Token MAGIC

 

Overview [ERC-20]

Price
$0.50 @ 0.000289 Eth (-14.76%)
Fully Diluted Market Cap
Max Total Supply:
339,645,510.317975919597211394 MAGIC

Holders:
2,123

Transfers:
-

 
Loading
[ Download CSV Export  ] 
Loading
[ Download CSV Export  ] 
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MagicProxy

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 21 : MagicProxy.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import '@solidstate/contracts/proxy/diamond/Diamond.sol';
import '@solidstate/contracts/token/ERC20/metadata/ERC20MetadataStorage.sol';

contract MagicProxy is Diamond {
    constructor() {
        ERC20MetadataStorage.Layout storage l = ERC20MetadataStorage.layout();
        l.name = 'MAGIC';
        l.symbol = 'MAGIC';
    }
}

File 2 of 21 : Diamond.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {SafeOwnable, OwnableStorage, Ownable} from '../../access/SafeOwnable.sol';
import {IERC173} from '../../access/IERC173.sol';
import {ERC165, IERC165, ERC165Storage} from '../../introspection/ERC165.sol';
import {DiamondBase, DiamondBaseStorage} from './DiamondBase.sol';
import {DiamondCuttable, IDiamondCuttable} from './DiamondCuttable.sol';
import {DiamondLoupe, IDiamondLoupe} from './DiamondLoupe.sol';

/**
 * @notice SolidState "Diamond" proxy reference implementation
 */
abstract contract Diamond is DiamondBase, DiamondCuttable, DiamondLoupe, SafeOwnable, ERC165 {
  using DiamondBaseStorage for DiamondBaseStorage.Layout;
  using ERC165Storage for ERC165Storage.Layout;
  using OwnableStorage for OwnableStorage.Layout;

  constructor () {
    ERC165Storage.Layout storage erc165 = ERC165Storage.layout();
    bytes4[] memory selectors = new bytes4[](12);

    // register DiamondCuttable

    selectors[0] = IDiamondCuttable.diamondCut.selector;

    erc165.setSupportedInterface(type(IDiamondCuttable).interfaceId, true);

    // register DiamondLoupe

    selectors[1] = IDiamondLoupe.facets.selector;
    selectors[2] = IDiamondLoupe.facetFunctionSelectors.selector;
    selectors[3] = IDiamondLoupe.facetAddresses.selector;
    selectors[4] = IDiamondLoupe.facetAddress.selector;

    erc165.setSupportedInterface(type(IDiamondLoupe).interfaceId, true);

    // register ERC165

    selectors[5] = IERC165.supportsInterface.selector;

    erc165.setSupportedInterface(type(IERC165).interfaceId, true);

    // register SafeOwnable

    selectors[6] = Ownable.owner.selector;
    selectors[7] = SafeOwnable.nomineeOwner.selector;
    selectors[8] = SafeOwnable.transferOwnership.selector;
    selectors[9] = SafeOwnable.acceptOwnership.selector;

    erc165.setSupportedInterface(type(IERC173).interfaceId, true);

    // register Diamond

    selectors[10] = Diamond.getFallbackAddress.selector;
    selectors[11] = Diamond.setFallbackAddress.selector;

    // diamond cut

    FacetCut[] memory facetCuts = new FacetCut[](1);

    facetCuts[0] = FacetCut({
      target: address(this),
      action: IDiamondCuttable.FacetCutAction.ADD,
      selectors: selectors
    });

    DiamondBaseStorage.layout().diamondCut(facetCuts, address(0), '');

    // set owner

    OwnableStorage.layout().setOwner(msg.sender);
  }

  receive () external payable {}

  /**
   * @notice get the address of the fallback contract
   * @return fallback address
   */
  function getFallbackAddress () external view returns (address) {
    return DiamondBaseStorage.layout().fallbackAddress;
  }

  /**
   * @notice set the address of the fallback contract
   * @param fallbackAddress fallback address
   */
  function setFallbackAddress (
    address fallbackAddress
  ) external onlyOwner {
    DiamondBaseStorage.layout().fallbackAddress = fallbackAddress;
  }
}

File 3 of 21 : ERC20MetadataStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library ERC20MetadataStorage {
  struct Layout {
    string name;
    string symbol;
    uint8 decimals;
  }

  bytes32 internal constant STORAGE_SLOT = keccak256(
    'solidstate.contracts.storage.ERC20Metadata'
  );

  function layout () internal pure returns (Layout storage l) {
    bytes32 slot = STORAGE_SLOT;
    assembly { l.slot := slot }
  }

  function setName (
    Layout storage l,
    string memory name
  ) internal {
    l.name = name;
  }

  function setSymbol (
    Layout storage l,
    string memory symbol
  ) internal {
    l.symbol = symbol;
  }

  function setDecimals (
    Layout storage l,
    uint8 decimals
  ) internal {
    l.decimals = decimals;
  }
}

File 4 of 21 : SafeOwnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {Ownable, OwnableStorage} from './Ownable.sol';
import {SafeOwnableInternal} from './SafeOwnableInternal.sol';
import {SafeOwnableStorage} from './SafeOwnableStorage.sol';

/**
 * @title Ownership access control based on ERC173 with ownership transfer safety check
 */
abstract contract SafeOwnable is Ownable, SafeOwnableInternal {
  using OwnableStorage for OwnableStorage.Layout;
  using SafeOwnableStorage for SafeOwnableStorage.Layout;

  function nomineeOwner () virtual public view returns (address) {
    return SafeOwnableStorage.layout().nomineeOwner;
  }

  /**
   * @inheritdoc Ownable
   * @dev ownership transfer must be accepted by beneficiary before transfer is complete
   */
  function transferOwnership (
    address account
  ) virtual override public onlyOwner {
    SafeOwnableStorage.layout().setNomineeOwner(account);
  }

  /**
   * @notice accept transfer of contract ownership
   */
  function acceptOwnership () virtual public onlyNomineeOwner {
    OwnableStorage.Layout storage l = OwnableStorage.layout();
    emit OwnershipTransferred(l.owner, msg.sender);
    l.setOwner(msg.sender);
    SafeOwnableStorage.layout().setNomineeOwner(address(0));
  }
}

File 5 of 21 : IERC173.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Contract ownership standard interface
 * @dev see https://eips.ethereum.org/EIPS/eip-173
 */
interface IERC173 {
  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

  /**
   * @notice get the ERC173 contract owner
   * @return conract owner
   */
  function owner () external view returns (address);

  /**
   * @notice transfer contract ownership to new account
   * @param account address of new owner
   */
  function transferOwnership (address account) external;
}

File 6 of 21 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {IERC165} from './IERC165.sol';
import {ERC165Storage} from './ERC165Storage.sol';

/**
 * @title ERC165 implementation
 */
abstract contract ERC165 is IERC165 {
  using ERC165Storage for ERC165Storage.Layout;

  /**
   * @inheritdoc IERC165
   */
  function supportsInterface (bytes4 interfaceId) override public view returns (bool) {
    return ERC165Storage.layout().isSupportedInterface(interfaceId);
  }
}

File 7 of 21 : DiamondBase.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {Proxy} from '../Proxy.sol';
import {DiamondBaseStorage} from './DiamondBaseStorage.sol';
import {IDiamondLoupe} from './IDiamondLoupe.sol';
import {IDiamondCuttable} from './IDiamondCuttable.sol';

/**
 * @title EIP-2535 "Diamond" proxy base contract
 * @dev see https://eips.ethereum.org/EIPS/eip-2535
 */
abstract contract DiamondBase is Proxy {
  /**
   * @inheritdoc Proxy
   */
  function _getImplementation () override internal view returns (address) {
    // inline storage layout retrieval uses less gas
    DiamondBaseStorage.Layout storage l;
    bytes32 slot = DiamondBaseStorage.STORAGE_SLOT;
    assembly { l.slot := slot }

    address implementation = address(bytes20(l.facets[msg.sig]));

    if (implementation == address(0)) {
      implementation = l.fallbackAddress;
      require(
        implementation != address(0),
        'DiamondBase: no facet found for function signature'
      );
    }

    return implementation;
  }
}

File 8 of 21 : DiamondCuttable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {OwnableInternal} from '../../access/OwnableInternal.sol';
import {IDiamondCuttable} from './IDiamondCuttable.sol';
import {DiamondBaseStorage} from './DiamondBaseStorage.sol';

/**
 * @title EIP-2535 "Diamond" proxy update contract
 */
abstract contract DiamondCuttable is IDiamondCuttable, OwnableInternal {
  using DiamondBaseStorage for DiamondBaseStorage.Layout;

  /**
   * @notice update functions callable on Diamond proxy
   * @param facetCuts array of structured Diamond facet update data
   * @param target optional recipient of initialization delegatecall
   * @param data optional initialization call data
   */
  function diamondCut (
    FacetCut[] calldata facetCuts,
    address target,
    bytes calldata data
  ) external override onlyOwner {
    DiamondBaseStorage.layout().diamondCut(facetCuts, target, data);
  }
}

File 9 of 21 : DiamondLoupe.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {DiamondBaseStorage} from './DiamondBaseStorage.sol';
import {IDiamondLoupe} from './IDiamondLoupe.sol';

/**
 * @title EIP-2535 "Diamond" proxy introspection contract
 * @dev derived from https://github.com/mudgen/diamond-2 (MIT license)
 */
abstract contract DiamondLoupe is IDiamondLoupe {
  /**
   * @inheritdoc IDiamondLoupe
   */
  function facets () external override view returns (Facet[] memory diamondFacets) {
    DiamondBaseStorage.Layout storage l = DiamondBaseStorage.layout();

    diamondFacets = new Facet[](l.selectorCount);

    uint8[] memory numFacetSelectors = new uint8[](l.selectorCount);
    uint256 numFacets;
    uint256 selectorIndex;

    // loop through function selectors
    for (uint256 slotIndex; selectorIndex < l.selectorCount; slotIndex++) {
      bytes32 slot = l.selectorSlots[slotIndex];

      for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) {
        selectorIndex++;

        if (selectorIndex > l.selectorCount) {
          break;
        }

        bytes4 selector = bytes4(slot << (selectorSlotIndex << 5));
        address facet = address(bytes20(l.facets[selector]));

        bool continueLoop;

        for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) {
          if (diamondFacets[facetIndex].target == facet) {
            diamondFacets[facetIndex].selectors[numFacetSelectors[facetIndex]] = selector;
            // probably will never have more than 256 functions from one facet contract
            require(numFacetSelectors[facetIndex] < 255);
            numFacetSelectors[facetIndex]++;
            continueLoop = true;
            break;
          }
        }

        if (continueLoop) {
          continue;
        }

        diamondFacets[numFacets].target = facet;
        diamondFacets[numFacets].selectors = new bytes4[](l.selectorCount);
        diamondFacets[numFacets].selectors[0] = selector;
        numFacetSelectors[numFacets] = 1;
        numFacets++;
      }
    }

    for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) {
      uint256 numSelectors = numFacetSelectors[facetIndex];
      bytes4[] memory selectors = diamondFacets[facetIndex].selectors;

      // setting the number of selectors
      assembly { mstore(selectors, numSelectors) }
    }

    // setting the number of facets
    assembly { mstore(diamondFacets, numFacets) }
  }

  /**
   * @inheritdoc IDiamondLoupe
   */
  function facetFunctionSelectors (
    address facet
  ) external override view returns (bytes4[] memory selectors) {
    DiamondBaseStorage.Layout storage l = DiamondBaseStorage.layout();

    selectors = new bytes4[](l.selectorCount);

    uint256 numSelectors;
    uint256 selectorIndex;

    // loop through function selectors
    for (uint256 slotIndex; selectorIndex < l.selectorCount; slotIndex++) {
      bytes32 slot = l.selectorSlots[slotIndex];

      for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) {
        selectorIndex++;

        if (selectorIndex > l.selectorCount) {
          break;
        }

        bytes4 selector = bytes4(slot << (selectorSlotIndex << 5));

        if (facet == address(bytes20(l.facets[selector]))) {
          selectors[numSelectors] = selector;
          numSelectors++;
        }
      }
    }

    // set the number of selectors in the array
    assembly { mstore(selectors, numSelectors) }
  }

  /**
   * @inheritdoc IDiamondLoupe
   */
  function facetAddresses () external override view returns (address[] memory addresses) {
    DiamondBaseStorage.Layout storage l = DiamondBaseStorage.layout();

    addresses = new address[](l.selectorCount);
    uint256 numFacets;
    uint256 selectorIndex;

    for (uint256 slotIndex; selectorIndex < l.selectorCount; slotIndex++) {
      bytes32 slot = l.selectorSlots[slotIndex];

      for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) {
        selectorIndex++;

        if (selectorIndex > l.selectorCount) {
          break;
        }

        bytes4 selector = bytes4(slot << (selectorSlotIndex << 5));
        address facet = address(bytes20(l.facets[selector]));

        bool continueLoop;

        for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) {
          if (facet == addresses[facetIndex]) {
            continueLoop = true;
            break;
          }
        }

        if (continueLoop) {
          continue;
        }

        addresses[numFacets] = facet;
        numFacets++;
      }
    }

    // set the number of facet addresses in the array
    assembly { mstore(addresses, numFacets) }
  }

  /**
   * @inheritdoc IDiamondLoupe
   */
  function facetAddress (
    bytes4 selector
  ) external override view returns (address facet) {
    facet = address(bytes20(
      DiamondBaseStorage.layout().facets[selector]
    ));
  }
}

File 10 of 21 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {IERC173} from './IERC173.sol';
import {OwnableInternal} from './OwnableInternal.sol';
import {OwnableStorage} from './OwnableStorage.sol';

/**
 * @title Ownership access control based on ERC173
 */
abstract contract Ownable is IERC173, OwnableInternal {
  using OwnableStorage for OwnableStorage.Layout;

  /**
   * @inheritdoc IERC173
   */
  function owner () virtual override public view returns (address) {
    return OwnableStorage.layout().owner;
  }

  /**
   * @inheritdoc IERC173
   */
  function transferOwnership (
    address account
  ) virtual override public onlyOwner {
    OwnableStorage.layout().setOwner(account);
    emit OwnershipTransferred(msg.sender, account);
  }
}

File 11 of 21 : SafeOwnableInternal.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {SafeOwnableStorage} from './SafeOwnableStorage.sol';

abstract contract SafeOwnableInternal {
  using SafeOwnableStorage for SafeOwnableStorage.Layout;

  modifier onlyNomineeOwner () {
    require(
      msg.sender == SafeOwnableStorage.layout().nomineeOwner,
      'SafeOwnable: sender must be nominee owner'
    );
    _;
  }
}

File 12 of 21 : SafeOwnableStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library SafeOwnableStorage {
  struct Layout {
    address nomineeOwner;
  }

  bytes32 internal constant STORAGE_SLOT = keccak256(
    'solidstate.contracts.storage.SafeOwnable'
  );

  function layout () internal pure returns (Layout storage l) {
    bytes32 slot = STORAGE_SLOT;
    assembly { l.slot := slot }
  }

  function setNomineeOwner (
    Layout storage l,
    address nomineeOwner
  ) internal {
    l.nomineeOwner = nomineeOwner;
  }
}

File 13 of 21 : OwnableInternal.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {OwnableStorage} from './OwnableStorage.sol';

abstract contract OwnableInternal {
  using OwnableStorage for OwnableStorage.Layout;

  modifier onlyOwner {
    require(
      msg.sender == OwnableStorage.layout().owner,
      'Ownable: sender must be owner'
    );
    _;
  }
}

File 14 of 21 : OwnableStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library OwnableStorage {
  struct Layout {
    address owner;
  }

  bytes32 internal constant STORAGE_SLOT = keccak256(
    'solidstate.contracts.storage.Ownable'
  );

  function layout () internal pure returns (Layout storage l) {
    bytes32 slot = STORAGE_SLOT;
    assembly { l.slot := slot }
  }

  function setOwner (
    Layout storage l,
    address owner
  ) internal {
    l.owner = owner;
  }
}

File 15 of 21 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title ERC165 interface registration interface
 * @dev see https://eips.ethereum.org/EIPS/eip-165
 */
interface IERC165 {
  /**
   * @notice query whether contract has registered support for given interface
   * @param interfaceId interface id
   * @return bool whether interface is supported
   */
  function supportsInterface (
    bytes4 interfaceId
  ) external view returns (bool);
}

File 16 of 21 : ERC165Storage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library ERC165Storage {
  struct Layout {
    // TODO: use EnumerableSet to allow post-diamond-cut auditing
    mapping (bytes4 => bool) supportedInterfaces;
  }

  bytes32 internal constant STORAGE_SLOT = keccak256(
    'solidstate.contracts.storage.ERC165'
  );

  function layout () internal pure returns (Layout storage l) {
    bytes32 slot = STORAGE_SLOT;
    assembly { l.slot := slot }
  }

  function isSupportedInterface (
    Layout storage l,
    bytes4 interfaceId
  ) internal view returns (bool) {
    return l.supportedInterfaces[interfaceId];
  }

  function setSupportedInterface (
    Layout storage l,
    bytes4 interfaceId,
    bool status
  ) internal {
    require(interfaceId != 0xffffffff, 'ERC165: invalid interface id');
    l.supportedInterfaces[interfaceId] = status;
  }
}

File 17 of 21 : Proxy.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {AddressUtils} from '../utils/AddressUtils.sol';

/**
 * @title Base proxy contract
 */
abstract contract Proxy {
  using AddressUtils for address;

  /**
   * @notice delegate all calls to implementation contract
   * @dev reverts if implementation address contains no code, for compatibility with metamorphic contracts
   * @dev memory location in use by assembly may be unsafe in other contexts
   */
  fallback () virtual external payable {
    address implementation = _getImplementation();

    require(
      implementation.isContract(),
      'Proxy: implementation must be contract'
    );

    assembly {
      calldatacopy(0, 0, calldatasize())
      let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
      returndatacopy(0, 0, returndatasize())

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

  /**
   * @notice get logic implementation address
   * @return implementation address
   */
  function _getImplementation () virtual internal returns (address);
}

File 18 of 21 : DiamondBaseStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {AddressUtils} from '../../utils/AddressUtils.sol';
import {IDiamondCuttable} from './IDiamondCuttable.sol';

/**
 * @dev derived from https://github.com/mudgen/diamond-2 (MIT license)
 */
library DiamondBaseStorage {
  using AddressUtils for address;
  using DiamondBaseStorage for DiamondBaseStorage.Layout;

  struct Layout {
    // function selector => (facet address, selector slot position)
    mapping (bytes4 => bytes32) facets;
    // total number of selectors registered
    uint16 selectorCount;
    // array of selector slots with 8 selectors per slot
    mapping (uint256 => bytes32) selectorSlots;

    address fallbackAddress;
  }

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

  bytes32 internal constant STORAGE_SLOT = keccak256(
    'solidstate.contracts.storage.DiamondBase'
  );

  event DiamondCut (IDiamondCuttable.FacetCut[] facetCuts, address target, bytes data);

  function layout () internal pure returns (Layout storage l) {
    bytes32 slot = STORAGE_SLOT;
    assembly { l.slot := slot }
  }

  /**
   * @notice update functions callable on Diamond proxy
   * @param l storage layout
   * @param facetCuts array of structured Diamond facet update data
   * @param target optional recipient of initialization delegatecall
   * @param data optional initialization call data
   */
  function diamondCut(
    Layout storage l,
    IDiamondCuttable.FacetCut[] memory facetCuts,
    address target,
    bytes memory data
  ) internal {
    unchecked {
      uint256 originalSelectorCount = l.selectorCount;
      uint256 selectorCount = originalSelectorCount;
      bytes32 selectorSlot;

      // Check if last selector slot is not full
      if (selectorCount & 7 > 0) {
        // get last selectorSlot
        selectorSlot = l.selectorSlots[selectorCount >> 3];
      }

      for (uint256 i; i < facetCuts.length; i++) {
        IDiamondCuttable.FacetCut memory facetCut = facetCuts[i];
        IDiamondCuttable.FacetCutAction action = facetCut.action;

        require(
          facetCut.selectors.length > 0,
          'DiamondBase: no selectors specified'
        );

        if (action == IDiamondCuttable.FacetCutAction.ADD) {
          (selectorCount, selectorSlot) = l.addFacetSelectors(
            selectorCount,
            selectorSlot,
            facetCut
          );
        } else if (action == IDiamondCuttable.FacetCutAction.REMOVE) {
          (selectorCount, selectorSlot) = l.removeFacetSelectors(
            selectorCount,
            selectorSlot,
            facetCut
          );
        } else if (action == IDiamondCuttable.FacetCutAction.REPLACE) {
          l.replaceFacetSelectors(facetCut);
        }
      }

      if (selectorCount != originalSelectorCount) {
        l.selectorCount = uint16(selectorCount);
      }

      // If last selector slot is not full
      if (selectorCount & 7 > 0) {
        l.selectorSlots[selectorCount >> 3] = selectorSlot;
      }

      emit DiamondCut(facetCuts, target, data);
      initialize(target, data);
    }
  }

  function addFacetSelectors (
    Layout storage l,
    uint256 selectorCount,
    bytes32 selectorSlot,
    IDiamondCuttable.FacetCut memory facetCut
  ) internal returns (uint256, bytes32) {
    unchecked {
      require(
        facetCut.target == address(this) || facetCut.target.isContract(),
        'DiamondBase: ADD target has no code'
      );

      for (uint256 i; i < facetCut.selectors.length; i++) {
        bytes4 selector = facetCut.selectors[i];
        bytes32 oldFacet = l.facets[selector];

        require(
          address(bytes20(oldFacet)) == address(0),
          'DiamondBase: selector already added'
        );

        // add facet for selector
        l.facets[selector] = bytes20(facetCut.target) | bytes32(selectorCount);
        uint256 selectorInSlotPosition = (selectorCount & 7) << 5;

        // 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) {
          l.selectorSlots[selectorCount >> 3] = selectorSlot;
          selectorSlot = 0;
        }

        selectorCount++;
      }

      return (selectorCount, selectorSlot);
    }
  }

  function removeFacetSelectors (
    Layout storage l,
    uint256 selectorCount,
    bytes32 selectorSlot,
    IDiamondCuttable.FacetCut memory facetCut
  ) internal returns (uint256, bytes32) {
    unchecked {
      require(
        facetCut.target == address(0),
        'DiamondBase: REMOVE target must be zero address'
      );

      uint256 selectorSlotCount = selectorCount >> 3;
      uint256 selectorInSlotIndex = selectorCount & 7;

      for (uint256 i; i < facetCut.selectors.length; i++) {
        bytes4 selector = facetCut.selectors[i];
        bytes32 oldFacet = l.facets[selector];

        require(
          address(bytes20(oldFacet)) != address(0),
          'DiamondBase: selector not found'
        );

        require(
          address(bytes20(oldFacet)) != address(this),
          'DiamondBase: selector is immutable'
        );

        if (selectorSlot == 0) {
          selectorSlotCount--;
          selectorSlot = l.selectorSlots[selectorSlotCount];
          selectorInSlotIndex = 7;
        } else {
          selectorInSlotIndex--;
        }

        bytes4 lastSelector;
        uint256 oldSelectorsSlotCount;
        uint256 oldSelectorInSlotPosition;

        // adding a block here prevents stack too deep error
        {
          // replace selector with last selector in l.facets
          lastSelector = bytes4(selectorSlot << (selectorInSlotIndex << 5));

          if (lastSelector != selector) {
            // update last selector slot position info
            l.facets[lastSelector] = (
              oldFacet & CLEAR_ADDRESS_MASK
            ) | bytes20(l.facets[lastSelector]);
          }

          delete l.facets[selector];
          uint256 oldSelectorCount = uint16(uint256(oldFacet));
          oldSelectorsSlotCount = oldSelectorCount >> 3;
          oldSelectorInSlotPosition = (oldSelectorCount & 7) << 5;
        }

        if (oldSelectorsSlotCount != selectorSlotCount) {
          bytes32 oldSelectorSlot = l.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
          l.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 l.selectorSlots[selectorSlotCount];
          selectorSlot = 0;
        }
      }

      selectorCount = (selectorSlotCount << 3) | selectorInSlotIndex;

      return (selectorCount, selectorSlot);
    }
  }

  function replaceFacetSelectors (
    Layout storage l,
    IDiamondCuttable.FacetCut memory facetCut
  ) internal {
    unchecked {
      require(
        facetCut.target.isContract(),
        'DiamondBase: REPLACE target has no code'
      );

      for (uint256 i; i < facetCut.selectors.length; i++) {
        bytes4 selector = facetCut.selectors[i];
        bytes32 oldFacet = l.facets[selector];
        address oldFacetAddress = address(bytes20(oldFacet));

        require(
          oldFacetAddress != address(0),
          'DiamondBase: selector not found'
        );

        require(
          oldFacetAddress != address(this),
          'DiamondBase: selector is immutable'
        );

        require(
          oldFacetAddress != facetCut.target,
          'DiamondBase: REPLACE target is identical'
        );

        // replace old facet address
        l.facets[selector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(facetCut.target);
      }
    }
  }

  function initialize (
    address target,
    bytes memory data
  ) private {
    require(
      (target == address(0)) == (data.length == 0),
      'DiamondBase: invalid initialization parameters'
    );

    if (target != address(0)) {
      if (target != address(this)) {
        require(
          target.isContract(),
          'DiamondBase: initialization target has no code'
        );
      }

      (bool success, ) = target.delegatecall(data);

      if (!success) {
        assembly {
          returndatacopy(0, 0, returndatasize())
          revert(0, returndatasize())
        }
      }
    }
  }
}

File 19 of 21 : IDiamondLoupe.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Diamond proxy introspection interface
 * @dev see https://eips.ethereum.org/EIPS/eip-2535
 */
interface IDiamondLoupe {
  struct Facet {
    address target;
    bytes4[] selectors;
  }

  /**
   * @notice get all facets and their selectors
   * @return diamondFacets array of structured facet data
   */
  function facets () external view returns (Facet[] memory diamondFacets);

  /**
   * @notice get all selectors for given facet address
   * @param facet address of facet to query
   * @return selectors array of function selectors
   */
  function facetFunctionSelectors (
    address facet
  ) external view returns (bytes4[] memory selectors);

  /**
   * @notice get addresses of all facets used by diamond
   * @return addresses array of facet addresses
   */
  function facetAddresses () external view returns (address[] memory addresses);

  /**
   * @notice get the address of the facet associated with given selector
   * @param selector function selector to query
   * @return facet facet address (zero address if not found)
   */
  function facetAddress (
    bytes4 selector
  ) external view returns (address facet);
}

File 20 of 21 : IDiamondCuttable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Diamond proxy upgrade interface
 * @dev see https://eips.ethereum.org/EIPS/eip-2535
 */
interface IDiamondCuttable {
  enum FacetCutAction { ADD, REPLACE, REMOVE }

  event DiamondCut (FacetCut[] facetCuts, address target, bytes data);

  struct FacetCut {
    address target;
    FacetCutAction action;
    bytes4[] selectors;
  }

  /**
   * @notice update diamond facets and optionally execute arbitrary initialization function
   * @param facetCuts facet addresses, actions, and function selectors
   * @param target initialization function target
   * @param data initialization function call data
   */
  function diamondCut (
    FacetCut[] calldata facetCuts,
    address target,
    bytes calldata data
  ) external;
}

File 21 of 21 : AddressUtils.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library AddressUtils {
  function toString (address account) internal pure returns (string memory) {
    bytes32 value = bytes32(uint256(uint160(account)));
    bytes memory alphabet = '0123456789abcdef';
    bytes memory chars = new bytes(42);

    chars[0] = '0';
    chars[1] = 'x';

    for (uint256 i = 0; i < 20; i++) {
      chars[2 + i * 2] = alphabet[uint8(value[i + 12] >> 4)];
      chars[3 + i * 2] = alphabet[uint8(value[i + 12] & 0x0f)];
    }

    return string(chars);
  }

  function isContract (address account) internal view returns (bool) {
    uint size;
    assembly { size := extcodesize(account) }
    return size > 0;
  }

  function sendValue (address payable account, uint amount) internal {
    (bool success, ) = account.call{ value: amount }('');
    require(success, 'AddressUtils: failed to send value');
  }

  function functionCall (address target, bytes memory data) internal returns (bytes memory) {
    return functionCall(target, data, 'AddressUtils: failed low-level call');
  }

  function functionCall (address target, bytes memory data, string memory error) internal returns (bytes memory) {
    return _functionCallWithValue(target, data, 0, error);
  }

  function functionCallWithValue (address target, bytes memory data, uint value) internal returns (bytes memory) {
    return functionCallWithValue(target, data, value, 'AddressUtils: failed low-level call with value');
  }

  function functionCallWithValue (address target, bytes memory data, uint value, string memory error) internal returns (bytes memory) {
    require(address(this).balance >= value, 'AddressUtils: insufficient balance for call');
    return _functionCallWithValue(target, data, value, error);
  }

  function _functionCallWithValue (address target, bytes memory data, uint value, string memory error) private returns (bytes memory) {
    require(isContract(target), 'AddressUtils: function call to non-contract');

    (bool success, bytes memory returnData) = target.call{ value: value }(data);

    if (success) {
      return returnData;
    } else if (returnData.length > 0) {
      assembly {
        let returnData_size := mload(returnData)
        revert(add(32, returnData), returnData_size)
      }
    } else {
      revert(error);
    }
  }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IDiamondCuttable.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"selectors","type":"bytes4[]"}],"indexed":false,"internalType":"struct IDiamondCuttable.FacetCut[]","name":"facetCuts","type":"tuple[]"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"DiamondCut","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IDiamondCuttable.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"selectors","type":"bytes4[]"}],"internalType":"struct IDiamondCuttable.FacetCut[]","name":"facetCuts","type":"tuple[]"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"diamondCut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"facetAddress","outputs":[{"internalType":"address","name":"facet","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"facetAddresses","outputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"facet","type":"address"}],"name":"facetFunctionSelectors","outputs":[{"internalType":"bytes4[]","name":"selectors","type":"bytes4[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"facets","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4[]","name":"selectors","type":"bytes4[]"}],"internalType":"struct IDiamondLoupe.Facet[]","name":"diamondFacets","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFallbackAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nomineeOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"fallbackAddress","type":"address"}],"name":"setFallbackAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b506000620000296200059860201b62000ebe1760201c565b60408051600c8082526101a08201909252919250600091906020820161018080368337019050509050631f931c1c60e01b816000815181106200007c57634e487b7160e01b600052603260045260246000fd5b6001600160e01b0319909216602092830291909101820152620000b69083906307e4c70760e21b9060019062000ee2620005bc821b17901c565b637a0ed62760e01b81600181518110620000e057634e487b7160e01b600052603260045260246000fd5b6001600160e01b03199092166020928302919091019091015280516356fe50af60e11b90829060029081106200012657634e487b7160e01b600052603260045260246000fd5b6001600160e01b03199092166020928302919091019091015280516314bbdacb60e21b90829060039081106200016c57634e487b7160e01b600052603260045260246000fd5b6001600160e01b03199092166020928302919091019091015280516366ffd66360e11b9082906004908110620001b257634e487b7160e01b600052603260045260246000fd5b6001600160e01b0319909216602092830291909101820152620001ec9083906348e2b09360e01b9060019062000ee2620005bc821b17901c565b6301ffc9a760e01b816005815181106200021657634e487b7160e01b600052603260045260246000fd5b6001600160e01b0319909216602092830291909101820152620002509083906301ffc9a760e01b9060019062000ee2620005bc821b17901c565b638da5cb5b60e01b816006815181106200027a57634e487b7160e01b600052603260045260246000fd5b6001600160e01b031990921660209283029190910190910152805163455a8a8560e11b9082906007908110620002c057634e487b7160e01b600052603260045260246000fd5b6001600160e01b031990921660209283029190910190910152805163f2fde38b60e01b90829060089081106200030657634e487b7160e01b600052603260045260246000fd5b6001600160e01b03199092166020928302919091019091015280516379ba509760e01b90829060099081106200034c57634e487b7160e01b600052603260045260246000fd5b6001600160e01b0319909216602092830291909101820152620003869083906307f5828d60e41b9060019062000ee2620005bc821b17901c565b632c40805960e01b81600a81518110620003b057634e487b7160e01b600052603260045260246000fd5b6001600160e01b0319909216602092830291909101909101528051639142376560e01b908290600b908110620003f657634e487b7160e01b600052603260045260246000fd5b6001600160e01b03199290921660209283029190910190910152604080516001808252818301909252600091816020015b6040805160608082018352600080835260208301529181019190915281526020019060019003908162000427579050506040805160608101909152308152909150602081016000815260200183815250816000815181106200049957634e487b7160e01b600052603260045260246000fd5b6020026020010181905250620004e681600060405180602001604052806000815250620004d06200064a60201b62000f6a1760201c565b6200066e60201b62000f8e17909392919060201c565b620005143362000500620008c160201b6200119a1760201c565b620008e560201b620011be1790919060201c565b50505060006200052e6200090260201b620011db1760201c565b604080518082019091526005808252644d4147494360d81b60209092019182529192506200055f91839190620011b3565b50604080518082019091526005808252644d4147494360d81b602090920191825262000590916001840191620011b3565b505062001418565b7f326d0c59a7612f6a9919e2a8ee333c80ba689d8ba2634de89c85cbb04832e70590565b6001600160e01b031980831614156200061c5760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e746572666163652069640000000060448201526064015b60405180910390fd5b6001600160e01b03199190911660009081526020929092526040909120805460ff1916911515919091179055565b7f177481ac65e4292921c69f62d1cc7f57541261e5d61c8175cf4e36a01c9bfc9390565b600184015461ffff8116908190600090600716156200069f5750600381901c60009081526002870160205260409020545b60005b86518110156200082f576000878281518110620006cf57634e487b7160e01b600052603260045260246000fd5b60200260200101519050600081602001519050600082604001515111620007455760405162461bcd60e51b815260206004820152602360248201527f4469616d6f6e64426173653a206e6f2073656c6563746f7273207370656369666044820152621a595960ea1b606482015260840162000613565b60008160028111156200076857634e487b7160e01b600052602160045260246000fd5b141562000798576200078d8585848d6200092660201b620011ff17909392919060201c565b909550935062000824565b6002816002811115620007bb57634e487b7160e01b600052602160045260246000fd5b1415620007e0576200078d8585848d62000b0460201b620013c017909392919060201c565b60018160028111156200080357634e487b7160e01b600052602160045260246000fd5b1415620008245762000824828b62000dd860201b620016601790919060201c565b5050600101620006a2565b508282146200084c5760018701805461ffff191661ffff84161790555b60078216156200086f57600382901c600090815260028801602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673868686604051620008a493929190620012a5565b60405180910390a1620008b885856200101e565b50505050505050565b7f8a22373512790c48b83a1fe2efdd2888d4a917bcdc24d0adf63e60f67168046090565b81546001600160a01b0319166001600160a01b0391909116179055565b7f2967a798b92539a1b9eefe4d8eb931f96b68d27665e276f1bee2d5db7f74304790565b805160009081906001600160a01b03163014806200096257506200096283600001516001600160a01b0316620011ad60201b620003a41760201c565b620009bc5760405162461bcd60e51b815260206004820152602360248201527f4469616d6f6e64426173653a204144442074617267657420686173206e6f20636044820152626f646560e81b606482015260840162000613565b60005b83604001515181101562000af757600084604001518281518110620009f457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c1562000a7d5760405162461bcd60e51b815260206004820152602360248201527f4469616d6f6e64426173653a2073656c6563746f7220616c726561647920616460448201526219195960ea1b606482015260840162000613565b85516001600160e01b0319838116600081815260208d90526040902060609390931b6001600160601b0319168b1790925560058a901b60e090811692831c91831c1999909916179781141562000ae757600389901c600090815260028b0160205260408120989098555b50505060019586019501620009bf565b5093959294509192505050565b805160009081906001600160a01b03161562000b7b5760405162461bcd60e51b815260206004820152602f60248201527f4469616d6f6e64426173653a2052454d4f564520746172676574206d7573742060448201526e6265207a65726f206164647265737360881b606482015260840162000613565b600385901c6007861660005b85604001515181101562000dc45760008660400151828151811062000bbc57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160e01b031981166000908152918c9052604090912054909150606081901c62000c385760405162461bcd60e51b815260206004820152601f60248201527f4469616d6f6e64426173653a2073656c6563746f72206e6f7420666f756e6400604482015260640162000613565b606081901c30141562000c885760405162461bcd60e51b81526020600482015260226024820152600080516020620034948339815191526044820152616c6560f01b606482015260840162000613565b8862000cb257600019909401600081815260028c0160205260409020549850936007935062000cba565b600019909301925b600584901b89901b6000806001600160e01b03198084169086161462000d0d576001600160e01b03198316600090815260208f90526040902080546001600160601b0319166001600160601b0386161790555b50506001600160e01b03198316600090815260208d90526040812055611fff600383901c1660e0600584901b1687821462000d7257600082815260028f016020526040902080546001600160e01b031980841c19909116908516831c17905562000d96565b80836001600160e01b031916901c816001600160e01b031960001b901c198d16179b505b8662000db257600088815260028f01602052604081208190559b505b50506001909301925062000b87915050565b5060039190911b1796939550929350505050565b62000dfb81600001516001600160a01b0316620011ad60201b620003a41760201c565b62000e595760405162461bcd60e51b815260206004820152602760248201527f4469616d6f6e64426173653a205245504c4143452074617267657420686173206044820152666e6f20636f646560c81b606482015260840162000613565b60005b816040015151811015620010195760008260400151828151811062000e9157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160e01b03198116600090815291869052604090912054909150606081901c8062000f0e5760405162461bcd60e51b815260206004820152601f60248201527f4469616d6f6e64426173653a2073656c6563746f72206e6f7420666f756e6400604482015260640162000613565b6001600160a01b03811630141562000f635760405162461bcd60e51b81526020600482015260226024820152600080516020620034948339815191526044820152616c6560f01b606482015260840162000613565b84516001600160a01b038281169116141562000fd35760405162461bcd60e51b815260206004820152602860248201527f4469616d6f6e64426173653a205245504c41434520746172676574206973206960448201526719195b9d1a58d85b60c21b606482015260840162000613565b5083516001600160e01b031992909216600090815260208690526040902060609290921b6001600160601b0319166001600160601b039190911617905560010162000e5c565b505050565b8051156001600160a01b0383161514620010925760405162461bcd60e51b815260206004820152602e60248201527f4469616d6f6e64426173653a20696e76616c696420696e697469616c697a617460448201526d696f6e20706172616d657465727360901b606482015260840162000613565b6001600160a01b03821615620011a9576001600160a01b03821630146200113757620010d2826001600160a01b0316620011ad60201b620003a41760201c565b620011375760405162461bcd60e51b815260206004820152602e60248201527f4469616d6f6e64426173653a20696e697469616c697a6174696f6e207461726760448201526d657420686173206e6f20636f646560901b606482015260840162000613565b6000826001600160a01b03168260405162001153919062001287565b600060405180830381855af49150503d806000811462001190576040519150601f19603f3d011682016040523d82523d6000602084013e62001195565b606091505b505090508062001019573d6000803e3d6000fd5b5050565b3b151590565b828054620011c190620013db565b90600052602060002090601f016020900481019282620011e5576000855562001230565b82601f106200120057805160ff191683800117855562001230565b8280016001018555821562001230579182015b828111156200123057825182559160200191906001019062001213565b506200123e92915062001242565b5090565b5b808211156200123e576000815560010162001243565b6000815180845262001273816020860160208601620013a8565b601f01601f19169290920160200192915050565b600082516200129b818460208701620013a8565b9190910192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b01875b848110156200137657898403607f19018652815180516001600160a01b031685528381015189860190600381106200131357634e487b7160e01b8c52602160045260248cfd5b868601526040918201519186018a9052815190819052908401908a90898701905b80831015620013605783516001600160e01b031916825292860192600192909201919086019062001334565b50978501979550505090820190600101620012cd565b50506001600160a01b038a169088015286810360408801526200139a818962001259565b9a9950505050505050505050565b60005b83811015620013c5578181015183820152602001620013ab565b83811115620013d5576000848401525b50505050565b600181811c90821680620013f057607f821691505b602082108114156200141257634e487b7160e01b600052602260045260246000fd5b50919050565b61206c80620014286000396000f3fe6080604052600436106100ab5760003560e01c80638ab5150a116100645780638ab5150a1461022a5780638da5cb5b1461023f5780639142376514610254578063adfca15e14610274578063cdffacc6146102a1578063f2fde38b146102c1576100b2565b806301ffc9a71461014d5780631f931c1c146101825780632c408059146101a457806352ef6b2c146101d157806379ba5097146101f35780637a0ed62714610208576100b2565b366100b257005b60006100bc6102e1565b90506001600160a01b0381163b6101295760405162461bcd60e51b815260206004820152602660248201527f50726f78793a20696d706c656d656e746174696f6e206d75737420626520636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b3660008037600080366000845af43d6000803e808015610148573d6000f35b3d6000fd5b34801561015957600080fd5b5061016d610168366004611b10565b6103aa565b60405190151581526020015b60405180910390f35b34801561018e57600080fd5b506101a261019d366004611a64565b6103df565b005b3480156101b057600080fd5b506101b961046c565b6040516001600160a01b039091168152602001610179565b3480156101dd57600080fd5b506101e6610488565b6040516101799190611bb6565b3480156101ff57600080fd5b506101a261065c565b34801561021457600080fd5b5061021d610743565b6040516101799190611cdc565b34801561023657600080fd5b506101b9610c52565b34801561024b57600080fd5b506101b9610c73565b34801561026057600080fd5b506101a261026f366004611a4a565b610c7d565b34801561028057600080fd5b5061029461028f366004611a4a565b610cda565b6040516101799190611c03565b3480156102ad57600080fd5b506101b96102bc366004611b10565b610e49565b3480156102cd57600080fd5b506101a26102dc366004611a4a565b610e76565b600080356001600160e01b03191681527f177481ac65e4292921c69f62d1cc7f57541261e5d61c8175cf4e36a01c9bfc9360208190526040822054819060601c8061039d575060038201546001600160a01b03168061039d5760405162461bcd60e51b815260206004820152603260248201527f4469616d6f6e64426173653a206e6f20666163657420666f756e6420666f722060448201527166756e6374696f6e207369676e617475726560701b6064820152608401610120565b9392505050565b3b151590565b60006103d9826103b8610ebe565b906001600160e01b0319166000908152602091909152604090205460ff1690565b92915050565b6103e761119a565b546001600160a01b0316331461040f5760405162461bcd60e51b815260040161012090611d58565b61046561041c8587611e4f565b8484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061045d9250610f6a915050565b929190610f8e565b5050505050565b6000610476610f6a565b600301546001600160a01b0316919050565b60606000610494610f6a565b600181015490915061ffff1667ffffffffffffffff8111156104c657634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156104ef578160200160208202803683370190505b50915060008060005b600184015461ffff16821015610654576000818152600285016020526040812054905b600881101561063f578361052e81611faf565b600188015490955061ffff1685111590506105485761063f565b600581901b82901b6001600160e01b0319811660009081526020889052604081205460601c90805b888110156105d4578a818151811061059857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316836001600160a01b031614156105c257600191506105d4565b806105cc81611faf565b915050610570565b5080156105e35750505061062d565b818a898151811061060457634e487b7160e01b600052603260045260246000fd5b6001600160a01b03909216602092830291909101909101528761062681611faf565b9850505050505b8061063781611faf565b91505061051b565b5050808061064c90611faf565b9150506104f8565b505082525090565b600080516020612017833981519152546001600160a01b031633146106d55760405162461bcd60e51b815260206004820152602960248201527f536166654f776e61626c653a2073656e646572206d757374206265206e6f6d696044820152683732b29037bbb732b960b91b6064820152608401610120565b60006106df61119a565b805460405191925033916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a361072581336111be565b61074060006000805160206120178339815191525b906111be565b50565b6060600061074f610f6a565b600181015490915061ffff1667ffffffffffffffff81111561078157634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156107c757816020015b60408051808201909152600081526060602082015281526020019060019003908161079f5790505b50600182015490925060009061ffff1667ffffffffffffffff8111156107fd57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610826578160200160208202803683370190505b50905060008060005b600185015461ffff16821015610bc4576000818152600286016020526040812054905b6008811015610baf578361086581611faf565b600189015490955061ffff16851115905061087f57610baf565b600581901b82901b6001600160e01b0319811660009081526020899052604081205460601c90805b88811015610a1957826001600160a01b03168c82815181106108d957634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b03161415610a0757838c828151811061091557634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518b838151811061094157634e487b7160e01b600052603260045260246000fd5b602002602001015160ff168151811061096a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160e01b03191690816001600160e01b0319168152505060ff8a82815181106109ae57634e487b7160e01b600052603260045260246000fd5b602002602001015160ff16106109c357600080fd5b8981815181106109e357634e487b7160e01b600052603260045260246000fd5b6020026020010180518091906109f890611fca565b60ff1690525060019150610a19565b80610a1181611faf565b9150506108a7565b508015610a2857505050610b9d565b818b8981518110610a4957634e487b7160e01b600052603260045260246000fd5b60209081029190910101516001600160a01b03909116905260018a015461ffff1667ffffffffffffffff811115610a9057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610ab9578160200160208202803683370190505b508b8981518110610ada57634e487b7160e01b600052603260045260246000fd5b602002602001015160200181905250828b8981518110610b0a57634e487b7160e01b600052603260045260246000fd5b602002602001015160200151600081518110610b3657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160e01b03191690816001600160e01b031916815250506001898981518110610b7a57634e487b7160e01b600052603260045260246000fd5b60ff9092166020928302919091019091015287610b9681611faf565b9850505050505b80610ba781611faf565b915050610852565b50508080610bbc90611faf565b91505061082f565b5060005b82811015610c47576000848281518110610bf257634e487b7160e01b600052603260045260246000fd5b602002602001015160ff1690506000878381518110610c2157634e487b7160e01b600052603260045260246000fd5b602002602001015160200151905081815250508080610c3f90611faf565b915050610bc8565b508185525050505090565b60006000805160206120178339815191525b546001600160a01b0316919050565b6000610c6461119a565b610c8561119a565b546001600160a01b03163314610cad5760405162461bcd60e51b815260040161012090611d58565b80610cb6610f6a565b60030180546001600160a01b0319166001600160a01b039290921691909117905550565b60606000610ce6610f6a565b600181015490915061ffff1667ffffffffffffffff811115610d1857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d41578160200160208202803683370190505b50915060008060005b600184015461ffff16821015610e3f576000818152600285016020526040812054905b6008811015610e2a5783610d8081611faf565b600188015490955061ffff168511159050610d9a57610e2a565b600581901b82901b6001600160e01b0319811660009081526020889052604090205460601c6001600160a01b038a161415610e175780888781518110610df057634e487b7160e01b600052603260045260246000fd5b6001600160e01b03199092166020928302919091019091015285610e1381611faf565b9650505b5080610e2281611faf565b915050610d6d565b50508080610e3790611faf565b915050610d4a565b5050825250919050565b6000610e53610f6a565b6001600160e01b0319909216600090815260209290925250604090205460601c90565b610e7e61119a565b546001600160a01b03163314610ea65760405162461bcd60e51b815260040161012090611d58565b6107408160008051602061201783398151915261073a565b7f326d0c59a7612f6a9919e2a8ee333c80ba689d8ba2634de89c85cbb04832e70590565b6001600160e01b03198083161415610f3c5760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e74657266616365206964000000006044820152606401610120565b6001600160e01b03199190911660009081526020929092526040909120805460ff1916911515919091179055565b7f177481ac65e4292921c69f62d1cc7f57541261e5d61c8175cf4e36a01c9bfc9390565b600184015461ffff811690819060009060071615610fbe5750600381901c60009081526002870160205260409020545b60005b865181101561110e576000878281518110610fec57634e487b7160e01b600052603260045260246000fd5b602002602001015190506000816020015190506000826040015151116110605760405162461bcd60e51b815260206004820152602360248201527f4469616d6f6e64426173653a206e6f2073656c6563746f7273207370656369666044820152621a595960ea1b6064820152608401610120565b600081600281111561108257634e487b7160e01b600052602160045260246000fd5b141561109e576110948a8686856111ff565b9095509350611104565b60028160028111156110c057634e487b7160e01b600052602160045260246000fd5b14156110d2576110948a8686856113c0565b60018160028111156110f457634e487b7160e01b600052602160045260246000fd5b1415611104576111048a83611660565b5050600101610fc1565b5082821461112a5760018701805461ffff191661ffff84161790555b600782161561114c57600382901c600090815260028801602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb67386868660405161117f93929190611c16565b60405180910390a1611191858561185f565b50505050505050565b7f8a22373512790c48b83a1fe2efdd2888d4a917bcdc24d0adf63e60f67168046090565b81546001600160a01b0319166001600160a01b0391909116179055565b7f2967a798b92539a1b9eefe4d8eb931f96b68d27665e276f1bee2d5db7f74304790565b805160009081906001600160a01b0316301480611226575082516001600160a01b03163b15155b61127e5760405162461bcd60e51b815260206004820152602360248201527f4469616d6f6e64426173653a204144442074617267657420686173206e6f20636044820152626f646560e81b6064820152608401610120565b60005b8360400151518110156113b3576000846040015182815181106112b457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c1561133b5760405162461bcd60e51b815260206004820152602360248201527f4469616d6f6e64426173653a2073656c6563746f7220616c726561647920616460448201526219195960ea1b6064820152608401610120565b85516001600160e01b0319838116600081815260208d90526040902060609390931b6001600160601b0319168b1790925560058a901b60e090811692831c91831c199990991617978114156113a457600389901c600090815260028b0160205260408120989098555b50505060019586019501611281565b5093959294509192505050565b805160009081906001600160a01b0316156114355760405162461bcd60e51b815260206004820152602f60248201527f4469616d6f6e64426173653a2052454d4f564520746172676574206d7573742060448201526e6265207a65726f206164647265737360881b6064820152608401610120565b600385901c6007861660005b85604001515181101561164c5760008660400151828151811061147457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160e01b031981166000908152918c9052604090912054909150606081901c6114ee5760405162461bcd60e51b815260206004820152601f60248201527f4469616d6f6e64426173653a2073656c6563746f72206e6f7420666f756e64006044820152606401610120565b606081901c3014156115125760405162461bcd60e51b815260040161012090611d8f565b8861153a57600019909401600081815260028c01602052604090205498509360079350611542565b600019909301925b600584901b89901b6000806001600160e01b031980841690861614611599576001600160e01b03198316600090815260208f90526040902080546001600160601b0319166bffffffffffffffffffffffff86161790555b50506001600160e01b03198316600090815260208d90526040812055611fff600383901c1660e0600584901b168782146115fc57600082815260028f016020526040902080546001600160e01b031980841c19909116908516831c179055611620565b80836001600160e01b031916901c816001600160e01b031960001b901c198d16179b505b8661163b57600088815260028f01602052604081208190559b505b505060019093019250611441915050565b5060039190911b1796939550929350505050565b80516001600160a01b03163b6116c85760405162461bcd60e51b815260206004820152602760248201527f4469616d6f6e64426173653a205245504c4143452074617267657420686173206044820152666e6f20636f646560c81b6064820152608401610120565b60005b81604001515181101561185a576000826040015182815181106116fe57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160e01b03198116600090815291869052604090912054909150606081901c806117795760405162461bcd60e51b815260206004820152601f60248201527f4469616d6f6e64426173653a2073656c6563746f72206e6f7420666f756e64006044820152606401610120565b6001600160a01b0381163014156117a25760405162461bcd60e51b815260040161012090611d8f565b84516001600160a01b03828116911614156118105760405162461bcd60e51b815260206004820152602860248201527f4469616d6f6e64426173653a205245504c41434520746172676574206973206960448201526719195b9d1a58d85b60c21b6064820152608401610120565b5083516001600160e01b031992909216600090815260208690526040902060609290921b6001600160601b0319166bffffffffffffffffffffffff919091161790556001016116cb565b505050565b8051156001600160a01b03831615146118d15760405162461bcd60e51b815260206004820152602e60248201527f4469616d6f6e64426173653a20696e76616c696420696e697469616c697a617460448201526d696f6e20706172616d657465727360901b6064820152608401610120565b6001600160a01b038216156119cb576001600160a01b038216301461195e576001600160a01b0382163b61195e5760405162461bcd60e51b815260206004820152602e60248201527f4469616d6f6e64426173653a20696e697469616c697a6174696f6e207461726760448201526d657420686173206e6f20636f646560901b6064820152608401610120565b6000826001600160a01b0316826040516119789190611b9a565b600060405180830381855af49150503d80600081146119b3576040519150601f19603f3d011682016040523d82523d6000602084013e6119b8565b606091505b505090508061185a573d6000803e3d6000fd5b5050565b80356001600160a01b03811681146119e657600080fd5b919050565b80356001600160e01b0319811681146119e657600080fd5b60008083601f840112611a14578182fd5b50813567ffffffffffffffff811115611a2b578182fd5b602083019150836020828501011115611a4357600080fd5b9250929050565b600060208284031215611a5b578081fd5b61039d826119cf565b600080600080600060608688031215611a7b578081fd5b853567ffffffffffffffff80821115611a92578283fd5b818801915088601f830112611aa5578283fd5b813581811115611ab3578384fd5b8960208260051b8501011115611ac7578384fd5b60208301975080965050611add602089016119cf565b94506040880135915080821115611af2578283fd5b50611aff88828901611a03565b969995985093965092949392505050565b600060208284031215611b21578081fd5b61039d826119eb565b6000815180845260208085019450808401835b83811015611b635781516001600160e01b03191687529582019590820190600101611b3d565b509495945050505050565b60008151808452611b86816020860160208601611f7f565b601f01601f19169290920160200192915050565b60008251611bac818460208701611f7f565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b81811015611bf75783516001600160a01b031683529284019291840191600101611bd2565b50909695505050505050565b60208152600061039d6020830184611b2a565b6000606080830181845280875180835260808601915060808160051b87010192506020808a01865b83811015611cad57888603607f19018552815180516001600160a01b031687528381015160038110611c7e57634e487b7160e01b8a52602160045260248afd5b87850152604090810151908701889052611c9a88880182611b2a565b9650509382019390820190600101611c3e565b50506001600160a01b0389169087015250508381036040850152611cd18186611b6e565b979650505050505050565b60006020808301818452808551808352604092508286019150828160051b870101848801865b83811015611d4a57888303603f19018552815180516001600160a01b03168452870151878401879052611d3787850182611b2a565b9588019593505090860190600101611d02565b509098975050505050505050565b6020808252601d908201527f4f776e61626c653a2073656e646572206d757374206265206f776e6572000000604082015260600190565b60208082526022908201527f4469616d6f6e64426173653a2073656c6563746f7220697320696d6d757461626040820152616c6560f01b606082015260800190565b6040516060810167ffffffffffffffff81118282101715611df457611df4612000565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611e2357611e23612000565b604052919050565b600067ffffffffffffffff821115611e4557611e45612000565b5060051b60200190565b6000611e62611e5d84611e2b565b611dfa565b838152602080820191908460053688821b83011115611e7f578586fd5b855b88811015611f7257823567ffffffffffffffff80821115611ea0578889fd5b818a01915060608236031215611eb4578889fd5b611ebc611dd1565b611ec5836119cf565b81528683013560038110611ed7578a8bfd5b8188015260408381013583811115611eed578b8cfd5b939093019236601f850112611f00578a8bfd5b83359250611f10611e5d84611e2b565b83815288810190858a0136868a1b88018c011115611f2c578d8efd5b8d96505b85871015611f5557611f41816119eb565b835260019690960195918a01918a01611f30565b509183019190915250885250509483019491830191600101611e81565b5092979650505050505050565b60005b83811015611f9a578181015183820152602001611f82565b83811115611fa9576000848401525b50505050565b6000600019821415611fc357611fc3611fea565b5060010190565b600060ff821660ff811415611fe157611fe1611fea565b60010192915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe24aa1f7b31fd188a8d3ecfb06bc55c806040e59b03bd4396283442fce6617890a2646970667358221220bd930cfc7d47142cc2e541ff334e3933cf9ac9bb977638c6f6fa5e9e5423037a64736f6c634300080400334469616d6f6e64426173653a2073656c6563746f7220697320696d6d75746162

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.