Skip to content

Does Foundry use the default CREATE2_FACTORY when running tests? #5079

Closed Answered by PaulRBerg
PaulRBerg asked this question in Help
Discussion options

You must be logged in to vote

Looks like it does use that factory even when testing. I wrote this test to check:

function test_Example() external {
    bytes memory zeroBytecode = address(0xfF00000000000000000000000000000000000000).code;
    bytes memory factoryBytecode = CREATE2_FACTORY.code;
    assertEq(zeroBytecode, factoryBytecode, "bytecodes mismatch");
}

factoryBytecode has this value:

0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3

Just like the value it has on Mainnet.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by PaulRBerg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant