Add snippet for enabling connectors after deployment

This commit is contained in:
Mubaris NK 2021-03-15 22:16:22 +05:30
parent 7a9fc83a5f
commit 593069bddd
No known key found for this signature in database
GPG Key ID: 9AC09AD0F8D68561

View File

@ -4,29 +4,43 @@ const { ethers } = hre;
const deployConnector = require("./deployConnector"); const deployConnector = require("./deployConnector");
async function main() { async function main() {
const connectors = [ const accounts = await hre.ethers.getSigners()
'ConnectV2OneInch', const wallet = accounts[0]
'ConnectV2AaveV1',
'ConnectV2AaveV2', const connectMapping = {
'ConnectV2Auth', '1inch': 'ConnectV2OneInch',
'ConnectV2Basic', 'aaveV1': 'ConnectV2AaveV1',
'ConnectV2COMP', 'aaveV2': 'ConnectV2AaveV2',
'ConnectV2Compound', 'auth': 'ConnectV2Auth',
'ConnectV2Dydx', 'basic': 'ConnectV2Basic',
'ConnectV2Fee', 'comp': 'ConnectV2COMP',
'ConnectV2Gelato', 'compound': 'ConnectV2Compound',
'ConnectV2Maker', 'dydx': 'ConnectV2Dydx',
'ConnectV2UniswapV2' 'fee': 'ConnectV2Fee',
] 'gelato': 'ConnectV2Gelato',
'maker': 'ConnectV2Maker',
for (const connector of connectors) { 'uniswap': 'ConnectV2UniswapV2'
await deployConnector(connector)
} }
const addressMapping = {}
for (const key in connectMapping) {
addressMapping[key] = await deployConnector(connectMapping[key])
}
const connectorsAbi = [
"function addConnectors(string[] _connectorNames, address[] _connectors)"
]
// Replace the address with correct v2 connectors registry address
const connectorsContract = new ethers.Contract("0x84b457c6D31025d56449D5A01F0c34bF78636f67", connectorsAbi, wallet)
await connectorsContract.addConnectors(Object.keys(addressMapping), Object.values(addressMapping))
} }
main() main()
.then(() => process.exit(0)) .then(() => process.exit(0))
.catch(error => { .catch(error => {
console.error(error); console.error(error);
process.exit(1); process.exit(1);
}); });