From 43d362716447914a855f9ca733ca8214b0f83a4a Mon Sep 17 00:00:00 2001 From: William Poulin Date: Thu, 9 Nov 2023 14:25:54 -0500 Subject: [PATCH] feat(wombat-exchange): Add new pools --- .../wombat-exchange.pool.token-fetcher.ts | 23 ++++--------- .../wombat-exchange.pool.token-fetcher.ts | 33 +++++++++---------- .../wombat-exchange.pool.token-fetcher.ts | 16 ++++++++- 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/apps/wombat-exchange/arbitrum/wombat-exchange.pool.token-fetcher.ts b/src/apps/wombat-exchange/arbitrum/wombat-exchange.pool.token-fetcher.ts index d264483af..8c7bd0434 100644 --- a/src/apps/wombat-exchange/arbitrum/wombat-exchange.pool.token-fetcher.ts +++ b/src/apps/wombat-exchange/arbitrum/wombat-exchange.pool.token-fetcher.ts @@ -1,10 +1,6 @@ -import BigNumber from 'bignumber.js'; - import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; -import { GetPricePerShareParams } from '~position/template/app-token.template.types'; import { WombatExchangePoolTokenFetcher } from '../common/wombat-exchange.pool.token-fetcher'; -import { WombatExchangePoolToken } from '../contracts'; @PositionTemplate() export class ArbitrumWombatExchangePoolTokenFetcher extends WombatExchangePoolTokenFetcher { @@ -19,17 +15,12 @@ export class ArbitrumWombatExchangePoolTokenFetcher extends WombatExchangePoolTo '0xee9b42b40852a53c7361f527e638b485d49750cd', // wmxWOM Pool '0x12fa5ab079cff564d599466d39715d35d90af978', // qWOM Pool '0x4a8686df475d4c44324210ffa3fc1dea705296e0', // FRAX-MAI-USD Pool + '0xe78876c360716f2225f55a6726b32324fe1b1145', // Cross Chain Pool + '0x20d7ee728900848752fa280fad51af40c47302f1', // frxETH Pool + '0xe14302040c0a1eb6fb5a4a79efa46d60029358d9', // wstETH Pool + '0xb9bdfe449da096256fe7954ef61a18ee195db77b', // ankrETH Pool + '0xc7a6ba5f28993badb566007bd2e0cb253c431974', // jUSDC Pool + '0x956454c7be9318863297309183c79b793d370401', // fUSDC Pool + '0xe7159f15e7b1d6045506b228a1ed2136dcc56f48', // mPENDLE Pool ]; - - async getPricePerShare({ contract, multicall, appToken }: GetPricePerShareParams) { - const poolAddress = await contract.pool(); - const _pool = this.contractFactory.wombatExchangePool({ address: poolAddress, network: this.network }); - const pool = multicall.wrap(_pool); - - const amount = new BigNumber(10).pow(18).toFixed(0); - - const pricePerShareRaw = await pool.quotePotentialWithdraw(appToken.tokens[0].address, amount); - const pricePerShare = Number(pricePerShareRaw.amount) / 10 ** appToken.tokens[0].decimals; - return [pricePerShare]; - } } diff --git a/src/apps/wombat-exchange/binance-smart-chain/wombat-exchange.pool.token-fetcher.ts b/src/apps/wombat-exchange/binance-smart-chain/wombat-exchange.pool.token-fetcher.ts index 8d0cc3982..9a462ac0c 100644 --- a/src/apps/wombat-exchange/binance-smart-chain/wombat-exchange.pool.token-fetcher.ts +++ b/src/apps/wombat-exchange/binance-smart-chain/wombat-exchange.pool.token-fetcher.ts @@ -1,10 +1,6 @@ -import BigNumber from 'bignumber.js'; - import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; -import { GetPricePerShareParams } from '~position/template/app-token.template.types'; import { WombatExchangePoolTokenFetcher } from '../common/wombat-exchange.pool.token-fetcher'; -import { WombatExchangePoolToken } from '../contracts'; @PositionTemplate() export class BinanceSmartChainWombatExchangePoolTokenFetcher extends WombatExchangePoolTokenFetcher { @@ -12,7 +8,7 @@ export class BinanceSmartChainWombatExchangePoolTokenFetcher extends WombatExcha poolAddresses = [ '0x312bc7eaaf93f1c60dc5afc115fccde161055fb0', // MAIN POOL - '0x0520451b19ad0bb00ed35ef391086a692cfc74b2', // HAY Pool + '0x0520451b19ad0bb00ed35ef391086a692cfc74b2', // Smart HAY Pool '0x0029b7e8e9ed8001c868aa09c74a1ac6269d4183', // BNB Pool '0x48f6a8a0158031baf8ce3e45344518f1e69f2a14', // FRAX Pool '0xeeb5a751e0f5231fc21c7415c4a4c6764f67ce2e', // wmxWOM Pool @@ -25,18 +21,19 @@ export class BinanceSmartChainWombatExchangePoolTokenFetcher extends WombatExcha '0x8ad47d7ab304272322513ee63665906b64a49da2', // axlUSDC Pool '0x05f727876d7c123b9bb41507251e2afd81ead09a', // USDD Pool '0xea6cdd9e8819bbf7f8791e7d084d9f0a6afa7892', // BOB Pool - '0x9498563e47d7cfdfa22b818bb8112781036c201c', // Overnight Pool + '0x9498563e47d7cfdfa22b818bb8112781036c201c', // Stable Guild Pool + '0x6569ddc1cc2648c89bc8025046a7dd65eb8940f3', // Deprecated + '0x1ee15673e07105bcf360139fa8cafebdd7754bef', // Cross chain Pool + '0x2ea772346486972e7690219c190dadda40ac5da4', // frxETH Pool + '0xb8b1b72a9b9ba90e2539348fec1ad6b265f9f684', // MIM Pool + '0x6f1c689235580341562cdc3304e923cc8fad5bfa', // ankrBNB Pool + '0xbed9b758a681d73a95ab4c01309c63aa16297b80', // BNBy Pool + '0x8b892b6ea1d0e5b29b719d6bd6eb9354f1cde060', // wBETH Pool + '0x1b507b97c89ede3e40d1b2ed92972197c6276d35', // ankrETH Pool + '0xf1e604e9a31c3b575f91cf008445b7ce06bf3fef', // snBNB Pool + '0x0592083b285aa75b9c8bad2485c6cccf93ccc348', // rBNB Pool + '0x0c735f84bd7eda8f8176236091af8068bb6c41de', // USDS Pool + '0x9a39f4ab3f52026432835dee6d3db721d95f3d28', // zBNB Pool + '0xc26b7cbe7e695a0d11a8cb96140d1cd502945a2c', // zUSD Pool ]; - - async getPricePerShare({ contract, multicall, appToken }: GetPricePerShareParams) { - const poolAddress = await contract.pool(); - const _pool = this.contractFactory.wombatExchangePool({ address: poolAddress, network: this.network }); - const pool = multicall.wrap(_pool); - - const amount = new BigNumber(10).pow(appToken.tokens[0].decimals).toFixed(0); - - const pricePerShareRaw = await pool.quotePotentialWithdraw(appToken.tokens[0].address, amount); - const pricePerShare = Number(pricePerShareRaw.amount) / 10 ** appToken.decimals; - return [pricePerShare]; - } } diff --git a/src/apps/wombat-exchange/common/wombat-exchange.pool.token-fetcher.ts b/src/apps/wombat-exchange/common/wombat-exchange.pool.token-fetcher.ts index 4cfa4aaf6..d8788e843 100644 --- a/src/apps/wombat-exchange/common/wombat-exchange.pool.token-fetcher.ts +++ b/src/apps/wombat-exchange/common/wombat-exchange.pool.token-fetcher.ts @@ -3,7 +3,11 @@ import { uniq } from 'lodash'; import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher'; -import { GetAddressesParams, GetUnderlyingTokensParams } from '~position/template/app-token.template.types'; +import { + GetAddressesParams, + GetPricePerShareParams, + GetUnderlyingTokensParams, +} from '~position/template/app-token.template.types'; import { WombatExchangePoolToken, WombatExchangeContractFactory } from '../contracts'; @@ -40,4 +44,14 @@ export abstract class WombatExchangePoolTokenFetcher extends AppTokenTemplatePos async getUnderlyingTokenDefinitions({ contract }: GetUnderlyingTokensParams) { return [{ address: await contract.underlyingToken(), network: this.network }]; } + + async getPricePerShare({ contract, multicall, appToken }: GetPricePerShareParams) { + const poolAddress = await contract.pool(); + const _pool = this.contractFactory.wombatExchangePool({ address: poolAddress, network: this.network }); + const pool = multicall.wrap(_pool); + + const pricePerShareRaw = await pool.exchangeRate(appToken.tokens[0].address); + const pricePerShare = Number(pricePerShareRaw) / 10 ** appToken.decimals; + return [pricePerShare]; + } }