Loading

create2_predict

Scalar function

Derives the deterministic CREATE2 deployment address from a deployer, 32-byte salt, and init code hash.

create2_predict(ADDRESS, BYTES32, BYTES32)

Expects `salt` as a BYTES32 value, matching the pre-hashed CREATE2 salt format.

Parameters

NameType
deployerADDRESS
saltBYTES32
init_hashBYTES32

Returns

NameType
addressADDRESS
1
SELECT create2_predict(
2
'0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'::address, -- deployer
3
'0x000000000000000000000000000000000000000000000000000000000000002a'::bytes32, -- salt
4
keccak256('0x6001600055') -- init_hash
5
) AS contract_address;
Notebook ready in readonly mode.

create2_predict(ADDRESS, BIGINT, BYTES32)

Accepts an unsigned integer salt and left-pads it to 32 bytes before computing the CREATE2 address.

Parameters

NameType
deployerADDRESS
saltBIGINT
init_hashBYTES32

Returns

NameType
addressADDRESS
1
SELECT create2_predict(
2
'0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'::address, -- deployer
3
42, -- salt
4
keccak256('0x6001600055') -- init_hash
5
) AS contract_address;
Notebook ready in readonly mode.