ETH Price: $3,373.79 (-1.39%)
Gas: 6 Gwei

Token

Dreams (DREAMS)
 

Overview

Max Total Supply

8 DREAMS

Holders

7

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
tankbottoms.eth
Balance
1 DREAMS
0x5d95baebb8412ad827287240a5c281e3bb30d27e
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
Dreams

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 32 : Dreams.sol
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@jbox/sol/contracts/abstract/JuiceboxProject.sol";
import "./Tiles.sol";

pragma solidity 0.8.6;

contract Dreams is JuiceboxProject, ERC721Enumerable {
    event Mint(address to, uint256 id, address tileAddress);
    event SetBaseURI(string baseURI);

    bool public saleIsActive = false;

    // Map Tile addresses of Dreams to their token ID
    mapping(address => uint256) public idOfAddress;

    // Map Dream token IDs to Tile addresses
    mapping(uint256 => address) public tileAddressOf;

    // Base uri used to retrieve Tile token metadata
    string public baseURI;

    // Tiles contract
    Tiles public immutable tiles;

    uint256 public constant MAX_SUPPLY = 2222;
    uint256 public constant PRICE = 2e16; // 0.02 ETH

    constructor(
        uint256 _projectID,
        ITerminalDirectory _terminalDirectory,
        Tiles _tiles,
        string memory _baseURI
    )
        JuiceboxProject(_projectID, _terminalDirectory)
        ERC721("Dreams", "DREAMS")
    {
        tiles = _tiles;
        baseURI = _baseURI;
    }

    // Get URI used to retrieve metadata for Tile with ID `tokenID`
    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );

        return
            bytes(baseURI).length > 0
                ? string(
                    abi.encodePacked(
                        baseURI,
                        toAsciiString(tileAddressOf[tokenId])
                    ) // Convert address to string before encoding
                )
                : "";
    }

    // Get IDs for all tokens owned by `_owner`
    function tokensOfOwner(address _owner)
        external
        view
        returns (uint256[] memory)
    {
        uint256 tokenCount = balanceOf(_owner);
        if (tokenCount == 0) {
            // Return an empty array
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](tokenCount);
            uint256 index;
            for (index = 0; index < tokenCount; index++) {
                result[index] = tokenOfOwnerByIndex(_owner, index);
            }
            return result;
        }
    }

    // Mint Dream for `tileAddress` to `msg.sender`
    function mint(address tileAddress) external payable returns (uint256) {
        require(saleIsActive, "Sale has not started");
        require(totalSupply() < MAX_SUPPLY, "All dreams have been minted.");
        require(idOfAddress[tileAddress] == 0, "Tile has already been dreamt");
        require(
            tiles.ownerOf(tiles.idOfAddress(tileAddress)) == msg.sender,
            "Sender does not own this Tile."
        );
        require(msg.value >= PRICE, "Ether value sent is below the price");

        // Take fee into Juicebox treasury
        _takeFee(
            msg.value,
            msg.sender,
            string(
                abi.encodePacked("Dreamt of Tile ", toAsciiString(tileAddress))
            ),
            false
        );

        // Start IDs at 1
        uint256 tokenId = totalSupply() + 1;
        // Map Tile address to token ID
        idOfAddress[tileAddress] = tokenId;
        // Map token ID to Tile address
        tileAddressOf[tokenId] = tileAddress;

        _safeMint(msg.sender, tokenId);

        emit Mint(msg.sender, tokenId, tileAddress);

        return tokenId;
    }

    //
    // Owner functions
    //

    function startSale() external onlyOwner {
        require(saleIsActive == false, "Sale is already active");
        saleIsActive = true;
    }

    function pauseSale() external onlyOwner {
        require(saleIsActive == true, "Sale is already inactive");
        saleIsActive = false;
    }

    function setBaseURI(string memory _baseURI) external onlyOwner {
        baseURI = _baseURI;
        emit SetBaseURI(_baseURI);
    }

    function toAsciiString(address x) internal pure returns (string memory) {
        bytes memory s = new bytes(40);
        for (uint256 i = 0; i < 20; i++) {
            bytes1 b = bytes1(uint8(uint256(uint160(x)) / (2**(8 * (19 - i)))));
            bytes1 hi = bytes1(uint8(b) / 16);
            bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi));
            s[2 * i] = char(hi);
            s[2 * i + 1] = char(lo);
        }
        return string(s);
    }

    function char(bytes1 b) internal pure returns (bytes1 c) {
        if (uint8(b) < 10) return bytes1(uint8(b) + 0x30);
        else return bytes1(uint8(b) + 0x57);
    }
}

File 2 of 32 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping (uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping (address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping (uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping (address => mapping (address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC721).interfaceId
            || interfaceId == type(IERC721Metadata).interfaceId
            || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0
            ? string(abi.encodePacked(baseURI, tokenId.toString()))
            : '';
    }

    /**
     * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
     * in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    // solhint-disable-next-line no-inline-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}

File 3 of 32 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return interfaceId == type(IERC721Enumerable).interfaceId
            || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 4 of 32 : JuiceboxProject.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";

import "./../interfaces/IJuicer.sol";

/** 
  @notice A contract that inherits from JuiceboxProject can use Juicebox as a business-model-as-a-service.
  @dev The owner of the contract makes admin decisions such as:
    - Which address is the funding cycle owner, which can tap funds from the funding cycle.
    - Should this project's Tickets be migrated to a new Juicer. 
*/
abstract contract JuiceboxProject is IERC721Receiver, Ownable {
    /// @notice The direct deposit terminals.
    ITerminalDirectory public immutable terminalDirectory;

    /// @notice The ID of the project that should be used to forward this contract's received payments.
    uint256 public projectId;

    /** 
      @param _projectId The ID of the project that should be used to forward this contract's received payments.
      @param _terminalDirectory A directory of a project's current Juicebox terminal to receive payments in.
    */
    constructor(uint256 _projectId, ITerminalDirectory _terminalDirectory) {
        projectId = _projectId;
        terminalDirectory = _terminalDirectory;
    }

    receive() external payable {}

    /** 
      @notice Withdraws funds stored in this contract.
      @param _beneficiary The address to send the funds to.
      @param _amount The amount to send.
    */
    function withdraw(address payable _beneficiary, uint256 _amount)
        external
        onlyOwner
    {
        Address.sendValue(_beneficiary, _amount);
    }

    /** 
      @notice Allows the project that is being managed to be set.
      @param _projectId The ID of the project that is being managed.
    */
    function setProjectId(uint256 _projectId) external onlyOwner {
        projectId = _projectId;
    }

    /** 
      @notice Make a payment to this project.
      @param _beneficiary The address who will receive tickets from this fee.
      @param _memo A memo that will be included in the published event.
      @param _preferUnstakedTickets Whether ERC20's should be claimed automatically if they have been issued.
    */
    function pay(
        address _beneficiary,
        string calldata _memo,
        bool _preferUnstakedTickets
    ) external payable {
        require(projectId != 0, "JuiceboxProject::pay: PROJECT_NOT_FOUND");

        // Get the terminal for this contract's project.
        ITerminal _terminal = terminalDirectory.terminalOf(projectId);

        // There must be a terminal.
        require(
            _terminal != ITerminal(address(0)),
            "JuiceboxProject::pay: TERMINAL_NOT_FOUND"
        );

        _terminal.pay{value: msg.value}(
            projectId,
            _beneficiary,
            _memo,
            _preferUnstakedTickets
        );
    }

    /** 
        @notice Transfer the ownership of the project to a new owner.  
        @dev This contract will no longer be able to reconfigure or tap funds from this project.
        @param _projects The projects contract.
        @param _newOwner The new project owner.
        @param _projectId The ID of the project to transfer ownership of.
        @param _data Arbitrary data to include in the transaction.
    */
    function transferProjectOwnership(
        IProjects _projects,
        address _newOwner,
        uint256 _projectId,
        bytes calldata _data
    ) external onlyOwner {
        _projects.safeTransferFrom(address(this), _newOwner, _projectId, _data);
    }

    /** 
      @notice Allows this contract to receive a project.
    */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes calldata
    ) public pure override returns (bytes4) {
        return this.onERC721Received.selector;
    }

    function setOperator(
        IOperatorStore _operatorStore,
        address _operator,
        uint256 _projectId,
        uint256[] calldata _permissionIndexes
    ) external onlyOwner {
        _operatorStore.setOperator(_operator, _projectId, _permissionIndexes);
    }

    function setOperators(
        IOperatorStore _operatorStore,
        address[] calldata _operators,
        uint256[] calldata _projectIds,
        uint256[][] calldata _permissionIndexes
    ) external onlyOwner {
        _operatorStore.setOperators(
            _operators,
            _projectIds,
            _permissionIndexes
        );
    }

    /** 
      @notice Take a fee for this project from this contract.
      @param _amount The payment amount.
      @param _beneficiary The address who will receive tickets from this fee.
      @param _memo A memo that will be included in the published event.
      @param _preferUnstakedTickets Whether ERC20's should be claimed automatically if they have been issued.
    */
    function _takeFee(
        uint256 _amount,
        address _beneficiary,
        string memory _memo,
        bool _preferUnstakedTickets
    ) internal {
        require(projectId != 0, "JuiceboxProject::takeFee: PROJECT_NOT_FOUND");
        // Find the terminal for this contract's project.
        ITerminal _terminal = terminalDirectory.terminalOf(projectId);

        // There must be a terminal.
        require(
            _terminal != ITerminal(address(0)),
            "JuiceboxProject::takeFee: TERMINAL_NOT_FOUND"
        );

        // There must be enough funds in the contract to take the fee.
        require(
            address(this).balance >= _amount,
            "JuiceboxProject::takeFee: INSUFFICIENT_FUNDS"
        );

        // Send funds to the terminal.
        _terminal.pay{value: _amount}(
            projectId,
            _beneficiary,
            _memo,
            _preferUnstakedTickets
        );
    }
}

File 5 of 32 : Tiles.sol
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@jbox/sol/contracts/abstract/JuiceboxProject.sol";

pragma solidity 0.8.6;

contract Tiles is JuiceboxProject, ERC721Enumerable {
    using SafeMath for uint256;

    event Mint(address to, address tileAddress);
    event SetBaseURI(string baseURI);

    bool public saleIsActive = false;

    // Limit the total number of reserve Tiles that can be minted by the owner
    uint256 public mintedReservesLimit = 50;
    uint256 public mintedReservesCount = 0;

    // Map Tile addresses to their token ID
    mapping(address => uint256) public idOfAddress;

    // Map token IDs to Tile addresses
    mapping(uint256 => address) public tileAddressOf;

    // Base uri used to retrieve Tile token metadata
    string public baseURI;

    constructor(
        uint256 _projectID,
        ITerminalDirectory _terminalDirectory,
        string memory _baseURI
    ) JuiceboxProject(_projectID, _terminalDirectory) ERC721("Tiles", "TILES") {
        baseURI = _baseURI;
    }

    // Get URI used to retrieve metadata for Tile with ID `tokenID`
    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );

        return
            bytes(baseURI).length > 0
                ? string(
                    abi.encodePacked(
                        baseURI,
                        toAsciiString(tileAddressOf[tokenId])
                    ) // Convert address to string before encoding
                )
                : "";
    }

    // Get IDs for all tokens owned by `_owner`
    function tokensOfOwner(address _owner)
        external
        view
        returns (uint256[] memory)
    {
        uint256 tokenCount = balanceOf(_owner);
        if (tokenCount == 0) {
            // Return an empty array
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](tokenCount);
            uint256 index;
            for (index = 0; index < tokenCount; index++) {
                result[index] = tokenOfOwnerByIndex(_owner, index);
            }
            return result;
        }
    }

    // Calculate the current Tile market price based on current supply
    function calculatePrice() public view returns (uint256) {
        require(saleIsActive == true, "Sale hasn't started");

        uint256 currentSupply = totalSupply();

        if (currentSupply >= 102400) {
            return 10240000000000000000; // 102,401 - ∞ : 10.24 ETH
        } else if (currentSupply >= 51200) {
            return 5120000000000000000; // 51,201 - 102,400 : 5.12 ETH
        } else if (currentSupply >= 25600) {
            return 2560000000000000000; // 25,601 - 51,200 : 2.56 ETH
        } else if (currentSupply >= 12800) {
            return 1280000000000000000; // 12,801 - 25,600 : 1.28 ETH
        } else if (currentSupply >= 6400) {
            return 640000000000000000; // 6,401 - 12,800 : 0.64 ETH
        } else if (currentSupply >= 3200) {
            return 320000000000000000; // 3,201 - 6,400 : 0.32 ETH
        } else if (currentSupply >= 1600) {
            return 160000000000000000; // 1,601 - 3,200 : 0.16 ETH
        } else if (currentSupply >= 800) {
            return 80000000000000000; // 801 - 1600 : 0.08 ETH
        } else if (currentSupply >= 400) {
            return 40000000000000000; // 401 - 800 : 0.04 ETH
        } else if (currentSupply >= 200) {
            return 20000000000000000; // 201 - 400 : 0.02 ETH
        } else {
            return 10000000000000000; // 1 - 200 : 0.01 ETH
        }
    }

    // Mint Tile for address `_tileAddress` to `msg.sender`
    function mintTile(address _tileAddress) external payable returns (uint256) {
        require(
            msg.value >= calculatePrice(),
            "Ether value sent is below the price"
        );

        // Take fee into TileDAO Juicebox treasury
        _takeFee(
            msg.value,
            msg.sender,
            string(
                abi.encodePacked(
                    "Minted Tile with address ",
                    toAsciiString(_tileAddress)
                )
            ),
            false
        );

        return _mintTile(msg.sender, _tileAddress);
    }

    // If a wallet owner's matching Tile has been minted already, they may collect it from its current owner by paying the owner the current market price.
    function collectTile() external payable {
        uint256 tokenId = idOfAddress[msg.sender];
        require(tokenId != 0, "Tile for sender address has not been minted");

        address owner = ownerOf(tokenId);
        require(owner != msg.sender, "Sender already owns this Tile");
        require(
            msg.value >= calculatePrice(),
            "Ether value sent is below the price"
        );

        require(payable(owner).send(msg.value));

        _transfer(owner, msg.sender, tokenId);
    }

    function _mintTile(address to, address _tileAddress)
        private
        returns (uint256)
    {
        require(
            idOfAddress[_tileAddress] == 0,
            "Tile already minted for address"
        );

        // Start IDs at 1
        uint256 tokenId = totalSupply() + 1;

        _safeMint(to, tokenId);

        // Map Tile address to token ID
        idOfAddress[_tileAddress] = tokenId;
        // Map token ID to Tile address
        tileAddressOf[tokenId] = _tileAddress;

        emit Mint(to, _tileAddress);

        return tokenId;
    }

    //
    // Owner functions
    //

    function startSale() external onlyOwner {
        require(saleIsActive == false, "Sale is already active");
        saleIsActive = true;
    }

    function pauseSale() external onlyOwner {
        require(saleIsActive == true, "Sale is already inactive");
        saleIsActive = false;
    }

    function setBaseURI(string memory _baseURI) external onlyOwner {
        baseURI = _baseURI;
        emit SetBaseURI(_baseURI);
    }

    // Reserved for promotional giveaways, and rewards to those who helped inspire or enable Tiles.
    // Owner may mint Tile for `_tileAddress` to `to`
    function mintReserveTile(address to, address _tileAddress)
        external
        onlyOwner
        returns (uint256)
    {
        require(
            mintedReservesCount < mintedReservesLimit,
            "Reserves limit exceeded"
        );

        mintedReservesCount = mintedReservesCount + 1;

        return _mintTile(to, _tileAddress);
    }

    function toAsciiString(address x) internal pure returns (string memory) {
        bytes memory s = new bytes(40);
        for (uint256 i = 0; i < 20; i++) {
            bytes1 b = bytes1(uint8(uint256(uint160(x)) / (2**(8 * (19 - i)))));
            bytes1 hi = bytes1(uint8(b) / 16);
            bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi));
            s[2 * i] = char(hi);
            s[2 * i + 1] = char(lo);
        }
        return string(s);
    }

    function char(bytes1 b) internal pure returns (bytes1 c) {
        if (uint8(b) < 10) return bytes1(uint8(b) + 0x30);
        else return bytes1(uint8(b) + 0x57);
    }
}

File 6 of 32 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
      * - `from` cannot be the zero address.
      * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

File 7 of 32 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}

File 8 of 32 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {

    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 9 of 32 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 of 32 : Context.sol
// SPDX-License-Identifier: MIT

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) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 11 of 32 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

}

File 12 of 32 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 13 of 32 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 14 of 32 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 15 of 32 : Ownable.sol
// SPDX-License-Identifier: MIT

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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 16 of 32 : IJuicer.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "./ITicketBooth.sol";
import "./IFundingCycles.sol";
import "./IYielder.sol";
import "./IProjects.sol";
import "./IModStore.sol";
import "./ITerminal.sol";
import "./IOperatorStore.sol";

struct FundingCycleMetadata {
    uint256 reservedRate;
    uint256 bondingCurveRate;
    uint256 reconfigurationBondingCurveRate;
}

interface IJuicer {
    event Configure(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        address caller
    );

    event Tap(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        address indexed beneficiary,
        uint256 amount,
        uint256 currency,
        uint256 netTransferAmount,
        uint256 beneficiaryTransferAmount,
        uint256 govFeeAmount,
        address caller
    );
    event Redeem(
        address indexed holder,
        address indexed beneficiary,
        uint256 indexed _projectId,
        uint256 amount,
        uint256 returnAmount,
        address caller
    );

    event PrintReserveTickets(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        address indexed beneficiary,
        uint256 count,
        uint256 beneficiaryTicketAmount,
        address caller
    );

    event DistributeToPayoutMod(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        PaymentMod mod,
        uint256 modCut,
        address caller
    );
    event DistributeToTicketMod(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        TicketMod mod,
        uint256 modCut,
        address caller
    );
    event AppointGovernance(address governance);

    event AcceptGovernance(address governance);

    event PrintPreminedTickets(
        uint256 indexed projectId,
        address indexed beneficiary,
        uint256 amount,
        uint256 currency,
        string memo,
        address caller
    );

    event Deposit(uint256 amount);

    event EnsureTargetLocalWei(uint256 target);

    event SetYielder(IYielder newYielder);

    event SetFee(uint256 _amount);

    event SetTargetLocalWei(uint256 amount);

    function governance() external view returns (address payable);

    function pendingGovernance() external view returns (address payable);

    function projects() external view returns (IProjects);

    function fundingCycles() external view returns (IFundingCycles);

    function ticketBooth() external view returns (ITicketBooth);

    function prices() external view returns (IPrices);

    function modStore() external view returns (IModStore);

    function reservedTicketBalanceOf(uint256 _projectId, uint256 _reservedRate)
        external
        view
        returns (uint256);

    function canPrintPreminedTickets(uint256 _projectId)
        external
        view
        returns (bool);

    function balanceOf(uint256 _projectId) external view returns (uint256);

    function currentOverflowOf(uint256 _projectId)
        external
        view
        returns (uint256);

    function claimableOverflowOf(
        address _account,
        uint256 _amount,
        uint256 _projectId
    ) external view returns (uint256);

    function fee() external view returns (uint256);

    function deploy(
        address _owner,
        bytes32 _handle,
        string calldata _uri,
        FundingCycleProperties calldata _properties,
        FundingCycleMetadata calldata _metadata,
        PaymentMod[] memory _paymentMods,
        TicketMod[] memory _ticketMods
    ) external;

    function configure(
        uint256 _projectId,
        FundingCycleProperties calldata _properties,
        FundingCycleMetadata calldata _metadata,
        PaymentMod[] memory _paymentMods,
        TicketMod[] memory _ticketMods
    ) external returns (uint256);

    function printPreminedTickets(
        uint256 _projectId,
        uint256 _amount,
        uint256 _currency,
        address _beneficiary,
        string memory _memo,
        bool _preferUnstakedTickets
    ) external;

    function tap(
        uint256 _projectId,
        uint256 _amount,
        uint256 _currency,
        uint256 _minReturnedWei
    ) external returns (uint256);

    function redeem(
        address _account,
        uint256 _projectId,
        uint256 _amount,
        uint256 _minReturnedWei,
        address payable _beneficiary,
        bool _preferUnstaked
    ) external returns (uint256 returnAmount);

    function printReservedTickets(uint256 _projectId)
        external
        returns (uint256 reservedTicketsToPrint);

    function setFee(uint256 _fee) external;

    function appointGovernance(address payable _pendingGovernance) external;

    function acceptGovernance() external;
}

File 17 of 32 : ITicketBooth.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "./IProjects.sol";
import "./IOperatorStore.sol";
import "./ITickets.sol";

interface ITicketBooth {
    event Issue(
        uint256 indexed projectId,
        string name,
        string symbol,
        address caller
    );
    event Print(
        address indexed holder,
        uint256 indexed projectId,
        uint256 amount,
        bool convertedTickets,
        bool preferUnstakedTickets,
        address controller
    );

    event Redeem(
        address indexed holder,
        uint256 indexed projectId,
        uint256 amount,
        uint256 stakedTickets,
        bool preferUnstaked,
        address controller
    );

    event Stake(
        address indexed holder,
        uint256 indexed projectId,
        uint256 amount,
        address caller
    );

    event Unstake(
        address indexed holder,
        uint256 indexed projectId,
        uint256 amount,
        address caller
    );

    event Lock(
        address indexed holder,
        uint256 indexed projectId,
        uint256 amount,
        address caller
    );

    event Unlock(
        address indexed holder,
        uint256 indexed projectId,
        uint256 amount,
        address caller
    );

    event Transfer(
        address indexed holder,
        uint256 indexed projectId,
        address indexed recipient,
        uint256 amount,
        address caller
    );

    function ticketsOf(uint256 _projectId) external view returns (ITickets);

    function projects() external view returns (IProjects);

    function lockedBalanceOf(address _holder, uint256 _projectId)
        external
        view
        returns (uint256);

    function lockedBalanceBy(
        address _operator,
        address _holder,
        uint256 _projectId
    ) external view returns (uint256);

    function stakedBalanceOf(address _holder, uint256 _projectId)
        external
        view
        returns (uint256);

    function stakedTotalSupplyOf(uint256 _projectId)
        external
        view
        returns (uint256);

    function totalSupplyOf(uint256 _projectId) external view returns (uint256);

    function balanceOf(address _holder, uint256 _projectId)
        external
        view
        returns (uint256 _result);

    function issue(
        uint256 _projectId,
        string calldata _name,
        string calldata _symbol
    ) external;

    function print(
        address _holder,
        uint256 _projectId,
        uint256 _amount,
        bool _preferUnstakedTickets
    ) external;

    function redeem(
        address _holder,
        uint256 _projectId,
        uint256 _amount,
        bool _preferUnstaked
    ) external;

    function stake(
        address _holder,
        uint256 _projectId,
        uint256 _amount
    ) external;

    function unstake(
        address _holder,
        uint256 _projectId,
        uint256 _amount
    ) external;

    function lock(
        address _holder,
        uint256 _projectId,
        uint256 _amount
    ) external;

    function unlock(
        address _holder,
        uint256 _projectId,
        uint256 _amount
    ) external;

    function transfer(
        address _holder,
        uint256 _projectId,
        uint256 _amount,
        address _recipient
    ) external;
}

File 18 of 32 : IFundingCycles.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "./IPrices.sol";
import "./IProjects.sol";
import "./IFundingCycleBallot.sol";

/// @notice The funding cycle structure represents a project stewarded by an address, and accounts for which addresses have helped sustain the project.
struct FundingCycle {
    // A unique number that's incremented for each new funding cycle, starting with 1.
    uint256 id;
    // The ID of the project contract that this funding cycle belongs to.
    uint256 projectId;
    // The number of this funding cycle for the project.
    uint256 number;
    // The ID of a previous funding cycle that this one is based on.
    uint256 basedOn;
    // The time when this funding cycle was last configured.
    uint256 configured;
    // The number of cycles that this configuration should last for before going back to the last permanent.
    uint256 cycleLimit;
    // A number determining the amount of redistribution shares this funding cycle will issue to each sustainer.
    uint256 weight;
    // The ballot contract to use to determine a subsequent funding cycle's reconfiguration status.
    IFundingCycleBallot ballot;
    // The time when this funding cycle will become active.
    uint256 start;
    // The number of seconds until this funding cycle's surplus is redistributed.
    uint256 duration;
    // The amount that this funding cycle is targeting in terms of the currency.
    uint256 target;
    // The currency that the target is measured in.
    uint256 currency;
    // The percentage of each payment to send as a fee to the Juicebox admin.
    uint256 fee;
    // A percentage indicating how much more weight to give a funding cycle compared to its predecessor.
    uint256 discountRate;
    // The amount of available funds that have been tapped by the project in terms of the currency.
    uint256 tapped;
    // A packed list of extra data. The first 8 bytes are reserved for versioning.
    uint256 metadata;
}

struct FundingCycleProperties {
    uint256 target;
    uint256 currency;
    uint256 duration;
    uint256 cycleLimit;
    uint256 discountRate;
    IFundingCycleBallot ballot;
}

interface IFundingCycles {
    event Configure(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        uint256 reconfigured,
        FundingCycleProperties _properties,
        uint256 metadata,
        address caller
    );

    event Tap(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        uint256 amount,
        uint256 newTappedAmount,
        address caller
    );

    event Init(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        uint256 number,
        uint256 previous,
        uint256 weight,
        uint256 start
    );

    function latestIdOf(uint256 _projectId) external view returns (uint256);

    function count() external view returns (uint256);

    function BASE_WEIGHT() external view returns (uint256);

    function MAX_CYCLE_LIMIT() external view returns (uint256);

    function get(uint256 _fundingCycleId)
        external
        view
        returns (FundingCycle memory);

    function queuedOf(uint256 _projectId)
        external
        view
        returns (FundingCycle memory);

    function currentOf(uint256 _projectId)
        external
        view
        returns (FundingCycle memory);

    function currentBallotStateOf(uint256 _projectId)
        external
        view
        returns (BallotState);

    function configure(
        uint256 _projectId,
        FundingCycleProperties calldata _properties,
        uint256 _metadata,
        uint256 _fee,
        bool _configureActiveFundingCycle
    ) external returns (FundingCycle memory fundingCycle);

    function tap(uint256 _projectId, uint256 _amount)
        external
        returns (FundingCycle memory fundingCycle);
}

File 19 of 32 : IYielder.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "./IJuicer.sol";

// In constructure, give unlimited access for Juicer to take money from this.
interface IYielder {
    function deposited() external view returns (uint256);

    function getCurrentBalance() external view returns (uint256);

    function deposit() external payable;

    function withdraw(uint256 _amount, address payable _beneficiary) external;

    function withdrawAll(address payable _beneficiary)
        external
        returns (uint256);
}

File 20 of 32 : IProjects.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "./ITerminal.sol";
import "./IOperatorStore.sol";

interface IProjects is IERC721 {
    event Create(
        uint256 indexed projectId,
        address indexed owner,
        bytes32 indexed handle,
        string uri,
        ITerminal terminal,
        address caller
    );

    event SetHandle(
        uint256 indexed projectId,
        bytes32 indexed handle,
        address caller
    );

    event SetUri(uint256 indexed projectId, string uri, address caller);

    event TransferHandle(
        uint256 indexed projectId,
        address indexed to,
        bytes32 indexed handle,
        bytes32 newHandle,
        address caller
    );

    event ClaimHandle(
        address indexed account,
        uint256 indexed projectId,
        bytes32 indexed handle,
        address caller
    );

    event ChallengeHandle(
        bytes32 indexed handle,
        uint256 challengeExpiry,
        address caller
    );

    event RenewHandle(
        bytes32 indexed handle,
        uint256 indexed projectId,
        address caller
    );

    function count() external view returns (uint256);

    function uriOf(uint256 _projectId) external view returns (string memory);

    function handleOf(uint256 _projectId) external returns (bytes32 handle);

    function projectFor(bytes32 _handle) external returns (uint256 projectId);

    function transferAddressFor(bytes32 _handle)
        external
        returns (address receiver);

    function challengeExpiryOf(bytes32 _handle) external returns (uint256);

    function exists(uint256 _projectId) external view returns (bool);

    function create(
        address _owner,
        bytes32 _handle,
        string calldata _uri,
        ITerminal _terminal
    ) external returns (uint256 id);

    function setHandle(uint256 _projectId, bytes32 _handle) external;

    function setUri(uint256 _projectId, string calldata _uri) external;

    function transferHandle(
        uint256 _projectId,
        address _to,
        bytes32 _newHandle
    ) external returns (bytes32 _handle);

    function claimHandle(
        bytes32 _handle,
        address _for,
        uint256 _projectId
    ) external;
}

File 21 of 32 : IModStore.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "./IOperatorStore.sol";
import "./IProjects.sol";
import "./IModAllocator.sol";

struct PaymentMod {
    bool preferUnstaked;
    uint16 percent;
    uint48 lockedUntil;
    address payable beneficiary;
    IModAllocator allocator;
    uint56 projectId;
}

struct TicketMod {
    bool preferUnstaked;
    uint16 percent;
    uint48 lockedUntil;
    address payable beneficiary;
}

interface IModStore {
    event SetPaymentMod(
        uint256 indexed projectId,
        uint256 indexed configuration,
        PaymentMod mods,
        address caller
    );

    event SetTicketMod(
        uint256 indexed projectId,
        uint256 indexed configuration,
        TicketMod mods,
        address caller
    );

    function projects() external view returns (IProjects);

    function paymentModsOf(uint256 _projectId, uint256 _configuration)
        external
        view
        returns (PaymentMod[] memory);

    function ticketModsOf(uint256 _projectId, uint256 _configuration)
        external
        view
        returns (TicketMod[] memory);

    function setPaymentMods(
        uint256 _projectId,
        uint256 _configuration,
        PaymentMod[] memory _mods
    ) external;

    function setTicketMods(
        uint256 _projectId,
        uint256 _configuration,
        TicketMod[] memory _mods
    ) external;
}

File 22 of 32 : ITerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "./ITerminalDirectory.sol";

interface ITerminal {
    event Pay(
        uint256 indexed fundingCycleId,
        uint256 indexed projectId,
        address indexed beneficiary,
        uint256 amount,
        string note,
        address caller
    );

    event AddToBalance(
        uint256 indexed projectId,
        uint256 value,
        address caller
    );

    event AllowMigration(ITerminal allowed);

    event Migrate(
        uint256 indexed projectId,
        ITerminal indexed to,
        uint256 _amount,
        address caller
    );

    function terminalDirectory() external view returns (ITerminalDirectory);

    function migrationIsAllowed(ITerminal _terminal)
        external
        view
        returns (bool);

    function pay(
        uint256 _projectId,
        address _beneficiary,
        string calldata _memo,
        bool _preferUnstakedTickets
    ) external payable returns (uint256 fundingCycleId);

    function addToBalance(uint256 _projectId) external payable;

    function allowMigration(ITerminal _contract) external;

    function migrate(uint256 _projectId, ITerminal _to) external;
}

File 23 of 32 : IOperatorStore.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

interface IOperatorStore {
    event SetOperator(
        address indexed operator,
        address indexed account,
        uint256 indexed domain,
        uint256[] permissionIndexes,
        uint256 packed
    );

    function permissionsOf(
        address _operator,
        address _account,
        uint256 _domain
    ) external view returns (uint256);

    function hasPermission(
        address _operator,
        address _account,
        uint256 _domain,
        uint256 _permissionIndex
    ) external view returns (bool);

    function hasPermissions(
        address _operator,
        address _account,
        uint256 _domain,
        uint256[] calldata _permissionIndexes
    ) external view returns (bool);

    function setOperator(
        address _operator,
        uint256 _domain,
        uint256[] calldata _permissionIndexes
    ) external;

    function setOperators(
        address[] calldata _operators,
        uint256[] calldata _domains,
        uint256[][] calldata _permissionIndexes
    ) external;
}

File 24 of 32 : ITickets.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface ITickets is IERC20 {
    function print(address _account, uint256 _amount) external;

    function redeem(address _account, uint256 _amount) external;
}

File 25 of 32 : ITerminalDirectory.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "./IDirectPaymentAddress.sol";
import "./ITerminal.sol";
import "./IProjects.sol";
import "./IProjects.sol";

interface ITerminalDirectory {
    event DeployAddress(
        uint256 indexed projectId,
        string memo,
        address indexed caller
    );

    event SetTerminal(
        uint256 indexed projectId,
        ITerminal indexed terminal,
        address caller
    );

    event SetPayerPreferences(
        address indexed account,
        address beneficiary,
        bool preferUnstakedTickets
    );

    function projects() external view returns (IProjects);

    function terminalOf(uint256 _projectId) external view returns (ITerminal);

    function beneficiaryOf(address _account) external returns (address);

    function unstakedTicketsPreferenceOf(address _account)
        external
        returns (bool);

    function addressesOf(uint256 _projectId)
        external
        view
        returns (IDirectPaymentAddress[] memory);

    function deployAddress(uint256 _projectId, string calldata _memo) external;

    function setTerminal(uint256 _projectId, ITerminal _terminal) external;

    function setPayerPreferences(
        address _beneficiary,
        bool _preferUnstakedTickets
    ) external;
}

File 26 of 32 : IDirectPaymentAddress.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "./ITerminalDirectory.sol";
import "./ITerminal.sol";

interface IDirectPaymentAddress {
    event Forward(
        address indexed payer,
        uint256 indexed projectId,
        address beneficiary,
        uint256 value,
        string memo,
        bool preferUnstakedTickets
    );

    function terminalDirectory() external returns (ITerminalDirectory);

    function projectId() external returns (uint256);

    function memo() external returns (string memory);
}

File 27 of 32 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 28 of 32 : IPrices.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

interface IPrices {
    event AddFeed(uint256 indexed currency, AggregatorV3Interface indexed feed);

    function feedDecimalAdjuster(uint256 _currency) external returns (uint256);

    function targetDecimals() external returns (uint256);

    function feedFor(uint256 _currency)
        external
        returns (AggregatorV3Interface);

    function getETHPriceFor(uint256 _currency) external view returns (uint256);

    function addFeed(AggregatorV3Interface _priceFeed, uint256 _currency)
        external;
}

File 29 of 32 : IFundingCycleBallot.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "./IJuicer.sol";

enum BallotState {
    Approved,
    Active,
    Failed,
    Standby
}

interface IFundingCycleBallot {
    function duration() external view returns (uint256);

    function state(uint256 _fundingCycleId, uint256 _configured)
        external
        view
        returns (BallotState);
}

File 30 of 32 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

interface AggregatorV3Interface {

  function decimals() external view returns (uint8);
  function description() external view returns (string memory);
  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

}

File 31 of 32 : IModAllocator.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

interface IModAllocator {
    event Allocate(
        uint256 indexed projectId,
        uint256 indexed forProjectId,
        address indexed beneficiary,
        uint256 amount,
        address caller
    );

    function allocate(
        uint256 _projectId,
        uint256 _forProjectId,
        address _beneficiary
    ) external payable;
}

File 32 of 32 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_projectID","type":"uint256"},{"internalType":"contract ITerminalDirectory","name":"_terminalDirectory","type":"address"},{"internalType":"contract Tiles","name":"_tiles","type":"address"},{"internalType":"string","name":"_baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"tileAddress","type":"address"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"SetBaseURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"idOfAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tileAddress","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"string","name":"_memo","type":"string"},{"internalType":"bool","name":"_preferUnstakedTickets","type":"bool"}],"name":"pay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"projectId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleIsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOperatorStore","name":"_operatorStore","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"uint256[]","name":"_permissionIndexes","type":"uint256[]"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOperatorStore","name":"_operatorStore","type":"address"},{"internalType":"address[]","name":"_operators","type":"address[]"},{"internalType":"uint256[]","name":"_projectIds","type":"uint256[]"},{"internalType":"uint256[][]","name":"_permissionIndexes","type":"uint256[][]"}],"name":"setOperators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"}],"name":"setProjectId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"terminalDirectory","outputs":[{"internalType":"contract ITerminalDirectory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tileAddressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tiles","outputs":[{"internalType":"contract Tiles","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IProjects","name":"_projects","type":"address"},{"internalType":"address","name":"_newOwner","type":"address"},{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"transferProjectOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c0604052600c805460ff191690553480156200001b57600080fd5b506040516200392a3803806200392a8339810160408190526200003e91620001fa565b60405180604001604052806006815260200165447265616d7360d01b81525060405180604001604052806006815260200165445245414d5360d01b81525085856000620000906200015060201b60201c565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060019190915560601b6001600160601b03191660805281516200010590600290602085019062000154565b5080516200011b90600390602084019062000154565b5050506001600160601b0319606083901b1660a05280516200014590600f90602084019062000154565b505050505062000377565b3390565b82805462000162906200030b565b90600052602060002090601f016020900481019282620001865760008555620001d1565b82601f10620001a157805160ff1916838001178555620001d1565b82800160010185558215620001d1579182015b82811115620001d1578251825591602001919060010190620001b4565b50620001df929150620001e3565b5090565b5b80821115620001df5760008155600101620001e4565b600080600080608085870312156200021157600080fd5b8451935060208086015162000226816200035e565b604087015190945062000239816200035e565b60608701519093506001600160401b03808211156200025757600080fd5b818801915088601f8301126200026c57600080fd5b81518181111562000281576200028162000348565b604051601f8201601f19908116603f01168101908382118183101715620002ac57620002ac62000348565b816040528281528b86848701011115620002c557600080fd5b600093505b82841015620002e95784840186015181850187015292850192620002ca565b82841115620002fb5760008684830101525b989b979a50959850505050505050565b600181811c908216806200032057607f821691505b602082108114156200034257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200037457600080fd5b50565b60805160601c60a05160601c613572620003b8600039600081816105f20152610ece0152600081816104a60152818161141a0152611f9101526135726000f3fe60806040526004361061023f5760003560e01c8063715018a61161012e578063b88d4fde116100ab578063e985e9c51161006f578063e985e9c5146106d6578063eb8d24441461071f578063f2ec575514610739578063f2fde38b1461076f578063f3fef3a31461078f57600080fd5b8063b88d4fde14610629578063bc8c30c514610649578063c0a485e214610676578063c87b56dd14610696578063ce9246dd146106b657600080fd5b806395d89b41116100f257806395d89b411461058b578063999a244f146105a0578063a22cb465146105c0578063b2e0a100146105e0578063b66a0e5d1461061457600080fd5b8063715018a6146104fd5780638462151c14610512578063897c063e1461053f5780638d859f3e146105525780638da5cb5b1461056d57600080fd5b806342842e0e116101bc5780636352211e116101805780636352211e146104615780636a627842146104815780636abcf8e3146104945780636c0360eb146104c857806370a08231146104dd57600080fd5b806342842e0e146103cc5780634f6ccce7146103ec578063544c0e151461040c57806355367ba91461042c57806355f804b31461044157600080fd5b806318160ddd1161020357806318160ddd1461034157806323b872dd146103605780632f745c591461038057806332cb6b0c146103a05780633fafa127146103b657600080fd5b806301ffc9a71461024b57806306fdde0314610280578063081812fc146102a2578063095ea7b3146102da578063150b7a02146102fc57600080fd5b3661024657005b600080fd5b34801561025757600080fd5b5061026b610266366004612bb9565b6107af565b60405190151581526020015b60405180910390f35b34801561028c57600080fd5b506102956107da565b60405161027791906130e5565b3480156102ae57600080fd5b506102c26102bd366004612d4b565b61086c565b6040516001600160a01b039091168152602001610277565b3480156102e657600080fd5b506102fa6102f5366004612984565b610906565b005b34801561030857600080fd5b50610328610317366004612a2a565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610277565b34801561034d57600080fd5b50600a545b604051908152602001610277565b34801561036c57600080fd5b506102fa61037b3660046129e9565b610a1c565b34801561038c57600080fd5b5061035261039b366004612984565b610a4d565b3480156103ac57600080fd5b506103526108ae81565b3480156103c257600080fd5b5061035260015481565b3480156103d857600080fd5b506102fa6103e73660046129e9565b610ae3565b3480156103f857600080fd5b50610352610407366004612d4b565b610afe565b34801561041857600080fd5b506102fa610427366004612bf3565b610b91565b34801561043857600080fd5b506102fa610c26565b34801561044d57600080fd5b506102fa61045c366004612d02565b610cb3565b34801561046d57600080fd5b506102c261047c366004612d4b565b610d2b565b61035261048f366004612943565b610da2565b3480156104a057600080fd5b506102c27f000000000000000000000000000000000000000000000000000000000000000081565b3480156104d457600080fd5b50610295611156565b3480156104e957600080fd5b506103526104f8366004612943565b6111e4565b34801561050957600080fd5b506102fa61126b565b34801561051e57600080fd5b5061053261052d366004612943565b6112df565b60405161027791906130a1565b6102fa61054d366004612b52565b61139e565b34801561055e57600080fd5b5061035266470de4df82000081565b34801561057957600080fd5b506000546001600160a01b03166102c2565b34801561059757600080fd5b5061029561159b565b3480156105ac57600080fd5b506102fa6105bb366004612c55565b6115aa565b3480156105cc57600080fd5b506102fa6105db366004612b1d565b611645565b3480156105ec57600080fd5b506102c27f000000000000000000000000000000000000000000000000000000000000000081565b34801561062057600080fd5b506102fa61170a565b34801561063557600080fd5b506102fa610644366004612a9d565b61178f565b34801561065557600080fd5b50610352610664366004612943565b600d6020526000908152604090205481565b34801561068257600080fd5b506102fa610691366004612a2a565b6117c7565b3480156106a257600080fd5b506102956106b1366004612d4b565b611825565b3480156106c257600080fd5b506102fa6106d1366004612d4b565b611919565b3480156106e257600080fd5b5061026b6106f13660046129b0565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561072b57600080fd5b50600c5461026b9060ff1681565b34801561074557600080fd5b506102c2610754366004612d4b565b600e602052600090815260409020546001600160a01b031681565b34801561077b57600080fd5b506102fa61078a366004612943565b611948565b34801561079b57600080fd5b506102fa6107aa366004612984565b611a32565b60006001600160e01b0319821663780e9d6360e01b14806107d457506107d482611a6a565b92915050565b6060600280546107e990613450565b80601f016020809104026020016040519081016040528092919081815260200182805461081590613450565b80156108625780601f1061083757610100808354040283529160200191610862565b820191906000526020600020905b81548152906001019060200180831161084557829003601f168201915b5050505050905090565b6000818152600460205260408120546001600160a01b03166108ea5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061091182610d2b565b9050806001600160a01b0316836001600160a01b0316141561097f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016108e1565b336001600160a01b038216148061099b575061099b81336106f1565b610a0d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016108e1565b610a178383611aba565b505050565b610a263382611b28565b610a425760405162461bcd60e51b81526004016108e19061317f565b610a17838383611c1f565b6000610a58836111e4565b8210610aba5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016108e1565b506001600160a01b03919091166000908152600860209081526040808320938352929052205490565b610a178383836040518060200160405280600081525061178f565b6000610b09600a5490565b8210610b6c5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016108e1565b600a8281548110610b7f57610b7f6134e2565b90600052602060002001549050919050565b6000546001600160a01b03163314610bbb5760405162461bcd60e51b81526004016108e19061314a565b604051632f53664360e11b81526001600160a01b03861690635ea6cc8690610bed908790879087908790600401612f7e565b600060405180830381600087803b158015610c0757600080fd5b505af1158015610c1b573d6000803e3d6000fd5b505050505050505050565b6000546001600160a01b03163314610c505760405162461bcd60e51b81526004016108e19061314a565b600c5460ff161515600114610ca75760405162461bcd60e51b815260206004820152601860248201527f53616c6520697320616c726561647920696e616374697665000000000000000060448201526064016108e1565b600c805460ff19169055565b6000546001600160a01b03163314610cdd5760405162461bcd60e51b81526004016108e19061314a565b8051610cf090600f906020840190612796565b507f23c8c9488efebfd474e85a7956de6f39b17c7ab88502d42a623db2d8e382bbaa81604051610d2091906130e5565b60405180910390a150565b6000818152600460205260408120546001600160a01b0316806107d45760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016108e1565b600c5460009060ff16610dee5760405162461bcd60e51b815260206004820152601460248201527314d85b19481a185cc81b9bdd081cdd185c9d195960621b60448201526064016108e1565b6108ae610dfa600a5490565b10610e475760405162461bcd60e51b815260206004820152601c60248201527f416c6c20647265616d732068617665206265656e206d696e7465642e0000000060448201526064016108e1565b6001600160a01b0382166000908152600d602052604090205415610ead5760405162461bcd60e51b815260206004820152601c60248201527f54696c652068617320616c7265616479206265656e20647265616d740000000060448201526064016108e1565b60405163bc8c30c560e01b81526001600160a01b03838116600483015233917f000000000000000000000000000000000000000000000000000000000000000090911690636352211e90829063bc8c30c59060240160206040518083038186803b158015610f1a57600080fd5b505afa158015610f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f529190612d64565b6040518263ffffffff1660e01b8152600401610f7091815260200190565b60206040518083038186803b158015610f8857600080fd5b505afa158015610f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc09190612967565b6001600160a01b0316146110165760405162461bcd60e51b815260206004820152601e60248201527f53656e64657220646f6573206e6f74206f776e20746869732054696c652e000060448201526064016108e1565b66470de4df8200003410156110795760405162461bcd60e51b815260206004820152602360248201527f45746865722076616c75652073656e742069732062656c6f772074686520707260448201526269636560e81b60648201526084016108e1565b6110ad343361108785611dca565b6040516020016110979190612ecb565b6040516020818303038152906040526000611f11565b60006110b8600a5490565b6110c390600161324c565b6001600160a01b0384166000818152600d60209081526040808320859055848352600e909152902080546001600160a01b03191690911790559050611108338261211f565b60408051338152602081018390526001600160a01b0385168183015290517fbcad3d7d3dfccb90d49c6063bf70f828901fefc88937d90af74e58e6e55bc39d9181900360600190a192915050565b600f805461116390613450565b80601f016020809104026020016040519081016040528092919081815260200182805461118f90613450565b80156111dc5780601f106111b1576101008083540402835291602001916111dc565b820191906000526020600020905b8154815290600101906020018083116111bf57829003601f168201915b505050505081565b60006001600160a01b03821661124f5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016108e1565b506001600160a01b031660009081526005602052604090205490565b6000546001600160a01b031633146112955760405162461bcd60e51b81526004016108e19061314a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b606060006112ec836111e4565b90508061130d5760408051600080825260208201909252905b509392505050565b60008167ffffffffffffffff811115611328576113286134f8565b604051908082528060200260200182016040528015611351578160200160208202803683370190505b50905060005b82811015611305576113698582610a4d565b82828151811061137b5761137b6134e2565b60209081029190910101528061139081613485565b915050611357565b50919050565b6001546113fd5760405162461bcd60e51b815260206004820152602760248201527f4a75696365626f7850726f6a6563743a3a7061793a2050524f4a4543545f4e4f6044820152661517d193d5539160ca1b60648201526084016108e1565b600154604051634fe0eced60e01b81526000916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691634fe0eced916114519160040190815260200190565b60206040518083038186803b15801561146957600080fd5b505afa15801561147d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a19190612967565b90506001600160a01b03811661150a5760405162461bcd60e51b815260206004820152602860248201527f4a75696365626f7850726f6a6563743a3a7061793a205445524d494e414c5f4e60448201526713d517d193d5539160c21b60648201526084016108e1565b6001546040516302c8986f60e01b81526001600160a01b038316916302c8986f913491611541918a908a908a908a906004016131d0565b6020604051808303818588803b15801561155a57600080fd5b505af115801561156e573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115939190612d64565b505050505050565b6060600380546107e990613450565b6000546001600160a01b031633146115d45760405162461bcd60e51b81526004016108e19061314a565b6040516393535be160e01b81526001600160a01b038816906393535be19061160a90899089908990899089908990600401612fa6565b600060405180830381600087803b15801561162457600080fd5b505af1158015611638573d6000803e3d6000fd5b5050505050505050505050565b6001600160a01b03821633141561169e5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016108e1565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000546001600160a01b031633146117345760405162461bcd60e51b81526004016108e19061314a565b600c5460ff16156117805760405162461bcd60e51b815260206004820152601660248201527553616c6520697320616c72656164792061637469766560501b60448201526064016108e1565b600c805460ff19166001179055565b6117993383611b28565b6117b55760405162461bcd60e51b81526004016108e19061317f565b6117c184848484612139565b50505050565b6000546001600160a01b031633146117f15760405162461bcd60e51b81526004016108e19061314a565b604051635c46a7ef60e11b81526001600160a01b0386169063b88d4fde90610bed9030908890889088908890600401612f02565b6000818152600460205260409020546060906001600160a01b03166118a45760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016108e1565b6000600f80546118b390613450565b9050116118cf57604051806020016040528060008152506107d4565b6000828152600e6020526040902054600f906118f3906001600160a01b0316611dca565b604051602001611904929190612e24565b60405160208183030381529060405292915050565b6000546001600160a01b031633146119435760405162461bcd60e51b81526004016108e19061314a565b600155565b6000546001600160a01b031633146119725760405162461bcd60e51b81526004016108e19061314a565b6001600160a01b0381166119d75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108e1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314611a5c5760405162461bcd60e51b81526004016108e19061314a565b611a66828261216c565b5050565b60006001600160e01b031982166380ac58cd60e01b1480611a9b57506001600160e01b03198216635b5e139f60e01b145b806107d457506301ffc9a760e01b6001600160e01b03198316146107d4565b600081815260066020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611aef82610d2b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600460205260408120546001600160a01b0316611ba15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016108e1565b6000611bac83610d2b565b9050806001600160a01b0316846001600160a01b03161480611be75750836001600160a01b0316611bdc8461086c565b6001600160a01b0316145b80611c1757506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611c3282610d2b565b6001600160a01b031614611c9a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016108e1565b6001600160a01b038216611cfc5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016108e1565b611d07838383612285565b611d12600082611aba565b6001600160a01b0383166000908152600560205260408120805460019290611d3b9084906133ea565b90915550506001600160a01b0382166000908152600560205260408120805460019290611d6990849061324c565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60408051602880825260608281019093526000919060208201818036833701905050905060005b6014811015611f0a576000611e078260136133ea565b611e129060086133aa565b611e1d906002613302565b611e30906001600160a01b038716613289565b60f81b9050600060108260f81c611e47919061329d565b60f81b905060008160f81c6010611e5e91906133c9565b8360f81c611e6c9190613401565b60f81b9050611e7a8261233d565b85611e868660026133aa565b81518110611e9657611e966134e2565b60200101906001600160f81b031916908160001a905350611eb68161233d565b85611ec28660026133aa565b611ecd90600161324c565b81518110611edd57611edd6134e2565b60200101906001600160f81b031916908160001a9053505050508080611f0290613485565b915050611df1565b5092915050565b600154611f745760405162461bcd60e51b815260206004820152602b60248201527f4a75696365626f7850726f6a6563743a3a74616b654665653a2050524f4a454360448201526a1517d393d517d193d5539160aa1b60648201526084016108e1565b600154604051634fe0eced60e01b81526000916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691634fe0eced91611fc89160040190815260200190565b60206040518083038186803b158015611fe057600080fd5b505afa158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120189190612967565b90506001600160a01b0381166120855760405162461bcd60e51b815260206004820152602c60248201527f4a75696365626f7850726f6a6563743a3a74616b654665653a205445524d494e60448201526b105317d393d517d193d5539160a21b60648201526084016108e1565b844710156120ea5760405162461bcd60e51b815260206004820152602c60248201527f4a75696365626f7850726f6a6563743a3a74616b654665653a20494e5355464660448201526b494349454e545f46554e445360a01b60648201526084016108e1565b6001546040516302c8986f60e01b81526001600160a01b038316916302c8986f9188916115419189908990899060040161320f565b611a66828260405180602001604052806000815250612378565b612144848484611c1f565b612150848484846123ab565b6117c15760405162461bcd60e51b81526004016108e1906130f8565b804710156121bc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108e1565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612209576040519150601f19603f3d011682016040523d82523d6000602084013e61220e565b606091505b5050905080610a175760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108e1565b6001600160a01b0383166122e0576122db81600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b612303565b816001600160a01b0316836001600160a01b0316146123035761230383826124b8565b6001600160a01b03821661231a57610a1781612555565b826001600160a01b0316826001600160a01b031614610a1757610a178282612604565b6000600a60f883901c10156123645761235b60f883901c6030613264565b60f81b92915050565b61235b60f883901c6057613264565b919050565b6123828383612648565b61238f60008484846123ab565b610a175760405162461bcd60e51b81526004016108e1906130f8565b60006001600160a01b0384163b156124ad57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123ef903390899088908890600401612f41565b602060405180830381600087803b15801561240957600080fd5b505af1925050508015612439575060408051601f3d908101601f1916820190925261243691810190612bd6565b60015b612493573d808015612467576040519150601f19603f3d011682016040523d82523d6000602084013e61246c565b606091505b50805161248b5760405162461bcd60e51b81526004016108e1906130f8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611c17565b506001949350505050565b600060016124c5846111e4565b6124cf91906133ea565b600083815260096020526040902054909150808214612522576001600160a01b03841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b5060009182526009602090815260408084208490556001600160a01b039094168352600881528383209183525290812055565b600a54600090612567906001906133ea565b6000838152600b6020526040812054600a805493945090928490811061258f5761258f6134e2565b9060005260206000200154905080600a83815481106125b0576125b06134e2565b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a8054806125e8576125e86134cc565b6001900381819060005260206000200160009055905550505050565b600061260f836111e4565b6001600160a01b039093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b6001600160a01b03821661269e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016108e1565b6000818152600460205260409020546001600160a01b0316156127035760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108e1565b61270f60008383612285565b6001600160a01b038216600090815260056020526040812080546001929061273890849061324c565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546127a290613450565b90600052602060002090601f0160209004810192826127c4576000855561280a565b82601f106127dd57805160ff191683800117855561280a565b8280016001018555821561280a579182015b8281111561280a5782518255916020019190600101906127ef565b5061281692915061281a565b5090565b5b80821115612816576000815560010161281b565b600067ffffffffffffffff8084111561284a5761284a6134f8565b604051601f8501601f19908116603f01168101908282118183101715612872576128726134f8565b8160405280935085815286868601111561288b57600080fd5b858560208301376000602087830101525050509392505050565b60008083601f8401126128b757600080fd5b50813567ffffffffffffffff8111156128cf57600080fd5b6020830191508360208260051b85010111156128ea57600080fd5b9250929050565b8035801515811461237357600080fd5b60008083601f84011261291357600080fd5b50813567ffffffffffffffff81111561292b57600080fd5b6020830191508360208285010111156128ea57600080fd5b60006020828403121561295557600080fd5b81356129608161350e565b9392505050565b60006020828403121561297957600080fd5b81516129608161350e565b6000806040838503121561299757600080fd5b82356129a28161350e565b946020939093013593505050565b600080604083850312156129c357600080fd5b82356129ce8161350e565b915060208301356129de8161350e565b809150509250929050565b6000806000606084860312156129fe57600080fd5b8335612a098161350e565b92506020840135612a198161350e565b929592945050506040919091013590565b600080600080600060808688031215612a4257600080fd5b8535612a4d8161350e565b94506020860135612a5d8161350e565b935060408601359250606086013567ffffffffffffffff811115612a8057600080fd5b612a8c88828901612901565b969995985093965092949392505050565b60008060008060808587031215612ab357600080fd5b8435612abe8161350e565b93506020850135612ace8161350e565b925060408501359150606085013567ffffffffffffffff811115612af157600080fd5b8501601f81018713612b0257600080fd5b612b118782356020840161282f565b91505092959194509250565b60008060408385031215612b3057600080fd5b8235612b3b8161350e565b9150612b49602084016128f1565b90509250929050565b60008060008060608587031215612b6857600080fd5b8435612b738161350e565b9350602085013567ffffffffffffffff811115612b8f57600080fd5b612b9b87828801612901565b9094509250612bae9050604086016128f1565b905092959194509250565b600060208284031215612bcb57600080fd5b813561296081613526565b600060208284031215612be857600080fd5b815161296081613526565b600080600080600060808688031215612c0b57600080fd5b8535612c168161350e565b94506020860135612c268161350e565b935060408601359250606086013567ffffffffffffffff811115612c4957600080fd5b612a8c888289016128a5565b60008060008060008060006080888a031215612c7057600080fd5b8735612c7b8161350e565b9650602088013567ffffffffffffffff80821115612c9857600080fd5b612ca48b838c016128a5565b909850965060408a0135915080821115612cbd57600080fd5b612cc98b838c016128a5565b909650945060608a0135915080821115612ce257600080fd5b50612cef8a828b016128a5565b989b979a50959850939692959293505050565b600060208284031215612d1457600080fd5b813567ffffffffffffffff811115612d2b57600080fd5b8201601f81018413612d3c57600080fd5b611c178482356020840161282f565b600060208284031215612d5d57600080fd5b5035919050565b600060208284031215612d7657600080fd5b5051919050565b81835260006001600160fb1b03831115612d9657600080fd5b8260051b8083602087013760009401602001938452509192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008151808452612df4816020860160208601613424565b601f01601f19169290920160200192915050565b60008151612e1a818560208601613424565b9290920192915050565b600080845481600182811c915080831680612e4057607f831692505b6020808410821415612e6057634e487b7160e01b86526022600452602486fd5b818015612e745760018114612e8557612eb2565b60ff19861689528489019650612eb2565b60008b81526020902060005b86811015612eaa5781548b820152908501908301612e91565b505084890196505b505050505050612ec28185612e08565b95945050505050565b6e0223932b0b6ba1037b3102a34b6329608d1b815260008251612ef581600f850160208701613424565b91909101600f0192915050565b6001600160a01b0386811682528516602082015260408101849052608060608201819052600090612f369083018486612db3565b979650505050505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612f7490830184612ddc565b9695505050505050565b60018060a01b0385168152836020820152606060408201526000612f74606083018486612d7d565b6060808252810186905260008760808301825b89811015612fe9578235612fcc8161350e565b6001600160a01b0316825260209283019290910190600101612fb9565b50602091508381038285015261300081888a612d7d565b84810360408601528581529050818101600586811b830184018860005b8981101561308e57858303601f190185528135368c9003601e1901811261304357600080fd5b8b01803567ffffffffffffffff81111561305c57600080fd5b80861b36038d131561306d57600080fd5b61307a85828b8501612d7d565b96890196945050509086019060010161301d565b50909d9c50505050505050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156130d9578351835292840192918401916001016130bd565b50909695505050505050565b6020815260006129606020830184612ddc565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b8581526001600160a01b03851660208201526080604082018190526000906131fb9083018587612db3565b905082151560608301529695505050505050565b8481526001600160a01b038416602082015260806040820181905260009061323990830185612ddc565b9050821515606083015295945050505050565b6000821982111561325f5761325f6134a0565b500190565b600060ff821660ff84168060ff03821115613281576132816134a0565b019392505050565b600082613298576132986134b6565b500490565b600060ff8316806132b0576132b06134b6565b8060ff84160491505092915050565b600181815b808511156132fa5781600019048211156132e0576132e06134a0565b808516156132ed57918102915b93841c93908002906132c4565b509250929050565b60006129608383600082613318575060016107d4565b81613325575060006107d4565b816001811461333b576002811461334557613361565b60019150506107d4565b60ff841115613356576133566134a0565b50506001821b6107d4565b5060208310610133831016604e8410600b8410161715613384575081810a6107d4565b61338e83836132bf565b80600019048211156133a2576133a26134a0565b029392505050565b60008160001904831182151516156133c4576133c46134a0565b500290565b600060ff821660ff84168160ff04811182151516156133a2576133a26134a0565b6000828210156133fc576133fc6134a0565b500390565b600060ff821660ff84168082101561341b5761341b6134a0565b90039392505050565b60005b8381101561343f578181015183820152602001613427565b838111156117c15750506000910152565b600181811c9082168061346457607f821691505b6020821081141561139857634e487b7160e01b600052602260045260246000fd5b6000600019821415613499576134996134a0565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461352357600080fd5b50565b6001600160e01b03198116811461352357600080fdfea26469706673582212206eef197bebf78481852fa4bf4a1c846e40df419033272b191af2892a28a5f7ad64736f6c63430008060033000000000000000000000000000000000000000000000000000000000000000200000000000000000000000046c9999a2edcd5aa177ed7e8af90c68b7d75ba4600000000000000000000000064931f06d3266049bf0195346973762e6996d7640000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001c68747470733a2f2f647265616d6c616e642e74696c65732e6172742f00000000

Deployed Bytecode

0x60806040526004361061023f5760003560e01c8063715018a61161012e578063b88d4fde116100ab578063e985e9c51161006f578063e985e9c5146106d6578063eb8d24441461071f578063f2ec575514610739578063f2fde38b1461076f578063f3fef3a31461078f57600080fd5b8063b88d4fde14610629578063bc8c30c514610649578063c0a485e214610676578063c87b56dd14610696578063ce9246dd146106b657600080fd5b806395d89b41116100f257806395d89b411461058b578063999a244f146105a0578063a22cb465146105c0578063b2e0a100146105e0578063b66a0e5d1461061457600080fd5b8063715018a6146104fd5780638462151c14610512578063897c063e1461053f5780638d859f3e146105525780638da5cb5b1461056d57600080fd5b806342842e0e116101bc5780636352211e116101805780636352211e146104615780636a627842146104815780636abcf8e3146104945780636c0360eb146104c857806370a08231146104dd57600080fd5b806342842e0e146103cc5780634f6ccce7146103ec578063544c0e151461040c57806355367ba91461042c57806355f804b31461044157600080fd5b806318160ddd1161020357806318160ddd1461034157806323b872dd146103605780632f745c591461038057806332cb6b0c146103a05780633fafa127146103b657600080fd5b806301ffc9a71461024b57806306fdde0314610280578063081812fc146102a2578063095ea7b3146102da578063150b7a02146102fc57600080fd5b3661024657005b600080fd5b34801561025757600080fd5b5061026b610266366004612bb9565b6107af565b60405190151581526020015b60405180910390f35b34801561028c57600080fd5b506102956107da565b60405161027791906130e5565b3480156102ae57600080fd5b506102c26102bd366004612d4b565b61086c565b6040516001600160a01b039091168152602001610277565b3480156102e657600080fd5b506102fa6102f5366004612984565b610906565b005b34801561030857600080fd5b50610328610317366004612a2a565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610277565b34801561034d57600080fd5b50600a545b604051908152602001610277565b34801561036c57600080fd5b506102fa61037b3660046129e9565b610a1c565b34801561038c57600080fd5b5061035261039b366004612984565b610a4d565b3480156103ac57600080fd5b506103526108ae81565b3480156103c257600080fd5b5061035260015481565b3480156103d857600080fd5b506102fa6103e73660046129e9565b610ae3565b3480156103f857600080fd5b50610352610407366004612d4b565b610afe565b34801561041857600080fd5b506102fa610427366004612bf3565b610b91565b34801561043857600080fd5b506102fa610c26565b34801561044d57600080fd5b506102fa61045c366004612d02565b610cb3565b34801561046d57600080fd5b506102c261047c366004612d4b565b610d2b565b61035261048f366004612943565b610da2565b3480156104a057600080fd5b506102c27f00000000000000000000000046c9999a2edcd5aa177ed7e8af90c68b7d75ba4681565b3480156104d457600080fd5b50610295611156565b3480156104e957600080fd5b506103526104f8366004612943565b6111e4565b34801561050957600080fd5b506102fa61126b565b34801561051e57600080fd5b5061053261052d366004612943565b6112df565b60405161027791906130a1565b6102fa61054d366004612b52565b61139e565b34801561055e57600080fd5b5061035266470de4df82000081565b34801561057957600080fd5b506000546001600160a01b03166102c2565b34801561059757600080fd5b5061029561159b565b3480156105ac57600080fd5b506102fa6105bb366004612c55565b6115aa565b3480156105cc57600080fd5b506102fa6105db366004612b1d565b611645565b3480156105ec57600080fd5b506102c27f00000000000000000000000064931f06d3266049bf0195346973762e6996d76481565b34801561062057600080fd5b506102fa61170a565b34801561063557600080fd5b506102fa610644366004612a9d565b61178f565b34801561065557600080fd5b50610352610664366004612943565b600d6020526000908152604090205481565b34801561068257600080fd5b506102fa610691366004612a2a565b6117c7565b3480156106a257600080fd5b506102956106b1366004612d4b565b611825565b3480156106c257600080fd5b506102fa6106d1366004612d4b565b611919565b3480156106e257600080fd5b5061026b6106f13660046129b0565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561072b57600080fd5b50600c5461026b9060ff1681565b34801561074557600080fd5b506102c2610754366004612d4b565b600e602052600090815260409020546001600160a01b031681565b34801561077b57600080fd5b506102fa61078a366004612943565b611948565b34801561079b57600080fd5b506102fa6107aa366004612984565b611a32565b60006001600160e01b0319821663780e9d6360e01b14806107d457506107d482611a6a565b92915050565b6060600280546107e990613450565b80601f016020809104026020016040519081016040528092919081815260200182805461081590613450565b80156108625780601f1061083757610100808354040283529160200191610862565b820191906000526020600020905b81548152906001019060200180831161084557829003601f168201915b5050505050905090565b6000818152600460205260408120546001600160a01b03166108ea5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061091182610d2b565b9050806001600160a01b0316836001600160a01b0316141561097f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016108e1565b336001600160a01b038216148061099b575061099b81336106f1565b610a0d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016108e1565b610a178383611aba565b505050565b610a263382611b28565b610a425760405162461bcd60e51b81526004016108e19061317f565b610a17838383611c1f565b6000610a58836111e4565b8210610aba5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016108e1565b506001600160a01b03919091166000908152600860209081526040808320938352929052205490565b610a178383836040518060200160405280600081525061178f565b6000610b09600a5490565b8210610b6c5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016108e1565b600a8281548110610b7f57610b7f6134e2565b90600052602060002001549050919050565b6000546001600160a01b03163314610bbb5760405162461bcd60e51b81526004016108e19061314a565b604051632f53664360e11b81526001600160a01b03861690635ea6cc8690610bed908790879087908790600401612f7e565b600060405180830381600087803b158015610c0757600080fd5b505af1158015610c1b573d6000803e3d6000fd5b505050505050505050565b6000546001600160a01b03163314610c505760405162461bcd60e51b81526004016108e19061314a565b600c5460ff161515600114610ca75760405162461bcd60e51b815260206004820152601860248201527f53616c6520697320616c726561647920696e616374697665000000000000000060448201526064016108e1565b600c805460ff19169055565b6000546001600160a01b03163314610cdd5760405162461bcd60e51b81526004016108e19061314a565b8051610cf090600f906020840190612796565b507f23c8c9488efebfd474e85a7956de6f39b17c7ab88502d42a623db2d8e382bbaa81604051610d2091906130e5565b60405180910390a150565b6000818152600460205260408120546001600160a01b0316806107d45760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016108e1565b600c5460009060ff16610dee5760405162461bcd60e51b815260206004820152601460248201527314d85b19481a185cc81b9bdd081cdd185c9d195960621b60448201526064016108e1565b6108ae610dfa600a5490565b10610e475760405162461bcd60e51b815260206004820152601c60248201527f416c6c20647265616d732068617665206265656e206d696e7465642e0000000060448201526064016108e1565b6001600160a01b0382166000908152600d602052604090205415610ead5760405162461bcd60e51b815260206004820152601c60248201527f54696c652068617320616c7265616479206265656e20647265616d740000000060448201526064016108e1565b60405163bc8c30c560e01b81526001600160a01b03838116600483015233917f00000000000000000000000064931f06d3266049bf0195346973762e6996d76490911690636352211e90829063bc8c30c59060240160206040518083038186803b158015610f1a57600080fd5b505afa158015610f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f529190612d64565b6040518263ffffffff1660e01b8152600401610f7091815260200190565b60206040518083038186803b158015610f8857600080fd5b505afa158015610f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc09190612967565b6001600160a01b0316146110165760405162461bcd60e51b815260206004820152601e60248201527f53656e64657220646f6573206e6f74206f776e20746869732054696c652e000060448201526064016108e1565b66470de4df8200003410156110795760405162461bcd60e51b815260206004820152602360248201527f45746865722076616c75652073656e742069732062656c6f772074686520707260448201526269636560e81b60648201526084016108e1565b6110ad343361108785611dca565b6040516020016110979190612ecb565b6040516020818303038152906040526000611f11565b60006110b8600a5490565b6110c390600161324c565b6001600160a01b0384166000818152600d60209081526040808320859055848352600e909152902080546001600160a01b03191690911790559050611108338261211f565b60408051338152602081018390526001600160a01b0385168183015290517fbcad3d7d3dfccb90d49c6063bf70f828901fefc88937d90af74e58e6e55bc39d9181900360600190a192915050565b600f805461116390613450565b80601f016020809104026020016040519081016040528092919081815260200182805461118f90613450565b80156111dc5780601f106111b1576101008083540402835291602001916111dc565b820191906000526020600020905b8154815290600101906020018083116111bf57829003601f168201915b505050505081565b60006001600160a01b03821661124f5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016108e1565b506001600160a01b031660009081526005602052604090205490565b6000546001600160a01b031633146112955760405162461bcd60e51b81526004016108e19061314a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b606060006112ec836111e4565b90508061130d5760408051600080825260208201909252905b509392505050565b60008167ffffffffffffffff811115611328576113286134f8565b604051908082528060200260200182016040528015611351578160200160208202803683370190505b50905060005b82811015611305576113698582610a4d565b82828151811061137b5761137b6134e2565b60209081029190910101528061139081613485565b915050611357565b50919050565b6001546113fd5760405162461bcd60e51b815260206004820152602760248201527f4a75696365626f7850726f6a6563743a3a7061793a2050524f4a4543545f4e4f6044820152661517d193d5539160ca1b60648201526084016108e1565b600154604051634fe0eced60e01b81526000916001600160a01b037f00000000000000000000000046c9999a2edcd5aa177ed7e8af90c68b7d75ba461691634fe0eced916114519160040190815260200190565b60206040518083038186803b15801561146957600080fd5b505afa15801561147d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a19190612967565b90506001600160a01b03811661150a5760405162461bcd60e51b815260206004820152602860248201527f4a75696365626f7850726f6a6563743a3a7061793a205445524d494e414c5f4e60448201526713d517d193d5539160c21b60648201526084016108e1565b6001546040516302c8986f60e01b81526001600160a01b038316916302c8986f913491611541918a908a908a908a906004016131d0565b6020604051808303818588803b15801561155a57600080fd5b505af115801561156e573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115939190612d64565b505050505050565b6060600380546107e990613450565b6000546001600160a01b031633146115d45760405162461bcd60e51b81526004016108e19061314a565b6040516393535be160e01b81526001600160a01b038816906393535be19061160a90899089908990899089908990600401612fa6565b600060405180830381600087803b15801561162457600080fd5b505af1158015611638573d6000803e3d6000fd5b5050505050505050505050565b6001600160a01b03821633141561169e5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016108e1565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000546001600160a01b031633146117345760405162461bcd60e51b81526004016108e19061314a565b600c5460ff16156117805760405162461bcd60e51b815260206004820152601660248201527553616c6520697320616c72656164792061637469766560501b60448201526064016108e1565b600c805460ff19166001179055565b6117993383611b28565b6117b55760405162461bcd60e51b81526004016108e19061317f565b6117c184848484612139565b50505050565b6000546001600160a01b031633146117f15760405162461bcd60e51b81526004016108e19061314a565b604051635c46a7ef60e11b81526001600160a01b0386169063b88d4fde90610bed9030908890889088908890600401612f02565b6000818152600460205260409020546060906001600160a01b03166118a45760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016108e1565b6000600f80546118b390613450565b9050116118cf57604051806020016040528060008152506107d4565b6000828152600e6020526040902054600f906118f3906001600160a01b0316611dca565b604051602001611904929190612e24565b60405160208183030381529060405292915050565b6000546001600160a01b031633146119435760405162461bcd60e51b81526004016108e19061314a565b600155565b6000546001600160a01b031633146119725760405162461bcd60e51b81526004016108e19061314a565b6001600160a01b0381166119d75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108e1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314611a5c5760405162461bcd60e51b81526004016108e19061314a565b611a66828261216c565b5050565b60006001600160e01b031982166380ac58cd60e01b1480611a9b57506001600160e01b03198216635b5e139f60e01b145b806107d457506301ffc9a760e01b6001600160e01b03198316146107d4565b600081815260066020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611aef82610d2b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600460205260408120546001600160a01b0316611ba15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016108e1565b6000611bac83610d2b565b9050806001600160a01b0316846001600160a01b03161480611be75750836001600160a01b0316611bdc8461086c565b6001600160a01b0316145b80611c1757506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611c3282610d2b565b6001600160a01b031614611c9a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016108e1565b6001600160a01b038216611cfc5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016108e1565b611d07838383612285565b611d12600082611aba565b6001600160a01b0383166000908152600560205260408120805460019290611d3b9084906133ea565b90915550506001600160a01b0382166000908152600560205260408120805460019290611d6990849061324c565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60408051602880825260608281019093526000919060208201818036833701905050905060005b6014811015611f0a576000611e078260136133ea565b611e129060086133aa565b611e1d906002613302565b611e30906001600160a01b038716613289565b60f81b9050600060108260f81c611e47919061329d565b60f81b905060008160f81c6010611e5e91906133c9565b8360f81c611e6c9190613401565b60f81b9050611e7a8261233d565b85611e868660026133aa565b81518110611e9657611e966134e2565b60200101906001600160f81b031916908160001a905350611eb68161233d565b85611ec28660026133aa565b611ecd90600161324c565b81518110611edd57611edd6134e2565b60200101906001600160f81b031916908160001a9053505050508080611f0290613485565b915050611df1565b5092915050565b600154611f745760405162461bcd60e51b815260206004820152602b60248201527f4a75696365626f7850726f6a6563743a3a74616b654665653a2050524f4a454360448201526a1517d393d517d193d5539160aa1b60648201526084016108e1565b600154604051634fe0eced60e01b81526000916001600160a01b037f00000000000000000000000046c9999a2edcd5aa177ed7e8af90c68b7d75ba461691634fe0eced91611fc89160040190815260200190565b60206040518083038186803b158015611fe057600080fd5b505afa158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120189190612967565b90506001600160a01b0381166120855760405162461bcd60e51b815260206004820152602c60248201527f4a75696365626f7850726f6a6563743a3a74616b654665653a205445524d494e60448201526b105317d393d517d193d5539160a21b60648201526084016108e1565b844710156120ea5760405162461bcd60e51b815260206004820152602c60248201527f4a75696365626f7850726f6a6563743a3a74616b654665653a20494e5355464660448201526b494349454e545f46554e445360a01b60648201526084016108e1565b6001546040516302c8986f60e01b81526001600160a01b038316916302c8986f9188916115419189908990899060040161320f565b611a66828260405180602001604052806000815250612378565b612144848484611c1f565b612150848484846123ab565b6117c15760405162461bcd60e51b81526004016108e1906130f8565b804710156121bc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108e1565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612209576040519150601f19603f3d011682016040523d82523d6000602084013e61220e565b606091505b5050905080610a175760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108e1565b6001600160a01b0383166122e0576122db81600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b612303565b816001600160a01b0316836001600160a01b0316146123035761230383826124b8565b6001600160a01b03821661231a57610a1781612555565b826001600160a01b0316826001600160a01b031614610a1757610a178282612604565b6000600a60f883901c10156123645761235b60f883901c6030613264565b60f81b92915050565b61235b60f883901c6057613264565b919050565b6123828383612648565b61238f60008484846123ab565b610a175760405162461bcd60e51b81526004016108e1906130f8565b60006001600160a01b0384163b156124ad57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123ef903390899088908890600401612f41565b602060405180830381600087803b15801561240957600080fd5b505af1925050508015612439575060408051601f3d908101601f1916820190925261243691810190612bd6565b60015b612493573d808015612467576040519150601f19603f3d011682016040523d82523d6000602084013e61246c565b606091505b50805161248b5760405162461bcd60e51b81526004016108e1906130f8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611c17565b506001949350505050565b600060016124c5846111e4565b6124cf91906133ea565b600083815260096020526040902054909150808214612522576001600160a01b03841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b5060009182526009602090815260408084208490556001600160a01b039094168352600881528383209183525290812055565b600a54600090612567906001906133ea565b6000838152600b6020526040812054600a805493945090928490811061258f5761258f6134e2565b9060005260206000200154905080600a83815481106125b0576125b06134e2565b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a8054806125e8576125e86134cc565b6001900381819060005260206000200160009055905550505050565b600061260f836111e4565b6001600160a01b039093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b6001600160a01b03821661269e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016108e1565b6000818152600460205260409020546001600160a01b0316156127035760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108e1565b61270f60008383612285565b6001600160a01b038216600090815260056020526040812080546001929061273890849061324c565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546127a290613450565b90600052602060002090601f0160209004810192826127c4576000855561280a565b82601f106127dd57805160ff191683800117855561280a565b8280016001018555821561280a579182015b8281111561280a5782518255916020019190600101906127ef565b5061281692915061281a565b5090565b5b80821115612816576000815560010161281b565b600067ffffffffffffffff8084111561284a5761284a6134f8565b604051601f8501601f19908116603f01168101908282118183101715612872576128726134f8565b8160405280935085815286868601111561288b57600080fd5b858560208301376000602087830101525050509392505050565b60008083601f8401126128b757600080fd5b50813567ffffffffffffffff8111156128cf57600080fd5b6020830191508360208260051b85010111156128ea57600080fd5b9250929050565b8035801515811461237357600080fd5b60008083601f84011261291357600080fd5b50813567ffffffffffffffff81111561292b57600080fd5b6020830191508360208285010111156128ea57600080fd5b60006020828403121561295557600080fd5b81356129608161350e565b9392505050565b60006020828403121561297957600080fd5b81516129608161350e565b6000806040838503121561299757600080fd5b82356129a28161350e565b946020939093013593505050565b600080604083850312156129c357600080fd5b82356129ce8161350e565b915060208301356129de8161350e565b809150509250929050565b6000806000606084860312156129fe57600080fd5b8335612a098161350e565b92506020840135612a198161350e565b929592945050506040919091013590565b600080600080600060808688031215612a4257600080fd5b8535612a4d8161350e565b94506020860135612a5d8161350e565b935060408601359250606086013567ffffffffffffffff811115612a8057600080fd5b612a8c88828901612901565b969995985093965092949392505050565b60008060008060808587031215612ab357600080fd5b8435612abe8161350e565b93506020850135612ace8161350e565b925060408501359150606085013567ffffffffffffffff811115612af157600080fd5b8501601f81018713612b0257600080fd5b612b118782356020840161282f565b91505092959194509250565b60008060408385031215612b3057600080fd5b8235612b3b8161350e565b9150612b49602084016128f1565b90509250929050565b60008060008060608587031215612b6857600080fd5b8435612b738161350e565b9350602085013567ffffffffffffffff811115612b8f57600080fd5b612b9b87828801612901565b9094509250612bae9050604086016128f1565b905092959194509250565b600060208284031215612bcb57600080fd5b813561296081613526565b600060208284031215612be857600080fd5b815161296081613526565b600080600080600060808688031215612c0b57600080fd5b8535612c168161350e565b94506020860135612c268161350e565b935060408601359250606086013567ffffffffffffffff811115612c4957600080fd5b612a8c888289016128a5565b60008060008060008060006080888a031215612c7057600080fd5b8735612c7b8161350e565b9650602088013567ffffffffffffffff80821115612c9857600080fd5b612ca48b838c016128a5565b909850965060408a0135915080821115612cbd57600080fd5b612cc98b838c016128a5565b909650945060608a0135915080821115612ce257600080fd5b50612cef8a828b016128a5565b989b979a50959850939692959293505050565b600060208284031215612d1457600080fd5b813567ffffffffffffffff811115612d2b57600080fd5b8201601f81018413612d3c57600080fd5b611c178482356020840161282f565b600060208284031215612d5d57600080fd5b5035919050565b600060208284031215612d7657600080fd5b5051919050565b81835260006001600160fb1b03831115612d9657600080fd5b8260051b8083602087013760009401602001938452509192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008151808452612df4816020860160208601613424565b601f01601f19169290920160200192915050565b60008151612e1a818560208601613424565b9290920192915050565b600080845481600182811c915080831680612e4057607f831692505b6020808410821415612e6057634e487b7160e01b86526022600452602486fd5b818015612e745760018114612e8557612eb2565b60ff19861689528489019650612eb2565b60008b81526020902060005b86811015612eaa5781548b820152908501908301612e91565b505084890196505b505050505050612ec28185612e08565b95945050505050565b6e0223932b0b6ba1037b3102a34b6329608d1b815260008251612ef581600f850160208701613424565b91909101600f0192915050565b6001600160a01b0386811682528516602082015260408101849052608060608201819052600090612f369083018486612db3565b979650505050505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612f7490830184612ddc565b9695505050505050565b60018060a01b0385168152836020820152606060408201526000612f74606083018486612d7d565b6060808252810186905260008760808301825b89811015612fe9578235612fcc8161350e565b6001600160a01b0316825260209283019290910190600101612fb9565b50602091508381038285015261300081888a612d7d565b84810360408601528581529050818101600586811b830184018860005b8981101561308e57858303601f190185528135368c9003601e1901811261304357600080fd5b8b01803567ffffffffffffffff81111561305c57600080fd5b80861b36038d131561306d57600080fd5b61307a85828b8501612d7d565b96890196945050509086019060010161301d565b50909d9c50505050505050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156130d9578351835292840192918401916001016130bd565b50909695505050505050565b6020815260006129606020830184612ddc565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b8581526001600160a01b03851660208201526080604082018190526000906131fb9083018587612db3565b905082151560608301529695505050505050565b8481526001600160a01b038416602082015260806040820181905260009061323990830185612ddc565b9050821515606083015295945050505050565b6000821982111561325f5761325f6134a0565b500190565b600060ff821660ff84168060ff03821115613281576132816134a0565b019392505050565b600082613298576132986134b6565b500490565b600060ff8316806132b0576132b06134b6565b8060ff84160491505092915050565b600181815b808511156132fa5781600019048211156132e0576132e06134a0565b808516156132ed57918102915b93841c93908002906132c4565b509250929050565b60006129608383600082613318575060016107d4565b81613325575060006107d4565b816001811461333b576002811461334557613361565b60019150506107d4565b60ff841115613356576133566134a0565b50506001821b6107d4565b5060208310610133831016604e8410600b8410161715613384575081810a6107d4565b61338e83836132bf565b80600019048211156133a2576133a26134a0565b029392505050565b60008160001904831182151516156133c4576133c46134a0565b500290565b600060ff821660ff84168160ff04811182151516156133a2576133a26134a0565b6000828210156133fc576133fc6134a0565b500390565b600060ff821660ff84168082101561341b5761341b6134a0565b90039392505050565b60005b8381101561343f578181015183820152602001613427565b838111156117c15750506000910152565b600181811c9082168061346457607f821691505b6020821081141561139857634e487b7160e01b600052602260045260246000fd5b6000600019821415613499576134996134a0565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461352357600080fd5b50565b6001600160e01b03198116811461352357600080fdfea26469706673582212206eef197bebf78481852fa4bf4a1c846e40df419033272b191af2892a28a5f7ad64736f6c63430008060033

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

000000000000000000000000000000000000000000000000000000000000000200000000000000000000000046c9999a2edcd5aa177ed7e8af90c68b7d75ba4600000000000000000000000064931f06d3266049bf0195346973762e6996d7640000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001c68747470733a2f2f647265616d6c616e642e74696c65732e6172742f00000000

-----Decoded View---------------
Arg [0] : _projectID (uint256): 2
Arg [1] : _terminalDirectory (address): 0x46C9999A2EDCD5aA177ed7E8af90c68b7d75Ba46
Arg [2] : _tiles (address): 0x64931F06d3266049Bf0195346973762E6996D764
Arg [3] : _baseURI (string): https://dreamland.tiles.art/

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [1] : 00000000000000000000000046c9999a2edcd5aa177ed7e8af90c68b7d75ba46
Arg [2] : 00000000000000000000000064931f06d3266049bf0195346973762e6996d764
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [4] : 000000000000000000000000000000000000000000000000000000000000001c
Arg [5] : 68747470733a2f2f647265616d6c616e642e74696c65732e6172742f00000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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