From 548055fea2910bc05c33997747f4b4a4a7bc5fe5 Mon Sep 17 00:00:00 2001 From: William Poulin Date: Tue, 14 Jun 2022 09:24:39 -0400 Subject: [PATCH] feat(curve): Added liquidity data prop and enabled TVL (#603) Co-authored-by: immasandwich --- .../curve/arbitrum/curve.balance-fetcher.ts | 8 +++++--- .../curve/arbitrum/curve.pool.token-fetcher.ts | 2 +- .../curve/avalanche/curve.balance-fetcher.ts | 8 +++++--- .../avalanche/curve.pool.token-fetcher.ts | 2 +- src/apps/curve/curve.definition.ts | 4 ++-- .../curve/ethereum/curve.pool.token-fetcher.ts | 10 +++++----- ...vesting-escrow.contract-position-fetcher.ts | 11 +++++------ ....voting-escrow.contract-position-fetcher.ts | 11 +++++------ src/apps/curve/fantom/curve.balance-fetcher.ts | 8 +++++--- .../curve/fantom/curve.pool.token-fetcher.ts | 2 +- src/apps/curve/gnosis/curve.balance-fetcher.ts | 8 +++++--- .../curve/gnosis/curve.pool.token-fetcher.ts | 2 +- .../curve/harmony/curve.balance-fetcher.ts | 8 +++++--- .../curve/harmony/curve.pool.token-fetcher.ts | 2 +- ....vesting-escrow.contract-position-helper.ts | 18 +++++++++++++++--- ...e.voting-escrow.contract-position-helper.ts | 15 +++++++++++++-- .../curve/optimism/curve.balance-fetcher.ts | 8 +++++--- .../curve/optimism/curve.pool.token-fetcher.ts | 2 +- .../curve/polygon/curve.balance-fetcher.ts | 8 +++++--- .../curve/polygon/curve.pool.token-fetcher.ts | 2 +- 20 files changed, 87 insertions(+), 52 deletions(-) diff --git a/src/apps/curve/arbitrum/curve.balance-fetcher.ts b/src/apps/curve/arbitrum/curve.balance-fetcher.ts index cd3b7781e..de28a81dd 100644 --- a/src/apps/curve/arbitrum/curve.balance-fetcher.ts +++ b/src/apps/curve/arbitrum/curve.balance-fetcher.ts @@ -10,6 +10,8 @@ import { Network } from '~types/network.interface'; import { CurveChildLiquidityGauge, CurveContractFactory, CurveRewardsOnlyGauge } from '../contracts'; import { CURVE_DEFINITION } from '../curve.definition'; +const network = Network.ARBITRUM_MAINNET; + @Register.BalanceFetcher(CURVE_DEFINITION.id, Network.ARBITRUM_MAINNET) export class ArbitrumCurveBalanceFetcher implements BalanceFetcher { constructor( @@ -19,7 +21,7 @@ export class ArbitrumCurveBalanceFetcher implements BalanceFetcher { private async getPoolTokenBalances(address: string) { return this.appToolkit.helpers.tokenBalanceHelper.getTokenBalances({ - network: Network.ARBITRUM_MAINNET, + network, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.pool.id, address, @@ -31,7 +33,7 @@ export class ArbitrumCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.ARBITRUM_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'rewards-only-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveRewardsOnlyGauge({ address, network }), resolveStakedTokenBalance: ({ contract, address, multicall }) => multicall.wrap(contract).balanceOf(address), @@ -48,7 +50,7 @@ export class ArbitrumCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.ARBITRUM_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'child-liquidity-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveChildLiquidityGauge({ address, network }), diff --git a/src/apps/curve/arbitrum/curve.pool.token-fetcher.ts b/src/apps/curve/arbitrum/curve.pool.token-fetcher.ts index efeb26222..d74b1e4f3 100644 --- a/src/apps/curve/arbitrum/curve.pool.token-fetcher.ts +++ b/src/apps/curve/arbitrum/curve.pool.token-fetcher.ts @@ -16,7 +16,7 @@ const appId = CURVE_DEFINITION.id; const groupId = CURVE_DEFINITION.groups.pool.id; const network = Network.ARBITRUM_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network }) +@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class ArbitrumCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveV1PoolTokenHelper) diff --git a/src/apps/curve/avalanche/curve.balance-fetcher.ts b/src/apps/curve/avalanche/curve.balance-fetcher.ts index 736742852..f0729f830 100644 --- a/src/apps/curve/avalanche/curve.balance-fetcher.ts +++ b/src/apps/curve/avalanche/curve.balance-fetcher.ts @@ -10,6 +10,8 @@ import { Network } from '~types/network.interface'; import { CurveChildLiquidityGauge, CurveContractFactory, CurveRewardsOnlyGauge } from '../contracts'; import { CURVE_DEFINITION } from '../curve.definition'; +const network = Network.AVALANCHE_MAINNET; + @Register.BalanceFetcher(CURVE_DEFINITION.id, Network.AVALANCHE_MAINNET) export class AvalancheCurveBalanceFetcher implements BalanceFetcher { constructor( @@ -19,7 +21,7 @@ export class AvalancheCurveBalanceFetcher implements BalanceFetcher { private async getPoolTokenBalances(address: string) { return this.appToolkit.helpers.tokenBalanceHelper.getTokenBalances({ - network: Network.AVALANCHE_MAINNET, + network, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.pool.id, address, @@ -31,7 +33,7 @@ export class AvalancheCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.AVALANCHE_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'rewards-only-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveRewardsOnlyGauge({ address, network }), resolveStakedTokenBalance: ({ contract, address, multicall }) => multicall.wrap(contract).balanceOf(address), @@ -48,7 +50,7 @@ export class AvalancheCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.AVALANCHE_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'child-liquidity-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveChildLiquidityGauge({ address, network }), diff --git a/src/apps/curve/avalanche/curve.pool.token-fetcher.ts b/src/apps/curve/avalanche/curve.pool.token-fetcher.ts index 165e4808a..1652586f2 100644 --- a/src/apps/curve/avalanche/curve.pool.token-fetcher.ts +++ b/src/apps/curve/avalanche/curve.pool.token-fetcher.ts @@ -16,7 +16,7 @@ const appId = CURVE_DEFINITION.id; const groupId = CURVE_DEFINITION.groups.pool.id; const network = Network.AVALANCHE_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network }) +@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class AvalancheCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveV1PoolTokenHelper) diff --git a/src/apps/curve/curve.definition.ts b/src/apps/curve/curve.definition.ts index 4b897fb87..583f99c47 100644 --- a/src/apps/curve/curve.definition.ts +++ b/src/apps/curve/curve.definition.ts @@ -17,8 +17,8 @@ export const CURVE_DEFINITION = appDefinition({ groups: { farm: { id: 'farm', type: GroupType.POSITION, label: 'Staking', groupLabel: 'Farms' }, pool: { id: 'pool', type: GroupType.TOKEN, label: 'Pools' }, - votingEscrow: { id: 'votingEscrow', type: GroupType.POSITION, label: 'Voting Escrow' }, - vestingEscrow: { id: 'vestingEscrow', type: GroupType.POSITION, label: 'Vesting' }, + votingEscrow: { id: 'voting-escrow', type: GroupType.POSITION, label: 'Voting Escrow' }, + vestingEscrow: { id: 'vesting-escrow', type: GroupType.POSITION, label: 'Vesting' }, }, tags: [AppTag.LIQUIDITY_POOL], supportedNetworks: { diff --git a/src/apps/curve/ethereum/curve.pool.token-fetcher.ts b/src/apps/curve/ethereum/curve.pool.token-fetcher.ts index d2563b06b..fee4a2257 100644 --- a/src/apps/curve/ethereum/curve.pool.token-fetcher.ts +++ b/src/apps/curve/ethereum/curve.pool.token-fetcher.ts @@ -25,7 +25,7 @@ const appId = CURVE_DEFINITION.id; const groupId = CURVE_DEFINITION.groups.pool.id; const network = Network.ETHEREUM_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network }) +@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class EthereumCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveV1PoolTokenHelper) @@ -67,7 +67,7 @@ export class EthereumCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveVestingEscrowContractPositionHelper) @@ -21,7 +21,6 @@ export class EthereumCurveVestingEscrowContractPositionFetcher implements Positi ) {} async getPositions() { - const network = Network.ETHEREUM_MAINNET; return this.curveVestingEscrowContractPositionHelper.getContractPositions({ vestingEscrowAddress: '0x575ccd8e2d300e2377b43478339e364000318e2c', appId: CURVE_DEFINITION.id, diff --git a/src/apps/curve/ethereum/curve.voting-escrow.contract-position-fetcher.ts b/src/apps/curve/ethereum/curve.voting-escrow.contract-position-fetcher.ts index d761c6862..d286766a9 100644 --- a/src/apps/curve/ethereum/curve.voting-escrow.contract-position-fetcher.ts +++ b/src/apps/curve/ethereum/curve.voting-escrow.contract-position-fetcher.ts @@ -9,11 +9,11 @@ import { CurveVotingEscrow, CurveVotingEscrowReward } from '../contracts'; import { CURVE_DEFINITION } from '../curve.definition'; import { CurveVotingEscrowContractPositionHelper } from '../helpers/curve.voting-escrow.contract-position-helper'; -@Register.ContractPositionFetcher({ - appId: CURVE_DEFINITION.id, - groupId: CURVE_DEFINITION.groups.votingEscrow.id, - network: Network.ETHEREUM_MAINNET, -}) +const appId = CURVE_DEFINITION.id; +const groupId = CURVE_DEFINITION.groups.votingEscrow.id; +const network = Network.ETHEREUM_MAINNET; + +@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class EthereumCurveVotingEscrowContractPositionFetcher implements PositionFetcher { constructor( @Inject(CurveVotingEscrowContractPositionHelper) @@ -21,7 +21,6 @@ export class EthereumCurveVotingEscrowContractPositionFetcher implements Positio ) {} async getPositions() { - const network = Network.ETHEREUM_MAINNET; return this.curveVotingEscrowContractPositionHelper.getContractPositions< CurveVotingEscrow, CurveVotingEscrowReward diff --git a/src/apps/curve/fantom/curve.balance-fetcher.ts b/src/apps/curve/fantom/curve.balance-fetcher.ts index 8f0b6f2b0..6a80e40ac 100644 --- a/src/apps/curve/fantom/curve.balance-fetcher.ts +++ b/src/apps/curve/fantom/curve.balance-fetcher.ts @@ -10,6 +10,8 @@ import { Network } from '~types/network.interface'; import { CurveChildLiquidityGauge, CurveContractFactory, CurveRewardsOnlyGauge } from '../contracts'; import { CURVE_DEFINITION } from '../curve.definition'; +const network = Network.FANTOM_OPERA_MAINNET; + @Register.BalanceFetcher(CURVE_DEFINITION.id, Network.FANTOM_OPERA_MAINNET) export class FantomCurveBalanceFetcher implements BalanceFetcher { constructor( @@ -19,7 +21,7 @@ export class FantomCurveBalanceFetcher implements BalanceFetcher { private async getPoolTokenBalances(address: string) { return this.appToolkit.helpers.tokenBalanceHelper.getTokenBalances({ - network: Network.FANTOM_OPERA_MAINNET, + network, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.pool.id, address, @@ -31,7 +33,7 @@ export class FantomCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.FANTOM_OPERA_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'rewards-only-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveRewardsOnlyGauge({ address, network }), resolveStakedTokenBalance: ({ contract, address, multicall }) => multicall.wrap(contract).balanceOf(address), @@ -48,7 +50,7 @@ export class FantomCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.FANTOM_OPERA_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'child-liquidity-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveChildLiquidityGauge({ address, network }), diff --git a/src/apps/curve/fantom/curve.pool.token-fetcher.ts b/src/apps/curve/fantom/curve.pool.token-fetcher.ts index 44e85c32a..6621991f0 100644 --- a/src/apps/curve/fantom/curve.pool.token-fetcher.ts +++ b/src/apps/curve/fantom/curve.pool.token-fetcher.ts @@ -20,7 +20,7 @@ const appId = CURVE_DEFINITION.id; const groupId = CURVE_DEFINITION.groups.pool.id; const network = Network.FANTOM_OPERA_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network }) +@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class FantomCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveV1PoolTokenHelper) diff --git a/src/apps/curve/gnosis/curve.balance-fetcher.ts b/src/apps/curve/gnosis/curve.balance-fetcher.ts index 455d9c7f0..a0ad12318 100644 --- a/src/apps/curve/gnosis/curve.balance-fetcher.ts +++ b/src/apps/curve/gnosis/curve.balance-fetcher.ts @@ -10,6 +10,8 @@ import { Network } from '~types/network.interface'; import { CurveChildLiquidityGauge, CurveContractFactory, CurveRewardsOnlyGauge } from '../contracts'; import { CURVE_DEFINITION } from '../curve.definition'; +const network = Network.GNOSIS_MAINNET; + @Register.BalanceFetcher(CURVE_DEFINITION.id, Network.GNOSIS_MAINNET) export class GnosisCurveBalanceFetcher implements BalanceFetcher { constructor( @@ -19,7 +21,7 @@ export class GnosisCurveBalanceFetcher implements BalanceFetcher { private async getPoolTokenBalances(address: string) { return this.appToolkit.helpers.tokenBalanceHelper.getTokenBalances({ - network: Network.GNOSIS_MAINNET, + network, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.pool.id, address, @@ -31,7 +33,7 @@ export class GnosisCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.GNOSIS_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'rewards-only-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveRewardsOnlyGauge({ address, network }), resolveStakedTokenBalance: ({ contract, address, multicall }) => multicall.wrap(contract).balanceOf(address), @@ -48,7 +50,7 @@ export class GnosisCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.GNOSIS_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'child-liquidity-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveChildLiquidityGauge({ address, network }), diff --git a/src/apps/curve/gnosis/curve.pool.token-fetcher.ts b/src/apps/curve/gnosis/curve.pool.token-fetcher.ts index 1f0395644..1f1476e10 100644 --- a/src/apps/curve/gnosis/curve.pool.token-fetcher.ts +++ b/src/apps/curve/gnosis/curve.pool.token-fetcher.ts @@ -14,7 +14,7 @@ const appId = CURVE_DEFINITION.id; const groupId = CURVE_DEFINITION.groups.pool.id; const network = Network.GNOSIS_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network }) +@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class GnosisCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveV1PoolTokenHelper) diff --git a/src/apps/curve/harmony/curve.balance-fetcher.ts b/src/apps/curve/harmony/curve.balance-fetcher.ts index 52c1db79d..d346b93e0 100644 --- a/src/apps/curve/harmony/curve.balance-fetcher.ts +++ b/src/apps/curve/harmony/curve.balance-fetcher.ts @@ -10,6 +10,8 @@ import { Network } from '~types/network.interface'; import { CurveChildLiquidityGauge, CurveContractFactory, CurveRewardsOnlyGauge } from '../contracts'; import { CURVE_DEFINITION } from '../curve.definition'; +const network = Network.HARMONY_MAINNET; + @Register.BalanceFetcher(CURVE_DEFINITION.id, Network.HARMONY_MAINNET) export class HarmonyCurveBalanceFetcher implements BalanceFetcher { constructor( @@ -19,7 +21,7 @@ export class HarmonyCurveBalanceFetcher implements BalanceFetcher { private async getPoolTokenBalances(address: string) { return this.appToolkit.helpers.tokenBalanceHelper.getTokenBalances({ - network: Network.HARMONY_MAINNET, + network, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.pool.id, address, @@ -31,7 +33,7 @@ export class HarmonyCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.HARMONY_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'rewards-only-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveRewardsOnlyGauge({ address, network }), resolveStakedTokenBalance: ({ contract, address, multicall }) => multicall.wrap(contract).balanceOf(address), @@ -48,7 +50,7 @@ export class HarmonyCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.HARMONY_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'child-liquidity-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveChildLiquidityGauge({ address, network }), diff --git a/src/apps/curve/harmony/curve.pool.token-fetcher.ts b/src/apps/curve/harmony/curve.pool.token-fetcher.ts index c90dce4d0..b958ceadb 100644 --- a/src/apps/curve/harmony/curve.pool.token-fetcher.ts +++ b/src/apps/curve/harmony/curve.pool.token-fetcher.ts @@ -15,7 +15,7 @@ const appId = CURVE_DEFINITION.id; const groupId = CURVE_DEFINITION.groups.pool.id; const network = Network.HARMONY_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network }) +@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class HarmonyCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveV1PoolTokenHelper) diff --git a/src/apps/curve/helpers/curve.vesting-escrow.contract-position-helper.ts b/src/apps/curve/helpers/curve.vesting-escrow.contract-position-helper.ts index c3893b196..473b0e79f 100644 --- a/src/apps/curve/helpers/curve.vesting-escrow.contract-position-helper.ts +++ b/src/apps/curve/helpers/curve.vesting-escrow.contract-position-helper.ts @@ -45,13 +45,25 @@ export class CurveVestingEscrowContractPositionHelper { const escrowedToken = baseTokens.find(v => v.address === escrowedTokenAddress)!; const tokens = [claimable(escrowedToken), vesting(escrowedToken)]; + const escrowedTokenContract = this.contractFactory.erc20({ address: escrowedToken.address, network }); + const balanceOfRaw = await multicall.wrap(escrowedTokenContract).balanceOf(vestingEscrowAddress); + const balanceOf = Number(balanceOfRaw) / 10 ** escrowedToken.decimals; + const liquidity = balanceOf * escrowedToken.price; + // Display Props const label = `Vesting Escrow ${escrowedToken.symbol}`; const secondaryLabel = buildDollarDisplayItem(escrowedToken.price); const images = [getTokenImg(escrowedToken.address, network)]; - const statsItems = []; + const statsItems = [ + { + label: 'Liquidity', + value: buildDollarDisplayItem(liquidity), + }, + ]; - const dataProps = {}; + const dataProps = { + liquidity, + }; const displayProps = { label, secondaryLabel, images, statsItems }; const contractPosition: ContractPosition = { @@ -60,9 +72,9 @@ export class CurveVestingEscrowContractPositionHelper { appId, groupId, network, + tokens, dataProps, displayProps, - tokens, }; return [contractPosition]; diff --git a/src/apps/curve/helpers/curve.voting-escrow.contract-position-helper.ts b/src/apps/curve/helpers/curve.voting-escrow.contract-position-helper.ts index d07c6e4d2..d8e95ba40 100644 --- a/src/apps/curve/helpers/curve.voting-escrow.contract-position-helper.ts +++ b/src/apps/curve/helpers/curve.voting-escrow.contract-position-helper.ts @@ -14,6 +14,7 @@ import { CurveContractFactory as ContractFactory } from '../contracts'; export type CurveVotingEscrowContractPositionDataProps = { rewardAddress?: string; + liquidity: number; }; type CurveVotingEscrowContractPositionHelperParams = { @@ -60,8 +61,13 @@ export class CurveVotingEscrowContractPositionHelper { const escrowedToken = allTokens.find(v => v.address === escrowedTokenAddress); if (!escrowedToken) return []; + const escrowedTokenContract = this.contractFactory.erc20({ address: escrowedToken.address, network }); + const balanceOfRaw = await multicall.wrap(escrowedTokenContract).balanceOf(votingEscrowAddress); + const balanceOf = Number(balanceOfRaw) / 10 ** escrowedToken.decimals; + const liquidity = balanceOf * escrowedToken.price; + const tokens = [supplied(escrowedToken)]; - const dataProps: CurveVotingEscrowContractPositionDataProps = {}; + const dataProps: CurveVotingEscrowContractPositionDataProps = { liquidity }; // Resolve reward token if applicable if (resolveRewardContract && resolveRewardTokenAddress) { @@ -77,7 +83,12 @@ export class CurveVotingEscrowContractPositionHelper { const label = `Voting Escrow ${getLabelFromToken(escrowedToken)}`; const secondaryLabel = buildDollarDisplayItem(escrowedToken.price); const images = getImagesFromToken(escrowedToken); - const statsItems = []; + const statsItems = [ + { + label: 'Liquidity', + value: buildDollarDisplayItem(liquidity), + }, + ]; const displayProps = { label, secondaryLabel, images, statsItems }; const contractPosition: ContractPosition = { diff --git a/src/apps/curve/optimism/curve.balance-fetcher.ts b/src/apps/curve/optimism/curve.balance-fetcher.ts index 3858719e4..a108a6c8f 100644 --- a/src/apps/curve/optimism/curve.balance-fetcher.ts +++ b/src/apps/curve/optimism/curve.balance-fetcher.ts @@ -10,6 +10,8 @@ import { Network } from '~types/network.interface'; import { CurveChildLiquidityGauge, CurveContractFactory, CurveRewardsOnlyGauge } from '../contracts'; import { CURVE_DEFINITION } from '../curve.definition'; +const network = Network.OPTIMISM_MAINNET; + @Register.BalanceFetcher(CURVE_DEFINITION.id, Network.OPTIMISM_MAINNET) export class OptimismCurveBalanceFetcher implements BalanceFetcher { constructor( @@ -19,7 +21,7 @@ export class OptimismCurveBalanceFetcher implements BalanceFetcher { private async getPoolTokenBalances(address: string) { return this.appToolkit.helpers.tokenBalanceHelper.getTokenBalances({ - network: Network.OPTIMISM_MAINNET, + network, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.pool.id, address, @@ -31,7 +33,7 @@ export class OptimismCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.OPTIMISM_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'rewards-only-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveRewardsOnlyGauge({ address, network }), resolveStakedTokenBalance: ({ contract, address, multicall }) => multicall.wrap(contract).balanceOf(address), @@ -48,7 +50,7 @@ export class OptimismCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.OPTIMISM_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'child-liquidity-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveChildLiquidityGauge({ address, network }), diff --git a/src/apps/curve/optimism/curve.pool.token-fetcher.ts b/src/apps/curve/optimism/curve.pool.token-fetcher.ts index 30932c06a..4a791840e 100644 --- a/src/apps/curve/optimism/curve.pool.token-fetcher.ts +++ b/src/apps/curve/optimism/curve.pool.token-fetcher.ts @@ -15,7 +15,7 @@ const appId = CURVE_DEFINITION.id; const groupId = CURVE_DEFINITION.groups.pool.id; const network = Network.OPTIMISM_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network }) +@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class OptimismCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveV1PoolTokenHelper) diff --git a/src/apps/curve/polygon/curve.balance-fetcher.ts b/src/apps/curve/polygon/curve.balance-fetcher.ts index c1230dc79..6f3aa2d13 100644 --- a/src/apps/curve/polygon/curve.balance-fetcher.ts +++ b/src/apps/curve/polygon/curve.balance-fetcher.ts @@ -10,6 +10,8 @@ import { Network } from '~types/network.interface'; import { CurveChildLiquidityGauge, CurveContractFactory, CurveRewardsOnlyGauge } from '../contracts'; import { CURVE_DEFINITION } from '../curve.definition'; +const network = Network.POLYGON_MAINNET; + @Register.BalanceFetcher(CURVE_DEFINITION.id, Network.POLYGON_MAINNET) export class PolygonCurveBalanceFetcher implements BalanceFetcher { constructor( @@ -19,7 +21,7 @@ export class PolygonCurveBalanceFetcher implements BalanceFetcher { private async getPoolTokenBalances(address: string) { return this.appToolkit.helpers.tokenBalanceHelper.getTokenBalances({ - network: Network.POLYGON_MAINNET, + network, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.pool.id, address, @@ -31,7 +33,7 @@ export class PolygonCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.POLYGON_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'rewards-only-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveRewardsOnlyGauge({ address, network }), resolveStakedTokenBalance: ({ contract, address, multicall }) => multicall.wrap(contract).balanceOf(address), @@ -48,7 +50,7 @@ export class PolygonCurveBalanceFetcher implements BalanceFetcher { address, appId: CURVE_DEFINITION.id, groupId: CURVE_DEFINITION.groups.farm.id, - network: Network.POLYGON_MAINNET, + network, farmFilter: v => v.dataProps.implementation === 'child-liquidity-gauge', resolveContract: ({ address, network }) => this.curveContractFactory.curveChildLiquidityGauge({ address, network }), diff --git a/src/apps/curve/polygon/curve.pool.token-fetcher.ts b/src/apps/curve/polygon/curve.pool.token-fetcher.ts index 26a865361..188d9cbd0 100644 --- a/src/apps/curve/polygon/curve.pool.token-fetcher.ts +++ b/src/apps/curve/polygon/curve.pool.token-fetcher.ts @@ -15,7 +15,7 @@ const appId = CURVE_DEFINITION.id; const groupId = CURVE_DEFINITION.groups.pool.id; const network = Network.POLYGON_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network }) +@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) export class PolygonCurvePoolTokenFetcher implements PositionFetcher { constructor( @Inject(CurveV1PoolTokenHelper)