Skip to content

Commit b7462c6

Browse files
committed
feat: update UiPoolDataProvider task to match other tasks code style. Fix old reference of verifyContract at deployUiPoolDataProvider function.
1 parent 6312f9a commit b7462c6

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

helpers/contracts-deployments.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ import {
5656
linkBytecode,
5757
insertContractAddressInDb,
5858
deployContract,
59+
verifyContract,
5960
} from './contracts-helpers';
6061
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
6162
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
6263
import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins';
6364
import { HardhatRuntimeEnvironment } from 'hardhat/types';
6465
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
6566
import { UiPoolDataProvider } from '../types';
66-
import { verifyContract } from './etherscan-verification';
6767

6868
export const deployUiPoolDataProvider = async (
6969
[incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress],
@@ -73,7 +73,7 @@ export const deployUiPoolDataProvider = async (
7373
const args: string[] = [incentivesController, aaveOracle];
7474
const instance = await deployContract<UiPoolDataProvider>(id, args);
7575
if (verify) {
76-
await verifyContract(instance.address, args);
76+
await verifyContract(id, instance, args);
7777
}
7878
return instance;
7979
};
Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { task } from 'hardhat/config';
2-
import { UiPoolDataProviderFactory } from '../../types';
3-
import { verifyContract } from '../../helpers/contracts-helpers';
4-
import { eContractid } from '../../helpers/types';
5-
2+
import { eContractid, eEthereumNetwork, eNetwork, ePolygonNetwork } from '../../helpers/types';
3+
import { deployUiPoolDataProvider } from '../../helpers/contracts-deployments';
4+
import { exit } from 'process';
65

76
task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`)
87
.addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.')
@@ -11,8 +10,11 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
1110
if (!localBRE.network.config.chainId) {
1211
throw new Error('INVALID_CHAIN_ID');
1312
}
13+
const network = localBRE.network.name;
1414

15-
const addressesByNetwork = {
15+
const addressesByNetwork: {
16+
[key: string]: { incentivesController: string; aaveOracle: string };
17+
} = {
1618
[eEthereumNetwork.kovan]: {
1719
incentivesController: '0x0000000000000000000000000000000000000000',
1820
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
@@ -30,18 +32,25 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
3032
aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5',
3133
},
3234
};
35+
const supportedNetworks = Object.keys(addressesByNetwork);
36+
37+
if (!supportedNetworks.includes(network)) {
38+
console.error(
39+
`[task][error] Network "${network}" not supported, please use one of: ${supportedNetworks.join()}`
40+
);
41+
exit(2);
42+
}
43+
44+
const oracle = addressesByNetwork[network].aaveOracle;
45+
const incentivesController = addressesByNetwork[network].aaveOracle;
3346

3447
console.log(`\n- UiPoolDataProvider deployment`);
3548

36-
console.log(`\tDeploying UiPoolDataProvider implementation ...`);
37-
const uiPoolDataProvider = await new UiPoolDataProviderFactory(
38-
await localBRE.ethers.provider.getSigner()
39-
).deploy();
40-
await uiPoolDataProvider.deployTransaction.wait();
41-
console.log('uiPoolDataProvider.address', uiPoolDataProvider.address);
42-
if (verify) {
43-
await verifyContract(eContractid.UiPoolDataProvider, uiPoolDataProvider, []);
44-
}
49+
const uiPoolDataProvider = await deployUiPoolDataProvider(
50+
[incentivesController, oracle],
51+
verify
52+
);
4553

54+
console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address);
4655
console.log(`\tFinished UiPoolDataProvider deployment`);
4756
});

0 commit comments

Comments
 (0)