Last active
March 4, 2022 08:38
-
-
Save bjoveski/3a2b1c1df7b2d1e58f8bf4f7b6f5904b to your computer and use it in GitHub Desktop.
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
import "./Forwarder.sol"; | |
contract ForwarderFactory { | |
function initForwarder(address destination, uint256 salt) public returns (Forwarder forwarder) { | |
bytes memory deploymentData = abi.encodePacked( | |
type(Forwarder).creationCode, | |
uint256(destination) | |
); | |
assembly { | |
forwarder := create2( | |
0x0, add(0x20, deploymentData), mload(deploymentData), salt | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment