Skip to content

Commit

Permalink
Add script to get contract codehash (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
channing-magiceden authored Feb 13, 2024
1 parent fb5f422 commit 2cb8575
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,14 @@ task('deployOwnedRegistrant', 'Deploy OwnedRegistrant')
.addParam('newowner', 'new owner address', '0x0000000000000000000000000000000000000000')
.setAction(deployOwnedRegistrant);

task('getContractCodehash', 'Get the code hash of a contract')
.addParam('contract', 'contract address')
.setAction(async (args, hre) => {
const [signer] = await hre.ethers.getSigners();
const provider = signer.provider;
let code = await provider!.getCode(args.contract);
const codehash = hre.ethers.utils.keccak256(code);
console.log(codehash);
});

export default config;

0 comments on commit 2cb8575

Please sign in to comment.