ETH Price: $2,598.69 (+0.90%)

Contract

0xDf36944e720cf5Af30a3C5D80d36db5FB71dDE40
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040110932672020-10-20 13:28:471401 days ago1603200527IN
 Create: TicketsFacet
0 ETH0.0908203860

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TicketsFacet

Compiler Version
v0.7.3+commit.9bfce1f6

Optimization Enabled:
Yes with 20000 runs

Other Settings:
default evmVersion
File 1 of 7 : TicketsFacet.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "../interfaces/IERC1155.sol";
import "../interfaces/IERC1155TokenReceiver.sol";
import "../libraries/AppStorage.sol";
import "../libraries/LibDiamond.sol";
import "../libraries/LibStrings.sol";

contract TicketsFacet is IERC1155 {
    AppStorage internal s;
    bytes4 internal constant ERC1155_ACCEPTED = 0xf23a6e61; // Return value from `onERC1155Received` call if a contract accepts receipt (i.e `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`).
    bytes4 internal constant ERC1155_BATCH_ACCEPTED = 0xbc197c81; // Return value from `onERC1155BatchReceived` call if a contract accepts receipt (i.e `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`).

    function setBaseURI(string memory _value) external {
        LibDiamond.enforceIsContractOwner();
        s.ticketsBaseUri = _value;
        for (uint256 i; i < 6; i++) {
            emit URI(string(abi.encodePacked(_value, LibStrings.uintStr(i))), i);
        }
    }

    function uri(uint256 _id) external view returns (string memory) {
        require(_id < 6, "_id not found for  ticket");
        return string(abi.encodePacked(s.ticketsBaseUri, LibStrings.uintStr(_id)));
    }

    /**
        @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
        MUST revert if `_to` is the zero address.
        MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
        MUST revert on any other error.
        MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
        After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).        
        @param _from    Source address
        @param _to      Target address
        @param _id      ID of the token type
        @param _value   Transfer amount
        @param _data    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
    */
    function safeTransferFrom(
        address _from,
        address _to,
        uint256 _id,
        uint256 _value,
        bytes calldata _data
    ) external override {
        require(_to != address(0), "Tickets: Can't transfer to 0 address");
        require(_from == msg.sender || s.approved[_from][msg.sender], "Tickets: Not approved to transfer");
        uint256 bal = s.tickets[_id].accountBalances[_from];
        require(bal >= _value, "Tickets: _value greater than balance");
        s.tickets[_id].accountBalances[_from] = bal - _value;
        s.tickets[_id].accountBalances[_to] += _value;
        emit TransferSingle(msg.sender, _from, _to, _id, _value);
        uint256 size;
        assembly {
            size := extcodesize(_to)
        }
        if (size > 0) {
            require(
                ERC1155_ACCEPTED == IERC1155TokenReceiver(_to).onERC1155Received(msg.sender, _from, _id, _value, _data),
                "Tickets: Transfer rejected/failed by _to"
            );
        }
    }

    /**
        @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
        MUST revert if `_to` is the zero address.
        MUST revert if length of `_ids` is not the same as length of `_values`.
        MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
        MUST revert on any other error.        
        MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
        Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
        After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).                      
        @param _from    Source address
        @param _to      Target address
        @param _ids     IDs of each token type (order and length must match _values array)
        @param _values  Transfer amounts per token type (order and length must match _ids array)
        @param _data    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
    */
    function safeBatchTransferFrom(
        address _from,
        address _to,
        uint256[] calldata _ids,
        uint256[] calldata _values,
        bytes calldata _data
    ) external override {
        require(_to != address(0), "Tickets: Can't transfer to 0 address");
        require(_ids.length == _values.length, "Tickets: _ids not the same length as _values");
        require(_from == msg.sender || s.approved[_from][msg.sender], "Tickets: Not approved to transfer");
        for (uint256 i; i < _ids.length; i++) {
            uint256 id = _ids[i];
            uint256 value = _values[i];
            uint256 bal = s.tickets[id].accountBalances[_from];
            require(bal >= value, "Tickets: _value greater than balance");
            s.tickets[id].accountBalances[_from] = bal - value;
            s.tickets[id].accountBalances[_to] += value;
        }
        emit TransferBatch(msg.sender, _from, _to, _ids, _values);
        uint256 size;
        assembly {
            size := extcodesize(_to)
        }
        if (size > 0) {
            require(
                ERC1155_BATCH_ACCEPTED == IERC1155TokenReceiver(_to).onERC1155BatchReceived(msg.sender, _from, _ids, _values, _data),
                "Tickets: Transfer rejected/failed by _to"
            );
        }
    }

    function totalSupplies() external view returns (uint256[] memory totalSupplies_) {
        totalSupplies_ = new uint256[](6);
        for (uint256 i; i < 6; i++) {
            totalSupplies_[i] = s.tickets[i].totalSupply;
        }
    }

    function totalSupply(uint256 _id) external view returns (uint256 totalSupply_) {
        require(_id < 6, "Vourchers:  Voucher not found");
        totalSupply_ = s.tickets[_id].totalSupply;
    }

    // returns the balance of each  voucher
    function balanceOfAll(address _owner) external view returns (uint256[] memory balances_) {
        balances_ = new uint256[](6);
        for (uint256 i; i < 6; i++) {
            balances_[i] = s.tickets[i].accountBalances[_owner];
        }
    }

    /**
        @notice Get the balance of an account's tokens.
        @param _owner    The address of the token holder
        @param _id       ID of the token
        @return balance_ The _owner's balance of the token type requested
     */
    function balanceOf(address _owner, uint256 _id) external override view returns (uint256 balance_) {
        balance_ = s.tickets[_id].accountBalances[_owner];
    }

    /**
        @notice Get the balance of multiple account/token pairs
        @param _owners    The addresses of the token holders
        @param _ids       ID of the tokens
        @return balances_ The _owner's balance of the token types requested (i.e. balance for each (owner, id) pair)
     */
    function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external override view returns (uint256[] memory balances_) {
        require(_owners.length == _ids.length, "Tickets: _owners not same length as _ids");
        balances_ = new uint256[](_owners.length);
        for (uint256 i; i < _owners.length; i++) {
            balances_[i] = s.tickets[_ids[i]].accountBalances[_owners[i]];
        }
    }

    /**
        @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
        @dev MUST emit the ApprovalForAll event on success.
        @param _operator  Address to add to the set of authorized operators
        @param _approved  True if the operator is approved, false to revoke approval
    */
    function setApprovalForAll(address _operator, bool _approved) external override {
        s.approved[msg.sender][_operator] = _approved;
        emit ApprovalForAll(msg.sender, _operator, _approved);
    }

    /**
        @notice Queries the approval status of an operator for a given owner.
        @param _owner     The owner of the tokens
        @param _operator  Address of authorized operator
        @return           True if the operator is approved, false if not
    */
    function isApprovedForAll(address _owner, address _operator) external override view returns (bool) {
        return s.approved[_owner][_operator];
    }
}

File 2 of 7 : IERC1155.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;

/**
    @title ERC-1155 Multi Token Standard
    @dev See https://eips.ethereum.org/EIPS/eip-1155
    Note: The ERC-165 identifier for this interface is 0xd9b67a26.
 */
/* is ERC165 */
interface IERC1155 {
    /**
        @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
        The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
        The `_from` argument MUST be the address of the holder whose balance is decreased.
        The `_to` argument MUST be the address of the recipient whose balance is increased.
        The `_id` argument MUST be the token type being transferred.
        The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
        When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
        When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).        
    */
    event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);

    /**
        @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).      
        The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
        The `_from` argument MUST be the address of the holder whose balance is decreased.
        The `_to` argument MUST be the address of the recipient whose balance is increased.
        The `_ids` argument MUST be the list of tokens being transferred.
        The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
        When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
        When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).                
    */
    event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);

    /**
        @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absence of an event assumes disabled).        
    */
    event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

    /**
        @dev MUST emit when the URI is updated for a token ID.
        URIs are defined in RFC 3986.
        The URI MUST point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
    */
    event URI(string _value, uint256 indexed _id);

    /**
        @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
        MUST revert if `_to` is the zero address.
        MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
        MUST revert on any other error.
        MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
        After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).        
        @param _from    Source address
        @param _to      Target address
        @param _id      ID of the token type
        @param _value   Transfer amount
        @param _data    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
    */
    function safeTransferFrom(
        address _from,
        address _to,
        uint256 _id,
        uint256 _value,
        bytes calldata _data
    ) external;

    /**
        @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
        MUST revert if `_to` is the zero address.
        MUST revert if length of `_ids` is not the same as length of `_values`.
        MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
        MUST revert on any other error.        
        MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
        Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
        After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).                      
        @param _from    Source address
        @param _to      Target address
        @param _ids     IDs of each token type (order and length must match _values array)
        @param _values  Transfer amounts per token type (order and length must match _ids array)
        @param _data    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
    */
    function safeBatchTransferFrom(
        address _from,
        address _to,
        uint256[] calldata _ids,
        uint256[] calldata _values,
        bytes calldata _data
    ) external;

    /**
        @notice Get the balance of an account's tokens.
        @param _owner  The address of the token holder
        @param _id     ID of the token
        @return        The _owner's balance of the token type requested
     */
    function balanceOf(address _owner, uint256 _id) external view returns (uint256);

    /**
        @notice Get the balance of multiple account/token pairs
        @param _owners The addresses of the token holders
        @param _ids    ID of the tokens
        @return        The _owner's balance of the token types requested (i.e. balance for each (owner, id) pair)
     */
    function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);

    /**
        @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
        @dev MUST emit the ApprovalForAll event on success.
        @param _operator  Address to add to the set of authorized operators
        @param _approved  True if the operator is approved, false to revoke approval
    */
    function setApprovalForAll(address _operator, bool _approved) external;

    /**
        @notice Queries the approval status of an operator for a given owner.
        @param _owner     The owner of the tokens
        @param _operator  Address of authorized operator
        @return           True if the operator is approved, false if not
    */
    function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}

File 3 of 7 : IERC1155TokenReceiver.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;

/**
    Note: The ERC-165 identifier for this interface is 0x4e2312e0.
*/
interface IERC1155TokenReceiver {
    /**
        @notice Handle the receipt of a single ERC1155 token type.
        @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated.        
        This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it accepts the transfer.
        This function MUST revert if it rejects the transfer.
        Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.
        @param _operator  The address which initiated the transfer (i.e. msg.sender)
        @param _from      The address which previously owned the token
        @param _id        The ID of the token being transferred
        @param _value     The amount of tokens being transferred
        @param _data      Additional data with no specified format
        @return           `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
    */
    function onERC1155Received(
        address _operator,
        address _from,
        uint256 _id,
        uint256 _value,
        bytes calldata _data
    ) external returns (bytes4);

    /**
        @notice Handle the receipt of multiple ERC1155 token types.
        @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated.        
        This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s).
        This function MUST revert if it rejects the transfer(s).
        Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.
        @param _operator  The address which initiated the batch transfer (i.e. msg.sender)
        @param _from      The address which previously owned the token
        @param _ids       An array containing ids of each token being transferred (order and length must match _values array)
        @param _values    An array containing amounts of each token being transferred (order and length must match _ids array)
        @param _data      Additional data with no specified format
        @return           `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
    */
    function onERC1155BatchReceived(
        address _operator,
        address _from,
        uint256[] calldata _ids,
        uint256[] calldata _values,
        bytes calldata _data
    ) external returns (bytes4);
}

File 4 of 7 : AppStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;

struct Account {
    uint96 ghst;
    uint96 uniV2PoolTokens;
    uint40 lastUpdate;
    uint104 frens;
}

struct Ticket {
    // user address => balance
    mapping(address => uint256) accountBalances;
    uint96 totalSupply;
}

struct AppStorage {
    mapping(address => mapping(address => bool)) approved;
    mapping(address => Account) accounts;
    mapping(uint256 => Ticket) tickets;
    address ghstContract;
    address uniV2PoolContract;
    string ticketsBaseUri;
}

File 5 of 7 : LibDiamond.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

/******************************************************************************\
* Author: Nick Mudge
*
* Implementation of Diamond facet.
* Uses the diamond-2 version 1.3.4 implementation:
* https://github.com/mudgen/diamond-2
*
* This is gas optimized by reducing storage reads and storage writes.
* This code is as complex as it is to reduce gas costs.
/******************************************************************************/

import "../interfaces/IDiamondCut.sol";

library LibDiamond {
    bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage");

    struct DiamondStorage {
        // maps function selectors to the facets that execute the functions.
        // and maps the selectors to their position in the selectorSlots array.
        // func selector => address facet, selector position
        mapping(bytes4 => bytes32) facets;
        // array of slots of function selectors.
        // each slot holds 8 function selectors.
        mapping(uint256 => bytes32) selectorSlots;
        // The number of function selectors in selectorSlots
        uint16 selectorCount;
        // owner of the contract
        // Used to query if a contract implements an interface.
        // Used to implement ERC-165.
        mapping(bytes4 => bool) supportedInterfaces;
        // owner of the contract
        address contractOwner;
    }

    function diamondStorage() internal pure returns (DiamondStorage storage ds) {
        bytes32 position = DIAMOND_STORAGE_POSITION;
        assembly {
            ds.slot := position
        }
    }

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    function setContractOwner(address _newOwner) internal {
        DiamondStorage storage ds = diamondStorage();
        address previousOwner = ds.contractOwner;
        ds.contractOwner = _newOwner;
        emit OwnershipTransferred(previousOwner, _newOwner);
    }

    function contractOwner() internal view returns (address contractOwner_) {
        contractOwner_ = diamondStorage().contractOwner;
    }

    function enforceIsContractOwner() internal view {
        require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner");
    }

    modifier onlyOwner {
        require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner");
        _;
    }

    event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata);

    bytes32 constant CLEAR_ADDRESS_MASK = bytes32(uint256(0xffffffffffffffffffffffff));
    bytes32 constant CLEAR_SELECTOR_MASK = bytes32(uint256(0xffffffff << 224));

    // Internal function version of diamondCut
    // This code is almost the same as the external diamondCut,
    // except it is using 'Facet[] memory _diamondCut' instead of
    // 'Facet[] calldata _diamondCut'.
    // The code is duplicated to prevent copying calldata to memory which
    // causes an error for a two dimensional array.
    function diamondCut(
        IDiamondCut.FacetCut[] memory _diamondCut,
        address _init,
        bytes memory _calldata
    ) internal {
        DiamondStorage storage ds = diamondStorage();
        uint256 originalSelectorCount = ds.selectorCount;
        uint256 selectorCount = originalSelectorCount;
        bytes32 selectorSlot;
        // Check if last selector slot is not full
        if (selectorCount % 8 > 0) {
            // get last selectorSlot
            selectorSlot = ds.selectorSlots[selectorCount / 8];
        }
        // loop through diamond cut
        for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) {
            (selectorCount, selectorSlot) = addReplaceRemoveFacetSelectors(
                selectorCount,
                selectorSlot,
                _diamondCut[facetIndex].facetAddress,
                _diamondCut[facetIndex].action,
                _diamondCut[facetIndex].functionSelectors
            );
        }
        if (selectorCount != originalSelectorCount) {
            ds.selectorCount = uint16(selectorCount);
        }
        // If last selector slot is not full
        if (selectorCount % 8 > 0) {
            ds.selectorSlots[selectorCount / 8] = selectorSlot;
        }
        emit DiamondCut(_diamondCut, _init, _calldata);
        initializeDiamondCut(_init, _calldata);
    }

    function addReplaceRemoveFacetSelectors(
        uint256 _selectorCount,
        bytes32 _selectorSlot,
        address _newFacetAddress,
        IDiamondCut.FacetCutAction _action,
        bytes4[] memory _selectors
    ) internal returns (uint256, bytes32) {
        DiamondStorage storage ds = diamondStorage();
        require(_selectors.length > 0, "LibDiamondCut: No selectors in facet to cut");
        if (_action == IDiamondCut.FacetCutAction.Add) {
            require(_newFacetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)");
            enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Add facet has no code");
            for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) {
                bytes4 selector = _selectors[selectorIndex];
                bytes32 oldFacet = ds.facets[selector];
                require(address(bytes20(oldFacet)) == address(0), "LibDiamondCut: Can't add function that already exists");
                // add facet for selector
                ds.facets[selector] = bytes20(_newFacetAddress) | bytes32(_selectorCount);
                uint256 selectorInSlotPosition = (_selectorCount % 8) * 32;
                // clear selector position in slot and add selector
                _selectorSlot = (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> selectorInSlotPosition)) | (bytes32(selector) >> selectorInSlotPosition);
                // if slot is full then write it to storage
                if (selectorInSlotPosition == 224) {
                    ds.selectorSlots[_selectorCount / 8] = _selectorSlot;
                    _selectorSlot = 0;
                }
                _selectorCount++;
            }
        } else if (_action == IDiamondCut.FacetCutAction.Replace) {
            require(_newFacetAddress != address(0), "LibDiamondCut: Replace facet can't be address(0)");
            enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Replace facet has no code");
            for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) {
                bytes4 selector = _selectors[selectorIndex];
                bytes32 oldFacet = ds.facets[selector];
                address oldFacetAddress = address(bytes20(oldFacet));
                // only useful if immutable functions exist
                require(oldFacetAddress != address(this), "LibDiamondCut: Can't replace immutable function");
                require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function");
                require(oldFacetAddress != address(0), "LibDiamondCut: Can't replace function that doesn't exist");
                // replace old facet address
                ds.facets[selector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(_newFacetAddress);
            }
        } else if (_action == IDiamondCut.FacetCutAction.Remove) {
            require(_newFacetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)");
            uint256 selectorSlotCount = _selectorCount / 8;
            uint256 selectorInSlotIndex = (_selectorCount % 8) - 1;
            for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) {
                if (_selectorSlot == 0) {
                    // get last selectorSlot
                    selectorSlotCount--;
                    _selectorSlot = ds.selectorSlots[selectorSlotCount];
                    selectorInSlotIndex = 7;
                }
                bytes4 lastSelector;
                uint256 oldSelectorsSlotCount;
                uint256 oldSelectorInSlotPosition;
                // adding a block here prevents stack too deep error
                {
                    bytes4 selector = _selectors[selectorIndex];
                    bytes32 oldFacet = ds.facets[selector];
                    require(address(bytes20(oldFacet)) != address(0), "LibDiamondCut: Can't remove function that doesn't exist");
                    // only useful if immutable functions exist
                    require(address(bytes20(oldFacet)) != address(this), "LibDiamondCut: Can't remove immutable function");
                    // replace selector with last selector in ds.facets
                    // gets the last selector
                    lastSelector = bytes4(_selectorSlot << (selectorInSlotIndex * 32));
                    if (lastSelector != selector) {
                        // update last selector slot position info
                        ds.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(ds.facets[lastSelector]);
                    }
                    delete ds.facets[selector];
                    uint256 oldSelectorCount = uint16(uint256(oldFacet));
                    oldSelectorsSlotCount = oldSelectorCount / 8;
                    oldSelectorInSlotPosition = (oldSelectorCount % 8) * 32;
                }
                if (oldSelectorsSlotCount != selectorSlotCount) {
                    bytes32 oldSelectorSlot = ds.selectorSlots[oldSelectorsSlotCount];
                    // clears the selector we are deleting and puts the last selector in its place.
                    oldSelectorSlot =
                        (oldSelectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) |
                        (bytes32(lastSelector) >> oldSelectorInSlotPosition);
                    // update storage with the modified slot
                    ds.selectorSlots[oldSelectorsSlotCount] = oldSelectorSlot;
                } else {
                    // clears the selector we are deleting and puts the last selector in its place.
                    _selectorSlot =
                        (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) |
                        (bytes32(lastSelector) >> oldSelectorInSlotPosition);
                }
                if (selectorInSlotIndex == 0) {
                    delete ds.selectorSlots[selectorSlotCount];
                    _selectorSlot = 0;
                }
                selectorInSlotIndex--;
            }
            _selectorCount = selectorSlotCount * 8 + selectorInSlotIndex + 1;
        } else {
            revert("LibDiamondCut: Incorrect FacetCutAction");
        }
        return (_selectorCount, _selectorSlot);
    }

    function initializeDiamondCut(address _init, bytes memory _calldata) internal {
        if (_init == address(0)) {
            require(_calldata.length == 0, "LibDiamondCut: _init is address(0) but_calldata is not empty");
        } else {
            require(_calldata.length > 0, "LibDiamondCut: _calldata is empty but _init is not address(0)");
            if (_init != address(this)) {
                enforceHasContractCode(_init, "LibDiamondCut: _init address has no code");
            }
            (bool success, bytes memory error) = _init.delegatecall(_calldata);
            if (!success) {
                if (error.length > 0) {
                    // bubble up the error
                    revert(string(error));
                } else {
                    revert("LibDiamondCut: _init function reverted");
                }
            }
        }
    }

    function enforceHasContractCode(address _contract, string memory _errorMessage) internal view {
        uint256 contractSize;
        assembly {
            contractSize := extcodesize(_contract)
        }
        require(contractSize > 0, _errorMessage);
    }
}

File 6 of 7 : IDiamondCut.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

/******************************************************************************\
* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
/******************************************************************************/

interface IDiamondCut {
    enum FacetCutAction {Add, Replace, Remove}

    struct FacetCut {
        address facetAddress;
        FacetCutAction action;
        bytes4[] functionSelectors;
    }

    /// @notice Add/replace/remove any number of functions and optionally execute
    ///         a function with delegatecall
    /// @param _diamondCut Contains the facet addresses and function selectors
    /// @param _init The address of the contract or facet to execute _calldata
    /// @param _calldata A function call, including function selector and arguments
    ///                  _calldata is executed with delegatecall on _init
    function diamondCut(
        FacetCut[] calldata _diamondCut,
        address _init,
        bytes calldata _calldata
    ) external;

    event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata);
}

File 7 of 7 : LibStrings.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;

// From Open Zeppelin contracts: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol

/**
 * @dev String operations.
 */
library LibStrings {
    /**
     * @dev Converts a `uint256` to its ASCII `string` representation.
     */
    function uintStr(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = bytes1(uint8(48 + (temp % 10)));
            temp /= 10;
        }
        return string(buffer);
    }
}

Settings
{
  "metadata": {
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 20000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":false,"internalType":"bool","name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_value","type":"string"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOfAll","outputs":[{"internalType":"uint256[]","name":"balances_","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_owners","type":"address[]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"balances_","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupplies","outputs":[{"internalType":"uint256[]","name":"totalSupplies_","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"totalSupply_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50611a94806100206000396000f3fe608060405234801561001057600080fd5b50600436106100c85760003560e01c8063a22cb46511610081578063e985e9c51161005b578063e985e9c51461018c578063f242432a146101ac578063fe992c98146101bf576100c8565b8063a22cb4651461015e578063bd85b03914610171578063d068cdc514610184576100c8565b80632eb2c2d6116100b25780632eb2c2d6146101165780634e1273f41461012b57806355f804b31461014b576100c8565b8062fdd58e146100cd5780630e89341c146100f6575b600080fd5b6100e06100db366004611292565b6101d2565b6040516100ed9190611a17565b60405180910390f35b610109610104366004611417565b610205565b6040516100ed91906116cd565b61012961012436600461112b565b61027d565b005b61013e6101393660046112bb565b6106eb565b6040516100ed919061167e565b610129610159366004611364565b610823565b61012961016c366004611258565b6108d4565b6100e061017f366004611417565b61096c565b61013e6109cc565b61019f61019a3660046110f9565b610a43565b6040516100ed91906116c2565b6101296101ba3660046111e2565b610a7c565b61013e6101cd3660046110d8565b610d77565b600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff9094168352929052205490565b60606006821061024a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906118c9565b60405180910390fd5b600561025583610dfd565b6040516020016102669291906114f3565b60405160208183030381529060405290505b919050565b73ffffffffffffffffffffffffffffffffffffffff87166102ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024190611900565b848314610303576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906119ba565b73ffffffffffffffffffffffffffffffffffffffff8816331480610355575073ffffffffffffffffffffffffffffffffffffffff881660009081526020818152604080832033845290915290205460ff165b61038b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061186c565b60005b858110156105295760008787838181106103a457fe5b90506020020135905060008686848181106103bb57fe5b905060200201359050600080600201600084815260200190815260200160002060000160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610458576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906117b2565b8181036000600201600085815260200190815260200160002060000160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000600201600085815260200190815260200160002060000160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550505050808060010191505061038e565b508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb898989896040516105a4949392919061164c565b60405180910390a4863b80156106e0576040517fbc197c8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89169063bc197c81906106149033908d908c908c908c908c908c908c90600401611589565b602060405180830381600087803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106669190611324565b7fffffffff00000000000000000000000000000000000000000000000000000000167fbc197c8100000000000000000000000000000000000000000000000000000000146106e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061195d565b505050505050505050565b6060838214610726576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061180f565b8367ffffffffffffffff8111801561073d57600080fd5b50604051908082528060200260200182016040528015610767578160200160208202803683370190505b50905060005b8481101561081a576002600085858481811061078557fe5b90506020020135815260200190815260200160002060000160008787848181106107ab57fe5b90506020020160208101906107c091906110d8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482828151811061080757fe5b602090810291909101015260010161076d565b50949350505050565b61082b610f21565b805161083e906005906020840190610fa1565b5060005b60068110156108d057807f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b8361087784610dfd565b6040516020016108889291906114c4565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526108c0916116cd565b60405180910390a2600101610842565b5050565b3360008181526020818152604080832073ffffffffffffffffffffffffffffffffffffffff871680855292529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906109609085906116c2565b60405180910390a35050565b6000600682106109a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061171e565b506000908152600260205260409020600101546bffffffffffffffffffffffff1690565b60408051600680825260e082019092526060916020820160c08036833701905050905060005b6006811015610a3f5760008181526002602052604090206001015482516bffffffffffffffffffffffff90911690839083908110610a2c57fe5b60209081029190910101526001016109f2565b5090565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526020818152604080832093909416825291909152205460ff1690565b73ffffffffffffffffffffffffffffffffffffffff8516610ac9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024190611900565b73ffffffffffffffffffffffffffffffffffffffff8616331480610b1b575073ffffffffffffffffffffffffffffffffffffffff861660009081526020818152604080832033845290915290205460ff165b610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061186c565b600084815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8a16845290915290205483811015610bbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906117b2565b600085815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8b8116808652919093528184208886039055918916808452928190208054880190555133907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6290610c35908a908a90611a20565b60405180910390a4853b8015610d6d576040517ff23a6e6100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063f23a6e6190610ca19033908c908b908b908b908b906004016115fa565b602060405180830381600087803b158015610cbb57600080fd5b505af1158015610ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf39190611324565b7fffffffff00000000000000000000000000000000000000000000000000000000167ff23a6e610000000000000000000000000000000000000000000000000000000014610d6d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061195d565b5050505050505050565b60408051600680825260e082019092526060916020820160c08036833701905050905060005b6006811015610df757600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548251839083908110610de457fe5b6020908102919091010152600101610d9d565b50919050565b606081610e3e575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610278565b8160005b8115610e5657600101600a82049150610e42565b60608167ffffffffffffffff81118015610e6f57600080fd5b506040519080825280601f01601f191660200182016040528015610e9a576020820181803683370190505b5085935090507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82015b831561081a57600a840660300160f81b82828060019003935081518110610ee757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a84049350610ec4565b610f29610f7d565b6004015473ffffffffffffffffffffffffffffffffffffffff163314610f7b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024190611755565b565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610fe257805160ff191683800117855561100f565b8280016001018555821561100f579182015b8281111561100f578251825591602001919060010190610ff4565b50610a3f9291505b80821115610a3f5760008155600101611017565b803573ffffffffffffffffffffffffffffffffffffffff8116811461027857600080fd5b60008083601f840112611060578182fd5b50813567ffffffffffffffff811115611077578182fd5b602083019150836020808302850101111561109157600080fd5b9250929050565b60008083601f8401126110a9578182fd5b50813567ffffffffffffffff8111156110c0578182fd5b60208301915083602082850101111561109157600080fd5b6000602082840312156110e9578081fd5b6110f28261102b565b9392505050565b6000806040838503121561110b578081fd5b6111148361102b565b91506111226020840161102b565b90509250929050565b60008060008060008060008060a0898b031215611146578384fd5b61114f8961102b565b975061115d60208a0161102b565b9650604089013567ffffffffffffffff80821115611179578586fd5b6111858c838d0161104f565b909850965060608b013591508082111561119d578586fd5b6111a98c838d0161104f565b909650945060808b01359150808211156111c1578384fd5b506111ce8b828c01611098565b999c989b5096995094979396929594505050565b60008060008060008060a087890312156111fa578182fd5b6112038761102b565b95506112116020880161102b565b94506040870135935060608701359250608087013567ffffffffffffffff81111561123a578283fd5b61124689828a01611098565b979a9699509497509295939492505050565b6000806040838503121561126a578182fd5b6112738361102b565b915060208301358015158114611287578182fd5b809150509250929050565b600080604083850312156112a4578182fd5b6112ad8361102b565b946020939093013593505050565b600080600080604085870312156112d0578384fd5b843567ffffffffffffffff808211156112e7578586fd5b6112f38883890161104f565b9096509450602087013591508082111561130b578384fd5b506113188782880161104f565b95989497509550505050565b600060208284031215611335578081fd5b81517fffffffff00000000000000000000000000000000000000000000000000000000811681146110f2578182fd5b60006020808385031215611376578182fd5b823567ffffffffffffffff8082111561138d578384fd5b818501915085601f8301126113a0578384fd5b8135818111156113ac57fe5b604051847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011682010181811084821117156113e757fe5b60405281815283820185018810156113fd578586fd5b818585018683013790810190930193909352509392505050565b600060208284031215611428578081fd5b5035919050565b60008284527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115611460578081fd5b6020830280836020870137939093016020019283525090919050565b600082845282826020860137806020848601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011685010190509392505050565b600083516114d6818460208801611a2e565b8351908301906114ea818360208801611a2e565b01949350505050565b6000808454600180821660008114611512576001811461154757611576565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083168652607f600284041686019350611576565b600283048886526020808720875b8381101561156e5781548a820152908501908201611555565b505050860193505b50505083516114ea818360208801611a2e565b600073ffffffffffffffffffffffffffffffffffffffff808b168352808a1660208401525060a060408301526115c360a08301888a61142f565b82810360608401526115d681878961142f565b905082810360808401526115eb81858761147c565b9b9a5050505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808916835280881660208401525085604083015284606083015260a0608083015261164060a08301848661147c565b98975050505050505050565b60006040825261166060408301868861142f565b828103602084015261167381858761142f565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156116b65783518352928401929184019160010161169a565b50909695505050505050565b901515815260200190565b60006020825282518060208401526116ec816040850160208701611a2e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6020808252601d908201527f566f757263686572733a2020566f7563686572206e6f7420666f756e64000000604082015260600190565b60208082526022908201527f4c69624469616d6f6e643a204d75737420626520636f6e7472616374206f776e60408201527f6572000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f5469636b6574733a205f76616c75652067726561746572207468616e2062616c60408201527f616e636500000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f5469636b6574733a205f6f776e657273206e6f742073616d65206c656e67746860408201527f206173205f696473000000000000000000000000000000000000000000000000606082015260800190565b60208082526021908201527f5469636b6574733a204e6f7420617070726f76656420746f207472616e73666560408201527f7200000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f5f6964206e6f7420666f756e6420666f7220207469636b657400000000000000604082015260600190565b60208082526024908201527f5469636b6574733a2043616e2774207472616e7366657220746f20302061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f5469636b6574733a205472616e736665722072656a65637465642f6661696c6560408201527f64206279205f746f000000000000000000000000000000000000000000000000606082015260800190565b6020808252602c908201527f5469636b6574733a205f696473206e6f74207468652073616d65206c656e677460408201527f68206173205f76616c7565730000000000000000000000000000000000000000606082015260800190565b90815260200190565b918252602082015260400190565b60005b83811015611a49578181015183820152602001611a31565b83811115611a58576000848401525b5050505056fea2646970667358221220317d4e06f2c95be286d5b342bfb897e30e14ac10d017feadfa094c5f546e40ba64736f6c63430007030033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100c85760003560e01c8063a22cb46511610081578063e985e9c51161005b578063e985e9c51461018c578063f242432a146101ac578063fe992c98146101bf576100c8565b8063a22cb4651461015e578063bd85b03914610171578063d068cdc514610184576100c8565b80632eb2c2d6116100b25780632eb2c2d6146101165780634e1273f41461012b57806355f804b31461014b576100c8565b8062fdd58e146100cd5780630e89341c146100f6575b600080fd5b6100e06100db366004611292565b6101d2565b6040516100ed9190611a17565b60405180910390f35b610109610104366004611417565b610205565b6040516100ed91906116cd565b61012961012436600461112b565b61027d565b005b61013e6101393660046112bb565b6106eb565b6040516100ed919061167e565b610129610159366004611364565b610823565b61012961016c366004611258565b6108d4565b6100e061017f366004611417565b61096c565b61013e6109cc565b61019f61019a3660046110f9565b610a43565b6040516100ed91906116c2565b6101296101ba3660046111e2565b610a7c565b61013e6101cd3660046110d8565b610d77565b600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff9094168352929052205490565b60606006821061024a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906118c9565b60405180910390fd5b600561025583610dfd565b6040516020016102669291906114f3565b60405160208183030381529060405290505b919050565b73ffffffffffffffffffffffffffffffffffffffff87166102ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024190611900565b848314610303576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906119ba565b73ffffffffffffffffffffffffffffffffffffffff8816331480610355575073ffffffffffffffffffffffffffffffffffffffff881660009081526020818152604080832033845290915290205460ff165b61038b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061186c565b60005b858110156105295760008787838181106103a457fe5b90506020020135905060008686848181106103bb57fe5b905060200201359050600080600201600084815260200190815260200160002060000160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610458576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906117b2565b8181036000600201600085815260200190815260200160002060000160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000600201600085815260200190815260200160002060000160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550505050808060010191505061038e565b508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb898989896040516105a4949392919061164c565b60405180910390a4863b80156106e0576040517fbc197c8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89169063bc197c81906106149033908d908c908c908c908c908c908c90600401611589565b602060405180830381600087803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106669190611324565b7fffffffff00000000000000000000000000000000000000000000000000000000167fbc197c8100000000000000000000000000000000000000000000000000000000146106e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061195d565b505050505050505050565b6060838214610726576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061180f565b8367ffffffffffffffff8111801561073d57600080fd5b50604051908082528060200260200182016040528015610767578160200160208202803683370190505b50905060005b8481101561081a576002600085858481811061078557fe5b90506020020135815260200190815260200160002060000160008787848181106107ab57fe5b90506020020160208101906107c091906110d8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482828151811061080757fe5b602090810291909101015260010161076d565b50949350505050565b61082b610f21565b805161083e906005906020840190610fa1565b5060005b60068110156108d057807f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b8361087784610dfd565b6040516020016108889291906114c4565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526108c0916116cd565b60405180910390a2600101610842565b5050565b3360008181526020818152604080832073ffffffffffffffffffffffffffffffffffffffff871680855292529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906109609085906116c2565b60405180910390a35050565b6000600682106109a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061171e565b506000908152600260205260409020600101546bffffffffffffffffffffffff1690565b60408051600680825260e082019092526060916020820160c08036833701905050905060005b6006811015610a3f5760008181526002602052604090206001015482516bffffffffffffffffffffffff90911690839083908110610a2c57fe5b60209081029190910101526001016109f2565b5090565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526020818152604080832093909416825291909152205460ff1690565b73ffffffffffffffffffffffffffffffffffffffff8516610ac9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024190611900565b73ffffffffffffffffffffffffffffffffffffffff8616331480610b1b575073ffffffffffffffffffffffffffffffffffffffff861660009081526020818152604080832033845290915290205460ff165b610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061186c565b600084815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8a16845290915290205483811015610bbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610241906117b2565b600085815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8b8116808652919093528184208886039055918916808452928190208054880190555133907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6290610c35908a908a90611a20565b60405180910390a4853b8015610d6d576040517ff23a6e6100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063f23a6e6190610ca19033908c908b908b908b908b906004016115fa565b602060405180830381600087803b158015610cbb57600080fd5b505af1158015610ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf39190611324565b7fffffffff00000000000000000000000000000000000000000000000000000000167ff23a6e610000000000000000000000000000000000000000000000000000000014610d6d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102419061195d565b5050505050505050565b60408051600680825260e082019092526060916020820160c08036833701905050905060005b6006811015610df757600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548251839083908110610de457fe5b6020908102919091010152600101610d9d565b50919050565b606081610e3e575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610278565b8160005b8115610e5657600101600a82049150610e42565b60608167ffffffffffffffff81118015610e6f57600080fd5b506040519080825280601f01601f191660200182016040528015610e9a576020820181803683370190505b5085935090507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82015b831561081a57600a840660300160f81b82828060019003935081518110610ee757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a84049350610ec4565b610f29610f7d565b6004015473ffffffffffffffffffffffffffffffffffffffff163314610f7b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024190611755565b565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610fe257805160ff191683800117855561100f565b8280016001018555821561100f579182015b8281111561100f578251825591602001919060010190610ff4565b50610a3f9291505b80821115610a3f5760008155600101611017565b803573ffffffffffffffffffffffffffffffffffffffff8116811461027857600080fd5b60008083601f840112611060578182fd5b50813567ffffffffffffffff811115611077578182fd5b602083019150836020808302850101111561109157600080fd5b9250929050565b60008083601f8401126110a9578182fd5b50813567ffffffffffffffff8111156110c0578182fd5b60208301915083602082850101111561109157600080fd5b6000602082840312156110e9578081fd5b6110f28261102b565b9392505050565b6000806040838503121561110b578081fd5b6111148361102b565b91506111226020840161102b565b90509250929050565b60008060008060008060008060a0898b031215611146578384fd5b61114f8961102b565b975061115d60208a0161102b565b9650604089013567ffffffffffffffff80821115611179578586fd5b6111858c838d0161104f565b909850965060608b013591508082111561119d578586fd5b6111a98c838d0161104f565b909650945060808b01359150808211156111c1578384fd5b506111ce8b828c01611098565b999c989b5096995094979396929594505050565b60008060008060008060a087890312156111fa578182fd5b6112038761102b565b95506112116020880161102b565b94506040870135935060608701359250608087013567ffffffffffffffff81111561123a578283fd5b61124689828a01611098565b979a9699509497509295939492505050565b6000806040838503121561126a578182fd5b6112738361102b565b915060208301358015158114611287578182fd5b809150509250929050565b600080604083850312156112a4578182fd5b6112ad8361102b565b946020939093013593505050565b600080600080604085870312156112d0578384fd5b843567ffffffffffffffff808211156112e7578586fd5b6112f38883890161104f565b9096509450602087013591508082111561130b578384fd5b506113188782880161104f565b95989497509550505050565b600060208284031215611335578081fd5b81517fffffffff00000000000000000000000000000000000000000000000000000000811681146110f2578182fd5b60006020808385031215611376578182fd5b823567ffffffffffffffff8082111561138d578384fd5b818501915085601f8301126113a0578384fd5b8135818111156113ac57fe5b604051847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011682010181811084821117156113e757fe5b60405281815283820185018810156113fd578586fd5b818585018683013790810190930193909352509392505050565b600060208284031215611428578081fd5b5035919050565b60008284527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115611460578081fd5b6020830280836020870137939093016020019283525090919050565b600082845282826020860137806020848601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011685010190509392505050565b600083516114d6818460208801611a2e565b8351908301906114ea818360208801611a2e565b01949350505050565b6000808454600180821660008114611512576001811461154757611576565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083168652607f600284041686019350611576565b600283048886526020808720875b8381101561156e5781548a820152908501908201611555565b505050860193505b50505083516114ea818360208801611a2e565b600073ffffffffffffffffffffffffffffffffffffffff808b168352808a1660208401525060a060408301526115c360a08301888a61142f565b82810360608401526115d681878961142f565b905082810360808401526115eb81858761147c565b9b9a5050505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808916835280881660208401525085604083015284606083015260a0608083015261164060a08301848661147c565b98975050505050505050565b60006040825261166060408301868861142f565b828103602084015261167381858761142f565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156116b65783518352928401929184019160010161169a565b50909695505050505050565b901515815260200190565b60006020825282518060208401526116ec816040850160208701611a2e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6020808252601d908201527f566f757263686572733a2020566f7563686572206e6f7420666f756e64000000604082015260600190565b60208082526022908201527f4c69624469616d6f6e643a204d75737420626520636f6e7472616374206f776e60408201527f6572000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f5469636b6574733a205f76616c75652067726561746572207468616e2062616c60408201527f616e636500000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f5469636b6574733a205f6f776e657273206e6f742073616d65206c656e67746860408201527f206173205f696473000000000000000000000000000000000000000000000000606082015260800190565b60208082526021908201527f5469636b6574733a204e6f7420617070726f76656420746f207472616e73666560408201527f7200000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f5f6964206e6f7420666f756e6420666f7220207469636b657400000000000000604082015260600190565b60208082526024908201527f5469636b6574733a2043616e2774207472616e7366657220746f20302061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f5469636b6574733a205472616e736665722072656a65637465642f6661696c6560408201527f64206279205f746f000000000000000000000000000000000000000000000000606082015260800190565b6020808252602c908201527f5469636b6574733a205f696473206e6f74207468652073616d65206c656e677460408201527f68206173205f76616c7565730000000000000000000000000000000000000000606082015260800190565b90815260200190565b918252602082015260400190565b60005b83811015611a49578181015183820152602001611a31565b83811115611a58576000848401525b5050505056fea2646970667358221220317d4e06f2c95be286d5b342bfb897e30e14ac10d017feadfa094c5f546e40ba64736f6c63430007030033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.