Skip to content

Commit

Permalink
Merge pull request #457 from paraswap/fix/camelotv3-revert-to-rpc
Browse files Browse the repository at this point in the history
BACK-1232: Camelotv3 revert to RPC
  • Loading branch information
Verisana authored Aug 16, 2023
2 parents bcda72d + 4cf417c commit d15f3d5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paraswap/dex-lib",
"version": "2.28.8",
"version": "2.28.9",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
13 changes: 13 additions & 0 deletions src/dex/algebra/algebra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,18 @@ export class Algebra extends SimpleExchange implements IDex<AlgebraData> {

if (!pool) return null;

if (this.config.forceRPC) {
const rpcPrice = await this.getPricingFromRpc(
_srcToken,
_destToken,
amounts,
side,
pool,
);

return rpcPrice;
}

let state = pool.getState(blockNumber);

if (state === null) {
Expand Down Expand Up @@ -773,6 +785,7 @@ export class Algebra extends SimpleExchange implements IDex<AlgebraData> {
initHash: this.config.initHash,
subgraphURL: this.config.subgraphURL,
version: this.config.version,
forceRPC: this.config.forceRPC,
};
return newConfig;
}
Expand Down
1 change: 1 addition & 0 deletions src/dex/algebra/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const AlgebraConfig: DexConfigMap<DexParams> = {
uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
deployer: '0x6dd3fb9653b10e806650f107c3b5a0a6ff974f65',
version: 'v1.9',
forceRPC: true,
},
},
};
Expand Down
1 change: 1 addition & 0 deletions src/dex/algebra/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export type DexParams = {
subgraphURL: string;
initHash: string;
version: 'v1.1' | 'v1.9';
forceRPC?: boolean;
};

export type IAlgebraPoolState = PoolStateV1_1 | PoolState_v1_9;
Expand Down

0 comments on commit d15f3d5

Please sign in to comment.