ETH Price: $2,615.63 (-3.94%)

Contract

0x4393F1470317Da64e277b29D96e5bf203f28eFbE
Transaction Hash
Method
Block
From
To
Buy From AMM Wit...1226969452024-07-14 21:31:07208 days ago1720992667IN
0x4393F147...03f28eFbE
0 ETH0.0000012629940.00127755
Buy From AMM Wit...1225760962024-07-12 2:22:49211 days ago1720750969IN
0x4393F147...03f28eFbE
0 ETH0.0000013789640.001242
Buy From AMM Wit...1225030712024-07-10 9:48:39213 days ago1720604919IN
0x4393F147...03f28eFbE
0 ETH0.0001059792850.0611083
Buy From AMM Wit...1225029522024-07-10 9:44:41213 days ago1720604681IN
0x4393F147...03f28eFbE
0 ETH0.0000665609030.0606752
Mint1224446372024-07-09 1:20:51214 days ago1720488051IN
0x4393F147...03f28eFbE
0 ETH0.0000193637750.0618695
Mint1224444472024-07-09 1:14:31214 days ago1720487671IN
0x4393F147...03f28eFbE
0 ETH0.0000196407660.062765
Mint1224443432024-07-09 1:11:03214 days ago1720487463IN
0x4393F147...03f28eFbE
0 ETH0.0000232135240.0741854
Mint1224421172024-07-08 23:56:51214 days ago1720483011IN
0x4393F147...03f28eFbE
0 ETH0.0000190517990.0614325
Mint1224420612024-07-08 23:54:59214 days ago1720482899IN
0x4393F147...03f28eFbE
0 ETH0.000019290970.0616437
Buy From AMM Wit...1221360772024-07-01 21:55:31221 days ago1719870931IN
0x4393F147...03f28eFbE
0 ETH0.0000745253750.0626098
Buy From AMM Wit...1221360562024-07-01 21:54:49221 days ago1719870889IN
0x4393F147...03f28eFbE
0 ETH0.0000563700380.0613777
Buy From AMM Wit...1219217152024-06-26 22:50:07226 days ago1719442207IN
0x4393F147...03f28eFbE
0 ETH0.0000125236910.007215
Buy From AMM Wit...1217840272024-06-23 18:20:31229 days ago1719166831IN
0x4393F147...03f28eFbE
0 ETH0.0000677529190.061603
Buy From Parlay ...1217495582024-06-22 23:11:33230 days ago1719097893IN
0x4393F147...03f28eFbE
0 ETH0.0002406849220.08493238
Mint1216566852024-06-20 19:35:47232 days ago1718912147IN
0x4393F147...03f28eFbE
0 ETH0.0000211984920.0614006
Buy From AMM Wit...1215258242024-06-17 18:53:45235 days ago1718650425IN
0x4393F147...03f28eFbE
0 ETH0.0000705072950.06125872
Buy From Parlay ...1215137882024-06-17 12:12:33236 days ago1718626353IN
0x4393F147...03f28eFbE
0 ETH0.0000624074460.02120903
Mint1214960152024-06-17 2:20:07236 days ago1718590807IN
0x4393F147...03f28eFbE
0 ETH0.0000005385820.0017155
Buy From AMM Wit...1214778642024-06-16 16:15:05236 days ago1718554505IN
0x4393F147...03f28eFbE
0 ETH0.0000224321930.02042112
Buy From AMM Wit...1214778172024-06-16 16:13:31236 days ago1718554411IN
0x4393F147...03f28eFbE
0 ETH0.0000225974730.01447913
Mint1214006062024-06-14 21:19:49238 days ago1718399989IN
0x4393F147...03f28eFbE
0 ETH0.0000006549130.0020372
Buy From Parlay ...1208259712024-06-01 14:05:19252 days ago1717250719IN
0x4393F147...03f28eFbE
0 ETH0.0000096575890.00365466
Buy From AMM Wit...1207382102024-05-30 13:19:57254 days ago1717075197IN
0x4393F147...03f28eFbE
0 ETH0.0000049170630.0043025
Buy From AMM Wit...1207381832024-05-30 13:19:03254 days ago1717075143IN
0x4393F147...03f28eFbE
0 ETH0.0000050816330.0043704
Buy From AMM Wit...1207381732024-05-30 13:18:43254 days ago1717075123IN
0x4393F147...03f28eFbE
0 ETH0.0000049199810.0043704
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
1073992762023-07-26 18:48:49562 days ago1690397329
0x4393F147...03f28eFbE
0 ETH
1073992762023-07-26 18:48:49562 days ago1690397329
0x4393F147...03f28eFbE
0 ETH
1073868792023-07-26 11:55:35563 days ago1690372535
0x4393F147...03f28eFbE
0 ETH
1073868792023-07-26 11:55:35563 days ago1690372535
0x4393F147...03f28eFbE
0 ETH
1073868792023-07-26 11:55:35563 days ago1690372535
0x4393F147...03f28eFbE
0 ETH
1073868792023-07-26 11:55:35563 days ago1690372535
0x4393F147...03f28eFbE
0 ETH
1073868792023-07-26 11:55:35563 days ago1690372535
0x4393F147...03f28eFbE
0 ETH
1073867262023-07-26 11:50:29563 days ago1690372229
0x4393F147...03f28eFbE
0 ETH
1073867262023-07-26 11:50:29563 days ago1690372229
0x4393F147...03f28eFbE
0 ETH
1073867262023-07-26 11:50:29563 days ago1690372229
0x4393F147...03f28eFbE
0 ETH
1073867262023-07-26 11:50:29563 days ago1690372229
0x4393F147...03f28eFbE
0 ETH
1073867062023-07-26 11:49:49563 days ago1690372189
0x4393F147...03f28eFbE
0 ETH
1073867062023-07-26 11:49:49563 days ago1690372189
0x4393F147...03f28eFbE
0 ETH
1073867062023-07-26 11:49:49563 days ago1690372189
0x4393F147...03f28eFbE
0 ETH
1073867062023-07-26 11:49:49563 days ago1690372189
0x4393F147...03f28eFbE
0 ETH
1073866612023-07-26 11:48:19563 days ago1690372099
0x4393F147...03f28eFbE
0 ETH
1073866612023-07-26 11:48:19563 days ago1690372099
0x4393F147...03f28eFbE
0 ETH
1073866612023-07-26 11:48:19563 days ago1690372099
0x4393F147...03f28eFbE
0 ETH
1073866612023-07-26 11:48:19563 days ago1690372099
0x4393F147...03f28eFbE
0 ETH
1073794382023-07-26 7:47:33563 days ago1690357653
0x4393F147...03f28eFbE
0 ETH
1073794382023-07-26 7:47:33563 days ago1690357653
0x4393F147...03f28eFbE
0 ETH
1073794382023-07-26 7:47:33563 days ago1690357653
0x4393F147...03f28eFbE
0 ETH
1073794382023-07-26 7:47:33563 days ago1690357653
0x4393F147...03f28eFbE
0 ETH
1073794382023-07-26 7:47:33563 days ago1690357653
0x4393F147...03f28eFbE
0 ETH
1073794042023-07-26 7:46:25563 days ago1690357585
0x4393F147...03f28eFbE
0 ETH
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OvertimeVoucher

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

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

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-4.4.1/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-4.4.1/utils/Counters.sol";
import "@openzeppelin/contracts-4.4.1/access/Ownable.sol";
import "@openzeppelin/contracts-4.4.1/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts-4.4.1/utils/math/SafeMath.sol";
import "@openzeppelin/contracts-4.4.1/token/ERC20/utils/SafeERC20.sol";

import "../../interfaces/ISportsAMM.sol";
import "../../interfaces/IParlayMarketsAMM.sol";
import "../../interfaces/ISportPositionalMarket.sol";
import "../../interfaces/IPosition.sol";

contract OvertimeVoucher is ERC721URIStorage, Ownable {
    /* ========== LIBRARIES ========== */

    using Counters for Counters.Counter;
    using SafeMath for uint;
    using SafeERC20 for IERC20;

    /* ========== STATE VARIABLES ========== */

    Counters.Counter private _tokenIds;

    string public _name = "Overtime Voucher";
    string public _symbol = "OVER";
    bool public paused = false;
    string public tokenURIFive;
    string public tokenURITen;
    string public tokenURITwenty;
    string public tokenURIFifty;
    string public tokenURIHundred;
    string public tokenURITwoHundred;
    string public tokenURIFiveHundred;
    string public tokenURIThousand;

    ISportsAMM public sportsAMM;
    IParlayMarketsAMM public parlayAMM;

    IERC20 public sUSD;
    mapping(uint => uint) public amountInVoucher;

    /* ========== CONSTANTS ========== */
    uint private constant ONE = 1e18;
    uint private constant FIVE = 5 * 1e18;
    uint private constant TEN = 10 * 1e18;
    uint private constant TWENTY = 20 * 1e18;
    uint private constant FIFTY = 50 * 1e18;
    uint private constant HUNDRED = 100 * 1e18;
    uint private constant TWO_HUNDRED = 200 * 1e18;
    uint private constant FIVE_HUNDRED = 500 * 1e18;
    uint private constant THOUSAND = 1000 * 1e18;

    /* ========== CONSTRUCTOR ========== */

    constructor(
        address _sUSD,
        string memory _tokenURIFive,
        string memory _tokenURITen,
        string memory _tokenURITwenty,
        string memory _tokenURIFifty,
        string memory _tokenURIHundred,
        string memory _tokenURITwoHundred,
        string memory _tokenURIFiveHundred,
        string memory _tokenURIThousand,
        address _sportsamm,
        address _parlayAMM
    ) ERC721(_name, _symbol) {
        sUSD = IERC20(_sUSD);
        tokenURIFive = _tokenURIFive;
        tokenURITen = _tokenURITen;
        tokenURITwenty = _tokenURITwenty;
        tokenURIFifty = _tokenURIFifty;
        tokenURIHundred = _tokenURIHundred;
        tokenURITwoHundred = _tokenURITwoHundred;
        tokenURIFiveHundred = _tokenURIFiveHundred;
        tokenURIThousand = _tokenURIThousand;
        sportsAMM = ISportsAMM(_sportsamm);
        sUSD.approve(_sportsamm, type(uint256).max);
        parlayAMM = IParlayMarketsAMM(_parlayAMM);
        sUSD.approve(_parlayAMM, type(uint256).max);
    }

    /* ========== TRV ========== */

    function mint(address recipient, uint amount) external returns (uint newItemId) {
        require(!paused, "Cant mint while paused");

        require(
            amount == FIVE ||
                amount == TEN ||
                amount == TWENTY ||
                amount == FIFTY ||
                amount == HUNDRED ||
                amount == TWO_HUNDRED ||
                amount == FIVE_HUNDRED ||
                amount == THOUSAND,
            "Invalid amount"
        );

        sUSD.safeTransferFrom(msg.sender, address(this), amount);

        _tokenIds.increment();

        newItemId = _tokenIds.current();

        _mint(recipient, newItemId);

        _setTokenURI(
            newItemId,
            amount == FIVE ? tokenURIFive : amount == TEN ? tokenURITen : amount == TWENTY ? tokenURITwenty : amount == FIFTY
                ? tokenURIFifty
                : amount == HUNDRED
                ? tokenURIHundred
                : amount == TWO_HUNDRED
                ? tokenURITwoHundred
                : amount == FIVE_HUNDRED
                ? tokenURIFiveHundred
                : tokenURIThousand
        );

        amountInVoucher[newItemId] = amount;
    }

    function buyFromAMMWithVoucher(
        address market,
        ISportsAMM.Position position,
        uint amount,
        uint tokenId
    ) external {
        require(!paused, "Cant buy while paused");
        require(ERC721.ownerOf(tokenId) == msg.sender, "You are not the voucher owner!");

        uint quote = sportsAMM.buyFromAmmQuote(market, position, amount);
        require(quote < amountInVoucher[tokenId], "Insufficient amount in voucher");

        sportsAMM.buyFromAMM(market, position, amount, quote, 0);
        amountInVoucher[tokenId] = amountInVoucher[tokenId] - quote;

        (IPosition home, IPosition away, IPosition draw) = ISportPositionalMarket(market).getOptions();
        IPosition target = position == ISportsAMM.Position.Home ? home : position == ISportsAMM.Position.Away ? away : draw;

        IERC20(address(target)).safeTransfer(msg.sender, amount);

        //if less than 1 sUSD, transfer the rest to the owner and burn
        if (amountInVoucher[tokenId] < 1e18) {
            sUSD.safeTransfer(address(msg.sender), amountInVoucher[tokenId]);
            super._burn(tokenId);
        }
        emit BoughtFromAmmWithVoucher(msg.sender, market, position, amount, quote, address(sUSD), address(target));
    }

    function buyFromParlayAMMWithVoucher(
        address[] calldata _sportMarkets,
        uint[] calldata _positions,
        uint _sUSDPaid,
        uint _additionalSlippage,
        uint _expectedPayout,
        uint tokenId
    ) external {
        require(!paused, "Cant buy while paused");
        require(ERC721.ownerOf(tokenId) == msg.sender, "You are not the voucher owner!");

        require(_sUSDPaid <= amountInVoucher[tokenId], "Insufficient amount in voucher");

        parlayAMM.buyFromParlay(_sportMarkets, _positions, _sUSDPaid, _additionalSlippage, _expectedPayout, msg.sender);
        amountInVoucher[tokenId] = amountInVoucher[tokenId] - _sUSDPaid;

        //if less than 1 sUSD, transfer the rest to the owner and burn
        if (amountInVoucher[tokenId] < 1e18) {
            sUSD.safeTransfer(address(msg.sender), amountInVoucher[tokenId]);
            super._burn(tokenId);
        }
        emit BoughtFromParlayWithVoucher(msg.sender, _sportMarkets, _positions, _sUSDPaid, _expectedPayout, address(sUSD));
    }

    /* ========== VIEW ========== */

    /* ========== INTERNALS ========== */

    /* ========== CONTRACT MANAGEMENT ========== */

    /// @notice Retrieve sUSD from the contract
    /// @param account whom to send the sUSD
    /// @param amount how much sUSD to retrieve
    function retrieveSUSDAmount(address payable account, uint amount) external onlyOwner {
        sUSD.safeTransfer(account, amount);
    }

    // function burnToken(uint _tokenId, address _recepient) external onlyOwner {
    //     require(amountInVoucher[_tokenId] > 0, "Amount is zero");
    //     if(_recepient != address(0)) {
    //         sUSD.safeTransfer(_recepient, amountInVoucher[_tokenId]);
    //     }
    //     super._burn(_tokenId);
    // }

    function setTokenUris(
        string memory _tokenURIFive,
        string memory _tokenURITen,
        string memory _tokenURITwenty,
        string memory _tokenURIFifty,
        string memory _tokenURIHundred,
        string memory _tokenURITwoHundred,
        string memory _tokenURIFiveHundred,
        string memory _tokenURIThousand
    ) external onlyOwner {
        tokenURIFive = _tokenURIFive;
        tokenURITen = _tokenURITen;
        tokenURITwenty = _tokenURITwenty;
        tokenURIFifty = _tokenURIFifty;
        tokenURIHundred = _tokenURIHundred;
        tokenURITwoHundred = _tokenURITwoHundred;
        tokenURIFiveHundred = _tokenURIFiveHundred;
        tokenURIThousand = _tokenURIThousand;
    }

    function setPause(bool _state) external onlyOwner {
        paused = _state;
        emit Paused(_state);
    }

    function setParlayAMM(address _parlayAMM) external onlyOwner {
        if (address(_parlayAMM) != address(0)) {
            sUSD.approve(address(sportsAMM), 0);
        }
        parlayAMM = IParlayMarketsAMM(_parlayAMM);
        sUSD.approve(_parlayAMM, type(uint256).max);
        emit NewParlayAMM(_parlayAMM);
    }

    function setSportsAMM(address _sportsAMM) external onlyOwner {
        if (address(_sportsAMM) != address(0)) {
            sUSD.approve(address(sportsAMM), 0);
        }
        sportsAMM = ISportsAMM(_sportsAMM);
        sUSD.approve(_sportsAMM, type(uint256).max);
        emit NewSportsAMM(_sportsAMM);
    }

    /* ========== EVENTS ========== */

    event BoughtFromAmmWithVoucher(
        address buyer,
        address market,
        ISportsAMM.Position position,
        uint amount,
        uint sUSDPaid,
        address susd,
        address asset
    );
    event BoughtFromParlayWithVoucher(
        address buyer,
        address[] _sportMarkets,
        uint[] _positions,
        uint _sUSDPaid,
        uint _expectedPayout,
        address susd
    );
    event NewTokenUri(string _tokenURI);
    event NewSportsAMM(address _sportsAMM);
    event NewParlayAMM(address _parlayAMM);
    event Paused(bool _state);
}

File 2 of 25 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 3 of 25 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 4 of 25 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

File 5 of 25 : ERC721URIStorage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";

/**
 * @dev ERC721 token with storage based token URI management.
 */
abstract contract ERC721URIStorage is ERC721 {
    using Strings for uint256;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }

        return super.tokenURI(tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev See {ERC721-_burn}. This override additionally checks to see if a
     * token-specific URI was set for the token, and if so, it deletes the token URI from
     * the storage mapping.
     */
    function _burn(uint256 tokenId) internal virtual override {
        super._burn(tokenId);

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
    }
}

File 6 of 25 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

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 generally not needed starting with Solidity 0.8, since 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 subtraction 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. 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;
        }
    }
}

File 7 of 25 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

interface ISportsAMM {
    /* ========== VIEWS / VARIABLES ========== */

    enum Position {
        Home,
        Away,
        Draw
    }

    struct SellRequirements {
        address user;
        address market;
        Position position;
        uint amount;
        uint expectedPayout;
        uint additionalSlippage;
    }

    function theRundownConsumer() external view returns (address);

    function getMarketDefaultOdds(address _market, bool isSell) external view returns (uint[] memory);

    function isMarketInAMMTrading(address _market) external view returns (bool);

    function availableToBuyFromAMM(address market, Position position) external view returns (uint _available);

    function parlayAMM() external view returns (address);

    function minSupportedOdds() external view returns (uint);

    function maxSupportedOdds() external view returns (uint);

    function min_spread() external view returns (uint);

    function max_spread() external view returns (uint);

    function minimalTimeLeftToMaturity() external view returns (uint);

    function getSpentOnGame(address market) external view returns (uint);

    function safeBoxImpact() external view returns (uint);

    function manager() external view returns (address);

    function apexConsumer() external view returns (address);

    function calculateCapToBeUsed(address market) external view returns (uint);

    function buyFromAMM(
        address market,
        Position position,
        uint amount,
        uint expectedPayout,
        uint additionalSlippage
    ) external;

    function buyFromAmmQuote(
        address market,
        Position position,
        uint amount
    ) external view returns (uint);

    function buyFromAmmQuoteForParlayAMM(
        address market,
        Position position,
        uint amount
    ) external view returns (uint);

    function updateParlayVolume(address _account, uint _amount) external;

    function buyPriceImpact(
        address market,
        ISportsAMM.Position position,
        uint amount
    ) external view returns (int impact);

    function obtainOdds(address _market, ISportsAMM.Position _position) external view returns (uint oddsToReturn);
}

File 9 of 25 : IParlayMarketsAMM.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface IParlayMarketsAMM {
    /* ========== VIEWS / VARIABLES ========== */

    function parlaySize() external view returns (uint);

    function sUSD() external view returns (IERC20Upgradeable);

    function sportsAmm() external view returns (address);

    function parlayAmmFee() external view returns (uint);

    function maxAllowedRiskPerCombination() external view returns (uint);

    function maxSupportedOdds() external view returns (uint);

    function riskPerCombination(
        address _sportMarkets1,
        uint _position1,
        address _sportMarkets2,
        uint _position2,
        address _sportMarkets3,
        uint _position3,
        address _sportMarkets4,
        uint _position4
    ) external view returns (uint);

    function riskPerGameCombination(
        address _sportMarkets1,
        address _sportMarkets2,
        address _sportMarkets3,
        address _sportMarkets4,
        address _sportMarkets5,
        address _sportMarkets6,
        address _sportMarkets7,
        address _sportMarkets8
    ) external view returns (uint);

    function isActiveParlay(address _parlayMarket) external view returns (bool isActiveParlayMarket);

    function exerciseParlay(address _parlayMarket) external;

    function exerciseSportMarketInParlay(address _parlayMarket, address _sportMarket) external;

    function triggerResolvedEvent(address _account, bool _userWon) external;

    function resolveParlay() external;

    function buyFromParlay(
        address[] calldata _sportMarkets,
        uint[] calldata _positions,
        uint _sUSDPaid,
        uint _additionalSlippage,
        uint _expectedPayout,
        address _differentRecepient
    ) external;
}

File 10 of 25 : ISportPositionalMarket.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16;

import "../interfaces/IPositionalMarketManager.sol";
import "../interfaces/IPosition.sol";
import "../interfaces/IPriceFeed.sol";

interface ISportPositionalMarket {
    /* ========== TYPES ========== */

    enum Phase {
        Trading,
        Maturity,
        Expiry
    }
    enum Side {
        Cancelled,
        Home,
        Away,
        Draw
    }

    /* ========== VIEWS / VARIABLES ========== */

    function getOptions()
        external
        view
        returns (
            IPosition home,
            IPosition away,
            IPosition draw
        );

    function times() external view returns (uint maturity, uint destruction);

    function initialMint() external view returns (uint);

    function getGameDetails() external view returns (bytes32 gameId, string memory gameLabel);

    function getGameId() external view returns (bytes32);

    function deposited() external view returns (uint);

    function optionsCount() external view returns (uint);

    function creator() external view returns (address);

    function resolved() external view returns (bool);

    function cancelled() external view returns (bool);

    function paused() external view returns (bool);

    function phase() external view returns (Phase);

    function canResolve() external view returns (bool);

    function result() external view returns (Side);

    function isChild() external view returns (bool);

    function tags(uint idx) external view returns (uint);

    function getParentMarketPositions() external view returns (IPosition position1, IPosition position2);

    function getStampedOdds()
        external
        view
        returns (
            uint,
            uint,
            uint
        );

    function balancesOf(address account)
        external
        view
        returns (
            uint home,
            uint away,
            uint draw
        );

    function totalSupplies()
        external
        view
        returns (
            uint home,
            uint away,
            uint draw
        );

    function isDoubleChance() external view returns (bool);

    function parentMarket() external view returns (ISportPositionalMarket);

    /* ========== MUTATIVE FUNCTIONS ========== */

    function setPaused(bool _paused) external;

    function updateDates(uint256 _maturity, uint256 _expiry) external;

    function mint(uint value) external;

    function exerciseOptions() external;

    function restoreInvalidOdds(
        uint _homeOdds,
        uint _awayOdds,
        uint _drawOdds
    ) external;
}

File 11 of 25 : IPosition.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

import "./IPositionalMarket.sol";

interface IPosition {
    /* ========== VIEWS / VARIABLES ========== */

    function getBalanceOf(address account) external view returns (uint);

    function getTotalSupply() external view returns (uint);

    function exerciseWithAmount(address claimant, uint amount) external;
}

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

pragma solidity ^0.8.0;

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

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

File 13 of 25 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

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: address zero is not a valid owner");
        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: invalid token ID");
        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) {
        _requireMinted(tokenId);

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

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden 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 token owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_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: caller is not token 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: caller is not token 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) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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);

        _afterTokenTransfer(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);

        _afterTokenTransfer(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 from incorrect owner");
        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);

        _afterTokenTransfer(from, to, tokenId);
    }

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

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @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.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-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` and `to` are never both zero.
     *
     * 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 {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 14 of 25 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

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`.
     *
     * 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;

    /**
     * @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 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @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);
}

File 15 of 25 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

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 `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 16 of 25 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

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 17 of 25 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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");

        (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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 18 of 25 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 19 of 25 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

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 20 of 25 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

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 21 of 25 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 22 of 25 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 23 of 25 : IPositionalMarketManager.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

import "../interfaces/IPositionalMarket.sol";

interface IPositionalMarketManager {
    /* ========== VIEWS / VARIABLES ========== */

    function durations() external view returns (uint expiryDuration, uint maxTimeToMaturity);

    function capitalRequirement() external view returns (uint);

    function marketCreationEnabled() external view returns (bool);

    function onlyAMMMintingAndBurning() external view returns (bool);

    function transformCollateral(uint value) external view returns (uint);

    function reverseTransformCollateral(uint value) external view returns (uint);

    function totalDeposited() external view returns (uint);

    function numActiveMarkets() external view returns (uint);

    function activeMarkets(uint index, uint pageSize) external view returns (address[] memory);

    function numMaturedMarkets() external view returns (uint);

    function maturedMarkets(uint index, uint pageSize) external view returns (address[] memory);

    function isActiveMarket(address candidate) external view returns (bool);

    function isKnownMarket(address candidate) external view returns (bool);

    function getThalesAMM() external view returns (address);

    /* ========== MUTATIVE FUNCTIONS ========== */

    function createMarket(
        bytes32 oracleKey,
        uint strikePrice,
        uint maturity,
        uint initialMint // initial sUSD to mint options for,
    ) external returns (IPositionalMarket);

    function resolveMarket(address market) external;

    function expireMarkets(address[] calldata market) external;

    function transferSusdTo(
        address sender,
        address receiver,
        uint amount
    ) external;
}

File 24 of 25 : IPriceFeed.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

interface IPriceFeed {
    // Structs
    struct RateAndUpdatedTime {
        uint216 rate;
        uint40 time;
    }

    // Mutative functions
    function addAggregator(bytes32 currencyKey, address aggregatorAddress) external;

    function removeAggregator(bytes32 currencyKey) external;

    // Views

    function rateForCurrency(bytes32 currencyKey) external view returns (uint);

    function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time);

    function getRates() external view returns (uint[] memory);

    function getCurrencies() external view returns (bytes32[] memory);
}

File 25 of 25 : IPositionalMarket.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

import "../interfaces/IPositionalMarketManager.sol";
import "../interfaces/IPosition.sol";
import "../interfaces/IPriceFeed.sol";

interface IPositionalMarket {
    /* ========== TYPES ========== */

    enum Phase {
        Trading,
        Maturity,
        Expiry
    }
    enum Side {
        Up,
        Down
    }

    /* ========== VIEWS / VARIABLES ========== */

    function getOptions() external view returns (IPosition up, IPosition down);

    function times() external view returns (uint maturity, uint destructino);

    function getOracleDetails()
        external
        view
        returns (
            bytes32 key,
            uint strikePrice,
            uint finalPrice
        );

    function fees() external view returns (uint poolFee, uint creatorFee);

    function deposited() external view returns (uint);

    function creator() external view returns (address);

    function resolved() external view returns (bool);

    function phase() external view returns (Phase);

    function oraclePrice() external view returns (uint);

    function oraclePriceAndTimestamp() external view returns (uint price, uint updatedAt);

    function canResolve() external view returns (bool);

    function result() external view returns (Side);

    function balancesOf(address account) external view returns (uint up, uint down);

    function totalSupplies() external view returns (uint up, uint down);

    function getMaximumBurnable(address account) external view returns (uint amount);

    /* ========== MUTATIVE FUNCTIONS ========== */

    function mint(uint value) external;

    function exerciseOptions() external returns (uint);

    function burnOptions(uint amount) external;

    function burnOptionsMaximum() external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_sUSD","type":"address"},{"internalType":"string","name":"_tokenURIFive","type":"string"},{"internalType":"string","name":"_tokenURITen","type":"string"},{"internalType":"string","name":"_tokenURITwenty","type":"string"},{"internalType":"string","name":"_tokenURIFifty","type":"string"},{"internalType":"string","name":"_tokenURIHundred","type":"string"},{"internalType":"string","name":"_tokenURITwoHundred","type":"string"},{"internalType":"string","name":"_tokenURIFiveHundred","type":"string"},{"internalType":"string","name":"_tokenURIThousand","type":"string"},{"internalType":"address","name":"_sportsamm","type":"address"},{"internalType":"address","name":"_parlayAMM","type":"address"}],"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":"buyer","type":"address"},{"indexed":false,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"enum ISportsAMM.Position","name":"position","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sUSDPaid","type":"uint256"},{"indexed":false,"internalType":"address","name":"susd","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"BoughtFromAmmWithVoucher","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"address[]","name":"_sportMarkets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"_positions","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"_sUSDPaid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_expectedPayout","type":"uint256"},{"indexed":false,"internalType":"address","name":"susd","type":"address"}],"name":"BoughtFromParlayWithVoucher","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_parlayAMM","type":"address"}],"name":"NewParlayAMM","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_sportsAMM","type":"address"}],"name":"NewSportsAMM","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_tokenURI","type":"string"}],"name":"NewTokenUri","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":"bool","name":"_state","type":"bool"}],"name":"Paused","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":"_name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"amountInVoucher","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":[{"internalType":"address","name":"market","type":"address"},{"internalType":"enum ISportsAMM.Position","name":"position","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"buyFromAMMWithVoucher","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_sportMarkets","type":"address[]"},{"internalType":"uint256[]","name":"_positions","type":"uint256[]"},{"internalType":"uint256","name":"_sUSDPaid","type":"uint256"},{"internalType":"uint256","name":"_additionalSlippage","type":"uint256"},{"internalType":"uint256","name":"_expectedPayout","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"buyFromParlayAMMWithVoucher","outputs":[],"stateMutability":"nonpayable","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":"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":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"newItemId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":"parlayAMM","outputs":[{"internalType":"contract IParlayMarketsAMM","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"retrieveSUSDAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sUSD","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","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":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_parlayAMM","type":"address"}],"name":"setParlayAMM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sportsAMM","type":"address"}],"name":"setSportsAMM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_tokenURIFive","type":"string"},{"internalType":"string","name":"_tokenURITen","type":"string"},{"internalType":"string","name":"_tokenURITwenty","type":"string"},{"internalType":"string","name":"_tokenURIFifty","type":"string"},{"internalType":"string","name":"_tokenURIHundred","type":"string"},{"internalType":"string","name":"_tokenURITwoHundred","type":"string"},{"internalType":"string","name":"_tokenURIFiveHundred","type":"string"},{"internalType":"string","name":"_tokenURIThousand","type":"string"}],"name":"setTokenUris","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sportsAMM","outputs":[{"internalType":"contract ISportsAMM","name":"","type":"address"}],"stateMutability":"view","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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIFifty","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIFive","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIFiveHundred","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIHundred","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURITen","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIThousand","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURITwenty","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURITwoHundred","outputs":[{"internalType":"string","name":"","type":"string"}],"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"}]

60c0604052601060808190526f27bb32b93a34b6b2902b37bab1b432b960811b60a090815262000033916009919062000482565b506040805180820190915260048082526327ab22a960e11b60209092019182526200006191600a9162000482565b50600b805460ff191690553480156200007957600080fd5b50604051620037d3380380620037d38339810160408190526200009c91620005f8565b60098054620000ab90620007e2565b80601f0160208091040260200160405190810160405280929190818152602001828054620000d990620007e2565b80156200012a5780601f10620000fe576101008083540402835291602001916200012a565b820191906000526020600020905b8154815290600101906020018083116200010c57829003601f168201915b5050505050600a80546200013e90620007e2565b80601f01602080910402602001604051908101604052809291908181526020018280546200016c90620007e2565b8015620001bd5780601f106200019157610100808354040283529160200191620001bd565b820191906000526020600020905b8154815290600101906020018083116200019f57829003601f168201915b50508451620001d793506000925060208601915062000482565b508051620001ed90600190602084019062000482565b5050506200020a620002046200042c60201b60201c565b62000430565b601680546001600160a01b0319166001600160a01b038d1617905589516200023a90600c9060208d019062000482565b5088516200025090600d9060208c019062000482565b5087516200026690600e9060208b019062000482565b5086516200027c90600f9060208a019062000482565b5085516200029290601090602089019062000482565b508451620002a890601190602088019062000482565b508351620002be90601290602087019062000482565b508251620002d490601390602086019062000482565b50601480546001600160a01b0319166001600160a01b0384811691821790925560165460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b390604401602060405180830381600087803b1580156200033c57600080fd5b505af115801562000351573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003779190620007b9565b50601580546001600160a01b0319166001600160a01b0383811691821790925560165460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b390604401602060405180830381600087803b158015620003df57600080fd5b505af1158015620003f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200041a9190620007b9565b50505050505050505050505062000835565b3390565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200049090620007e2565b90600052602060002090601f016020900481019282620004b45760008555620004ff565b82601f10620004cf57805160ff1916838001178555620004ff565b82800160010185558215620004ff579182015b82811115620004ff578251825591602001919060010190620004e2565b506200050d92915062000511565b5090565b5b808211156200050d576000815560010162000512565b80516001600160a01b03811681146200054057600080fd5b919050565b600082601f83011262000556578081fd5b81516001600160401b03808211156200057357620005736200081f565b604051601f8301601f19908116603f011681019082821181831017156200059e576200059e6200081f565b81604052838152602092508683858801011115620005ba578485fd5b8491505b83821015620005dd5785820183015181830184015290820190620005be565b83821115620005ee57848385830101525b9695505050505050565b60008060008060008060008060008060006101608c8e0312156200061a578687fd5b620006258c62000528565b60208d0151909b506001600160401b0381111562000641578788fd5b6200064f8e828f0162000545565b60408e0151909b5090506001600160401b038111156200066d578788fd5b6200067b8e828f0162000545565b60608e0151909a5090506001600160401b0381111562000699578788fd5b620006a78e828f0162000545565b60808e015190995090506001600160401b03811115620006c5578788fd5b620006d38e828f0162000545565b60a08e015190985090506001600160401b03811115620006f1578687fd5b620006ff8e828f0162000545565b60c08e015190975090506001600160401b038111156200071d578586fd5b6200072b8e828f0162000545565b60e08e015190965090506001600160401b0381111562000749578485fd5b620007578e828f0162000545565b6101008e015190955090506001600160401b0381111562000776578384fd5b620007848e828f0162000545565b935050620007966101208d0162000528565b9150620007a76101408d0162000528565b90509295989b509295989b9093969950565b600060208284031215620007cb578081fd5b81518015158114620007db578182fd5b9392505050565b600181811c90821680620007f757607f821691505b602082108114156200081957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b612f8e80620008456000396000f3fe608060405234801561001057600080fd5b506004361061023d5760003560e01c8063715018a61161013b578063b88d4fde116100b8578063e81e52ee1161007c578063e81e52ee14610493578063e985e9c5146104a6578063e9e520d6146104e2578063efb1fe35146104ea578063f2fde38b146104fd57600080fd5b8063b88d4fde1461043f578063bedb86fb14610452578063c87b56dd14610465578063c992528814610478578063d28d88521461048b57600080fd5b806395d89b41116100ff57806395d89b41146103f4578063a22cb465146103fc578063aed8fc9e1461040f578063b09f12661461042f578063b540a6751461043757600080fd5b8063715018a6146103ad578063755f388b146103b55780637d550e05146103bd5780638da5cb5b146103d05780639324cac7146103e157600080fd5b806322da870f116101c957806346acf2241161018d57806346acf2241461035f578063563dae4e146103725780635c975abb1461037a5780636352211e1461038757806370a082311461039a57600080fd5b806322da870f146102fd57806323b872dd146103105780633ccdb11f1461032357806340c10f191461032b57806342842e0e1461034c57600080fd5b80630ec9efd3116102105780630ec9efd3146102bf57806314ef86fe146102c75780631b291c7f146102cf5780631cc28552146102e257806322ba400c146102f557600080fd5b806301ffc9a71461024257806306fdde031461026a578063081812fc1461027f578063095ea7b3146102aa575b600080fd5b6102556102503660046128af565b610510565b60405190151581526020015b60405180910390f35b610272610562565b6040516102619190612d51565b61029261028d366004612a6a565b6105f4565b6040516001600160a01b039091168152602001610261565b6102bd6102b83660046127d9565b61061b565b005b610272610736565b6102726107c4565b6102bd6102dd3660046127eb565b6107d1565b6102bd6102f0366004612628565b610a11565b610272610b91565b6102bd61030b366004612933565b610b9e565b6102bd61031e3660046126a7565b610c50565b610272610c81565b61033e6103393660046127d9565b610c8e565b604051908152602001610261565b6102bd61035a3660046126a7565b610f28565b6102bd61036d366004612791565b610f43565b610272611309565b600b546102559060ff1681565b610292610395366004612a6a565b611316565b61033e6103a8366004612628565b611376565b6102bd6113fc565b610272611410565b601554610292906001600160a01b031681565b6007546001600160a01b0316610292565b601654610292906001600160a01b031681565b61027261141d565b6102bd61040a366004612764565b61142c565b61033e61041d366004612a6a565b60176020526000908152604090205481565b61027261143b565b610272611448565b6102bd61044d3660046126e7565b611455565b6102bd610460366004612877565b61148d565b610272610473366004612a6a565b6114d6565b601454610292906001600160a01b031681565b6102726115e7565b6102bd6104a1366004612628565b6115f4565b6102556104b436600461266f565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61027261176d565b6102bd6104f8366004612644565b61177a565b6102bd61050b366004612628565b611799565b60006001600160e01b031982166380ac58cd60e01b148061054157506001600160e01b03198216635b5e139f60e01b145b8061055c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606000805461057190612e73565b80601f016020809104026020016040519081016040528092919081815260200182805461059d90612e73565b80156105ea5780601f106105bf576101008083540402835291602001916105ea565b820191906000526020600020905b8154815290600101906020018083116105cd57829003601f168201915b5050505050905090565b60006105ff82611812565b506000908152600460205260409020546001600160a01b031690565b600061062682611316565b9050806001600160a01b0316836001600160a01b031614156106995760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806106b557506106b581336104b4565b6107275760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610690565b6107318383611871565b505050565b6011805461074390612e73565b80601f016020809104026020016040519081016040528092919081815260200182805461076f90612e73565b80156107bc5780601f10610791576101008083540402835291602001916107bc565b820191906000526020600020905b81548152906001019060200180831161079f57829003601f168201915b505050505081565b6013805461074390612e73565b600b5460ff161561081c5760405162461bcd60e51b815260206004820152601560248201527410d85b9d08189d5e481dda1a5b19481c185d5cd959605a1b6044820152606401610690565b3361082682611316565b6001600160a01b03161461087c5760405162461bcd60e51b815260206004820152601e60248201527f596f7520617265206e6f742074686520766f7563686572206f776e65722100006044820152606401610690565b6000818152601760205260409020548411156108da5760405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e7420616d6f756e7420696e20766f756368657200006044820152606401610690565b60155460405163f9b2c83360e01b81526001600160a01b039091169063f9b2c83390610918908b908b908b908b908b908b908b903390600401612cf9565b600060405180830381600087803b15801561093257600080fd5b505af1158015610946573d6000803e3d6000fd5b50505060008281526017602052604090205461096491508590612e30565b6000828152601760205260409020819055670de0b6b3a764000011156109b6576000818152601760205260409020546016546109ad916001600160a01b039091169033906118df565b6109b681611942565b6016546040517f71fb51bcf134e995851a6a160fb77a3e69ef292c12aaf05c8cb49a4b944d4bf2916109ff9133918c918c918c918c918c918b916001600160a01b031690612c3c565b60405180910390a15050505050505050565b610a19611982565b6001600160a01b03811615610ab25760165460145460405163095ea7b360e01b81526001600160a01b0391821660048201526000602482015291169063095ea7b390604401602060405180830381600087803b158015610a7857600080fd5b505af1158015610a8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab09190612893565b505b601580546001600160a01b0319166001600160a01b0383811691821790925560165460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b390604401602060405180830381600087803b158015610b1857600080fd5b505af1158015610b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b509190612893565b506040516001600160a01b03821681527f85dec884b9d5f668d61f62f842433df60cc0928a0bccbf0dafb98e992f2c4f41906020015b60405180910390a150565b600d805461074390612e73565b610ba6611982565b8751610bb990600c9060208b019061247a565b508651610bcd90600d9060208a019061247a565b508551610be190600e90602089019061247a565b508451610bf590600f90602088019061247a565b508351610c0990601090602087019061247a565b508251610c1d90601190602086019061247a565b508151610c3190601290602085019061247a565b508051610c4590601390602084019061247a565b505050505050505050565b610c5a33826119dc565b610c765760405162461bcd60e51b815260040161069090612db6565b610731838383611a5a565b6012805461074390612e73565b600b5460009060ff1615610cdd5760405162461bcd60e51b815260206004820152601660248201527510d85b9d081b5a5b9d081dda1a5b19481c185d5cd95960521b6044820152606401610690565b674563918244f40000821480610cfa5750678ac7230489e8000082145b80610d0d57506801158e460913d0000082145b80610d2057506802b5e3af16b188000082145b80610d33575068056bc75e2d6310000082145b80610d465750680ad78ebc5ac620000082145b80610d595750681b1ae4d6e2ef50000082145b80610d6c5750683635c9adc5dea0000082145b610da95760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610690565b601654610dc1906001600160a01b0316333085611bf6565b610dcf600880546001019055565b50600854610ddd8382611c2e565b610f1181674563918244f400008414610e8057678ac7230489e800008414610e79576801158e460913d000008414610e72576802b5e3af16b18800008414610e6b5768056bc75e2d631000008414610e6457680ad78ebc5ac62000008414610e5d57681b1ae4d6e2ef5000008414610e56576013610e83565b6012610e83565b6011610e83565b6010610e83565b600f610e83565b600e610e83565b600d610e83565b600c5b8054610e8e90612e73565b80601f0160208091040260200160405190810160405280929190818152602001828054610eba90612e73565b8015610f075780601f10610edc57610100808354040283529160200191610f07565b820191906000526020600020905b815481529060010190602001808311610eea57829003601f168201915b5050505050611d70565b600081815260176020526040902091909155919050565b61073183838360405180602001604052806000815250611455565b600b5460ff1615610f8e5760405162461bcd60e51b815260206004820152601560248201527410d85b9d08189d5e481dda1a5b19481c185d5cd959605a1b6044820152606401610690565b33610f9882611316565b6001600160a01b031614610fee5760405162461bcd60e51b815260206004820152601e60248201527f596f7520617265206e6f742074686520766f7563686572206f776e65722100006044820152606401610690565b60145460405163270e13ef60e01b81526000916001600160a01b03169063270e13ef9061102390889088908890600401612c95565b60206040518083038186803b15801561103b57600080fd5b505afa15801561104f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110739190612a82565b60008381526017602052604090205490915081106110d35760405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e7420616d6f756e7420696e20766f756368657200006044820152606401610690565b60145460405163221d7ae160e21b81526001600160a01b0390911690638875eb849061110c908890889088908790600090600401612cc0565b600060405180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b50505060008381526017602052604090205461115891508290612e30565b60176000848152602001908152602001600020819055506000806000876001600160a01b031663cc2ee1966040518163ffffffff1660e01b815260040160606040518083038186803b1580156111ad57600080fd5b505afa1580156111c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e591906128e7565b9194509250905060008088600281111561120f57634e487b7160e01b600052602160045260246000fd5b1461124757600188600281111561123657634e487b7160e01b600052602160045260246000fd5b146112415781611249565b82611249565b835b905061125f6001600160a01b03821633896118df565b600086815260176020526040902054670de0b6b3a764000011156112af576000868152601760205260409020546016546112a6916001600160a01b039091169033906118df565b6112af86611942565b6016546040517f5225d682e99fd1872cb0110d60372f8ebb3e5407caf698baed5b26daeafd8292916112f69133918d918d918d918c916001600160a01b0316908990612baf565b60405180910390a1505050505050505050565b600e805461074390612e73565b6000818152600260205260408120546001600160a01b03168061055c5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610690565b60006001600160a01b0382166113e05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610690565b506001600160a01b031660009081526003602052604090205490565b611404611982565b61140e6000611e0a565b565b6010805461074390612e73565b60606001805461057190612e73565b611437338383611e5c565b5050565b600a805461074390612e73565b600c805461074390612e73565b61145f33836119dc565b61147b5760405162461bcd60e51b815260040161069090612db6565b61148784848484611f2b565b50505050565b611495611982565b600b805460ff19168215159081179091556040519081527f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290602001610b86565b60606114e182611812565b600082815260066020526040812080546114fa90612e73565b80601f016020809104026020016040519081016040528092919081815260200182805461152690612e73565b80156115735780601f1061154857610100808354040283529160200191611573565b820191906000526020600020905b81548152906001019060200180831161155657829003601f168201915b50505050509050600061159160408051602081019091526000815290565b90508051600014156115a4575092915050565b8151156115d65780826040516020016115be929190612b80565b60405160208183030381529060405292505050919050565b6115df84611f5e565b949350505050565b6009805461074390612e73565b6115fc611982565b6001600160a01b038116156116955760165460145460405163095ea7b360e01b81526001600160a01b0391821660048201526000602482015291169063095ea7b390604401602060405180830381600087803b15801561165b57600080fd5b505af115801561166f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116939190612893565b505b601480546001600160a01b0319166001600160a01b0383811691821790925560165460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b390604401602060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117339190612893565b506040516001600160a01b03821681527ffff8440c271c1df6e96cbb45fef2b4a959501f65ce7e2a6ed01efabb263ea56590602001610b86565b600f805461074390612e73565b611782611982565b601654611437906001600160a01b031683836118df565b6117a1611982565b6001600160a01b0381166118065760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610690565b61180f81611e0a565b50565b6000818152600260205260409020546001600160a01b031661180f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610690565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118a682611316565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6040516001600160a01b03831660248201526044810182905261073190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fd2565b61194b816120a4565b6000818152600660205260409020805461196490612e73565b15905061180f57600081815260066020526040812061180f916124fe565b6007546001600160a01b0316331461140e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b6000806119e883611316565b9050806001600160a01b0316846001600160a01b03161480611a2f57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806115df5750836001600160a01b0316611a48846105f4565b6001600160a01b031614949350505050565b826001600160a01b0316611a6d82611316565b6001600160a01b031614611ad15760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610690565b6001600160a01b038216611b335760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610690565b611b3e600082611871565b6001600160a01b0383166000908152600360205260408120805460019290611b67908490612e30565b90915550506001600160a01b0382166000908152600360205260408120805460019290611b95908490612e04565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040516001600160a01b03808516602483015283166044820152606481018290526114879085906323b872dd60e01b9060840161190b565b6001600160a01b038216611c845760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610690565b6000818152600260205260409020546001600160a01b031615611ce95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610690565b6001600160a01b0382166000908152600360205260408120805460019290611d12908490612e04565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000828152600260205260409020546001600160a01b0316611deb5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610690565b600082815260066020908152604090912082516107319284019061247a565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03161415611ebe5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610690565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611f36848484611a5a565b611f428484848461213f565b6114875760405162461bcd60e51b815260040161069090612d64565b6060611f6982611812565b6000611f8060408051602081019091526000815290565b90506000815111611fa05760405180602001604052806000815250611fcb565b80611faa8461224c565b604051602001611fbb929190612b80565b6040516020818303038152906040525b9392505050565b6000612027826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123669092919063ffffffff16565b80519091501561073157808060200190518101906120459190612893565b6107315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610690565b60006120af82611316565b90506120bc600083611871565b6001600160a01b03811660009081526003602052604081208054600192906120e5908490612e30565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006001600160a01b0384163b1561224157604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612183903390899088908890600401612bff565b602060405180830381600087803b15801561219d57600080fd5b505af19250505080156121cd575060408051601f3d908101601f191682019092526121ca918101906128cb565b60015b612227573d8080156121fb576040519150601f19603f3d011682016040523d82523d6000602084013e612200565b606091505b50805161221f5760405162461bcd60e51b815260040161069090612d64565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506115df565b506001949350505050565b6060816122705750506040805180820190915260018152600360fc1b602082015290565b8160005b811561229a578061228481612eae565b91506122939050600a83612e1c565b9150612274565b60008167ffffffffffffffff8111156122c357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156122ed576020820181803683370190505b5090505b84156115df57612302600183612e30565b915061230f600a86612ec9565b61231a906030612e04565b60f81b81838151811061233d57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061235f600a86612e1c565b94506122f1565b60606115df8484600085856001600160a01b0385163b6123c85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610690565b600080866001600160a01b031685876040516123e49190612b64565b60006040518083038185875af1925050503d8060008114612421576040519150601f19603f3d011682016040523d82523d6000602084013e612426565b606091505b5091509150612436828286612441565b979650505050505050565b60608315612450575081611fcb565b8251156124605782518084602001fd5b8160405162461bcd60e51b81526004016106909190612d51565b82805461248690612e73565b90600052602060002090601f0160209004810192826124a857600085556124ee565b82601f106124c157805160ff19168380011785556124ee565b828001600101855582156124ee579182015b828111156124ee5782518255916020019190600101906124d3565b506124fa929150612534565b5090565b50805461250a90612e73565b6000825580601f1061251a575050565b601f01602090049060005260206000209081019061180f91905b5b808211156124fa5760008155600101612535565b600067ffffffffffffffff8084111561256457612564612f09565b604051601f8501601f19908116603f0116810190828211818310171561258c5761258c612f09565b816040528093508581528686860111156125a557600080fd5b858560208301376000602087830101525050509392505050565b60008083601f8401126125d0578182fd5b50813567ffffffffffffffff8111156125e7578182fd5b6020830191508360208260051b850101111561260257600080fd5b9250929050565b600082601f830112612619578081fd5b611fcb83833560208501612549565b600060208284031215612639578081fd5b8135611fcb81612f1f565b60008060408385031215612656578081fd5b823561266181612f1f565b946020939093013593505050565b60008060408385031215612681578182fd5b823561268c81612f1f565b9150602083013561269c81612f1f565b809150509250929050565b6000806000606084860312156126bb578081fd5b83356126c681612f1f565b925060208401356126d681612f1f565b929592945050506040919091013590565b600080600080608085870312156126fc578081fd5b843561270781612f1f565b9350602085013561271781612f1f565b925060408501359150606085013567ffffffffffffffff811115612739578182fd5b8501601f81018713612749578182fd5b61275887823560208401612549565b91505092959194509250565b60008060408385031215612776578182fd5b823561278181612f1f565b9150602083013561269c81612f34565b600080600080608085870312156127a6578384fd5b84356127b181612f1f565b93506020850135600381106127c4578384fd5b93969395505050506040820135916060013590565b60008060408385031215612656578182fd5b60008060008060008060008060c0898b031215612806578586fd5b883567ffffffffffffffff8082111561281d578788fd5b6128298c838d016125bf565b909a50985060208b0135915080821115612841578788fd5b5061284e8b828c016125bf565b999c989b5099604081013598606082013598506080820135975060a09091013595509350505050565b600060208284031215612888578081fd5b8135611fcb81612f34565b6000602082840312156128a4578081fd5b8151611fcb81612f34565b6000602082840312156128c0578081fd5b8135611fcb81612f42565b6000602082840312156128dc578081fd5b8151611fcb81612f42565b6000806000606084860312156128fb578081fd5b835161290681612f1f565b602085015190935061291781612f1f565b604085015190925061292881612f1f565b809150509250925092565b600080600080600080600080610100898b03121561294f578182fd5b883567ffffffffffffffff80821115612966578384fd5b6129728c838d01612609565b995060208b0135915080821115612987578384fd5b6129938c838d01612609565b985060408b01359150808211156129a8578384fd5b6129b48c838d01612609565b975060608b01359150808211156129c9578384fd5b6129d58c838d01612609565b965060808b01359150808211156129ea578384fd5b6129f68c838d01612609565b955060a08b0135915080821115612a0b578384fd5b612a178c838d01612609565b945060c08b0135915080821115612a2c578384fd5b612a388c838d01612609565b935060e08b0135915080821115612a4d578283fd5b50612a5a8b828c01612609565b9150509295985092959890939650565b600060208284031215612a7b578081fd5b5035919050565b600060208284031215612a93578081fd5b5051919050565b81835260006020808501945082825b85811015612ad7578135612abc81612f1f565b6001600160a01b031687529582019590820190600101612aa9565b509495945050505050565b81835260006001600160fb1b03831115612afa578081fd5b8260051b80836020870137939093016020019283525090919050565b60008151808452612b2e816020860160208601612e47565b601f01601f19169290920160200192915050565b60038110612b6057634e487b7160e01b600052602160045260246000fd5b9052565b60008251612b76818460208701612e47565b9190910192915050565b60008351612b92818460208801612e47565b835190830190612ba6818360208801612e47565b01949350505050565b6001600160a01b038881168252878116602083015260e0820190612bd66040840189612b42565b86606084015285608084015280851660a084015280841660c08401525098975050505050505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612c3290830184612b16565b9695505050505050565b600060018060a01b03808b16835260c06020840152612c5f60c084018a8c612a9a565b8381036040850152612c7281898b612ae2565b606085019790975250608083019490945250911660a09091015295945050505050565b6001600160a01b038416815260608101612cb26020830185612b42565b826040830152949350505050565b6001600160a01b038616815260a08101612cdd6020830187612b42565b8460408301528360608301528260808301529695505050505050565b60c081526000612d0d60c083018a8c612a9a565b8281036020840152612d2081898b612ae2565b60408401979097525050606081019390935260808301919091526001600160a01b031660a090910152949350505050565b602081526000611fcb6020830184612b16565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b60008219821115612e1757612e17612edd565b500190565b600082612e2b57612e2b612ef3565b500490565b600082821015612e4257612e42612edd565b500390565b60005b83811015612e62578181015183820152602001612e4a565b838111156114875750506000910152565b600181811c90821680612e8757607f821691505b60208210811415612ea857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612ec257612ec2612edd565b5060010190565b600082612ed857612ed8612ef3565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461180f57600080fd5b801515811461180f57600080fd5b6001600160e01b03198116811461180f57600080fdfea2646970667358221220c05b6af43ff6875c90be5f5f7e41d07b77ea722b25e938c81e0296194230392564736f6c634300080400330000000000000000000000008c6f28f2f1a3c87f0f938b96d27520d9751ec8d9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000170a5714112daeff20e798b6e92e25b86ea603c100000000000000000000000082b3634c0518507d5d817be6dab6233ebe4d68d9000000000000000000000000000000000000000000000000000000000000004268747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d352e706e67000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004368747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d31302e706e670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004368747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d32302e706e670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004368747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d35302e706e670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004468747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d3130302e706e6700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004468747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d3230302e706e6700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004468747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d3530302e706e6700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004568747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d313030302e706e67000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061023d5760003560e01c8063715018a61161013b578063b88d4fde116100b8578063e81e52ee1161007c578063e81e52ee14610493578063e985e9c5146104a6578063e9e520d6146104e2578063efb1fe35146104ea578063f2fde38b146104fd57600080fd5b8063b88d4fde1461043f578063bedb86fb14610452578063c87b56dd14610465578063c992528814610478578063d28d88521461048b57600080fd5b806395d89b41116100ff57806395d89b41146103f4578063a22cb465146103fc578063aed8fc9e1461040f578063b09f12661461042f578063b540a6751461043757600080fd5b8063715018a6146103ad578063755f388b146103b55780637d550e05146103bd5780638da5cb5b146103d05780639324cac7146103e157600080fd5b806322da870f116101c957806346acf2241161018d57806346acf2241461035f578063563dae4e146103725780635c975abb1461037a5780636352211e1461038757806370a082311461039a57600080fd5b806322da870f146102fd57806323b872dd146103105780633ccdb11f1461032357806340c10f191461032b57806342842e0e1461034c57600080fd5b80630ec9efd3116102105780630ec9efd3146102bf57806314ef86fe146102c75780631b291c7f146102cf5780631cc28552146102e257806322ba400c146102f557600080fd5b806301ffc9a71461024257806306fdde031461026a578063081812fc1461027f578063095ea7b3146102aa575b600080fd5b6102556102503660046128af565b610510565b60405190151581526020015b60405180910390f35b610272610562565b6040516102619190612d51565b61029261028d366004612a6a565b6105f4565b6040516001600160a01b039091168152602001610261565b6102bd6102b83660046127d9565b61061b565b005b610272610736565b6102726107c4565b6102bd6102dd3660046127eb565b6107d1565b6102bd6102f0366004612628565b610a11565b610272610b91565b6102bd61030b366004612933565b610b9e565b6102bd61031e3660046126a7565b610c50565b610272610c81565b61033e6103393660046127d9565b610c8e565b604051908152602001610261565b6102bd61035a3660046126a7565b610f28565b6102bd61036d366004612791565b610f43565b610272611309565b600b546102559060ff1681565b610292610395366004612a6a565b611316565b61033e6103a8366004612628565b611376565b6102bd6113fc565b610272611410565b601554610292906001600160a01b031681565b6007546001600160a01b0316610292565b601654610292906001600160a01b031681565b61027261141d565b6102bd61040a366004612764565b61142c565b61033e61041d366004612a6a565b60176020526000908152604090205481565b61027261143b565b610272611448565b6102bd61044d3660046126e7565b611455565b6102bd610460366004612877565b61148d565b610272610473366004612a6a565b6114d6565b601454610292906001600160a01b031681565b6102726115e7565b6102bd6104a1366004612628565b6115f4565b6102556104b436600461266f565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61027261176d565b6102bd6104f8366004612644565b61177a565b6102bd61050b366004612628565b611799565b60006001600160e01b031982166380ac58cd60e01b148061054157506001600160e01b03198216635b5e139f60e01b145b8061055c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606000805461057190612e73565b80601f016020809104026020016040519081016040528092919081815260200182805461059d90612e73565b80156105ea5780601f106105bf576101008083540402835291602001916105ea565b820191906000526020600020905b8154815290600101906020018083116105cd57829003601f168201915b5050505050905090565b60006105ff82611812565b506000908152600460205260409020546001600160a01b031690565b600061062682611316565b9050806001600160a01b0316836001600160a01b031614156106995760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806106b557506106b581336104b4565b6107275760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610690565b6107318383611871565b505050565b6011805461074390612e73565b80601f016020809104026020016040519081016040528092919081815260200182805461076f90612e73565b80156107bc5780601f10610791576101008083540402835291602001916107bc565b820191906000526020600020905b81548152906001019060200180831161079f57829003601f168201915b505050505081565b6013805461074390612e73565b600b5460ff161561081c5760405162461bcd60e51b815260206004820152601560248201527410d85b9d08189d5e481dda1a5b19481c185d5cd959605a1b6044820152606401610690565b3361082682611316565b6001600160a01b03161461087c5760405162461bcd60e51b815260206004820152601e60248201527f596f7520617265206e6f742074686520766f7563686572206f776e65722100006044820152606401610690565b6000818152601760205260409020548411156108da5760405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e7420616d6f756e7420696e20766f756368657200006044820152606401610690565b60155460405163f9b2c83360e01b81526001600160a01b039091169063f9b2c83390610918908b908b908b908b908b908b908b903390600401612cf9565b600060405180830381600087803b15801561093257600080fd5b505af1158015610946573d6000803e3d6000fd5b50505060008281526017602052604090205461096491508590612e30565b6000828152601760205260409020819055670de0b6b3a764000011156109b6576000818152601760205260409020546016546109ad916001600160a01b039091169033906118df565b6109b681611942565b6016546040517f71fb51bcf134e995851a6a160fb77a3e69ef292c12aaf05c8cb49a4b944d4bf2916109ff9133918c918c918c918c918c918b916001600160a01b031690612c3c565b60405180910390a15050505050505050565b610a19611982565b6001600160a01b03811615610ab25760165460145460405163095ea7b360e01b81526001600160a01b0391821660048201526000602482015291169063095ea7b390604401602060405180830381600087803b158015610a7857600080fd5b505af1158015610a8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab09190612893565b505b601580546001600160a01b0319166001600160a01b0383811691821790925560165460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b390604401602060405180830381600087803b158015610b1857600080fd5b505af1158015610b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b509190612893565b506040516001600160a01b03821681527f85dec884b9d5f668d61f62f842433df60cc0928a0bccbf0dafb98e992f2c4f41906020015b60405180910390a150565b600d805461074390612e73565b610ba6611982565b8751610bb990600c9060208b019061247a565b508651610bcd90600d9060208a019061247a565b508551610be190600e90602089019061247a565b508451610bf590600f90602088019061247a565b508351610c0990601090602087019061247a565b508251610c1d90601190602086019061247a565b508151610c3190601290602085019061247a565b508051610c4590601390602084019061247a565b505050505050505050565b610c5a33826119dc565b610c765760405162461bcd60e51b815260040161069090612db6565b610731838383611a5a565b6012805461074390612e73565b600b5460009060ff1615610cdd5760405162461bcd60e51b815260206004820152601660248201527510d85b9d081b5a5b9d081dda1a5b19481c185d5cd95960521b6044820152606401610690565b674563918244f40000821480610cfa5750678ac7230489e8000082145b80610d0d57506801158e460913d0000082145b80610d2057506802b5e3af16b188000082145b80610d33575068056bc75e2d6310000082145b80610d465750680ad78ebc5ac620000082145b80610d595750681b1ae4d6e2ef50000082145b80610d6c5750683635c9adc5dea0000082145b610da95760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610690565b601654610dc1906001600160a01b0316333085611bf6565b610dcf600880546001019055565b50600854610ddd8382611c2e565b610f1181674563918244f400008414610e8057678ac7230489e800008414610e79576801158e460913d000008414610e72576802b5e3af16b18800008414610e6b5768056bc75e2d631000008414610e6457680ad78ebc5ac62000008414610e5d57681b1ae4d6e2ef5000008414610e56576013610e83565b6012610e83565b6011610e83565b6010610e83565b600f610e83565b600e610e83565b600d610e83565b600c5b8054610e8e90612e73565b80601f0160208091040260200160405190810160405280929190818152602001828054610eba90612e73565b8015610f075780601f10610edc57610100808354040283529160200191610f07565b820191906000526020600020905b815481529060010190602001808311610eea57829003601f168201915b5050505050611d70565b600081815260176020526040902091909155919050565b61073183838360405180602001604052806000815250611455565b600b5460ff1615610f8e5760405162461bcd60e51b815260206004820152601560248201527410d85b9d08189d5e481dda1a5b19481c185d5cd959605a1b6044820152606401610690565b33610f9882611316565b6001600160a01b031614610fee5760405162461bcd60e51b815260206004820152601e60248201527f596f7520617265206e6f742074686520766f7563686572206f776e65722100006044820152606401610690565b60145460405163270e13ef60e01b81526000916001600160a01b03169063270e13ef9061102390889088908890600401612c95565b60206040518083038186803b15801561103b57600080fd5b505afa15801561104f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110739190612a82565b60008381526017602052604090205490915081106110d35760405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e7420616d6f756e7420696e20766f756368657200006044820152606401610690565b60145460405163221d7ae160e21b81526001600160a01b0390911690638875eb849061110c908890889088908790600090600401612cc0565b600060405180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b50505060008381526017602052604090205461115891508290612e30565b60176000848152602001908152602001600020819055506000806000876001600160a01b031663cc2ee1966040518163ffffffff1660e01b815260040160606040518083038186803b1580156111ad57600080fd5b505afa1580156111c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e591906128e7565b9194509250905060008088600281111561120f57634e487b7160e01b600052602160045260246000fd5b1461124757600188600281111561123657634e487b7160e01b600052602160045260246000fd5b146112415781611249565b82611249565b835b905061125f6001600160a01b03821633896118df565b600086815260176020526040902054670de0b6b3a764000011156112af576000868152601760205260409020546016546112a6916001600160a01b039091169033906118df565b6112af86611942565b6016546040517f5225d682e99fd1872cb0110d60372f8ebb3e5407caf698baed5b26daeafd8292916112f69133918d918d918d918c916001600160a01b0316908990612baf565b60405180910390a1505050505050505050565b600e805461074390612e73565b6000818152600260205260408120546001600160a01b03168061055c5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610690565b60006001600160a01b0382166113e05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610690565b506001600160a01b031660009081526003602052604090205490565b611404611982565b61140e6000611e0a565b565b6010805461074390612e73565b60606001805461057190612e73565b611437338383611e5c565b5050565b600a805461074390612e73565b600c805461074390612e73565b61145f33836119dc565b61147b5760405162461bcd60e51b815260040161069090612db6565b61148784848484611f2b565b50505050565b611495611982565b600b805460ff19168215159081179091556040519081527f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290602001610b86565b60606114e182611812565b600082815260066020526040812080546114fa90612e73565b80601f016020809104026020016040519081016040528092919081815260200182805461152690612e73565b80156115735780601f1061154857610100808354040283529160200191611573565b820191906000526020600020905b81548152906001019060200180831161155657829003601f168201915b50505050509050600061159160408051602081019091526000815290565b90508051600014156115a4575092915050565b8151156115d65780826040516020016115be929190612b80565b60405160208183030381529060405292505050919050565b6115df84611f5e565b949350505050565b6009805461074390612e73565b6115fc611982565b6001600160a01b038116156116955760165460145460405163095ea7b360e01b81526001600160a01b0391821660048201526000602482015291169063095ea7b390604401602060405180830381600087803b15801561165b57600080fd5b505af115801561166f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116939190612893565b505b601480546001600160a01b0319166001600160a01b0383811691821790925560165460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b390604401602060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117339190612893565b506040516001600160a01b03821681527ffff8440c271c1df6e96cbb45fef2b4a959501f65ce7e2a6ed01efabb263ea56590602001610b86565b600f805461074390612e73565b611782611982565b601654611437906001600160a01b031683836118df565b6117a1611982565b6001600160a01b0381166118065760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610690565b61180f81611e0a565b50565b6000818152600260205260409020546001600160a01b031661180f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610690565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118a682611316565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6040516001600160a01b03831660248201526044810182905261073190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fd2565b61194b816120a4565b6000818152600660205260409020805461196490612e73565b15905061180f57600081815260066020526040812061180f916124fe565b6007546001600160a01b0316331461140e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b6000806119e883611316565b9050806001600160a01b0316846001600160a01b03161480611a2f57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806115df5750836001600160a01b0316611a48846105f4565b6001600160a01b031614949350505050565b826001600160a01b0316611a6d82611316565b6001600160a01b031614611ad15760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610690565b6001600160a01b038216611b335760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610690565b611b3e600082611871565b6001600160a01b0383166000908152600360205260408120805460019290611b67908490612e30565b90915550506001600160a01b0382166000908152600360205260408120805460019290611b95908490612e04565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040516001600160a01b03808516602483015283166044820152606481018290526114879085906323b872dd60e01b9060840161190b565b6001600160a01b038216611c845760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610690565b6000818152600260205260409020546001600160a01b031615611ce95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610690565b6001600160a01b0382166000908152600360205260408120805460019290611d12908490612e04565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000828152600260205260409020546001600160a01b0316611deb5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610690565b600082815260066020908152604090912082516107319284019061247a565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03161415611ebe5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610690565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611f36848484611a5a565b611f428484848461213f565b6114875760405162461bcd60e51b815260040161069090612d64565b6060611f6982611812565b6000611f8060408051602081019091526000815290565b90506000815111611fa05760405180602001604052806000815250611fcb565b80611faa8461224c565b604051602001611fbb929190612b80565b6040516020818303038152906040525b9392505050565b6000612027826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123669092919063ffffffff16565b80519091501561073157808060200190518101906120459190612893565b6107315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610690565b60006120af82611316565b90506120bc600083611871565b6001600160a01b03811660009081526003602052604081208054600192906120e5908490612e30565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006001600160a01b0384163b1561224157604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612183903390899088908890600401612bff565b602060405180830381600087803b15801561219d57600080fd5b505af19250505080156121cd575060408051601f3d908101601f191682019092526121ca918101906128cb565b60015b612227573d8080156121fb576040519150601f19603f3d011682016040523d82523d6000602084013e612200565b606091505b50805161221f5760405162461bcd60e51b815260040161069090612d64565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506115df565b506001949350505050565b6060816122705750506040805180820190915260018152600360fc1b602082015290565b8160005b811561229a578061228481612eae565b91506122939050600a83612e1c565b9150612274565b60008167ffffffffffffffff8111156122c357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156122ed576020820181803683370190505b5090505b84156115df57612302600183612e30565b915061230f600a86612ec9565b61231a906030612e04565b60f81b81838151811061233d57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061235f600a86612e1c565b94506122f1565b60606115df8484600085856001600160a01b0385163b6123c85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610690565b600080866001600160a01b031685876040516123e49190612b64565b60006040518083038185875af1925050503d8060008114612421576040519150601f19603f3d011682016040523d82523d6000602084013e612426565b606091505b5091509150612436828286612441565b979650505050505050565b60608315612450575081611fcb565b8251156124605782518084602001fd5b8160405162461bcd60e51b81526004016106909190612d51565b82805461248690612e73565b90600052602060002090601f0160209004810192826124a857600085556124ee565b82601f106124c157805160ff19168380011785556124ee565b828001600101855582156124ee579182015b828111156124ee5782518255916020019190600101906124d3565b506124fa929150612534565b5090565b50805461250a90612e73565b6000825580601f1061251a575050565b601f01602090049060005260206000209081019061180f91905b5b808211156124fa5760008155600101612535565b600067ffffffffffffffff8084111561256457612564612f09565b604051601f8501601f19908116603f0116810190828211818310171561258c5761258c612f09565b816040528093508581528686860111156125a557600080fd5b858560208301376000602087830101525050509392505050565b60008083601f8401126125d0578182fd5b50813567ffffffffffffffff8111156125e7578182fd5b6020830191508360208260051b850101111561260257600080fd5b9250929050565b600082601f830112612619578081fd5b611fcb83833560208501612549565b600060208284031215612639578081fd5b8135611fcb81612f1f565b60008060408385031215612656578081fd5b823561266181612f1f565b946020939093013593505050565b60008060408385031215612681578182fd5b823561268c81612f1f565b9150602083013561269c81612f1f565b809150509250929050565b6000806000606084860312156126bb578081fd5b83356126c681612f1f565b925060208401356126d681612f1f565b929592945050506040919091013590565b600080600080608085870312156126fc578081fd5b843561270781612f1f565b9350602085013561271781612f1f565b925060408501359150606085013567ffffffffffffffff811115612739578182fd5b8501601f81018713612749578182fd5b61275887823560208401612549565b91505092959194509250565b60008060408385031215612776578182fd5b823561278181612f1f565b9150602083013561269c81612f34565b600080600080608085870312156127a6578384fd5b84356127b181612f1f565b93506020850135600381106127c4578384fd5b93969395505050506040820135916060013590565b60008060408385031215612656578182fd5b60008060008060008060008060c0898b031215612806578586fd5b883567ffffffffffffffff8082111561281d578788fd5b6128298c838d016125bf565b909a50985060208b0135915080821115612841578788fd5b5061284e8b828c016125bf565b999c989b5099604081013598606082013598506080820135975060a09091013595509350505050565b600060208284031215612888578081fd5b8135611fcb81612f34565b6000602082840312156128a4578081fd5b8151611fcb81612f34565b6000602082840312156128c0578081fd5b8135611fcb81612f42565b6000602082840312156128dc578081fd5b8151611fcb81612f42565b6000806000606084860312156128fb578081fd5b835161290681612f1f565b602085015190935061291781612f1f565b604085015190925061292881612f1f565b809150509250925092565b600080600080600080600080610100898b03121561294f578182fd5b883567ffffffffffffffff80821115612966578384fd5b6129728c838d01612609565b995060208b0135915080821115612987578384fd5b6129938c838d01612609565b985060408b01359150808211156129a8578384fd5b6129b48c838d01612609565b975060608b01359150808211156129c9578384fd5b6129d58c838d01612609565b965060808b01359150808211156129ea578384fd5b6129f68c838d01612609565b955060a08b0135915080821115612a0b578384fd5b612a178c838d01612609565b945060c08b0135915080821115612a2c578384fd5b612a388c838d01612609565b935060e08b0135915080821115612a4d578283fd5b50612a5a8b828c01612609565b9150509295985092959890939650565b600060208284031215612a7b578081fd5b5035919050565b600060208284031215612a93578081fd5b5051919050565b81835260006020808501945082825b85811015612ad7578135612abc81612f1f565b6001600160a01b031687529582019590820190600101612aa9565b509495945050505050565b81835260006001600160fb1b03831115612afa578081fd5b8260051b80836020870137939093016020019283525090919050565b60008151808452612b2e816020860160208601612e47565b601f01601f19169290920160200192915050565b60038110612b6057634e487b7160e01b600052602160045260246000fd5b9052565b60008251612b76818460208701612e47565b9190910192915050565b60008351612b92818460208801612e47565b835190830190612ba6818360208801612e47565b01949350505050565b6001600160a01b038881168252878116602083015260e0820190612bd66040840189612b42565b86606084015285608084015280851660a084015280841660c08401525098975050505050505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612c3290830184612b16565b9695505050505050565b600060018060a01b03808b16835260c06020840152612c5f60c084018a8c612a9a565b8381036040850152612c7281898b612ae2565b606085019790975250608083019490945250911660a09091015295945050505050565b6001600160a01b038416815260608101612cb26020830185612b42565b826040830152949350505050565b6001600160a01b038616815260a08101612cdd6020830187612b42565b8460408301528360608301528260808301529695505050505050565b60c081526000612d0d60c083018a8c612a9a565b8281036020840152612d2081898b612ae2565b60408401979097525050606081019390935260808301919091526001600160a01b031660a090910152949350505050565b602081526000611fcb6020830184612b16565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b60008219821115612e1757612e17612edd565b500190565b600082612e2b57612e2b612ef3565b500490565b600082821015612e4257612e42612edd565b500390565b60005b83811015612e62578181015183820152602001612e4a565b838111156114875750506000910152565b600181811c90821680612e8757607f821691505b60208210811415612ea857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612ec257612ec2612edd565b5060010190565b600082612ed857612ed8612ef3565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461180f57600080fd5b801515811461180f57600080fd5b6001600160e01b03198116811461180f57600080fdfea2646970667358221220c05b6af43ff6875c90be5f5f7e41d07b77ea722b25e938c81e0296194230392564736f6c63430008040033

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

0000000000000000000000008c6f28f2f1a3c87f0f938b96d27520d9751ec8d9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000170a5714112daeff20e798b6e92e25b86ea603c100000000000000000000000082b3634c0518507d5d817be6dab6233ebe4d68d9000000000000000000000000000000000000000000000000000000000000004268747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d352e706e67000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004368747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d31302e706e670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004368747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d32302e706e670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004368747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d35302e706e670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004468747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d3130302e706e6700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004468747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d3230302e706e6700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004468747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d3530302e706e6700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004568747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d313030302e706e67000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _sUSD (address): 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9
Arg [1] : _tokenURIFive (string): https://thales-protocol.s3.eu-north-1.amazonaws.com/voucher1-5.png
Arg [2] : _tokenURITen (string): https://thales-protocol.s3.eu-north-1.amazonaws.com/voucher1-10.png
Arg [3] : _tokenURITwenty (string): https://thales-protocol.s3.eu-north-1.amazonaws.com/voucher1-20.png
Arg [4] : _tokenURIFifty (string): https://thales-protocol.s3.eu-north-1.amazonaws.com/voucher1-50.png
Arg [5] : _tokenURIHundred (string): https://thales-protocol.s3.eu-north-1.amazonaws.com/voucher1-100.png
Arg [6] : _tokenURITwoHundred (string): https://thales-protocol.s3.eu-north-1.amazonaws.com/voucher1-200.png
Arg [7] : _tokenURIFiveHundred (string): https://thales-protocol.s3.eu-north-1.amazonaws.com/voucher1-500.png
Arg [8] : _tokenURIThousand (string): https://thales-protocol.s3.eu-north-1.amazonaws.com/voucher1-1000.png
Arg [9] : _sportsamm (address): 0x170a5714112daEfF20E798B6e92e25B86Ea603C1
Arg [10] : _parlayAMM (address): 0x82B3634C0518507D5d817bE6dAb6233ebE4D68D9

-----Encoded View---------------
43 Constructor Arguments found :
Arg [0] : 0000000000000000000000008c6f28f2f1a3c87f0f938b96d27520d9751ec8d9
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [4] : 00000000000000000000000000000000000000000000000000000000000002e0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000360
Arg [6] : 00000000000000000000000000000000000000000000000000000000000003e0
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000460
Arg [8] : 00000000000000000000000000000000000000000000000000000000000004e0
Arg [9] : 000000000000000000000000170a5714112daeff20e798b6e92e25b86ea603c1
Arg [10] : 00000000000000000000000082b3634c0518507d5d817be6dab6233ebe4d68d9
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000042
Arg [12] : 68747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f
Arg [13] : 7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d352e70
Arg [14] : 6e67000000000000000000000000000000000000000000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [16] : 68747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f
Arg [17] : 7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d31302e
Arg [18] : 706e670000000000000000000000000000000000000000000000000000000000
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [20] : 68747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f
Arg [21] : 7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d32302e
Arg [22] : 706e670000000000000000000000000000000000000000000000000000000000
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [24] : 68747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f
Arg [25] : 7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d35302e
Arg [26] : 706e670000000000000000000000000000000000000000000000000000000000
Arg [27] : 0000000000000000000000000000000000000000000000000000000000000044
Arg [28] : 68747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f
Arg [29] : 7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d313030
Arg [30] : 2e706e6700000000000000000000000000000000000000000000000000000000
Arg [31] : 0000000000000000000000000000000000000000000000000000000000000044
Arg [32] : 68747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f
Arg [33] : 7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d323030
Arg [34] : 2e706e6700000000000000000000000000000000000000000000000000000000
Arg [35] : 0000000000000000000000000000000000000000000000000000000000000044
Arg [36] : 68747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f
Arg [37] : 7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d353030
Arg [38] : 2e706e6700000000000000000000000000000000000000000000000000000000
Arg [39] : 0000000000000000000000000000000000000000000000000000000000000045
Arg [40] : 68747470733a2f2f7468616c65732d70726f746f636f6c2e73332e65752d6e6f
Arg [41] : 7274682d312e616d617a6f6e6177732e636f6d2f766f7563686572312d313030
Arg [42] : 302e706e67000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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