-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to verify contract upgrade
- Loading branch information
Showing
3 changed files
with
388 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Web3 from "web3"; | ||
|
||
import { argv } from "./setup"; | ||
import MainnetImpl from '../publish/mainnet.json'; | ||
import contracts from '../src/contracts'; | ||
import { getLogger } from './logger'; | ||
|
||
const main = async () => { | ||
const target = argv.target ?? 'child'; | ||
const contractsImpl = MainnetImpl[target]; | ||
const web3 = new Web3('https://base.llamarpc.com'); | ||
const logger = getLogger('verifyUpgrade'); | ||
|
||
for (const name in contractsImpl) { | ||
const contract = contractsImpl[name]; | ||
const address = contract.innerAddress; | ||
if (!address) continue; | ||
|
||
const contractInfo = contracts[name]; | ||
if (!contractInfo) { | ||
logger.error(`Contract not found: ${name}`); | ||
continue; | ||
} | ||
|
||
const localBytecode = contractInfo.deployedBytecode; | ||
const remoteBytecode = await web3.eth.getCode(address); | ||
if (remoteBytecode !== localBytecode) { | ||
logger.info(`🚨 Bytecode mismatch for contract: ${name}`); | ||
} else { | ||
logger.info(`🚀 Contract verification succeed: ${name}`); | ||
} | ||
} | ||
} | ||
|
||
main(); |
Oops, something went wrong.