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

Commit

Permalink
feat(template): Remove common attributes (#1419)
Browse files Browse the repository at this point in the history
  • Loading branch information
JForsaken committed Sep 15, 2022
1 parent cfbc5b5 commit 87ba656
Show file tree
Hide file tree
Showing 344 changed files with 857 additions and 2,650 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -89,6 +89,7 @@
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"ethers": "^5.5.1",
"glob": "^8.0.3",
"graphql": "^15.5.1",
"graphql-request": "^3.7.0",
"husky": "^8.0.1",
Expand Down
30 changes: 28 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions src/apps/aave-amm/ethereum/aave-amm.position-presenter.ts
@@ -1,14 +1,8 @@
import { Injectable } from '@nestjs/common';

import { PresenterTemplate } from '~app-toolkit/decorators/presenter-template.decorator';
import { AaveV2PositionPresenter } from '~apps/aave-v2/common/aave-v2.position-presenter';
import { Network } from '~types';

import { AAVE_AMM_DEFINITION } from '../aave-amm.definition';

@Injectable()
@PresenterTemplate()
export class EthereumAaveAmmPositionPresenter extends AaveV2PositionPresenter {
appId = AAVE_AMM_DEFINITION.id;
network = Network.ETHEREUM_MAINNET;
lendingPoolAddress = '0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9';
explorePresentationConfig = undefined;
}
10 changes: 2 additions & 8 deletions src/apps/aave-amm/ethereum/aave-amm.stable-debt.token-fetcher.ts
@@ -1,22 +1,16 @@
import { Injectable } from '@nestjs/common';

import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import {
AaveV2LendingTokenDataProps,
AaveV2ReserveApyData,
AaveV2ReserveTokenAddressesData,
} from '~apps/aave-v2/helpers/aave-v2.lending.template.token-fetcher';
import { GetDisplayPropsParams } from '~position/template/app-token.template.types';
import { Network } from '~types/network.interface';

import { AAVE_AMM_DEFINITION } from '../aave-amm.definition';
import { AaveAmmAToken } from '../contracts';
import { AaveAmmLendingTemplateTokenFetcher } from '../helpers/aave-amm.lending.template.token-fetcher';

@Injectable()
@PositionTemplate()
export class EthereumAaveAmmStableDebtTokenFetcher extends AaveAmmLendingTemplateTokenFetcher {
appId = AAVE_AMM_DEFINITION.id;
groupId = AAVE_AMM_DEFINITION.groups.stableDebt.id;
network = Network.ETHEREUM_MAINNET;
groupLabel = 'Lending';
providerAddress = '0x7937d4799803fbbe595ed57278bc4ca21f3bffcb';
isDebt = true;
Expand Down
10 changes: 2 additions & 8 deletions src/apps/aave-amm/ethereum/aave-amm.supply.token-fetcher.ts
@@ -1,22 +1,16 @@
import { Injectable } from '@nestjs/common';

import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import {
AaveV2LendingTokenDataProps,
AaveV2ReserveApyData,
AaveV2ReserveTokenAddressesData,
} from '~apps/aave-v2/helpers/aave-v2.lending.template.token-fetcher';
import { GetDisplayPropsParams } from '~position/template/app-token.template.types';
import { Network } from '~types/network.interface';

import { AAVE_AMM_DEFINITION } from '../aave-amm.definition';
import { AaveAmmAToken } from '../contracts';
import { AaveAmmLendingTemplateTokenFetcher } from '../helpers/aave-amm.lending.template.token-fetcher';

@Injectable()
@PositionTemplate()
export class EthereumAaveAmmSupplyTokenFetcher extends AaveAmmLendingTemplateTokenFetcher {
appId = AAVE_AMM_DEFINITION.id;
groupId = AAVE_AMM_DEFINITION.groups.supply.id;
network = Network.ETHEREUM_MAINNET;
groupLabel = 'Lending';
providerAddress = '0x7937d4799803fbbe595ed57278bc4ca21f3bffcb';
isDebt = false;
Expand Down
@@ -1,22 +1,16 @@
import { Injectable } from '@nestjs/common';

import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import {
AaveV2LendingTokenDataProps,
AaveV2ReserveApyData,
AaveV2ReserveTokenAddressesData,
} from '~apps/aave-v2/helpers/aave-v2.lending.template.token-fetcher';
import { GetDisplayPropsParams } from '~position/template/app-token.template.types';
import { Network } from '~types/network.interface';

import { AAVE_AMM_DEFINITION } from '../aave-amm.definition';
import { AaveAmmAToken } from '../contracts';
import { AaveAmmLendingTemplateTokenFetcher } from '../helpers/aave-amm.lending.template.token-fetcher';

@Injectable()
@PositionTemplate()
export class EthereumAaveAmmVariableDebtTokenFetcher extends AaveAmmLendingTemplateTokenFetcher {
appId = AAVE_AMM_DEFINITION.id;
groupId = AAVE_AMM_DEFINITION.groups.variableDebt.id;
network = Network.ETHEREUM_MAINNET;
groupLabel = 'Lending';
providerAddress = '0x7937d4799803fbbe595ed57278bc4ca21f3bffcb';
isDebt = true;
Expand Down
@@ -1,7 +1,8 @@
import { Inject, Injectable } from '@nestjs/common';
import { Inject } from '@nestjs/common';
import { sum } from 'lodash';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import { getLabelFromToken } from '~app-toolkit/helpers/presentation/image.present';
import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher';
import {
Expand All @@ -10,9 +11,7 @@ import {
GetPricePerShareParams,
GetUnderlyingTokensParams,
} from '~position/template/app-token.template.types';
import { Network } from '~types/network.interface';

import { AAVE_SAFETY_MODULE_DEFINITION } from '../aave-safety-module.definition';
import { AaveAbpt, AaveSafetyModuleContractFactory } from '../contracts';

type AaveSafetyModuleAbptTokenDataProps = {
Expand All @@ -21,14 +20,11 @@ type AaveSafetyModuleAbptTokenDataProps = {
fee: number;
};

@Injectable()
@PositionTemplate()
export class EthereumAaveSafetyModuleAbptTokenFetcher extends AppTokenTemplatePositionFetcher<
AaveAbpt,
AaveSafetyModuleAbptTokenDataProps
> {
appId = AAVE_SAFETY_MODULE_DEFINITION.id;
groupId = AAVE_SAFETY_MODULE_DEFINITION.groups.abpt.id;
network = Network.ETHEREUM_MAINNET;
groupLabel = 'ABPT';

readonly bptAddress = '0xc697051d1c6296c24ae3bcef39aca743861d9a81';
Expand Down
@@ -1,6 +1,7 @@
import { Inject, Injectable } from '@nestjs/common';
import { Inject } from '@nestjs/common';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import { getLabelFromToken } from '~app-toolkit/helpers/presentation/image.present';
import { MetaType } from '~position/position.interface';
import { ContractPositionTemplatePositionFetcher } from '~position/template/contract-position.template.position-fetcher';
Expand All @@ -10,16 +11,11 @@ import {
GetTokenBalancesParams,
GetTokenDefinitionsParams,
} from '~position/template/contract-position.template.types';
import { Network } from '~types';

import { AAVE_SAFETY_MODULE_DEFINITION } from '../aave-safety-module.definition';
import { AaveSafetyModuleContractFactory, AaveStkAave } from '../contracts';

@Injectable()
@PositionTemplate()
export class EthereumAaveSafetyModuleStkAaveClaimableContractPositionFetcher extends ContractPositionTemplatePositionFetcher<AaveStkAave> {
appId = AAVE_SAFETY_MODULE_DEFINITION.id;
groupId = AAVE_SAFETY_MODULE_DEFINITION.groups.stkAaveClaimable.id;
network = Network.ETHEREUM_MAINNET;
groupLabel = 'stkAAVE Rewards';

constructor(
Expand Down
@@ -1,27 +1,23 @@
import { Inject, Injectable } from '@nestjs/common';
import { Inject } from '@nestjs/common';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { ZERO_ADDRESS } from '~app-toolkit/constants/address';
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher';
import { GetDataPropsParams, GetUnderlyingTokensParams } from '~position/template/app-token.template.types';
import { Network } from '~types/network.interface';

import { AAVE_SAFETY_MODULE_DEFINITION } from '../aave-safety-module.definition';
import { AaveSafetyModuleContractFactory, AaveStkAave } from '../contracts';

type AaveSafetyModuleStkAaveTokenDataProps = {
apy: number;
liquidity: number;
};

@Injectable()
@PositionTemplate()
export class EthereumAaveSafetyModuleStkAaveTokenFetcher extends AppTokenTemplatePositionFetcher<
AaveStkAave,
AaveSafetyModuleStkAaveTokenDataProps
> {
appId = AAVE_SAFETY_MODULE_DEFINITION.id;
groupId = AAVE_SAFETY_MODULE_DEFINITION.groups.stkAave.id;
network = Network.ETHEREUM_MAINNET;
groupLabel = 'stkAAVE';

constructor(
Expand Down
@@ -1,20 +1,16 @@
import { Inject, Injectable } from '@nestjs/common';
import { Inject } from '@nestjs/common';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import { getLabelFromToken } from '~app-toolkit/helpers/presentation/image.present';
import { MetaType } from '~position/position.interface';
import { ContractPositionTemplatePositionFetcher } from '~position/template/contract-position.template.position-fetcher';
import { GetDisplayPropsParams, GetTokenBalancesParams } from '~position/template/contract-position.template.types';
import { Network } from '~types';

import { AAVE_SAFETY_MODULE_DEFINITION } from '../aave-safety-module.definition';
import { AaveSafetyModuleContractFactory, AaveStkAbpt } from '../contracts';

@Injectable()
@PositionTemplate()
export class EthereumAaveSafetyModuleStkAbptClaimableContractPositionFetcher extends ContractPositionTemplatePositionFetcher<AaveStkAbpt> {
appId = AAVE_SAFETY_MODULE_DEFINITION.id;
groupId = AAVE_SAFETY_MODULE_DEFINITION.groups.stkAbptClaimable.id;
network = Network.ETHEREUM_MAINNET;
groupLabel = 'stkABPT Rewards';

constructor(
Expand Down
@@ -1,27 +1,23 @@
import { Inject, Injectable } from '@nestjs/common';
import { Inject } from '@nestjs/common';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { ZERO_ADDRESS } from '~app-toolkit/constants/address';
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher';
import { GetDataPropsParams } from '~position/template/app-token.template.types';
import { Network } from '~types/network.interface';

import { AAVE_SAFETY_MODULE_DEFINITION } from '../aave-safety-module.definition';
import { AaveSafetyModuleContractFactory, AaveStkAbpt } from '../contracts';

type AaveSafetyModuleStkAbptTokenDataProps = {
apy: number;
liquidity: number;
};

@Injectable()
@PositionTemplate()
export class EthereumAaveSafetyModuleStkAbptTokenFetcher extends AppTokenTemplatePositionFetcher<
AaveStkAbpt,
AaveSafetyModuleStkAbptTokenDataProps
> {
appId = AAVE_SAFETY_MODULE_DEFINITION.id;
groupId = AAVE_SAFETY_MODULE_DEFINITION.groups.stkAbpt.id;
network = Network.ETHEREUM_MAINNET;
groupLabel = 'stkABPT';

constructor(
Expand Down
@@ -1,17 +1,10 @@
import { Injectable } from '@nestjs/common';
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';

import { Network } from '~types/network.interface';

import { AAVE_V2_DEFINITION } from '../aave-v2.definition';
import { AaveV2ClaimableTemplatePositionFetcher } from '../helpers/aave-v2.claimable.template.contract-position-fetcher';

@Injectable()
@PositionTemplate()
export class AvalancheAaveV2ClaimableContractPositionFetcher extends AaveV2ClaimableTemplatePositionFetcher {
appId = AAVE_V2_DEFINITION.id;
network = Network.AVALANCHE_MAINNET;
groupId = AAVE_V2_DEFINITION.groups.claimable.id;
groupLabel = 'Rewards';

isExcludedFromExplore = true;
isExcludedFromTvl = true;

Expand Down
10 changes: 2 additions & 8 deletions src/apps/aave-v2/avalanche/aave-v2.position-presenter.ts
@@ -1,13 +1,7 @@
import { Injectable } from '@nestjs/common';

import { PresenterTemplate } from '~app-toolkit/decorators/presenter-template.decorator';
import { AaveV2PositionPresenter } from '~apps/aave-v2/common/aave-v2.position-presenter';
import { Network } from '~types';

import { AAVE_V2_DEFINITION } from '../aave-v2.definition';

@Injectable()
@PresenterTemplate()
export class AvalancheAaveV2PositionPresenter extends AaveV2PositionPresenter {
appId = AAVE_V2_DEFINITION.id;
network = Network.AVALANCHE_MAINNET;
lendingPoolAddress = '0x4f01aed16d97e3ab5ab2b501154dc9bb0f1a5a2c';
}
10 changes: 2 additions & 8 deletions src/apps/aave-v2/avalanche/aave-v2.stable-debt.token-fetcher.ts
@@ -1,9 +1,6 @@
import { Injectable } from '@nestjs/common';

import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import { GetDisplayPropsParams } from '~position/template/app-token.template.types';
import { Network } from '~types/network.interface';

import { AAVE_V2_DEFINITION } from '../aave-v2.definition';
import { AaveV2AToken } from '../contracts/ethers/AaveV2AToken';
import {
AaveV2ReserveApyData,
Expand All @@ -12,11 +9,8 @@ import {
AaveV2LendingTokenDataProps,
} from '../helpers/aave-v2.lending.template.token-fetcher';

@Injectable()
@PositionTemplate()
export class AvalancheAaveV2StableDebtTokenFetcher extends AaveV2LendingTemplateTokenFetcher {
appId = AAVE_V2_DEFINITION.id;
groupId = AAVE_V2_DEFINITION.groups.stableDebt.id;
network = Network.AVALANCHE_MAINNET;
groupLabel = 'Lending';
providerAddress = '0x65285e9dfab318f57051ab2b139cccf232945451';
isDebt = true;
Expand Down

0 comments on commit 87ba656

Please sign in to comment.