From db9a5b64dd32d3ff36d1f50b07673483205c6b2a Mon Sep 17 00:00:00 2001 From: David Racero Date: Thu, 20 May 2021 10:58:35 +0200 Subject: [PATCH] feat: Add deployment curve atoken scripts --- helpers/constants.ts | 5 +++++ helpers/contracts-deployments.ts | 22 ++++++++++++++++++++++ helpers/types.ts | 1 + 3 files changed, 28 insertions(+) diff --git a/helpers/constants.ts b/helpers/constants.ts index 79c50814..55e2b704 100644 --- a/helpers/constants.ts +++ b/helpers/constants.ts @@ -1,4 +1,5 @@ import BigNumber from 'bignumber.js'; +import { eEthereumNetwork } from './types'; // ---------------- // MATH @@ -72,3 +73,7 @@ export const MOCK_CHAINLINK_AGGREGATORS_PRICES = { USD: '5848466240000000', REW: oneEther.multipliedBy('0.00137893825230').toFixed(), }; + +export const CRV_TOKEN = { + [eEthereumNetwork.main]: '0xD533a949740bb3306d119CC777fa900bA034cd52', +}; diff --git a/helpers/contracts-deployments.ts b/helpers/contracts-deployments.ts index 4aeb6d56..bc55fb26 100644 --- a/helpers/contracts-deployments.ts +++ b/helpers/contracts-deployments.ts @@ -51,6 +51,7 @@ import { FlashLiquidationAdapterFactory, RewardsTokenFactory, RewardsATokenMockFactory, + CurveRewardsAwareATokenFactory, } from '../types'; import { withSaveAndVerify, @@ -68,6 +69,7 @@ import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins' import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory'; import { UiPoolDataProvider } from '../types'; +import { CRV_TOKEN } from './constants'; export const deployUiPoolDataProvider = async ( [incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress], @@ -662,6 +664,8 @@ export const chooseATokenDeployment = (id: eContractid) => { return deployDelegationAwareATokenImpl; case eContractid.RewardsATokenMock: return deployRewardATokenMock; + case eContractid.CurveRewardsAwareAToken: + return deployCurveRewardsAwareATokenByNetwork; default: throw Error(`Missing aToken implementation deployment script for: ${id}`); } @@ -714,3 +718,21 @@ export const deployATokenImplementations = async ( await deployGenericVariableDebtToken(verify); } }; + +export const deployCurveRewardsAwareAToken = async ( + crvToken: tEthereumAddress, + verify?: boolean +) => { + const args: [tEthereumAddress] = [crvToken]; + return withSaveAndVerify( + await new CurveRewardsAwareATokenFactory(await getFirstSigner()).deploy(...args), + eContractid.CurveRewardsAwareAToken, + args, + verify + ); +}; + +export const deployCurveRewardsAwareATokenByNetwork = async (verify?: boolean) => { + const network = DRE.network.name as eEthereumNetwork; + return deployCurveRewardsAwareAToken(CRV_TOKEN[network], verify); +}; diff --git a/helpers/types.ts b/helpers/types.ts index 8b210516..73f4b264 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -89,6 +89,7 @@ export enum eContractid { FlashLiquidationAdapter = 'FlashLiquidationAdapter', RewardsATokenMock = 'RewardsATokenMock', RewardsToken = 'RewardsToken', + CurveRewardsAwareAToken = 'CurveRewardsAwareAToken', } /*