mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Integrate polygon verifier into verification tools and Hardhat tasks
This commit is contained in:
parent
7b757e340a
commit
d16c680b7c
|
@ -38,14 +38,15 @@ import { eContractid, PoolConfiguration, tEthereumAddress, TokenContractId } fro
|
|||
|
||||
export const getFirstSigner = async () => (await DRE.ethers.getSigners())[0];
|
||||
|
||||
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) =>
|
||||
await LendingPoolAddressesProviderFactory.connect(
|
||||
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) => {
|
||||
console.log(DRE.network.name);
|
||||
return await LendingPoolAddressesProviderFactory.connect(
|
||||
address ||
|
||||
(await getDb().get(`${eContractid.LendingPoolAddressesProvider}.${DRE.network.name}`).value())
|
||||
.address,
|
||||
await getFirstSigner()
|
||||
);
|
||||
|
||||
};
|
||||
export const getLendingPoolConfiguratorProxy = async (address?: tEthereumAddress) => {
|
||||
return await LendingPoolConfiguratorFactory.connect(
|
||||
address ||
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
import { MintableERC20 } from '../types/MintableERC20';
|
||||
import { Artifact } from 'hardhat/types';
|
||||
import { Artifact as BuidlerArtifact } from '@nomiclabs/buidler/types';
|
||||
import { verifyContract } from './etherscan-verification';
|
||||
import { verifyEtherscanContract } from './etherscan-verification';
|
||||
import { getIErc20Detailed } from './contracts-getters';
|
||||
import { usingTenderly, verifyAtTenderly } from './tenderly-utils';
|
||||
import { usingPolygon, verifyAtPolygon } from './polygon-utils';
|
||||
|
@ -99,15 +99,8 @@ export const withSaveAndVerify = async <ContractType extends Contract>(
|
|||
): Promise<ContractType> => {
|
||||
await waitForTx(instance.deployTransaction);
|
||||
await registerContractInJsonDb(id, instance);
|
||||
if (usingTenderly()) {
|
||||
await verifyAtTenderly(id, instance);
|
||||
}
|
||||
if (verify) {
|
||||
if (usingPolygon()) {
|
||||
await verifyAtPolygon(id, instance, args);
|
||||
} else {
|
||||
await verifyContract(instance.address, args);
|
||||
}
|
||||
await verifyContract(id, instance, args);
|
||||
}
|
||||
return instance;
|
||||
};
|
||||
|
@ -326,3 +319,19 @@ export const buildFlashLiquidationAdapterParams = (
|
|||
[collateralAsset, debtAsset, user, debtToCover, useEthPath]
|
||||
);
|
||||
};
|
||||
|
||||
export const verifyContract = async (
|
||||
id: string,
|
||||
instance: Contract,
|
||||
args: (string | string[])[]
|
||||
) => {
|
||||
if (usingPolygon()) {
|
||||
await verifyAtPolygon(id, instance, args);
|
||||
} else {
|
||||
if (usingTenderly()) {
|
||||
await verifyAtTenderly(id, instance);
|
||||
}
|
||||
await verifyEtherscanContract(instance.address, args);
|
||||
}
|
||||
return instance;
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ function delay(ms: number) {
|
|||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
export const verifyContract = async (
|
||||
export const verifyEtherscanContract = async (
|
||||
address: string,
|
||||
constructorArguments: (string | string[])[],
|
||||
libraries?: string
|
||||
|
|
|
@ -5,6 +5,10 @@ import { source } from 'lowdb/adapters/FileSync';
|
|||
import { file } from 'tmp-promise';
|
||||
import { DRE } from './misc-utils';
|
||||
import { eEthereumNetwork, ePolygonNetwork, EthereumNetworkNames } from './types';
|
||||
import curlirize from 'axios-curlirize';
|
||||
|
||||
// Initialize Curlizie to add curl logs
|
||||
curlirize(axios);
|
||||
|
||||
const TASK_FLATTEN_GET_FLATTENED_SOURCE = 'flatten:get-flattened-sources';
|
||||
const TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS = 'compile:solidity:get-source-paths';
|
||||
|
@ -76,10 +80,9 @@ export const verifyAtPolygon = async (
|
|||
&optimization={false}
|
||||
&contractSourceCode={contractSourceCode}
|
||||
*/
|
||||
const network = (DRE as HardhatRuntimeEnvironment).network.name;
|
||||
const net = network === EthereumNetworkNames.matic ? 'mainnet' : network;
|
||||
try {
|
||||
const network = (DRE as HardhatRuntimeEnvironment).network.name;
|
||||
const net = network === EthereumNetworkNames.matic ? 'mainnet' : network;
|
||||
|
||||
const filePath = await findPath(id);
|
||||
const encodedConstructorParams = encodeDeployParams(instance, args);
|
||||
const flattenSourceCode = await hardhatFlattener(filePath);
|
||||
|
@ -117,12 +120,19 @@ export const verifyAtPolygon = async (
|
|||
if (response.status === 200 && response.data.message === 'OK') {
|
||||
console.log(`[Polygon Verify] Verified contract at Matic ${net} network.`);
|
||||
console.log(
|
||||
`[Polygon Verify] You can check at https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts) \n`
|
||||
`[Polygon Verify] Check at: https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts) \n`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
throw Error(JSON.stringify(response.data, null, 2));
|
||||
} catch (error) {
|
||||
if (error?.message.includes('Smart-contract already verified.')) {
|
||||
console.log(
|
||||
`[Polygon Verify] Already verified. Check it at: https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts) \n`
|
||||
);
|
||||
return;
|
||||
}
|
||||
console.error('[Polygon Verify] Error:', error.toString());
|
||||
throw error;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
import BigNumber from 'bignumber.js';
|
||||
import { oneEther, oneRay, RAY, ZERO_ADDRESS, MOCK_CHAINLINK_AGGREGATORS_PRICES } from '../../helpers/constants';
|
||||
import {
|
||||
oneEther,
|
||||
oneRay,
|
||||
RAY,
|
||||
ZERO_ADDRESS,
|
||||
MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||
} from '../../helpers/constants';
|
||||
import { ICommonConfiguration, ePolygonNetwork } from '../../helpers/types';
|
||||
|
||||
// ----------------
|
||||
|
@ -74,19 +80,19 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.matic]: '0x17c4A170FFF882862F656597889016D3a6073534',
|
||||
},
|
||||
EmergencyAdminIndex: 1,
|
||||
EmergencyAdminIndex: 0,
|
||||
ProviderRegistry: {
|
||||
[ePolygonNetwork.mumbai]: '0x569859d41499B4dDC28bfaA43915051FF0A38a6F', // TEMP
|
||||
[ePolygonNetwork.matic]: '0x28334e4791860a0c1eCF89a62B973ba04a5d643F', // TEMP
|
||||
[ePolygonNetwork.mumbai]: '0x27453A916e91Fb922d309D92e637C0b6625846dF', // TEMP
|
||||
[ePolygonNetwork.matic]: '0x28334e4791860a0c1eCF89a62B973ba04a5d643F', // TEMP
|
||||
},
|
||||
ProviderRegistryOwner: {
|
||||
[ePolygonNetwork.mumbai]: '0x18d9bA2baEfBdE0FF137C4ad031427EF205f1Fd9', // TEMP
|
||||
[ePolygonNetwork.matic]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F', // TEMP
|
||||
[ePolygonNetwork.mumbai]: '0xa6842C2C7fece4Cdc6a4aaaD331eb1c7910e419A', // TEMP
|
||||
[ePolygonNetwork.matic]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F', // TEMP
|
||||
},
|
||||
LendingRateOracle: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.matic]: '',
|
||||
},
|
||||
},
|
||||
LendingPoolCollateralManager: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.matic]: '0x9Af76e0575D139570D3B4c821567Fe935E8c25C5',
|
||||
|
@ -95,9 +101,9 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.matic]: '',
|
||||
},
|
||||
WethGateway: {
|
||||
WethGateway: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.matic]: '0x15A46f5073789b7D16F6F46632aE50Bae838d938',
|
||||
[ePolygonNetwork.matic]: '',
|
||||
},
|
||||
AaveOracle: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
|
@ -135,10 +141,10 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
},
|
||||
WETH: {
|
||||
[ePolygonNetwork.mumbai]: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', // WMATIC address (untested)
|
||||
[ePolygonNetwork.matic]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC address
|
||||
[ePolygonNetwork.matic]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC address
|
||||
},
|
||||
ReserveFactorTreasuryAddress: {
|
||||
[ePolygonNetwork.mumbai]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP
|
||||
[ePolygonNetwork.matic]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP
|
||||
[ePolygonNetwork.mumbai]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP
|
||||
[ePolygonNetwork.matic]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP
|
||||
},
|
||||
};
|
||||
|
|
25528
package-lock.json
generated
25528
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -69,6 +69,10 @@
|
|||
"kovan:verify": "npm run hardhat:kovan verify:general -- --all --pool Aave",
|
||||
"ropsten:verify": "npm run hardhat:ropsten verify:general -- --all --pool Aave",
|
||||
"mainnet:verify": "npm run hardhat:main verify:general -- --all --pool Aave",
|
||||
"matic:mumbai:verify": "npm run hardhat:mumbai verify:general -- --all --pool Matic",
|
||||
"matic:mainnet:verify": "npm run hardhat:matic verify:general -- --all --pool Matic",
|
||||
"matic:mumbai:verify:tokens": "npm run hardhat:mumbai verify:tokens -- --pool Matic",
|
||||
"matic:mainnet:verify:tokens": "npm run hardhat:matic verify:tokens -- --pool Matic",
|
||||
"kovan:verify:tokens": "npm run hardhat:kovan verify:tokens -- --pool Aave",
|
||||
"ropsten:verify:tokens": "npm run hardhat:ropsten verify:tokens -- --pool Aave",
|
||||
"mainnet:verify:tokens": "npm run hardhat:main verify:tokens -- --pool Aave",
|
||||
|
@ -144,6 +148,7 @@
|
|||
],
|
||||
"license": "AGPLv3",
|
||||
"dependencies": {
|
||||
"axios-curlirize": "^1.3.7",
|
||||
"tmp-promise": "^3.0.2"
|
||||
},
|
||||
"keywords": [
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { task } from 'hardhat/config';
|
||||
|
||||
import { UiPoolDataProviderFactory } from '../../types';
|
||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
||||
import { verifyContract } from '../../helpers/contracts-helpers';
|
||||
import { eContractid } from '../../helpers/types';
|
||||
|
||||
task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`)
|
||||
|
@ -21,7 +21,9 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
|
|||
).deploy();
|
||||
await uiPoolDataProvider.deployTransaction.wait();
|
||||
console.log('uiPoolDataProvider.address', uiPoolDataProvider.address);
|
||||
await verifyContract(uiPoolDataProvider.address, []);
|
||||
if (verify) {
|
||||
await verifyContract(eContractid.UiPoolDataProvider, uiPoolDataProvider, []);
|
||||
}
|
||||
|
||||
console.log(`\tFinished UiPoolDataProvider proxy and implementation deployment`);
|
||||
});
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { task } from 'hardhat/config';
|
||||
|
||||
import { UniswapLiquiditySwapAdapterFactory } from '../../types';
|
||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
||||
import { verifyContract } from '../../helpers/contracts-helpers';
|
||||
import { getFirstSigner } from '../../helpers/contracts-getters';
|
||||
import { eContractid } from '../../helpers/types';
|
||||
|
||||
const CONTRACT_NAME = 'UniswapLiquiditySwapAdapter';
|
||||
|
||||
|
@ -29,7 +30,14 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
|
|||
).deploy(provider, router, weth);
|
||||
await uniswapRepayAdapter.deployTransaction.wait();
|
||||
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
|
||||
await verifyContract(uniswapRepayAdapter.address, [provider, router, weth]);
|
||||
|
||||
if (verify) {
|
||||
await verifyContract(eContractid.UniswapLiquiditySwapAdapter, uniswapRepayAdapter, [
|
||||
provider,
|
||||
router,
|
||||
weth,
|
||||
]);
|
||||
}
|
||||
|
||||
console.log(`\tFinished ${CONTRACT_NAME} proxy and implementation deployment`);
|
||||
});
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { task } from 'hardhat/config';
|
||||
|
||||
import { UniswapRepayAdapterFactory } from '../../types';
|
||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
||||
import { verifyContract } from '../../helpers/contracts-helpers';
|
||||
import { getFirstSigner } from '../../helpers/contracts-getters';
|
||||
import { eContractid } from '../../helpers/types';
|
||||
|
||||
const CONTRACT_NAME = 'UniswapRepayAdapter';
|
||||
|
||||
|
@ -30,7 +31,14 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
|
|||
);
|
||||
await uniswapRepayAdapter.deployTransaction.wait();
|
||||
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
|
||||
await verifyContract(uniswapRepayAdapter.address, [provider, router, weth]);
|
||||
|
||||
if (verify) {
|
||||
await verifyContract(eContractid.UniswapRepayAdapter, uniswapRepayAdapter, [
|
||||
provider,
|
||||
router,
|
||||
weth,
|
||||
]);
|
||||
}
|
||||
|
||||
console.log(
|
||||
`\tFinished ${CONTRACT_NAME}${CONTRACT_NAME}lDataProvider proxy and implementation deployment`
|
||||
|
|
|
@ -21,12 +21,7 @@ task(`full-deploy-weth-gateway`, `Deploys the ${CONTRACT_NAME} contract`)
|
|||
if (!localBRE.network.config.chainId) {
|
||||
throw new Error('INVALID_CHAIN_ID');
|
||||
}
|
||||
let gateWay = getParamPerNetwork(WethGateway, network);
|
||||
if (gateWay === '') {
|
||||
const wethGateWay = await deployWETHGateway([Weth], verify);
|
||||
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
|
||||
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
|
||||
} else {
|
||||
console.log(`Weth gateway already deployed. Address: ${gateWay}`);
|
||||
}
|
||||
const wethGateWay = await deployWETHGateway([Weth], verify);
|
||||
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
|
||||
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
|
||||
});
|
||||
|
|
|
@ -95,6 +95,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
if (!notFalsyOrZeroAddress(gateWay)) {
|
||||
gateWay = (await getWETHGateway()).address;
|
||||
}
|
||||
console.log('GATEWAY', gateWay);
|
||||
await authorizeWETHGateway(gateWay, lendingPoolAddress);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ConfigNames } from '../../helpers/configuration';
|
|||
import { printContracts } from '../../helpers/misc-utils';
|
||||
import { usingTenderly } from '../../helpers/tenderly-utils';
|
||||
|
||||
task('matic:mainnet', 'Deploy development enviroment')
|
||||
task('matic:mainnet', 'Deploy Matic market at Polygon network')
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.setAction(async ({ verify }, DRE) => {
|
||||
const POOL_NAME = ConfigNames.Matic;
|
||||
|
@ -28,16 +28,18 @@ task('matic:mainnet', 'Deploy development enviroment')
|
|||
|
||||
console.log('4. Deploy Data Provider');
|
||||
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
||||
console.log('5. Deploy WETH Gateway');
|
||||
await DRE.run('full-deploy-weth-gateway', { pool: POOL_NAME });
|
||||
|
||||
console.log('5. Initialize lending pool');
|
||||
console.log('6. Initialize lending pool');
|
||||
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
||||
|
||||
if (verify) {
|
||||
printContracts();
|
||||
console.log('4. Veryfing contracts');
|
||||
console.log('7. Veryfing contracts');
|
||||
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
||||
|
||||
console.log('5. Veryfing aTokens and debtTokens');
|
||||
console.log('8. Veryfing aTokens and debtTokens');
|
||||
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import { verifyContract, checkVerification } from '../../helpers/etherscan-verification';
|
||||
|
||||
import { verifyEtherscanContract, checkVerification } from '../../helpers/etherscan-verification';
|
||||
interface VerifyParams {
|
||||
contractName: string;
|
||||
address: string;
|
||||
|
@ -24,6 +23,6 @@ task('verify-sc', 'Inits the DRE, to have access to all the plugins')
|
|||
|
||||
checkVerification();
|
||||
|
||||
const result = await verifyContract(address, constructorArguments, libraries);
|
||||
const result = await verifyEtherscanContract(address, constructorArguments, libraries);
|
||||
return result;
|
||||
});
|
||||
|
|
|
@ -19,13 +19,13 @@ import {
|
|||
getLendingPoolConfiguratorImpl,
|
||||
getLendingPoolConfiguratorProxy,
|
||||
getLendingPoolImpl,
|
||||
getProxy,
|
||||
getWalletProvider,
|
||||
getWETHGateway,
|
||||
} from '../../helpers/contracts-getters';
|
||||
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
||||
import { verifyContract, getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
|
||||
import { eNetwork, ICommonConfiguration } from '../../helpers/types';
|
||||
import { eContractid, eNetwork, ICommonConfiguration } from '../../helpers/types';
|
||||
|
||||
task('verify:general', 'Verify contracts at Etherscan')
|
||||
.addFlag('all', 'Verify all contracts at Etherscan')
|
||||
|
@ -55,6 +55,10 @@ task('verify:general', 'Verify contracts at Etherscan')
|
|||
const lendingPoolConfiguratorAddress = await addressesProvider.getLendingPoolConfigurator(); //getLendingPoolConfiguratorProxy();
|
||||
const lendingPoolCollateralManagerAddress = await addressesProvider.getLendingPoolCollateralManager();
|
||||
|
||||
const lendingPoolProxy = await getProxy(lendingPoolAddress);
|
||||
const lendingPoolConfiguratorProxy = await getProxy(lendingPoolConfiguratorAddress);
|
||||
const lendingPoolCollateralManagerProxy = await getProxy(lendingPoolCollateralManagerAddress);
|
||||
|
||||
if (all) {
|
||||
const lendingPoolImplAddress = getParamPerNetwork(LendingPool, network);
|
||||
const lendingPoolImpl = notFalsyOrZeroAddress(lendingPoolImplAddress)
|
||||
|
@ -89,64 +93,69 @@ task('verify:general', 'Verify contracts at Etherscan')
|
|||
|
||||
// Address Provider
|
||||
console.log('\n- Verifying address provider...\n');
|
||||
await verifyContract(addressesProvider.address, [MarketId]);
|
||||
await verifyContract(eContractid.LendingPoolAddressesProvider, addressesProvider, [MarketId]);
|
||||
|
||||
// Address Provider Registry
|
||||
console.log('\n- Verifying address provider registry...\n');
|
||||
await verifyContract(addressesProviderRegistry.address, []);
|
||||
await verifyContract(
|
||||
eContractid.LendingPoolAddressesProviderRegistry,
|
||||
addressesProviderRegistry,
|
||||
[]
|
||||
);
|
||||
|
||||
// Lending Pool implementation
|
||||
console.log('\n- Verifying LendingPool Implementation...\n');
|
||||
await verifyContract(lendingPoolImpl.address, []);
|
||||
await verifyContract(eContractid.LendingPool, lendingPoolImpl, []);
|
||||
|
||||
// Lending Pool Configurator implementation
|
||||
console.log('\n- Verifying LendingPool Configurator Implementation...\n');
|
||||
await verifyContract(lendingPoolConfiguratorImpl.address, []);
|
||||
await verifyContract(eContractid.LendingPoolConfigurator, lendingPoolConfiguratorImpl, []);
|
||||
|
||||
// Lending Pool Collateral Manager implementation
|
||||
console.log('\n- Verifying LendingPool Collateral Manager Implementation...\n');
|
||||
await verifyContract(lendingPoolCollateralManagerImpl.address, []);
|
||||
await verifyContract(
|
||||
eContractid.LendingPoolCollateralManager,
|
||||
lendingPoolCollateralManagerImpl,
|
||||
[]
|
||||
);
|
||||
|
||||
// Test helpers
|
||||
console.log('\n- Verifying Aave Provider Helpers...\n');
|
||||
await verifyContract(dataProvider.address, [addressesProvider.address]);
|
||||
await verifyContract(eContractid.AaveProtocolDataProvider, dataProvider, [
|
||||
addressesProvider.address,
|
||||
]);
|
||||
|
||||
// Wallet balance provider
|
||||
console.log('\n- Verifying Wallet Balance Provider...\n');
|
||||
await verifyContract(walletProvider.address, []);
|
||||
await verifyContract(eContractid.WalletBalanceProvider, walletProvider, []);
|
||||
|
||||
// WETHGateway
|
||||
console.log('\n- Verifying WETHGateway...\n');
|
||||
await verifyContract(wethGateway.address, [await getWethAddress(poolConfig)]);
|
||||
await verifyContract(eContractid.WETHGateway, wethGateway, [
|
||||
await getWethAddress(poolConfig),
|
||||
]);
|
||||
}
|
||||
// Lending Pool proxy
|
||||
console.log('\n- Verifying Lending Pool Proxy...\n');
|
||||
await verifyContract(lendingPoolAddress, [addressesProvider.address]);
|
||||
await verifyContract(eContractid.InitializableAdminUpgradeabilityProxy, lendingPoolProxy, [
|
||||
addressesProvider.address,
|
||||
]);
|
||||
|
||||
// LendingPool Conf proxy
|
||||
console.log('\n- Verifying Lending Pool Configurator Proxy...\n');
|
||||
await verifyContract(lendingPoolConfiguratorAddress, [addressesProvider.address]);
|
||||
await verifyContract(
|
||||
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||
lendingPoolConfiguratorProxy,
|
||||
[addressesProvider.address]
|
||||
);
|
||||
|
||||
// Proxy collateral manager
|
||||
console.log('\n- Verifying Lending Pool Collateral Manager Proxy...\n');
|
||||
await verifyContract(lendingPoolCollateralManagerAddress, []);
|
||||
await verifyContract(
|
||||
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||
lendingPoolCollateralManagerProxy,
|
||||
[]
|
||||
);
|
||||
|
||||
// DelegatedAwareAToken
|
||||
console.log('\n- Verifying DelegatedAwareAToken...\n');
|
||||
const UNI = getParamPerNetwork(ReserveAssets, network).UNI;
|
||||
const aUNI = await getAddressById('aUNI');
|
||||
if (aUNI) {
|
||||
console.log('Verifying aUNI');
|
||||
await verifyContract(aUNI, [
|
||||
lendingPoolAddress,
|
||||
UNI,
|
||||
treasuryAddress,
|
||||
'Aave interest bearing UNI',
|
||||
'aUNI',
|
||||
ZERO_ADDRESS,
|
||||
]);
|
||||
} else {
|
||||
console.error('Missing aUNI address at JSON DB. Skipping...');
|
||||
}
|
||||
console.log('Finished verifications.');
|
||||
});
|
||||
|
|
|
@ -8,14 +8,16 @@ import {
|
|||
import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import {
|
||||
getAddressById,
|
||||
getAToken,
|
||||
getFirstSigner,
|
||||
getLendingPool,
|
||||
getInterestRateStrategy,
|
||||
getLendingPoolAddressesProvider,
|
||||
getLendingPoolConfiguratorProxy,
|
||||
getProxy,
|
||||
getStableDebtToken,
|
||||
getVariableDebtToken,
|
||||
} from '../../helpers/contracts-getters';
|
||||
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
||||
import { eNetwork, ICommonConfiguration, IReserveParams } from '../../helpers/types';
|
||||
import { getParamPerNetwork, verifyContract } from '../../helpers/contracts-helpers';
|
||||
import { eContractid, eNetwork, ICommonConfiguration, IReserveParams } from '../../helpers/types';
|
||||
import { LendingPoolConfiguratorFactory, LendingPoolFactory } from '../../types';
|
||||
|
||||
task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||
|
@ -66,27 +68,43 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
|||
console.log;
|
||||
// Proxy Stable Debt
|
||||
console.log(`\n- Verifying Stable Debt Token proxy...\n`);
|
||||
await verifyContract(stableDebtTokenAddress, [lendingPoolConfigurator.address]);
|
||||
await verifyContract(
|
||||
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||
await getProxy(stableDebtTokenAddress),
|
||||
[lendingPoolConfigurator.address]
|
||||
);
|
||||
|
||||
// Proxy Variable Debt
|
||||
console.log(`\n- Verifying Debt Token proxy...\n`);
|
||||
await verifyContract(variableDebtTokenAddress, [lendingPoolConfigurator.address]);
|
||||
await verifyContract(
|
||||
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||
await getProxy(variableDebtTokenAddress),
|
||||
[lendingPoolConfigurator.address]
|
||||
);
|
||||
|
||||
// Proxy aToken
|
||||
console.log('\n- Verifying aToken proxy...\n');
|
||||
await verifyContract(aTokenAddress, [lendingPoolConfigurator.address]);
|
||||
await verifyContract(
|
||||
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||
await getProxy(aTokenAddress),
|
||||
[lendingPoolConfigurator.address]
|
||||
);
|
||||
|
||||
// Strategy Rate
|
||||
console.log(`\n- Verifying Strategy rate...\n`);
|
||||
await verifyContract(interestRateStrategyAddress, [
|
||||
addressesProvider.address,
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
variableRateSlope1,
|
||||
variableRateSlope2,
|
||||
stableRateSlope1,
|
||||
stableRateSlope2,
|
||||
]);
|
||||
await verifyContract(
|
||||
eContractid.DefaultReserveInterestRateStrategy,
|
||||
await getInterestRateStrategy(interestRateStrategyAddress),
|
||||
[
|
||||
addressesProvider.address,
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
variableRateSlope1,
|
||||
variableRateSlope2,
|
||||
stableRateSlope1,
|
||||
stableRateSlope2,
|
||||
]
|
||||
);
|
||||
|
||||
const stableDebt = await getAddressById(`stableDebt${token}`);
|
||||
const variableDebt = await getAddressById(`variableDebt${token}`);
|
||||
|
@ -94,7 +112,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
|||
|
||||
if (aToken) {
|
||||
console.log('\n- Verifying aToken...\n');
|
||||
await verifyContract(aToken, [
|
||||
await verifyContract(eContractid.AToken, await getAToken(aToken), [
|
||||
lendingPoolProxy.address,
|
||||
tokenAddress,
|
||||
treasuryAddress,
|
||||
|
@ -107,7 +125,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
|||
}
|
||||
if (stableDebt) {
|
||||
console.log('\n- Verifying StableDebtToken...\n');
|
||||
await verifyContract(stableDebt, [
|
||||
await verifyContract(eContractid.StableDebtToken, await getStableDebtToken(stableDebt), [
|
||||
lendingPoolProxy.address,
|
||||
tokenAddress,
|
||||
`Aave stable debt bearing ${token}`,
|
||||
|
@ -119,13 +137,17 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
|||
}
|
||||
if (variableDebt) {
|
||||
console.log('\n- Verifying VariableDebtToken...\n');
|
||||
await verifyContract(variableDebt, [
|
||||
lendingPoolProxy.address,
|
||||
tokenAddress,
|
||||
`Aave variable debt bearing ${token}`,
|
||||
`variableDebt${token}`,
|
||||
ZERO_ADDRESS,
|
||||
]);
|
||||
await verifyContract(
|
||||
eContractid.VariableDebtToken,
|
||||
await getVariableDebtToken(variableDebt),
|
||||
[
|
||||
lendingPoolProxy.address,
|
||||
tokenAddress,
|
||||
`Aave variable debt bearing ${token}`,
|
||||
`variableDebt${token}`,
|
||||
ZERO_ADDRESS,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
console.error(`Skipping variable debt verify for ${token}. Missing address at JSON DB.`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user