From 242850241f9f2a81ce3ca731394ef7c41c8d7a67 Mon Sep 17 00:00:00 2001 From: karotjal Date: Mon, 20 Sep 2021 10:59:13 +0200 Subject: [PATCH] feat: Revised Avalanche configs. Add UiPoolDataProvider helper to deployment scripts. --- markets/avalanche/commons.ts | 12 ++++++------ markets/avalanche/index.ts | 8 +------- tasks/full/6-initialize.ts | 17 ++++++++++------- tasks/verifications/1_general.ts | 9 ++++----- tasks/verifications/2_tokens.ts | 7 +------ 5 files changed, 22 insertions(+), 31 deletions(-) diff --git a/markets/avalanche/commons.ts b/markets/avalanche/commons.ts index 47682fd3..3ce0b8e8 100644 --- a/markets/avalanche/commons.ts +++ b/markets/avalanche/commons.ts @@ -147,19 +147,19 @@ export const CommonsConfig: ICommonConfiguration = { [eAvalancheNetwork.fuji]: '', }, WETH: { - [eAvalancheNetwork.avalanche]: '0xf20d962a6c8f70c731bd838a3a388D7d48fA6e15', // WETH Address - [eAvalancheNetwork.fuji]: '0x3b8b3fc85ccA720809Af2dA4B58cF4ce84bcbdd0', // MintableERC20 WETH + [eAvalancheNetwork.avalanche]: '', + [eAvalancheNetwork.fuji]: '', }, WrappedNativeToken: { [eAvalancheNetwork.avalanche]: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', // Official WAVAX [eAvalancheNetwork.fuji]: '0xd00ae08403B9bbb9124bB305C09058E32C39A48c', // Official WAVAX }, ReserveFactorTreasuryAddress: { - [eAvalancheNetwork.avalanche]: '0xBDEE917d2BDE529eDEc5b20e0B770F56EDFE8e74', // Not Final, only for test purposes - [eAvalancheNetwork.fuji]: '0xB45F5C501A22288dfdb897e5f73E189597e09288', // Self-controlled EOA + [eAvalancheNetwork.avalanche]: '', // TO BE DEPLOYED + [eAvalancheNetwork.fuji]: '0xB45F5C501A22288dfdb897e5f73E189597e09288', // Self-controlled EOA for testing }, IncentivesController: { - [eAvalancheNetwork.avalanche]: ZERO_ADDRESS, // Not final, no incentives proxy for test purposes - [eAvalancheNetwork.fuji]: '0xa1EF206fb9a8D8186157FC817fCddcC47727ED55', // WAVAX Incentives Controller + [eAvalancheNetwork.avalanche]: '0x01D83Fe6A10D2f2B7AF17034343746188272cAc9', + [eAvalancheNetwork.fuji]: '0xa1EF206fb9a8D8186157FC817fCddcC47727ED55', }, }; diff --git a/markets/avalanche/index.ts b/markets/avalanche/index.ts index 381c2b8d..417f68a0 100644 --- a/markets/avalanche/index.ts +++ b/markets/avalanche/index.ts @@ -1,10 +1,4 @@ -import { oneRay, ZERO_ADDRESS } from '../../helpers/constants'; -import { - IAaveConfiguration, - eEthereumNetwork, - eAvalancheNetwork, - IAvalancheConfiguration, -} from '../../helpers/types'; +import { eAvalancheNetwork, IAvalancheConfiguration } from '../../helpers/types'; import { CommonsConfig } from './commons'; import { diff --git a/tasks/full/6-initialize.ts b/tasks/full/6-initialize.ts index f315f36b..fc93600d 100644 --- a/tasks/full/6-initialize.ts +++ b/tasks/full/6-initialize.ts @@ -3,15 +3,10 @@ import { getParamPerNetwork } from '../../helpers/contracts-helpers'; import { deployLendingPoolCollateralManager, deployWalletBalancerProvider, - deployWETHGateway, authorizeWETHGateway, + deployUiPoolDataProvider, } from '../../helpers/contracts-deployments'; -import { - loadPoolConfig, - ConfigNames, - getWethAddress, - getTreasuryAddress, -} from '../../helpers/configuration'; +import { loadPoolConfig, ConfigNames, getTreasuryAddress } from '../../helpers/configuration'; import { getWETHGateway } from '../../helpers/contracts-getters'; import { eNetwork, ICommonConfiguration } from '../../helpers/types'; import { notFalsyOrZeroAddress, waitForTx } from '../../helpers/misc-utils'; @@ -50,6 +45,8 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.') const testHelpers = await getAaveProtocolDataProvider(); const admin = await addressesProvider.getPoolAdmin(); + const oracle = await addressesProvider.getPriceOracle(); + if (!reserveAssets) { throw 'Reserve assets is undefined. Check ReserveAssets configuration at config directory'; } @@ -103,6 +100,12 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.') await deployWalletBalancerProvider(verify); + const uiPoolDataProvider = await deployUiPoolDataProvider( + [incentivesController, oracle], + verify + ); + console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address); + const lendingPoolAddress = await addressesProvider.getLendingPool(); let gateWay = getParamPerNetwork(WethGateway, network); diff --git a/tasks/verifications/1_general.ts b/tasks/verifications/1_general.ts index b2b3bcb7..c7c7d233 100644 --- a/tasks/verifications/1_general.ts +++ b/tasks/verifications/1_general.ts @@ -1,11 +1,9 @@ -import { error } from 'console'; -import { zeroAddress } from 'ethereumjs-util'; import { task } from 'hardhat/config'; import { loadPoolConfig, ConfigNames, - getWethAddress, getTreasuryAddress, + getWrappedNativeTokenAddress, } from '../../helpers/configuration'; import { ZERO_ADDRESS } from '../../helpers/constants'; import { @@ -53,7 +51,8 @@ task('verify:general', 'Verify contracts at Etherscan') : await getLendingPoolAddressesProviderRegistry(); const lendingPoolAddress = await addressesProvider.getLendingPool(); const lendingPoolConfiguratorAddress = await addressesProvider.getLendingPoolConfigurator(); //getLendingPoolConfiguratorProxy(); - const lendingPoolCollateralManagerAddress = await addressesProvider.getLendingPoolCollateralManager(); + const lendingPoolCollateralManagerAddress = + await addressesProvider.getLendingPoolCollateralManager(); const lendingPoolProxy = await getProxy(lendingPoolAddress); const lendingPoolConfiguratorProxy = await getProxy(lendingPoolConfiguratorAddress); @@ -132,7 +131,7 @@ task('verify:general', 'Verify contracts at Etherscan') // WETHGateway console.log('\n- Verifying WETHGateway...\n'); await verifyContract(eContractid.WETHGateway, wethGateway, [ - await getWethAddress(poolConfig), + await getWrappedNativeTokenAddress(poolConfig), ]); } // Lending Pool proxy diff --git a/tasks/verifications/2_tokens.ts b/tasks/verifications/2_tokens.ts index eacc7f92..bbe5bbab 100644 --- a/tasks/verifications/2_tokens.ts +++ b/tasks/verifications/2_tokens.ts @@ -1,10 +1,5 @@ import { task } from 'hardhat/config'; -import { - loadPoolConfig, - ConfigNames, - getWethAddress, - getTreasuryAddress, -} from '../../helpers/configuration'; +import { loadPoolConfig, ConfigNames, getTreasuryAddress } from '../../helpers/configuration'; import { ZERO_ADDRESS } from '../../helpers/constants'; import { getAddressById,