mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
deployment scripts
This commit is contained in:
parent
6b1e542a5b
commit
e43d791d39
|
@ -63,17 +63,22 @@ import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
||||||
import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins';
|
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, UiIncentiveDataProvider } from '../types';
|
||||||
|
|
||||||
export const deployUiPoolDataProvider = async (
|
export const deployUiPoolDataProvider = async (verify?: boolean) => {
|
||||||
[incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress],
|
|
||||||
verify?: boolean
|
|
||||||
) => {
|
|
||||||
const id = eContractid.UiPoolDataProvider;
|
const id = eContractid.UiPoolDataProvider;
|
||||||
const args: string[] = [incentivesController, aaveOracle];
|
const instance = await deployContract<UiPoolDataProvider>(id, []);
|
||||||
const instance = await deployContract<UiPoolDataProvider>(id, args);
|
|
||||||
if (verify) {
|
if (verify) {
|
||||||
await verifyContract(id, instance, args);
|
await verifyContract(id, instance, []);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deployUiIncentiveDataProvider = async (verify?: boolean) => {
|
||||||
|
const id = eContractid.UiIncentiveDataProvider;
|
||||||
|
const instance = await deployContract<UiIncentiveDataProvider>(id, []);
|
||||||
|
if (verify) {
|
||||||
|
await verifyContract(id, instance, []);
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
||||||
|
|
23
tasks/deployments/deploy-UiIncentiveDataProvider.ts
Normal file
23
tasks/deployments/deploy-UiIncentiveDataProvider.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { task } from 'hardhat/config';
|
||||||
|
import { eContractid, eEthereumNetwork, eNetwork, ePolygonNetwork } from '../../helpers/types';
|
||||||
|
import { deployUiIncentiveDataProvider } from '../../helpers/contracts-deployments';
|
||||||
|
import { exit } from 'process';
|
||||||
|
|
||||||
|
task(
|
||||||
|
`deploy-${eContractid.UiIncentiveDataProvider}`,
|
||||||
|
`Deploys the UiIncentiveDataProvider contract`
|
||||||
|
)
|
||||||
|
.addFlag('verify', 'Verify UiIncentiveDataProvider contract via Etherscan API.')
|
||||||
|
.setAction(async ({ verify }, localBRE) => {
|
||||||
|
await localBRE.run('set-DRE');
|
||||||
|
if (!localBRE.network.config.chainId) {
|
||||||
|
throw new Error('INVALID_CHAIN_ID');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`\n- UiIncentiveDataProvider deployment`);
|
||||||
|
|
||||||
|
const uiIncentiveDataProvider = await deployUiIncentiveDataProvider(verify);
|
||||||
|
|
||||||
|
console.log('UiPoolDataProvider deployed at:', uiIncentiveDataProvider.address);
|
||||||
|
console.log(`\tFinished UiPoolDataProvider deployment`);
|
||||||
|
});
|
|
@ -10,46 +10,10 @@ 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: {
|
|
||||||
[key: string]: { incentivesController: string; aaveOracle: string };
|
|
||||||
} = {
|
|
||||||
[eEthereumNetwork.kovan]: {
|
|
||||||
incentivesController: '0x0000000000000000000000000000000000000000',
|
|
||||||
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
|
|
||||||
},
|
|
||||||
[eEthereumNetwork.main]: {
|
|
||||||
incentivesController: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5',
|
|
||||||
aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9',
|
|
||||||
},
|
|
||||||
[ePolygonNetwork.matic]: {
|
|
||||||
incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
|
|
||||||
aaveOracle: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d',
|
|
||||||
},
|
|
||||||
[ePolygonNetwork.mumbai]: {
|
|
||||||
incentivesController: '0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644',
|
|
||||||
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].incentivesController;
|
|
||||||
|
|
||||||
console.log(`\n- UiPoolDataProvider deployment`);
|
console.log(`\n- UiPoolDataProvider deployment`);
|
||||||
|
|
||||||
const uiPoolDataProvider = await deployUiPoolDataProvider(
|
const uiPoolDataProvider = await deployUiPoolDataProvider(verify);
|
||||||
[incentivesController, oracle],
|
|
||||||
verify
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address);
|
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