Skip to content

CREATE3 should have a way of call getDeployed with an address? #678

Answered by eugenioclrc
eugenioclrc asked this question in Q&A
Discussion options

You must be logged in to vote

Something like this:

    /// @dev Returns the deterministic address for `salt` and a `deployer` address.
    function getDeployed(bytes32 salt, address deployer) internal pure returns (address deployed) {
        /// @solidity memory-safe-assembly
        assembly {
            // Cache the free memory pointer.
            let m := mload(0x40)
            // Store `deployer`.
            mstore(0x00, deployer)
            // Store the prefix.
            mstore8(0x0b, 0xff)
            // Store the salt.
            mstore(0x20, salt)
            // Store the bytecode hash.
            mstore(0x40, _PROXY_BYTECODE_HASH)

            // Store the proxy's address.
            mstore(0x14, k…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Vectorized
Comment options

You must be logged in to vote
4 replies
@eugenioclrc
Comment options

@Vectorized
Comment options

@eugenioclrc
Comment options

@magnetto90
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants