You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assembly {
// Prepare the contract creation code for the clone
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
instance := create2(0, 0x09, 0x37, salt)
}
// Revert if the clone operation failed
if (instance == address(0))
revert CloneOpCancelled("Creation Failed");
// Call the initialization function of the newly cloned contract
(bool success, ) = instance.call(initData);
Minimal reproduction steps
this code works on remix ide on polygon mainnet. but when I use it on polygon mainnet fork for testing it gives initialization fail error. I use another version of assembly code, it passes initialization but could not generate abi correctly.
let pointer := mload(0x40)
// mstore 32 bytes at the start of free memory
mstore(pointer, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
// overwrite the trailing 0s above with implementation contract's address in bytes
mstore(add(pointer, 0x14), implementation)
// store 32 bytes to memory starting at "clone" + 40 bytes
mstore(add(pointer, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
instance := create2(0, pointer, 0x37, salt)
Search terms
create2 on hardhat
The text was updated successfully, but these errors were encountered:
Version of Hardhat
2.22.12
What happened?
Minimal reproduction steps
this code works on remix ide on polygon mainnet. but when I use it on polygon mainnet fork for testing it gives initialization fail error. I use another version of assembly code, it passes initialization but could not generate abi correctly.
Search terms
create2 on hardhat
The text was updated successfully, but these errors were encountered: