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