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

Commit

Permalink
fix(granary-finance): Add variable debt on Base
Browse files Browse the repository at this point in the history
  • Loading branch information
wpoulin committed Oct 11, 2023
1 parent 972df82 commit 1784daf
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 97 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import { PresenterTemplate } from '~app-toolkit/decorators/presenter-template.decorator';
import { PresentationConfig } from '~app/app.interface';
import { AaveV2PositionPresenter } from '~apps/aave-v2/common/aave-v2.position-presenter';

@PresenterTemplate()
export class ArbitrumGranaryFinancePositionPresenter extends AaveV2PositionPresenter {
lendingPoolAddress = '0x102442a3ba1e441043154bc0b8a2e2fb5e0f94a7';

explorePresentationConfig?: PresentationConfig = {
tabs: [
{
label: 'Lending',
viewType: 'split',
views: [
{
viewType: 'list',
label: 'Supply',
groupIds: ['supply'],
},
{
viewType: 'list',
label: 'Borrow',
groupIds: ['variable-debt'],
},
],
},
],
};
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { PresenterTemplate } from '~app-toolkit/decorators/presenter-template.decorator';
import { PresentationConfig } from '~app/app.interface';
import { AaveV2PositionPresenter } from '~apps/aave-v2/common/aave-v2.position-presenter';

@PresenterTemplate()
export class BaseGranaryFinancePositionPresenter extends AaveV2PositionPresenter {
lendingPoolAddress = '0xb702ce183b4e1faa574834715e5d4a6378d0eed3';

explorePresentationConfig?: PresentationConfig = {
tabs: [
{
label: 'Lending',
viewType: 'split',
views: [
{
viewType: 'list',
label: 'Supply',
groupIds: ['supply'],
},
{
viewType: 'list',
label: 'Borrow',
groupIds: ['variable-debt'],
},
],
},
],
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import { AaveV2AToken } from '~apps/aave-v2/contracts';
import { GetDisplayPropsParams } from '~position/template/app-token.template.types';

@PositionTemplate()
export class FantomGranaryFinanceStableDebtTokenFetcher extends AaveV2LendingTokenFetcher {
export class BaseGranaryFinanceVariableDebtTokenFetcher extends AaveV2LendingTokenFetcher {
groupLabel = 'Lending';
providerAddress = '0x3132870d08f736505ff13b19199be17629085072';
providerAddress = '0xed984a0e9c12ee27602314191fc4487a702bb83f';
isDebt = true;

getTokenAddress(reserveTokenAddressesData: AaveV2ReserveTokenAddressesData): string {
return reserveTokenAddressesData.stableDebtTokenAddress;
return reserveTokenAddressesData.variableDebtTokenAddress;
}

getApyFromReserveData(reserveApyData: AaveV2ReserveApyData): number {
return reserveApyData.stableBorrowApy;
return reserveApyData.variableBorrowApy;
}

async getTertiaryLabel({ appToken }: GetDisplayPropsParams<AaveV2AToken, AaveV2LendingTokenDataProps>) {
return `${appToken.dataProps.apy.toFixed(3)}% APR (stable)`;
return `${appToken.dataProps.apy.toFixed(3)}% APR (variable)`;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import { PresenterTemplate } from '~app-toolkit/decorators/presenter-template.decorator';
import { PresentationConfig } from '~app/app.interface';
import { AaveV2PositionPresenter } from '~apps/aave-v2/common/aave-v2.position-presenter';

@PresenterTemplate()
export class EthereumGranaryFinancePositionPresenter extends AaveV2PositionPresenter {
lendingPoolAddress = '0xb702ce183b4e1faa574834715e5d4a6378d0eed3';

explorePresentationConfig?: PresentationConfig = {
tabs: [
{
label: 'Lending',
viewType: 'split',
views: [
{
viewType: 'list',
label: 'Supply',
groupIds: ['supply'],
},
{
viewType: 'list',
label: 'Borrow',
groupIds: ['variable-debt'],
},
],
},
],
};
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import { PresenterTemplate } from '~app-toolkit/decorators/presenter-template.decorator';
import { PresentationConfig } from '~app/app.interface';
import { AaveV2PositionPresenter } from '~apps/aave-v2/common/aave-v2.position-presenter';

@PresenterTemplate()
export class FantomGranaryFinancePositionPresenter extends AaveV2PositionPresenter {
lendingPoolAddress = '0x7220ffd5dc173ba3717e47033a01d870f06e5284';

explorePresentationConfig?: PresentationConfig = {
tabs: [
{
label: 'Lending',
viewType: 'split',
views: [
{
viewType: 'list',
label: 'Supply',
groupIds: ['supply'],
},
{
viewType: 'list',
label: 'Borrow',
groupIds: ['variable-debt'],
},
],
},
],
};
}
13 changes: 5 additions & 8 deletions src/apps/granary-finance/granary-finance.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ import { AbstractApp } from '~app/app.dynamic-module';
import { AaveV2ContractFactory } from '~apps/aave-v2/contracts';

import { ArbitrumGranaryFinancePositionPresenter } from './arbitrum/granary-finance.position-presenter';
import { ArbitrumGranaryFinanceStableDebtTokenFetcher } from './arbitrum/granary-finance.stable-debt.token-fetcher';
import { ArbitrumGranaryFinanceSupplyTokenFetcher } from './arbitrum/granary-finance.supply.token-fetcher';
import { ArbitrumGranaryFinanceVariableDebtTokenFetcher } from './arbitrum/granary-finance.variable-debt.token-fetcher';
import { BaseGranaryFinancePositionPresenter } from './base/granary-finance.position-presenter';
import { BaseGranaryFinanceVariableDebtTokenFetcher } from './base/granary-finance.variable-debt.token-fetcher';
import { GranaryFinanceContractFactory } from './contracts';
import { EthereumGranaryFinancePositionPresenter } from './ethereum/granary-finance.position-presenter';
import { EthereumGranaryFinanceStableDebtTokenFetcher } from './ethereum/granary-finance.stable-debt.token-fetcher';
import { EthereumGranaryFinanceSupplyTokenFetcher } from './ethereum/granary-finance.supply.token-fetcher';
import { EthereumGranaryFinanceVariableDebtTokenFetcher } from './ethereum/granary-finance.variable-debt.token-fetcher';
import { FantomGranaryFinancePositionPresenter } from './fantom/granary-finance.position-presenter';
import { FantomGranaryFinanceStableDebtTokenFetcher } from './fantom/granary-finance.stable-debt.token-fetcher';
import { FantomGranaryFinanceSupplyTokenFetcher } from './fantom/granary-finance.supply.token-fetcher';
import { FantomGranaryFinanceVariableDebtTokenFetcher } from './fantom/granary-finance.variable-debt.token-fetcher';
import { OptimismGranaryFinancePositionPresenter } from './optimism/granary-finance.position-presenter';
import { OptimismGranaryFinanceStableDebtTokenFetcher } from './optimism/granary-finance.stable-debt.token-fetcher';
import { OptimismGranaryFinanceSupplyTokenFetcher } from './optimism/granary-finance.supply.token-fetcher';
import { OptimismGranaryFinanceVariableDebtTokenFetcher } from './optimism/granary-finance.variable-debt.token-fetcher';

Expand All @@ -27,22 +25,21 @@ import { OptimismGranaryFinanceVariableDebtTokenFetcher } from './optimism/grana
AaveV2ContractFactory,
// Arbitrum
ArbitrumGranaryFinancePositionPresenter,
ArbitrumGranaryFinanceStableDebtTokenFetcher,
ArbitrumGranaryFinanceSupplyTokenFetcher,
ArbitrumGranaryFinanceVariableDebtTokenFetcher,
// Base
BaseGranaryFinancePositionPresenter,
BaseGranaryFinanceVariableDebtTokenFetcher,
// Ethereum
EthereumGranaryFinancePositionPresenter,
EthereumGranaryFinanceStableDebtTokenFetcher,
EthereumGranaryFinanceSupplyTokenFetcher,
EthereumGranaryFinanceVariableDebtTokenFetcher,
// Fantom
FantomGranaryFinancePositionPresenter,
FantomGranaryFinanceStableDebtTokenFetcher,
FantomGranaryFinanceSupplyTokenFetcher,
FantomGranaryFinanceVariableDebtTokenFetcher,
// Optimism
OptimismGranaryFinancePositionPresenter,
OptimismGranaryFinanceStableDebtTokenFetcher,
OptimismGranaryFinanceSupplyTokenFetcher,
OptimismGranaryFinanceVariableDebtTokenFetcher,
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import { PresenterTemplate } from '~app-toolkit/decorators/presenter-template.decorator';
import { PresentationConfig } from '~app/app.interface';
import { AaveV2PositionPresenter } from '~apps/aave-v2/common/aave-v2.position-presenter';

@PresenterTemplate()
export class OptimismGranaryFinancePositionPresenter extends AaveV2PositionPresenter {
lendingPoolAddress = '0x8fd4af47e4e63d1d2d45582c3286b4bd9bb95dfe';

explorePresentationConfig?: PresentationConfig = {
tabs: [
{
label: 'Lending',
viewType: 'split',
views: [
{
viewType: 'list',
label: 'Supply',
groupIds: ['supply'],
},
{
viewType: 'list',
label: 'Borrow',
groupIds: ['variable-debt'],
},
],
},
],
};
}

This file was deleted.

0 comments on commit 1784daf

Please sign in to comment.