Skip to content

Instantly share code, notes, and snippets.

@an-ivannikov
Last active June 19, 2022 12:04
Show Gist options
  • Save an-ivannikov/a02e187b8b2961e86880d8ff9764f107 to your computer and use it in GitHub Desktop.
Save an-ivannikov/a02e187b8b2961e86880d8ff9764f107 to your computer and use it in GitHub Desktop.
Get Uniswap Init Code Hash
const ValueswapV2Pair = artifacts.require('ValueswapV2Pair.sol');
module.exports = async (callback) => {
console.log(
'ValueswapV2Pair bytecode hash (Look for INIT_CODE_HASH):\n%s',
(web3.utils.keccak256(ValueswapV2Pair.bytecode)).substring(2)
);
callback();
}
/*
pragma solidity =0.5.16;
import './UniswapV2Pair.sol';
contract CalHash {
function getInitHash() public pure returns(bytes32){
bytes memory bytecode = type(UniswapV2Pair).creationCode;
return keccak256(abi.encodePacked(bytecode));
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment