Smart Contract Repository
InitializedProxy

InitializedProxy

Deploy on Alchemy

Contract Information

This contract is a proxy and the implementation details are not yet known.
More Info

InitializedProxy Source Code

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title InitializedProxy * @author Anna Carroll */ contract InitializedProxy { // address of logic contract address public immutable logic; // ======== Constructor ========= constructor( address _logic, bytes memory _initializationCalldata ) { logic = _logic; // Delegatecall into the logic contract, supplying initialization calldata (bool _ok, bytes memory returnData) = _logic.delegatecall(_initializationCalldata); // Revert if delegatecall to implementation reverts require(_ok, string(returnData)); } // ======== Fallback ========= fallback() external payable { address _impl = logic; assembly { let ptr := mload(0x40) calldatacopy(ptr, 0, calldatasize()) let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0) let size := returndatasize() returndatacopy(ptr, 0, size) switch result case 0 { revert(ptr, size) } default { return(ptr, size) } } } // ======== Receive ========= receive() external payable {} // solhint-disable-line no-empty-blocks }
< // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title InitializedProxy
 * @author Anna Carroll
 */
contract InitializedProxy {
    // address of logic contract
    address public immutable logic;

    // ======== Constructor =========

    constructor(
        address _logic,
        bytes memory _initializationCalldata
    ) {
        logic = _logic;
        // Delegatecall into the logic contract, supplying initialization calldata
        (bool _ok, bytes memory returnData) =
            _logic.delegatecall(_initializationCalldata);
        // Revert if delegatecall to implementation reverts
        require(_ok, string(returnData));
    }

    // ======== Fallback =========

    fallback() external payable {
        address _impl = logic;
        assembly {
            let ptr := mload(0x40)
            calldatacopy(ptr, 0, calldatasize())
            let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
            let size := returndatasize()
            returndatacopy(ptr, 0, size)

            switch result
                case 0 {
                    revert(ptr, size)
                }
                default {
                    return(ptr, size)
                }
        }
    }

    // ======== Receive =========

    receive() external payable {} // solhint-disable-line no-empty-blocks
} < 

InitializedProxy ABI

[{"inputs":[{"internalType":"address","name":"_logic","type":"address"},{"internalType":"bytes","name":"_initializationCalldata","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"logic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
[{"inputs":[{"internalType":"address","name":"_logic","type":"address"},{"internalType":"bytes","name":"_initializationCalldata","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"logic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

InitializedProxy Bytecode

60a060405234801561001057600080fd5b5060405161035738038061035783398101604081905261002f916100d7565b6001600160601b0319606083901b1660805260405160009081906001600160a01b0385169061005f9085906101a5565b600060405180830381855af49150503d806000811461009a576040519150601f19603f3d011682016040523d82523d6000602084013e61009f565b606091505b50915091508181906100cd5760405162461bcd60e51b81526004016100c491906101c1565b60405180910390fd5b505050505061023a565b600080604083850312156100ea57600080fd5b82516001600160a01b038116811461010157600080fd5b60208401519092506001600160401b038082111561011e57600080fd5b818501915085601f83011261013257600080fd5b81518181111561014457610144610224565b604051601f8201601f19908116603f0116810190838211818310171561016c5761016c610224565b8160405282815288602084870101111561018557600080fd5b6101968360208301602088016101f4565b80955050505050509250929050565b600082516101b78184602087016101f4565b9190910192915050565b60208152600082518060208401526101e08160408501602087016101f4565b601f01601f19169190910160400192915050565b60005b8381101561020f5781810151838201526020016101f7565b8381111561021e576000848401525b50505050565b634e487b7160e01b600052604160045260246000fd5b60805160601c60fc61025b60003960008181602a0152607b015260fc6000f3fe608060405260043610601f5760003560e01c8063d7dfa0dd14606b576025565b36602557005b6040517f00000000000000000000000000000000000000000000000000000000000000009036600082376000803683855af43d806000843e8180156067578184f35b8184fd5b348015607657600080fd5b50609d7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f3fea264697066735822122013174273c18ed4bea127cbc0952900378004a1870c433d85adc8dafba30dae5764736f6c634300080500330000000000000000000000007b0fce54574d9746414d11367f54c9ab94e53dca00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000184626fb2f000000000000000000000000090e5aa59a9df2add394df81521dbbed5f3c4a1a3000000000000000000000000521f9c7505005cfa19a8e5786a9c3c9c9f5e6f4200000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000008e890a7c0e2a43400000000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000f526f677565204d61676520416e647900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003524d41000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
60a060405234801561001057600080fd5b5060405161035738038061035783398101604081905261002f916100d7565b6001600160601b0319606083901b1660805260405160009081906001600160a01b0385169061005f9085906101a5565b600060405180830381855af49150503d806000811461009a576040519150601f19603f3d011682016040523d82523d6000602084013e61009f565b606091505b50915091508181906100cd5760405162461bcd60e51b81526004016100c491906101c1565b60405180910390fd5b505050505061023a565b600080604083850312156100ea57600080fd5b82516001600160a01b038116811461010157600080fd5b60208401519092506001600160401b038082111561011e57600080fd5b818501915085601f83011261013257600080fd5b81518181111561014457610144610224565b604051601f8201601f19908116603f0116810190838211818310171561016c5761016c610224565b8160405282815288602084870101111561018557600080fd5b6101968360208301602088016101f4565b80955050505050509250929050565b600082516101b78184602087016101f4565b9190910192915050565b60208152600082518060208401526101e08160408501602087016101f4565b601f01601f19169190910160400192915050565b60005b8381101561020f5781810151838201526020016101f7565b8381111561021e576000848401525b50505050565b634e487b7160e01b600052604160045260246000fd5b60805160601c60fc61025b60003960008181602a0152607b015260fc6000f3fe608060405260043610601f5760003560e01c8063d7dfa0dd14606b576025565b36602557005b6040517f00000000000000000000000000000000000000000000000000000000000000009036600082376000803683855af43d806000843e8180156067578184f35b8184fd5b348015607657600080fd5b50609d7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f3fea264697066735822122013174273c18ed4bea127cbc0952900378004a1870c433d85adc8dafba30dae5764736f6c634300080500330000000000000000000000007b0fce54574d9746414d11367f54c9ab94e53dca00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000184626fb2f000000000000000000000000090e5aa59a9df2add394df81521dbbed5f3c4a1a3000000000000000000000000521f9c7505005cfa19a8e5786a9c3c9c9f5e6f4200000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000008e890a7c0e2a43400000000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000f526f677565204d61676520416e647900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003524d41000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Check out more smart contracts

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.