Last active
April 28, 2021 17:50
-
-
Save alexanderattar/58baa17f93244aa81868120c6322c7e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const { exec } = require("child_process"); | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
const contracts = { | |
"AddressManager": { | |
"address": "0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
"params": [] | |
}, | |
"OVM_L1CrossDomainMessenger": { | |
"address": "0xE8F1bD5e5629F4adac6fd63A39F4b4cB76c5E7B2", | |
"params": [] | |
}, | |
"Proxy__OVM_L1CrossDomainMessenger": { | |
"address": "0xfBE93ba0a2Df92A8e8D40cE00acCF9248a6Fc812", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
"OVM_L1CrossDomainMessenger" | |
] | |
}, | |
"OVM_CanonicalTransactionChain": { | |
"address": "0xed2701f7135eab0D7ca02e6Ab634AD6CbE159Ffb", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
18000000, | |
1200000, | |
9000000 | |
] | |
}, | |
"OVM_StateCommitmentChain": { | |
"address": "0x901a629a72A5daF200fc359657f070b34bBfdd18", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
604800, | |
18000000 | |
] | |
}, | |
"OVM_L1MessageSender": { | |
"address": "0xfB575F7E68F9B01f648F4536370AB4d6E31b8d3a", | |
"params": [] | |
}, | |
"OVM_SafetyChecker": { | |
"address": "0x3F4914B14cb75D83935E4b42Cc27B0BEE21b862c", | |
"params": [] | |
}, | |
"OVM_ExecutionManager": { | |
"address": "0x8Ef57E19D3961497582f4e4b662f3815342DAE07", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
{ | |
"minTransactionGasLimit": 50000, | |
"maxTransactionGasLimit": 9000000, | |
"maxGasPerQueuePerEpoch": 250000000, | |
"secondsPerEpoch": 0 | |
}, | |
{ | |
"ovmCHAINID": 10, | |
"L2CrossDomainMessengerAddress": "0x4200000000000000000000000000000000000007" | |
} | |
] | |
}, | |
"OVM_StateManagerFactory": { | |
"address": "0x1E8367f0A53ED2C98d8E56310f6F30BA27e358De", | |
"params": [] | |
}, | |
"OVM_FraudVerifier": { | |
"address": "0xb89f3cF275F0ccbe6d70Fa01E225879dCCd4184F", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1" | |
] | |
}, | |
"OVM_StateTransitionerFactory": { | |
"address": "0x88F9A790F56bb8589c077485742B58e6eE8FdCcE", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1" | |
] | |
}, | |
"OVM_BondManager": { | |
"address": "0x64cfd73BE445F6Aa4ee9F4f7B1d068008a9DAc06", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1" | |
] | |
}, | |
"OVM_ChainStorageContainer:CTC:batches": { | |
"address": "0x7Cb043e523F6B5D492E0d2221e45062d3878599c", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
"OVM_CanonicalTransactionChain" | |
] | |
}, | |
"OVM_ChainStorageContainer:CTC:queue": { | |
"address": "0x62De49fe8215DFF88b9C1a2ea573E1471fF61f83", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
"OVM_CanonicalTransactionChain" | |
] | |
}, | |
"OVM_ChainStorageContainer:SCC:batches": { | |
"address": "0x7C3e67e5E885556cEF01866CB7bdB5A254D35698", | |
"params": [ | |
"0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
"OVM_StateCommitmentChain" | |
] | |
} | |
} | |
async function writeArguments(output) { | |
const timestamp = Date.now() | |
fs.writeFile(`./deploy-arguments/arguments.js`, output, (error) => { | |
// throws an error, you could also catch it here | |
if (error) throw error; | |
// success case, the file was saved | |
console.log('Done writing arguments.js') | |
}) | |
} | |
async function verify(address) { | |
exec(`npx hardhat verify --constructor-args ./deploy-arguments/arguments.js --network mainnet ${address}`, (error, stdout, stderr) => { | |
if (error) { | |
console.log(`error: ${error.message}`); | |
return | |
} | |
if (stderr) { | |
console.log(`stderr: ${stderr}`); | |
return | |
} | |
console.log(`stdout: ${stdout}`); | |
}) | |
} | |
(async () => { | |
for (const [key, value] of Object.entries(contracts)) { | |
const address = value.address | |
const params = JSON.stringify(value.params) | |
let output = `module.exports = ${params}` | |
console.log(key); | |
console.log(output) | |
await writeArguments(output) | |
await verify(address) | |
console.log('Sleeping') | |
await sleep(30000) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment