Skip to content

Commit

Permalink
minimal proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
stevennevins committed Sep 16, 2023
1 parent 593e83a commit 2cd8816
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/Create2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,20 @@ contract Create2Test is Test {

Emitter(predictedTo).ping();
}

function test_Create2MinimalProxy() public {
Emitter emitter = new Emitter();
address implementation = address(emitter);
bytes memory creationCode = bytes.concat(
hex"3d602d80600a3d3981f3363d3d373d3d3d363d73", bytes20(implementation), hex"5af43d82803e903d91602b57fd5bf3"
);
bytes32 salt = bytes32(0);
bytes memory initCode = bytes.concat(creationCode, abi.encode());

(bool success,) = CREATE2_FACTORY.call(bytes.concat(salt, initCode));
assertTrue(success);
address predictedTo = computeCreate2Address(salt, hashInitCode(creationCode));

Emitter(predictedTo).ping();
}
}

0 comments on commit 2cd8816

Please sign in to comment.