mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge pull request #112 from aave/feat/ui-pool-data-provider-task
Feat/UI pool data provider task
This commit is contained in:
commit
38701827f5
|
@ -56,6 +56,7 @@ import {
|
||||||
linkBytecode,
|
linkBytecode,
|
||||||
insertContractAddressInDb,
|
insertContractAddressInDb,
|
||||||
deployContract,
|
deployContract,
|
||||||
|
verifyContract,
|
||||||
} from './contracts-helpers';
|
} from './contracts-helpers';
|
||||||
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
|
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
|
||||||
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
||||||
|
@ -63,7 +64,6 @@ import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins'
|
||||||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||||
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
|
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
|
||||||
import { UiPoolDataProvider } from '../types';
|
import { UiPoolDataProvider } from '../types';
|
||||||
import { verifyContract } from './etherscan-verification';
|
|
||||||
|
|
||||||
export const deployUiPoolDataProvider = async (
|
export const deployUiPoolDataProvider = async (
|
||||||
[incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress],
|
[incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress],
|
||||||
|
@ -73,7 +73,7 @@ export const deployUiPoolDataProvider = async (
|
||||||
const args: string[] = [incentivesController, aaveOracle];
|
const args: string[] = [incentivesController, aaveOracle];
|
||||||
const instance = await deployContract<UiPoolDataProvider>(id, args);
|
const instance = await deployContract<UiPoolDataProvider>(id, args);
|
||||||
if (verify) {
|
if (verify) {
|
||||||
await verifyContract(instance.address, args);
|
await verifyContract(id, instance, args);
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { task } from 'hardhat/config';
|
import { task } from 'hardhat/config';
|
||||||
import { UiPoolDataProviderFactory } from '../../types';
|
import { eContractid, eEthereumNetwork, eNetwork, ePolygonNetwork } from '../../helpers/types';
|
||||||
import { verifyContract } from '../../helpers/contracts-helpers';
|
import { deployUiPoolDataProvider } from '../../helpers/contracts-deployments';
|
||||||
import { eContractid } from '../../helpers/types';
|
import { exit } from 'process';
|
||||||
|
|
||||||
|
|
||||||
task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`)
|
task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`)
|
||||||
.addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.')
|
.addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.')
|
||||||
|
@ -11,8 +10,11 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
|
||||||
if (!localBRE.network.config.chainId) {
|
if (!localBRE.network.config.chainId) {
|
||||||
throw new Error('INVALID_CHAIN_ID');
|
throw new Error('INVALID_CHAIN_ID');
|
||||||
}
|
}
|
||||||
|
const network = localBRE.network.name;
|
||||||
|
|
||||||
const addressesByNetwork = {
|
const addressesByNetwork: {
|
||||||
|
[key: string]: { incentivesController: string; aaveOracle: string };
|
||||||
|
} = {
|
||||||
[eEthereumNetwork.kovan]: {
|
[eEthereumNetwork.kovan]: {
|
||||||
incentivesController: '0x0000000000000000000000000000000000000000',
|
incentivesController: '0x0000000000000000000000000000000000000000',
|
||||||
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
|
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
|
||||||
|
@ -30,18 +32,25 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
|
||||||
aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5',
|
aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
const supportedNetworks = Object.keys(addressesByNetwork);
|
||||||
|
|
||||||
|
if (!supportedNetworks.includes(network)) {
|
||||||
|
console.error(
|
||||||
|
`[task][error] Network "${network}" not supported, please use one of: ${supportedNetworks.join()}`
|
||||||
|
);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const oracle = addressesByNetwork[network].aaveOracle;
|
||||||
|
const incentivesController = addressesByNetwork[network].aaveOracle;
|
||||||
|
|
||||||
console.log(`\n- UiPoolDataProvider deployment`);
|
console.log(`\n- UiPoolDataProvider deployment`);
|
||||||
|
|
||||||
console.log(`\tDeploying UiPoolDataProvider implementation ...`);
|
const uiPoolDataProvider = await deployUiPoolDataProvider(
|
||||||
const uiPoolDataProvider = await new UiPoolDataProviderFactory(
|
[incentivesController, oracle],
|
||||||
await localBRE.ethers.provider.getSigner()
|
verify
|
||||||
).deploy();
|
);
|
||||||
await uiPoolDataProvider.deployTransaction.wait();
|
|
||||||
console.log('uiPoolDataProvider.address', uiPoolDataProvider.address);
|
|
||||||
if (verify) {
|
|
||||||
await verifyContract(eContractid.UiPoolDataProvider, uiPoolDataProvider, []);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address);
|
||||||
console.log(`\tFinished UiPoolDataProvider deployment`);
|
console.log(`\tFinished UiPoolDataProvider deployment`);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user