ETH Price: $2,648.66 (+0.34%)

Token

 

Overview

Max Total Supply

0

Holders

45

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

0xBe7F644Cc8b30D45786f78B253f6F72eD3D0F31a
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
PremiaOption

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 50 runs

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

pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;

import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import '@openzeppelin/contracts/utils/SafeCast.sol';

import "./interface/IERC20Extended.sol";
import "./interface/IFeeCalculator.sol";
import "./interface/IFlashLoanReceiver.sol";
import "./interface/IPremiaReferral.sol";
import "./interface/IPremiaUncutErc20.sol";

import "./uniswapV2/interfaces/IUniswapV2Router02.sol";


/// @author Premia
/// @title An option contract
contract PremiaOption is Ownable, ERC1155, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    struct OptionWriteArgs {
        address token;                  // Token address
        uint256 amount;                 // Amount of tokens to write option for
        uint256 strikePrice;            // Strike price (Must follow strikePriceIncrement of token)
        uint256 expiration;             // Expiration timestamp of the option (Must follow expirationIncrement)
        bool isCall;                    // If true : Call option | If false : Put option
    }

    struct OptionData {
        address token;                  // Token address
        uint256 strikePrice;            // Strike price (Must follow strikePriceIncrement of token)
        uint256 expiration;             // Expiration timestamp of the option (Must follow expirationIncrement)
        bool isCall;                    // If true : Call option | If false : Put option
        uint256 claimsPreExp;           // Amount of options from which the funds have been withdrawn pre expiration
        uint256 claimsPostExp;          // Amount of options from which the funds have been withdrawn post expiration
        uint256 exercised;              // Amount of options which have been exercised
        uint256 supply;                 // Total circulating supply
        uint8 decimals;                 // Token decimals
    }

    // Total write cost = collateral + fee + feeReferrer
    struct QuoteWrite {
        address collateralToken;        // The token to deposit as collateral
        uint256 collateral;             // The amount of collateral to deposit
        uint8 collateralDecimals;       // Decimals of collateral token
        uint256 fee;                    // The amount of collateralToken needed to be paid as protocol fee
        uint256 feeReferrer;            // The amount of collateralToken which will be paid the referrer
    }

    // Total exercise cost = input + fee + feeReferrer
    struct QuoteExercise {
        address inputToken;             // Input token for exercise
        uint256 input;                  // Amount of input token to pay to exercise
        uint8 inputDecimals;            // Decimals of input token
        address outputToken;            // Output token from the exercise
        uint256 output;                 // Amount of output tokens which will be received on exercise
        uint8 outputDecimals;           // Decimals of output token
        uint256 fee;                    // The amount of inputToken needed to be paid as protocol fee
        uint256 feeReferrer;            // The amount of inputToken which will be paid to the referrer
    }

    struct Pool {
        uint256 tokenAmount;            // The amount of tokens in the option pool
        uint256 denominatorAmount;      // The amounts of denominator in the option pool
    }

    IERC20 public denominator;
    uint8 public denominatorDecimals;

    //////////////////////////////////////////////////

    // Address receiving protocol fees (PremiaMaker)
    address public feeRecipient;

    // PremiaReferral contract
    IPremiaReferral public premiaReferral;
    // The uPremia token
    IPremiaUncutErc20 public uPremia;
    // FeeCalculator contract
    IFeeCalculator public feeCalculator;

    //////////////////////////////////////////////////

    // Whitelisted tokens for which options can be written (Each token must also have a non 0 strike price increment to be enabled)
    address[] public tokens;
    // Strike price increment mapping of each token
    mapping (address => uint256) public tokenStrikeIncrement;

    //////////////////////////////////////////////////

    // The option id of next option type which will be created
    uint256 public nextOptionId = 1;

    // Offset to add to Unix timestamp to make it Fri 23:59:59 UTC
    uint256 private constant _baseExpiration = 172799;
    // Expiration increment
    uint256 private constant _expirationIncrement = 1 weeks;
    // Max expiration time from now
    uint256 public maxExpiration = 365 days;

    // Uniswap routers allowed to be used for swap from flashExercise
    address[] public whitelistedUniswapRouters;

    // token => expiration => strikePrice => isCall (1 for call, 0 for put) => optionId
    mapping (address => mapping(uint256 => mapping(uint256 => mapping (bool => uint256)))) public options;

    // optionId => OptionData
    mapping (uint256 => OptionData) public optionData;

    // optionId => Pool
    mapping (uint256 => Pool) public pools;

    // account => optionId => amount of options written
    mapping (address => mapping (uint256 => uint256)) public nbWritten;

    ////////////
    // Events //
    ////////////

    event SetToken(address indexed token, uint256 strikePriceIncrement);
    event OptionIdCreated(uint256 indexed optionId, address indexed token);
    event OptionWritten(address indexed owner, uint256 indexed optionId, address indexed token, uint256 amount);
    event OptionCancelled(address indexed owner, uint256 indexed optionId, address indexed token, uint256 amount);
    event OptionExercised(address indexed user, uint256 indexed optionId, address indexed token, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed optionId, address indexed token, uint256 amount);
    event FeePaid(address indexed user, address indexed token, address indexed referrer, uint256 feeProtocol, uint256 feeReferrer);

    //////////////////////////////////////////////////
    //////////////////////////////////////////////////
    //////////////////////////////////////////////////

    /// @param _uri URI of ERC1155 metadata
    /// @param _denominator The token used as denominator
    /// @param _uPremia The uPremia token
    /// @param _feeCalculator FeeCalculator contract
    /// @param _premiaReferral PremiaReferral contract
    /// @param _feeRecipient Recipient of protocol fees (PremiaMaker)
    constructor(string memory _uri, IERC20 _denominator, IPremiaUncutErc20 _uPremia, IFeeCalculator _feeCalculator,
        IPremiaReferral _premiaReferral, address _feeRecipient) ERC1155(_uri) {
        denominator = _denominator;
        uPremia = _uPremia;
        feeCalculator = _feeCalculator;
        feeRecipient = _feeRecipient;
        premiaReferral = _premiaReferral;
        denominatorDecimals = IERC20Extended(address(_denominator)).decimals();
    }

    //////////////////////////////////////////////////
    //////////////////////////////////////////////////
    //////////////////////////////////////////////////

    ///////////////
    // Modifiers //
    ///////////////

    modifier notExpired(uint256 _optionId) {
        require(block.timestamp < optionData[_optionId].expiration, "Expired");
        _;
    }

    modifier expired(uint256 _optionId) {
        require(block.timestamp >= optionData[_optionId].expiration, "Not expired");
        _;
    }

    //////////////////////////////////////////////////
    //////////////////////////////////////////////////
    //////////////////////////////////////////////////

    ///////////
    // Admin //
    ///////////

    /// @notice Set new URI for ERC1155 metadata
    /// @param _newUri The new URI
    function setURI(string memory _newUri) external onlyOwner {
        _setURI(_newUri);
    }

    /// @notice Set new protocol fee recipient
    /// @param _feeRecipient The new protocol fee recipient
    function setFeeRecipient(address _feeRecipient) external onlyOwner {
        feeRecipient = _feeRecipient;
    }

    /// @notice Set a new max expiration date for options writing (By default, 1 year from current date)
    /// @param _max The max amount of seconds in the future for which an option expiration can be set
    function setMaxExpiration(uint256 _max) external onlyOwner {
        maxExpiration = _max;
    }

    /// @notice Set a new PremiaReferral contract
    /// @param _premiaReferral The new PremiaReferral Contract
    function setPremiaReferral(IPremiaReferral _premiaReferral) external onlyOwner {
        premiaReferral = _premiaReferral;
    }

    /// @notice Set a new PremiaUncut contract
    /// @param _uPremia The new PremiaUncut Contract
    function setPremiaUncutErc20(IPremiaUncutErc20 _uPremia) external onlyOwner {
        uPremia = _uPremia;
    }

    /// @notice Set a new FeeCalculator contract
    /// @param _feeCalculator The new FeeCalculator Contract
    function setFeeCalculator(IFeeCalculator _feeCalculator) external onlyOwner {
        feeCalculator = _feeCalculator;
    }

    /// @notice Set settings for tokens to support writing of options paired to denominator
    /// @dev A value of 0 means this token is disabled and options cannot be written for it
    /// @param _tokens The list of tokens for which to set strike price increment
    /// @param _strikePriceIncrement The new strike price increment to set for each token
    function setTokens(address[] memory _tokens, uint256[] memory _strikePriceIncrement) external onlyOwner {
        require(_tokens.length == _strikePriceIncrement.length);

        for (uint256 i=0; i < _tokens.length; i++) {
            if (!_isInArray(_tokens[i], tokens)) {
                tokens.push(_tokens[i]);
            }

            require(_tokens[i] != address(denominator), "Cant add denominator");
            tokenStrikeIncrement[_tokens[i]] = _strikePriceIncrement[i];

            emit SetToken(_tokens[i], _strikePriceIncrement[i]);
        }
    }

    /// @notice Set a new list of whitelisted UniswapRouter contracts allowed to be used for flashExercise
    /// @param _addrList The new list of whitelisted routers
    function setWhitelistedUniswapRouters(address[] memory _addrList) external onlyOwner {
        delete whitelistedUniswapRouters;

        for (uint256 i=0; i < _addrList.length; i++) {
            whitelistedUniswapRouters.push(_addrList[i]);
        }
    }

    //////////////////////////////////////////////////

    //////////
    // View //
    //////////

    /// @notice Get the id of an option
    /// @param _token Token for which the option is for
    /// @param _expiration Expiration timestamp of the option
    /// @param _strikePrice Strike price of the option
    /// @param _isCall Whether the option is a call or a put
    /// @return The option id
    function getOptionId(address _token, uint256 _expiration, uint256 _strikePrice, bool _isCall) public view returns(uint256) {
        return options[_token][_expiration][_strikePrice][_isCall];
    }

    /// @notice Get the amount of whitelisted tokens
    /// @return The amount of whitelisted tokens
    function tokensLength() external view returns(uint256) {
        return tokens.length;
    }

    /// @notice Get a quote to write an option
    /// @param _from Address which will write the option
    /// @param _option The option to write
    /// @param _referrer Referrer
    /// @param _decimals The option token decimals
    /// @return The quote
    function getWriteQuote(address _from, OptionWriteArgs memory _option, address _referrer, uint8 _decimals) public view returns(QuoteWrite memory) {
        QuoteWrite memory quote;

        if (_option.isCall) {
            quote.collateralToken = _option.token;
            quote.collateral = _option.amount;
            quote.collateralDecimals = _decimals;
        } else {
            quote.collateralToken = address(denominator);
            quote.collateral = _option.amount.mul(_option.strikePrice).div(10**_decimals);
            quote.collateralDecimals = denominatorDecimals;
        }

        (uint256 fee, uint256 feeReferrer) = feeCalculator.getFeeAmounts(_from, _referrer != address(0), quote.collateral, IFeeCalculator.FeeType.Write);
        quote.fee = fee;
        quote.feeReferrer = feeReferrer;

        return quote;
    }

    /// @notice Get a quote to exercise an option
    /// @param _from Address which will exercise the option
    /// @param _option The option to exercise
    /// @param _referrer Referrer
    /// @param _decimals The option token decimals
    /// @return The quote
    function getExerciseQuote(address _from, OptionData memory _option, uint256 _amount, address _referrer, uint8 _decimals) public view returns(QuoteExercise memory) {
        QuoteExercise memory quote;

        uint256 tokenAmount = _amount;
        uint256 denominatorAmount = _amount.mul(_option.strikePrice).div(10**_decimals);

        if (_option.isCall) {
            quote.inputToken = address(denominator);
            quote.input = denominatorAmount;
            quote.inputDecimals = denominatorDecimals;
            quote.outputToken = _option.token;
            quote.output = tokenAmount;
            quote.outputDecimals = _option.decimals;
        } else {
            quote.inputToken = _option.token;
            quote.input = tokenAmount;
            quote.inputDecimals = _option.decimals;
            quote.outputToken = address(denominator);
            quote.output = denominatorAmount;
            quote.outputDecimals = denominatorDecimals;
        }

        (uint256 fee, uint256 feeReferrer) = feeCalculator.getFeeAmounts(_from, _referrer != address(0), quote.input, IFeeCalculator.FeeType.Exercise);
        quote.fee = fee;
        quote.feeReferrer = feeReferrer;

        return quote;
    }

    //////////////////////////////////////////////////

    //////////
    // Main //
    //////////

    /// @notice Get the id of the option, or create a new id if there is no existing id for it
    /// @param _token Token for which the option is for
    /// @param _expiration Expiration timestamp of the option
    /// @param _strikePrice Strike price of the option
    /// @param _isCall Whether the option is a call or a put
    /// @return The option id
    function getOptionIdOrCreate(address _token, uint256 _expiration, uint256 _strikePrice, bool _isCall) public returns(uint256) {
        uint256 optionId = getOptionId(_token, _expiration, _strikePrice, _isCall);

        if (optionId == 0) {
            _preCheckOptionIdCreate(_token, _strikePrice, _expiration);

            optionId = nextOptionId;
            options[_token][_expiration][_strikePrice][_isCall] = optionId;
            uint8 decimals = IERC20Extended(_token).decimals();
            require(decimals <= 18, "Too many decimals");

            pools[optionId] = Pool({ tokenAmount: 0, denominatorAmount: 0 });
                optionData[optionId] = OptionData({
                token: _token,
                expiration: _expiration,
                strikePrice: _strikePrice,
                isCall: _isCall,
                claimsPreExp: 0,
                claimsPostExp: 0,
                exercised: 0,
                supply: 0,
                decimals: decimals
            });

            emit OptionIdCreated(optionId, _token);

            nextOptionId = nextOptionId.add(1);
        }

        return optionId;
    }

    //////////////////////////////////////////////////

    /// @notice Write an option on behalf of an address with an existing option id (Used by market delayed writing)
    /// @dev Requires approval on option contract + token needed to write the option
    /// @param _from Address on behalf of which the option is written
    /// @param _optionId The id of the option to write
    /// @param _amount Amount of options to write
    /// @param _referrer Referrer
    /// @return The option id
    function writeOptionWithIdFrom(address _from, uint256 _optionId, uint256 _amount, address _referrer) external returns(uint256) {
        require(isApprovedForAll(_from, msg.sender), "Not approved");

        OptionData memory data = optionData[_optionId];
        OptionWriteArgs memory writeArgs = OptionWriteArgs({
        token: data.token,
        amount: _amount,
        strikePrice: data.strikePrice,
        expiration: data.expiration,
        isCall: data.isCall
        });

        return _writeOption(_from, writeArgs, _referrer);
    }

    /// @notice Write an option on behalf of an address
    /// @dev Requires approval on option contract + token needed to write the option
    /// @param _from Address on behalf of which the option is written
    /// @param _option The option to write
    /// @param _referrer Referrer
    /// @return The option id
    function writeOptionFrom(address _from, OptionWriteArgs memory _option, address _referrer) external returns(uint256) {
        require(isApprovedForAll(_from, msg.sender), "Not approved");
        return _writeOption(_from, _option, _referrer);
    }

    /// @notice Write an option
    /// @param _option The option to write
    /// @param _referrer Referrer
    /// @return The option id
    function writeOption(OptionWriteArgs memory _option, address _referrer) public returns(uint256) {
        return _writeOption(msg.sender, _option, _referrer);
    }

    /// @notice Write an option on behalf of an address
    /// @param _from Address on behalf of which the option is written
    /// @param _option The option to write
    /// @param _referrer Referrer
    /// @return The option id
    function _writeOption(address _from, OptionWriteArgs memory _option, address _referrer) internal nonReentrant returns(uint256) {
        require(_option.amount > 0, "Amount <= 0");

        uint256 optionId = getOptionIdOrCreate(_option.token, _option.expiration, _option.strikePrice, _option.isCall);

        // Set referrer or get current if one already exists
        _referrer = _trySetReferrer(_from, _referrer);

        QuoteWrite memory quote = getWriteQuote(_from, _option, _referrer, optionData[optionId].decimals);

        IERC20(quote.collateralToken).safeTransferFrom(_from, address(this), quote.collateral);
        _payFees(_from, IERC20(quote.collateralToken), _referrer, quote.fee, quote.feeReferrer, quote.collateralDecimals);

        if (_option.isCall) {
            pools[optionId].tokenAmount = pools[optionId].tokenAmount.add(quote.collateral);
        } else {
            pools[optionId].denominatorAmount = pools[optionId].denominatorAmount.add(quote.collateral);
        }

        nbWritten[_from][optionId] = nbWritten[_from][optionId].add(_option.amount);

        mint(_from, optionId, _option.amount);

        emit OptionWritten(_from, optionId, _option.token, _option.amount);

        return optionId;
    }

    //////////////////////////////////////////////////

    /// @notice Cancel an option on behalf of an address. This will burn the option ERC1155 and withdraw collateral.
    /// @dev Requires approval of the option contract
    ///      This is only doable by an address which wrote an amount of options >= _amount
    ///      Must be called before expiration
    /// @param _from Address on behalf of which the option is cancelled
    /// @param _optionId The id of the option to cancel
    /// @param _amount Amount to cancel
    function cancelOptionFrom(address _from, uint256 _optionId, uint256 _amount) external {
        require(isApprovedForAll(_from, msg.sender), "Not approved");
        _cancelOption(_from, _optionId, _amount);
    }

    /// @notice Cancel an option. This will burn the option ERC1155 and withdraw collateral.
    /// @dev This is only doable by an address which wrote an amount of options >= _amount
    ///      Must be called before expiration
    /// @param _optionId The id of the option to cancel
    /// @param _amount Amount to cancel
    function cancelOption(uint256 _optionId, uint256 _amount) public {
        _cancelOption(msg.sender, _optionId, _amount);
    }

    /// @notice Cancel an option on behalf of an address. This will burn the option ERC1155 and withdraw collateral.
    /// @dev This is only doable by an address which wrote an amount of options >= _amount
    ///      Must be called before expiration
    /// @param _from Address on behalf of which the option is cancelled
    /// @param _optionId The id of the option to cancel
    /// @param _amount Amount to cancel
    function _cancelOption(address _from, uint256 _optionId, uint256 _amount) internal nonReentrant {
        require(_amount > 0, "Amount <= 0");
        require(nbWritten[_from][_optionId] >= _amount, "Not enough written");

        burn(_from, _optionId, _amount);
        nbWritten[_from][_optionId] = nbWritten[_from][_optionId].sub(_amount);

        if (optionData[_optionId].isCall) {
            pools[_optionId].tokenAmount = pools[_optionId].tokenAmount.sub(_amount);
            IERC20(optionData[_optionId].token).safeTransfer(_from, _amount);
        } else {
            uint256 amount = _amount.mul(optionData[_optionId].strikePrice).div(10**optionData[_optionId].decimals);
            pools[_optionId].denominatorAmount = pools[_optionId].denominatorAmount.sub(amount);
            denominator.safeTransfer(_from, amount);
        }

        emit OptionCancelled(_from, _optionId, optionData[_optionId].token, _amount);
    }

    //////////////////////////////////////////////////

    /// @notice Exercise an option on behalf of an address
    /// @dev Requires approval of the option contract
    /// @param _from Address on behalf of which the option will be exercised
    /// @param _optionId The id of the option to exercise
    /// @param _amount Amount to exercise
    /// @param _referrer Referrer
    function exerciseOptionFrom(address _from, uint256 _optionId, uint256 _amount, address _referrer) external {
        require(isApprovedForAll(_from, msg.sender), "Not approved");
        _exerciseOption(_from, _optionId, _amount, _referrer);
    }

    /// @notice Exercise an option
    /// @param _optionId The id of the option to exercise
    /// @param _amount Amount to exercise
    /// @param _referrer Referrer
    function exerciseOption(uint256 _optionId, uint256 _amount, address _referrer) public {
        _exerciseOption(msg.sender, _optionId, _amount, _referrer);
    }

    /// @notice Exercise an option on behalf of an address
    /// @param _from Address on behalf of which the option will be exercised
    /// @param _optionId The id of the option to exercise
    /// @param _amount Amount to exercise
    /// @param _referrer Referrer
    function _exerciseOption(address _from, uint256 _optionId, uint256 _amount, address _referrer) internal nonReentrant {
        require(_amount > 0, "Amount <= 0");

        OptionData storage data = optionData[_optionId];

        burn(_from, _optionId, _amount);
        data.exercised = uint256(data.exercised).add(_amount);

        // Set referrer or get current if one already exists
        _referrer = _trySetReferrer(_from, _referrer);

        QuoteExercise memory quote = getExerciseQuote(_from, data, _amount, _referrer, data.decimals);
        IERC20(quote.inputToken).safeTransferFrom(_from, address(this), quote.input);
        _payFees(_from, IERC20(quote.inputToken), _referrer, quote.fee, quote.feeReferrer, quote.inputDecimals);

        if (data.isCall) {
            pools[_optionId].tokenAmount = pools[_optionId].tokenAmount.sub(quote.output);
            pools[_optionId].denominatorAmount = pools[_optionId].denominatorAmount.add(quote.input);
        } else {
            pools[_optionId].denominatorAmount = pools[_optionId].denominatorAmount.sub(quote.output);
            pools[_optionId].tokenAmount = pools[_optionId].tokenAmount.add(quote.input);
        }

        IERC20(quote.outputToken).safeTransfer(_from, quote.output);

        emit OptionExercised(_from, _optionId, data.token, _amount);
    }

    //////////////////////////////////////////////////

    /// @notice Withdraw collateral from an option post expiration on behalf of an address.
    ///         (Funds will be send to the address on behalf of which withdrawal is made)
    ///         Funds in the option pool will be distributed pro rata of amount of options written by the address
    ///         Ex : If after expiration date there has been 10 options written and there is 1 eth and 1000 DAI in the pool,
    ///              Withdraw for each option will be worth 0.1 eth and 100 dai
    /// @dev Only callable by addresses which have unclaimed funds for options they wrote
    ///      Requires approval of the option contract
    /// @param _from Address on behalf of which the withdraw call is made (Which will receive the withdrawn funds)
    /// @param _optionId The id of the option to withdraw funds from
    function withdrawFrom(address _from, uint256 _optionId) external {
        require(isApprovedForAll(_from, msg.sender), "Not approved");
        _withdraw(_from, _optionId);
    }

    /// @notice Withdraw collateral from an option post expiration
    ///         Funds in the option pool will be distributed pro rata of amount of options written by the address
    ///         Ex : If after expiration date there has been 10 options written and there is 1 eth and 1000 DAI in the pool,
    ///              Withdraw for each option will be worth 0.1 eth and 100 dai
    /// @dev Only callable by addresses which have unclaimed funds for options they wrote
    /// @param _optionId The id of the option to withdraw funds from
    function withdraw(uint256 _optionId) public {
        _withdraw(msg.sender, _optionId);
    }

    /// @notice Withdraw collateral from an option post expiration on behalf of an address.
    ///         (Funds will be send to the address on behalf of which withdrawal is made)
    ///         Funds in the option pool will be distributed pro rata of amount of options written by the address
    ///         Ex : If after expiration date there has been 10 options written and there is 1 eth and 1000 DAI in the pool,
    ///              Withdraw for each option will be worth 0.1 eth and 100 dai
    /// @dev Only callable by addresses which have unclaimed funds for options they wrote
    /// @param _from Address on behalf of which the withdraw call is made (Which will receive the withdrawn funds)
    /// @param _optionId The id of the option to withdraw funds from
    function _withdraw(address _from, uint256 _optionId) internal nonReentrant expired(_optionId) {
        require(nbWritten[_from][_optionId] > 0, "No option to claim");

        OptionData storage data = optionData[_optionId];

        uint256 nbTotal = uint256(data.supply).add(data.exercised).sub(data.claimsPreExp);

        // Amount of options user still has to claim funds from
        uint256 claimsUser = nbWritten[_from][_optionId];

        //

        uint256 denominatorAmount = pools[_optionId].denominatorAmount.mul(claimsUser).div(nbTotal);
        uint256 tokenAmount = pools[_optionId].tokenAmount.mul(claimsUser).div(nbTotal);

        //

        pools[_optionId].denominatorAmount.sub(denominatorAmount);
        pools[_optionId].tokenAmount.sub(tokenAmount);
        data.claimsPostExp = uint256(data.claimsPostExp).add(claimsUser);
        delete nbWritten[_from][_optionId];

        denominator.safeTransfer(_from, denominatorAmount);
        IERC20(optionData[_optionId].token).safeTransfer(_from, tokenAmount);

        emit Withdraw(_from, _optionId, data.token, claimsUser);
    }

    //////////////////////////////////////////////////

    /// @notice Withdraw collateral from an option pre expiration on behalf of an address.
    ///         (Funds will be send to the address on behalf of which withdrawal is made)
    ///         Only opposite side of the collateral will be allocated when withdrawing pre expiration
    ///         If writer deposited WETH for a WETH/DAI call, he will only receive the strike amount in DAI from a pre-expiration withdrawal,
    ///         while doing a withdrawal post expiration would make him receive pro rata of funds left in the option pool at the expiration,
    ///         (Which might be both WETH and DAI if not all options have been exercised)
    ///
    /// @dev Requires approval of the option contract
    ///      Only callable by addresses which have unclaimed funds for options they wrote
    ///      This also requires options to have been exercised and not claimed
    ///      Ex : If a total of 10 options have been written (2 from Alice and 8 from Bob) and 3 options have been exercise :
    ///           - Alice will be allowed to call withdrawPreExpiration for her 2 options written
    ///           - Bob will only be allowed to call withdrawPreExpiration for 3 options he wrote
    ///           - If Alice call first withdrawPreExpiration for her 2 options,
    ///             there will be only 1 unclaimed exercised options that Bob will be allowed to withdrawPreExpiration
    ///
    /// @param _from Address on behalf of which the withdrawPreExpiration call is made (Which will receive the withdrawn funds)
    /// @param _optionId The id of the option to withdraw funds from
    /// @param _amount The amount of options for which withdrawPreExpiration
    function withdrawPreExpirationFrom(address _from, uint256 _optionId, uint256 _amount) external {
        require(isApprovedForAll(_from, msg.sender), "Not approved");
        _withdrawPreExpiration(_from, _optionId, _amount);
    }

    /// @notice Withdraw collateral from an option pre expiration
    ///         (Funds will be send to the address on behalf of which withdrawal is made)
    ///         Only opposite side of the collateral will be allocated when withdrawing pre expiration
    ///         If writer deposited WETH for a WETH/DAI call, he will only receive the strike amount in DAI from a pre-expiration withdrawal,
    ///         while doing a withdrawal post expiration would make him receive pro rata of funds left in the option pool at the expiration,
    ///         (Which might be both WETH and DAI if not all options have been exercised)
    ///
    /// @dev Only callable by addresses which have unclaimed funds for options they wrote
    ///      This also requires options to have been exercised and not claimed
    ///      Ex : If a total of 10 options have been written (2 from Alice and 8 from Bob) and 3 options have been exercise :
    ///           - Alice will be allowed to call withdrawPreExpiration for her 2 options written
    ///           - Bob will only be allowed to call withdrawPreExpiration for 3 options he wrote
    ///           - If Alice call first withdrawPreExpiration for her 2 options,
    ///             there will be only 1 unclaimed exercised options that Bob will be allowed to withdrawPreExpiration
    ///
    /// @param _optionId The id of the option to exercise
    /// @param _amount The amount of options for which withdrawPreExpiration
    function withdrawPreExpiration(uint256 _optionId, uint256 _amount) public {
        _withdrawPreExpiration(msg.sender, _optionId, _amount);
    }

    /// @notice Withdraw collateral from an option pre expiration on behalf of an address.
    ///         (Funds will be send to the address on behalf of which withdrawal is made)
    ///         Only opposite side of the collateral will be allocated when withdrawing pre expiration
    ///         If writer deposited WETH for a WETH/DAI call, he will only receive the strike amount in DAI from a pre-expiration withdrawal,
    ///         while doing a withdrawal post expiration would make him receive pro rata of funds left in the option pool at the expiration,
    ///         (Which might be both WETH and DAI if not all options have been exercised)
    ///
    /// @dev Only callable by addresses which have unclaimed funds for options they wrote
    ///      This also requires options to have been exercised and not claimed
    ///      Ex : If a total of 10 options have been written (2 from Alice and 8 from Bob) and 3 options have been exercise :
    ///           - Alice will be allowed to call withdrawPreExpiration for her 2 options written
    ///           - Bob will only be allowed to call withdrawPreExpiration for 3 options he wrote
    ///           - If Alice call first withdrawPreExpiration for her 2 options,
    ///             there will be only 1 unclaimed exercised options that Bob will be allowed to withdrawPreExpiration
    ///
    /// @param _from Address on behalf of which the withdrawPreExpiration call is made (Which will receive the withdrawn funds)
    /// @param _optionId The id of the option to withdraw funds from
    /// @param _amount The amount of options for which withdrawPreExpiration
    function _withdrawPreExpiration(address _from, uint256 _optionId, uint256 _amount) internal nonReentrant notExpired(_optionId) {
        require(_amount > 0, "Amount <= 0");

        // Amount of options user still has to claim funds from
        uint256 claimsUser = nbWritten[_from][_optionId];
        require(claimsUser >= _amount, "Not enough claims");

        OptionData storage data = optionData[_optionId];

        uint256 nbClaimable = uint256(data.exercised).sub(data.claimsPreExp);
        require(nbClaimable >= _amount, "Not enough claimable");

        //

        nbWritten[_from][_optionId] = nbWritten[_from][_optionId].sub(_amount);
        data.claimsPreExp = uint256(data.claimsPreExp).add(_amount);

        if (data.isCall) {
            uint256 amount = _amount.mul(data.strikePrice).div(10**data.decimals);
            pools[_optionId].denominatorAmount = pools[_optionId].denominatorAmount.sub(amount);
            denominator.safeTransfer(_from, amount);
        } else {
            pools[_optionId].tokenAmount = pools[_optionId].tokenAmount.sub(_amount);
            IERC20(data.token).safeTransfer(_from, _amount);
        }
    }

    //////////////////////////////////////////////////

    /// @notice Flash exercise an option on behalf of an address
    ///         This is usable on options in the money, in order to use a portion of the option collateral
    ///         to swap a portion of it to the token required to exercise the option and pay protocol fees,
    ///         and send the profit to the address exercising.
    ///         This allows any option in the money to be exercised without the need of owning the token needed to exercise
    /// @dev Requires approval of the option contract
    /// @param _from Address on behalf of which the flash exercise is made (Which will receive the profit)
    /// @param _optionId The id of the option to flash exercise
    /// @param _amount Amount of option to flash exercise
    /// @param _referrer Referrer
    /// @param _router The UniswapRouter used to perform the swap (Needs to be a whitelisted router)
    /// @param _amountInMax Max amount of collateral token to use for the swap, for the tx to not be reverted
    /// @param _path Path used for the routing of the swap
    function flashExerciseOptionFrom(address _from, uint256 _optionId, uint256 _amount, address _referrer, IUniswapV2Router02 _router, uint256 _amountInMax, address[] memory _path) external {
        require(isApprovedForAll(_from, msg.sender), "Not approved");
        _flashExerciseOption(_from, _optionId, _amount, _referrer, _router, _amountInMax, _path);
    }

    /// @notice Flash exercise an option
    ///         This is usable on options in the money, in order to use a portion of the option collateral
    ///         to swap a portion of it to the token required to exercise the option and pay protocol fees,
    ///         and send the profit to the address exercising.
    ///         This allows any option in the money to be exercised without the need of owning the token needed to exercise
    /// @param _optionId The id of the option to flash exercise
    /// @param _amount Amount of option to flash exercise
    /// @param _referrer Referrer
    /// @param _router The UniswapRouter used to perform the swap (Needs to be a whitelisted router)
    /// @param _amountInMax Max amount of collateral token to use for the swap, for the tx to not be reverted
    /// @param _path Path used for the routing of the swap
    function flashExerciseOption(uint256 _optionId, uint256 _amount, address _referrer, IUniswapV2Router02 _router, uint256 _amountInMax, address[] memory _path) external {
        _flashExerciseOption(msg.sender, _optionId, _amount, _referrer, _router, _amountInMax, _path);
    }

    /// @notice Flash exercise an option on behalf of an address
    ///         This is usable on options in the money, in order to use a portion of the option collateral
    ///         to swap a portion of it to the token required to exercise the option and pay protocol fees,
    ///         and send the profit to the address exercising.
    ///         This allows any option in the money to be exercised without the need of owning the token needed to exercise
    /// @dev Requires approval of the option contract
    /// @param _from Address on behalf of which the flash exercise is made (Which will receive the profit)
    /// @param _optionId The id of the option to flash exercise
    /// @param _amount Amount of option to flash exercise
    /// @param _referrer Referrer
    /// @param _router The UniswapRouter used to perform the swap (Needs to be a whitelisted router)
    /// @param _amountInMax Max amount of collateral token to use for the swap, for the tx to not be reverted
    /// @param _path Path used for the routing of the swap
    function _flashExerciseOption(address _from, uint256 _optionId, uint256 _amount, address _referrer, IUniswapV2Router02 _router, uint256 _amountInMax, address[] memory _path) internal nonReentrant {
        require(_amount > 0, "Amount <= 0");

        burn(_from, _optionId, _amount);
        optionData[_optionId].exercised = uint256(optionData[_optionId].exercised).add(_amount);

        // Set referrer or get current if one already exists
        _referrer = _trySetReferrer(_from, _referrer);

        QuoteExercise memory quote = getExerciseQuote(_from, optionData[_optionId], _amount, _referrer, optionData[_optionId].decimals);

        IERC20 tokenErc20 = IERC20(optionData[_optionId].token);

        uint256 tokenAmountRequired = tokenErc20.balanceOf(address(this));
        uint256 denominatorAmountRequired = denominator.balanceOf(address(this));

        if (optionData[_optionId].isCall) {
            pools[_optionId].tokenAmount = pools[_optionId].tokenAmount.sub(quote.output);
            pools[_optionId].denominatorAmount = pools[_optionId].denominatorAmount.add(quote.input);
        } else {
            pools[_optionId].denominatorAmount = pools[_optionId].denominatorAmount.sub(quote.output);
            pools[_optionId].tokenAmount = pools[_optionId].tokenAmount.add(quote.input);
        }

        //

        if (quote.output < _amountInMax) {
            _amountInMax = quote.output;
        }

        // Swap enough denominator to tokenErc20 to pay fee + strike price
        uint256 tokenAmountUsed = _swap(_router, quote.outputToken, quote.inputToken, quote.input.add(quote.fee).add(quote.feeReferrer), _amountInMax, _path)[0];

        // Pay fees
        _payFees(address(this), IERC20(quote.inputToken), _referrer, quote.fee, quote.feeReferrer, quote.inputDecimals);

        uint256 profit = quote.output.sub(tokenAmountUsed);

        // Send profit to sender
        IERC20(quote.outputToken).safeTransfer(_from, profit);

        //

        if (optionData[_optionId].isCall) {
            denominatorAmountRequired = denominatorAmountRequired.add(quote.input);
            tokenAmountRequired = tokenAmountRequired.sub(quote.output);
        } else {
            denominatorAmountRequired = denominatorAmountRequired.sub(quote.output);
            tokenAmountRequired = tokenAmountRequired.add(quote.input);
        }

        require(denominator.balanceOf(address(this)) >= denominatorAmountRequired, "Wrong denom bal");
        require(tokenErc20.balanceOf(address(this)) >= tokenAmountRequired, "Wrong token bal");

        emit OptionExercised(_from, _optionId, optionData[_optionId].token, _amount);
    }

    //////////////////////////////////////////////////

    /// @notice Flash loan collaterals sitting in this contract
    ///         Loaned amount + fee must be repaid by the end of the transaction for the transaction to not be reverted
    /// @param _tokenAddress Token to flashLoan
    /// @param _amount Amount to flashLoan
    /// @param _receiver Receiver of the flashLoan
    function flashLoan(address _tokenAddress, uint256 _amount, IFlashLoanReceiver _receiver) public nonReentrant {
        IERC20 _token = IERC20(_tokenAddress);
        uint256 startBalance = _token.balanceOf(address(this));
        _token.safeTransfer(address(_receiver), _amount);

        (uint256 fee,) = feeCalculator.getFeeAmounts(msg.sender, false, _amount, IFeeCalculator.FeeType.FlashLoan);

        _receiver.execute(_tokenAddress, _amount, _amount.add(fee));

        uint256 endBalance = _token.balanceOf(address(this));

        uint256 endBalanceRequired = startBalance.add(fee);

        require(endBalance >= endBalanceRequired, "Failed to pay back");
        _token.safeTransfer(feeRecipient, endBalance.sub(startBalance));

        endBalance = _token.balanceOf(address(this));
        require(endBalance >= startBalance, "Failed to pay back");
    }

    //////////////////////////////////////////////////

    //////////////
    // Internal //
    //////////////

    /// @notice Mint ERC1155 representing the option
    /// @dev Requires option to not be expired
    /// @param _account Address for which ERC1155 is minted
    /// @param _amount Amount minted
    function mint(address _account, uint256 _id, uint256 _amount) internal notExpired(_id) {
        OptionData storage data = optionData[_id];

        _mint(_account, _id, _amount, "");
        data.supply = uint256(data.supply).add(_amount);
    }

    /// @notice Burn ERC1155 representing the option
    /// @param _account Address from which ERC1155 is burnt
    /// @param _amount Amount burnt
    function burn(address _account, uint256 _id, uint256 _amount) internal notExpired(_id) {
        OptionData storage data = optionData[_id];

        data.supply = uint256(data.supply).sub(_amount);
        _burn(_account, _id, _amount);
    }

    /// @notice Utility function to check if a value is inside an array
    /// @param _value The value to look for
    /// @param _array The array to check
    /// @return Whether the value is in the array or not
    function _isInArray(address _value, address[] memory _array) internal pure returns(bool) {
        uint256 length = _array.length;
        for (uint256 i = 0; i < length; ++i) {
            if (_array[i] == _value) {
                return true;
            }
        }

        return false;
    }

    /// @notice Pay protocol fees
    /// @param _from Address paying protocol fees
    /// @param _token The token in which protocol fees are paid
    /// @param _referrer The referrer of _from
    /// @param _fee Protocol fee to pay to feeRecipient
    /// @param _feeReferrer Fee to pay to referrer
    /// @param _decimals Token decimals
    function _payFees(address _from, IERC20 _token, address _referrer, uint256 _fee, uint256 _feeReferrer, uint8 _decimals) internal {
        if (_fee > 0) {
            // For flash exercise
            if (_from == address(this)) {
                _token.safeTransfer(feeRecipient, _fee);
            } else {
                _token.safeTransferFrom(_from, feeRecipient, _fee);
            }

        }

        if (_feeReferrer > 0) {
            // For flash exercise
            if (_from == address(this)) {
                _token.safeTransfer(_referrer, _feeReferrer);
            } else {
                _token.safeTransferFrom(_from, _referrer, _feeReferrer);
            }
        }

        // If uPremia rewards are enabled
        if (address(uPremia) != address(0)) {
            uint256 totalFee = _fee.add(_feeReferrer);
            if (totalFee > 0) {
                uPremia.mintReward(_from, address(_token), totalFee, _decimals);
            }
        }

        emit FeePaid(_from, address(_token), _referrer, _fee, _feeReferrer);
    }

    /// @notice Try to set given referrer, returns current referrer if one already exists
    /// @param _user Address for which we try to set a referrer
    /// @param _referrer Potential referrer
    /// @return Actual referrer (Potential referrer, or actual referrer if one already exists)
    function _trySetReferrer(address _user, address _referrer) internal returns(address) {
        if (address(premiaReferral) != address(0)) {
            _referrer = premiaReferral.trySetReferrer(_user, _referrer);
        } else {
            _referrer = address(0);
        }

        return _referrer;
    }

    /// @notice Token swap (Used for flashExercise)
    /// @param _router The UniswapRouter contract to use to perform the swap (Must be whitelisted)
    /// @param _from Input token for the swap
    /// @param _to Output token of the swap
    /// @param _amount Amount of output tokens we want
    /// @param _amountInMax Max amount of input token to spend for the tx to not revert
    /// @param _path Path used for the routing of the swap
    /// @return Swap amounts
    function _swap(IUniswapV2Router02 _router, address _from, address _to, uint256 _amount, uint256 _amountInMax, address[] memory _path) internal returns (uint256[] memory) {
        require(_isInArray(address(_router), whitelistedUniswapRouters), "Router not whitelisted");

        IERC20(_from).approve(address(_router), _amountInMax);

        uint256[] memory amounts = _router.swapTokensForExactTokens(
            _amount,
            _amountInMax,
            _path,
            address(this),
            block.timestamp.add(60)
        );

        IERC20(_from).approve(address(_router), 0);

        return amounts;
    }

    /// @notice Check if option settings are valid (Reverts if not valid)
    /// @param _token Token for which option this
    /// @param _strikePrice Strike price of the option
    /// @param _expiration timestamp of the option
    function _preCheckOptionIdCreate(address _token, uint256 _strikePrice, uint256 _expiration) internal view {
        require(tokenStrikeIncrement[_token] != 0, "Token not supported");
        require(_strikePrice > 0, "Strike <= 0");
        require(_strikePrice % tokenStrikeIncrement[_token] == 0, "Wrong strike incr");
        require(_expiration > block.timestamp, "Exp passed");
        require(_expiration.sub(block.timestamp) <= maxExpiration, "Exp > 1 yr");
        require(_expiration % _expirationIncrement == _baseExpiration, "Wrong exp incr");
    }
}

File 2 of 23 : ERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC1155.sol";
import "./IERC1155MetadataURI.sol";
import "./IERC1155Receiver.sol";
import "../../GSN/Context.sol";
import "../../introspection/ERC165.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

/**
 *
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using SafeMath for uint256;
    using Address for address;

    // Mapping from token ID to account balances
    mapping (uint256 => mapping(address => uint256)) private _balances;

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

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /*
     *     bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e
     *     bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a
     *     bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6
     *
     *     => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^
     *        0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26
     */
    bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;

    /*
     *     bytes4(keccak256('uri(uint256)')) == 0x0e89341c
     */
    bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c;

    /**
     * @dev See {_setURI}.
     */
    constructor (string memory uri_) public {
        _setURI(uri_);

        // register the supported interfaces to conform to ERC1155 via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155);

        // register the supported interfaces to conform to ERC1155MetadataURI via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI);
    }

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) external view override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view override returns (uint256) {
        require(account != address(0), "ERC1155: balance query for the zero address");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] memory accounts,
        uint256[] memory ids
    )
        public
        view
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            require(accounts[i] != address(0), "ERC1155: batch balance query for the zero address");
            batchBalances[i] = _balances[ids[i]][accounts[i]];
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(_msgSender() != operator, "ERC1155: setting approval status for self");

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    )
        public
        virtual
        override
    {
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][from] = _balances[id][from].sub(amount, "ERC1155: insufficient balance for transfer");
        _balances[id][to] = _balances[id][to].add(amount);

        emit TransferSingle(operator, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        public
        virtual
        override
    {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            _balances[id][from] = _balances[id][from].sub(
                amount,
                "ERC1155: insufficient balance for transfer"
            );
            _balances[id][to] = _balances[id][to].add(amount);
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual {
        require(account != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][account] = _balances[id][account].add(amount);
        emit TransferSingle(operator, address(0), account, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]);
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `account`
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens of token type `id`.
     */
    function _burn(address account, uint256 id, uint256 amount) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        _balances[id][account] = _balances[id][account].sub(
            amount,
            "ERC1155: burn amount exceeds balance"
        );

        emit TransferSingle(operator, account, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), ids, amounts, "");

        for (uint i = 0; i < ids.length; i++) {
            _balances[ids[i]][account] = _balances[ids[i]][account].sub(
                amounts[i],
                "ERC1155: burn amount exceeds balance"
            );
        }

        emit TransferBatch(operator, account, address(0), ids, amounts);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal virtual
    { }

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    )
        private
    {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver(to).onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        private
    {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (bytes4 response) {
                if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

File 3 of 23 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

    /**
     * @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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 23 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../GSN/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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

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

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

File 5 of 23 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 6 of 23 : SafeCast.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;


/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        require(value < 2**255, "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 7 of 23 : IERC20Extended.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

interface IERC20Extended is IERC20 {
    function decimals() external view returns (uint8);
}

File 8 of 23 : IFeeCalculator.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

interface IFeeCalculator {
    enum FeeType {Write, Exercise, Maker, Taker, FlashLoan}

    function writeFee() external view returns(uint256);
    function exerciseFee() external view returns(uint256);
    function flashLoanFee() external view returns(uint256);

    function referrerFee() external view returns(uint256);
    function referredDiscount() external view returns(uint256);

    function makerFee() external view returns(uint256);
    function takerFee() external view returns(uint256);

    function getFee(address _user, bool _hasReferrer, FeeType _feeType) external view returns(uint256);
    function getFeeAmounts(address _user, bool _hasReferrer, uint256 _amount, FeeType _feeType) external view returns(uint256 _fee, uint256 _feeReferrer);
    function getFeeAmountsWithDiscount(address _user, bool _hasReferrer, uint256 _baseFee) external view returns(uint256 _fee, uint256 _feeReferrer);
}

File 9 of 23 : IFlashLoanReceiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

interface IFlashLoanReceiver {
    function execute(address _tokenAddress, uint256 _amount, uint256 _amountWithFee) external;
}

File 10 of 23 : IPremiaReferral.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

interface IPremiaReferral {
    function referrals(address _referred) external view returns(address _referrer);
    function trySetReferrer(address _referred, address _potentialReferrer) external returns(address);
}

File 11 of 23 : IPremiaUncutErc20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

interface IPremiaUncutErc20 is IERC20 {
    function getTokenPrice(address _token) external view returns(uint256);
    function mint(address _account, uint256 _amount) external;
    function mintReward(address _account, address _token, uint256 _feePaid, uint8 _decimals) external;
}

File 12 of 23 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 13 of 23 : IERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;
}

File 14 of 23 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "./IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 15 of 23 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

/**
 * _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {

    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    )
        external
        returns(bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    )
        external
        returns(bytes4);
}

File 16 of 23 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 17 of 23 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @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) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @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 sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

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

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts 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 mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 19 of 23 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 20 of 23 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 23 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 22 of 23 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens 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 amount) internal virtual { }
}

File 23 of 23 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_uri","type":"string"},{"internalType":"contract IERC20","name":"_denominator","type":"address"},{"internalType":"contract IPremiaUncutErc20","name":"_uPremia","type":"address"},{"internalType":"contract IFeeCalculator","name":"_feeCalculator","type":"address"},{"internalType":"contract IPremiaReferral","name":"_premiaReferral","type":"address"},{"internalType":"address","name":"_feeRecipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"referrer","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeProtocol","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeReferrer","type":"uint256"}],"name":"FeePaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OptionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OptionExercised","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"OptionIdCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OptionWritten","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":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"strikePriceIncrement","type":"uint256"}],"name":"SetToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"cancelOption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"cancelOptionFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"denominator","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"denominatorDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"}],"name":"exerciseOption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"}],"name":"exerciseOptionFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeCalculator","outputs":[{"internalType":"contract IFeeCalculator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"contract IUniswapV2Router02","name":"_router","type":"address"},{"internalType":"uint256","name":"_amountInMax","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"flashExerciseOption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"contract IUniswapV2Router02","name":"_router","type":"address"},{"internalType":"uint256","name":"_amountInMax","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"flashExerciseOptionFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"contract IFlashLoanReceiver","name":"_receiver","type":"address"}],"name":"flashLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"bool","name":"isCall","type":"bool"},{"internalType":"uint256","name":"claimsPreExp","type":"uint256"},{"internalType":"uint256","name":"claimsPostExp","type":"uint256"},{"internalType":"uint256","name":"exercised","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct PremiaOption.OptionData","name":"_option","type":"tuple"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"name":"getExerciseQuote","outputs":[{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"output","type":"uint256"},{"internalType":"uint8","name":"outputDecimals","type":"uint8"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"feeReferrer","type":"uint256"}],"internalType":"struct PremiaOption.QuoteExercise","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_expiration","type":"uint256"},{"internalType":"uint256","name":"_strikePrice","type":"uint256"},{"internalType":"bool","name":"_isCall","type":"bool"}],"name":"getOptionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_expiration","type":"uint256"},{"internalType":"uint256","name":"_strikePrice","type":"uint256"},{"internalType":"bool","name":"_isCall","type":"bool"}],"name":"getOptionIdOrCreate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"bool","name":"isCall","type":"bool"}],"internalType":"struct PremiaOption.OptionWriteArgs","name":"_option","type":"tuple"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"name":"getWriteQuote","outputs":[{"components":[{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"uint8","name":"collateralDecimals","type":"uint8"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"feeReferrer","type":"uint256"}],"internalType":"struct PremiaOption.QuoteWrite","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxExpiration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"nbWritten","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextOptionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"optionData","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"bool","name":"isCall","type":"bool"},{"internalType":"uint256","name":"claimsPreExp","type":"uint256"},{"internalType":"uint256","name":"claimsPostExp","type":"uint256"},{"internalType":"uint256","name":"exercised","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"name":"options","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"uint256","name":"denominatorAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"premiaReferral","outputs":[{"internalType":"contract IPremiaReferral","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","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":"contract IFeeCalculator","name":"_feeCalculator","type":"address"}],"name":"setFeeCalculator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeRecipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_max","type":"uint256"}],"name":"setMaxExpiration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPremiaReferral","name":"_premiaReferral","type":"address"}],"name":"setPremiaReferral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPremiaUncutErc20","name":"_uPremia","type":"address"}],"name":"setPremiaUncutErc20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_strikePriceIncrement","type":"uint256[]"}],"name":"setTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newUri","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addrList","type":"address[]"}],"name":"setWhitelistedUniswapRouters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenStrikeIncrement","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uPremia","outputs":[{"internalType":"contract IPremiaUncutErc20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"whitelistedUniswapRouters","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_optionId","type":"uint256"}],"name":"withdrawFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawPreExpiration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawPreExpirationFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"bool","name":"isCall","type":"bool"}],"internalType":"struct PremiaOption.OptionWriteArgs","name":"_option","type":"tuple"},{"internalType":"address","name":"_referrer","type":"address"}],"name":"writeOption","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"bool","name":"isCall","type":"bool"}],"internalType":"struct PremiaOption.OptionWriteArgs","name":"_option","type":"tuple"},{"internalType":"address","name":"_referrer","type":"address"}],"name":"writeOptionFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"}],"name":"writeOptionWithIdFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

60806040526001600d556301e13380600e553480156200001e57600080fd5b50604051620062253803806200622583398101604081905262000041916200033a565b8560006200004e620001cc565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350620000aa6301ffc9a760e01b620001d0565b620000b58162000258565b620000c7636cdb3d1360e11b620001d0565b620000d96303a24d0760e21b620001d0565b506001600555600680546001600160a01b038088166001600160a01b0319928316811790935560098054888316908416179055600a80548783169084161790556007805485831690841617905560088054918616919092161790556040805163313ce56760e01b8152905163313ce56791600480820192602092909190829003018186803b1580156200016b57600080fd5b505afa15801562000180573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001a6919062000457565b600660146101000a81548160ff021916908360ff16021790555050505050505062000481565b3390565b6001600160e01b0319808216141562000230576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b80516200026d90600490602084019062000271565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620002a95760008555620002f4565b82601f10620002c457805160ff1916838001178555620002f4565b82800160010185558215620002f4579182015b82811115620002f4578251825591602001919060010190620002d7565b506200030292915062000306565b5090565b5b8082111562000302576000815560010162000307565b80516001600160a01b03811681146200033557600080fd5b919050565b60008060008060008060c0878903121562000353578182fd5b86516001600160401b03808211156200036a578384fd5b818901915089601f8301126200037e578384fd5b8151818111156200038b57fe5b6040516020601f8301601f1916820181018481118382101715620003ab57fe5b60405282825284830181018d1015620003c2578687fd5b8693505b82841015620003e55784840181015182850182015292830192620003c6565b82841115620003f657868184840101525b819a5062000406818d016200031d565b995050505050506200041b604088016200031d565b93506200042b606088016200031d565b92506200043b608088016200031d565b91506200044b60a088016200031d565b90509295509295509295565b60006020828403121562000469578081fd5b815160ff811681146200047a578182fd5b9392505050565b615d9480620004916000396000f3fe608060405234801561001057600080fd5b50600436106102965760003560e01c80638c66d04f11610168578063b9a8e9d3116100d4578063b9a8e9d3146105a6578063bf9092ce146105ae578063c0b5f2cc146105c1578063c8390a48146105d4578063d35daf2b146105e7578063d48b0e5214610607578063d92fc67b1461061a578063dbe5f0eb14610622578063e74b981b14610635578063e985e9c514610648578063f18e1a941461065b578063f242432a1461066e578063f2fde38b14610681578063f3944b271461069457610296565b80638c66d04f146104cd5780638da5cb5b146104e05780638e5a2892146104e85780639215abb0146104fb5780639470b0bd1461050357806396ce0795146105165780639fe9f8481461051e578063a22cb46514610531578063a852c7e714610544578063ac4afa3814610557578063b00eb9fe14610578578063b4ac946014610580578063b7f1dd2e1461059357610296565b806330b025eb1161020757806330b025eb146103ce5780633a5b7c82146103e15780633e998172146103f4578063410e4e2614610414578063469048401461042757806348af19681461043c5780634cc47c0d1461044f5780634e1273f4146104645780634ebd2287146104845780634f64b2be1461048c5780635c070b651461049f5780635c6a945e146104b2578063715018a6146104c557610296565b8062fdd58e1461029b57806301ffc9a7146102c457806302c25b54146102e457806302fe5305146102f95780630676695b1461030c5780630e2e8c541461031f5780630e89341c146103325780631f01a794146103525780632216ef601461037a57806325bee3e91461038d578063263621f3146103955780632e1a7d4d146103a85780632eb2c2d6146103bb575b600080fd5b6102ae6102a9366004614e32565b6106a7565b6040516102bb9190615872565b60405180910390f35b6102d76102d2366004615103565b610719565b6040516102bb9190615432565b6102f76102f2366004614e5d565b61073c565b005b6102f761030736600461512b565b610aa2565b6102f761031a36600461519c565b610b06565b6102ae61032d366004615170565b610b63565b61034561034036600461519c565b610b77565b6040516102bb919061543d565b61036561036036600461519c565b610c0f565b6040516102bb999897969594939291906153a1565b6102f7610388366004614ec7565b610c6a565b6102ae610ca2565b6102ae6103a3366004614f94565b610ca8565b6102f76103b636600461519c565b610ce5565b6102f76103c9366004614b6f565b610cef565b6102f76103dc3660046151cc565b610fed565b6102f76103ef366004615210565b610ffc565b610407610402366004614cab565b61100d565b6040516102bb91906157c6565b6102ae610422366004614e32565b6111b8565b61042f6111d5565b6040516102bb91906152e2565b6102ae61044a366004614aff565b6111e4565b6104576111f6565b6040516102bb91906158f9565b610477610472366004615004565b611206565b6040516102bb91906153ee565b61042f611383565b61042f61049a36600461519c565b611392565b6102f76104ad3660046151cc565b6113bc565b6102f76104c0366004614f05565b6113c7565b6102f7611405565b6102f76104db366004614aff565b6114a7565b61042f611521565b6102ae6104f6366004614d8e565b611531565b6102ae61156c565b6102f7610511366004614e32565b611572565b61042f6115a2565b6102f761052c366004614fd2565b6115b1565b6102f761053f366004614c7e565b611674565b6102f7610552366004614e93565b611763565b61056a61056536600461519c565b611794565b6040516102bb92919061587b565b61042f6117ad565b6102ae61058e366004614f94565b6117bc565b6102f76105a136600461523d565b6117e8565b61042f6117f7565b6102ae6105bc366004614f94565b611806565b6102f76105cf366004614aff565b611a9b565b6102f76105e2366004615004565b611b15565b6105fa6105f5366004614dd7565b611d57565b6040516102bb9190615831565b6102ae610615366004614ec7565b611e85565b6102ae611f85565b61042f61063036600461519c565b611f8b565b6102f7610643366004614aff565b611f9b565b6102d7610656366004614b37565b612015565b6102f7610669366004614aff565b612043565b6102f761067c366004614c18565b6120bd565b6102f761068f366004614aff565b612276565b6102f76106a2366004614e93565b61236e565b60006001600160a01b0383166106ee5760405162461bcd60e51b815260040180806020018281038252602b815260200180615ac0602b913960400191505060405180910390fd5b5060008181526002602090815260408083206001600160a01b03861684529091529020545b92915050565b6001600160e01b0319811660009081526001602052604090205460ff165b919050565b60026005541415610782576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b60026005556040516370a0823160e01b815283906000906001600160a01b038316906370a08231906107b89030906004016152e2565b60206040518083038186803b1580156107d057600080fd5b505afa1580156107e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080891906151b4565b905061081e6001600160a01b038316848661239f565b600a54604051637693655560e01b81526000916001600160a01b03169063769365559061085590339085908a9060049081016152f6565b604080518083038186803b15801561086c57600080fd5b505afa158015610880573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a491906151ed565b5090506001600160a01b03841663c52ab77887876108c281866123f1565b6040518463ffffffff1660e01b81526004016108e093929190615380565b600060405180830381600087803b1580156108fa57600080fd5b505af115801561090e573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b03861691506370a08231906109419030906004016152e2565b60206040518083038186803b15801561095957600080fd5b505afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099191906151b4565b9050600061099f84846123f1565b9050808210156109ca5760405162461bcd60e51b81526004016109c19061560c565b60405180910390fd5b6007546109f5906001600160a01b03166109e48487612449565b6001600160a01b038816919061239f565b6040516370a0823160e01b81526001600160a01b038616906370a0823190610a219030906004016152e2565b60206040518083038186803b158015610a3957600080fd5b505afa158015610a4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7191906151b4565b915083821015610a935760405162461bcd60e51b81526004016109c19061560c565b50506001600555505050505050565b610aaa61248b565b6000546001600160a01b03908116911614610afa576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b610b038161248f565b50565b610b0e61248b565b6000546001600160a01b03908116911614610b5e576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600e55565b6000610b703384846124a2565b9392505050565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c035780601f10610bd857610100808354040283529160200191610c03565b820191906000526020600020905b815481529060010190602001808311610be657829003601f168201915b50505050509050919050565b6011602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460078801546008909801546001600160a01b03909716979596949560ff9485169593949293919290911689565b610c748433612015565b610c905760405162461bcd60e51b81526004016109c190615638565b610c9c848484846126de565b50505050565b600e5481565b6001600160a01b03939093166000908152601060209081526040808320948352938152838220928252918252828120931515815292905290205490565b610b033382612983565b8151835114610d2f5760405162461bcd60e51b8152600401808060200182810382526028815260200180615d166028913960400191505060405180910390fd5b6001600160a01b038416610d745760405162461bcd60e51b8152600401808060200182810382526025815260200180615bb56025913960400191505060405180910390fd5b610d7c61248b565b6001600160a01b0316856001600160a01b03161480610da25750610da28561065661248b565b610ddd5760405162461bcd60e51b8152600401808060200182810382526032815260200180615bda6032913960400191505060405180910390fd5b6000610de761248b565b9050610df7818787878787610fe5565b60005b8451811015610efd576000858281518110610e1157fe5b602002602001015190506000858381518110610e2957fe5b60200260200101519050610e96816040518060600160405280602a8152602001615c2f602a91396002600086815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002054612bdc9092919063ffffffff16565b60008381526002602090815260408083206001600160a01b038e811685529252808320939093558a1681522054610ecd90826123f1565b60009283526002602090815260408085206001600160a01b038c1686529091529092209190915550600101610dfa565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610f83578181015183820152602001610f6b565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610fc2578181015183820152602001610faa565b5050505090500194505050505060405180910390a4610fe5818787878787612c73565b505050505050565b610ff8338383612ee9565b5050565b611008338484846126de565b505050565b6110156147cd565b61101d6147cd565b6000859050600061104b8560ff16600a0a6110458a602001518a61312f90919063ffffffff16565b90613188565b905087606001511561109f576006546001600160a01b0380821685526020850183905260ff600160a01b909204821660408601528951166060850152608084018390526101008901511660a08401526110e6565b87516001600160a01b0390811684526020840183905261010089015160ff9081166040860152600654918216606086015260808501839052600160a01b9091041660a08401525b600080600a60009054906101000a90046001600160a01b03166001600160a01b031663769365558c60006001600160a01b03168b6001600160a01b03161415886020015160016040518563ffffffff1660e01b815260040161114b94939291906152f6565b604080518083038186803b15801561116257600080fd5b505afa158015611176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119a91906151ed565b60c087019190915260e0860152509293505050505b95945050505050565b601360209081526000928352604080842090915290825290205481565b6007546001600160a01b031681565b600c6020526000908152604090205481565b600654600160a01b900460ff1681565b606081518351146112485760405162461bcd60e51b8152600401808060200182810382526029815260200180615ced6029913960400191505060405180910390fd5b600083516001600160401b038111801561126157600080fd5b5060405190808252806020026020018201604052801561128b578160200160208202803683370190505b50905060005b845181101561137b5760006001600160a01b03168582815181106112b157fe5b60200260200101516001600160a01b031614156112ff5760405162461bcd60e51b8152600401808060200182810382526031815260200180615aeb6031913960400191505060405180910390fd5b6002600085838151811061130f57fe5b60200260200101518152602001908152602001600020600086838151811061133357fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061136857fe5b6020908102919091010152600101611291565b509392505050565b6008546001600160a01b031681565b600b81815481106113a257600080fd5b6000918252602090912001546001600160a01b0316905081565b610ff83383836131c7565b6113d18733612015565b6113ed5760405162461bcd60e51b81526004016109c190615638565b6113fc87878787878787613420565b50505050505050565b61140d61248b565b6000546001600160a01b0390811691161461145d576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6114af61248b565b6000546001600160a01b039081169116146114ff576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03165b90565b600061153d8433612015565b6115595760405162461bcd60e51b81526004016109c190615638565b6115648484846124a2565b949350505050565b600d5481565b61157c8233612015565b6115985760405162461bcd60e51b81526004016109c190615638565b610ff88282612983565b6006546001600160a01b031681565b6115b961248b565b6000546001600160a01b03908116911614611609576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b611615600f600061482a565b60005b8151811015610ff857600f82828151811061162f57fe5b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501611618565b816001600160a01b031661168661248b565b6001600160a01b031614156116cc5760405162461bcd60e51b8152600401808060200182810382526029815260200180615c9a6029913960400191505060405180910390fd5b80600360006116d961248b565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561171d61248b565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b61176d8333612015565b6117895760405162461bcd60e51b81526004016109c190615638565b6110088383836131c7565b6012602052600090815260409020805460019091015482565b600a546001600160a01b031681565b601060209081526000948552604080862082529385528385208152918452828420909152825290205481565b610fe533878787878787613420565b6009546001600160a01b031681565b60008061181586868686610ca8565b9050806111af57611827868587613a3d565b50600d546001600160a01b03861660008181526010602090815260408083208984528252808320888452825280832087151584528252808320859055805163313ce56760e01b8152905192939263313ce56792600480840193919291829003018186803b15801561189757600080fd5b505afa1580156118ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cf91906152b8565b905060128160ff1611156118f55760405162461bcd60e51b81526004016109c19061577a565b6040518060400160405280600081526020016000815250601260008481526020019081526020016000206000820151816000015560208201518160010155905050604051806101200160405280886001600160a01b031681526020018681526020018781526020018515158152602001600081526020016000815260200160008152602001600081526020018260ff168152506011600084815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff0219169083151502179055506080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080160006101000a81548160ff021916908360ff160217905550905050866001600160a01b0316827ffde1d545a79e30139419cf7880b5c46d455dd9f1dfd88cc6cbc898d348af72ff60405160405180910390a3600d54611a8e9060016123f1565b600d555095945050505050565b611aa361248b565b6000546001600160a01b03908116911614611af3576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b611b1d61248b565b6000546001600160a01b03908116911614611b6d576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b8051825114611b7b57600080fd5b60005b825181101561100857611bfe838281518110611b9657fe5b6020026020010151600b805480602002602001604051908101604052809291908181526020018280548015611bf457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611bd6575b5050505050613b42565b611c4c57600b838281518110611c1057fe5b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b039092169190911790555b60065483516001600160a01b0390911690849083908110611c6957fe5b60200260200101516001600160a01b03161415611c985760405162461bcd60e51b81526004016109c1906156d4565b818181518110611ca457fe5b6020026020010151600c6000858481518110611cbc57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550828181518110611cf457fe5b60200260200101516001600160a01b03167f720764556647dd167f4229d6a4255ac86018e302a50fc29dd67a70edb7b314d0838381518110611d3257fe5b6020026020010151604051611d479190615872565b60405180910390a2600101611b7e565b611d5f614848565b611d67614848565b846080015115611d965784516001600160a01b031681526020808601519082015260ff83166040820152611ddb565b6006546001600160a01b0316815260408501516020860151611dc39160ff8616600a0a916110459161312f565b6020820152600654600160a01b900460ff1660408201525b600a546020820151604051637693655560e01b815260009283926001600160a01b0391821692637693655592611e1d928d92918c1615159187906004016152f6565b604080518083038186803b158015611e3457600080fd5b505afa158015611e48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6c91906151ed565b6060850191909152608084015250909695505050505050565b6000611e918533612015565b611ead5760405162461bcd60e51b81526004016109c190615638565b60008481526011602090815260409182902082516101208101845281546001600160a01b03908116825260018301548285019081526002840154838701908152600385015460ff908116151560608087019182526004880154608080890191909152600589015460a0808a019190915260068a015460c08a015260078a015460e08a015260089099015490931661010088015289519788018a52865190951687529686018b9052915196850196909652945190830152915115159281019290925290611f7a8782866124a2565b979650505050505050565b600b5490565b600f81815481106113a257600080fd5b611fa361248b565b6000546001600160a01b03908116911614611ff3576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b61204b61248b565b6000546001600160a01b0390811691161461209b576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0384166121025760405162461bcd60e51b8152600401808060200182810382526025815260200180615bb56025913960400191505060405180910390fd5b61210a61248b565b6001600160a01b0316856001600160a01b0316148061213057506121308561065661248b565b61216b5760405162461bcd60e51b8152600401808060200182810382526029815260200180615b666029913960400191505060405180910390fd5b600061217561248b565b905061219581878761218688613b9c565b61218f88613b9c565b87610fe5565b6121dc836040518060600160405280602a8152602001615c2f602a913960008781526002602090815260408083206001600160a01b038d1684529091529020549190612bdc565b60008581526002602090815260408083206001600160a01b038b8116855292528083209390935587168152205461221390846123f1565b60008581526002602090815260408083206001600160a01b03808b168086529184529382902094909455805188815291820187905280518a841693861692600080516020615aa083398151915292908290030190a4610fe5818787878787613be1565b61227e61248b565b6000546001600160a01b039081169116146122ce576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b6001600160a01b0381166123135760405162461bcd60e51b8152600401808060200182810382526026815260200180615b1c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6123788333612015565b6123945760405162461bcd60e51b81526004016109c190615638565b611008838383612ee9565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611008908490613d52565b600082820183811015610b70576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000610b7083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdc565b3390565b8051610ff8906004906020840190614883565b6000600260055414156124ea576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b600260055560208301516125105760405162461bcd60e51b81526004016109c1906154e4565b600061252e8460000151856060015186604001518760800151611806565b905061253a8584613e03565b600082815260116020526040812060080154919450906125629087908790879060ff16611d57565b60208101518151919250612583916001600160a01b03169088903090613ead565b6125a186826000015186846060015185608001518660400151613f07565b8460800151156125de57602080820151600084815260129092526040909120546125ca916123f1565b600083815260126020526040902055612613565b60208082015160008481526012909252604090912060010154612600916123f1565b6000838152601260205260409020600101555b6020808601516001600160a01b03881660009081526013835260408082208683529093529190912054612645916123f1565b6001600160a01b038716600090815260136020908152604080832086845282529091209190915585015161267c908790849061408d565b84600001516001600160a01b031682876001600160a01b03167fb621f8758571be4a426feacc13e4bb7a476c12cda0805ba65f14f89d1a0a05c388602001516040516126c89190615872565b60405180910390a4506001600555949350505050565b60026005541415612724576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b6002600555816127465760405162461bcd60e51b81526004016109c1906154e4565b600083815260116020526040902061275f858585614105565b600681015461276e90846123f1565b600682015561277d8583613e03565b604080516101208101825283546001600160a01b0316815260018401546020820152600284015491810191909152600383015460ff9081161515606083015260048401546080830152600584015460a0830152600684015460c0830152600784015460e083015260088401541661010082018190529193506000916128079188918790879061100d565b60208101518151919250612828916001600160a01b03169088903090613ead565b612846868260000151858460c001518560e001518660400151613f07565b600382015460ff16156128ad57608081015160008681526012602052604090205461287091612449565b6000868152601260209081526040909120918255820151600190910154612896916123f1565b600086815260126020526040902060010155612904565b60808101516000868152601260205260409020600101546128cd91612449565b6000868152601260209081526040909120600181019290925582015190546128f4916123f1565b6000868152601260205260409020555b61292a86826080015183606001516001600160a01b031661239f9092919063ffffffff16565b81546040516001600160a01b03918216918791908916907fa9149acb233878ee232a8279e24b74301705dcfd2319e4bf98bda4b04040afd69061296e908990615872565b60405180910390a45050600160055550505050565b600260055414156129c9576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b60026005819055600082815260116020526040902001548190421015612a015760405162461bcd60e51b81526004016109c190615682565b6001600160a01b0383166000908152601360209081526040808320858452909152902054612a415760405162461bcd60e51b81526004016109c19061552e565b6000828152601160205260408120600481015460068201546007830154929392612a769291612a7091906123f1565b90612449565b6001600160a01b0386166000908152601360209081526040808320888452825280832054601290925282206001015492935091612ab9908490611045908561312f565b60008781526012602052604081205491925090612adc908590611045908661312f565b600088815260126020526040902060010154909150612afb9083612449565b50600087815260126020526040902054612b159082612449565b506005850154612b2590846123f1565b60058601556001600160a01b0380891660009081526013602090815260408083208b8452909152812055600654612b5e9116898461239f565b600087815260116020526040902054612b81906001600160a01b0316898361239f565b84546040516001600160a01b03918216918991908b16907f457f950b75085c30ff780acd57bde642ff1316cc4aad9f286af2c1ffc4163a7890612bc5908890615872565b60405180910390a450506001600555505050505050565b60008184841115612c6b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c30578181015183820152602001612c18565b50505050905090810190601f168015612c5d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b612c85846001600160a01b031661416b565b15610fe557836001600160a01b031663bc197c8187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b03168152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015612d13578181015183820152602001612cfb565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015612d52578181015183820152602001612d3a565b50505050905001848103825285818151815260200191508051906020019080838360005b83811015612d8e578181015183820152602001612d76565b50505050905090810190601f168015612dbb5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b158015612de057600080fd5b505af1925050508015612e0557506040513d6020811015612e0057600080fd5b505160015b612e9a57612e1161594d565b80612e1c5750612e63565b60405162461bcd60e51b8152602060048201818152835160248401528351849391928392604401919085019080838360008315612c30578181015183820152602001612c18565b60405162461bcd60e51b8152600401808060200182810382526034815260200180615a246034913960400191505060405180910390fd5b6001600160e01b0319811663bc197c8160e01b146113fc5760405162461bcd60e51b8152600401808060200182810382526028815260200180615a586028913960400191505060405180910390fd5b60026005541415612f2f576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b600260055580612f515760405162461bcd60e51b81526004016109c1906154e4565b6001600160a01b0383166000908152601360209081526040808320858452909152902054811115612f945760405162461bcd60e51b81526004016109c190615702565b612f9f838383614105565b6001600160a01b0383166000908152601360209081526040808320858452909152902054612fcd9082612449565b6001600160a01b038416600090815260136020908152604080832086845282528083209390935560119052206003015460ff16156130525760008281526012602052604090205461301e9082612449565b60008381526012602090815260408083209390935560119052205461304d906001600160a01b0316848361239f565b6130cb565b600082815260116020526040812060088101546001909101546130819160ff16600a0a9061104590859061312f565b6000848152601260205260409020600101549091506130a09082612449565b6000848152601260205260409020600101556006546130c9906001600160a01b0316858361239f565b505b600082815260116020526040908190205490516001600160a01b03918216918491908616907f9035f481e4b25fdafc60883ab62c86fec841bb1c318f5b189ebee1b10ced360b9061311d908690615872565b60405180910390a45050600160055550565b60008261313e57506000610713565b8282028284828161314b57fe5b0414610b705760405162461bcd60e51b8152600401808060200182810382526021815260200180615c596021913960400191505060405180910390fd5b6000610b7083836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250614171565b6002600554141561320d576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b6002600581905560008381526011602052604090200154829042106132445760405162461bcd60e51b81526004016109c1906157a5565b600082116132645760405162461bcd60e51b81526004016109c1906154e4565b6001600160a01b0384166000908152601360209081526040808320868452909152902054828110156132a85760405162461bcd60e51b81526004016109c1906154b9565b6000848152601160205260408120600481015460068201549192916132cc91612449565b9050848110156132ee5760405162461bcd60e51b81526004016109c1906155de565b6001600160a01b038716600090815260136020908152604080832089845290915290205461331c9086612449565b6001600160a01b03881660009081526013602090815260408083208a8452909152902055600482015461334f90866123f1565b6004830155600382015460ff16156133d457600882015460018301546000916133869160ff909116600a0a9061104590899061312f565b6000888152601260205260409020600101549091506133a59082612449565b6000888152601260205260409020600101556006546133ce906001600160a01b0316898361239f565b50613412565b6000868152601260205260409020546133ed9086612449565b6000878152601260205260409020558154613412906001600160a01b0316888761239f565b505060016005555050505050565b60026005541415613466576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b6002600555846134885760405162461bcd60e51b81526004016109c1906154e4565b613493878787614105565b6000868152601160205260409020600601546134af90866123f1565b6000878152601160205260409020600601556134cb8785613e03565b600087815260116020818152604080842081516101208101835281546001600160a01b03168152600182015481850152600282015492810192909252600381015460ff9081161515606084015260048201546080840152600582015460a0840152600682015460c0840152600782015460e08401526008909101541661010082018190528b855292909152929650909161356b918a91908990899061100d565b6000888152601160205260408082205490516370a0823160e01b81529293506001600160a01b03169182906370a08231906135aa9030906004016152e2565b60206040518083038186803b1580156135c257600080fd5b505afa1580156135d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135fa91906151b4565b6006546040516370a0823160e01b81529192506000916001600160a01b03909116906370a08231906136309030906004016152e2565b60206040518083038186803b15801561364857600080fd5b505afa15801561365c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061368091906151b4565b60008b81526011602052604090206003015490915060ff16156136f757608084015160008b8152601260205260409020546136ba91612449565b60008b81526012602090815260409091209182558501516001909101546136e0916123f1565b60008b81526012602052604090206001015561374e565b608084015160008b81526012602052604090206001015461371791612449565b60008b81526012602090815260409091206001810192909255850151905461373e916123f1565b60008b8152601260205260409020555b858460800151101561376257836080015195505b60006137a2888660600151876000015161379b8960e001516137958b60c001518c602001516123f190919063ffffffff16565b906123f1565b8b8b6141d6565b6000815181106137ae57fe5b602002602001015190506137d63086600001518b8860c001518960e001518a60400151613f07565b60808501516000906137e89083612449565b6060870151909150613804906001600160a01b03168e8361239f565b60008c81526011602052604090206003015460ff161561384e57602086015161382e9084906123f1565b925061384786608001518561244990919063ffffffff16565b935061387a565b608086015161385e908490612449565b92506138778660200151856123f190919063ffffffff16565b93505b6006546040516370a0823160e01b815284916001600160a01b0316906370a08231906138aa9030906004016152e2565b60206040518083038186803b1580156138c257600080fd5b505afa1580156138d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138fa91906151b4565b10156139185760405162461bcd60e51b81526004016109c190615490565b6040516370a0823160e01b815284906001600160a01b038716906370a08231906139469030906004016152e2565b60206040518083038186803b15801561395e57600080fd5b505afa158015613972573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399691906151b4565b10156139b45760405162461bcd60e51b81526004016109c1906155b5565b601160008d815260200190815260200160002060000160009054906101000a90046001600160a01b03166001600160a01b03168c8e6001600160a01b03167fa9149acb233878ee232a8279e24b74301705dcfd2319e4bf98bda4b04040afd68e604051613a219190615872565b60405180910390a4505060016005555050505050505050505050565b6001600160a01b0383166000908152600c6020526040902054613a725760405162461bcd60e51b81526004016109c1906156a7565b60008211613a925760405162461bcd60e51b81526004016109c190615509565b6001600160a01b0383166000908152600c60205260409020548281613ab357fe5b0615613ad15760405162461bcd60e51b81526004016109c19061555a565b428111613af05760405162461bcd60e51b81526004016109c19061565e565b600e54613afd8242612449565b1115613b1b5760405162461bcd60e51b81526004016109c19061572e565b6202a2ff62093a808206146110085760405162461bcd60e51b81526004016109c190615752565b8051600090815b81811015613b9157846001600160a01b0316848281518110613b6757fe5b60200260200101516001600160a01b03161415613b8957600192505050610713565b600101613b49565b506000949350505050565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110613bd057fe5b602090810291909101015292915050565b613bf3846001600160a01b031661416b565b15610fe557836001600160a01b031663f23a6e6187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613c82578181015183820152602001613c6a565b50505050905090810190601f168015613caf5780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b158015613cd257600080fd5b505af1925050508015613cf757506040513d6020811015613cf257600080fd5b505160015b613d0357612e1161594d565b6001600160e01b0319811663f23a6e6160e01b146113fc5760405162461bcd60e51b8152600401808060200182810382526028815260200180615a586028913960400191505060405180910390fd5b6000613da7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166143fd9092919063ffffffff16565b80519091501561100857808060200190516020811015613dc657600080fd5b50516110085760405162461bcd60e51b815260040180806020018281038252602a815260200180615cc3602a913960400191505060405180910390fd5b6008546000906001600160a01b031615613ea257600854604051630b353c5160e41b81526001600160a01b039091169063b353c51090613e499086908690600401615322565b602060405180830381600087803b158015613e6357600080fd5b505af1158015613e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e9b9190614b1b565b9150613ea7565b600091505b50919050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610c9c908590613d52565b8215613f59576001600160a01b038616301415613f3d57600754613f38906001600160a01b0387811691168561239f565b613f59565b600754613f59906001600160a01b038781169189911686613ead565b8115613f9e576001600160a01b038616301415613f8957613f846001600160a01b038616858461239f565b613f9e565b613f9e6001600160a01b038616878685613ead565b6009546001600160a01b03161561402e576000613fbb84846123f1565b9050801561402c57600954604051631388d79f60e21b81526001600160a01b0390911690634e235e7c90613ff9908a908a908690889060040161533c565b600060405180830381600087803b15801561401357600080fd5b505af1158015614027573d6000803e3d6000fd5b505050505b505b836001600160a01b0316856001600160a01b0316876001600160a01b03167f7b025f69f5843a875988abc4e248350e4e5d0ec876e181973034e7a5c5bad884868660405161407d92919061587b565b60405180910390a4505050505050565b600082815260116020526040902060020154829042106140bf5760405162461bcd60e51b81526004016109c1906157a5565b600083815260116020908152604080832081519283019091529181526140ea9086908690869061440c565b60078101546140f990846123f1565b60079091015550505050565b600082815260116020526040902060020154829042106141375760405162461bcd60e51b81526004016109c1906157a5565b600083815260116020526040902060078101546141549084612449565b60078201556141648585856144fb565b5050505050565b3b151590565b600081836141c05760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612c30578181015183820152602001612c18565b5060008385816141cc57fe5b0495945050505050565b606061423a87600f805480602002602001604051908101604052809291908181526020018280548015611bf4576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311611bd6575050505050613b42565b6142565760405162461bcd60e51b81526004016109c190615585565b60405163095ea7b360e01b81526001600160a01b0387169063095ea7b390614284908a908790600401615367565b602060405180830381600087803b15801561429e57600080fd5b505af11580156142b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142d691906150e7565b5060006001600160a01b038816638803dbee868686306142f742603c6123f1565b6040518663ffffffff1660e01b8152600401614317959493929190615889565b600060405180830381600087803b15801561433157600080fd5b505af1158015614345573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261436d9190810190615064565b60405163095ea7b360e01b81529091506001600160a01b0388169063095ea7b39061439f908b90600090600401615367565b602060405180830381600087803b1580156143b957600080fd5b505af11580156143cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143f191906150e7565b50979650505050505050565b6060611564848460008561461c565b6001600160a01b0384166144515760405162461bcd60e51b8152600401808060200182810382526021815260200180615d3e6021913960400191505060405180910390fd5b600061445b61248b565b905061446d8160008761218688613b9c565b60008481526002602090815260408083206001600160a01b038916845290915290205461449a90846123f1565b60008581526002602090815260408083206001600160a01b03808b1680865291845282852095909555815189815292830188905281519094861692600080516020615aa083398151915292908290030190a461416481600087878787613be1565b6001600160a01b0383166145405760405162461bcd60e51b8152600401808060200182810382526023815260200180615c0c6023913960400191505060405180910390fd5b600061454a61248b565b905061457a8185600061455c87613b9c565b61456587613b9c565b60405180602001604052806000815250610fe5565b6145c182604051806060016040528060248152602001615b426024913960008681526002602090815260408083206001600160a01b038b1684529091529020549190612bdc565b60008481526002602090815260408083206001600160a01b03808a1680865291845282852095909555815188815292830187905281519394909390861692600080516020615aa083398151915292908290030190a450505050565b60608247101561465d5760405162461bcd60e51b8152600401808060200182810382526026815260200180615b8f6026913960400191505060405180910390fd5b6146668561416b565b6146b7576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106146f55780518252601f1990920191602091820191016146d6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614757576040519150601f19603f3d011682016040523d82523d6000602084013e61475c565b606091505b5091509150611f7a82828660608315614776575081610b70565b8251156147865782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315612c30578181015183820152602001612c18565b60405180610100016040528060006001600160a01b0316815260200160008152602001600060ff16815260200160006001600160a01b0316815260200160008152602001600060ff16815260200160008152602001600081525090565b5080546000825590600052602060002090810190610b03919061490f565b6040518060a0016040528060006001600160a01b0316815260200160008152602001600060ff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826148b957600085556148ff565b82601f106148d257805160ff19168380011785556148ff565b828001600101855582156148ff579182015b828111156148ff5782518255916020019190600101906148e4565b5061490b92915061490f565b5090565b5b8082111561490b5760008155600101614910565b60006001600160401b0383111561493757fe5b61494a601f8401601f1916602001615907565b905082815283838301111561495e57600080fd5b828260208301376000602084830101529392505050565b8035610737816159f1565b600082601f830112614990578081fd5b813560206149a56149a08361592a565b615907565b82815281810190858301838502870184018810156149c1578586fd5b855b858110156149e85781356149d6816159f1565b845292840192908401906001016149c3565b5090979650505050505050565b600082601f830112614a05578081fd5b81356020614a156149a08361592a565b8281528181019085830183850287018401881015614a31578586fd5b855b858110156149e857813584529284019290840190600101614a33565b803561073781615a06565b600082601f830112614a6a578081fd5b610b7083833560208501614924565b600060a08284031215614a8a578081fd5b60405160a081018181106001600160401b0382111715614aa657fe5b6040529050808235614ab7816159f1565b808252506020830135602082015260408301356040820152606083013560608201526080830135614ae781615a06565b6080919091015292915050565b803561073781615a14565b600060208284031215614b10578081fd5b8135610b70816159f1565b600060208284031215614b2c578081fd5b8151610b70816159f1565b60008060408385031215614b49578081fd5b8235614b54816159f1565b91506020830135614b64816159f1565b809150509250929050565b600080600080600060a08688031215614b86578081fd5b8535614b91816159f1565b94506020860135614ba1816159f1565b935060408601356001600160401b0380821115614bbc578283fd5b614bc889838a016149f5565b94506060880135915080821115614bdd578283fd5b614be989838a016149f5565b93506080880135915080821115614bfe578283fd5b50614c0b88828901614a5a565b9150509295509295909350565b600080600080600060a08688031215614c2f578283fd5b8535614c3a816159f1565b94506020860135614c4a816159f1565b9350604086013592506060860135915060808601356001600160401b03811115614c72578182fd5b614c0b88828901614a5a565b60008060408385031215614c90578182fd5b8235614c9b816159f1565b91506020830135614b6481615a06565b60008060008060008587036101a0811215614cc4578384fd5b8635614ccf816159f1565b9550610120601f198201811315614ce4578485fd5b614ced81615907565b9150614cfb60208901614975565b82526040880135602083015260608801356040830152614d1d60808901614a4f565b606083015260a0880135608083015260c088013560a083015260e088013560c08301526101008089013560e0840152614d57828a01614af4565b908301525093506101408601359250614d736101608701614975565b9150614d826101808701614af4565b90509295509295909350565b600080600060e08486031215614da2578081fd5b8335614dad816159f1565b9250614dbc8560208601614a79565b915060c0840135614dcc816159f1565b809150509250925092565b6000806000806101008587031215614ded578182fd5b8435614df8816159f1565b9350614e078660208701614a79565b925060c0850135614e17816159f1565b915060e0850135614e2781615a14565b939692955090935050565b60008060408385031215614e44578182fd5b8235614e4f816159f1565b946020939093013593505050565b600080600060608486031215614e71578081fd5b8335614e7c816159f1565b9250602084013591506040840135614dcc816159f1565b600080600060608486031215614ea7578081fd5b8335614eb2816159f1565b95602085013595506040909401359392505050565b60008060008060808587031215614edc578182fd5b8435614ee7816159f1565b935060208501359250604085013591506060850135614e27816159f1565b600080600080600080600060e0888a031215614f1f578485fd5b8735614f2a816159f1565b965060208801359550604088013594506060880135614f48816159f1565b93506080880135614f58816159f1565b925060a0880135915060c08801356001600160401b03811115614f79578182fd5b614f858a828b01614980565b91505092959891949750929550565b60008060008060808587031215614fa9578182fd5b8435614fb4816159f1565b935060208501359250604085013591506060850135614e2781615a06565b600060208284031215614fe3578081fd5b81356001600160401b03811115614ff8578182fd5b61156484828501614980565b60008060408385031215615016578182fd5b82356001600160401b038082111561502c578384fd5b61503886838701614980565b9350602085013591508082111561504d578283fd5b5061505a858286016149f5565b9150509250929050565b60006020808385031215615076578182fd5b82516001600160401b0381111561508b578283fd5b8301601f8101851361509b578283fd5b80516150a96149a08261592a565b81815283810190838501858402850186018910156150c5578687fd5b8694505b838510156143f15780518352600194909401939185019185016150c9565b6000602082840312156150f8578081fd5b8151610b7081615a06565b600060208284031215615114578081fd5b81356001600160e01b031981168114610b70578182fd5b60006020828403121561513c578081fd5b81356001600160401b03811115615151578182fd5b8201601f81018413615161578182fd5b61156484823560208401614924565b60008060c08385031215615182578182fd5b61518c8484614a79565b915060a0830135614b64816159f1565b6000602082840312156151ad578081fd5b5035919050565b6000602082840312156151c5578081fd5b5051919050565b600080604083850312156151de578182fd5b50508035926020909101359150565b600080604083850312156151ff578182fd5b505080516020909101519092909150565b600080600060608486031215615224578081fd5b83359250602084013591506040840135614dcc816159f1565b60008060008060008060c08789031215615255578384fd5b8635955060208701359450604087013561526e816159f1565b9350606087013561527e816159f1565b92506080870135915060a08701356001600160401b0381111561529f578182fd5b6152ab89828a01614980565b9150509295509295509295565b6000602082840312156152c9578081fd5b8151610b7081615a14565b600581106152de57fe5b9052565b6001600160a01b0391909116815260200190565b6001600160a01b0385168152831515602082015260408101839052608081016111af60608301846152d4565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039485168152929093166020830152604082015260ff909116606082015260800190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03999099168952602089019790975260408801959095529215156060870152608086019190915260a085015260c084015260e083015260ff166101008201526101200190565b6020808252825182820181905260009190848201906040850190845b818110156154265783518352928401929184019160010161540a565b50909695505050505050565b901515815260200190565b6000602080835283518082850152825b818110156154695785810183015185820160400152820161544d565b8181111561547a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600f908201526e15dc9bdb99c819195b9bdb4818985b608a1b604082015260600190565b6020808252601190820152704e6f7420656e6f75676820636c61696d7360781b604082015260600190565b6020808252600b908201526a0416d6f756e74203c3d20360ac1b604082015260600190565b6020808252600b908201526a0537472696b65203c3d20360ac1b604082015260600190565b6020808252601290820152714e6f206f7074696f6e20746f20636c61696d60701b604082015260600190565b6020808252601190820152702bb937b7339039ba3934b5b29034b731b960791b604082015260600190565b602080825260169082015275149bdd5d195c881b9bdd081dda1a5d195b1a5cdd195960521b604082015260600190565b6020808252600f908201526e15dc9bdb99c81d1bdad95b8818985b608a1b604082015260600190565b6020808252601490820152734e6f7420656e6f75676820636c61696d61626c6560601b604082015260600190565b6020808252601290820152714661696c656420746f20706179206261636b60701b604082015260600190565b6020808252600c908201526b139bdd08185c1c1c9bdd995960a21b604082015260600190565b6020808252600a9082015269115e1c081c185cdcd95960b21b604082015260600190565b6020808252600b908201526a139bdd08195e1c1a5c995960aa1b604082015260600190565b602080825260139082015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604082015260600190565b60208082526014908201527321b0b73a1030b232103232b737b6b4b730ba37b960611b604082015260600190565b6020808252601290820152712737ba1032b737bab3b4103bb934ba3a32b760711b604082015260600190565b6020808252600a908201526922bc38101f1018903cb960b11b604082015260600190565b6020808252600e908201526d2bb937b7339032bc381034b731b960911b604082015260600190565b602080825260119082015270546f6f206d616e7920646563696d616c7360781b604082015260600190565b602080825260079082015266115e1c1a5c995960ca1b604082015260600190565b60006101008201905060018060a01b038084511683526020840151602084015260ff6040850151166040840152806060850151166060840152506080830151608083015260ff60a08401511660a083015260c083015160c083015260e083015160e083015292915050565b81516001600160a01b031681526020808301519082015260408083015160ff1690820152606080830151908201526080918201519181019190915260a00190565b90815260200190565b918252602082015260400190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156158d85784516001600160a01b0316835293830193918301916001016158b3565b50506001600160a01b03969096166060850152505050608001529392505050565b60ff91909116815260200190565b6040518181016001600160401b038111828210171561592257fe5b604052919050565b60006001600160401b0382111561593d57fe5b5060209081020190565b60e01c90565b600060443d101561595d5761152e565b600481823e6308c379a06159718251615947565b1461597b5761152e565b6040513d600319016004823e80513d6001600160401b0381602484011181841117156159aa575050505061152e565b828401925082519150808211156159c4575050505061152e565b503d830160208284010111156159dc5750505061152e565b601f01601f1916810160200160405291505090565b6001600160a01b0381168114610b0357600080fd5b8015158114610b0357600080fd5b60ff81168114610b0357600080fdfe455243313135353a207472616e7366657220746f206e6f6e2045524331313535526563656976657220696d706c656d656e746572455243313135353a204552433131353552656365697665722072656a656374656420746f6b656e735265656e7472616e637947756172643a207265656e7472616e742063616c6c00c3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62455243313135353a2062616c616e636520717565727920666f7220746865207a65726f2061646472657373455243313135353a2062617463682062616c616e636520717565727920666f7220746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373455243313135353a206275726e20616d6f756e7420657863656564732062616c616e6365455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c455243313135353a207472616e7366657220746f20746865207a65726f2061646472657373455243313135353a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243313135353a206275726e2066726f6d20746865207a65726f2061646472657373455243313135353a20696e73756666696369656e742062616c616e636520666f72207472616e73666572536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572455243313135353a2073657474696e6720617070726f76616c2073746174757320666f722073656c665361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564455243313135353a206163636f756e747320616e6420696473206c656e677468206d69736d61746368455243313135353a2069647320616e6420616d6f756e7473206c656e677468206d69736d61746368455243313135353a206d696e7420746f20746865207a65726f2061646472657373a2646970667358221220a7dec1e778243144adf635499a9b7533cc8e28e23737195947d79616963e14d364736f6c6343000706003300000000000000000000000000000000000000000000000000000000000000c00000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000008406c6c1db4d224c8b0cf7859c0881ddd68d4761000000000000000000000000602b50091b0b351ca179e87ad6e006aeceb2a6ad000000000000000000000000afcf4ca5826ed76189ea227bd863916abf43a6da000000000000000000000000c22fae86443aeed038a4ed887bba8f5035fd12f0000000000000000000000000000000000000000000000000000000000000002868747470733a2f2f7072656d69612e66696e616e63652f6170692f6461692f7b69647d2e6a736f6e000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102965760003560e01c80638c66d04f11610168578063b9a8e9d3116100d4578063b9a8e9d3146105a6578063bf9092ce146105ae578063c0b5f2cc146105c1578063c8390a48146105d4578063d35daf2b146105e7578063d48b0e5214610607578063d92fc67b1461061a578063dbe5f0eb14610622578063e74b981b14610635578063e985e9c514610648578063f18e1a941461065b578063f242432a1461066e578063f2fde38b14610681578063f3944b271461069457610296565b80638c66d04f146104cd5780638da5cb5b146104e05780638e5a2892146104e85780639215abb0146104fb5780639470b0bd1461050357806396ce0795146105165780639fe9f8481461051e578063a22cb46514610531578063a852c7e714610544578063ac4afa3814610557578063b00eb9fe14610578578063b4ac946014610580578063b7f1dd2e1461059357610296565b806330b025eb1161020757806330b025eb146103ce5780633a5b7c82146103e15780633e998172146103f4578063410e4e2614610414578063469048401461042757806348af19681461043c5780634cc47c0d1461044f5780634e1273f4146104645780634ebd2287146104845780634f64b2be1461048c5780635c070b651461049f5780635c6a945e146104b2578063715018a6146104c557610296565b8062fdd58e1461029b57806301ffc9a7146102c457806302c25b54146102e457806302fe5305146102f95780630676695b1461030c5780630e2e8c541461031f5780630e89341c146103325780631f01a794146103525780632216ef601461037a57806325bee3e91461038d578063263621f3146103955780632e1a7d4d146103a85780632eb2c2d6146103bb575b600080fd5b6102ae6102a9366004614e32565b6106a7565b6040516102bb9190615872565b60405180910390f35b6102d76102d2366004615103565b610719565b6040516102bb9190615432565b6102f76102f2366004614e5d565b61073c565b005b6102f761030736600461512b565b610aa2565b6102f761031a36600461519c565b610b06565b6102ae61032d366004615170565b610b63565b61034561034036600461519c565b610b77565b6040516102bb919061543d565b61036561036036600461519c565b610c0f565b6040516102bb999897969594939291906153a1565b6102f7610388366004614ec7565b610c6a565b6102ae610ca2565b6102ae6103a3366004614f94565b610ca8565b6102f76103b636600461519c565b610ce5565b6102f76103c9366004614b6f565b610cef565b6102f76103dc3660046151cc565b610fed565b6102f76103ef366004615210565b610ffc565b610407610402366004614cab565b61100d565b6040516102bb91906157c6565b6102ae610422366004614e32565b6111b8565b61042f6111d5565b6040516102bb91906152e2565b6102ae61044a366004614aff565b6111e4565b6104576111f6565b6040516102bb91906158f9565b610477610472366004615004565b611206565b6040516102bb91906153ee565b61042f611383565b61042f61049a36600461519c565b611392565b6102f76104ad3660046151cc565b6113bc565b6102f76104c0366004614f05565b6113c7565b6102f7611405565b6102f76104db366004614aff565b6114a7565b61042f611521565b6102ae6104f6366004614d8e565b611531565b6102ae61156c565b6102f7610511366004614e32565b611572565b61042f6115a2565b6102f761052c366004614fd2565b6115b1565b6102f761053f366004614c7e565b611674565b6102f7610552366004614e93565b611763565b61056a61056536600461519c565b611794565b6040516102bb92919061587b565b61042f6117ad565b6102ae61058e366004614f94565b6117bc565b6102f76105a136600461523d565b6117e8565b61042f6117f7565b6102ae6105bc366004614f94565b611806565b6102f76105cf366004614aff565b611a9b565b6102f76105e2366004615004565b611b15565b6105fa6105f5366004614dd7565b611d57565b6040516102bb9190615831565b6102ae610615366004614ec7565b611e85565b6102ae611f85565b61042f61063036600461519c565b611f8b565b6102f7610643366004614aff565b611f9b565b6102d7610656366004614b37565b612015565b6102f7610669366004614aff565b612043565b6102f761067c366004614c18565b6120bd565b6102f761068f366004614aff565b612276565b6102f76106a2366004614e93565b61236e565b60006001600160a01b0383166106ee5760405162461bcd60e51b815260040180806020018281038252602b815260200180615ac0602b913960400191505060405180910390fd5b5060008181526002602090815260408083206001600160a01b03861684529091529020545b92915050565b6001600160e01b0319811660009081526001602052604090205460ff165b919050565b60026005541415610782576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b60026005556040516370a0823160e01b815283906000906001600160a01b038316906370a08231906107b89030906004016152e2565b60206040518083038186803b1580156107d057600080fd5b505afa1580156107e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080891906151b4565b905061081e6001600160a01b038316848661239f565b600a54604051637693655560e01b81526000916001600160a01b03169063769365559061085590339085908a9060049081016152f6565b604080518083038186803b15801561086c57600080fd5b505afa158015610880573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a491906151ed565b5090506001600160a01b03841663c52ab77887876108c281866123f1565b6040518463ffffffff1660e01b81526004016108e093929190615380565b600060405180830381600087803b1580156108fa57600080fd5b505af115801561090e573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b03861691506370a08231906109419030906004016152e2565b60206040518083038186803b15801561095957600080fd5b505afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099191906151b4565b9050600061099f84846123f1565b9050808210156109ca5760405162461bcd60e51b81526004016109c19061560c565b60405180910390fd5b6007546109f5906001600160a01b03166109e48487612449565b6001600160a01b038816919061239f565b6040516370a0823160e01b81526001600160a01b038616906370a0823190610a219030906004016152e2565b60206040518083038186803b158015610a3957600080fd5b505afa158015610a4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7191906151b4565b915083821015610a935760405162461bcd60e51b81526004016109c19061560c565b50506001600555505050505050565b610aaa61248b565b6000546001600160a01b03908116911614610afa576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b610b038161248f565b50565b610b0e61248b565b6000546001600160a01b03908116911614610b5e576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600e55565b6000610b703384846124a2565b9392505050565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c035780601f10610bd857610100808354040283529160200191610c03565b820191906000526020600020905b815481529060010190602001808311610be657829003601f168201915b50505050509050919050565b6011602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460078801546008909801546001600160a01b03909716979596949560ff9485169593949293919290911689565b610c748433612015565b610c905760405162461bcd60e51b81526004016109c190615638565b610c9c848484846126de565b50505050565b600e5481565b6001600160a01b03939093166000908152601060209081526040808320948352938152838220928252918252828120931515815292905290205490565b610b033382612983565b8151835114610d2f5760405162461bcd60e51b8152600401808060200182810382526028815260200180615d166028913960400191505060405180910390fd5b6001600160a01b038416610d745760405162461bcd60e51b8152600401808060200182810382526025815260200180615bb56025913960400191505060405180910390fd5b610d7c61248b565b6001600160a01b0316856001600160a01b03161480610da25750610da28561065661248b565b610ddd5760405162461bcd60e51b8152600401808060200182810382526032815260200180615bda6032913960400191505060405180910390fd5b6000610de761248b565b9050610df7818787878787610fe5565b60005b8451811015610efd576000858281518110610e1157fe5b602002602001015190506000858381518110610e2957fe5b60200260200101519050610e96816040518060600160405280602a8152602001615c2f602a91396002600086815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002054612bdc9092919063ffffffff16565b60008381526002602090815260408083206001600160a01b038e811685529252808320939093558a1681522054610ecd90826123f1565b60009283526002602090815260408085206001600160a01b038c1686529091529092209190915550600101610dfa565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610f83578181015183820152602001610f6b565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610fc2578181015183820152602001610faa565b5050505090500194505050505060405180910390a4610fe5818787878787612c73565b505050505050565b610ff8338383612ee9565b5050565b611008338484846126de565b505050565b6110156147cd565b61101d6147cd565b6000859050600061104b8560ff16600a0a6110458a602001518a61312f90919063ffffffff16565b90613188565b905087606001511561109f576006546001600160a01b0380821685526020850183905260ff600160a01b909204821660408601528951166060850152608084018390526101008901511660a08401526110e6565b87516001600160a01b0390811684526020840183905261010089015160ff9081166040860152600654918216606086015260808501839052600160a01b9091041660a08401525b600080600a60009054906101000a90046001600160a01b03166001600160a01b031663769365558c60006001600160a01b03168b6001600160a01b03161415886020015160016040518563ffffffff1660e01b815260040161114b94939291906152f6565b604080518083038186803b15801561116257600080fd5b505afa158015611176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119a91906151ed565b60c087019190915260e0860152509293505050505b95945050505050565b601360209081526000928352604080842090915290825290205481565b6007546001600160a01b031681565b600c6020526000908152604090205481565b600654600160a01b900460ff1681565b606081518351146112485760405162461bcd60e51b8152600401808060200182810382526029815260200180615ced6029913960400191505060405180910390fd5b600083516001600160401b038111801561126157600080fd5b5060405190808252806020026020018201604052801561128b578160200160208202803683370190505b50905060005b845181101561137b5760006001600160a01b03168582815181106112b157fe5b60200260200101516001600160a01b031614156112ff5760405162461bcd60e51b8152600401808060200182810382526031815260200180615aeb6031913960400191505060405180910390fd5b6002600085838151811061130f57fe5b60200260200101518152602001908152602001600020600086838151811061133357fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061136857fe5b6020908102919091010152600101611291565b509392505050565b6008546001600160a01b031681565b600b81815481106113a257600080fd5b6000918252602090912001546001600160a01b0316905081565b610ff83383836131c7565b6113d18733612015565b6113ed5760405162461bcd60e51b81526004016109c190615638565b6113fc87878787878787613420565b50505050505050565b61140d61248b565b6000546001600160a01b0390811691161461145d576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6114af61248b565b6000546001600160a01b039081169116146114ff576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03165b90565b600061153d8433612015565b6115595760405162461bcd60e51b81526004016109c190615638565b6115648484846124a2565b949350505050565b600d5481565b61157c8233612015565b6115985760405162461bcd60e51b81526004016109c190615638565b610ff88282612983565b6006546001600160a01b031681565b6115b961248b565b6000546001600160a01b03908116911614611609576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b611615600f600061482a565b60005b8151811015610ff857600f82828151811061162f57fe5b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501611618565b816001600160a01b031661168661248b565b6001600160a01b031614156116cc5760405162461bcd60e51b8152600401808060200182810382526029815260200180615c9a6029913960400191505060405180910390fd5b80600360006116d961248b565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561171d61248b565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b61176d8333612015565b6117895760405162461bcd60e51b81526004016109c190615638565b6110088383836131c7565b6012602052600090815260409020805460019091015482565b600a546001600160a01b031681565b601060209081526000948552604080862082529385528385208152918452828420909152825290205481565b610fe533878787878787613420565b6009546001600160a01b031681565b60008061181586868686610ca8565b9050806111af57611827868587613a3d565b50600d546001600160a01b03861660008181526010602090815260408083208984528252808320888452825280832087151584528252808320859055805163313ce56760e01b8152905192939263313ce56792600480840193919291829003018186803b15801561189757600080fd5b505afa1580156118ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cf91906152b8565b905060128160ff1611156118f55760405162461bcd60e51b81526004016109c19061577a565b6040518060400160405280600081526020016000815250601260008481526020019081526020016000206000820151816000015560208201518160010155905050604051806101200160405280886001600160a01b031681526020018681526020018781526020018515158152602001600081526020016000815260200160008152602001600081526020018260ff168152506011600084815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff0219169083151502179055506080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080160006101000a81548160ff021916908360ff160217905550905050866001600160a01b0316827ffde1d545a79e30139419cf7880b5c46d455dd9f1dfd88cc6cbc898d348af72ff60405160405180910390a3600d54611a8e9060016123f1565b600d555095945050505050565b611aa361248b565b6000546001600160a01b03908116911614611af3576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b611b1d61248b565b6000546001600160a01b03908116911614611b6d576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b8051825114611b7b57600080fd5b60005b825181101561100857611bfe838281518110611b9657fe5b6020026020010151600b805480602002602001604051908101604052809291908181526020018280548015611bf457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611bd6575b5050505050613b42565b611c4c57600b838281518110611c1057fe5b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b039092169190911790555b60065483516001600160a01b0390911690849083908110611c6957fe5b60200260200101516001600160a01b03161415611c985760405162461bcd60e51b81526004016109c1906156d4565b818181518110611ca457fe5b6020026020010151600c6000858481518110611cbc57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550828181518110611cf457fe5b60200260200101516001600160a01b03167f720764556647dd167f4229d6a4255ac86018e302a50fc29dd67a70edb7b314d0838381518110611d3257fe5b6020026020010151604051611d479190615872565b60405180910390a2600101611b7e565b611d5f614848565b611d67614848565b846080015115611d965784516001600160a01b031681526020808601519082015260ff83166040820152611ddb565b6006546001600160a01b0316815260408501516020860151611dc39160ff8616600a0a916110459161312f565b6020820152600654600160a01b900460ff1660408201525b600a546020820151604051637693655560e01b815260009283926001600160a01b0391821692637693655592611e1d928d92918c1615159187906004016152f6565b604080518083038186803b158015611e3457600080fd5b505afa158015611e48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6c91906151ed565b6060850191909152608084015250909695505050505050565b6000611e918533612015565b611ead5760405162461bcd60e51b81526004016109c190615638565b60008481526011602090815260409182902082516101208101845281546001600160a01b03908116825260018301548285019081526002840154838701908152600385015460ff908116151560608087019182526004880154608080890191909152600589015460a0808a019190915260068a015460c08a015260078a015460e08a015260089099015490931661010088015289519788018a52865190951687529686018b9052915196850196909652945190830152915115159281019290925290611f7a8782866124a2565b979650505050505050565b600b5490565b600f81815481106113a257600080fd5b611fa361248b565b6000546001600160a01b03908116911614611ff3576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b61204b61248b565b6000546001600160a01b0390811691161461209b576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0384166121025760405162461bcd60e51b8152600401808060200182810382526025815260200180615bb56025913960400191505060405180910390fd5b61210a61248b565b6001600160a01b0316856001600160a01b0316148061213057506121308561065661248b565b61216b5760405162461bcd60e51b8152600401808060200182810382526029815260200180615b666029913960400191505060405180910390fd5b600061217561248b565b905061219581878761218688613b9c565b61218f88613b9c565b87610fe5565b6121dc836040518060600160405280602a8152602001615c2f602a913960008781526002602090815260408083206001600160a01b038d1684529091529020549190612bdc565b60008581526002602090815260408083206001600160a01b038b8116855292528083209390935587168152205461221390846123f1565b60008581526002602090815260408083206001600160a01b03808b168086529184529382902094909455805188815291820187905280518a841693861692600080516020615aa083398151915292908290030190a4610fe5818787878787613be1565b61227e61248b565b6000546001600160a01b039081169116146122ce576040805162461bcd60e51b81526020600482018190526024820152600080516020615c7a833981519152604482015290519081900360640190fd5b6001600160a01b0381166123135760405162461bcd60e51b8152600401808060200182810382526026815260200180615b1c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6123788333612015565b6123945760405162461bcd60e51b81526004016109c190615638565b611008838383612ee9565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611008908490613d52565b600082820183811015610b70576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000610b7083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdc565b3390565b8051610ff8906004906020840190614883565b6000600260055414156124ea576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b600260055560208301516125105760405162461bcd60e51b81526004016109c1906154e4565b600061252e8460000151856060015186604001518760800151611806565b905061253a8584613e03565b600082815260116020526040812060080154919450906125629087908790879060ff16611d57565b60208101518151919250612583916001600160a01b03169088903090613ead565b6125a186826000015186846060015185608001518660400151613f07565b8460800151156125de57602080820151600084815260129092526040909120546125ca916123f1565b600083815260126020526040902055612613565b60208082015160008481526012909252604090912060010154612600916123f1565b6000838152601260205260409020600101555b6020808601516001600160a01b03881660009081526013835260408082208683529093529190912054612645916123f1565b6001600160a01b038716600090815260136020908152604080832086845282529091209190915585015161267c908790849061408d565b84600001516001600160a01b031682876001600160a01b03167fb621f8758571be4a426feacc13e4bb7a476c12cda0805ba65f14f89d1a0a05c388602001516040516126c89190615872565b60405180910390a4506001600555949350505050565b60026005541415612724576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b6002600555816127465760405162461bcd60e51b81526004016109c1906154e4565b600083815260116020526040902061275f858585614105565b600681015461276e90846123f1565b600682015561277d8583613e03565b604080516101208101825283546001600160a01b0316815260018401546020820152600284015491810191909152600383015460ff9081161515606083015260048401546080830152600584015460a0830152600684015460c0830152600784015460e083015260088401541661010082018190529193506000916128079188918790879061100d565b60208101518151919250612828916001600160a01b03169088903090613ead565b612846868260000151858460c001518560e001518660400151613f07565b600382015460ff16156128ad57608081015160008681526012602052604090205461287091612449565b6000868152601260209081526040909120918255820151600190910154612896916123f1565b600086815260126020526040902060010155612904565b60808101516000868152601260205260409020600101546128cd91612449565b6000868152601260209081526040909120600181019290925582015190546128f4916123f1565b6000868152601260205260409020555b61292a86826080015183606001516001600160a01b031661239f9092919063ffffffff16565b81546040516001600160a01b03918216918791908916907fa9149acb233878ee232a8279e24b74301705dcfd2319e4bf98bda4b04040afd69061296e908990615872565b60405180910390a45050600160055550505050565b600260055414156129c9576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b60026005819055600082815260116020526040902001548190421015612a015760405162461bcd60e51b81526004016109c190615682565b6001600160a01b0383166000908152601360209081526040808320858452909152902054612a415760405162461bcd60e51b81526004016109c19061552e565b6000828152601160205260408120600481015460068201546007830154929392612a769291612a7091906123f1565b90612449565b6001600160a01b0386166000908152601360209081526040808320888452825280832054601290925282206001015492935091612ab9908490611045908561312f565b60008781526012602052604081205491925090612adc908590611045908661312f565b600088815260126020526040902060010154909150612afb9083612449565b50600087815260126020526040902054612b159082612449565b506005850154612b2590846123f1565b60058601556001600160a01b0380891660009081526013602090815260408083208b8452909152812055600654612b5e9116898461239f565b600087815260116020526040902054612b81906001600160a01b0316898361239f565b84546040516001600160a01b03918216918991908b16907f457f950b75085c30ff780acd57bde642ff1316cc4aad9f286af2c1ffc4163a7890612bc5908890615872565b60405180910390a450506001600555505050505050565b60008184841115612c6b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c30578181015183820152602001612c18565b50505050905090810190601f168015612c5d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b612c85846001600160a01b031661416b565b15610fe557836001600160a01b031663bc197c8187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b03168152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015612d13578181015183820152602001612cfb565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015612d52578181015183820152602001612d3a565b50505050905001848103825285818151815260200191508051906020019080838360005b83811015612d8e578181015183820152602001612d76565b50505050905090810190601f168015612dbb5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b158015612de057600080fd5b505af1925050508015612e0557506040513d6020811015612e0057600080fd5b505160015b612e9a57612e1161594d565b80612e1c5750612e63565b60405162461bcd60e51b8152602060048201818152835160248401528351849391928392604401919085019080838360008315612c30578181015183820152602001612c18565b60405162461bcd60e51b8152600401808060200182810382526034815260200180615a246034913960400191505060405180910390fd5b6001600160e01b0319811663bc197c8160e01b146113fc5760405162461bcd60e51b8152600401808060200182810382526028815260200180615a586028913960400191505060405180910390fd5b60026005541415612f2f576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b600260055580612f515760405162461bcd60e51b81526004016109c1906154e4565b6001600160a01b0383166000908152601360209081526040808320858452909152902054811115612f945760405162461bcd60e51b81526004016109c190615702565b612f9f838383614105565b6001600160a01b0383166000908152601360209081526040808320858452909152902054612fcd9082612449565b6001600160a01b038416600090815260136020908152604080832086845282528083209390935560119052206003015460ff16156130525760008281526012602052604090205461301e9082612449565b60008381526012602090815260408083209390935560119052205461304d906001600160a01b0316848361239f565b6130cb565b600082815260116020526040812060088101546001909101546130819160ff16600a0a9061104590859061312f565b6000848152601260205260409020600101549091506130a09082612449565b6000848152601260205260409020600101556006546130c9906001600160a01b0316858361239f565b505b600082815260116020526040908190205490516001600160a01b03918216918491908616907f9035f481e4b25fdafc60883ab62c86fec841bb1c318f5b189ebee1b10ced360b9061311d908690615872565b60405180910390a45050600160055550565b60008261313e57506000610713565b8282028284828161314b57fe5b0414610b705760405162461bcd60e51b8152600401808060200182810382526021815260200180615c596021913960400191505060405180910390fd5b6000610b7083836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250614171565b6002600554141561320d576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b6002600581905560008381526011602052604090200154829042106132445760405162461bcd60e51b81526004016109c1906157a5565b600082116132645760405162461bcd60e51b81526004016109c1906154e4565b6001600160a01b0384166000908152601360209081526040808320868452909152902054828110156132a85760405162461bcd60e51b81526004016109c1906154b9565b6000848152601160205260408120600481015460068201549192916132cc91612449565b9050848110156132ee5760405162461bcd60e51b81526004016109c1906155de565b6001600160a01b038716600090815260136020908152604080832089845290915290205461331c9086612449565b6001600160a01b03881660009081526013602090815260408083208a8452909152902055600482015461334f90866123f1565b6004830155600382015460ff16156133d457600882015460018301546000916133869160ff909116600a0a9061104590899061312f565b6000888152601260205260409020600101549091506133a59082612449565b6000888152601260205260409020600101556006546133ce906001600160a01b0316898361239f565b50613412565b6000868152601260205260409020546133ed9086612449565b6000878152601260205260409020558154613412906001600160a01b0316888761239f565b505060016005555050505050565b60026005541415613466576040805162461bcd60e51b815260206004820152601f6024820152600080516020615a80833981519152604482015290519081900360640190fd5b6002600555846134885760405162461bcd60e51b81526004016109c1906154e4565b613493878787614105565b6000868152601160205260409020600601546134af90866123f1565b6000878152601160205260409020600601556134cb8785613e03565b600087815260116020818152604080842081516101208101835281546001600160a01b03168152600182015481850152600282015492810192909252600381015460ff9081161515606084015260048201546080840152600582015460a0840152600682015460c0840152600782015460e08401526008909101541661010082018190528b855292909152929650909161356b918a91908990899061100d565b6000888152601160205260408082205490516370a0823160e01b81529293506001600160a01b03169182906370a08231906135aa9030906004016152e2565b60206040518083038186803b1580156135c257600080fd5b505afa1580156135d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135fa91906151b4565b6006546040516370a0823160e01b81529192506000916001600160a01b03909116906370a08231906136309030906004016152e2565b60206040518083038186803b15801561364857600080fd5b505afa15801561365c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061368091906151b4565b60008b81526011602052604090206003015490915060ff16156136f757608084015160008b8152601260205260409020546136ba91612449565b60008b81526012602090815260409091209182558501516001909101546136e0916123f1565b60008b81526012602052604090206001015561374e565b608084015160008b81526012602052604090206001015461371791612449565b60008b81526012602090815260409091206001810192909255850151905461373e916123f1565b60008b8152601260205260409020555b858460800151101561376257836080015195505b60006137a2888660600151876000015161379b8960e001516137958b60c001518c602001516123f190919063ffffffff16565b906123f1565b8b8b6141d6565b6000815181106137ae57fe5b602002602001015190506137d63086600001518b8860c001518960e001518a60400151613f07565b60808501516000906137e89083612449565b6060870151909150613804906001600160a01b03168e8361239f565b60008c81526011602052604090206003015460ff161561384e57602086015161382e9084906123f1565b925061384786608001518561244990919063ffffffff16565b935061387a565b608086015161385e908490612449565b92506138778660200151856123f190919063ffffffff16565b93505b6006546040516370a0823160e01b815284916001600160a01b0316906370a08231906138aa9030906004016152e2565b60206040518083038186803b1580156138c257600080fd5b505afa1580156138d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138fa91906151b4565b10156139185760405162461bcd60e51b81526004016109c190615490565b6040516370a0823160e01b815284906001600160a01b038716906370a08231906139469030906004016152e2565b60206040518083038186803b15801561395e57600080fd5b505afa158015613972573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399691906151b4565b10156139b45760405162461bcd60e51b81526004016109c1906155b5565b601160008d815260200190815260200160002060000160009054906101000a90046001600160a01b03166001600160a01b03168c8e6001600160a01b03167fa9149acb233878ee232a8279e24b74301705dcfd2319e4bf98bda4b04040afd68e604051613a219190615872565b60405180910390a4505060016005555050505050505050505050565b6001600160a01b0383166000908152600c6020526040902054613a725760405162461bcd60e51b81526004016109c1906156a7565b60008211613a925760405162461bcd60e51b81526004016109c190615509565b6001600160a01b0383166000908152600c60205260409020548281613ab357fe5b0615613ad15760405162461bcd60e51b81526004016109c19061555a565b428111613af05760405162461bcd60e51b81526004016109c19061565e565b600e54613afd8242612449565b1115613b1b5760405162461bcd60e51b81526004016109c19061572e565b6202a2ff62093a808206146110085760405162461bcd60e51b81526004016109c190615752565b8051600090815b81811015613b9157846001600160a01b0316848281518110613b6757fe5b60200260200101516001600160a01b03161415613b8957600192505050610713565b600101613b49565b506000949350505050565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110613bd057fe5b602090810291909101015292915050565b613bf3846001600160a01b031661416b565b15610fe557836001600160a01b031663f23a6e6187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613c82578181015183820152602001613c6a565b50505050905090810190601f168015613caf5780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b158015613cd257600080fd5b505af1925050508015613cf757506040513d6020811015613cf257600080fd5b505160015b613d0357612e1161594d565b6001600160e01b0319811663f23a6e6160e01b146113fc5760405162461bcd60e51b8152600401808060200182810382526028815260200180615a586028913960400191505060405180910390fd5b6000613da7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166143fd9092919063ffffffff16565b80519091501561100857808060200190516020811015613dc657600080fd5b50516110085760405162461bcd60e51b815260040180806020018281038252602a815260200180615cc3602a913960400191505060405180910390fd5b6008546000906001600160a01b031615613ea257600854604051630b353c5160e41b81526001600160a01b039091169063b353c51090613e499086908690600401615322565b602060405180830381600087803b158015613e6357600080fd5b505af1158015613e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e9b9190614b1b565b9150613ea7565b600091505b50919050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610c9c908590613d52565b8215613f59576001600160a01b038616301415613f3d57600754613f38906001600160a01b0387811691168561239f565b613f59565b600754613f59906001600160a01b038781169189911686613ead565b8115613f9e576001600160a01b038616301415613f8957613f846001600160a01b038616858461239f565b613f9e565b613f9e6001600160a01b038616878685613ead565b6009546001600160a01b03161561402e576000613fbb84846123f1565b9050801561402c57600954604051631388d79f60e21b81526001600160a01b0390911690634e235e7c90613ff9908a908a908690889060040161533c565b600060405180830381600087803b15801561401357600080fd5b505af1158015614027573d6000803e3d6000fd5b505050505b505b836001600160a01b0316856001600160a01b0316876001600160a01b03167f7b025f69f5843a875988abc4e248350e4e5d0ec876e181973034e7a5c5bad884868660405161407d92919061587b565b60405180910390a4505050505050565b600082815260116020526040902060020154829042106140bf5760405162461bcd60e51b81526004016109c1906157a5565b600083815260116020908152604080832081519283019091529181526140ea9086908690869061440c565b60078101546140f990846123f1565b60079091015550505050565b600082815260116020526040902060020154829042106141375760405162461bcd60e51b81526004016109c1906157a5565b600083815260116020526040902060078101546141549084612449565b60078201556141648585856144fb565b5050505050565b3b151590565b600081836141c05760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612c30578181015183820152602001612c18565b5060008385816141cc57fe5b0495945050505050565b606061423a87600f805480602002602001604051908101604052809291908181526020018280548015611bf4576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311611bd6575050505050613b42565b6142565760405162461bcd60e51b81526004016109c190615585565b60405163095ea7b360e01b81526001600160a01b0387169063095ea7b390614284908a908790600401615367565b602060405180830381600087803b15801561429e57600080fd5b505af11580156142b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142d691906150e7565b5060006001600160a01b038816638803dbee868686306142f742603c6123f1565b6040518663ffffffff1660e01b8152600401614317959493929190615889565b600060405180830381600087803b15801561433157600080fd5b505af1158015614345573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261436d9190810190615064565b60405163095ea7b360e01b81529091506001600160a01b0388169063095ea7b39061439f908b90600090600401615367565b602060405180830381600087803b1580156143b957600080fd5b505af11580156143cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143f191906150e7565b50979650505050505050565b6060611564848460008561461c565b6001600160a01b0384166144515760405162461bcd60e51b8152600401808060200182810382526021815260200180615d3e6021913960400191505060405180910390fd5b600061445b61248b565b905061446d8160008761218688613b9c565b60008481526002602090815260408083206001600160a01b038916845290915290205461449a90846123f1565b60008581526002602090815260408083206001600160a01b03808b1680865291845282852095909555815189815292830188905281519094861692600080516020615aa083398151915292908290030190a461416481600087878787613be1565b6001600160a01b0383166145405760405162461bcd60e51b8152600401808060200182810382526023815260200180615c0c6023913960400191505060405180910390fd5b600061454a61248b565b905061457a8185600061455c87613b9c565b61456587613b9c565b60405180602001604052806000815250610fe5565b6145c182604051806060016040528060248152602001615b426024913960008681526002602090815260408083206001600160a01b038b1684529091529020549190612bdc565b60008481526002602090815260408083206001600160a01b03808a1680865291845282852095909555815188815292830187905281519394909390861692600080516020615aa083398151915292908290030190a450505050565b60608247101561465d5760405162461bcd60e51b8152600401808060200182810382526026815260200180615b8f6026913960400191505060405180910390fd5b6146668561416b565b6146b7576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106146f55780518252601f1990920191602091820191016146d6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614757576040519150601f19603f3d011682016040523d82523d6000602084013e61475c565b606091505b5091509150611f7a82828660608315614776575081610b70565b8251156147865782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315612c30578181015183820152602001612c18565b60405180610100016040528060006001600160a01b0316815260200160008152602001600060ff16815260200160006001600160a01b0316815260200160008152602001600060ff16815260200160008152602001600081525090565b5080546000825590600052602060002090810190610b03919061490f565b6040518060a0016040528060006001600160a01b0316815260200160008152602001600060ff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826148b957600085556148ff565b82601f106148d257805160ff19168380011785556148ff565b828001600101855582156148ff579182015b828111156148ff5782518255916020019190600101906148e4565b5061490b92915061490f565b5090565b5b8082111561490b5760008155600101614910565b60006001600160401b0383111561493757fe5b61494a601f8401601f1916602001615907565b905082815283838301111561495e57600080fd5b828260208301376000602084830101529392505050565b8035610737816159f1565b600082601f830112614990578081fd5b813560206149a56149a08361592a565b615907565b82815281810190858301838502870184018810156149c1578586fd5b855b858110156149e85781356149d6816159f1565b845292840192908401906001016149c3565b5090979650505050505050565b600082601f830112614a05578081fd5b81356020614a156149a08361592a565b8281528181019085830183850287018401881015614a31578586fd5b855b858110156149e857813584529284019290840190600101614a33565b803561073781615a06565b600082601f830112614a6a578081fd5b610b7083833560208501614924565b600060a08284031215614a8a578081fd5b60405160a081018181106001600160401b0382111715614aa657fe5b6040529050808235614ab7816159f1565b808252506020830135602082015260408301356040820152606083013560608201526080830135614ae781615a06565b6080919091015292915050565b803561073781615a14565b600060208284031215614b10578081fd5b8135610b70816159f1565b600060208284031215614b2c578081fd5b8151610b70816159f1565b60008060408385031215614b49578081fd5b8235614b54816159f1565b91506020830135614b64816159f1565b809150509250929050565b600080600080600060a08688031215614b86578081fd5b8535614b91816159f1565b94506020860135614ba1816159f1565b935060408601356001600160401b0380821115614bbc578283fd5b614bc889838a016149f5565b94506060880135915080821115614bdd578283fd5b614be989838a016149f5565b93506080880135915080821115614bfe578283fd5b50614c0b88828901614a5a565b9150509295509295909350565b600080600080600060a08688031215614c2f578283fd5b8535614c3a816159f1565b94506020860135614c4a816159f1565b9350604086013592506060860135915060808601356001600160401b03811115614c72578182fd5b614c0b88828901614a5a565b60008060408385031215614c90578182fd5b8235614c9b816159f1565b91506020830135614b6481615a06565b60008060008060008587036101a0811215614cc4578384fd5b8635614ccf816159f1565b9550610120601f198201811315614ce4578485fd5b614ced81615907565b9150614cfb60208901614975565b82526040880135602083015260608801356040830152614d1d60808901614a4f565b606083015260a0880135608083015260c088013560a083015260e088013560c08301526101008089013560e0840152614d57828a01614af4565b908301525093506101408601359250614d736101608701614975565b9150614d826101808701614af4565b90509295509295909350565b600080600060e08486031215614da2578081fd5b8335614dad816159f1565b9250614dbc8560208601614a79565b915060c0840135614dcc816159f1565b809150509250925092565b6000806000806101008587031215614ded578182fd5b8435614df8816159f1565b9350614e078660208701614a79565b925060c0850135614e17816159f1565b915060e0850135614e2781615a14565b939692955090935050565b60008060408385031215614e44578182fd5b8235614e4f816159f1565b946020939093013593505050565b600080600060608486031215614e71578081fd5b8335614e7c816159f1565b9250602084013591506040840135614dcc816159f1565b600080600060608486031215614ea7578081fd5b8335614eb2816159f1565b95602085013595506040909401359392505050565b60008060008060808587031215614edc578182fd5b8435614ee7816159f1565b935060208501359250604085013591506060850135614e27816159f1565b600080600080600080600060e0888a031215614f1f578485fd5b8735614f2a816159f1565b965060208801359550604088013594506060880135614f48816159f1565b93506080880135614f58816159f1565b925060a0880135915060c08801356001600160401b03811115614f79578182fd5b614f858a828b01614980565b91505092959891949750929550565b60008060008060808587031215614fa9578182fd5b8435614fb4816159f1565b935060208501359250604085013591506060850135614e2781615a06565b600060208284031215614fe3578081fd5b81356001600160401b03811115614ff8578182fd5b61156484828501614980565b60008060408385031215615016578182fd5b82356001600160401b038082111561502c578384fd5b61503886838701614980565b9350602085013591508082111561504d578283fd5b5061505a858286016149f5565b9150509250929050565b60006020808385031215615076578182fd5b82516001600160401b0381111561508b578283fd5b8301601f8101851361509b578283fd5b80516150a96149a08261592a565b81815283810190838501858402850186018910156150c5578687fd5b8694505b838510156143f15780518352600194909401939185019185016150c9565b6000602082840312156150f8578081fd5b8151610b7081615a06565b600060208284031215615114578081fd5b81356001600160e01b031981168114610b70578182fd5b60006020828403121561513c578081fd5b81356001600160401b03811115615151578182fd5b8201601f81018413615161578182fd5b61156484823560208401614924565b60008060c08385031215615182578182fd5b61518c8484614a79565b915060a0830135614b64816159f1565b6000602082840312156151ad578081fd5b5035919050565b6000602082840312156151c5578081fd5b5051919050565b600080604083850312156151de578182fd5b50508035926020909101359150565b600080604083850312156151ff578182fd5b505080516020909101519092909150565b600080600060608486031215615224578081fd5b83359250602084013591506040840135614dcc816159f1565b60008060008060008060c08789031215615255578384fd5b8635955060208701359450604087013561526e816159f1565b9350606087013561527e816159f1565b92506080870135915060a08701356001600160401b0381111561529f578182fd5b6152ab89828a01614980565b9150509295509295509295565b6000602082840312156152c9578081fd5b8151610b7081615a14565b600581106152de57fe5b9052565b6001600160a01b0391909116815260200190565b6001600160a01b0385168152831515602082015260408101839052608081016111af60608301846152d4565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039485168152929093166020830152604082015260ff909116606082015260800190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03999099168952602089019790975260408801959095529215156060870152608086019190915260a085015260c084015260e083015260ff166101008201526101200190565b6020808252825182820181905260009190848201906040850190845b818110156154265783518352928401929184019160010161540a565b50909695505050505050565b901515815260200190565b6000602080835283518082850152825b818110156154695785810183015185820160400152820161544d565b8181111561547a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600f908201526e15dc9bdb99c819195b9bdb4818985b608a1b604082015260600190565b6020808252601190820152704e6f7420656e6f75676820636c61696d7360781b604082015260600190565b6020808252600b908201526a0416d6f756e74203c3d20360ac1b604082015260600190565b6020808252600b908201526a0537472696b65203c3d20360ac1b604082015260600190565b6020808252601290820152714e6f206f7074696f6e20746f20636c61696d60701b604082015260600190565b6020808252601190820152702bb937b7339039ba3934b5b29034b731b960791b604082015260600190565b602080825260169082015275149bdd5d195c881b9bdd081dda1a5d195b1a5cdd195960521b604082015260600190565b6020808252600f908201526e15dc9bdb99c81d1bdad95b8818985b608a1b604082015260600190565b6020808252601490820152734e6f7420656e6f75676820636c61696d61626c6560601b604082015260600190565b6020808252601290820152714661696c656420746f20706179206261636b60701b604082015260600190565b6020808252600c908201526b139bdd08185c1c1c9bdd995960a21b604082015260600190565b6020808252600a9082015269115e1c081c185cdcd95960b21b604082015260600190565b6020808252600b908201526a139bdd08195e1c1a5c995960aa1b604082015260600190565b602080825260139082015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604082015260600190565b60208082526014908201527321b0b73a1030b232103232b737b6b4b730ba37b960611b604082015260600190565b6020808252601290820152712737ba1032b737bab3b4103bb934ba3a32b760711b604082015260600190565b6020808252600a908201526922bc38101f1018903cb960b11b604082015260600190565b6020808252600e908201526d2bb937b7339032bc381034b731b960911b604082015260600190565b602080825260119082015270546f6f206d616e7920646563696d616c7360781b604082015260600190565b602080825260079082015266115e1c1a5c995960ca1b604082015260600190565b60006101008201905060018060a01b038084511683526020840151602084015260ff6040850151166040840152806060850151166060840152506080830151608083015260ff60a08401511660a083015260c083015160c083015260e083015160e083015292915050565b81516001600160a01b031681526020808301519082015260408083015160ff1690820152606080830151908201526080918201519181019190915260a00190565b90815260200190565b918252602082015260400190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156158d85784516001600160a01b0316835293830193918301916001016158b3565b50506001600160a01b03969096166060850152505050608001529392505050565b60ff91909116815260200190565b6040518181016001600160401b038111828210171561592257fe5b604052919050565b60006001600160401b0382111561593d57fe5b5060209081020190565b60e01c90565b600060443d101561595d5761152e565b600481823e6308c379a06159718251615947565b1461597b5761152e565b6040513d600319016004823e80513d6001600160401b0381602484011181841117156159aa575050505061152e565b828401925082519150808211156159c4575050505061152e565b503d830160208284010111156159dc5750505061152e565b601f01601f1916810160200160405291505090565b6001600160a01b0381168114610b0357600080fd5b8015158114610b0357600080fd5b60ff81168114610b0357600080fdfe455243313135353a207472616e7366657220746f206e6f6e2045524331313535526563656976657220696d706c656d656e746572455243313135353a204552433131353552656365697665722072656a656374656420746f6b656e735265656e7472616e637947756172643a207265656e7472616e742063616c6c00c3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62455243313135353a2062616c616e636520717565727920666f7220746865207a65726f2061646472657373455243313135353a2062617463682062616c616e636520717565727920666f7220746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373455243313135353a206275726e20616d6f756e7420657863656564732062616c616e6365455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c455243313135353a207472616e7366657220746f20746865207a65726f2061646472657373455243313135353a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243313135353a206275726e2066726f6d20746865207a65726f2061646472657373455243313135353a20696e73756666696369656e742062616c616e636520666f72207472616e73666572536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572455243313135353a2073657474696e6720617070726f76616c2073746174757320666f722073656c665361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564455243313135353a206163636f756e747320616e6420696473206c656e677468206d69736d61746368455243313135353a2069647320616e6420616d6f756e7473206c656e677468206d69736d61746368455243313135353a206d696e7420746f20746865207a65726f2061646472657373a2646970667358221220a7dec1e778243144adf635499a9b7533cc8e28e23737195947d79616963e14d364736f6c63430007060033

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

00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000008406c6c1db4d224c8b0cf7859c0881ddd68d4761000000000000000000000000602b50091b0b351ca179e87ad6e006aeceb2a6ad000000000000000000000000afcf4ca5826ed76189ea227bd863916abf43a6da000000000000000000000000c22fae86443aeed038a4ed887bba8f5035fd12f0000000000000000000000000000000000000000000000000000000000000002868747470733a2f2f7072656d69612e66696e616e63652f6170692f6461692f7b69647d2e6a736f6e000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _uri (string): https://premia.finance/api/dai/{id}.json
Arg [1] : _denominator (address): 0x6B175474E89094C44Da98b954EedeAC495271d0F
Arg [2] : _uPremia (address): 0x8406C6C1DB4D224C8B0cF7859c0881Ddd68D4761
Arg [3] : _feeCalculator (address): 0x602B50091B0B351CA179E87aD6e006AeCEB2a6Ad
Arg [4] : _premiaReferral (address): 0xaFcF4ca5826eD76189eA227bd863916ABf43a6Da
Arg [5] : _feeRecipient (address): 0xc22FAe86443aEed038A4ED887bbA8F5035FD12F0

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f
Arg [2] : 0000000000000000000000008406c6c1db4d224c8b0cf7859c0881ddd68d4761
Arg [3] : 000000000000000000000000602b50091b0b351ca179e87ad6e006aeceb2a6ad
Arg [4] : 000000000000000000000000afcf4ca5826ed76189ea227bd863916abf43a6da
Arg [5] : 000000000000000000000000c22fae86443aeed038a4ed887bba8f5035fd12f0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [7] : 68747470733a2f2f7072656d69612e66696e616e63652f6170692f6461692f7b
Arg [8] : 69647d2e6a736f6e000000000000000000000000000000000000000000000000


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

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