ETH Price: $2,487.35 (+7.71%)

Contract

0xEC3e38e536AD4fA55a378B14B257976148b618aC
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040143800762022-03-13 19:08:57920 days ago1647198537IN
 Create: CyberBrokersMetadataWrapper
0 ETH0.1125312859.65658165

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CyberBrokersMetadataWrapper

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 8 : CyberBrokersMetadataWrapper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/Strings.sol";

import "./ContractDataStorage.sol";
import "./SvgParser.sol";
import "./CyberBrokersMetadata.sol";

interface ICyberBrokersMetadata {
  struct CyberBrokerLayer {
    string key;
    string attributeName;
    string attributeValue;
  }

  struct CyberBrokerTalent {
    string talent;
    string species;
    string class;
    string description;
  }
}

contract CyberBrokersMetadataWrapper is ICyberBrokersMetadata {
  using Strings for uint256;

  // Storage contract, point back to all broker DNA, layers, and talents
  CyberBrokersMetadata public metadataStorageContract;

  constructor(
    address _metadataStorageContract
  ) {
    metadataStorageContract = CyberBrokersMetadata(_metadataStorageContract);
  }

  function layerMap(uint256 layerId) public view returns (CyberBrokerLayer memory) {
    (string memory key, string memory attributeName, string memory attributeValue) = metadataStorageContract.layerMap(layerId);
    return CyberBrokerLayer(key, attributeName, attributeValue);
  }

  function talentMap(uint256 talentId) public view returns (CyberBrokerTalent memory) {
    (string memory talent, string memory species, string memory class, string memory description) = metadataStorageContract.talentMap(talentId);
    return CyberBrokerTalent(talent, species, class, description);
  }

  function brokerDna(uint256 tokenId) public view returns (uint256) {
    return metadataStorageContract.brokerDna(tokenId);
  }

  // Bitwise constants
  uint256 constant private BROKER_MIND_DNA_POSITION = 0;
  uint256 constant private BROKER_BODY_DNA_POSITION = 5;
  uint256 constant private BROKER_SOUL_DNA_POSITION = 10;
  uint256 constant private BROKER_TALENT_DNA_POSITION = 15;
  uint256 constant private BROKER_LAYER_COUNT_DNA_POSITION = 21;
  uint256 constant private BROKER_LAYERS_DNA_POSITION = 26;

  uint256 constant private BROKER_LAYERS_DNA_SIZE = 12;

  uint256 constant private BROKER_MIND_DNA_BITMASK = uint256(0x1F);
  uint256 constant private BROKER_BODY_DNA_BITMASK = uint256(0x1F);
  uint256 constant private BROKER_SOUL_DNA_BITMASK = uint256(0x1F);
  uint256 constant private BROKER_TALENT_DNA_BITMASK = uint256(0x3F);
  uint256 constant private BROKER_LAYER_COUNT_DNA_BITMASK = uint256(0x1F);
  uint256 constant private BROKER_LAYER_DNA_BITMASK = uint256(0x0FFF);

  // Contracts
  function contractDataStorage() public view returns (ContractDataStorage) {
    return metadataStorageContract.contractDataStorage();
  }

  function svgParser() public view returns (SvgParser) {
    return metadataStorageContract.svgParser();
  }

  /**
   * On-Chain Metadata Construction
   **/

  // REQUIRED for token contract
  function hasOnchainMetadata(uint256 tokenId) public view returns (bool) {
    return metadataStorageContract.hasOnchainMetadata(tokenId);
  }

  // REQUIRED for token contract
  function tokenURI(uint256 tokenId) public view returns (string memory) {
    require(tokenId <= 10000, "Invalid tokenId");

    // Unpack the name, talent and layers
    string memory name = metadataStorageContract.getBrokerName(tokenId);

    return string(
        abi.encodePacked(
            abi.encodePacked(
                bytes('data:application/json;utf8,{"name":"'),
                name,
                bytes('","description":"'),
                getDescription(tokenId),
                bytes('","external_url":"'),
                metadataStorageContract.getExternalUrl(tokenId),
                bytes('","image":"'),
                metadataStorageContract.getImageCache(tokenId)
            ),
            abi.encodePacked(
                bytes('","attributes":['),
                getTalentAttributes(tokenId),
                metadataStorageContract.getStatAttributes(tokenId),
                metadataStorageContract.getLayerAttributes(tokenId),
                bytes(']}')
            )
        )
    );
  }

  function getBrokerName(uint256 _tokenId) public view returns (string memory) {
    return metadataStorageContract.getBrokerName(_tokenId);
  }

  function getLayers(uint256 tokenId) public view returns (uint256[] memory) {
    require(tokenId <= 10000, "Invalid tokenId");

    // Get the broker DNA -> layers
    uint256 dna = brokerDna(tokenId);
    require(dna > 0, "Broker DNA missing for token");

    uint256 layerCount = (dna >> BROKER_LAYER_COUNT_DNA_POSITION) & BROKER_LAYER_COUNT_DNA_BITMASK;
    uint256[] memory layers = new uint256[](layerCount);
    for (uint256 layerIdx; layerIdx < layerCount; layerIdx++) {
      layers[layerIdx] = (dna >> (BROKER_LAYERS_DNA_SIZE * layerIdx + BROKER_LAYERS_DNA_POSITION)) & BROKER_LAYER_DNA_BITMASK;
    }
    return layers;
  }

  function getDescription(uint256 tokenId) public view returns (string memory) {
    CyberBrokerTalent memory talent = getTalent(tokenId);
    return talent.description;
  }

  function getExternalUrl(uint256 tokenId) public view returns (string memory) {
    return metadataStorageContract.getExternalUrl(tokenId);
  }

  function getImageCache(uint256 tokenId) public view returns (string memory) {
    return metadataStorageContract.getImageCache(tokenId);
  }

  function getTalentAttributes(uint256 tokenId) public view returns (string memory) {
    CyberBrokerTalent memory talent = getTalent(tokenId);

    return string(
      abi.encodePacked(
        abi.encodePacked(
          bytes('{"trait_type": "Talent", "value": "'),
          talent.talent,
          bytes('"},{"trait_type": "Species", "value": "'),
          talent.species
        ),
        abi.encodePacked(
          bytes('"},{"trait_type": "Class", "value": "'),
          talent.class,
          bytes('"},')
        )
      )
    );
  }

  function getTalent(uint256 tokenId) public view returns (CyberBrokerTalent memory) {
    require(tokenId <= 10000, "Invalid tokenId");

    // Get the broker DNA
    uint256 dna = brokerDna(tokenId);
    require(dna > 0, "Broker DNA missing for token");

    // Get the talent
    uint256 talentIndex = (dna >> BROKER_TALENT_DNA_POSITION) & BROKER_TALENT_DNA_BITMASK;

    require(talentIndex < 1460, "Invalid talent index");

    return talentMap(talentIndex);
  }

  function getStats(uint256 tokenId) public view returns (uint256 mind, uint256 body, uint256 soul) {
    return metadataStorageContract.getStats(tokenId);
  }

  function getStatAttributes(uint256 tokenId) public view returns (string memory) {
    return metadataStorageContract.getStatAttributes(tokenId);
  }

  function getLayerAttributes(uint256 tokenId) public view returns (string memory) {
    // Get the layersg
    uint256[] memory layers = getLayers(tokenId);

    // Get the attribute names for all layers
    CyberBrokerLayer[] memory attrLayers = new CyberBrokerLayer[](layers.length);

    uint256 maxAttrLayerIdx = 0;
    for (uint16 layerIdx; layerIdx < layers.length; layerIdx++) {
      CyberBrokerLayer memory attribute = layerMap(layers[layerIdx]);

      if (keccak256(abi.encodePacked(attribute.attributeValue)) != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470) {
        attrLayers[maxAttrLayerIdx++] = attribute;
      }
    }

    // Compile the attributes
    string memory attributes = "";
    for (uint16 attrIdx; attrIdx < maxAttrLayerIdx; attrIdx++) {
      attributes = string(
        abi.encodePacked(
          attributes,
          bytes(',{"trait_type": "'),
          attrLayers[attrIdx].attributeName,
          bytes('", "value": "'),
          attrLayers[attrIdx].attributeValue,
          bytes('"}')
        )
      );
    }

    return attributes;
  }


  /**
   * On-Chain Token SVG Rendering
   **/

  // REQUIRED for token contract
  function render(
    uint256 tokenId
  )
    public
    view
    returns (string memory)
  {
    return metadataStorageContract.render(tokenId);
  }

  function renderData(
    string memory _key,
    uint256 _startIndex
  )
    public
    view
    returns (
      string memory,
      uint256
    )
  {
    return metadataStorageContract.renderData(_key, _startIndex);
  }

  function _renderData(
    string memory _key,
    uint256 _startIndex,
    uint256 _thresholdCounter
  )
    public
    view
    returns (
      string memory,
      uint256
    )
  {
    return metadataStorageContract._renderData(_key, _startIndex, _thresholdCounter);
  }

  function renderBroker(
    uint256 _tokenId,
    uint256 _startIndex
  )
    public
    view
    returns (
      string memory,
      uint256
    )
  {
    return metadataStorageContract.renderBroker(_tokenId, _startIndex);
  }

  function _renderBroker(
    uint256 _tokenId,
    uint256 _startIndex,
    uint256 _thresholdCounter
  )
    public
    view
    returns (
      string memory,
      uint256
    )
  {
    return metadataStorageContract._renderBroker(_tokenId, _startIndex, _thresholdCounter);
  }


  /**
   * Off-Chain Token SVG Rendering
   **/

  function getTokenData(uint256 _tokenId)
    public
    view
    returns (bytes memory)
  {
    uint256[] memory layerNumbers = getLayers(_tokenId);

    string[] memory layers = new string[](layerNumbers.length);
    for (uint256 layerIdx; layerIdx < layerNumbers.length; layerIdx++) {
      string memory key = layerMap(layerNumbers[layerIdx]).key;
      require(contractDataStorage().hasKey(key), "Key does not exist in contract data storage");
      layers[layerIdx] = key;
    }

    return contractDataStorage().getDataForAll(layers);
  }

  function getOffchainSvgParser()
    public
    view
    returns (
      string memory _output
    )
  {
    return metadataStorageContract.getOffchainSvgParser();
  }


  /**
   * Leaving all setters out of this contract
   **/
  /*

  function setContractDataStorageAddress(address _contractDataStorageAddress) public onlyOwner {
    metadataStorageContract.setContractDataStorageAddress(_contractDataStorageAddress);
  }

  function setSvgParserAddress(address _svgParserAddress) public onlyOwner {
    metadataStorageContract.setSvgParserAddress(_svgParserAddress);
  }

  function setLayers(
    uint256[] memory indexes,
    string[]  memory keys,
    string[]  memory attributeNames,
    string[]  memory attributeValues
  )
    public
    onlyOwner
  {
    metadataStorageContract.setLayers(indexes, keys, attributeNames, attributeValues);
  }

  function setTalents(
    uint256[] memory indexes,
    string[]  memory talent,
    string[]  memory species,
    string[]  memory class,
    string[]  memory description
  )
    public
    onlyOwner
  {
    metadataStorageContract.setTalents(indexes, talent, species, class, description);
  }

  function setBrokers(
    uint256[]  memory indexes,
    uint8[]    memory talent,
    uint8[]    memory mind,
    uint8[]    memory body,
    uint8[]    memory soul,
    uint16[][] memory layers
  )
    public
    onlyOwner
  {
    metadataStorageContract.setBrokers(indexes, talent, mind, body, soul, layers);
  }

  function setOnChainMetadata(bool _state) public onlyOwner {
    metadataStorageContract.setOnChainMetadata(_state);
  }

  function setExternalUri(string calldata _uri) public onlyOwner {
    metadataStorageContract.setExternalUri(_uri);
  }

  function setUseIndividualExternalUri(bool _setting) public onlyOwner {
    metadataStorageContract.setUseIndividualExternalUri(_setting);
  }

  function setImageCacheUri(string calldata _uri) public onlyOwner {
    metadataStorageContract.setImageCacheUri(_uri);
  }
  */

}

File 2 of 8 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(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);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 3 of 8 : ContractDataStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";

/**
 * Explaining the `init` variable within saveData:
 *
 * 61_00_00 -- PUSH2 (size)
 * 60_00 -- PUSH1 (code position)
 * 60_00 -- PUSH1 (mem position)
 * 39 CODECOPY
 * 61_00_00 PUSH2 (size)
 * 60_00 PUSH1 (mem position)
 * f3 RETURN
 *
 **/

contract ContractDataStorage is Ownable {

  struct ContractData {
    address rawContract;
    uint128 size;
    uint128 offset;
  }

  struct ContractDataPages {
    uint256 maxPageNumber;
    bool exists;
    mapping (uint256 => ContractData) pages;
  }

  mapping (string => ContractDataPages) internal _contractDataPages;

  mapping (address => bool) internal _controllers;

  constructor() {
    updateController(_msgSender(), true);
  }

  /**
   * Access Control
   **/
  function updateController(address _controller, bool _status) public onlyOwner {
    _controllers[_controller] = _status;
  }

  modifier onlyController() {
    require(_controllers[_msgSender()], "ContractDataStorage: caller is not a controller");
    _;
  }

  /**
   * Storage & Revocation
   **/

  function saveData(
    string memory _key,
    uint128 _pageNumber,
    bytes memory _b
  )
    public
    onlyController
  {
    require(_b.length < 24576, "SvgStorage: Exceeded 24,576 bytes max contract size");

    // Create the header for the contract data
    bytes memory init = hex"610000_600e_6000_39_610000_6000_f3";
    bytes1 size1 = bytes1(uint8(_b.length));
    bytes1 size2 = bytes1(uint8(_b.length >> 8));
    init[2] = size1;
    init[1] = size2;
    init[10] = size1;
    init[9] = size2;

    // Prepare the code for storage in a contract
    bytes memory code = abi.encodePacked(init, _b);

    // Create the contract
    address dataContract;
    assembly {
      dataContract := create(0, add(code, 32), mload(code))
      if eq(dataContract, 0) {
        returndatacopy(0, 0, returndatasize())
        revert(0, returndatasize())
      }
    }

    // Store the record of the contract
    saveDataForDeployedContract(
      _key,
      _pageNumber,
      dataContract,
      uint128(_b.length),
      0
    );
  }

  function saveDataForDeployedContract(
    string memory _key,
    uint256 _pageNumber,
    address dataContract,
    uint128 _size,
    uint128 _offset
  )
    public
    onlyController
  {
    // Pull the current data for the contractData
    ContractDataPages storage _cdPages = _contractDataPages[_key];

    // Store the maximum page
    if (_cdPages.maxPageNumber < _pageNumber) {
      _cdPages.maxPageNumber = _pageNumber;
    }

    // Keep track of the existance of this key
    _cdPages.exists = true;

    // Add the page to the location needed
    _cdPages.pages[_pageNumber] = ContractData(
      dataContract,
      _size,
      _offset
    );
  }

  function revokeContractData(
    string memory _key
  )
    public
    onlyController
  {
    delete _contractDataPages[_key];
  }

  function getSizeOfPages(
    string memory _key
  )
    public
    view
    returns (uint256)
  {
    // For all data within the contract data pages, iterate over and compile them
    ContractDataPages storage _cdPages = _contractDataPages[_key];

    // Determine the total size
    uint256 totalSize;
    for (uint256 idx; idx <= _cdPages.maxPageNumber; idx++) {
      totalSize += _cdPages.pages[idx].size;
    }

    return totalSize;
  }

  function getData(
    string memory _key
  )
    public
    view
    returns (bytes memory)
  {
    // Get the total size
    uint256 totalSize = getSizeOfPages(_key);

    // Create a region large enough for all of the data
    bytes memory _totalData = new bytes(totalSize);

    // Retrieve the pages
    ContractDataPages storage _cdPages = _contractDataPages[_key];

    // For each page, pull and compile
    uint256 currentPointer = 32;
    for (uint256 idx; idx <= _cdPages.maxPageNumber; idx++) {
      ContractData storage dataPage = _cdPages.pages[idx];
      address dataContract = dataPage.rawContract;
      uint256 size = uint256(dataPage.size);
      uint256 offset = uint256(dataPage.offset);

      // Copy directly to total data
      assembly {
        extcodecopy(dataContract, add(_totalData, currentPointer), offset, size)
      }

      // Update the current pointer
      currentPointer += size;
    }

    return _totalData;
  }

  function getDataForAll(string[] memory _keys)
    public
    view
    returns (bytes memory)
  {
    // Get the total size of all of the keys
    uint256 totalSize;
    for (uint256 idx; idx < _keys.length; idx++) {
      totalSize += getSizeOfPages(_keys[idx]);
    }

    // Create a region large enough for all of the data
    bytes memory _totalData = new bytes(totalSize);

    // For each key, pull down all data
    uint256 currentPointer = 32;
    for (uint256 idx; idx < _keys.length; idx++) {
      // Retrieve the set of pages
      ContractDataPages storage _cdPages = _contractDataPages[_keys[idx]];

      // For each page, pull and compile
      for (uint256 innerIdx; innerIdx <= _cdPages.maxPageNumber; innerIdx++) {
        ContractData storage dataPage = _cdPages.pages[innerIdx];
        address dataContract = dataPage.rawContract;
        uint256 size = uint256(dataPage.size);
        uint256 offset = uint256(dataPage.offset);

        // Copy directly to total data
        assembly {
          extcodecopy(dataContract, add(_totalData, currentPointer), offset, size)
        }

        // Update the current pointer
        currentPointer += size;
      }
    }

    return _totalData;
  }

  function hasKey(string memory _key)
    public
    view
    returns (bool)
  {
    return _contractDataPages[_key].exists;
  }

}

File 4 of 8 : SvgParser.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./Utils.sol";

contract SvgParser {

    // Limits
    uint256 constant DEFAULT_THRESHOLD_COUNTER = 2800;

    // Bits & Masks
    bytes1 constant tagBit            = bytes1(0x80);
    bytes1 constant startTagBit       = bytes1(0x40);
    bytes1 constant tagTypeMask       = bytes1(0x3F);
    bytes1 constant attributeTypeMask = bytes1(0x7F);

    bytes1 constant dCommandBit       = bytes1(0x80);
    bytes1 constant percentageBit     = bytes1(0x40);
    bytes1 constant negativeBit       = bytes1(0x20);
    bytes1 constant decimalBit        = bytes1(0x10);

    bytes1 constant numberMask        = bytes1(0x0F);

    bytes1 constant filterInIdBit     = bytes1(0x80);

    bytes1 constant filterInIdMask    = bytes1(0x7F);

    // SVG tags
    bytes constant SVG_OPEN_TAG = bytes('<?xml version="1.0" encoding="UTF-8"?><svg width="1320px" height="1760px" viewBox="0 0 1320 1760" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">');
    bytes constant SVG_CLOSE_TAG = bytes("</svg>");

    bytes[25] TAGS = [
        bytes("g"),
        bytes("polygon"),
        bytes("path"),
        bytes("circle"),
        bytes("defs"),
        bytes("linearGradient"),
        bytes("stop"),
        bytes("rect"),
        bytes("polyline"),
        bytes("text"),
        bytes("tspan"),
        bytes("mask"),
        bytes("use"),
        bytes("ellipse"),
        bytes("radialGradient"),
        bytes("filter"),
        bytes("feColorMatrix"),
        bytes("feComposite"),
        bytes("feGaussianBlur"),
        bytes("feMorphology"),
        bytes("feOffset"),
        bytes("pattern"),
        bytes("feMergeNode"),
        bytes("feMerge"),
        bytes("INVALIDTAG")
    ];

    bytes[54] ATTRIBUTES = [
        bytes("d"),
        bytes("points"),
        bytes("transform"),
        bytes("cx"),
        bytes("cy"),
        bytes("r"),
        bytes("stroke"),
        bytes("stroke-width"),
        bytes("fill"),
        bytes("fill-opacity"),
        bytes("translate"),
        bytes("rotate"),
        bytes("scale"),
        bytes("x1"),
        bytes("y1"),
        bytes("x2"),
        bytes("y2"),
        bytes("stop-color"),
        bytes("offset"),
        bytes("stop-opacity"),
        bytes("width"),
        bytes("height"),
        bytes("x"),
        bytes("y"),
        bytes("font-size"),
        bytes("letter-spacing"),
        bytes("opacity"),
        bytes("id"),
        bytes("xlink:href"),
        bytes("rx"),
        bytes("ry"),
        bytes("mask"),
        bytes("fx"),
        bytes("fy"),
        bytes("gradientTransform"),
        bytes("filter"),
        bytes("filterUnits"),
        bytes("result"),
        bytes("in"),
        bytes("in2"),
        bytes("type"),
        bytes("values"),
        bytes("operator"),
        bytes("k1"),
        bytes("k2"),
        bytes("k3"),
        bytes("k4"),
        bytes("stdDeviation"),
        bytes("edgeMode"),
        bytes("radius"),
        bytes("fill-rule"),
        bytes("dx"),
        bytes("dy"),
        bytes("INVALIDATTRIBUTE")
    ];

    bytes[2] PAIR_NUMBER_SET_ATTRIBUTES = [
        bytes("translate"),
        bytes("scale")
    ];

    bytes[4] PAIR_COLOR_ATTRIBUTES = [
        bytes("stroke"),
        bytes("fill"),
        bytes("stop-color"),
        bytes("mask")
    ];

    bytes[23] SINGLE_NUMBER_SET_ATTRIBUTES = [
        bytes("cx"),
        bytes("cy"),
        bytes("r"),
        bytes("rotate"),
        bytes("x1"),
        bytes("y1"),
        bytes("x2"),
        bytes("y2"),
        bytes("offset"),
        bytes("x"),
        bytes("y"),
        bytes("rx"),
        bytes("ry"),
        bytes("fx"),
        bytes("fy"),
        bytes("font-size"),
        bytes("letter-spacing"),
        bytes("stroke-width"),
        bytes("width"),
        bytes("height"),
        bytes("fill-opacity"),
        bytes("stop-opacity"),
        bytes("opacity")
    ];

    bytes[20] D_COMMANDS = [
        bytes("M"),
        bytes("m"),
        bytes("L"),
        bytes("l"),
        bytes("H"),
        bytes("h"),
        bytes("V"),
        bytes("v"),
        bytes("C"),
        bytes("c"),
        bytes("S"),
        bytes("s"),
        bytes("Q"),
        bytes("q"),
        bytes("T"),
        bytes("t"),
        bytes("A"),
        bytes("a"),
        bytes("Z"),
        bytes("z")
    ];

    bytes[2] FILL_RULE = [
        bytes("nonzero"),
        bytes("evenodd")
    ];

    bytes[2] FILTER_UNIT = [
        bytes("userSpaceOnUse"),
        bytes("objectBoundingBox")
    ];

    bytes[6] FILTER_IN = [
        bytes("SourceGraphic"),
        bytes("SourceAlpha"),
        bytes("BackgroundImage"),
        bytes("BackgroundAlpha"),
        bytes("FillPaint"),
        bytes("StrokePaint")
    ];

    bytes[16] FILTER_TYPE = [
        bytes("translate"),
        bytes("scale"),
        bytes("rotate"),
        bytes("skewX"),
        bytes("skewY"),
        bytes("matrix"),
        bytes("saturate"),
        bytes("hueRotate"),
        bytes("luminanceToAlpha"),
        bytes("identity"),
        bytes("table"),
        bytes("discrete"),
        bytes("linear"),
        bytes("gamma"),
        bytes("fractalNoise"),
        bytes("turbulence")
    ];

    bytes[9] FILTER_OPERATOR = [
        bytes("over"),
        bytes("in"),
        bytes("out"),
        bytes("atop"),
        bytes("xor"),
        bytes("lighter"),
        bytes("arithmetic"),
        bytes("erode"),
        bytes("dilate")
    ];

    bytes[3] FILTER_EDGEMODE = [
        bytes("duplicate"),
        bytes("wrap"),
        bytes("none")
    ];


    function checkTag(bytes1 line) internal pure returns (bool) {
        return line & tagBit > 0;
    }

    function checkStartTag(bytes1 line) internal pure returns (bool) {
        return line & startTagBit > 0;
    }

    function getTag(bytes1 line) internal view returns (bytes memory) {
        uint8 key = uint8(line & tagTypeMask);

        if (key >= TAGS.length - 1) {
            return TAGS[TAGS.length - 1];
        }

        return TAGS[key];
    }

    function getAttribute(bytes1 line) internal view returns (bytes memory) {
        uint8 key = uint8(line & attributeTypeMask);

        if (key >= ATTRIBUTES.length - 1) {
            return ATTRIBUTES[ATTRIBUTES.length - 1];
        }

        return ATTRIBUTES[key];
    }

    function compareAttrib(bytes memory attrib, string memory compareTo) internal pure returns (bool) {
        return keccak256(attrib) == keccak256(bytes(compareTo));
    }

    function compareAttrib(bytes memory attrib, bytes storage compareTo) internal pure returns (bool) {
        return keccak256(attrib) == keccak256(compareTo);
    }

    function addOutput(bytes memory _output, uint256 _outputIdx, bytes memory _addendum) internal pure returns (uint256) {
        for (uint256 _idx; _idx < _addendum.length; _idx++) {
            _output[_outputIdx++] = _addendum[_idx];
        }
        return _outputIdx;
    }

    function addOutput(bytes memory _output, uint256 _outputIdx, bytes memory _addendum1, bytes memory _addendum2)
        internal pure returns (uint256)
    {
        return addOutput(_output, addOutput(_output, _outputIdx, _addendum1), _addendum2);
    }

    function addOutput(bytes memory _output, uint256 _outputIdx, bytes memory _addendum1, bytes memory _addendum2, bytes memory _addendum3)
        internal pure returns (uint256)
    {
        return addOutput(_output, addOutput(_output, addOutput(_output, _outputIdx, _addendum1), _addendum2), _addendum3);
    }

    function addOutput(bytes memory _output, uint256 _outputIdx, bytes memory _addendum1, bytes memory _addendum2, bytes memory _addendum3, bytes memory _addendum4)
        internal pure returns (uint256)
    {
        return addOutput(_output, addOutput(_output, addOutput(_output, addOutput(_output, _outputIdx, _addendum1), _addendum2), _addendum3), _addendum4);
    }

    function parse(bytes memory input, uint256 idx) public view returns (string memory, uint256) {
        return parse(input, idx, DEFAULT_THRESHOLD_COUNTER);
    }

    function parse(bytes memory input, uint256 idx, uint256 thresholdCounter) public view returns (string memory, uint256) {
        // Keep track of what we're returning
        bytes memory output = new bytes(thresholdCounter * 15); // Plenty of padding
        uint256 outputIdx = 0;

        bool isTagOpen = false;
        uint256 counter = idx;

        // Start the output with SVG tags if needed
        if (idx == 0) {
            outputIdx = addOutput(output, outputIdx, SVG_OPEN_TAG);
        }

        // Go through all bytes we want to review
        while (idx < input.length)
        {
            // Get the current byte
            bytes1 _b = bytes1(input[idx]);

            // If this is a tag, determine if we're creating a new tag
            if (checkTag(_b)) {
                // Close the current tag
                bool closeTag = false;
                if (isTagOpen) {
                    closeTag = true;
                    isTagOpen = false;

                    if ((idx - counter) >= thresholdCounter) {
                        outputIdx = addOutput(output, outputIdx, bytes(">"));
                        break;
                    }
                }

                // Start the next tag
                if (checkStartTag(_b)) {
                    isTagOpen = true;

                    if (closeTag) {
                        outputIdx = addOutput(output, outputIdx, bytes("><"), getTag(_b));
                    } else {
                        outputIdx = addOutput(output, outputIdx, bytes("<"), getTag(_b));
                    }
                } else {
                    // If needed, open and close an end tag
                    if (closeTag) {
                        outputIdx = addOutput(output, outputIdx, bytes("></"), getTag(_b), bytes(">"));
                    } else {
                        outputIdx = addOutput(output, outputIdx, bytes("</"), getTag(_b), bytes(">"));
                    }
                }
            }
            else
            {
                // Attributes
                bytes memory attrib = getAttribute(_b);

                if (compareAttrib(attrib, "transform") || compareAttrib(attrib, "gradientTransform")) {
                    // Keep track of which transform we're doing
                    bool isGradientTransform = compareAttrib(attrib, "gradientTransform");

                    // Get the next byte & attribute
                    idx += 2;
                    _b = bytes1(input[idx]);
                    attrib = getAttribute(_b);

                    outputIdx = addOutput(output, outputIdx, bytes(" "), isGradientTransform ? bytes('gradientTransform="') : bytes('transform="'));
                    while (compareAttrib(attrib, 'translate') || compareAttrib(attrib, 'rotate') || compareAttrib(attrib, 'scale')) {
                        outputIdx = addOutput(output, outputIdx, bytes(" "));
                        (idx, outputIdx) = parseAttributeValues(output, outputIdx, attrib, input, idx);

                        // Get the next byte & attribute
                        idx += 2;
                        _b = bytes1(input[idx]);
                        attrib = getAttribute(_b);
                    }

                    outputIdx = addOutput(output, outputIdx, bytes('"'));

                    // Undo the previous index increment
                    idx -= 2;
                }
                else if (compareAttrib(attrib, "d")) {
                    (idx, outputIdx) = packDPoints(output, outputIdx, input, idx);
                }
                else if (compareAttrib(attrib, "points"))
                {
                    (idx, outputIdx) = packPoints(output, outputIdx, input, idx, bytes(' points="'));
                }
                else if (compareAttrib(attrib, "values"))
                {
                    (idx, outputIdx) = packPoints(output, outputIdx, input, idx, bytes(' values="'));
                }
                else
                {
                    outputIdx = addOutput(output, outputIdx, bytes(" "));
                    (idx, outputIdx) = parseAttributeValues(output, outputIdx, attrib, input, idx);
                }
            }

            idx += 2;
        }

        if (idx >= input.length) {
            // Close out the SVG tags
            outputIdx = addOutput(output, outputIdx, SVG_CLOSE_TAG);
            idx = 0;
        }

        // Pack everything down to the size that actually fits
        bytes memory finalOutput = new bytes(outputIdx);
        for (uint256 _idx; _idx < outputIdx; _idx++) {
            finalOutput[_idx] = output[_idx];
        }

        return (string(finalOutput), idx);
    }

    function packDPoints(bytes memory output, uint256 outputIdx, bytes memory input, uint256 idx) internal view returns (uint256, uint256) {
        outputIdx = addOutput(output, outputIdx, bytes(' d="'));

        // Due to the open-ended nature of points, we concat directly to local_output
        idx += 2;
        uint256 count = uint256(uint8(input[idx + 1])) * 2**8 + uint256(uint8(input[idx]));
        for (uint256 countIdx = 0; countIdx < count; countIdx++) {
            idx += 2;

            // Add the d command prior to any bits
            if (uint8(input[idx + 1] & dCommandBit) > 0) {
                outputIdx = addOutput(output, outputIdx, bytes(" "), D_COMMANDS[uint8(input[idx])]);
            }
            else
            {
                countIdx++;
                outputIdx = addOutput(output, outputIdx, bytes(" "), parseNumberSetValues(input[idx], input[idx + 1]), bytes(","), parseNumberSetValues(input[idx + 2], input[idx + 3]));
                idx += 2;
            }
        }

        outputIdx = addOutput(output, outputIdx, bytes('"'));

        return (idx, outputIdx);
    }

    function packPoints(bytes memory output, uint256 outputIdx, bytes memory input, uint256 idx, bytes memory attributePreface) internal view returns (uint256, uint256) {
        outputIdx = addOutput(output, outputIdx, attributePreface);

        // Due to the open-ended nature of points, we concat directly to local_output
        idx += 2;
        uint256 count = uint256(uint8(input[idx + 1])) * 2**8 + uint256(uint8(input[idx]));
        for (uint256 countIdx = 0; countIdx < count; countIdx++) {
            idx += 2;
            bytes memory numberSet = parseNumberSetValues(input[idx], input[idx + 1]);

            if (countIdx > 0) {
                outputIdx = addOutput(output, outputIdx, bytes(" "), numberSet);
            } else {
                outputIdx = addOutput(output, outputIdx, numberSet);
            }
        }

        outputIdx = addOutput(output, outputIdx, bytes('"'));

        return (idx, outputIdx);
    }

    function parseAttributeValues(
        bytes memory output,
        uint256 outputIdx,
        bytes memory attrib,
        bytes memory input,
        uint256 idx
    )
        internal
        view
        returns (uint256, uint256)
    {
        // Handled in main function
        if (compareAttrib(attrib, "d") || compareAttrib(attrib, "points") || compareAttrib(attrib, "values") || compareAttrib(attrib, 'transform')) {
            return (idx + 2, outputIdx);
        }

        if (compareAttrib(attrib, 'id') || compareAttrib(attrib, 'xlink:href') || compareAttrib(attrib, 'filter') || compareAttrib(attrib, 'result'))
        {
            bytes memory number = Utils.uint2bytes(
                uint256(uint8(input[idx + 2])) * 2**16 +
                uint256(uint8(input[idx + 5])) * 2**8 +
                uint256(uint8(input[idx + 4]))
            );

            if (compareAttrib(attrib, 'xlink:href')) {
                outputIdx = addOutput(output, outputIdx, attrib, bytes('="#id-'), number, bytes('"'));
            } else if (compareAttrib(attrib, 'filter')) {
                outputIdx = addOutput(output, outputIdx, attrib, bytes('="url(#id-'), number, bytes(')"'));
            } else {
                outputIdx = addOutput(output, outputIdx, attrib, bytes('="id-'), number, bytes('"'));
            }

            return (idx + 4, outputIdx);
        }

        for (uint256 attribIdx = 0; attribIdx < PAIR_NUMBER_SET_ATTRIBUTES.length; attribIdx++) {
            if (compareAttrib(attrib, PAIR_NUMBER_SET_ATTRIBUTES[attribIdx])) {
                outputIdx = addOutput(output, outputIdx, attrib, bytes('('), parseNumberSetValues(input[idx + 2], input[idx + 3]), bytes(','));
                outputIdx = addOutput(output, outputIdx, parseNumberSetValues(input[idx + 4], input[idx + 5]), bytes(')'));
                return (idx + 4, outputIdx);
            }
        }

        for (uint256 attribIdx = 0; attribIdx < PAIR_COLOR_ATTRIBUTES.length; attribIdx++) {
            if (compareAttrib(attrib, PAIR_COLOR_ATTRIBUTES[attribIdx])) {
                outputIdx = addOutput(output, outputIdx, attrib, bytes('="'), parseColorValues(input[idx + 2], input[idx + 3], input[idx + 4], input[idx + 5]), bytes('"'));
                return (idx + 4, outputIdx);
            }
        }

        if (compareAttrib(attrib, 'rotate')) {
            // Default, single number set values
            outputIdx = addOutput(output, outputIdx, attrib, bytes('('), parseNumberSetValues(input[idx + 2], input[idx + 3]), bytes(')'));
            return (idx + 2, outputIdx);
        }

        // Dictionary lookups
        if (compareAttrib(attrib, 'in') || compareAttrib(attrib, 'in2')) {
            // Special case for the dictionary lookup for in & in2 => allow for ID lookup
            if (uint8(input[idx + 3] & filterInIdBit) > 0) {
                bytes memory number = Utils.uint2bytes(
                    uint256(uint8(input[idx + 2] & filterInIdMask)) * 2**16 +
                    uint256(uint8(input[idx + 5] & filterInIdMask)) * 2**8 +
                    uint256(uint8(input[idx + 4]))
                );

                outputIdx = addOutput(output, outputIdx, attrib, bytes('="id-'), number, bytes('"'));
            } else {
                outputIdx = addOutput(output, outputIdx, attrib, bytes('="'), FILTER_IN[uint8(input[idx + 2])], bytes('"'));
            }

            return (idx + 4, outputIdx);
        } else if (compareAttrib(attrib, 'type')) {
            outputIdx = addOutput(output, outputIdx, attrib, bytes('="'), FILTER_TYPE[uint8(input[idx + 2])], bytes('"'));
            return (idx + 2, outputIdx);
        } else if (compareAttrib(attrib, 'operator')) {
            outputIdx = addOutput(output, outputIdx, attrib, bytes('="'), FILTER_OPERATOR[uint8(input[idx + 2])], bytes('"'));
            return (idx + 2, outputIdx);
        } else if (compareAttrib(attrib, 'edgeMode')) {
            outputIdx = addOutput(output, outputIdx, attrib, bytes('="'), FILTER_EDGEMODE[uint8(input[idx + 2])], bytes('"'));
            return (idx + 2, outputIdx);
        } else if (compareAttrib(attrib, 'fill-rule')) {
            outputIdx = addOutput(output, outputIdx, attrib, bytes('="'), FILL_RULE[uint8(input[idx + 2])], bytes('"'));
            return (idx + 2, outputIdx);
        } else if (compareAttrib(attrib, 'filterUnits')) {
            outputIdx = addOutput(output, outputIdx, attrib, bytes('="'), FILTER_UNIT[uint8(input[idx + 2])], bytes('"'));
            return (idx + 2, outputIdx);
        }

        // Default, single number set values
        outputIdx = addOutput(output, outputIdx, attrib, bytes('="'), parseNumberSetValues(input[idx + 2], input[idx + 3]), bytes('"'));
        return (idx + 2, outputIdx);
    }

    function parseColorValues(bytes1 one, bytes1 two, bytes1 three, bytes1 four) internal pure returns (bytes memory) {
        if (uint8(two) == 0xFF && uint8(one) == 0 && uint8(four) == 0 && uint8(three) == 0) {
            // None identifier case
            return bytes("none");
        }
        else if (uint8(two) == 0x80)
        {
            // URL identifier case
            bytes memory number = Utils.uint2bytes(
                uint256(uint8(one)) * 2**16 +
                uint256(uint8(four)) * 2**8 +
                uint256(uint8(three))
            );
            return abi.encodePacked("url(#id-", number, ")");
        } else {
            return Utils.unpackHexColorValues(uint8(one), uint8(four), uint8(three));
        }
    }

    function parseNumberSetValues(bytes1 one, bytes1 two) internal pure returns (bytes memory) {
        return Utils.unpackNumberSetValues(
            uint256(uint8(two & numberMask)) * 2**8 + uint256(uint8(one)), // number
            uint8(two & decimalBit) > 0, // decimal
            uint8(two & negativeBit) > 0, // negative
            uint8(two & percentageBit) > 0 // percent
        );
    }

}

File 5 of 8 : CyberBrokersMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "./ContractDataStorage.sol";
import "./SvgParser.sol";

contract CyberBrokersMetadata is Ownable {
  using Strings for uint256;

  bool private _useOnChainMetadata = false;
  bool private _useIndividualExternalUri = false;

  string private _externalUri = "https://cyberbrokers.io/";
  string private _imageCacheUri = "ipfs://QmcsrQJMKA9qC9GcEMgdjb9LPN99iDNAg8aQQJLJGpkHxk/";

  // Mapping of all layers
  struct CyberBrokerLayer {
    string key;
    string attributeName;
    string attributeValue;
  }
  CyberBrokerLayer[1460] public layerMap;

  // Mapping of all talents
  struct CyberBrokerTalent {
    string talent;
    string species;
    string class;
    string description;
  }
  CyberBrokerTalent[51] public talentMap;

  // Directory of Brokers
  uint256[10001] public brokerDna;

  // Bitwise constants
  uint256 constant private BROKER_MIND_DNA_POSITION = 0;
  uint256 constant private BROKER_BODY_DNA_POSITION = 5;
  uint256 constant private BROKER_SOUL_DNA_POSITION = 10;
  uint256 constant private BROKER_TALENT_DNA_POSITION = 15;
  uint256 constant private BROKER_LAYER_COUNT_DNA_POSITION = 21;
  uint256 constant private BROKER_LAYERS_DNA_POSITION = 26;

  uint256 constant private BROKER_LAYERS_DNA_SIZE = 12;

  uint256 constant private BROKER_MIND_DNA_BITMASK = uint256(0x1F);
  uint256 constant private BROKER_BODY_DNA_BITMASK = uint256(0x1F);
  uint256 constant private BROKER_SOUL_DNA_BITMASK = uint256(0x1F);
  uint256 constant private BROKER_TALENT_DNA_BITMASK = uint256(0x2F); // THIS IS WRONG, SHOULD BE 0x3F
  uint256 constant private BROKER_LAYER_COUNT_DNA_BITMASK = uint256(0x1F);
  uint256 constant private BROKER_LAYER_DNA_BITMASK = uint256(0x0FFF);

  // Contracts
  ContractDataStorage public contractDataStorage;
  SvgParser public svgParser;

  constructor(
    address _contractDataStorageAddress,
    address _svgParserAddress
  ) {
    // Set the addresses
    setContractDataStorageAddress(_contractDataStorageAddress);
    setSvgParserAddress(_svgParserAddress);
  }

  function setContractDataStorageAddress(address _contractDataStorageAddress) public onlyOwner {
    contractDataStorage = ContractDataStorage(_contractDataStorageAddress);
  }

  function setSvgParserAddress(address _svgParserAddress) public onlyOwner {
    svgParser = SvgParser(_svgParserAddress);
  }

  /**
   * Save the data on-chain
   **/
  function setLayers(
    uint256[] memory indexes,
    string[]  memory keys,
    string[]  memory attributeNames,
    string[]  memory attributeValues
  )
    public
    onlyOwner
  {
    require(
      indexes.length == keys.length &&
      indexes.length == attributeNames.length &&
      indexes.length == attributeValues.length,
      "Number of indexes much match keys, names and values"
    );

    for (uint256 idx; idx < indexes.length; idx++) {
      uint256 index = indexes[idx];
      layerMap[index] = CyberBrokerLayer(keys[idx], attributeNames[idx], attributeValues[idx]);
    }
  }

  function setTalents(
    uint256[] memory indexes,
    string[]  memory talent,
    string[]  memory species,
    string[]  memory class,
    string[]  memory description
  )
    public
    onlyOwner
  {
    require(
      indexes.length == talent.length &&
      indexes.length == species.length &&
      indexes.length == class.length &&
      indexes.length == description.length
    , "Number of indexes must match talent, species, class, and description");

    for (uint256 idx; idx < indexes.length; idx++) {
      uint256 index = indexes[idx];
      talentMap[index] = CyberBrokerTalent(talent[idx], species[idx], class[idx], description[idx]);
    }
  }

  function setBrokers(
    uint256[]  memory indexes,
    uint8[]    memory talent,
    uint8[]    memory mind,
    uint8[]    memory body,
    uint8[]    memory soul,
    uint16[][] memory layers
  )
    public
    onlyOwner
  {
    require(
      indexes.length == talent.length &&
      indexes.length == mind.length &&
      indexes.length == body.length &&
      indexes.length == soul.length &&
      indexes.length == layers.length,
      "Number of indexes must match talent, mind, body, soul, and layers"
    );

    for (uint8 idx; idx < indexes.length; idx++) {
      require(talent[idx] <= talentMap.length, "Invalid talent index");
      require(mind[idx] <= 30, "Invalid mind");
      require(body[idx] <= 30, "Invalid body");
      require(soul[idx] <= 30, "Invalid soul");

      uint256 _dna = (
        (uint256(mind[idx])   << BROKER_MIND_DNA_POSITION) +
        (uint256(body[idx])   << BROKER_BODY_DNA_POSITION) +
        (uint256(soul[idx])   << BROKER_SOUL_DNA_POSITION) +
        (uint256(talent[idx]) << BROKER_TALENT_DNA_POSITION) +
        (layers[idx].length   << BROKER_LAYER_COUNT_DNA_POSITION)
      );

      for (uint16 layerIdx; layerIdx < layers[idx].length; layerIdx++) {
        require(uint256(layers[idx][layerIdx]) <= layerMap.length, "Invalid layer index");
        _dna += uint256(layers[idx][layerIdx]) << (BROKER_LAYERS_DNA_SIZE * layerIdx + BROKER_LAYERS_DNA_POSITION);
      }

      uint256 index = indexes[idx];

      brokerDna[index] = _dna;
    }
  }

  /**
   * On-Chain Metadata Construction
   **/

  // REQUIRED for token contract
  function hasOnchainMetadata(uint256) public view returns (bool) {
    return _useOnChainMetadata;
  }

  function setOnChainMetadata(bool _state) public onlyOwner {
    _useOnChainMetadata = _state;
  }

  function setExternalUri(string calldata _uri) public onlyOwner {
    _externalUri = _uri;
  }

  function setUseIndividualExternalUri(bool _setting) public onlyOwner {
    _useIndividualExternalUri = _setting;
  }

  function setImageCacheUri(string calldata _uri) public onlyOwner {
    _imageCacheUri = _uri;
  }

  // REQUIRED for token contract
  function tokenURI(uint256 tokenId) public view returns (string memory) {
    require(tokenId <= 10000, "Invalid tokenId");

    // Unpack the name, talent and layers
    string memory name = getBrokerName(tokenId);

    return string(
        abi.encodePacked(
            abi.encodePacked(
                bytes('data:application/json;utf8,{"name":"'),
                name,
                bytes('","description":"'),
                getDescription(tokenId),
                bytes('","external_url":"'),
                getExternalUrl(tokenId),
                bytes('","image":"'),
                getImageCache(tokenId)
            ),
            abi.encodePacked(
                bytes('","attributes":['),
                getTalentAttributes(tokenId),
                getStatAttributes(tokenId),
                getLayerAttributes(tokenId),
                bytes(']}')
            )
        )
    );
  }

  function getBrokerName(uint256 _tokenId) public view returns (string memory) {
    string memory _key = 'broker-names';
    require(contractDataStorage.hasKey(_key), "Broker names are not uploaded");

    // Get the broker names
    bytes memory brokerNames = contractDataStorage.getData(_key);

    // Pull the broker name size
    uint256 brokerNameSize = uint256(uint8(brokerNames[_tokenId * 31]));

    bytes memory name = new bytes(brokerNameSize);
    for (uint256 idx; idx < brokerNameSize; idx++) {
      name[idx] = brokerNames[_tokenId * (31) + 1 + idx];
    }

    return string(name);
  }

  function getLayers(uint256 tokenId) public view returns (uint256[] memory) {
    require(tokenId <= 10000, "Invalid tokenId");

    // Get the broker DNA -> layers
    uint256 dna = brokerDna[tokenId];
    require(dna > 0, "Broker DNA missing for token");

    uint256 layerCount = (dna >> BROKER_LAYER_COUNT_DNA_POSITION) & BROKER_LAYER_COUNT_DNA_BITMASK;
    uint256[] memory layers = new uint256[](layerCount);
    for (uint256 layerIdx; layerIdx < layerCount; layerIdx++) {
      layers[layerIdx] = (dna >> (BROKER_LAYERS_DNA_SIZE * layerIdx + BROKER_LAYERS_DNA_POSITION)) & BROKER_LAYER_DNA_BITMASK;
    }
    return layers;
  }

  function getDescription(uint256 tokenId) public view returns (string memory) {
    CyberBrokerTalent memory talent = getTalent(tokenId);
    return talent.description;
  }

  function getExternalUrl(uint256 tokenId) public view returns (string memory) {
    if (_useIndividualExternalUri) {
      return string(abi.encodePacked(_externalUri, tokenId.toString()));
    }

    return _externalUri;
  }

  function getImageCache(uint256 tokenId) public view returns (string memory) {
    return string(abi.encodePacked(_imageCacheUri, tokenId.toString(), ".svg"));
  }

  function getTalentAttributes(uint256 tokenId) public view returns (string memory) {
    CyberBrokerTalent memory talent = getTalent(tokenId);

    return string(
      abi.encodePacked(
        abi.encodePacked(
          bytes('{"trait_type": "Talent", "value": "'),
          talent.talent,
          bytes('"},{"trait_type": "Species", "value": "'),
          talent.species
        ),
        abi.encodePacked(
          bytes('"},{"trait_type": "Class", "value": "'),
          talent.class,
          bytes('"},')
        )
      )
    );
  }

  function getTalent(uint256 tokenId) public view returns (CyberBrokerTalent memory talent) {
    require(tokenId <= 10000, "Invalid tokenId");

    // Get the broker DNA
    uint256 dna = brokerDna[tokenId];
    require(dna > 0, "Broker DNA missing for token");

    // Get the talent
    uint256 talentIndex = (dna >> BROKER_TALENT_DNA_POSITION) & BROKER_TALENT_DNA_BITMASK;

    require(talentIndex < talentMap.length, "Invalid talent index");

    return talentMap[talentIndex];
  }

  function getStats(uint256 tokenId) public view returns (uint256 mind, uint256 body, uint256 soul) {
    require(tokenId <= 10000, "Invalid tokenId");

    // Get the broker DNA
    uint256 dna = brokerDna[tokenId];
    require(dna > 0, "Broker DNA missing for token");

    // Return the mind, body, and soul
    return (
      (dna >> BROKER_MIND_DNA_POSITION) & BROKER_MIND_DNA_BITMASK,
      (dna >> BROKER_BODY_DNA_POSITION) & BROKER_BODY_DNA_BITMASK,
      (dna >> BROKER_SOUL_DNA_POSITION) & BROKER_SOUL_DNA_BITMASK
    );
  }

  function getStatAttributes(uint256 tokenId) public view returns (string memory) {
    (uint256 mind, uint256 body, uint256 soul) = getStats(tokenId);

    return string(
      abi.encodePacked(
        abi.encodePacked(
          bytes('{"trait_type": "Mind", "value": '),
          mind.toString(),
          bytes('},{"trait_type": "Body", "value": '),
          body.toString()
        ),
        abi.encodePacked(
          bytes('},{"trait_type": "Soul", "value": '),
          soul.toString(),
          bytes('}')
        )
      )
    );
  }

  function getLayerAttributes(uint256 tokenId) public view returns (string memory) {
    // Get the layersg
    uint256[] memory layers = getLayers(tokenId);

    // Get the attribute names for all layers
    CyberBrokerLayer[] memory attrLayers = new CyberBrokerLayer[](layers.length);

    uint256 maxAttrLayerIdx = 0;
    for (uint16 layerIdx; layerIdx < layers.length; layerIdx++) {
      CyberBrokerLayer memory attribute = layerMap[layers[layerIdx]];

      if (keccak256(abi.encodePacked(attribute.attributeValue)) != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470) {
        attrLayers[maxAttrLayerIdx++] = attribute;
      }
    }

    // Compile the attributes
    string memory attributes = "";
    for (uint16 attrIdx; attrIdx < maxAttrLayerIdx; attrIdx++) {
      attributes = string(
        abi.encodePacked(
          attributes,
          bytes(',{"trait_type": "'),
          attrLayers[attrIdx].attributeName,
          bytes('", "value": "'),
          attrLayers[attrIdx].attributeValue,
          bytes('"}')
        )
      );
    }

    return attributes;
  }


  /**
   * On-Chain Token SVG Rendering
   **/

  // REQUIRED for token contract
  function render(
    uint256
  )
    public
    pure
    returns (string memory)
  {
    return string("To render the token on-chain, call CyberBrokersMetadata.renderBroker(_tokenId, _startIndex) or CyberBrokersMetadata._renderBroker(_tokenId, _startIndex, _thresholdCounter) and iterate through the pages starting at _startIndex = 0. To render off-chain and use an off-chain renderer, call CyberBrokersMetadata.getTokenData(_tokenId) to get the raw data. A JavaScript parser is available by calling CyberBrokersMetadata.getOffchainSvgParser().");
  }

  function renderData(
    string memory _key,
    uint256 _startIndex
  )
    public
    view
    returns (
      string memory,
      uint256
    )
  {
    return _renderData(_key, _startIndex, 2800);
  }

  function _renderData(
    string memory _key,
    uint256 _startIndex,
    uint256 _thresholdCounter
  )
    public
    view
    returns (
      string memory,
      uint256
    )
  {
    require(contractDataStorage.hasKey(_key));
    return svgParser.parse(contractDataStorage.getData(_key), _startIndex, _thresholdCounter);
  }

  function renderBroker(
    uint256 _tokenId,
    uint256 _startIndex
  )
    public
    view
    returns (
      string memory,
      uint256
    )
  {
    return _renderBroker(_tokenId, _startIndex, 2800);
  }

  function _renderBroker(
    uint256 _tokenId,
    uint256 _startIndex,
    uint256 _thresholdCounter
  )
    public
    view
    returns (
      string memory,
      uint256
    )
  {
    require(_tokenId <= 10000, "Can only render valid token ID");
    return svgParser.parse(getTokenData(_tokenId), _startIndex, _thresholdCounter);
  }


  /**
   * Off-Chain Token SVG Rendering
   **/

  function getTokenData(uint256 _tokenId)
    public
    view
    returns (bytes memory)
  {
    uint256[] memory layerNumbers = getLayers(_tokenId);

    string[] memory layers = new string[](layerNumbers.length);
    for (uint256 layerIdx; layerIdx < layerNumbers.length; layerIdx++) {
      string memory key = layerMap[layerNumbers[layerIdx]].key;
      require(contractDataStorage.hasKey(key), "Key does not exist in contract data storage");
      layers[layerIdx] = key;
    }

    return contractDataStorage.getDataForAll(layers);
  }

  function getOffchainSvgParser()
    public
    view
    returns (
      string memory _output
    )
  {
    string memory _key = 'svg-parser.js';
    require(contractDataStorage.hasKey(_key), "Off-chain SVG Parser not uploaded");
    return string(contractDataStorage.getData(_key));
  }

}

File 6 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 7 of 8 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 8 of 8 : Utils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library Utils {

  /**
   * From https://github.com/provable-things/ethereum-api/blob/master/oraclizeAPI_0.5.sol
   **/

   function uint2bytes(uint _i) internal pure returns (bytes memory) {
    if (_i == 0) {
      return "0";
    }
    uint j = _i;
    uint len;
    while (j != 0) {
      len++;
      j /= 10;
    }
    bytes memory bstr = new bytes(len);
    uint k = len - 1;
    while (_i != 0) {
      unchecked {
        bstr[k--] = bytes1(uint8(48 + _i % 10));
      }

      _i /= 10;
    }
    return bstr;
  }

  function unpackNumberSetValues(uint _i, bool decimal, bool negative, bool percent) internal pure returns (bytes memory) {
    // Base case
    if (_i == 0) {
      if (percent) {
        return "0%";
      } else {
        return "0";
      }
    }

    // Kick off length with the slots needed to make room for, considering certain bits
    uint j = _i;
    uint len = (negative ? 1 : 0) + (percent ? 1 : 0) + (decimal ? 2 : 0);

    // See how many tens we need
    uint numTens;
    while (j != 0) {
      numTens++;
      j /= 10;
    }

    // Expand length
    // Special case: if decimal & numTens is less than 3, need to pad by 3 since we'll left-pad zeroes
    if (decimal && numTens < 3) {
      len += 3;
    } else {
      len += numTens;
    }

    // Now create the byte "string"
    bytes memory bstr = new bytes(len);

    // Index from right-most to left-most
    uint k = len - 1;

    // Percent character
    if (percent) {
      bstr[k--] = bytes1("%");
    }

    // The entire number
    while (_i != 0) {
      unchecked {
        bstr[k--] = bytes1(uint8(48 + _i % 10));
      }

      _i /= 10;
    }

    // If a decimal, we need to left-pad if the numTens isn't enough
    if (decimal) {
      while (numTens < 3) {
        bstr[k--] = bytes1("0");
        numTens++;
      }
      bstr[k--] = bytes1(".");

      unchecked {
        bstr[k--] = bytes1("0");
      }
    }

    // If negative, the last byte should be negative
    if (negative) {
      bstr[0] = bytes1("-");
    }

    return bstr;
  }

  /**
   * Reference pulled from https://gist.github.com/okwme/f3a35193dc4eb9d1d0db65ccf3eb4034
   **/

  function unpackHexColorValues(uint8 r, uint8 g, uint8 b) internal pure returns (bytes memory) {
    bytes memory rHex = Utils.uint2hexchar(r);
    bytes memory gHex = Utils.uint2hexchar(g);
    bytes memory bHex = Utils.uint2hexchar(b);
    bytes memory bstr = new bytes(7);
    bstr[6] = bHex[1];
    bstr[5] = bHex[0];
    bstr[4] = gHex[1];
    bstr[3] = gHex[0];
    bstr[2] = rHex[1];
    bstr[1] = rHex[0];
    bstr[0] = bytes1("#");
    return bstr;
  }

  function uint2hexchar(uint8 _i) internal pure returns (bytes memory) {
    uint8 mask = 15;
    bytes memory bstr = new bytes(2);
    bstr[1] = (_i & mask) > 9 ? bytes1(uint8(55 + (_i & mask))) : bytes1(uint8(48 + (_i & mask)));
    bstr[0] = ((_i >> 4) & mask) > 9 ? bytes1(uint8(55 + ((_i >> 4) & mask))) : bytes1(uint8(48 + ((_i >> 4) & mask)));
    return bstr;
  }

}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_metadataStorageContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_startIndex","type":"uint256"},{"internalType":"uint256","name":"_thresholdCounter","type":"uint256"}],"name":"_renderBroker","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_key","type":"string"},{"internalType":"uint256","name":"_startIndex","type":"uint256"},{"internalType":"uint256","name":"_thresholdCounter","type":"uint256"}],"name":"_renderData","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"brokerDna","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractDataStorage","outputs":[{"internalType":"contract ContractDataStorage","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getBrokerName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getDescription","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getExternalUrl","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getImageCache","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLayerAttributes","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLayers","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOffchainSvgParser","outputs":[{"internalType":"string","name":"_output","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getStatAttributes","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getStats","outputs":[{"internalType":"uint256","name":"mind","type":"uint256"},{"internalType":"uint256","name":"body","type":"uint256"},{"internalType":"uint256","name":"soul","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTalent","outputs":[{"components":[{"internalType":"string","name":"talent","type":"string"},{"internalType":"string","name":"species","type":"string"},{"internalType":"string","name":"class","type":"string"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct ICyberBrokersMetadata.CyberBrokerTalent","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTalentAttributes","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getTokenData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"hasOnchainMetadata","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"layerId","type":"uint256"}],"name":"layerMap","outputs":[{"components":[{"internalType":"string","name":"key","type":"string"},{"internalType":"string","name":"attributeName","type":"string"},{"internalType":"string","name":"attributeValue","type":"string"}],"internalType":"struct ICyberBrokersMetadata.CyberBrokerLayer","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataStorageContract","outputs":[{"internalType":"contract CyberBrokersMetadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"render","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_startIndex","type":"uint256"}],"name":"renderBroker","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_key","type":"string"},{"internalType":"uint256","name":"_startIndex","type":"uint256"}],"name":"renderData","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"svgParser","outputs":[{"internalType":"contract SvgParser","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"talentId","type":"uint256"}],"name":"talentMap","outputs":[{"components":[{"internalType":"string","name":"talent","type":"string"},{"internalType":"string","name":"species","type":"string"},{"internalType":"string","name":"class","type":"string"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct ICyberBrokersMetadata.CyberBrokerTalent","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516200214e3803806200214e83398101604081905261003191610056565b600080546001600160a01b0319166001600160a01b0392909216919091179055610086565b60006020828403121561006857600080fd5b81516001600160a01b038116811461007f57600080fd5b9392505050565b6120b880620000966000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c8063a17a5297116100de578063c321118c11610097578063c71ea0f711610071578063c71ea0f71461038d578063c87b56dd146103a0578063d1a58319146103b3578063f428d8f1146103bb57600080fd5b8063c321118c14610344578063c479174814610357578063c6395c1e1461036a57600080fd5b8063a17a5297146102dd578063a9fcd353146102f0578063b09afec114610303578063b2e8a28314610316578063b33dfeeb14610329578063bc2adb011461033157600080fd5b80636a697692116101305780636a69769214610227578063721ef834146102475780637b3039651461025a5780637e8b5bf8146102885780638aefb2ca146102a95780638d9ad7c2146102ca57600080fd5b80631002193a146101785780634925ec55146101a15780635f612793146101c15780635f94c35b146101e15780636070675d146101f457806366d6cb9914610214575b600080fd5b61018b6101863660046115d2565b6103ce565b6040516101989190611647565b60405180910390f35b6101b46101af3660046115d2565b610497565b60405161019891906116c5565b6101d46101cf3660046115d2565b6104af565b60405161019891906116df565b61018b6101ef3660046115d2565b6105e9565b6101fc6106f4565b6040516001600160a01b039091168152602001610198565b6101b46102223660046115d2565b610771565b61023a6102353660046115d2565b6107ea565b6040516101989190611723565b6101b46102553660046115d2565b6108a6565b61026d6102683660046115d2565b6108d8565b60408051938452602084019290925290820152606001610198565b61029b610296366004611840565b610957565b60405161019892919061188e565b6102bc6102b73660046115d2565b6109df565b604051908152602001610198565b61029b6102d83660046118b0565b610a4d565b61029b6102eb3660046118f5565b610ad2565b6101b46102fe3660046115d2565b610b0d565b6101b46103113660046115d2565b610b3f565b6101b46103243660046115d2565b610d52565b6101b4610fa5565b6000546101fc906001600160a01b031681565b6101b46103523660046115d2565b611016565b61029b610365366004611917565b611048565b61037d6103783660046115d2565b61108a565b6040519015158152602001610198565b6101b461039b3660046115d2565b6110f8565b6101b46103ae3660046115d2565b6111dc565b6101fc61154c565b6101b46103c93660046115d2565b6115a0565b6103f96040518060800160405280606081526020016060815260200160608152602001606081525090565b600080546040516308010c9d60e11b8152600481018590528291829182916001600160a01b031690631002193a90602401600060405180830381865afa158015610447573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261046f9190810190611993565b6040805160808101825294855260208501939093529183015260608201529695505050505050565b606060006104a4836105e9565b606001519392505050565b60606127108211156104dc5760405162461bcd60e51b81526004016104d390611a40565b60405180910390fd5b60006104e7836109df565b9050600081116105395760405162461bcd60e51b815260206004820152601c60248201527f42726f6b657220444e41206d697373696e6720666f7220746f6b656e0000000060448201526064016104d3565b601581901c601f1660008167ffffffffffffffff81111561055c5761055c61177b565b604051908082528060200260200182016040528015610585578160200160208202803683370190505b50905060005b828110156105e057610fff601a6105a383600c611a7f565b6105ad9190611a9e565b85901c168282815181106105c3576105c3611ab6565b6020908102919091010152806105d881611acc565b91505061058b565b50949350505050565b6106146040518060800160405280606081526020016060815260200160608152602001606081525090565b6127108211156106365760405162461bcd60e51b81526004016104d390611a40565b6000610641836109df565b9050600081116106935760405162461bcd60e51b815260206004820152601c60248201527f42726f6b657220444e41206d697373696e6720666f7220746f6b656e0000000060448201526064016104d3565b600f81901c603f166105b481106106e35760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840e8c2d8cadce840d2dcc8caf60631b60448201526064016104d3565b6106ec816103ce565b949350505050565b60008060009054906101000a90046001600160a01b03166001600160a01b0316636070675d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076c9190611aff565b905090565b6000546040516366d6cb9960e01b8152600481018390526060916001600160a01b0316906366d6cb99906024015b600060405180830381865afa1580156107bc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107e49190810190611b1c565b92915050565b61080e60405180606001604052806060815260200160608152602001606081525090565b60008054604051633534bb4960e11b815260048101859052829182916001600160a01b0390911690636a69769290602401600060405180830381865afa15801561085c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108849190810190611b51565b6040805160608101825293845260208401929092529082015295945050505050565b600054604051631c87be0d60e21b8152600481018390526060916001600160a01b03169063721ef8349060240161079f565b60008054604051637b30396560e01b815260048101849052829182916001600160a01b0390911690637b30396590602401606060405180830381865afa158015610926573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094a9190611bd9565b9250925092509193909250565b60008054604051630fd16b7f60e31b8152606092916001600160a01b031690637e8b5bf89061098e90889088908890600401611c07565b600060405180830381865afa1580156109ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d39190810190611c2c565b91509150935093915050565b60008054604051634577d96560e11b8152600481018490526001600160a01b0390911690638aefb2ca90602401602060405180830381865afa158015610a29573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e49190611c73565b600080546040516346cd6be160e11b8152606092916001600160a01b031690638d9ad7c290610a82908790879060040161188e565b600060405180830381865afa158015610a9f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ac79190810190611c2c565b915091509250929050565b6000805460405163a17a529760e01b81526004810185905260248101849052606092916001600160a01b03169063a17a529790604401610a82565b60005460405163a9fcd35360e01b8152600481018390526060916001600160a01b03169063a9fcd3539060240161079f565b60606000610b4c836104af565b90506000815167ffffffffffffffff811115610b6a57610b6a61177b565b604051908082528060200260200182016040528015610b9d57816020015b6060815260200190600190039081610b885790505b50905060005b8251811015610cd9576000610bd0848381518110610bc357610bc3611ab6565b60200260200101516107ea565b519050610bdb61154c565b6001600160a01b031663332d3780826040518263ffffffff1660e01b8152600401610c0691906116c5565b602060405180830381865afa158015610c23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c479190611c8c565b610ca75760405162461bcd60e51b815260206004820152602b60248201527f4b657920646f6573206e6f7420657869737420696e20636f6e7472616374206460448201526a6174612073746f7261676560a81b60648201526084016104d3565b80838381518110610cba57610cba611ab6565b6020026020010181905250508080610cd190611acc565b915050610ba3565b50610ce261154c565b6001600160a01b0316630854ddcf826040518263ffffffff1660e01b8152600401610d0d9190611cae565b600060405180830381865afa158015610d2a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106ec9190810190611d10565b60606000610d5f836104af565b90506000815167ffffffffffffffff811115610d7d57610d7d61177b565b604051908082528060200260200182016040528015610dd257816020015b610dbf60405180606001604052806060815260200160608152602001606081525090565b815260200190600190039081610d9b5790505b5090506000805b83518161ffff161015610e94576000610e01858361ffff1681518110610bc357610bc3611ab6565b90508060400151604051602001610e189190611d59565b604051602081830303815290604052805190602001207fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b14610e8157808484610e6381611acc565b955081518110610e7557610e75611ab6565b60200260200101819052505b5080610e8c81611d75565b915050610dd9565b50604080516020810190915260008082525b828161ffff161015610f9b578160405180604001604052806011815260200170163d913a3930b4ba2fba3cb832911d101160791b815250858361ffff1681518110610ef357610ef3611ab6565b6020026020010151602001516040518060400160405280600d81526020016c111610113b30b63ab2911d101160991b815250878561ffff1681518110610f3b57610f3b611ab6565b60200260200101516040015160405180604001604052806002815260200161227d60f01b815250604051602001610f7796959493929190611d97565b60405160208183030381529060405291508080610f9390611d75565b915050610ea6565b5095945050505050565b600080546040805163b33dfeeb60e01b815290516060936001600160a01b039093169263b33dfeeb92600480820193918290030181865afa158015610fee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261076c9190810190611b1c565b6000546040516330c8446360e21b8152600481018390526060916001600160a01b03169063c321118c9060240161079f565b6000805460405163188f22e960e31b8152600481018690526024810185905260448101849052606092916001600160a01b03169063c47917489060640161098e565b6000805460405163631cae0f60e11b8152600481018490526001600160a01b039091169063c6395c1e90602401602060405180830381865afa1580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e49190611c8c565b60606000611105836105e9565b905060405180606001604052806023815260200161201760239139815160408051606081019091526027808252611ff060208301396020808501516040516111509594939201611e16565b60408051601f1981840301815260608301909152602580835290919061205e6020830139826040015160405180604001604052806003815260200162089f4b60ea1b8152506040516020016111a793929190611e6d565b60408051601f19818403018152908290526111c59291602001611eb0565b604051602081830303815290604052915050919050565b60606127108211156112005760405162461bcd60e51b81526004016104d390611a40565b6000805460405163a9fcd35360e01b8152600481018590526001600160a01b039091169063a9fcd35390602401600060405180830381865afa15801561124a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112729190810190611b1c565b905060405180606001604052806024815260200161203a6024913981604051806040016040528060118152602001701116113232b9b1b934b83a34b7b7111d1160791b8152506112c186610497565b604080518082018252601281527111161132bc3a32b93730b62fbab936111d1160711b6020820152600054915163f428d8f160e01b8152600481018a905290916001600160a01b03169063f428d8f190602401600060405180830381865afa158015611331573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113599190810190611b1c565b604080518082018252600b81526a11161134b6b0b3b2911d1160a91b602082015260005491516366d6cb9960e01b8152600481018c905290916001600160a01b0316906366d6cb9990602401600060405180830381865afa1580156113c2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113ea9190810190611b1c565b604051602001611401989796959493929190611edf565b60408051601f19818403018152828201909152601082526f222c2261747472696275746573223a5b60801b60208301529061143b856110f8565b600054604051631c87be0d60e21b8152600481018890526001600160a01b039091169063721ef83490602401600060405180830381865afa158015611484573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114ac9190810190611b1c565b60005460405163b2e8a28360e01b8152600481018990526001600160a01b039091169063b2e8a28390602401600060405180830381865afa1580156114f5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261151d9190810190611b1c565b604051806040016040528060028152602001615d7d60f01b8152506040516020016111a7959493929190611f84565b60008060009054906101000a90046001600160a01b03166001600160a01b031663d1a583196040518163ffffffff1660e01b8152600401602060405180830381865afa158015610748573d6000803e3d6000fd5b60005460405163f428d8f160e01b8152600481018390526060916001600160a01b03169063f428d8f19060240161079f565b6000602082840312156115e457600080fd5b5035919050565b60005b838110156116065781810151838201526020016115ee565b83811115611615576000848401525b50505050565b600081518084526116338160208601602086016115eb565b601f01601f19169290920160200192915050565b60208152600082516080602084015261166360a084018261161b565b90506020840151601f1980858403016040860152611681838361161b565b9250604086015191508085840301606086015261169e838361161b565b92506060860151915080858403016080860152506116bc828261161b565b95945050505050565b6020815260006116d8602083018461161b565b9392505050565b6020808252825182820181905260009190848201906040850190845b81811015611717578351835292840192918401916001016116fb565b50909695505050505050565b60208152600082516060602084015261173f608084018261161b565b90506020840151601f198085840301604086015261175d838361161b565b92506040860151915080858403016060860152506116bc828261161b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156117ba576117ba61177b565b604052919050565b600067ffffffffffffffff8211156117dc576117dc61177b565b50601f01601f191660200190565b600082601f8301126117fb57600080fd5b813561180e611809826117c2565b611791565b81815284602083860101111561182357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561185557600080fd5b833567ffffffffffffffff81111561186c57600080fd5b611878868287016117ea565b9660208601359650604090950135949350505050565b6040815260006118a1604083018561161b565b90508260208301529392505050565b600080604083850312156118c357600080fd5b823567ffffffffffffffff8111156118da57600080fd5b6118e6858286016117ea565b95602094909401359450505050565b6000806040838503121561190857600080fd5b50508035926020909101359150565b60008060006060848603121561192c57600080fd5b505081359360208301359350604090920135919050565b6000611951611809846117c2565b905082815283838301111561196557600080fd5b6116d88360208301846115eb565b600082601f83011261198457600080fd5b6116d883835160208501611943565b600080600080608085870312156119a957600080fd5b845167ffffffffffffffff808211156119c157600080fd5b6119cd88838901611973565b955060208701519150808211156119e357600080fd5b6119ef88838901611973565b94506040870151915080821115611a0557600080fd5b611a1188838901611973565b93506060870151915080821115611a2757600080fd5b50611a3487828801611973565b91505092959194509250565b6020808252600f908201526e125b9d985b1a59081d1bdad95b9259608a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611a9957611a99611a69565b500290565b60008219821115611ab157611ab1611a69565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611ae057611ae0611a69565b5060010190565b6001600160a01b0381168114611afc57600080fd5b50565b600060208284031215611b1157600080fd5b81516116d881611ae7565b600060208284031215611b2e57600080fd5b815167ffffffffffffffff811115611b4557600080fd5b6106ec84828501611973565b600080600060608486031215611b6657600080fd5b835167ffffffffffffffff80821115611b7e57600080fd5b611b8a87838801611973565b94506020860151915080821115611ba057600080fd5b611bac87838801611973565b93506040860151915080821115611bc257600080fd5b50611bcf86828701611973565b9150509250925092565b600080600060608486031215611bee57600080fd5b8351925060208401519150604084015190509250925092565b606081526000611c1a606083018661161b565b60208301949094525060400152919050565b60008060408385031215611c3f57600080fd5b825167ffffffffffffffff811115611c5657600080fd5b611c6285828601611973565b925050602083015190509250929050565b600060208284031215611c8557600080fd5b5051919050565b600060208284031215611c9e57600080fd5b815180151581146116d857600080fd5b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611d0357603f19888603018452611cf185835161161b565b94509285019290850190600101611cd5565b5092979650505050505050565b600060208284031215611d2257600080fd5b815167ffffffffffffffff811115611d3957600080fd5b8201601f81018413611d4a57600080fd5b6106ec84825160208401611943565b60008251611d6b8184602087016115eb565b9190910192915050565b600061ffff80831681811415611d8d57611d8d611a69565b6001019392505050565b600087516020611daa8285838d016115eb565b885191840191611dbd8184848d016115eb565b8851920191611dcf8184848c016115eb565b8751920191611de18184848b016115eb565b8651920191611df38184848a016115eb565b8551920191611e0581848489016115eb565b919091019998505050505050505050565b60008551611e28818460208a016115eb565b855190830190611e3c818360208a016115eb565b8551910190611e4f8183602089016115eb565b8451910190611e628183602088016115eb565b019695505050505050565b60008451611e7f8184602089016115eb565b845190830190611e938183602089016115eb565b8451910190611ea68183602088016115eb565b0195945050505050565b60008351611ec28184602088016115eb565b835190830190611ed68183602088016115eb565b01949350505050565b600089516020611ef28285838f016115eb565b8a5191840191611f058184848f016115eb565b8a51920191611f178184848e016115eb565b8951920191611f298184848d016115eb565b8851920191611f3b8184848c016115eb565b8751920191611f4d8184848b016115eb565b8651920191611f5f8184848a016115eb565b8551920191611f7181848489016115eb565b919091019b9a5050505050505050505050565b60008651611f96818460208b016115eb565b865190830190611faa818360208b016115eb565b8651910190611fbd818360208a016115eb565b8551910190611fd08183602089016115eb565b8451910190611fe38183602088016115eb565b0197965050505050505056fe227d2c7b2274726169745f74797065223a202253706563696573222c202276616c7565223a20227b2274726169745f74797065223a202254616c656e74222c202276616c7565223a2022646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b226e616d65223a22227d2c7b2274726169745f74797065223a2022436c617373222c202276616c7565223a2022a264697066735822122019fba8445fa8e53b617ff095fc9a2ce9d08924bdf99333eb9cfd98c2141821e164736f6c634300080a0033000000000000000000000000fba40a041b615755a8b2741537e8942910e57698

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063a17a5297116100de578063c321118c11610097578063c71ea0f711610071578063c71ea0f71461038d578063c87b56dd146103a0578063d1a58319146103b3578063f428d8f1146103bb57600080fd5b8063c321118c14610344578063c479174814610357578063c6395c1e1461036a57600080fd5b8063a17a5297146102dd578063a9fcd353146102f0578063b09afec114610303578063b2e8a28314610316578063b33dfeeb14610329578063bc2adb011461033157600080fd5b80636a697692116101305780636a69769214610227578063721ef834146102475780637b3039651461025a5780637e8b5bf8146102885780638aefb2ca146102a95780638d9ad7c2146102ca57600080fd5b80631002193a146101785780634925ec55146101a15780635f612793146101c15780635f94c35b146101e15780636070675d146101f457806366d6cb9914610214575b600080fd5b61018b6101863660046115d2565b6103ce565b6040516101989190611647565b60405180910390f35b6101b46101af3660046115d2565b610497565b60405161019891906116c5565b6101d46101cf3660046115d2565b6104af565b60405161019891906116df565b61018b6101ef3660046115d2565b6105e9565b6101fc6106f4565b6040516001600160a01b039091168152602001610198565b6101b46102223660046115d2565b610771565b61023a6102353660046115d2565b6107ea565b6040516101989190611723565b6101b46102553660046115d2565b6108a6565b61026d6102683660046115d2565b6108d8565b60408051938452602084019290925290820152606001610198565b61029b610296366004611840565b610957565b60405161019892919061188e565b6102bc6102b73660046115d2565b6109df565b604051908152602001610198565b61029b6102d83660046118b0565b610a4d565b61029b6102eb3660046118f5565b610ad2565b6101b46102fe3660046115d2565b610b0d565b6101b46103113660046115d2565b610b3f565b6101b46103243660046115d2565b610d52565b6101b4610fa5565b6000546101fc906001600160a01b031681565b6101b46103523660046115d2565b611016565b61029b610365366004611917565b611048565b61037d6103783660046115d2565b61108a565b6040519015158152602001610198565b6101b461039b3660046115d2565b6110f8565b6101b46103ae3660046115d2565b6111dc565b6101fc61154c565b6101b46103c93660046115d2565b6115a0565b6103f96040518060800160405280606081526020016060815260200160608152602001606081525090565b600080546040516308010c9d60e11b8152600481018590528291829182916001600160a01b031690631002193a90602401600060405180830381865afa158015610447573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261046f9190810190611993565b6040805160808101825294855260208501939093529183015260608201529695505050505050565b606060006104a4836105e9565b606001519392505050565b60606127108211156104dc5760405162461bcd60e51b81526004016104d390611a40565b60405180910390fd5b60006104e7836109df565b9050600081116105395760405162461bcd60e51b815260206004820152601c60248201527f42726f6b657220444e41206d697373696e6720666f7220746f6b656e0000000060448201526064016104d3565b601581901c601f1660008167ffffffffffffffff81111561055c5761055c61177b565b604051908082528060200260200182016040528015610585578160200160208202803683370190505b50905060005b828110156105e057610fff601a6105a383600c611a7f565b6105ad9190611a9e565b85901c168282815181106105c3576105c3611ab6565b6020908102919091010152806105d881611acc565b91505061058b565b50949350505050565b6106146040518060800160405280606081526020016060815260200160608152602001606081525090565b6127108211156106365760405162461bcd60e51b81526004016104d390611a40565b6000610641836109df565b9050600081116106935760405162461bcd60e51b815260206004820152601c60248201527f42726f6b657220444e41206d697373696e6720666f7220746f6b656e0000000060448201526064016104d3565b600f81901c603f166105b481106106e35760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840e8c2d8cadce840d2dcc8caf60631b60448201526064016104d3565b6106ec816103ce565b949350505050565b60008060009054906101000a90046001600160a01b03166001600160a01b0316636070675d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076c9190611aff565b905090565b6000546040516366d6cb9960e01b8152600481018390526060916001600160a01b0316906366d6cb99906024015b600060405180830381865afa1580156107bc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107e49190810190611b1c565b92915050565b61080e60405180606001604052806060815260200160608152602001606081525090565b60008054604051633534bb4960e11b815260048101859052829182916001600160a01b0390911690636a69769290602401600060405180830381865afa15801561085c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108849190810190611b51565b6040805160608101825293845260208401929092529082015295945050505050565b600054604051631c87be0d60e21b8152600481018390526060916001600160a01b03169063721ef8349060240161079f565b60008054604051637b30396560e01b815260048101849052829182916001600160a01b0390911690637b30396590602401606060405180830381865afa158015610926573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094a9190611bd9565b9250925092509193909250565b60008054604051630fd16b7f60e31b8152606092916001600160a01b031690637e8b5bf89061098e90889088908890600401611c07565b600060405180830381865afa1580156109ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d39190810190611c2c565b91509150935093915050565b60008054604051634577d96560e11b8152600481018490526001600160a01b0390911690638aefb2ca90602401602060405180830381865afa158015610a29573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e49190611c73565b600080546040516346cd6be160e11b8152606092916001600160a01b031690638d9ad7c290610a82908790879060040161188e565b600060405180830381865afa158015610a9f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ac79190810190611c2c565b915091509250929050565b6000805460405163a17a529760e01b81526004810185905260248101849052606092916001600160a01b03169063a17a529790604401610a82565b60005460405163a9fcd35360e01b8152600481018390526060916001600160a01b03169063a9fcd3539060240161079f565b60606000610b4c836104af565b90506000815167ffffffffffffffff811115610b6a57610b6a61177b565b604051908082528060200260200182016040528015610b9d57816020015b6060815260200190600190039081610b885790505b50905060005b8251811015610cd9576000610bd0848381518110610bc357610bc3611ab6565b60200260200101516107ea565b519050610bdb61154c565b6001600160a01b031663332d3780826040518263ffffffff1660e01b8152600401610c0691906116c5565b602060405180830381865afa158015610c23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c479190611c8c565b610ca75760405162461bcd60e51b815260206004820152602b60248201527f4b657920646f6573206e6f7420657869737420696e20636f6e7472616374206460448201526a6174612073746f7261676560a81b60648201526084016104d3565b80838381518110610cba57610cba611ab6565b6020026020010181905250508080610cd190611acc565b915050610ba3565b50610ce261154c565b6001600160a01b0316630854ddcf826040518263ffffffff1660e01b8152600401610d0d9190611cae565b600060405180830381865afa158015610d2a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106ec9190810190611d10565b60606000610d5f836104af565b90506000815167ffffffffffffffff811115610d7d57610d7d61177b565b604051908082528060200260200182016040528015610dd257816020015b610dbf60405180606001604052806060815260200160608152602001606081525090565b815260200190600190039081610d9b5790505b5090506000805b83518161ffff161015610e94576000610e01858361ffff1681518110610bc357610bc3611ab6565b90508060400151604051602001610e189190611d59565b604051602081830303815290604052805190602001207fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b14610e8157808484610e6381611acc565b955081518110610e7557610e75611ab6565b60200260200101819052505b5080610e8c81611d75565b915050610dd9565b50604080516020810190915260008082525b828161ffff161015610f9b578160405180604001604052806011815260200170163d913a3930b4ba2fba3cb832911d101160791b815250858361ffff1681518110610ef357610ef3611ab6565b6020026020010151602001516040518060400160405280600d81526020016c111610113b30b63ab2911d101160991b815250878561ffff1681518110610f3b57610f3b611ab6565b60200260200101516040015160405180604001604052806002815260200161227d60f01b815250604051602001610f7796959493929190611d97565b60405160208183030381529060405291508080610f9390611d75565b915050610ea6565b5095945050505050565b600080546040805163b33dfeeb60e01b815290516060936001600160a01b039093169263b33dfeeb92600480820193918290030181865afa158015610fee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261076c9190810190611b1c565b6000546040516330c8446360e21b8152600481018390526060916001600160a01b03169063c321118c9060240161079f565b6000805460405163188f22e960e31b8152600481018690526024810185905260448101849052606092916001600160a01b03169063c47917489060640161098e565b6000805460405163631cae0f60e11b8152600481018490526001600160a01b039091169063c6395c1e90602401602060405180830381865afa1580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e49190611c8c565b60606000611105836105e9565b905060405180606001604052806023815260200161201760239139815160408051606081019091526027808252611ff060208301396020808501516040516111509594939201611e16565b60408051601f1981840301815260608301909152602580835290919061205e6020830139826040015160405180604001604052806003815260200162089f4b60ea1b8152506040516020016111a793929190611e6d565b60408051601f19818403018152908290526111c59291602001611eb0565b604051602081830303815290604052915050919050565b60606127108211156112005760405162461bcd60e51b81526004016104d390611a40565b6000805460405163a9fcd35360e01b8152600481018590526001600160a01b039091169063a9fcd35390602401600060405180830381865afa15801561124a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112729190810190611b1c565b905060405180606001604052806024815260200161203a6024913981604051806040016040528060118152602001701116113232b9b1b934b83a34b7b7111d1160791b8152506112c186610497565b604080518082018252601281527111161132bc3a32b93730b62fbab936111d1160711b6020820152600054915163f428d8f160e01b8152600481018a905290916001600160a01b03169063f428d8f190602401600060405180830381865afa158015611331573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113599190810190611b1c565b604080518082018252600b81526a11161134b6b0b3b2911d1160a91b602082015260005491516366d6cb9960e01b8152600481018c905290916001600160a01b0316906366d6cb9990602401600060405180830381865afa1580156113c2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113ea9190810190611b1c565b604051602001611401989796959493929190611edf565b60408051601f19818403018152828201909152601082526f222c2261747472696275746573223a5b60801b60208301529061143b856110f8565b600054604051631c87be0d60e21b8152600481018890526001600160a01b039091169063721ef83490602401600060405180830381865afa158015611484573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114ac9190810190611b1c565b60005460405163b2e8a28360e01b8152600481018990526001600160a01b039091169063b2e8a28390602401600060405180830381865afa1580156114f5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261151d9190810190611b1c565b604051806040016040528060028152602001615d7d60f01b8152506040516020016111a7959493929190611f84565b60008060009054906101000a90046001600160a01b03166001600160a01b031663d1a583196040518163ffffffff1660e01b8152600401602060405180830381865afa158015610748573d6000803e3d6000fd5b60005460405163f428d8f160e01b8152600481018390526060916001600160a01b03169063f428d8f19060240161079f565b6000602082840312156115e457600080fd5b5035919050565b60005b838110156116065781810151838201526020016115ee565b83811115611615576000848401525b50505050565b600081518084526116338160208601602086016115eb565b601f01601f19169290920160200192915050565b60208152600082516080602084015261166360a084018261161b565b90506020840151601f1980858403016040860152611681838361161b565b9250604086015191508085840301606086015261169e838361161b565b92506060860151915080858403016080860152506116bc828261161b565b95945050505050565b6020815260006116d8602083018461161b565b9392505050565b6020808252825182820181905260009190848201906040850190845b81811015611717578351835292840192918401916001016116fb565b50909695505050505050565b60208152600082516060602084015261173f608084018261161b565b90506020840151601f198085840301604086015261175d838361161b565b92506040860151915080858403016060860152506116bc828261161b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156117ba576117ba61177b565b604052919050565b600067ffffffffffffffff8211156117dc576117dc61177b565b50601f01601f191660200190565b600082601f8301126117fb57600080fd5b813561180e611809826117c2565b611791565b81815284602083860101111561182357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561185557600080fd5b833567ffffffffffffffff81111561186c57600080fd5b611878868287016117ea565b9660208601359650604090950135949350505050565b6040815260006118a1604083018561161b565b90508260208301529392505050565b600080604083850312156118c357600080fd5b823567ffffffffffffffff8111156118da57600080fd5b6118e6858286016117ea565b95602094909401359450505050565b6000806040838503121561190857600080fd5b50508035926020909101359150565b60008060006060848603121561192c57600080fd5b505081359360208301359350604090920135919050565b6000611951611809846117c2565b905082815283838301111561196557600080fd5b6116d88360208301846115eb565b600082601f83011261198457600080fd5b6116d883835160208501611943565b600080600080608085870312156119a957600080fd5b845167ffffffffffffffff808211156119c157600080fd5b6119cd88838901611973565b955060208701519150808211156119e357600080fd5b6119ef88838901611973565b94506040870151915080821115611a0557600080fd5b611a1188838901611973565b93506060870151915080821115611a2757600080fd5b50611a3487828801611973565b91505092959194509250565b6020808252600f908201526e125b9d985b1a59081d1bdad95b9259608a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611a9957611a99611a69565b500290565b60008219821115611ab157611ab1611a69565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611ae057611ae0611a69565b5060010190565b6001600160a01b0381168114611afc57600080fd5b50565b600060208284031215611b1157600080fd5b81516116d881611ae7565b600060208284031215611b2e57600080fd5b815167ffffffffffffffff811115611b4557600080fd5b6106ec84828501611973565b600080600060608486031215611b6657600080fd5b835167ffffffffffffffff80821115611b7e57600080fd5b611b8a87838801611973565b94506020860151915080821115611ba057600080fd5b611bac87838801611973565b93506040860151915080821115611bc257600080fd5b50611bcf86828701611973565b9150509250925092565b600080600060608486031215611bee57600080fd5b8351925060208401519150604084015190509250925092565b606081526000611c1a606083018661161b565b60208301949094525060400152919050565b60008060408385031215611c3f57600080fd5b825167ffffffffffffffff811115611c5657600080fd5b611c6285828601611973565b925050602083015190509250929050565b600060208284031215611c8557600080fd5b5051919050565b600060208284031215611c9e57600080fd5b815180151581146116d857600080fd5b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611d0357603f19888603018452611cf185835161161b565b94509285019290850190600101611cd5565b5092979650505050505050565b600060208284031215611d2257600080fd5b815167ffffffffffffffff811115611d3957600080fd5b8201601f81018413611d4a57600080fd5b6106ec84825160208401611943565b60008251611d6b8184602087016115eb565b9190910192915050565b600061ffff80831681811415611d8d57611d8d611a69565b6001019392505050565b600087516020611daa8285838d016115eb565b885191840191611dbd8184848d016115eb565b8851920191611dcf8184848c016115eb565b8751920191611de18184848b016115eb565b8651920191611df38184848a016115eb565b8551920191611e0581848489016115eb565b919091019998505050505050505050565b60008551611e28818460208a016115eb565b855190830190611e3c818360208a016115eb565b8551910190611e4f8183602089016115eb565b8451910190611e628183602088016115eb565b019695505050505050565b60008451611e7f8184602089016115eb565b845190830190611e938183602089016115eb565b8451910190611ea68183602088016115eb565b0195945050505050565b60008351611ec28184602088016115eb565b835190830190611ed68183602088016115eb565b01949350505050565b600089516020611ef28285838f016115eb565b8a5191840191611f058184848f016115eb565b8a51920191611f178184848e016115eb565b8951920191611f298184848d016115eb565b8851920191611f3b8184848c016115eb565b8751920191611f4d8184848b016115eb565b8651920191611f5f8184848a016115eb565b8551920191611f7181848489016115eb565b919091019b9a5050505050505050505050565b60008651611f96818460208b016115eb565b865190830190611faa818360208b016115eb565b8651910190611fbd818360208a016115eb565b8551910190611fd08183602089016115eb565b8451910190611fe38183602088016115eb565b0197965050505050505056fe227d2c7b2274726169745f74797065223a202253706563696573222c202276616c7565223a20227b2274726169745f74797065223a202254616c656e74222c202276616c7565223a2022646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b226e616d65223a22227d2c7b2274726169745f74797065223a2022436c617373222c202276616c7565223a2022a264697066735822122019fba8445fa8e53b617ff095fc9a2ce9d08924bdf99333eb9cfd98c2141821e164736f6c634300080a0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000fba40a041b615755a8b2741537e8942910e57698

-----Decoded View---------------
Arg [0] : _metadataStorageContract (address): 0xfBa40A041B615755a8B2741537E8942910E57698

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000fba40a041b615755a8b2741537e8942910e57698


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.