From ecf95c662e4b48a82422b36a6f87d7ecd1077d8c Mon Sep 17 00:00:00 2001 From: Mohamed Hassen Mami Date: Fri, 4 Aug 2023 12:12:41 +0200 Subject: [PATCH] revert plan for camelotV3 to force fallback rpc --- src/dex/algebra/algebra.ts | 13 +++++++++++++ src/dex/algebra/config.ts | 1 + src/dex/algebra/types.ts | 1 + 3 files changed, 15 insertions(+) diff --git a/src/dex/algebra/algebra.ts b/src/dex/algebra/algebra.ts index 372c539a8..21e6b1c57 100644 --- a/src/dex/algebra/algebra.ts +++ b/src/dex/algebra/algebra.ts @@ -447,6 +447,18 @@ export class Algebra extends SimpleExchange implements IDex { 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) { @@ -769,6 +781,7 @@ export class Algebra extends SimpleExchange implements IDex { initHash: this.config.initHash, subgraphURL: this.config.subgraphURL, version: this.config.version, + forceRPC: this.config.forceRPC, }; return newConfig; } diff --git a/src/dex/algebra/config.ts b/src/dex/algebra/config.ts index d55b532fc..54aaab370 100644 --- a/src/dex/algebra/config.ts +++ b/src/dex/algebra/config.ts @@ -67,6 +67,7 @@ export const AlgebraConfig: DexConfigMap = { uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984', deployer: '0x6dd3fb9653b10e806650f107c3b5a0a6ff974f65', version: 'v1.9', + forceRPC: true, }, }, }; diff --git a/src/dex/algebra/types.ts b/src/dex/algebra/types.ts index 6543426d7..a7bee6493 100644 --- a/src/dex/algebra/types.ts +++ b/src/dex/algebra/types.ts @@ -69,6 +69,7 @@ export type DexParams = { subgraphURL: string; initHash: string; version: 'v1.1' | 'v1.9'; + forceRPC?: boolean; }; export type TickBitMapMappingsWithBigNumber = {