From d5727e3451c95800ba91213da4366b2c8b4af2df Mon Sep 17 00:00:00 2001 From: Alexander Burkut Date: Fri, 29 Nov 2024 15:29:39 +0300 Subject: [PATCH] disable pooltracker --- src/dex/cables/cables.ts | 105 +++++++++++++++++++------------------ src/dex/dexalot/dexalot.ts | 51 +----------------- 2 files changed, 55 insertions(+), 101 deletions(-) diff --git a/src/dex/cables/cables.ts b/src/dex/cables/cables.ts index a015da3dc..03e102848 100644 --- a/src/dex/cables/cables.ts +++ b/src/dex/cables/cables.ts @@ -663,57 +663,60 @@ export class Cables extends SimpleExchange implements IDex { tokenAddress: Address, limit: number, ): Promise { - const tokens = (await this.getCachedTokens()) as { [key: string]: Token }; - const token = Object.values(tokens).find( - token => token.address.toLowerCase() === tokenAddress.toLowerCase(), - ); - - if (!token) { - return []; - } - - const tokenPriceUsd = await this.dexHelper.getTokenUSDPrice( - token, - BigInt(10 ** token.decimals), - ); - - const erc20BalanceCalldata = this.erc20Interface.encodeFunctionData( - 'balanceOf', - [this.mainnetRFQAddress], - ); - const tokenBalanceMultiCall = [ - { - target: token.address, - callData: erc20BalanceCalldata, - }, - ]; - const res = ( - await this.dexHelper.multiContract.methods - .aggregate(tokenBalanceMultiCall) - .call() - ).returnData[0]; - - let tokenLiquidity = BigInt(res); - - let tokenLiquidityUsd = - (tokenLiquidity * BigInt(tokenPriceUsd * 1_000_000)) / - BigInt(1_000_000 * 10 ** token.decimals); - - let tokenWithLiquidity = []; - - tokenWithLiquidity.push({ - exchange: this.dexKey, - address: this.mainnetRFQAddress, - connectorTokens: [ - { - address: token.address, - decimals: token.decimals, - }, - ], - liquidityUSD: Number(tokenLiquidityUsd), - }); - - return tokenWithLiquidity; + // const tokens = (await this.getCachedTokens()) as { [key: string]: Token }; + // const token = Object.values(tokens).find( + // token => token.address.toLowerCase() === tokenAddress.toLowerCase(), + // ); + // + // console.log('TOKEN: ', token); + // + // if (!token) { + // return []; + // } + // + // const tokenPriceUsd = await this.dexHelper.getTokenUSDPrice( + // token, + // BigInt(10 ** token.decimals), + // ); + // + // const erc20BalanceCalldata = this.erc20Interface.encodeFunctionData( + // 'balanceOf', + // [this.mainnetRFQAddress], + // ); + // + // const tokenBalanceMultiCall = [ + // { + // target: token.address, + // callData: erc20BalanceCalldata, + // }, + // ]; + // const res = ( + // await this.dexHelper.multiContract.methods + // .aggregate(tokenBalanceMultiCall) + // .call() + // ).returnData[0]; + // + // let tokenLiquidity = BigInt(res); + // + // let tokenLiquidityUsd = + // (tokenLiquidity * BigInt(tokenPriceUsd * 1_000_000)) / + // BigInt(1_000_000 * 10 ** token.decimals); + // + // let tokenWithLiquidity = []; + // + // tokenWithLiquidity.push({ + // exchange: this.dexKey, + // address: this.mainnetRFQAddress, + // connectorTokens: [ + // { + // address: token.address, + // decimals: token.decimals, + // }, + // ], + // liquidityUSD: Number(tokenLiquidityUsd), + // }); + // + // return tokenWithLiquidity; } /** diff --git a/src/dex/dexalot/dexalot.ts b/src/dex/dexalot/dexalot.ts index c27f7147a..3f4ff7869 100644 --- a/src/dex/dexalot/dexalot.ts +++ b/src/dex/dexalot/dexalot.ts @@ -1035,56 +1035,7 @@ export class Dexalot extends SimpleExchange implements IDex { tokenAddress: Address, limit: number, ): Promise { - const normalizedTokenAddress = this.normalizeAddress(tokenAddress); - const pairs = (await this.getCachedPairs()) || {}; - this.tokensMap = (await this.getCachedTokens()) || {}; - const tokensAddr = (await this.getCachedTokensAddr()) || {}; - const token = this.getTokenFromAddress(normalizedTokenAddress); - if (!token) { - return []; - } - - const tokenSymbol = token.symbol?.toLowerCase() || ''; - - let pairsByLiquidity = []; - for (const pairName of Object.keys(pairs)) { - if (!pairName.includes(tokenSymbol)) { - continue; - } - - const tokensInPair = pairName.split('/'); - if (tokensInPair.length !== 2) { - continue; - } - - const [baseToken, quoteToken] = tokensInPair; - const addr = tokensAddr[baseToken.toLowerCase()]; - let outputToken = this.getTokenFromAddress(addr); - if (baseToken === tokenSymbol) { - const addr = tokensAddr[quoteToken.toLowerCase()]; - outputToken = this.getTokenFromAddress(addr); - } - - const denormalizedToken = this.denormalizeToken(outputToken); - - pairsByLiquidity.push({ - exchange: this.dexKey, - address: this.mainnetRFQAddress, - connectorTokens: [ - { - address: denormalizedToken.address, - decimals: denormalizedToken.decimals, - }, - ], - liquidityUSD: pairs[pairName].liquidityUSD, - }); - } - - pairsByLiquidity.sort( - (a: PoolLiquidity, b: PoolLiquidity) => b.liquidityUSD - a.liquidityUSD, - ); - - return pairsByLiquidity.slice(0, limit); + return []; // not implemented } getAPIReqParams(endpoint: string, method: Method): DexalotAPIParameters {