Discover more of SonicScan Block Explorer's tools and services in one place.
Contract Source Code:
File 1 of 1 : Incubator_Proxy.sol
/* █▀ █▀█ █▄░█ █ █▀▀ █▀▀ ▄▀█ █▀▀ ▀█▀ █▀█ █▀█ █▄█ ▄█ █▄█ █░▀█ █ █▄▄ █▀░ █▀█ █▄▄ ░█░ █▄█ █▀▄ ░█░ Trade on SonicFactory and have fun! Web: https://sonicfactory.fun/ */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; library StorageSlot { function getAddressSlot(bytes32 _slot) internal view returns (address) { address addr; assembly { addr := sload(_slot) } return addr; } function setAddressSlot(bytes32 _slot, address _addr) internal { assembly { sstore(_slot, _addr) } } } contract Incubator_Proxy { bytes32 private constant ADMIN_SLOT = bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1); bytes32 private constant IMPLEMENTATION_SLOT = bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); event ImplementationUpgraded(address indexed implementation); modifier onlyOwner() { if (msg.sender == owner()) { _; } else { _fallback(); } } constructor() payable { _transferOwnership(msg.sender); } function owner() public view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT); } function transferOwnership(address newOwner) external onlyOwner { _transferOwnership(newOwner); } function getImplementation() external view returns (address) { return _getImplementation(); } function setImplementation(address _implementation) external onlyOwner { _setImplementation(_implementation); } function _transferOwnership(address newOwner) private { require(newOwner != address(0)); address oldOwner = owner(); StorageSlot.setAddressSlot(ADMIN_SLOT, newOwner); emit OwnershipTransferred(oldOwner, newOwner); } function _getImplementation() private view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT); } function _setImplementation(address _implementation) private { StorageSlot.setAddressSlot(IMPLEMENTATION_SLOT, _implementation); emit ImplementationUpgraded(_implementation); } function _delegate(address _implementation) private returns (bytes memory) { assembly { let csize := calldatasize() calldatacopy(0, 0, csize) let result := delegatecall(gas(), _implementation, 0, csize, 0, 0) let rsize := returndatasize() returndatacopy(0, 0, rsize) switch result case 0 { revert(0, rsize) } default { return(0, rsize) } } } function _fallback() private { _delegate(_getImplementation()); } receive() external payable { _fallback(); } fallback() external payable { _fallback(); } }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.