Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xC4eA2B7f3a162a6b7e04281976F2B3D5388d1921
Balance 0 ETH
Nonce 1
Code Size 890 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

890 bytes
0x6080604052600436106100435760003560e01c8063025313a21461005a5780635aa4470f1461008e5780635c60da1b146100ae578063caaee91c146100e257610052565b3661005257610050610102565b005b610050610102565b34801561006657600080fd5b50600080516020610325833981519152545b6040516100859190610290565b60405180910390f35b34801561009a57600080fd5b506100506100a93660046102c0565b610149565b3480156100ba57600080fd5b507f537c8f97140f7a775517a62f35148621bc76e9c42a44bbc2ea525328d78d110754610078565b3480156100ee57600080fd5b506100506100fd3660046102c0565b6101ef565b7f537c8f97140f7a775517a62f35148621bc76e9c42a44bbc2ea525328d78d110780543660008037600080366000845af43d6000803e808015610144573d6000f35b3d6000fd5b336101606000805160206103258339815191525490565b6001600160a01b03161461018f5760405162461bcd60e51b8152600401610186906102e9565b60405180910390fd5b7f537c8f97140f7a775517a62f35148621bc76e9c42a44bbc2ea525328d78d11078181556040517fa4aad34cb5a053866d19858558ded4f0e32f22ef062e9748d4dfc744a71847da906101e3908490610290565b60405180910390a15050565b336102066000805160206103258339815191525490565b6001600160a01b03161461022c5760405162461bcd60e51b8152600401610186906102e9565b6000805160206103258339815191528181556040517fb0e6698704f906b344e27d5c15e5c014e1fb1c960fae1d551b984e55e9ca49d9906101e3908490610290565b60006001600160a01b0382165b92915050565b61028a8161026e565b82525050565b6020810161027b8284610281565b6102a78161026e565b81146102b257600080fd5b50565b803561027b8161029e565b6000602082840312156102d5576102d5600080fd5b60006102e184846102b5565b949350505050565b6020808252810161027b81601a81527f796f75277265206e6f74207468652070726f7879206f776e657200000000000060208201526040019056fec5c377c9be99fdef46ba06869394c89e01e52a75b2aa045044fe307a41383ffea2646970667358221220a997852fd5bfa9dc9c016a513c5923a794e4516c2b4ad65c15745a54c3c6efed64736f6c63430008100033

Verified Source Code Full Match

Compiler: v0.8.16+commit.07a7930e EVM: london
Proxy.sol 109 lines
//SPDX-License-Identifier: GPL-3.0

/*_____________________________________________________________________________________________*/
//   ________  ________  _________  ________  ________  ________  ___  ________  _________     /
//  |\   __  \|\   __  \|\___   ___\\   ____\|\   ____\|\   __  \|\  \|\   __  \|\___   ___\   /
//  \ \  \|\  \ \  \|\  \|___ \  \_\ \  \___|\ \  \___|\ \  \|\  \ \  \ \  \|\  \|___ \  \_|   /
//   \ \   __  \ \   _  _\   \ \  \ \ \_____  \ \  \    \ \   _  _\ \  \ \   ____\   \ \  \    /
//    \ \  \ \  \ \  \\  \|   \ \  \ \|____|\  \ \  \____\ \  \\  \\ \  \ \  \___|    \ \  \   /
//     \ \__\ \__\ \__\\ _\    \ \__\  ____\_\  \ \_______\ \__\\ _\\ \__\ \__\        \ \__\  /
//      \|__|\|__|\|__|\|__|    \|__| |\_________\|_______|\|__|\|__|\|__|\|__|         \|__|  /
//                                    \|_________|                                             /
/*_____________________________________________________________________________________________*/

pragma solidity 0.8.16;

contract Proxy {

    //address where the proxy will make the delegatecall
    bytes32 private constant logic_contract = keccak256("artscript.proxy.logic");
    bytes32 private constant proxy_owner = keccak256("artscript.proxy.owner");

    event LogicContractChange(address _newImplementation);
    event OwnerChange(address _newOwner);

    modifier onlyProxyOwner {
        require(proxyOwner() == msg.sender, "you're not the proxy owner");
        _;
    }

    constructor(address _logic_contract, bytes32 _seed, address _metadataServer) {
        bytes32 position = proxy_owner;
        address admin = msg.sender;
        assembly{
            sstore(position, admin)
        }
        position = logic_contract;
        assembly{
            sstore(position, _logic_contract)
        }
       (bool success, ) = _logic_contract.delegatecall(abi.encodeWithSignature("initialize(address,bytes32)", _metadataServer, _seed));
       require(success, "initialize failed");
    }

    fallback () external payable {
        _fallback();
    }

    receive () external payable {
        _fallback();
    }

    /**
     * @notice Function to change the logic contract.
     * @param _logicAddress New logic contract address.
     */
    function setLogicContract(address _logicAddress) external onlyProxyOwner {   
        bytes32 position = logic_contract;   
        assembly {
            sstore(position, _logicAddress)
        } 
        emit LogicContractChange(_logicAddress);
    } 

    /**
     * @notice Function to set the admin of the contract.
     * @param _newOwner New admin of the contract.
     */
    function setProxyOwner(address _newOwner) external onlyProxyOwner  {
        bytes32 position = proxy_owner;   
        assembly {
            sstore(position, _newOwner)
        } 
        emit OwnerChange(_newOwner);
    }
    
    /**
     * @notice Getter for the logic contract address
     */
    function implementation() public view returns(address impl) {   
        bytes32 position = logic_contract;   
        assembly {
            impl := sload(position)
        } 
    } 
    
    /**
     * @notice Getter for the proxy admin address
     */
    function proxyOwner() public view returns(address admin) {   
        bytes32 position = proxy_owner;   
        assembly {
            admin := sload(position)
        } 
    }

    function _fallback() internal {
        bytes32 position = logic_contract;
        assembly {
          let _target := sload(position)
          calldatacopy(0x0, 0x0, calldatasize())
          let result := delegatecall(gas(), _target, 0x0, calldatasize(), 0x0, 0)
          returndatacopy(0x0, 0x0, returndatasize())
          switch result 
          case 0 {revert(0, returndatasize())} 
          default {return (0, returndatasize())}
        }
    }
    
}

Read Contract

implementation 0x5c60da1b → address
proxyOwner 0x025313a2 → address

Write Contract 2 functions

These functions modify contract state and require a wallet transaction to execute.

setLogicContract 0x5aa4470f
address _logicAddress
setProxyOwner 0xcaaee91c
address _newOwner

Recent Transactions

No transactions found for this address