2020-11-30 13:14:29 +00:00
|
|
|
import { task } from 'hardhat/config';
|
2021-08-24 11:31:43 +00:00
|
|
|
import {
|
|
|
|
eAvalancheNetwork,
|
|
|
|
eContractid,
|
|
|
|
eEthereumNetwork,
|
|
|
|
eNetwork,
|
|
|
|
ePolygonNetwork,
|
|
|
|
} from '../../helpers/types';
|
2021-05-12 08:15:41 +00:00
|
|
|
import { deployUiPoolDataProvider } from '../../helpers/contracts-deployments';
|
|
|
|
import { exit } from 'process';
|
2020-10-30 10:16:21 +00:00
|
|
|
|
|
|
|
task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`)
|
|
|
|
.addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.')
|
2020-11-30 13:14:29 +00:00
|
|
|
.setAction(async ({ verify }, localBRE) => {
|
|
|
|
await localBRE.run('set-DRE');
|
2020-10-30 10:16:21 +00:00
|
|
|
if (!localBRE.network.config.chainId) {
|
|
|
|
throw new Error('INVALID_CHAIN_ID');
|
|
|
|
}
|
2021-05-12 08:15:41 +00:00
|
|
|
const network = localBRE.network.name;
|
2020-10-30 10:16:21 +00:00
|
|
|
|
2021-05-12 08:15:41 +00:00
|
|
|
const addressesByNetwork: {
|
|
|
|
[key: string]: { incentivesController: string; aaveOracle: string };
|
|
|
|
} = {
|
2021-04-26 13:57:26 +00:00
|
|
|
[eEthereumNetwork.kovan]: {
|
|
|
|
incentivesController: '0x0000000000000000000000000000000000000000',
|
|
|
|
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
|
|
|
|
},
|
2021-04-19 15:23:45 +00:00
|
|
|
[eEthereumNetwork.main]: {
|
2021-04-21 17:16:11 +00:00
|
|
|
incentivesController: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5',
|
2021-04-19 15:23:45 +00:00
|
|
|
aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9',
|
|
|
|
},
|
2021-03-30 11:17:08 +00:00
|
|
|
[ePolygonNetwork.matic]: {
|
|
|
|
incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
|
2021-06-08 13:42:04 +00:00
|
|
|
aaveOracle: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d',
|
2021-03-30 11:17:08 +00:00
|
|
|
},
|
2021-04-09 08:57:01 +00:00
|
|
|
[ePolygonNetwork.mumbai]: {
|
2021-04-12 19:36:34 +00:00
|
|
|
incentivesController: '0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644',
|
|
|
|
aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5',
|
2021-04-09 08:57:01 +00:00
|
|
|
},
|
2021-07-21 09:38:55 +00:00
|
|
|
[eAvalancheNetwork.fuji]: {
|
2021-08-24 11:31:43 +00:00
|
|
|
incentivesController: '0xa1EF206fb9a8D8186157FC817fCddcC47727ED55',
|
|
|
|
aaveOracle: '0xD217DdD9f0Af84644dEFe84a0b634621D4617a29',
|
2021-07-21 09:38:55 +00:00
|
|
|
},
|
2021-10-04 16:56:39 +00:00
|
|
|
[eAvalancheNetwork.avalanche]: {
|
|
|
|
incentivesController: '0x01D83Fe6A10D2f2B7AF17034343746188272cAc9',
|
|
|
|
aaveOracle: '0xdC336Cd4769f4cC7E9d726DA53e6d3fC710cEB89',
|
|
|
|
},
|
2021-03-30 11:17:08 +00:00
|
|
|
};
|
2021-05-12 08:15:41 +00:00
|
|
|
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;
|
2021-06-08 12:24:48 +00:00
|
|
|
const incentivesController = addressesByNetwork[network].incentivesController;
|
2021-03-30 11:17:08 +00:00
|
|
|
|
2020-10-30 10:16:21 +00:00
|
|
|
console.log(`\n- UiPoolDataProvider deployment`);
|
|
|
|
|
2021-05-12 08:15:41 +00:00
|
|
|
const uiPoolDataProvider = await deployUiPoolDataProvider(
|
|
|
|
[incentivesController, oracle],
|
|
|
|
verify
|
|
|
|
);
|
2020-10-30 10:16:21 +00:00
|
|
|
|
2021-05-12 08:15:41 +00:00
|
|
|
console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address);
|
2021-03-12 17:06:15 +00:00
|
|
|
console.log(`\tFinished UiPoolDataProvider deployment`);
|
2020-10-30 10:16:21 +00:00
|
|
|
});
|