Fixed config. Fixed WETHGateway initialiation with WrappedNativeToken. Added AaveProtocolDataProvider init at addresses provider registry.

This commit is contained in:
David Racero 2021-03-31 14:13:44 +02:00
parent 3edbbceb1a
commit ae8f7aa21f
9 changed files with 69 additions and 20 deletions

View File

@ -113,6 +113,19 @@ export const getWethAddress = async (config: ICommonConfiguration) => {
return weth.address; return weth.address;
}; };
export const getWrappedNativeTokenddress = async (config: ICommonConfiguration) => {
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
const wethAddress = getParamPerNetwork(config.WrappedNativeToken, <eNetwork>currentNetwork);
if (wethAddress) {
return wethAddress;
}
if (currentNetwork.includes('main')) {
throw new Error('WETH not set at mainnet configuration.');
}
const weth = await deployWETHMocked();
return weth.address;
};
export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => { export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => {
const { const {
ProtocolGlobalParams: { UsdAddress }, ProtocolGlobalParams: { UsdAddress },

View File

@ -490,6 +490,7 @@ export interface ICommonConfiguration {
ReservesConfig: iMultiPoolsAssets<IReserveParams>; ReservesConfig: iMultiPoolsAssets<IReserveParams>;
ATokenDomainSeparator: iParamsPerNetwork<string>; ATokenDomainSeparator: iParamsPerNetwork<string>;
WETH: iParamsPerNetwork<tEthereumAddress>; WETH: iParamsPerNetwork<tEthereumAddress>;
WrappedNativeToken: iParamsPerNetwork<tEthereumAddress>;
WethGateway: iParamsPerNetwork<tEthereumAddress>; WethGateway: iParamsPerNetwork<tEthereumAddress>;
ReserveFactorTreasuryAddress: iParamsPerNetwork<tEthereumAddress>; ReserveFactorTreasuryAddress: iParamsPerNetwork<tEthereumAddress>;
IncentivesController: iParamsPerNetwork<tEthereumAddress>; IncentivesController: iParamsPerNetwork<tEthereumAddress>;

View File

@ -337,6 +337,15 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', [eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', [eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
}, },
WrappedNativeToken: {
[eEthereumNetwork.coverage]: '', // deployed in local evm
[eEthereumNetwork.hardhat]: '', // deployed in local evm
[eEthereumNetwork.buidlerevm]: '', // deployed in local evm
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
ReserveFactorTreasuryAddress: { ReserveFactorTreasuryAddress: {
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',

View File

@ -326,6 +326,15 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', [eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', [eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
}, },
WrappedNativeToken: {
[eEthereumNetwork.coverage]: '', // deployed in local evm
[eEthereumNetwork.hardhat]: '', // deployed in local evm
[eEthereumNetwork.buidlerevm]: '', // deployed in local evm
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
ReserveFactorTreasuryAddress: { ReserveFactorTreasuryAddress: {
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',

View File

@ -55,7 +55,7 @@ export const CommonsConfig: ICommonConfiguration = {
borrowRate: oneRay.multipliedBy(0.03).toFixed(), borrowRate: oneRay.multipliedBy(0.03).toFixed(),
}, },
WMATIC: { WMATIC: {
borrowRate: oneRay.multipliedBy(0.05).toFixed(), // TEMP borrowRate: oneRay.multipliedBy(0.05).toFixed(),
}, },
AAVE: { AAVE: {
borrowRate: oneRay.multipliedBy(0.03).toFixed(), borrowRate: oneRay.multipliedBy(0.03).toFixed(),
@ -85,16 +85,16 @@ export const CommonsConfig: ICommonConfiguration = {
[ePolygonNetwork.matic]: '', [ePolygonNetwork.matic]: '',
}, },
ProviderRegistry: { ProviderRegistry: {
[ePolygonNetwork.mumbai]: '0x27453A916e91Fb922d309D92e637C0b6625846dF', // TEMP [ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '', [ePolygonNetwork.matic]: '0x3ac4e9aa29940770aeC38fe853a4bbabb2dA9C19',
}, },
ProviderRegistryOwner: { ProviderRegistryOwner: {
[ePolygonNetwork.mumbai]: '0xa6842C2C7fece4Cdc6a4aaaD331eb1c7910e419A', // TEMP [ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '0x88505CB63c1679145053c758ebb7b37ac241Bd2C', [ePolygonNetwork.matic]: '0xD7D86236d6c463521920fCC50A9CB56f8C8Bf008',
}, },
LendingRateOracle: { LendingRateOracle: {
[ePolygonNetwork.mumbai]: '', [ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '', [ePolygonNetwork.matic]: '0x17F73aEaD876CC4059089ff815EDA37052960dFB',
}, },
LendingPoolCollateralManager: { LendingPoolCollateralManager: {
[ePolygonNetwork.mumbai]: '', [ePolygonNetwork.mumbai]: '',
@ -110,7 +110,7 @@ export const CommonsConfig: ICommonConfiguration = {
}, },
AaveOracle: { AaveOracle: {
[ePolygonNetwork.mumbai]: '', [ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '', [ePolygonNetwork.matic]: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d',
}, },
FallbackOracle: { FallbackOracle: {
[ePolygonNetwork.mumbai]: ZERO_ADDRESS, [ePolygonNetwork.mumbai]: ZERO_ADDRESS,
@ -144,11 +144,15 @@ export const CommonsConfig: ICommonConfiguration = {
[ePolygonNetwork.matic]: '', [ePolygonNetwork.matic]: '',
}, },
WETH: { WETH: {
[ePolygonNetwork.mumbai]: '0x53CDb16B8C031B779e996406546614E5F05BC4Bf', [ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', [ePolygonNetwork.matic]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
}, },
WrappedNativeToken: {
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
},
ReserveFactorTreasuryAddress: { ReserveFactorTreasuryAddress: {
[ePolygonNetwork.mumbai]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP [ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '0x7734280A4337F37Fbf4651073Db7c28C80B339e9', [ePolygonNetwork.matic]: '0x7734280A4337F37Fbf4651073Db7c28C80B339e9',
}, },
IncentivesController: { IncentivesController: {

View File

@ -120,6 +120,9 @@ export const CommonsConfig: ICommonConfiguration = {
WETH: { WETH: {
[eXDaiNetwork.xdai]: '', // DAI: xDAI is the base token, DAI is also there, We need WXDAI [eXDaiNetwork.xdai]: '', // DAI: xDAI is the base token, DAI is also there, We need WXDAI
}, },
WrappedNativeToken: {
[eXDaiNetwork.xdai]: '', // DAI: xDAI is the base token, DAI is also there, We need WXDAI
},
ReserveFactorTreasuryAddress: { ReserveFactorTreasuryAddress: {
[eXDaiNetwork.xdai]: '', // TEMP [eXDaiNetwork.xdai]: '', // TEMP
}, },

View File

@ -42,8 +42,8 @@
"aave:evm:dev:migration": "npm run compile && hardhat aave:dev", "aave:evm:dev:migration": "npm run compile && hardhat aave:dev",
"aave:docker:full:migration": "npm run compile && npm run hardhat:docker -- aave:mainnet", "aave:docker:full:migration": "npm run compile && npm run hardhat:docker -- aave:mainnet",
"aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --verify", "aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --verify",
"matic:mumbai:full:migration": "npm run compile && npm run hardhat:mumbai sidechain:mainnet --pool Matic", "matic:mumbai:full:migration": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic",
"matic:matic:full:migration": "npm run compile && npm run hardhat:matic sidechain:mainnet --pool Matic", "matic:matic:full:migration": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic",
"amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --verify", "amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --verify",
"aave:kovan:full:initialize": "npm run hardhat:kovan -- full:initialize-lending-pool --verify --pool Aave", "aave:kovan:full:initialize": "npm run hardhat:kovan -- full:initialize-lending-pool --verify --pool Aave",
"aave:ropsten:full:migration": "npm run compile && npm run hardhat:ropsten -- aave:mainnet --verify", "aave:ropsten:full:migration": "npm run compile && npm run hardhat:ropsten -- aave:mainnet --verify",

View File

@ -1,10 +1,10 @@
import { task } from 'hardhat/config'; import { task } from 'hardhat/config';
import { AaveConfig } from '../../markets/aave/index'; import {
import { getParamPerNetwork } from '../../helpers/contracts-helpers'; loadPoolConfig,
import { loadPoolConfig, ConfigNames, getWethAddress } from '../../helpers/configuration'; ConfigNames,
getWrappedNativeTokenddress,
} from '../../helpers/configuration';
import { deployWETHGateway } from '../../helpers/contracts-deployments'; import { deployWETHGateway } from '../../helpers/contracts-deployments';
import { DRE } from '../../helpers/misc-utils';
import { eNetwork } from '../../helpers/types';
const CONTRACT_NAME = 'WETHGateway'; const CONTRACT_NAME = 'WETHGateway';
@ -13,10 +13,8 @@ task(`full-deploy-weth-gateway`, `Deploys the ${CONTRACT_NAME} contract`)
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`) .addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
.setAction(async ({ verify, pool }, localBRE) => { .setAction(async ({ verify, pool }, localBRE) => {
await localBRE.run('set-DRE'); await localBRE.run('set-DRE');
const network = <eNetwork>localBRE.network.name;
const poolConfig = loadPoolConfig(pool); const poolConfig = loadPoolConfig(pool);
const Weth = await getWethAddress(poolConfig); const Weth = await getWrappedNativeTokenddress(poolConfig);
const { WethGateway } = poolConfig;
if (!localBRE.network.config.chainId) { if (!localBRE.network.config.chainId) {
throw new Error('INVALID_CHAIN_ID'); throw new Error('INVALID_CHAIN_ID');

View File

@ -88,6 +88,18 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
await addressesProvider.setLendingPoolCollateralManager(collateralManagerAddress) await addressesProvider.setLendingPoolCollateralManager(collateralManagerAddress)
); );
console.log(
'\tSetting AaveProtocolDataProvider at AddressesProvider at id: 0x01',
collateralManagerAddress
);
const aaveProtocolDataProvider = await getAaveProtocolDataProvider();
await waitForTx(
await addressesProvider.setAddress(
'0x0100000000000000000000000000000000000000000000000000000000000000',
aaveProtocolDataProvider.address
)
);
await deployWalletBalancerProvider(verify); await deployWalletBalancerProvider(verify);
const lendingPoolAddress = await addressesProvider.getLendingPool(); const lendingPoolAddress = await addressesProvider.getLendingPool();