diff --git a/src/apps/abracadabra/common/abracadabra.bridged-staked-spell.token-fetcher.ts b/src/apps/abracadabra/common/abracadabra.bridged-staked-spell.token-fetcher.ts index 22c5089c1..295e245a0 100644 --- a/src/apps/abracadabra/common/abracadabra.bridged-staked-spell.token-fetcher.ts +++ b/src/apps/abracadabra/common/abracadabra.bridged-staked-spell.token-fetcher.ts @@ -1,5 +1,4 @@ import { Injectable } from '@nestjs/common'; -import axios from 'axios'; import { Erc20 } from '~contract/contracts/viem'; import { GetDataPropsParams } from '~position/template/app-token.template.types'; @@ -7,13 +6,6 @@ import { WrapperTemplateTokenFetcher } from '~position/template/wrapper.template @Injectable() export abstract class AbracadabraBridgedStakedSpellTokenFetcher extends WrapperTemplateTokenFetcher { - async getApy(): Promise { - const { data } = await axios.get<{ apr: number }>('/api/v1/ethereum/SpellStakingInfo', { - baseURL: 'https://analytics.back.popsicle.finance', - }); - return data.apr; - } - async getReserves({ appToken }: GetDataPropsParams) { const liquidity = appToken.supply * appToken.price; return [liquidity / appToken.tokens[0].price]; diff --git a/src/apps/beefy/common/beefy.vault.token-definition-resolver.ts b/src/apps/beefy/common/beefy.vault.token-definition-resolver.ts index 746e47e17..716597ec3 100644 --- a/src/apps/beefy/common/beefy.vault.token-definition-resolver.ts +++ b/src/apps/beefy/common/beefy.vault.token-definition-resolver.ts @@ -5,8 +5,6 @@ import { ZERO_ADDRESS } from '~app-toolkit/constants/address'; import { Cache } from '~cache/cache.decorator'; import { Network } from '~types/network.interface'; -type ApyData = Record; - type BeefyMarketResponse = { id: string; name: string; @@ -41,20 +39,8 @@ export class BeefyVaultTokenDefinitionsResolver { return vaultData; } - @Cache({ - key: `studio:beefy:vault-apy`, - ttl: 5 * 60, // 60 minutes - }) - private async getVaultApyData() { - const { data } = await Axios.get(`https://beefy-api.herokuapp.com/apy`); - return data; - } - async getVaultDefinitions(network: Network) { - const [definitionsDataRaw, apyData] = await Promise.all([ - this.getVaultDefinitionsData(network), - this.getVaultApyData(), - ]); + const definitionsDataRaw = await this.getVaultDefinitionsData(network); const vaultDefinitions = definitionsDataRaw.map(t => { const tokenAddress = t.tokenAddress?.toLowerCase() ?? ZERO_ADDRESS; // Beefy doesn't have the concept of ZERO address to represent ETH @@ -74,14 +60,9 @@ export class BeefyVaultTokenDefinitionsResolver { id: t.id, marketName: t.name, symbol: t.token, - apy: apyData[t.id] ?? 0, }; }); return vaultDefinitions; } - - async getVaultApys() { - return await this.getVaultApyData(); - } } diff --git a/src/apps/beefy/common/beefy.vault.token-fetcher.ts b/src/apps/beefy/common/beefy.vault.token-fetcher.ts index c7a33a31d..0011bc8f7 100644 --- a/src/apps/beefy/common/beefy.vault.token-fetcher.ts +++ b/src/apps/beefy/common/beefy.vault.token-fetcher.ts @@ -6,7 +6,6 @@ import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.te import { DefaultAppTokenDataProps, GetAddressesParams, - GetDataPropsParams, GetDisplayPropsParams, GetPricePerShareParams, GetTokenPropsParams, @@ -24,7 +23,6 @@ export type BeefyVaultTokenDefinition = { id: string; marketName: string; symbol: string; - apy: number; }; export abstract class BeefyVaultTokenFetcher extends AppTokenTemplatePositionFetcher< @@ -72,8 +70,4 @@ export abstract class BeefyVaultTokenFetcher extends AppTokenTemplatePositionFet async getLabel({ appToken }: GetDisplayPropsParams) { return `${getLabelFromToken(appToken.tokens[0])} Vault`; } - - getApy({ definition }: GetDataPropsParams) { - return Promise.resolve(definition.apy * 100); - } } diff --git a/src/apps/hedgefarm/avalanche/hedgefarm.alpha-two.token-fetcher.ts b/src/apps/hedgefarm/avalanche/hedgefarm.alpha-two.token-fetcher.ts index c3e344b2f..efc30f82a 100644 --- a/src/apps/hedgefarm/avalanche/hedgefarm.alpha-two.token-fetcher.ts +++ b/src/apps/hedgefarm/avalanche/hedgefarm.alpha-two.token-fetcher.ts @@ -1,12 +1,9 @@ import { Inject } from '@nestjs/common'; -import Axios from 'axios'; import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; -import { Performance } from '~apps/hedgefarm/avalanche/hedgefarm.types'; -import { CacheOnInterval } from '~cache/cache-on-interval.decorator'; import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher'; -import { GetDataPropsParams, GetPricePerShareParams } from '~position/template/app-token.template.types'; +import { GetPricePerShareParams } from '~position/template/app-token.template.types'; import { HedgefarmViemContractFactory } from '../contracts'; import { AlphaTwo } from '../contracts/viem'; @@ -37,19 +34,4 @@ export class AvalancheHedgefarmAlphaTwoTokenFetcher extends AppTokenTemplatePosi async getPricePerShare({ contract }: GetPricePerShareParams) { return [Number(await contract.read.lastUpdatedPricePerShare()) / 10 ** 8]; } - - async getApy(_params: GetDataPropsParams) { - const performance = await this.getPerformance(); - return performance.averageApy; - } - - @CacheOnInterval({ - key: `studio:hedgefarm:alpha-two:performance`, - timeout: 15 * 60 * 1000, - failOnMissingData: false, - }) - async getPerformance(): Promise { - const url = 'https://api.hedgefarm.workers.dev/alpha2/performance'; - return await Axios.get(url).then(v => v.data); - } } diff --git a/src/apps/openleverage/common/openleverage-pool.apy-helper.ts b/src/apps/openleverage/common/openleverage-pool.apy-helper.ts deleted file mode 100644 index 89d867f6a..000000000 --- a/src/apps/openleverage/common/openleverage-pool.apy-helper.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import Axios from 'axios'; - -import { CacheOnInterval } from '~cache/cache-on-interval.decorator'; - -@Injectable() -export class OpenleveragePoolAPYHelper { - @CacheOnInterval({ - key: `studio:openleverage:pool:openleverage-definitions-data`, - timeout: 5 * 60 * 1000, - failOnMissingData: false, - }) - async getApy() { - const poolDetailMap = {}; - const bnbEndpoint = `https://bnb.openleverage.finance/api/info/pool/apy`; - const ethEndpoint = `https://eth.openleverage.finance/api/info/pool/apy`; - const bnbData = await Axios.get(bnbEndpoint); - bnbData.data?.forEach(pool => { - poolDetailMap[pool.poolAddr] = { - lendingYieldY: pool.lendingYieldY, - token1Symbol: pool.token1Symbol, - }; - }); - - const ethData = await Axios.get(ethEndpoint); - ethData.data?.forEach(pool => { - poolDetailMap[pool.poolAddr] = { - lendingYieldY: pool.lendingYieldY, - token1Symbol: pool.token1Symbol, - }; - }); - return poolDetailMap; - } -} diff --git a/src/apps/openleverage/common/openleverage.pool.token-fetcher.ts b/src/apps/openleverage/common/openleverage.pool.token-fetcher.ts index 343140c5d..309aff916 100644 --- a/src/apps/openleverage/common/openleverage.pool.token-fetcher.ts +++ b/src/apps/openleverage/common/openleverage.pool.token-fetcher.ts @@ -8,15 +8,12 @@ import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.te import { GetUnderlyingTokensParams, GetPricePerShareParams, - GetDataPropsParams, GetDisplayPropsParams, } from '~position/template/app-token.template.types'; import { OpenleverageViemContractFactory } from '../contracts'; import { OpenleverageLpool } from '../contracts/viem'; -import { OpenleveragePoolAPYHelper } from './openleverage-pool.apy-helper'; - type OpenLeveragePoolsResponse = { pools: { id: string; @@ -36,8 +33,6 @@ export abstract class OpenleveragePoolTokenFetcher extends AppTokenTemplatePosit constructor( @Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit, - @Inject(OpenleveragePoolAPYHelper) - private readonly openleveragePoolAPYHelper: OpenleveragePoolAPYHelper, @Inject(OpenleverageViemContractFactory) protected readonly contractFactory: OpenleverageViemContractFactory, ) { super(appToolkit); @@ -66,13 +61,7 @@ export abstract class OpenleveragePoolTokenFetcher extends AppTokenTemplatePosit return [exchangeRate]; } - async getApy({ appToken }: GetDataPropsParams) { - const poolDetailMap = await this.openleveragePoolAPYHelper.getApy(); - return (poolDetailMap[appToken.address]?.lendingYieldY || 0) * 100; - } - async getLabel({ appToken }: GetDisplayPropsParams) { - const poolDetailMap = await this.openleveragePoolAPYHelper.getApy(); - return getLabelFromToken(appToken.tokens[0]) + '/' + poolDetailMap[appToken.address]?.token1Symbol; + return getLabelFromToken(appToken.tokens[0]); } } diff --git a/src/apps/openleverage/openleverage.module.ts b/src/apps/openleverage/openleverage.module.ts index f1f6aa82e..7f2c90f37 100644 --- a/src/apps/openleverage/openleverage.module.ts +++ b/src/apps/openleverage/openleverage.module.ts @@ -3,17 +3,14 @@ import { Module } from '@nestjs/common'; import { AbstractApp } from '~app/app.dynamic-module'; import { BinanceSmartChainOpenleveragePoolTokenFetcher } from './binance-smart-chain/openleverage.pool.token-fetcher'; -import { OpenleveragePoolAPYHelper } from './common/openleverage-pool.apy-helper'; import { OpenleverageViemContractFactory } from './contracts'; import { EthereumOpenleveragePoolTokenFetcher } from './ethereum/openleverage.pool.token-fetcher'; @Module({ providers: [ + OpenleverageViemContractFactory, EthereumOpenleveragePoolTokenFetcher, BinanceSmartChainOpenleveragePoolTokenFetcher, - - OpenleverageViemContractFactory, - OpenleveragePoolAPYHelper, ], }) export class OpenleverageAppModule extends AbstractApp() {}