From dad27d334b45be0899ebeae6a60c7a2ad411bef6 Mon Sep 17 00:00:00 2001 From: William Poulin Date: Mon, 6 Nov 2023 10:40:22 -0500 Subject: [PATCH] fix(notional-finance-v3): Cleanup (#3013) --- ...nce-v3.borrow.contract-position-fetcher.ts | 2 +- ...tional-finance-v3.n-token.token-fetcher.ts | 20 +++---------------- ...otional-finance-v3.p-cash.token-fetcher.ts | 20 +++---------------- ...otional-finance-v3.p-debt.token-fetcher.ts | 20 +++---------------- ...nce-v3.supply.contract-position-fetcher.ts | 2 +- .../notional-finance-v3.module.ts | 4 ++-- 6 files changed, 13 insertions(+), 55 deletions(-) diff --git a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.borrow.contract-position-fetcher.ts b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.borrow.contract-position-fetcher.ts index 24a2bb11f..c5b0bdea0 100644 --- a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.borrow.contract-position-fetcher.ts +++ b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.borrow.contract-position-fetcher.ts @@ -34,7 +34,7 @@ export type NotionalBorrowingDataProps = { }; @PositionTemplate() -export class EthereumNotionalFinanceV3BorrowContractPositionFetcher extends ContractPositionTemplatePositionFetcher< +export class ArbitrumNotionalFinanceV3BorrowContractPositionFetcher extends ContractPositionTemplatePositionFetcher< NotionalView, NotionalBorrowingDataProps, NotionalBorrowingDefinition diff --git a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.n-token.token-fetcher.ts b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.n-token.token-fetcher.ts index 81de60010..27d34db91 100644 --- a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.n-token.token-fetcher.ts +++ b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.n-token.token-fetcher.ts @@ -6,7 +6,6 @@ import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher'; import { - DefaultAppTokenDataProps, DefaultAppTokenDefinition, GetAddressesParams, GetDefinitionsParams, @@ -17,17 +16,8 @@ import { import { NotionalFinanceV3ContractFactory, NotionalPCash } from '../contracts'; -export type NotionalFinanceV3PCashTokenDefinition = { - address: string; - currencyId: number; -}; - @PositionTemplate() -export class ArbitrumNotionalFinanceV3NTokenTokenFetcher extends AppTokenTemplatePositionFetcher< - NotionalPCash, - DefaultAppTokenDataProps, - NotionalFinanceV3PCashTokenDefinition -> { +export class ArbitrumNotionalFinanceV3NTokenTokenFetcher extends AppTokenTemplatePositionFetcher { groupLabel = 'nTokens'; notionalViewContractAddress = '0x1344a36a1b56144c3bc62e7757377d288fde0369'; @@ -42,7 +32,7 @@ export class ArbitrumNotionalFinanceV3NTokenTokenFetcher extends AppTokenTemplat return this.contractFactory.notionalPCash({ network: this.network, address }); } - async getDefinitions({ multicall }: GetDefinitionsParams): Promise { + async getDefinitions({ multicall }: GetDefinitionsParams): Promise { const notionalViewContract = this.contractFactory.notionalView({ address: this.notionalViewContractAddress, network: this.network, @@ -60,7 +50,6 @@ export class ArbitrumNotionalFinanceV3NTokenTokenFetcher extends AppTokenTemplat return { address, - currencyId, }; }), ); @@ -78,10 +67,7 @@ export class ArbitrumNotionalFinanceV3NTokenTokenFetcher extends AppTokenTemplat return [{ address: await contract.asset(), network: this.network }]; } - async getPricePerShare({ - appToken, - contract, - }: GetPricePerShareParams) { + async getPricePerShare({ appToken, contract }: GetPricePerShareParams) { let pricePerShareRaw: BigNumber; try { pricePerShareRaw = await contract.exchangeRate(); diff --git a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.p-cash.token-fetcher.ts b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.p-cash.token-fetcher.ts index d0530f4a3..ff2be3600 100644 --- a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.p-cash.token-fetcher.ts +++ b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.p-cash.token-fetcher.ts @@ -5,7 +5,6 @@ import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher'; import { - DefaultAppTokenDataProps, DefaultAppTokenDefinition, GetAddressesParams, GetDefinitionsParams, @@ -16,17 +15,8 @@ import { import { NotionalFinanceV3ContractFactory, NotionalPCash } from '../contracts'; -export type NotionalFinanceV3PCashTokenDefinition = { - address: string; - currencyId: number; -}; - @PositionTemplate() -export class ArbitrumNotionalFinanceV3PCashTokenFetcher extends AppTokenTemplatePositionFetcher< - NotionalPCash, - DefaultAppTokenDataProps, - NotionalFinanceV3PCashTokenDefinition -> { +export class ArbitrumNotionalFinanceV3PCashTokenFetcher extends AppTokenTemplatePositionFetcher { groupLabel = 'Supply'; notionalViewContractAddress = '0x1344a36a1b56144c3bc62e7757377d288fde0369'; @@ -41,7 +31,7 @@ export class ArbitrumNotionalFinanceV3PCashTokenFetcher extends AppTokenTemplate return this.contractFactory.notionalPCash({ network: this.network, address }); } - async getDefinitions({ multicall }: GetDefinitionsParams): Promise { + async getDefinitions({ multicall }: GetDefinitionsParams): Promise { const notionalViewContract = this.contractFactory.notionalView({ address: this.notionalViewContractAddress, network: this.network, @@ -54,7 +44,6 @@ export class ArbitrumNotionalFinanceV3PCashTokenFetcher extends AppTokenTemplate return { address, - currencyId, }; }), ); @@ -70,10 +59,7 @@ export class ArbitrumNotionalFinanceV3PCashTokenFetcher extends AppTokenTemplate return [{ address: await contract.asset(), network: this.network }]; } - async getPricePerShare({ - appToken, - contract, - }: GetPricePerShareParams) { + async getPricePerShare({ appToken, contract }: GetPricePerShareParams) { const pricePerShareRaw = await contract.exchangeRate(); const pricePerShare = Number(pricePerShareRaw) / 10 ** 10 + appToken.tokens[0].decimals; diff --git a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.p-debt.token-fetcher.ts b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.p-debt.token-fetcher.ts index 7a6b5a2ce..753566fb0 100644 --- a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.p-debt.token-fetcher.ts +++ b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.p-debt.token-fetcher.ts @@ -6,7 +6,6 @@ import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher'; import { - DefaultAppTokenDataProps, DefaultAppTokenDefinition, GetAddressesParams, GetDefinitionsParams, @@ -17,17 +16,8 @@ import { import { NotionalFinanceV3ContractFactory, NotionalPCash } from '../contracts'; -export type NotionalFinanceV3PDebtTokenDefinition = { - address: string; - currencyId: number; -}; - @PositionTemplate() -export class ArbitrumNotionalFinanceV3PDebtTokenFetcher extends AppTokenTemplatePositionFetcher< - NotionalPCash, - DefaultAppTokenDataProps, - NotionalFinanceV3PDebtTokenDefinition -> { +export class ArbitrumNotionalFinanceV3PDebtTokenFetcher extends AppTokenTemplatePositionFetcher { groupLabel = 'Borrow'; isDebt = true; @@ -44,7 +34,7 @@ export class ArbitrumNotionalFinanceV3PDebtTokenFetcher extends AppTokenTemplate return this.contractFactory.notionalPCash({ network: this.network, address }); } - async getDefinitions({ multicall }: GetDefinitionsParams): Promise { + async getDefinitions({ multicall }: GetDefinitionsParams): Promise { const notionalViewContract = this.contractFactory.notionalView({ address: this.notionalViewContractAddress, network: this.network, @@ -57,7 +47,6 @@ export class ArbitrumNotionalFinanceV3PDebtTokenFetcher extends AppTokenTemplate return { address, - currencyId, }; }), ); @@ -73,10 +62,7 @@ export class ArbitrumNotionalFinanceV3PDebtTokenFetcher extends AppTokenTemplate return [{ address: await contract.asset(), network: this.network }]; } - async getPricePerShare({ - appToken, - contract, - }: GetPricePerShareParams) { + async getPricePerShare({ appToken, contract }: GetPricePerShareParams) { let pricePerShareRaw: BigNumber; try { pricePerShareRaw = await contract.exchangeRate(); diff --git a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.supply.contract-position-fetcher.ts b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.supply.contract-position-fetcher.ts index 2ada82fb8..b83563cde 100644 --- a/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.supply.contract-position-fetcher.ts +++ b/src/apps/notional-finance-v3/arbitrum/notional-finance-v3.supply.contract-position-fetcher.ts @@ -31,8 +31,8 @@ export type NotionalFinanceLendingDataProps = { currencyId: number; tokenId: string; maturity: number; - type: string; positionKey: string; + type: string; }; @PositionTemplate() diff --git a/src/apps/notional-finance-v3/notional-finance-v3.module.ts b/src/apps/notional-finance-v3/notional-finance-v3.module.ts index acf8265eb..748641b05 100644 --- a/src/apps/notional-finance-v3/notional-finance-v3.module.ts +++ b/src/apps/notional-finance-v3/notional-finance-v3.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { AbstractApp } from '~app/app.dynamic-module'; -import { EthereumNotionalFinanceV3BorrowContractPositionFetcher } from './arbitrum/notional-finance-v3.borrow.contract-position-fetcher'; +import { ArbitrumNotionalFinanceV3BorrowContractPositionFetcher } from './arbitrum/notional-finance-v3.borrow.contract-position-fetcher'; import { ArbitrumNotionalFinanceV3FCashTokenFetcher } from './arbitrum/notional-finance-v3.f-cash.token-fetcher'; import { ArbitrumNotionalFinanceV3NTokenTokenFetcher } from './arbitrum/notional-finance-v3.n-token.token-fetcher'; import { ArbitrumNotionalFinanceV3PCashTokenFetcher } from './arbitrum/notional-finance-v3.p-cash.token-fetcher'; @@ -19,7 +19,7 @@ import { NotionalFinanceV3ContractFactory } from './contracts'; ArbitrumNotionalFinanceV3NTokenTokenFetcher, ArbitrumNotionalFinanceV3FCashTokenFetcher, ArbitrumNotionalFinanceV3SupplyContractPositionFetcher, - EthereumNotionalFinanceV3BorrowContractPositionFetcher, + ArbitrumNotionalFinanceV3BorrowContractPositionFetcher, ], }) export class NotionalFinanceV3AppModule extends AbstractApp() {}