Skip to content
Verified contractPartial

BeaconProxy

Address0x2eab30d70225d29d1ce8e3613db6d844b8ae2002
Balance

0 ETH

 

Transactions

9

 

Compiler

solc 0.8.3

 

Same code

127 more contracts

 

Details

Compiler
solc 0.8.3+commit.8d00100c
Language
solidity
Optimization
Yes, 200 runs
EVM version
istanbul
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
12,319,799
Creation transaction
0x6d6e009418…207bda08ae
Main copy (most transactions)
0x0c495c08…0472e5cb

BeaconProxy.sol

// File contracts/beacon/IBeacon.sol

pragma solidity ^0.8.0;

interface IBeacon {
    function latestCopy() external view returns(address);
}


// File contracts/beacon/BeaconProxy.sol

pragma solidity ^0.8.0;

contract BeaconProxy {

    bytes32 private constant BEACON_SLOT = keccak256(abi.encodePacked("fairmint.beaconproxy.beacon"));

    constructor() public {
        _setBeacon(msg.sender);
    }

    function _setBeacon(address _beacon) private {
        bytes32 slot = BEACON_SLOT;
        assembly {
            sstore(slot, _beacon)
        }
    }

    function _getBeacon() internal view returns(address beacon) {
        bytes32 slot = BEACON_SLOT;
        assembly {
            beacon := sload(slot)
        }
    }

    function _getMasterCopy() internal view returns(address) {
        IBeacon beacon = IBeacon(_getBeacon());
        return beacon.latestCopy();
    }

    fallback() external payable {
        address copy = _getMasterCopy();
        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(gas(), copy, 0, calldatasize(), 0, 0)
            let size := returndatasize()
            returndatacopy(0, 0, size)
            switch result
            case 0 { revert(0, size) }
            default { return(0, size) }
        }
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "istanbul",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.