Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
fix(sturdy): Fix Sturdy TVL and remove legacy TVL fetcher (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
wpoulin authored Jun 21, 2022
1 parent 71fb81e commit 9e89e65
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 66 deletions.
5 changes: 3 additions & 2 deletions src/apps/sturdy/ethereum/sturdy.stable-debt.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const appId = STURDY_DEFINITION.id;
const groupId = STURDY_DEFINITION.groups.stableDebt.id;
const network = Network.ETHEREUM_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class EthereumSturdyStableDebtTokenFetcher implements PositionFetcher<AppTokenPosition> {
constructor(@Inject(SturdyLendingTokenHelper) private readonly sturdyLendingTokenHelper: SturdyLendingTokenHelper) {}

Expand All @@ -23,9 +23,10 @@ export class EthereumSturdyStableDebtTokenFetcher implements PositionFetcher<App
groupId,
network,
protocolDataProviderAddress: '0xa422ca380bd70eef876292839222159e41aaee17',
isDebt: true,
resolveTokenAddress: ({ reserveTokenAddressesData }) => reserveTokenAddressesData.stableDebtTokenAddress,
resolveLendingRate: ({ reserveData }) => reserveData.stableBorrowRate,
resolveLabel: ({ reserveToken }) => `Borrowed ${getLabelFromToken(reserveToken)}`,
resolveLabel: ({ reserveToken }) => getLabelFromToken(reserveToken),
resolveApyLabel: ({ apy }) => `${(apy * 100).toFixed(3)}% APR (stable)`,
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/sturdy/ethereum/sturdy.supply.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const appId = STURDY_DEFINITION.id;
const groupId = STURDY_DEFINITION.groups.supply.id;
const network = Network.ETHEREUM_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class EthereumSturdySupplyTokenFetcher implements PositionFetcher<AppTokenPosition> {
constructor(@Inject(SturdyLendingTokenHelper) private readonly sturdyLendingTokenHelper: SturdyLendingTokenHelper) {}

Expand Down
26 changes: 0 additions & 26 deletions src/apps/sturdy/ethereum/sturdy.tvl-fetcher.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const appId = STURDY_DEFINITION.id;
const groupId = STURDY_DEFINITION.groups.variableDebt.id;
const network = Network.ETHEREUM_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class EthereumSturdyVariableDebtTokenFetcher implements PositionFetcher<AppTokenPosition> {
constructor(@Inject(SturdyLendingTokenHelper) private readonly sturdyLendingTokenHelper: SturdyLendingTokenHelper) {}

Expand All @@ -23,9 +23,10 @@ export class EthereumSturdyVariableDebtTokenFetcher implements PositionFetcher<A
groupId,
network,
protocolDataProviderAddress: '0xa422ca380bd70eef876292839222159e41aaee17',
isDebt: true,
resolveTokenAddress: ({ reserveTokenAddressesData }) => reserveTokenAddressesData.variableDebtTokenAddress,
resolveLendingRate: ({ reserveData }) => reserveData.variableBorrowRate,
resolveLabel: ({ reserveToken }) => `Borrowed ${getLabelFromToken(reserveToken)}`,
resolveLabel: ({ reserveToken }) => getLabelFromToken(reserveToken),
resolveApyLabel: ({ apy }) => `${(apy * 100).toFixed(3)}% APR (variable)`,
});
}
Expand Down
5 changes: 3 additions & 2 deletions src/apps/sturdy/fantom/sturdy.stable-debt.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const appId = STURDY_DEFINITION.id;
const groupId = STURDY_DEFINITION.groups.stableDebt.id;
const network = Network.FANTOM_OPERA_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class FantomSturdyStableDebtTokenFetcher implements PositionFetcher<AppTokenPosition> {
constructor(@Inject(SturdyLendingTokenHelper) private readonly sturdyLendingTokenHelper: SturdyLendingTokenHelper) {}

Expand All @@ -23,9 +23,10 @@ export class FantomSturdyStableDebtTokenFetcher implements PositionFetcher<AppTo
groupId,
network,
protocolDataProviderAddress: '0x7ff2520cd7b76e8c49b5db51505b842d665f3e9a',
isDebt: true,
resolveTokenAddress: ({ reserveTokenAddressesData }) => reserveTokenAddressesData.stableDebtTokenAddress,
resolveLendingRate: ({ reserveData }) => reserveData.stableBorrowRate,
resolveLabel: ({ reserveToken }) => `Borrowed ${getLabelFromToken(reserveToken)}`,
resolveLabel: ({ reserveToken }) => getLabelFromToken(reserveToken),
resolveApyLabel: ({ apy }) => `${(apy * 100).toFixed(3)}% APR (stable)`,
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/sturdy/fantom/sturdy.supply.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const appId = STURDY_DEFINITION.id;
const groupId = STURDY_DEFINITION.groups.supply.id;
const network = Network.FANTOM_OPERA_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class FantomSturdySupplyTokenFetcher implements PositionFetcher<AppTokenPosition> {
constructor(@Inject(SturdyLendingTokenHelper) private readonly sturdyLendingTokenHelper: SturdyLendingTokenHelper) {}

Expand Down
26 changes: 0 additions & 26 deletions src/apps/sturdy/fantom/sturdy.tvl-fetcher.ts

This file was deleted.

5 changes: 3 additions & 2 deletions src/apps/sturdy/fantom/sturdy.variable-debt.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const appId = STURDY_DEFINITION.id;
const groupId = STURDY_DEFINITION.groups.variableDebt.id;
const network = Network.FANTOM_OPERA_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class FantomSturdyVariableDebtTokenFetcher implements PositionFetcher<AppTokenPosition> {
constructor(@Inject(SturdyLendingTokenHelper) private readonly sturdyLendingTokenHelper: SturdyLendingTokenHelper) {}

Expand All @@ -23,9 +23,10 @@ export class FantomSturdyVariableDebtTokenFetcher implements PositionFetcher<App
groupId,
network,
protocolDataProviderAddress: '0x7ff2520cd7b76e8c49b5db51505b842d665f3e9a',
isDebt: true,
resolveTokenAddress: ({ reserveTokenAddressesData }) => reserveTokenAddressesData.variableDebtTokenAddress,
resolveLendingRate: ({ reserveData }) => reserveData.variableBorrowRate,
resolveLabel: ({ reserveToken }) => `Borrowed ${getLabelFromToken(reserveToken)}`,
resolveLabel: ({ reserveToken }) => getLabelFromToken(reserveToken),
resolveApyLabel: ({ apy }) => `${(apy * 100).toFixed(3)}% APR (variable)`,
});
}
Expand Down
3 changes: 3 additions & 0 deletions src/apps/sturdy/helpers/sturdy.lending.token-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type SturdyLendingTokenHelperParams = Pick<
| 'groupId'
| 'network'
| 'protocolDataProviderAddress'
| 'isDebt'
| 'resolveTokenAddress'
| 'resolveLendingRate'
| 'resolveLabel'
Expand All @@ -32,6 +33,7 @@ export class SturdyLendingTokenHelper {
groupId,
network,
protocolDataProviderAddress,
isDebt,
resolveTokenAddress,
resolveLendingRate,
resolveLabel,
Expand All @@ -42,6 +44,7 @@ export class SturdyLendingTokenHelper {
groupId,
network,
protocolDataProviderAddress,
isDebt,
resolveContract: ({ address }) => this.contractFactory.sturdyLendingPool({ network, address }),
resolveReserveTokens: ({ contract }) => contract.getReservesList(),
resolveReserveTokenAddresses: async ({ contract, multicall, reserveTokenAddress }) =>
Expand Down
4 changes: 0 additions & 4 deletions src/apps/sturdy/sturdy.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import { SturdyContractFactory } from './contracts';
import { EthereumSturdyBalanceFetcher } from './ethereum/sturdy.balance-fetcher';
import { EthereumSturdyStableDebtTokenFetcher } from './ethereum/sturdy.stable-debt.token-fetcher';
import { EthereumSturdySupplyTokenFetcher } from './ethereum/sturdy.supply.token-fetcher';
import { EthereumSturdyTvlFetcher } from './ethereum/sturdy.tvl-fetcher';
import { EthereumSturdyVariableDebtTokenFetcher } from './ethereum/sturdy.variable-debt.token-fetcher';
import { FantomSturdyBalanceFetcher } from './fantom/sturdy.balance-fetcher';
import { FantomSturdyStableDebtTokenFetcher } from './fantom/sturdy.stable-debt.token-fetcher';
import { FantomSturdySupplyTokenFetcher } from './fantom/sturdy.supply.token-fetcher';
import { FantomSturdyTvlFetcher } from './fantom/sturdy.tvl-fetcher';
import { FantomSturdyVariableDebtTokenFetcher } from './fantom/sturdy.variable-debt.token-fetcher';
import { SturdyLendingTokenHelper } from './helpers/sturdy.lending.token-helper';
import { SturdyAppDefinition, STURDY_DEFINITION } from './sturdy.definition';
Expand All @@ -28,13 +26,11 @@ import { SturdyAppDefinition, STURDY_DEFINITION } from './sturdy.definition';
EthereumSturdySupplyTokenFetcher,
EthereumSturdyStableDebtTokenFetcher,
EthereumSturdyVariableDebtTokenFetcher,
EthereumSturdyTvlFetcher,
// Fantom
FantomSturdyBalanceFetcher,
FantomSturdySupplyTokenFetcher,
FantomSturdyStableDebtTokenFetcher,
FantomSturdyVariableDebtTokenFetcher,
FantomSturdyTvlFetcher,
],
})
export class SturdyAppModule extends AbstractApp() {}

0 comments on commit 9e89e65

Please sign in to comment.