SimpleP1

0x6ca55a9668d6737488381146b3a0ed99c6c03326

Verification
Verified
v0.8.20+commit.a1b79de6
Type
Contract
1,387 bytes
ABI entries
13
2 read · 2 write
License
none

Contract information

Address
0x6ca55a9668d6737488381146b3a0ed99c6c03326
Chain
Robinhood Chain (4663)
Compiler
v0.8.20+commit.a1b79de6
Optimization
Disabled
Creation tx
0xeac41980ae…9b19ec105f

Token

Name
dogedoge
Symbol
dogedoge
Decimals
18
Holders
33,946

Read contract (2)

implementation()address
owner()address

Events (2)

ImplementationSetOwnershipRenounced

ABI

[
  {
    "inputs": [],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "inputs": [],
    "name": "ImplementationAlreadySet",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ImplementationNotSet",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "NotOwner",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ZeroAddress",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "implementation",
        "type": "address"
      }
    ],
    "name": "ImplementationSet",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [],
    "name": "OwnershipRenounced",
    "type": "event"
  },
  {
    "stateMutability": "payable",
    "type": "fallback"
  },
  {
    "inputs": [],
    "name": "implementation",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "owner",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "renounceOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_implementation",
        "type": "address"
      }
    ],
    "name": "setImplementation",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "stateMutability": "payable",
    "type": "receive"
  }
]

Source code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;


contract SimpleP1 {


    bytes32 private constant _OWNER_SLOT =
        0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    bytes32 private constant _IMPL_SLOT =
        0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;


    event ImplementationSet(address indexed implementation);

    event OwnershipRenounced();



    error NotOwner();
    error ZeroAddress();
    error ImplementationAlreadySet();
    error ImplementationNotSet();



    modifier onlyOwner() {
        if (_getOwner() != msg.sender) revert NotOwner();
        _;
    }


    constructor() {
        _setOwner(msg.sender);
    }



    function owner() external view returns (address) {
        return _getOwner();
    }


    function implementation() external view returns (address) {
        return _getImpl();
    }


    function setImplementation(address _implementation) external onlyOwner {
        if (_implementation == address(0)) revert ZeroAddress();
        if (_getImpl() != address(0)) revert ImplementationAlreadySet();

        _setImpl(_implementation);
        emit ImplementationSet(_implementation);
    }

    function renounceOwnership() external onlyOwner {
        _setOwner(address(0));
        emit OwnershipRenounced();
    }


    function _getOwner() internal view returns (address o) {
        bytes32 slot = _OWNER_SLOT;
        assembly {
            o := sload(slot)
        }
    }


    function _setOwner(address o) internal {
        bytes32 slot = _OWNER_SLOT;
        assembly {
            sstore(slot, o)
        }
    }


    function _getImpl() internal view returns (address o) {
        bytes32 slot = _IMPL_SLOT;
        assembly {
            o := sload(slot)
        }
    }


    function _setImpl(address o) internal {
        bytes32 slot = _IMPL_SLOT;
        assembly {
            sstore(slot, o)
        }
    }


    fallback() external payable {
        _delegate(_getImpl());
    }


    receive() external payable {
        _delegate(_getImpl());
    }


    function _delegate(address impl) internal {
        if (impl == address(0)) revert ImplementationNotSet();

        assembly {
   
            calldatacopy(0, 0, calldatasize())

  
            let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)

            returndatacopy(0, 0, returndatasize())

            switch result
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }
}
Chain explorer2515msChain node72ms