false
false
0

Contract Address Details

0xa3803769AD463004B1892fd29F25E4197906d70b

Token
Bitpost (BPG)
Creator
0x407b23–5f7771 at 0xc6c734–d0c8ba
Balance
0 BPX
Tokens
Fetching tokens...
Transactions
15 Transactions
Transfers
0 Transfers
Gas Used
2,609,750
Last Balance Update
540042
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
Proxy




Optimization enabled
false
Compiler version
v0.8.28+commit.7893614a




EVM Version
shanghai




Verified at
2025-01-20T11:58:12.936540Z

Constructor Arguments

0x000000000000000000000000407b23dad0bd32a3b1ad184a2e61c206615f77710000000000000000000000000000000000000000000000000000000000001388

Arg [0] (address) : 0x407b23dad0bd32a3b1ad184a2e61c206615f7771
Arg [1] (uint16) : 5000

              

Contract source code

Sol2uml
new
// File: bitpost-contracts/contracts-common/interfaces/access/IOwnable.sol



pragma solidity ^0.8.20;

interface IOwnable {
    error OwnableUnauthorized(address sender, address owner);
    error OwnableInvalidOwner(address owner);
    
    function getOwner() external view returns(address);
    function setOwner(address owner) external;
}

// File: bitpost-contracts/contracts-vm/interfaces/IVersionManager.sol



pragma solidity ^0.8.20;


interface IVersionManager is IOwnable {
    error VersionManagerInvalidCid(uint16 cid);
    
    function getImplementation(uint16 cid) external view returns(address);
    function setImplementation(uint16 cid, address implementation) external;
    function newContract(uint16 cid) external returns(address);
}

// File: bitpost-contracts/contracts-common/contracts/upgrade/Upgradeable.sol



pragma solidity ^0.8.20;


abstract contract Upgradeable {
    /// @custom:storage-location erc7201:bitpost.common.Upgradeable
    struct Storage_Upgradeable {
        IVersionManager versionManager;
        uint16 cid;
    }
    
    // keccak256(abi.encode(uint256(keccak256("bitpost.common.Upgradeable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant STORAGE_LOCATION_UPGRADEABLE = 0x828626e98fd64181cb42e58a50c4931f9ea11da1800ee5ae64b4a2a58285ae00;
    
    function _init_Upgradeable(IVersionManager versionManager, uint16 cid) internal {
        Storage_Upgradeable storage $ = _getStorage_Upgradeable();
        $.versionManager = versionManager;
        $.cid = cid;
    }
    
    function _getVersionManager() internal view returns(IVersionManager) {
        Storage_Upgradeable storage $ = _getStorage_Upgradeable();
        return $.versionManager;
    }
    
    function _getCid() internal view returns(uint16) {
        Storage_Upgradeable storage $ = _getStorage_Upgradeable();
        return $.cid;
    }
    
    function _getStorage_Upgradeable() private pure returns(Storage_Upgradeable storage $) {
        assembly {
            $.slot := STORAGE_LOCATION_UPGRADEABLE
        }
    }
}

// File: bitpost-contracts/contracts-common/contracts/access/Ownable.sol



pragma solidity ^0.8.20;


abstract contract Ownable is IOwnable {
    /// @custom:storage-location erc7201:bitpost.common.Ownable
    struct Storage_Ownable {
        address owner;
    }
    
    // keccak256(abi.encode(uint256(keccak256("bitpost.common.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant STORAGE_LOCATION_OWNABLE = 0xbfdc26bbaea09886fc184fe4fcae59b15cffdf4b859be87d5955dbd541465600;
    
    modifier onlyOwner() {
        _checkOwner();
        _;
    }
    
    function _init_Ownable(address owner) internal {
        _setOwner(owner);
    }
    
    function getOwner() public view returns(address) {
        Storage_Ownable storage $ = _getStorage_Ownable();
        return $.owner;
    }
    
    function setOwner(address owner) external onlyOwner {
        _setOwner(owner);
    }
    
    function _setOwner(address owner) internal {
        require(owner != address(0), OwnableInvalidOwner(address(0)));
        Storage_Ownable storage $ = _getStorage_Ownable();
        $.owner = owner;
    }
    
    function _checkOwner() private view {
        Storage_Ownable storage $ = _getStorage_Ownable();
        require(msg.sender == $.owner, OwnableUnauthorized(msg.sender, $.owner));
    }
    
    function _getStorage_Ownable() private pure returns(Storage_Ownable storage $) {
        assembly {
            $.slot := STORAGE_LOCATION_OWNABLE
        }
    }
}

// File: bitpost-contracts/contracts-vm/contracts/VersionManager.sol



pragma solidity ^0.8.20;




contract VersionManager is IVersionManager, Ownable {
    /// @custom:storage-location erc7201:bitpost.vm.VersionManager
    struct Storage_VersionManager {
        mapping(uint16 => address) implementations;
    }
    
    // keccak256(abi.encode(uint256(keccak256("bitpost.vm.VersionManager")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant STORAGE_LOCATION_VERSIONMANAGER = 0x433f1e912c5d27d7a45609db3e669bf6cc6b4b451297228e4c27368efb8c2300;
    
    constructor() {
        _init_Ownable(msg.sender);
    }
    
    function getImplementation(uint16 cid) external view returns(address) {
        Storage_VersionManager storage $ = _getStorage_VersionManager();
        require($.implementations[cid] != address(0), VersionManagerInvalidCid(cid));
        return $.implementations[cid];
    }
    
    function setImplementation(uint16 cid, address implementation) external onlyOwner {
        Storage_VersionManager storage $ = _getStorage_VersionManager();
        $.implementations[cid] = implementation;
    }
    
    function newContract(uint16 cid) external returns(address) {
        Storage_VersionManager storage $ = _getStorage_VersionManager();
        require($.implementations[cid] != address(0), VersionManagerInvalidCid(cid));
        return address(new Proxy(this, cid));
    }
    
    function _getStorage_VersionManager() private pure returns(Storage_VersionManager storage $) {
        assembly {
            $.slot := STORAGE_LOCATION_VERSIONMANAGER
        }
    }
}

// File: bitpost-contracts/contracts-vm/contracts/proxy/Proxy.sol



pragma solidity ^0.8.20;



contract Proxy is Upgradeable {
    constructor(VersionManager versionManager, uint16 cid) {
        _init_Upgradeable(versionManager, cid);
    }
    
    fallback() external payable {
        address target = _getVersionManager().getImplementation(_getCid());
        
        // The target address is stored on the stack, not in memory, 
        // so it won't be affected by operations using memory offset 0.
        
        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(gas(), target, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            
            switch result
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"versionManager","internalType":"contract VersionManager"},{"type":"uint16","name":"cid","internalType":"uint16"}]},{"type":"fallback","stateMutability":"payable"}]
              

Contract Creation Code

Verify & Publish
0x608060405234801561000f575f5ffd5b506040516103f53803806103f58339818101604052810190610031919061018a565b610041828261004860201b60201c565b50506101c8565b5f6100576100bd60201b60201c565b905082815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081815f0160146101000a81548161ffff021916908361ffff160217905550505050565b5f7f828626e98fd64181cb42e58a50c4931f9ea11da1800ee5ae64b4a2a58285ae00905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610111826100e8565b9050919050565b5f61012282610107565b9050919050565b61013281610118565b811461013c575f5ffd5b50565b5f8151905061014d81610129565b92915050565b5f61ffff82169050919050565b61016981610153565b8114610173575f5ffd5b50565b5f8151905061018481610160565b92915050565b5f5f604083850312156101a05761019f6100e4565b5b5f6101ad8582860161013f565b92505060206101be85828601610176565b9150509250929050565b610220806101d55f395ff3fe60806040525f61000d6100ac565b73ffffffffffffffffffffffffffffffffffffffff16639873400e6100306100e1565b6040518263ffffffff1660e01b815260040161004c9190610148565b602060405180830381865afa158015610067573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061008b91906101bf565b9050365f5f375f5f365f845af43d5f5f3e805f81146100a8573d5ff35b3d5ffd5b5f5f6100b6610105565b9050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691505090565b5f5f6100eb610105565b9050805f0160149054906101000a900461ffff1691505090565b5f7f828626e98fd64181cb42e58a50c4931f9ea11da1800ee5ae64b4a2a58285ae00905090565b5f61ffff82169050919050565b6101428161012c565b82525050565b5f60208201905061015b5f830184610139565b92915050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61018e82610165565b9050919050565b61019e81610184565b81146101a8575f5ffd5b50565b5f815190506101b981610195565b92915050565b5f602082840312156101d4576101d3610161565b5b5f6101e1848285016101ab565b9150509291505056fea26469706673582212205ea8572b2dc4952057aa047c7aa2c5ab28dfdae8fec0a824bf2f165add8790a764736f6c634300081c0033000000000000000000000000407b23dad0bd32a3b1ad184a2e61c206615f77710000000000000000000000000000000000000000000000000000000000001388

Deployed ByteCode

0x60806040525f61000d6100ac565b73ffffffffffffffffffffffffffffffffffffffff16639873400e6100306100e1565b6040518263ffffffff1660e01b815260040161004c9190610148565b602060405180830381865afa158015610067573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061008b91906101bf565b9050365f5f375f5f365f845af43d5f5f3e805f81146100a8573d5ff35b3d5ffd5b5f5f6100b6610105565b9050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691505090565b5f5f6100eb610105565b9050805f0160149054906101000a900461ffff1691505090565b5f7f828626e98fd64181cb42e58a50c4931f9ea11da1800ee5ae64b4a2a58285ae00905090565b5f61ffff82169050919050565b6101428161012c565b82525050565b5f60208201905061015b5f830184610139565b92915050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61018e82610165565b9050919050565b61019e81610184565b81146101a8575f5ffd5b50565b5f815190506101b981610195565b92915050565b5f602082840312156101d4576101d3610161565b5b5f6101e1848285016101ab565b9150509291505056fea26469706673582212205ea8572b2dc4952057aa047c7aa2c5ab28dfdae8fec0a824bf2f165add8790a764736f6c634300081c0033