Skip to main content

derive_universal_create3_address

Function derive_universal_create3_address 

Source
pub fn derive_universal_create3_address(
    deployer: Address,
    salt: B256,
) -> Address
Expand description

Derive CREATE3 deployment address via the universal factory.

Convenience wrapper around derive_create3_address that uses UNIVERSAL_CREATE3_FACTORY as the factory. As with the general form, the result depends only on deployer and salt, not on the deployed bytecode, and is only meaningful on chains where that factory is actually deployed.

use evm_fork_cache::create3::derive_universal_create3_address;
use alloy_primitives::{Address, B256, address, b256};

let deployer: Address = address!("00000000000000000000000000000000000000aa");
let salt: B256 =
    b256!("1111111111111111111111111111111111111111111111111111111111111111");

// Deterministic: the same (deployer, salt) always derive the same address.
assert_eq!(
    derive_universal_create3_address(deployer, salt),
    derive_universal_create3_address(deployer, salt),
);