POL Price: $0.436177 (+0.69%)
Gas: 31 GWei
 

Overview

Max Total Supply

30 MATIC-ATLANTIC-STRADDLE-V2

Holders

26

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
0 MATIC-ATLANTIC-STRADDLE-V2
0x193db18a5ef9a0320b7374c1fe8af976235f3211
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
AtlanticStraddleV2

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license
File 1 of 27 : AtlanticStraddleV2.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;

// Libraries
import {Counters} from "@openzeppelin/contracts/utils/Counters.sol";
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {ERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

// Contracts
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {ContractWhitelist} from "./helpers/ContractWhitelist.sol";

// Interfaces
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IOptionPricing} from "./interface/IOptionPricing.sol";
import {IPriceOracle} from "./interface/IPriceOracle.sol";
import {IVolatilityOracle} from "./interface/IVolatilityOracle.sol";
import {I1inchRouterV5} from "./interface/I1inchRouterV5.sol";
import {IRewardDistributor} from "./reward-distributor/IRewardDistributor.sol";

/// @title Atlantic Straddles V2
/// @author Dopex
/// @notice - Accept stable deposits
/// - Deposits during an epoch will be for the next epoch
/// - Stables are used as collateral to sell ATM put options for the underlying
/// - n day epochs, deposits auto-rollover unless deactivated
/// - Withdrawal considers performance of pool since deposit
/// - On purchase of an Atlantic straddle, use 50% of the collateral locked in the PUT to purchase underlying asset
/// - At expiry, settle by selling purchased underlying asset to return AP collateral
contract AtlanticStraddleV2 is
    ReentrancyGuard,
    ERC721,
    ERC721Enumerable,
    AccessControl,
    Pausable,
    ContractWhitelist
{
    using SafeERC20 for IERC20;
    using Counters for Counters.Counter;

    /// @dev Token ID counter for write positions
    Counters.Counter private _tokenIdCounter;

    /// @dev Current epoch. 0-indexed
    uint256 public currentEpoch;

    /// @dev Managar Role
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

    /// @dev Contract addresses
    Addresses public addresses;

    /// @dev Data for epoch (epoch => EpochData)
    mapping(uint256 => EpochData) public epochData;

    /// @dev Checks for epoch (epoch => EpochStatus)
    mapping(uint256 => EpochStatus) public epochStatus;

    /// @dev Write positions (tokenId => WritePosition)
    mapping(uint256 => WritePosition) public writePositions;

    /// @dev Straddle positions (tokenId => StraddlePosition)
    mapping(uint256 => StraddlePosition) public straddlePositions;

    /// @dev Percentage precision
    uint256 public constant PERCENT_PRECISION = 1e6;

    /// @dev USDC decimals
    uint256 public constant USDC_DECIMALS = 1e6;

    /// @dev Min purchase 0.01 to prevent spam
    uint256 public constant MIN_PURCHASE_AMOUNT = 1e16;

    /// @dev Min deposit amount 1 usd to prevent spam
    uint256 public constant MIN_DEPOSIT_AMOUNT = USDC_DECIMALS;

    /// @dev Seconds a year
    uint256 public constant SECONDS_A_YEAR = 365 days;

    /// @dev The decimal precision for amount of options * strike price (or price)
    uint256 public constant AMOUNT_PRICE_TO_USDC_DECIMALS = (1e18 * 1e8) / 1e6;

    /// @dev Vault variables
    VaultVariables public vaultVariables =
        VaultVariables({
            purchaseFeePercent: 15e4,
            settlementFeePercent: 1e5,
            delegationFeePercent: PERCENT_PRECISION / 10,
            maxDelegationFee: USDC_DECIMALS,
            apFundingPercent: 36 * PERCENT_PRECISION,
            pnlSlippagePercent: 5e5,
            maxPriceImpact: 200,
            blackoutPeriodBeforeExpiry: 4 hours
        });

    enum EpochStatus {
        NOT_READY,
        READY,
        EXPIRED,
        PREEXPIRED
    }

    struct VaultVariables {
        /// @dev Purchase fee percent
        uint256 purchaseFeePercent;
        /// @dev Settlement fee percent
        uint256 settlementFeePercent;
        /// @dev Fee percent charged to owner for rollover or settle delegation
        uint256 delegationFeePercent;
        /// @dev Max delegation fee
        uint256 maxDelegationFee;
        /// @dev AP funding percent
        uint256 apFundingPercent;
        /// @dev PnL slippage percent
        uint256 pnlSlippagePercent;
        /// @dev Max. price impact (bps)
        uint256 maxPriceImpact;
        /// @dev Purchase time limit variable to prevent last min buyouts
        uint256 blackoutPeriodBeforeExpiry;
    }

    struct Addresses {
        // USDC token (1e6 precision)
        address usd;
        // Underlying token
        address underlying;
        // Price Oracle
        address priceOracle;
        // Volatility Oracle
        address volatilityOracle;
        // Option Pricing
        address optionPricing;
        // Fee Distributor
        address feeDistributor;
        // 1inch Router
        address aggregationRouterV5;
        // Reward Distributor
        address rewardDistributor;
    }

    struct EpochData {
        // Start time
        uint256 startTime;
        // Expiry time
        uint256 expiry;
        // Total USD deposits
        uint256 usdDeposits;
        // Active USD deposits (used for writing)
        uint256 activeUsdDeposits;
        // Settlement Price
        uint256 settlementPrice;
        // Amount of underlying swapped during preExpire
        uint256 underlyingSwapped;
        // Amount of underlying assets purchased
        uint256 underlyingPurchased;
        // Total premiums collected for USD deposits
        uint256 usdPremiums;
        // Total funding collected for USD deposits
        uint256 usdFunding;
        // Total amount of straddles sold
        uint256 totalSold;
        // Number of "live" straddles per epoch
        uint256 straddleCounter;
        // Final usd balance before withdraw
        uint256 finalUsdBalanceBeforeWithdraw;
    }

    struct WritePosition {
        // Epoch #
        uint256 epoch;
        // USD deposits
        uint256 usdDeposit;
        // Whether deposit should be rolled over to the next epoch
        bool rollover;
    }

    struct StraddlePosition {
        // Epoch #
        uint256 epoch;
        // Amount
        uint256 amount;
        // AP Strike
        uint256 apStrike;
        // Underlying purchased for this straddle
        uint256 underlyingPurchased;
    }

    struct PurchaseParams {
        // Swap id
        uint256 swapId;
        // Unoswap params 0
        I1inchRouterV5.UnoswapParams unoswapParams;
        // UniswapV3 params 1
        I1inchRouterV5.UniswapV3Params uniswapV3Params;
        // Swap params 2
        I1inchRouterV5.SwapParams swapParams;
    }

    event Bootstrap(uint256 epoch);

    event Deposit(
        uint256 epoch,
        uint256 amount,
        bool rollover,
        address user,
        address sender,
        uint256 tokenId
    );

    event Purchase(
        uint256 epoch,
        address user,
        uint256 straddleId,
        uint256 cost
    );

    event Settle(
        uint256 epoch,
        address indexed sender,
        address indexed owner,
        uint256 id,
        uint256 pnl
    );

    event Withdraw(
        uint256 epoch,
        address indexed sender,
        uint256 id,
        uint256 pnl
    );

    event ToggleRollover(uint256 id, bool rollover);

    event EpochExpired(address caller);

    event EpochPreExpired(address caller);

    event SetAddresses(Addresses addresses);

    event SetVaultVariables(VaultVariables vaultVariables);

    event SetRouterAllowance(address token, uint256 value, bool increase);

    error DopexError(uint256 errorCode);

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

    constructor(string memory _name, string memory _symbol)
        ERC721(_name, _symbol)
    {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(MANAGER_ROLE, msg.sender);
    }

    /*==== USER METHODS ====*/

    /// @dev Deposit for next epoch
    /// @param amount Amount to deposit
    /// @param shouldRollover Should the deposit be rolled over
    /// @param user User address
    /// @return tokenId Write position token ID
    function deposit(
        uint256 amount,
        bool shouldRollover,
        address user
    ) external whenNotPaused nonReentrant returns (uint256 tokenId) {
        _isEligibleSender();
        _validate(amount > MIN_DEPOSIT_AMOUNT, 0);

        uint256 nextEpoch = currentEpoch + 1;

        epochData[nextEpoch].usdDeposits += amount;
        epochData[nextEpoch].finalUsdBalanceBeforeWithdraw += amount;

        tokenId = _mintPositionToken(user);

        writePositions[tokenId] = WritePosition({
            epoch: nextEpoch,
            usdDeposit: amount,
            rollover: shouldRollover
        });

        IERC20(addresses.usd).safeTransferFrom(
            msg.sender,
            address(this),
            amount
        );

        emit Deposit(
            nextEpoch,
            amount,
            shouldRollover,
            user,
            msg.sender,
            tokenId
        );
    }

    /// @dev Rolls over a deposit to the next epoch. Anyone can call this for write positions with `rollover` enabled
    /// Call this prior to bootstrapping to a new epoch or it will roll over to epoch n + 2
    /// @param id Write position token ID
    /// @return tokenId Rolled over write position token ID
    function rollover(uint256 id)
        public
        whenNotPaused
        nonReentrant
        returns (uint256 tokenId)
    {
        _isEligibleSender();
        WritePosition memory writePos = writePositions[id];

        _validate(writePos.rollover, 1);
        _validate(writePos.epoch != 0, 2);
        _validate(epochStatus[writePos.epoch] == EpochStatus.EXPIRED, 3);

        uint256 depositPlusPnl = calculateWritePositionPnl(id);

        address user = ownerOf(id);

        IRewardDistributor(addresses.rewardDistributor).claim(id);

        _burn(id);

        _validate(depositPlusPnl != 0, 4);

        uint256 delegationFee;

        // If the owner of the position is not the sender, collect rollover delegation fees
        if (user != msg.sender) {
            delegationFee =
                (depositPlusPnl * vaultVariables.delegationFeePercent) /
                (PERCENT_PRECISION * 100);
            delegationFee = Math.min(
                delegationFee,
                vaultVariables.maxDelegationFee
            );
        }

        depositPlusPnl -= delegationFee;

        emit Withdraw(writePos.epoch, user, id, depositPlusPnl);

        uint256 nextEpoch = currentEpoch + 1;

        epochData[nextEpoch].usdDeposits += depositPlusPnl;
        epochData[nextEpoch].finalUsdBalanceBeforeWithdraw += depositPlusPnl;

        tokenId = _mintPositionToken(user);

        writePositions[tokenId] = WritePosition({
            epoch: nextEpoch,
            usdDeposit: depositPlusPnl,
            rollover: true
        });

        IERC20(addresses.usd).safeTransfer(msg.sender, delegationFee);

        emit Deposit(nextEpoch, depositPlusPnl, true, user, user, tokenId);
    }

    /// @dev Rollover for multiple ids
    /// @param ids Write position token IDs
    /// @return tokenIds Rolled over write position token IDs
    function multirollover(uint256[] memory ids)
        external
        returns (uint256[] memory tokenIds)
    {
        uint256 idsLength = ids.length;
        tokenIds = new uint256[](idsLength);
        for (uint256 i; i < idsLength; ) {
            tokenIds[i] = rollover(ids[i]);

            unchecked {
                ++i;
            }
        }
    }

    /// @dev Toggle rollover for a write position
    /// @param id Write position token ID
    function toggleRollover(uint256 id) external whenNotPaused nonReentrant {
        _isEligibleSender();
        _validate(ownerOf(id) == msg.sender, 5);
        _validate(writePositions[id].epoch != 0, 2);
        writePositions[id].rollover = !writePositions[id].rollover;
        emit ToggleRollover(id, writePositions[id].rollover);
    }

    /// @dev Withdraw write positions after strikes are settled
    /// @param id ID of write position
    /// @return writePositionPnl of write position
    function withdraw(uint256 id)
        external
        whenNotPaused
        nonReentrant
        returns (uint256 writePositionPnl)
    {
        _isEligibleSender();
        _validate(ownerOf(id) == msg.sender, 5);

        WritePosition memory writePos = writePositions[id];

        _validate(writePos.epoch != 0, 2);
        _validate(epochStatus[writePos.epoch] == EpochStatus.EXPIRED, 3);

        writePositionPnl = calculateWritePositionPnl(id);

        // Call claim on reward distributor before burning the token
        IRewardDistributor(addresses.rewardDistributor).claim(id);

        _burn(id);

        _validate(writePositionPnl != 0, 4);

        IERC20(addresses.usd).safeTransfer(msg.sender, writePositionPnl);

        emit Withdraw(writePos.epoch, msg.sender, id, writePositionPnl);
    }

    /// @dev Purchase a straddle
    /// @param amount Approx. amount of straddles to purchase (10 ** 18)
    /// @param minAmountOut Min amount out for the underlying purchased
    /// @param user Address to purchase straddles for
    /// @param purchaseParams 1inch params
    /// @return tokenId Straddle position token ID
    function purchase(
        uint256 amount,
        uint256 minAmountOut,
        address user,
        PurchaseParams calldata purchaseParams
    )
        external
        whenNotPaused
        nonReentrant
        returns (
            uint256 tokenId,
            uint256 protocolFee,
            uint256 straddleCost
        )
    {
        _isEligibleSender();
        _validate(currentEpoch > 0, 6);
        _validate(amount > MIN_PURCHASE_AMOUNT, 0);
        _validate(
            block.timestamp <
                epochData[currentEpoch].expiry -
                    vaultVariables.blackoutPeriodBeforeExpiry,
            7
        );

        uint256 currentPrice = getUnderlyingPrice();

        _validate(
            epochData[currentEpoch].usdDeposits -
                (epochData[currentEpoch].activeUsdDeposits /
                    AMOUNT_PRICE_TO_USDC_DECIMALS) >=
                (currentPrice * amount) / AMOUNT_PRICE_TO_USDC_DECIMALS,
            8
        );

        // Swap half of AP to underlying
        uint256 underlyingPurchased = _swapToUnderlying(
            ((currentPrice * amount) / 2) / AMOUNT_PRICE_TO_USDC_DECIMALS,
            purchaseParams
        );

        _validate(underlyingPurchased >= minAmountOut, 9);

        uint256 swapPrice = (currentPrice * amount) / (underlyingPurchased * 2);

        _checkPriceImpact(swapPrice, currentPrice);

        epochData[currentEpoch].underlyingPurchased += underlyingPurchased;

        // Deposits
        epochData[currentEpoch].activeUsdDeposits +=
            swapPrice *
            (underlyingPurchased * 2);

        uint256 apPremium = calculatePremium(
            true,
            swapPrice,
            swapPrice,
            underlyingPurchased * 2,
            epochData[currentEpoch].expiry
        );

        uint256 apFunding = calculateApFunding(
            swapPrice,
            underlyingPurchased * 2,
            epochData[currentEpoch].expiry - block.timestamp
        );

        // Collections
        epochData[currentEpoch].usdPremiums += apPremium;
        epochData[currentEpoch].usdFunding += apFunding;
        epochData[currentEpoch].totalSold += underlyingPurchased * 2;
        epochData[currentEpoch].straddleCounter += 1;

        // Mint straddle position token
        tokenId = _mintPositionToken(user);
        straddlePositions[tokenId] = StraddlePosition({
            epoch: currentEpoch,
            amount: underlyingPurchased * 2,
            apStrike: swapPrice,
            underlyingPurchased: underlyingPurchased
        });

        protocolFee =
            (amount * currentPrice * vaultVariables.purchaseFeePercent) /
            (PERCENT_PRECISION * AMOUNT_PRICE_TO_USDC_DECIMALS * 100);

        straddleCost = ((apPremium + apFunding) /
            AMOUNT_PRICE_TO_USDC_DECIMALS);

        // 1inch swap from tokenIn to USD if tokenIn != USD
        IERC20(addresses.usd).safeTransferFrom(
            msg.sender,
            address(this),
            straddleCost + protocolFee
        );

        IERC20(addresses.usd).safeTransfer(
            addresses.feeDistributor,
            protocolFee
        );

        epochData[currentEpoch].finalUsdBalanceBeforeWithdraw += ((apPremium +
            apFunding) / AMOUNT_PRICE_TO_USDC_DECIMALS);

        emit Purchase(currentEpoch, user, tokenId, apPremium + apFunding);
    }

    /// @dev Settles a purchased option
    /// @param id ID of straddle position
    function settle(uint256 id)
        public
        whenNotPaused
        nonReentrant
        returns (uint256)
    {
        _isEligibleSender();

        StraddlePosition memory sp = straddlePositions[id];
        _validate(sp.epoch != 0, 2);
        _validate(epochStatus[sp.epoch] == EpochStatus.PREEXPIRED, 10);

        uint256 buyerPnl = calculateStraddlePositionPnl(id);
        address owner = ownerOf(id);

        _burn(id);

        _validate(buyerPnl != 0, 11);

        uint256 protocolFee = (buyerPnl * vaultVariables.settlementFeePercent) /
            (PERCENT_PRECISION * 100);
        uint256 delegationFee;

        // If owner did not settle, collect settlement fees
        if (owner != msg.sender) {
            delegationFee =
                (buyerPnl * vaultVariables.delegationFeePercent) /
                (PERCENT_PRECISION * 100);
            delegationFee = Math.min(
                delegationFee,
                vaultVariables.maxDelegationFee
            );
        }

        buyerPnl -= (protocolFee + delegationFee);

        epochData[sp.epoch].straddleCounter -= 1;
        epochData[sp.epoch].finalUsdBalanceBeforeWithdraw -= (buyerPnl +
            protocolFee +
            delegationFee);

        IERC20(addresses.usd).safeTransfer(
            addresses.feeDistributor,
            protocolFee
        );
        IERC20(addresses.usd).safeTransfer(owner, buyerPnl);
        IERC20(addresses.usd).safeTransfer(msg.sender, delegationFee);

        emit Settle(sp.epoch, msg.sender, owner, id, buyerPnl);

        return buyerPnl;
    }

    /// @dev Settle for multiple ids
    /// @param ids Straddle position token IDs
    /// @return pnls pnls
    function multisettle(uint256[] memory ids)
        external
        returns (uint256[] memory pnls)
    {
        uint256 idsLength = ids.length;
        pnls = new uint256[](idsLength);

        for (uint256 i; i < idsLength; ) {
            pnls[i] = settle(ids[i]);

            unchecked {
                ++i;
            }
        }
    }

    /*==== INTERNAL METHODS ====*/

    /// @dev Internal function to mint a write position token
    /// @param to the address to mint the position to
    function _mintPositionToken(address to) internal returns (uint256 tokenId) {
        tokenId = _tokenIdCounter.current();
        _tokenIdCounter.increment();
        _safeMint(to, tokenId);
    }

    /// @dev Internal function to ensure price impact is acceptable and 1inch paths are legit
    /// @param swapPrice Price obtained executing the swap
    /// @param currentPrice Price retrieved from the oracle
    function _checkPriceImpact(uint256 swapPrice, uint256 currentPrice)
        internal
        view
    {
        uint256 spread = swapPrice > currentPrice
            ? swapPrice - currentPrice
            : currentPrice - swapPrice;
        _validate(
            ((spread * (PERCENT_PRECISION / 100)) / currentPrice) <
                vaultVariables.maxPriceImpact,
            12
        );
    }

    /// @dev Internal function to execute 1inch swap
    /// @param amount Amount to swap
    /// @param purchaseParams 1inch purchase params
    function _swap(uint256 amount, PurchaseParams memory purchaseParams)
        internal
    {
        if (purchaseParams.swapId == 0)
            I1inchRouterV5(addresses.aggregationRouterV5).unoswap(
                purchaseParams.unoswapParams.srcToken,
                amount,
                purchaseParams.unoswapParams.minReturn,
                purchaseParams.unoswapParams.pools
            );
        else if (purchaseParams.swapId == 1)
            I1inchRouterV5(addresses.aggregationRouterV5).uniswapV3Swap(
                amount,
                purchaseParams.uniswapV3Params.minReturn,
                purchaseParams.uniswapV3Params.pools
            );
        else if (purchaseParams.swapId == 2) {
            purchaseParams.swapParams.desc.amount = amount;
            I1inchRouterV5(addresses.aggregationRouterV5).swap(
                purchaseParams.swapParams.executor,
                purchaseParams.swapParams.desc,
                purchaseParams.swapParams.permit,
                purchaseParams.swapParams.data
            );
        }
    }

    /// @dev Internal function to swap USD to underlying tokens
    /// @param usdToSwapToUnderlying Amount of USD to swap
    /// @param purchaseParams 1inch purchase params
    function _swapToUnderlying(
        uint256 usdToSwapToUnderlying,
        PurchaseParams calldata purchaseParams
    ) internal returns (uint256 underlyingPurchased) {
        uint256 underlyingBalance = IERC20(addresses.underlying).balanceOf(
            address(this)
        );
        uint256 usdBalance = IERC20(addresses.usd).balanceOf(address(this));

        _swap(usdToSwapToUnderlying, purchaseParams);

        uint256 usdSwappedToUnderlying = usdBalance -
            IERC20(addresses.usd).balanceOf(address(this));

        underlyingPurchased =
            IERC20(addresses.underlying).balanceOf(address(this)) -
            underlyingBalance;

        _validate(usdToSwapToUnderlying == usdSwappedToUnderlying, 13);

        epochData[currentEpoch]
            .finalUsdBalanceBeforeWithdraw -= usdSwappedToUnderlying;
    }

    /// @dev Internal function to swap underlying tokens to USD
    /// @param underlyingToSwapToUsd Amount of underlying to swap
    /// @param purchaseParams 1inch purchase params
    function _swapFromUnderlying(
        uint256 underlyingToSwapToUsd,
        PurchaseParams calldata purchaseParams
    ) internal returns (uint256 usdObtained) {
        uint256 usdBalance = IERC20(addresses.usd).balanceOf(address(this));

        _swap(underlyingToSwapToUsd, purchaseParams);

        usdObtained =
            IERC20(addresses.usd).balanceOf(address(this)) -
            usdBalance;
    }

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

    /// @notice Returns the price of the underlying in USD in 1e8 precision
    function getUnderlyingPrice() public view returns (uint256) {
        return IPriceOracle(addresses.priceOracle).getUnderlyingPrice();
    }

    /// @notice Returns the volatility from the volatility oracle
    /// @param _strike Strike of the option
    function getVolatility(uint256 _strike) public view returns (uint256) {
        return
            IVolatilityOracle(addresses.volatilityOracle).getVolatility(
                _strike
            );
    }

    /// @notice Calculate premium for an option
    /// @param _isPut Is put option
    /// @param _price Price of the underlying
    /// @param _strike Strike price of the option
    /// @param _amount Amount of options (1e18 precision)
    /// @param _expiry Expiry of the option
    /// @return premium in USD
    function calculatePremium(
        bool _isPut,
        uint256 _price,
        uint256 _strike,
        uint256 _amount,
        uint256 _expiry
    ) public view returns (uint256 premium) {
        premium = (IOptionPricing(addresses.optionPricing).getOptionPrice(
            _isPut,
            _expiry,
            _strike,
            _price,
            getVolatility(_strike)
        ) * _amount);
    }

    /// @notice Calculate premium for an option
    /// @param _price Price of the asset
    /// @param _amount Amount of options (1e18 precision)
    /// @param _timeToExpiry Time to expiry
    function calculateApFunding(
        uint256 _price,
        uint256 _amount,
        uint256 _timeToExpiry
    ) public view returns (uint256 funding) {
        funding =
            (((_price *
                vaultVariables.apFundingPercent *
                _timeToExpiry *
                _amount) / (SECONDS_A_YEAR * PERCENT_PRECISION)) / 100) /
            2;
    }

    /// @notice Calculates the writer position pnl
    /// @param id the id of the write position
    /// @return writePositionPnl
    function calculateWritePositionPnl(uint256 id)
        public
        view
        returns (uint256 writePositionPnl)
    {
        WritePosition memory writePos = writePositions[id];
        _validate(writePos.epoch != 0, 2);

        writePositionPnl =
            (writePos.usdDeposit *
                epochData[writePos.epoch].finalUsdBalanceBeforeWithdraw) /
            epochData[writePos.epoch].usdDeposits;
    }

    /// @param id ID of straddle position
    /// @return buyerPnl positive pnl of buyer
    function calculateStraddlePositionPnl(uint256 id)
        public
        view
        returns (uint256 buyerPnl)
    {
        StraddlePosition memory sp = straddlePositions[id];

        _validate(sp.epoch != 0, 2);

        uint256 settlementPrice = epochData[sp.epoch].settlementPrice;
        uint256 strikePrice = sp.apStrike;

        // straddle pnl = max(K - S, 0) + 0.5 * (S - K)
        // if K > S, get (K - S) - 0.5 * (K - S)
        if (strikePrice > settlementPrice) {
            buyerPnl = (strikePrice - settlementPrice) * sp.amount;
            buyerPnl -=
                (strikePrice - settlementPrice) *
                sp.underlyingPurchased;
        } else {
            // else get 0 + 0.5 * (S - K)
            buyerPnl +=
                (settlementPrice - strikePrice) *
                sp.underlyingPurchased;
        }

        buyerPnl /= AMOUNT_PRICE_TO_USDC_DECIMALS;
        buyerPnl -=
            (buyerPnl * vaultVariables.pnlSlippagePercent) /
            (100 * PERCENT_PRECISION);
    }

    /// @notice Returns the tokenIds owned by a wallet (writePositions)
    /// @param owner wallet owner
    function writePositionsOfOwner(address owner)
        public
        view
        returns (uint256[] memory tokenIds)
    {
        uint256 ownerTokenCount = balanceOf(owner);
        uint256 count;

        for (uint256 i; i < ownerTokenCount; ) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, i);
            if (writePositions[tokenId].epoch != 0) {
                ++count;
            }

            unchecked {
                ++i;
            }
        }

        tokenIds = new uint256[](count);
        uint256 start;
        uint256 idx;

        while (start < count) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, idx);
            if (writePositions[tokenId].epoch != 0) {
                tokenIds[start] = tokenId;
                ++start;
            }
            ++idx;
        }
    }

    /// @notice Returns the tokenIds owned by a wallet (straddlePositions)
    /// @param owner wallet owner
    function straddlePositionsOfOwner(address owner)
        public
        view
        returns (uint256[] memory tokenIds)
    {
        uint256 ownerTokenCount = balanceOf(owner);
        uint256 count;

        for (uint256 i; i < ownerTokenCount; ) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, i);
            if (straddlePositions[tokenId].epoch != 0) {
                ++count;
            }

            unchecked {
                ++i;
            }
        }

        tokenIds = new uint256[](count);
        uint256 start;
        uint256 idx;

        while (start < count) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, idx);
            if (straddlePositions[tokenId].epoch != 0) {
                tokenIds[start] = tokenId;
                ++start;
            }
            ++idx;
        }
    }

    /*==== MANAGER METHODS ====*/

    /// @dev Bootstrap and start the next epoch for purchases
    /// @param expiry Expiry
    function bootstrap(uint256 expiry)
        external
        whenNotPaused
        onlyRole(MANAGER_ROLE)
        returns (bool)
    {
        uint256 nextEpoch = currentEpoch + 1;
        _validate(block.timestamp < expiry, 14);
        _validate(epochStatus[nextEpoch] == EpochStatus.NOT_READY, 15);
        if (currentEpoch > 0) {
            _validate(epochStatus[currentEpoch] == EpochStatus.EXPIRED, 16);
        }

        // Set expiry in epoch data
        epochData[nextEpoch].startTime = block.timestamp;
        epochData[nextEpoch].expiry = expiry;
        // Mark vault as ready for epoch
        epochStatus[nextEpoch] = EpochStatus.READY;
        // Increase the current epoch
        currentEpoch = nextEpoch;

        IRewardDistributor(addresses.rewardDistributor).bootstrap(nextEpoch);

        emit Bootstrap(nextEpoch);

        return true;
    }

    /// @dev Swap a certain percentage of total purchased underlying
    /// @param underlyingToSwapToUsd Amount of underlying to swap
    /// @param minAmountOut the min amount out
    /// @param purchaseParams 1inch params
    function preExpireEpoch(
        uint256 underlyingToSwapToUsd,
        uint256 minAmountOut,
        PurchaseParams calldata purchaseParams
    )
        external
        whenNotPaused
        onlyRole(MANAGER_ROLE)
        returns (uint256 usdObtained)
    {
        EpochData memory data = epochData[currentEpoch];
        _validate(block.timestamp >= data.expiry, 17);
        _validate(epochStatus[currentEpoch] == EpochStatus.READY, 18);

        uint256 normalizedSettlementPrice;

        if (data.underlyingPurchased > 0) {
            usdObtained = _swapFromUnderlying(
                underlyingToSwapToUsd,
                purchaseParams
            );
            
            uint256 currentPrice = getUnderlyingPrice();
            uint256 swapPrice = (10 ** 2) * (usdObtained * 10 ** 18) / underlyingToSwapToUsd;

            _checkPriceImpact(swapPrice, currentPrice);

            _validate(usdObtained >= minAmountOut, 19);

            _validate(
                data.underlyingSwapped + underlyingToSwapToUsd <=
                    data.underlyingPurchased,
                20
            );

            epochData[currentEpoch]
                .finalUsdBalanceBeforeWithdraw += usdObtained;

            uint256 settlementPrice = (usdObtained *
                AMOUNT_PRICE_TO_USDC_DECIMALS) / underlyingToSwapToUsd;

            normalizedSettlementPrice =
                ((data.settlementPrice * data.underlyingSwapped) +
                    (settlementPrice * underlyingToSwapToUsd)) /
                (data.underlyingSwapped + underlyingToSwapToUsd);

            epochData[currentEpoch].underlyingSwapped += underlyingToSwapToUsd;
        } else {
            normalizedSettlementPrice = getUnderlyingPrice();
        }

        if (epochData[currentEpoch].settlementPrice == 0) {
            epochData[currentEpoch].settlementPrice = normalizedSettlementPrice;
        } else {
            epochData[currentEpoch].settlementPrice = Math.min(
                epochData[currentEpoch].settlementPrice,
                normalizedSettlementPrice
            );
        }

        if (
            epochData[currentEpoch].underlyingSwapped ==
            epochData[currentEpoch].underlyingPurchased
        ) {
            epochStatus[currentEpoch] = EpochStatus.PREEXPIRED;
        }

        emit EpochPreExpired(msg.sender);
    }

    /// @dev Expire epoch and set the settlement price
    function expireEpoch() external whenNotPaused onlyRole(MANAGER_ROLE) {
        _validate(block.timestamp >= epochData[currentEpoch].expiry, 17);
        _validate(epochStatus[currentEpoch] == EpochStatus.PREEXPIRED, 10);

        if (epochData[currentEpoch].straddleCounter == 0) {
            epochStatus[currentEpoch] = EpochStatus.EXPIRED;
        } else {
            revert DopexError(21);
        }

        emit EpochExpired(msg.sender);
    }

    /*==== ADMIN METHODS ====*/

    /// @notice Sets the addresses used in the contract
    /// @dev Can only be called by admin
    /// @param _addresses Addresses
    function setAddresses(Addresses memory _addresses)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        addresses = _addresses;

        emit SetAddresses(_addresses);
    }

    /// @notice Sets the allowance of the 1inch router
    /// @dev Can only be called by admin
    /// @param _token The token to set allowance for
    /// @param _value The amount of allowance
    /// @param _increase Whether to increase or decrease allowance
    function setRouterAllowance(
        address _token,
        uint256 _value,
        bool _increase
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (_increase) {
            IERC20(_token).safeIncreaseAllowance(
                addresses.aggregationRouterV5,
                _value
            );
        } else {
            IERC20(_token).safeDecreaseAllowance(
                addresses.aggregationRouterV5,
                _value
            );
        }

        emit SetRouterAllowance(_token, _value, _increase);
    }

    function setFees(VaultVariables calldata _vaultVariables)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        vaultVariables = _vaultVariables;
        emit SetVaultVariables(_vaultVariables);
    }

    /// @notice Pauses the vault for emergency cases
    /// @dev Can only be called by admin
    function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {
        _pause();
    }

    /// @notice Unpauses the vault
    /// @dev Can only be called by admin
    function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {
        _unpause();
    }

    /// @notice Add a contract to the whitelist
    /// @dev Can only be called by the owner
    /// @param _contract Address of the contract that needs to be added to the whitelist
    function addToContractWhitelist(address _contract)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _addToContractWhitelist(_contract);
    }

    /// @notice Remove a contract to the whitelist
    /// @dev Can only be called by the owner
    /// @param _contract Address of the contract that needs to be removed from the whitelist
    function removeFromContractWhitelist(address _contract)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _removeFromContractWhitelist(_contract);
    }

    /// @notice Transfers all funds to msg.sender
    /// @dev Can only be called by admin
    /// @param tokens The list of erc20 tokens to withdraw
    /// @param transferNative Whether should transfer the native currency
    function emergencyWithdraw(address[] calldata tokens, bool transferNative)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
        whenPaused
    {
        if (transferNative) {
            payable(msg.sender).transfer(address(this).balance);
        }

        for (uint256 i; i < tokens.length; ) {
            IERC20 token = IERC20(tokens[i]);
            token.safeTransfer(msg.sender, token.balanceOf(address(this)));

            unchecked {
                ++i;
            }
        }
    }

    /// @notice Revert-er function to revert with string error message.
    /// @param trueCondition Similar to require, a condition that has to be false to revert.
    /// @param errorCode Index in the errors[] that was set in error controller.
    function _validate(bool trueCondition, uint256 errorCode) internal pure {
        if (!trueCondition) {
            revert DopexError(errorCode);
        }
    }

    // The following functions are overrides required by Solidity.
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId,
        uint256 batchSize
    ) internal override(ERC721, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, tokenId, batchSize);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721, ERC721Enumerable, AccessControl)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

/**
Error codes:

0: Invalid amount
1: Rollover not authorized
2: Invalid position, epoch cannot be 0
3: Epoch has not expired
4: Write position pnl is 0
5: Invalid owner
6: Invalid epoch
7: Cannot purchase during blackout period
8: Not enough AP liquidity available
9: Underlying purchased is not enough
10: Epoch has not pre-expired
11: Buyer PnL cannot be 0
12: Price impact is too high
13: Invalid toUnderlyingSwapData
14: Expiry cannot be before current time
15: Cannot bootstrap when vault is ready
16: Cannot bootstrap before the current epoch was expired & settled
17: Time is not past epoch expiry
18: Epoch must be in ready state
19: USD obtained is not enough
20: You cannot swap more than all underlying purchased
21: All settlements have not been processed

**/

File 2 of 27 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 27 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 27 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 5 of 27 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^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() {
        _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 making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

    function _nonReentrantAfter() private {
        // 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 27 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 7 of 27 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 8 of 27 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 9 of 27 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

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

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

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

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

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

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

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

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

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

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

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

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

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

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

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

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

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

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

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

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

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

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256, /* firstTokenId */
        uint256 batchSize
    ) internal virtual {
        if (batchSize > 1) {
            if (from != address(0)) {
                _balances[from] -= batchSize;
            }
            if (to != address(0)) {
                _balances[to] += batchSize;
            }
        }
    }

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}
}

File 10 of 27 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 12 of 27 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {ERC721-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, firstTokenId, batchSize);

        if (batchSize > 1) {
            // Will only trigger during construction. Batch transferring (minting) is not available afterwards.
            revert("ERC721Enumerable: consecutive transfers not supported");
        }

        uint256 tokenId = firstTokenId;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 13 of 27 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

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

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

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

File 15 of 27 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 20 of 27 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 21 of 27 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 22 of 27 : ContractWhitelist.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

/// @title ContractWhitelist
/// @author witherblock
/// @notice A helper contract that lets you add a list of whitelisted contracts that should be able to interact with restricited functions
abstract contract ContractWhitelist {
    /// @dev contract => whitelisted or not
    mapping(address => bool) public whitelistedContracts;

    /*==== SETTERS ====*/

    /// @dev add to the contract whitelist
    /// @param _contract the address of the contract to add to the contract whitelist
    function _addToContractWhitelist(address _contract) internal {
        require(isContract(_contract), "Address must be a contract");
        require(
            !whitelistedContracts[_contract],
            "Contract already whitelisted"
        );

        whitelistedContracts[_contract] = true;

        emit AddToContractWhitelist(_contract);
    }

    /// @dev remove from  the contract whitelist
    /// @param _contract the address of the contract to remove from the contract whitelist
    function _removeFromContractWhitelist(address _contract) internal {
        require(whitelistedContracts[_contract], "Contract not whitelisted");

        whitelistedContracts[_contract] = false;

        emit RemoveFromContractWhitelist(_contract);
    }

    // modifier is eligible sender modifier
    function _isEligibleSender() internal view {
        // the below condition checks whether the caller is a contract or not
        if (msg.sender != tx.origin)
            require(
                whitelistedContracts[msg.sender],
                "Contract must be whitelisted"
            );
    }

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

    /// @dev checks for contract or eoa addresses
    /// @param addr the address to check
    /// @return bool whether the passed address is a contract address
    function isContract(address addr) public view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(addr)
        }
        return size > 0;
    }

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

    event AddToContractWhitelist(address indexed _contract);

    event RemoveFromContractWhitelist(address indexed _contract);
}

File 23 of 27 : I1inchRouterV5.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

interface IAggregationExecutor {
    /// @notice propagates information about original msg.sender and executes arbitrary data
    function execute(address msgSender) external payable;  // 0x4b64e492
}

struct SwapDescription {
    address srcToken;
    address dstToken;
    address payable srcReceiver;
    address payable dstReceiver;
    uint256 amount;
    uint256 minReturnAmount;
    uint256 flags;
}

interface I1inchRouterV5 {
    function unoswap(
        address srcToken,
        uint256 amount,
        uint256 minReturn,
        uint256[] calldata pools
    ) external payable returns(uint256 returnAmount);

     function uniswapV3Swap(
        uint256 amount,
        uint256 minReturn,
        uint256[] calldata pools
    ) external payable returns(uint256 returnAmount);

    function swap(
        IAggregationExecutor executor,
        SwapDescription calldata desc,
        bytes calldata permit,
        bytes calldata data
    )
    external
    payable
    returns (
        uint256 returnAmount,
        uint256 spentAmount
    );

    struct UnoswapParams {
        address srcToken;
        uint256 amount;
        uint256 minReturn;
        uint256[] pools;
    }

    struct UniswapV3Params {
        uint256 amount;
        uint256 minReturn;
        uint256[] pools;
    }

    struct SwapParams {
        IAggregationExecutor executor;
        SwapDescription desc;
        bytes permit;
        bytes data;
    }
}

File 24 of 27 : IOptionPricing.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;

interface IOptionPricing {
    function getOptionPrice(
        bool isPut,
        uint256 expiry,
        uint256 strike,
        uint256 lastPrice,
        uint256 baseIv
    ) external view returns (uint256);
}

File 25 of 27 : IPriceOracle.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;

interface IPriceOracle {
    function getCollateralPrice() external view returns (uint256);

    function getUnderlyingPrice() external view returns (uint256);
}

File 26 of 27 : IVolatilityOracle.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;

interface IVolatilityOracle {
    function getVolatility(uint256) external view returns (uint256);
}

File 27 of 27 : IRewardDistributor.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IRewardDistributor {
    function bootstrap(uint256 _epoch) external;

    function claim(uint256 _id) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"errorCode","type":"uint256"}],"name":"DopexError","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"AddToContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Bootstrap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"rollover","type":"bool"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"EpochExpired","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"EpochPreExpired","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"straddleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cost","type":"uint256"}],"name":"Purchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"RemoveFromContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"usd","type":"address"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"aggregationRouterV5","type":"address"},{"internalType":"address","name":"rewardDistributor","type":"address"}],"indexed":false,"internalType":"struct AtlanticStraddleV2.Addresses","name":"addresses","type":"tuple"}],"name":"SetAddresses","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bool","name":"increase","type":"bool"}],"name":"SetRouterAllowance","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"purchaseFeePercent","type":"uint256"},{"internalType":"uint256","name":"settlementFeePercent","type":"uint256"},{"internalType":"uint256","name":"delegationFeePercent","type":"uint256"},{"internalType":"uint256","name":"maxDelegationFee","type":"uint256"},{"internalType":"uint256","name":"apFundingPercent","type":"uint256"},{"internalType":"uint256","name":"pnlSlippagePercent","type":"uint256"},{"internalType":"uint256","name":"maxPriceImpact","type":"uint256"},{"internalType":"uint256","name":"blackoutPeriodBeforeExpiry","type":"uint256"}],"indexed":false,"internalType":"struct AtlanticStraddleV2.VaultVariables","name":"vaultVariables","type":"tuple"}],"name":"SetVaultVariables","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pnl","type":"uint256"}],"name":"Settle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bool","name":"rollover","type":"bool"}],"name":"ToggleRollover","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pnl","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"AMOUNT_PRICE_TO_USDC_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DEPOSIT_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_PURCHASE_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECONDS_A_YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"addToContractWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"addresses","outputs":[{"internalType":"address","name":"usd","type":"address"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"aggregationRouterV5","type":"address"},{"internalType":"address","name":"rewardDistributor","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"expiry","type":"uint256"}],"name":"bootstrap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_timeToExpiry","type":"uint256"}],"name":"calculateApFunding","outputs":[{"internalType":"uint256","name":"funding","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_isPut","type":"bool"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_strike","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_expiry","type":"uint256"}],"name":"calculatePremium","outputs":[{"internalType":"uint256","name":"premium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"calculateStraddlePositionPnl","outputs":[{"internalType":"uint256","name":"buyerPnl","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"calculateWritePositionPnl","outputs":[{"internalType":"uint256","name":"writePositionPnl","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"shouldRollover","type":"bool"},{"internalType":"address","name":"user","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"bool","name":"transferNative","type":"bool"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochData","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"usdDeposits","type":"uint256"},{"internalType":"uint256","name":"activeUsdDeposits","type":"uint256"},{"internalType":"uint256","name":"settlementPrice","type":"uint256"},{"internalType":"uint256","name":"underlyingSwapped","type":"uint256"},{"internalType":"uint256","name":"underlyingPurchased","type":"uint256"},{"internalType":"uint256","name":"usdPremiums","type":"uint256"},{"internalType":"uint256","name":"usdFunding","type":"uint256"},{"internalType":"uint256","name":"totalSold","type":"uint256"},{"internalType":"uint256","name":"straddleCounter","type":"uint256"},{"internalType":"uint256","name":"finalUsdBalanceBeforeWithdraw","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochStatus","outputs":[{"internalType":"enum AtlanticStraddleV2.EpochStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnderlyingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strike","type":"uint256"}],"name":"getVolatility","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"multirollover","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"multisettle","outputs":[{"internalType":"uint256[]","name":"pnls","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"underlyingToSwapToUsd","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"components":[{"internalType":"uint256","name":"swapId","type":"uint256"},{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"}],"internalType":"struct I1inchRouterV5.UnoswapParams","name":"unoswapParams","type":"tuple"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"}],"internalType":"struct I1inchRouterV5.UniswapV3Params","name":"uniswapV3Params","type":"tuple"},{"components":[{"internalType":"contract IAggregationExecutor","name":"executor","type":"address"},{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"address payable","name":"srcReceiver","type":"address"},{"internalType":"address payable","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"}],"internalType":"struct SwapDescription","name":"desc","type":"tuple"},{"internalType":"bytes","name":"permit","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct I1inchRouterV5.SwapParams","name":"swapParams","type":"tuple"}],"internalType":"struct AtlanticStraddleV2.PurchaseParams","name":"purchaseParams","type":"tuple"}],"name":"preExpireEpoch","outputs":[{"internalType":"uint256","name":"usdObtained","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"components":[{"internalType":"uint256","name":"swapId","type":"uint256"},{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"}],"internalType":"struct I1inchRouterV5.UnoswapParams","name":"unoswapParams","type":"tuple"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"}],"internalType":"struct I1inchRouterV5.UniswapV3Params","name":"uniswapV3Params","type":"tuple"},{"components":[{"internalType":"contract IAggregationExecutor","name":"executor","type":"address"},{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"address payable","name":"srcReceiver","type":"address"},{"internalType":"address payable","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"}],"internalType":"struct SwapDescription","name":"desc","type":"tuple"},{"internalType":"bytes","name":"permit","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct I1inchRouterV5.SwapParams","name":"swapParams","type":"tuple"}],"internalType":"struct AtlanticStraddleV2.PurchaseParams","name":"purchaseParams","type":"tuple"}],"name":"purchase","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"protocolFee","type":"uint256"},{"internalType":"uint256","name":"straddleCost","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"removeFromContractWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"rollover","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"usd","type":"address"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"aggregationRouterV5","type":"address"},{"internalType":"address","name":"rewardDistributor","type":"address"}],"internalType":"struct AtlanticStraddleV2.Addresses","name":"_addresses","type":"tuple"}],"name":"setAddresses","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":[{"components":[{"internalType":"uint256","name":"purchaseFeePercent","type":"uint256"},{"internalType":"uint256","name":"settlementFeePercent","type":"uint256"},{"internalType":"uint256","name":"delegationFeePercent","type":"uint256"},{"internalType":"uint256","name":"maxDelegationFee","type":"uint256"},{"internalType":"uint256","name":"apFundingPercent","type":"uint256"},{"internalType":"uint256","name":"pnlSlippagePercent","type":"uint256"},{"internalType":"uint256","name":"maxPriceImpact","type":"uint256"},{"internalType":"uint256","name":"blackoutPeriodBeforeExpiry","type":"uint256"}],"internalType":"struct AtlanticStraddleV2.VaultVariables","name":"_vaultVariables","type":"tuple"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bool","name":"_increase","type":"bool"}],"name":"setRouterAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"settle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"straddlePositions","outputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"apStrike","type":"uint256"},{"internalType":"uint256","name":"underlyingPurchased","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"straddlePositionsOfOwner","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"toggleRollover","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultVariables","outputs":[{"internalType":"uint256","name":"purchaseFeePercent","type":"uint256"},{"internalType":"uint256","name":"settlementFeePercent","type":"uint256"},{"internalType":"uint256","name":"delegationFeePercent","type":"uint256"},{"internalType":"uint256","name":"maxDelegationFee","type":"uint256"},{"internalType":"uint256","name":"apFundingPercent","type":"uint256"},{"internalType":"uint256","name":"pnlSlippagePercent","type":"uint256"},{"internalType":"uint256","name":"maxPriceImpact","type":"uint256"},{"internalType":"uint256","name":"blackoutPeriodBeforeExpiry","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedContracts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"writePositionPnl","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"writePositions","outputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"usdDeposit","type":"uint256"},{"internalType":"bool","name":"rollover","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"writePositionsOfOwner","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

610180604052620249f06080908152620186a060a05260c062000027600a620f42406200020c565b8152602001620f42408152602001620f424060246200004791906200022f565b81526207a12060208083019190915260c86040808401919091526138406060938401528351601c5583820151601d55830151601e5590820151601f556080820151905560a081015160215560c081015160225560e00151602355348015620000ae57600080fd5b506040516200600738038062006007833981016040819052620000d1916200031a565b6001600081905582908290620000e8838262000413565b506002620000f7828262000413565b5050600c805460ff19169055506200011160003362000145565b6200013d7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b083362000145565b5050620004df565b62000151828262000155565b5050565b620001618282620001df565b62000151576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200019b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152600b602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b6000826200022a57634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176200020657634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200027d57600080fd5b81516001600160401b03808211156200029a576200029a62000255565b604051601f8301601f19908116603f01168101908282118183101715620002c557620002c562000255565b81604052838152602092508683858801011115620002e257600080fd5b600091505b83821015620003065785820183015181830184015290820190620002e7565b600093810190920192909252949350505050565b600080604083850312156200032e57600080fd5b82516001600160401b03808211156200034657600080fd5b62000354868387016200026b565b935060208501519150808211156200036b57600080fd5b506200037a858286016200026b565b9150509250929050565b600181811c908216806200039957607f821691505b602082108103620003ba57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200040e57600081815260208120601f850160051c81016020861015620003e95750805b601f850160051c820191505b818110156200040a57828155600101620003f5565b5050505b505050565b81516001600160401b038111156200042f576200042f62000255565b620004478162000440845462000384565b84620003c0565b602080601f8311600181146200047f5760008415620004665750858301515b600019600386901b1c1916600185901b1785556200040a565b600085815260208120601f198616915b82811015620004b0578886015182559484019460019091019084016200048f565b5085821015620004cf5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b615b1880620004ef6000396000f3fe608060405234801561001057600080fd5b50600436106103e65760003560e01c806370a082311161020a578063acc3a00611610125578063da0321cd116100b8578063ec87621c11610087578063ec87621c14610a55578063ee0d82c114610a6a578063ef2bb7e214610ab9578063f9aa6e0f14610acc578063ffe8e3721461048e57600080fd5b8063da0321cd14610963578063de40e873146109f3578063de8b007a14610a06578063e985e9c514610a1957600080fd5b8063c3d9ed39116100f4578063c3d9ed39146108c9578063c87b56dd146108dc578063d547741f146108ef578063d966e18f1461090257600080fd5b8063acc3a00614610890578063b88d4fde146108a3578063c1419def1461048e578063c189c19b146108b657600080fd5b80638df828001161019d5780639ce990ea1161016c5780639ce990ea1461084f578063a217fddf14610862578063a22cb4651461086a578063a7de2a0d1461087d57600080fd5b80638df82800146107cc57806390bb5855146107df57806391d148541461083457806395d89b411461084757600080fd5b806379271130116101d9578063792711301461078b5780637c4b52cb1461079e57806380ed71e4146107b15780638456cb59146107c457600080fd5b806370a082311461074957806372cadb901461075c57806375153f3e1461076f578063766718081461078257600080fd5b8063391feebb116103055780635387b84c116102985780636352211e116102675780636352211e1461062657806366a1d0e7146106395780636c1085a1146106675780636db29f6d1461067a5780636e821b2e1461068257600080fd5b80635387b84c146105ef57806354545bfb14610602578063562b98d8146106105780635c975abb1461061b57600080fd5b806342842e0e116102d457806342842e0e146105b1578063468f02d2146105c45780634c3ea057146105cc5780634f6ccce7146105dc57600080fd5b8063391feebb146105535780633dbb196d146105765780633ec21260146105965780633f4ba83a146105a957600080fd5b8063248a9ca31161037d578063306b8ac21161034c578063306b8ac214610507578063337847b21461051a57806336568abe1461052d5780633686a39e1461054057600080fd5b8063248a9ca3146104ab5780632e1a7d4d146104ce5780632f2ff15d146104e15780632f745c59146104f457600080fd5b806316279055116103b9578063162790551461046857806318160ddd1461047c5780631ea30fef1461048e57806323b872dd1461049857600080fd5b806301ffc9a7146103eb57806306fdde0314610413578063081812fc14610428578063095ea7b314610453575b600080fd5b6103fe6103f9366004614cbe565b610afc565b60405190151581526020015b60405180910390f35b61041b610b0d565b60405161040a9190614d2b565b61043b610436366004614d3e565b610b9f565b6040516001600160a01b03909116815260200161040a565b610466610461366004614d77565b610bc6565b005b6103fe610476366004614da3565b3b151590565b6009545b60405190815260200161040a565b610480620f424081565b6104666104a6366004614dc0565b610ce0565b6104806104b9366004614d3e565b6000908152600b602052604090206001015490565b6104806104dc366004614d3e565b610d11565b6104666104ef366004614e01565b610eae565b610480610502366004614d77565b610ed3565b610466610515366004614e31565b610f69565b610466610528366004614ed4565b611039565b61046661053b366004614e01565b611187565b6103fe61054e366004614d3e565b611205565b6103fe610561366004614da3565b600d6020526000908152604090205460ff1681565b610589610584366004615011565b611388565b60405161040a9190615080565b6105896105a4366004614da3565b61142a565b610466611535565b6104666105bf366004614dc0565b61154b565b610480611566565b61048068056bc75e2d6310000081565b6104806105ea366004614d3e565b6115d9565b6104806105fd366004614d3e565b61166c565b610480662386f26fc1000081565b6104806301e1338081565b600c5460ff166103fe565b61043b610634366004614d3e565b611797565b61064c6106473660046150a5565b6117f7565b6040805193845260208401929092529082015260600161040a565b610466610675366004614d3e565b611ca3565b610466611d51565b6106f0610690366004614d3e565b601860205280600052604060002060009150905080600001549080600101549080600201549080600301549080600401549080600501549080600601549080600701549080600801549080600901549080600a01549080600b015490508c565b604080519c8d5260208d019b909b52998b019890985260608a0196909652608089019490945260a088019290925260c087015260e08601526101008501526101208401526101408301526101608201526101800161040a565b610480610757366004614da3565b611e58565b61046661076a366004615115565b611ede565b61048061077d366004614d3e565b611f78565b610480600f5481565b610589610799366004614da3565b612003565b6104666107ac366004615157565b612105565b6104806107bf3660046151d1565b612212565b610466612379565b6104806107da366004614d3e565b61238c565b6108146107ed366004614d3e565b601b6020526000908152604090208054600182015460028301546003909301549192909184565b60408051948552602085019390935291830152606082015260800161040a565b6103fe610842366004614e01565b6125ef565b61041b61261a565b61048061085d366004615208565b612629565b610480600081565b610466610878366004615234565b61268b565b61048061088b366004615262565b612696565b61046661089e366004614da3565b6129d1565b6104666108b1366004615320565b6129e5565b6104806108c4366004614d3e565b612a1d565b6104666108d7366004614da3565b612a8b565b61041b6108ea366004614d3e565b612a9f565b6104666108fd366004614e01565b612b12565b601c54601d54601e54601f54602054602154602254602354610928979695949392919088565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c083015260e08201526101000161040a565b6010546011546012546013546014546015546016546017546109a1976001600160a01b03908116978116968116958116948116938116928116911688565b604080516001600160a01b03998a16815297891660208901529588169587019590955292861660608601529085166080850152841660a0840152831660c083015290911660e08201526101000161040a565b610480610a0136600461537f565b612b37565b610589610a14366004615011565b612be8565b6103fe610a273660046153c3565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b610480600080516020615ac383398151915281565b610a9c610a78366004614d3e565b601a6020526000908152604090208054600182015460029092015490919060ff1683565b60408051938452602084019290925215159082015260600161040a565b610480610ac7366004614d3e565b612c83565b610aef610ada366004614d3e565b60196020526000908152604090205460ff1681565b60405161040a9190615407565b6000610b0782612f6c565b92915050565b606060018054610b1c9061542f565b80601f0160208091040260200160405190810160405280929190818152602001828054610b489061542f565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b6000610baa82612f91565b506000908152600560205260409020546001600160a01b031690565b6000610bd182611797565b9050806001600160a01b0316836001600160a01b031603610c435760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610c5f5750610c5f8133610a27565b610cd15760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610c3a565b610cdb8383612ff0565b505050565b610cea338261305e565b610d065760405162461bcd60e51b8152600401610c3a90615463565b610cdb8383836130dc565b6000610d1b61324d565b610d23613295565b610d2b6132ee565b610d4933610d3884611797565b6001600160a01b0316146005613354565b6000828152601a60209081526040918290208251606081018452815480825260018301549382019390935260029182015460ff16151593810193909352610d9291151590613354565b610dc560025b825160009081526019602052604090205460ff166003811115610dbd57610dbd6153f1565b146003613354565b610dce83611f78565b60175460405163379607f560e01b8152600481018690529193506001600160a01b03169063379607f590602401600060405180830381600087803b158015610e1557600080fd5b505af1158015610e29573d6000803e3d6000fd5b50505050610e3683613378565b610e438215156004613354565b601054610e5a906001600160a01b0316338461341b565b80516040805191825260208201859052810183905233907fb0ecf14e184effded5473bba77dcfab32b094b77ac1fbb36beec2aef555879709060600160405180910390a250610ea96001600055565b919050565b6000828152600b6020526040902060010154610ec98161347e565b610cdb8383613488565b6000610ede83611e58565b8210610f405760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c3a565b506001600160a01b03919091166000908152600760209081526040808320938352929052205490565b6000610f748161347e565b8135601c908155602080840135601d556040840135601e556060840135601f556080840135905560a083013560215560c083013560225560e0830135602355829050506040805183358152602080850135908201528184013591810191909152606080840135908201526080808401359082015260a0808401359082015260c0808401359082015260e080840135908201527fe90df7b8aa72d1a01765ac1d8aca43d7602c0d8d0c5920a7dde72d3761a148ee90610100015b60405180910390a15050565b60006110448161347e565b8151601080546001600160a01b03199081166001600160a01b039384161790915560208401516011805483169184169190911790556040808501516012805484169185169190911790556060850151601380548416918516919091179055608085015160148054841691851691909117905560a085015160158054841691851691909117905560c085015160168054841691851691909117905560e0850151601780549093169316929092179055517fefec2a608e6651b7f9dc06efa56139088896e798f1c1055a373672640d37e4b49061102d90849081516001600160a01b03908116825260208084015182169083015260408084015182169083015260608084015182169083015260808084015182169083015260a08084015182169083015260c08084015182169083015260e09283015116918101919091526101000190565b6001600160a01b03811633146111f75760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c3a565b611201828261350e565b5050565b600061120f61324d565b600080516020615ac38339815191526112278161347e565b6000600f54600161123891906154c6565b9050611247844210600e613354565b6112766000808381526019602052604090205460ff16600381111561126e5761126e6153f1565b14600f613354565b600f54156112b1576112b16002600f5460009081526019602052604090205460ff1660038111156112a9576112a96153f1565b146010613354565b60008181526018602090815260408083204281556001908101889055601990925291829020805460ff19169091179055600f8290556017549051631b4351cf60e11b8152600481018390526001600160a01b0390911690633686a39e90602401600060405180830381600087803b15801561132b57600080fd5b505af115801561133f573d6000803e3d6000fd5b505050507fb5ca1ca1b7b47549eb8af476f3ef702fc63bcd8b8c01dc163b009bb818f979978160405161137491815260200190565b60405180910390a160019250505b50919050565b8051606090806001600160401b038111156113a5576113a5614e44565b6040519080825280602002602001820160405280156113ce578160200160208202803683370190505b50915060005b81811015611423576113fe8482815181106113f1576113f16154d9565b602002602001015161238c565b838281518110611410576114106154d9565b60209081029190910101526001016113d4565b5050919050565b6060600061143783611e58565b90506000805b8281101561147d5760006114518683610ed3565b6000818152601b60205260409020549091501561147457611471836154ef565b92505b5060010161143d565b50806001600160401b0381111561149657611496614e44565b6040519080825280602002602001820160405280156114bf578160200160208202803683370190505b5092506000805b8282101561152c5760006114da8783610ed3565b6000818152601b60205260409020549091501561151b5780868481518110611504576115046154d9565b6020908102919091010152611518836154ef565b92505b611524826154ef565b9150506114c6565b50505050919050565b60006115408161347e565b611548613575565b50565b610cdb838383604051806020016040528060008152506129e5565b60125460408051632347816960e11b815290516000926001600160a01b03169163468f02d29160048083019260209291908290030181865afa1580156115b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d49190615508565b905090565b60006115e460095490565b82106116475760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c3a565b6009828154811061165a5761165a6154d9565b90600052602060002001549050919050565b6000818152601b6020908152604080832081516080810183528154808252600183015494820194909452600280830154938201939093526003909101546060820152916116bc9190151590613354565b8051600090815260186020526040908190206004015490820151818111156117245760208301516116ed8383615521565b6116f79190615534565b60608401519094506117098383615521565b6117139190615534565b61171d9085615521565b935061174a565b60608301516117338284615521565b61173d9190615534565b61174790856154c6565b93505b61175d68056bc75e2d631000008561554b565b935061176d620f42406064615534565b60215461177a9086615534565b611784919061554b565b61178e9085615521565b95945050505050565b6000818152600360205260408120546001600160a01b031680610b075760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c3a565b600080600061180461324d565b61180c613295565b6118146132ee565b6118246000600f54116006613354565b611838662386f26fc1000088116000613354565b602354600f546000908152601860205260409020600101546118669161185d91615521565b42106007613354565b6000611870611566565b90506118e468056bc75e2d631000006118898a84615534565b611893919061554b565b600f546000908152601860205260409020600301546118bc9068056bc75e2d631000009061554b565b600f546000908152601860205260409020600201546118db9190615521565b10156008613354565b600061191968056bc75e2d6310000060026118ff8c86615534565b611909919061554b565b611913919061554b565b876135c7565b9050611929888210156009613354565b6000611936826002615534565b6119408b85615534565b61194a919061554b565b905061195681846137f2565b600f546000908152601860205260408120600601805484929061197a9084906154c6565b9091555061198b9050826002615534565b6119959082615534565b600f54600090815260186020526040812060030180549091906119b99084906154c6565b90915550600090506119ed600183806119d3876002615534565b600f54600090815260186020526040902060010154612b37565b90506000611a2083611a00866002615534565b600f5460009081526018602052604090206001015461085d904290615521565b90508160186000600f5481526020019081526020016000206007016000828254611a4a91906154c6565b9091555050600f5460009081526018602052604081206008018054839290611a739084906154c6565b90915550611a849050846002615534565b600f5460009081526018602052604081206009018054909190611aa89084906154c6565b9091555050600f546000908152601860205260408120600a01805460019290611ad29084906154c6565b90915550611ae190508a613849565b97506040518060800160405280600f548152602001856002611b039190615534565b81526020808201869052604091820187905260008b8152601b825282902083518155908301516001820155908201516002820155606090910151600390910155611b5968056bc75e2d63100000620f4240615534565b611b64906064615534565b601c54611b71878f615534565b611b7b9190615534565b611b85919061554b565b965068056bc75e2d63100000611b9b82846154c6565b611ba5919061554b565b9550611bca3330611bb68a8a6154c6565b6010546001600160a01b031692919061386e565b601554601054611be7916001600160a01b0391821691168961341b565b68056bc75e2d63100000611bfb82846154c6565b611c05919061554b565b600f546000908152601860205260408120600b018054909190611c299084906154c6565b9091555050600f547f9d507133ca47d3afd7d870243115c9867ea2325ba4c3014950405d35dae67cd6908b8a611c5f85876154c6565b604080519485526001600160a01b03909316602085015291830152606082015260800160405180910390a15050505050611c996001600055565b9450945094915050565b611cab61324d565b611cb3613295565b611cbb6132ee565b611cc833610d3883611797565b6000818152601a6020526040902054611ce49015156002613354565b6000818152601a6020908152604091829020600201805460ff8082161560ff199092168217909255835185815291161515918101919091527fb5e95d468eadd79446f495b23ddf06bb55ff5717a821eb2cc57154a31cd5ee22910160405180910390a16115486001600055565b611d5961324d565b600080516020615ac3833981519152611d718161347e565b600f54600090815260186020526040902060010154611d94904210156011613354565b611dc76003600f5460009081526019602052604090205460ff166003811115611dbf57611dbf6153f1565b14600a613354565b600f546000908152601860205260408120600a01549003611e0357600f546000908152601960205260409020805460ff19166002179055611e22565b6040516001623cd50760e01b0319815260156004820152602401610c3a565b6040513381527f6a4de20bb9fa8fea199f1022f29eff6be1752c446674d16913f2afc2b3c5a8a59060200160405180910390a150565b60006001600160a01b038216611ec25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610c3a565b506001600160a01b031660009081526004602052604090205490565b6000611ee98161347e565b8115611f0e57601654611f09906001600160a01b038681169116856138a6565b611f28565b601654611f28906001600160a01b03868116911685613958565b604080516001600160a01b0386168152602081018590528315158183015290517f2482ddca0c9600e77de3f9629ffa0660a0104e6e45a24b21de67c69d5b35fe849181900360600190a150505050565b6000818152601a602090815260408083208151606081018352815480825260018301549482019490945260029182015460ff161515928101929092529091611fc39190151590613354565b8051600090815260186020908152604080832060020154845184529220600b015490830151611ff29190615534565b611ffc919061554b565b9392505050565b6060600061201083611e58565b90506000805b8281101561205657600061202a8683610ed3565b6000818152601a60205260409020549091501561204d5761204a836154ef565b92505b50600101612016565b50806001600160401b0381111561206f5761206f614e44565b604051908082528060200260200182016040528015612098578160200160208202803683370190505b5092506000805b8282101561152c5760006120b38783610ed3565b6000818152601a6020526040902054909150156120f457808684815181106120dd576120dd6154d9565b60209081029190910101526120f1836154ef565b92505b6120fd826154ef565b91505061209f565b60006121108161347e565b612118613a64565b811561214c5760405133904780156108fc02916000818181858888f1935050505015801561214a573d6000803e3d6000fd5b505b60005b8381101561220b57600085858381811061216b5761216b6154d9565b90506020020160208101906121809190614da3565b6040516370a0823160e01b81523060048201529091506122029033906001600160a01b038416906370a0823190602401602060405180830381865afa1580156121cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f19190615508565b6001600160a01b038416919061341b565b5060010161214f565b5050505050565b600061221c61324d565b612224613295565b61222c6132ee565b61223c620f424085116000613354565b6000600f54600161224d91906154c6565b90508460186000838152602001908152602001600020600201600082825461227591906154c6565b90915550506000818152601860205260408120600b01805487929061229b9084906154c6565b909155506122aa905083613849565b6040805160608101825283815260208082018981528815158385019081526000868152601a909352939091209151825551600182015590516002909101805460ff1916911515919091179055601054909250612311906001600160a01b031633308861386e565b6040805182815260208101879052851515818301526001600160a01b038516606082015233608082015260a0810184905290517f14c0e56f4125d5707194bbf1beff49bb39b170a0f49574bcf25d8616f4df1cf69181900360c00190a150611ffc6001600055565b60006123848161347e565b611548613aad565b600061239661324d565b61239e613295565b6123a66132ee565b6000828152601b602090815260409182902082516080810184528154808252600183015493820193909352600280830154948201949094526003909101546060820152916123f691151590613354565b6124206003825160009081526019602052604090205460ff166003811115611dbf57611dbf6153f1565b600061242b8461166c565b9050600061243885611797565b905061244385613378565b612450821515600b613354565b6000612460620f42406064615534565b601d5461246d9085615534565b612477919061554b565b905060006001600160a01b03831633146124c457612499620f42406064615534565b601e546124a69086615534565b6124b0919061554b565b90506124c181601c60030154613aea565b90505b6124ce81836154c6565b6124d89085615521565b85516000908152601860205260408120600a018054929650600192909190612501908490615521565b9091555081905061251283866154c6565b61251c91906154c6565b85516000908152601860205260408120600b01805490919061253f908490615521565b9091555050601554601054612561916001600160a01b0391821691168461341b565b601054612578906001600160a01b0316848661341b565b60105461258f906001600160a01b0316338361341b565b8451604080519182526020820189905281018590526001600160a01b0384169033907f5c6a917207417d39f68f90bcada5466a46efe20df97c2ac0046789b071b135ca9060600160405180910390a350919350505050610ea96001600055565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060028054610b1c9061542f565b600060026064612640620f42406301e13380615534565b60205486908690612651908a615534565b61265b9190615534565b6126659190615534565b61266f919061554b565b612679919061554b565b612683919061554b565b949350505050565b611201338383613b00565b60006126a061324d565b600080516020615ac38339815191526126b88161347e565b600f546000908152601860209081526040918290208251610180810184528154815260018201549281018390526002820154938101939093526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e084015260088101546101008401526009810154610120840152600a810154610140840152600b015461016083015261275c904210156011613354565b61278f6001600f5460009081526019602052604090205460ff166003811115612787576127876153f1565b146012613354565b60c0810151600090156128df576127a68786613bce565b935060006127b2611566565b90506000886127c987670de0b6b3a7640000615534565b6127d4906064615534565b6127de919061554b565b90506127ea81836137f2565b6127f8888710156013613354565b6128198460c001518a8660a0015161281091906154c6565b11156014613354565b600f546000908152601860205260408120600b01805488929061283d9084906154c6565b90915550600090508961285968056bc75e2d6310000089615534565b612863919061554b565b9050898560a0015161287591906154c6565b61287f8b83615534565b8660a0015187608001516128939190615534565b61289d91906154c6565b6128a7919061554b565b93508960186000600f54815260200190815260200160002060050160008282546128d191906154c6565b909155506128ea9350505050565b6128e7611566565b90505b600f54600090815260186020526040812060040154900361292157600f546000908152601860205260409020600401819055612956565b600f546000908152601860205260409020600401546129409082613aea565b600f546000908152601860205260409020600401555b600f54600090815260186020526040902060068101546005909101540361299457600f546000908152601960205260409020805460ff191660031790555b6040513381527fe299059e3adc918e4f4ab456527f6220987ed7fce29c2bc9a416f9336822bdd29060200160405180910390a15050509392505050565b60006129dc8161347e565b61120182613cc4565b6129ef338361305e565b612a0b5760405162461bcd60e51b8152600401610c3a90615463565b612a1784848484613dc7565b50505050565b60135460405163c189c19b60e01b8152600481018390526000916001600160a01b03169063c189c19b90602401602060405180830381865afa158015612a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b079190615508565b6000612a968161347e565b61120182613dfa565b6060612aaa82612f91565b6000612ac160408051602081019091526000815290565b90506000815111612ae15760405180602001604052806000815250611ffc565b80612aeb84613eab565b604051602001612afc92919061556d565b6040516020818303038152906040529392505050565b6000828152600b6020526040902060010154612b2d8161347e565b610cdb838361350e565b60145460009083906001600160a01b0316635b7b6d888885888a612b5a82612a1d565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a401602060405180830381865afa158015612bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd49190615508565b612bde9190615534565b9695505050505050565b8051606090806001600160401b03811115612c0557612c05614e44565b604051908082528060200260200182016040528015612c2e578160200160208202803683370190505b50915060005b8181101561142357612c5e848281518110612c5157612c516154d9565b6020026020010151612c83565b838281518110612c7057612c706154d9565b6020908102919091010152600101612c34565b6000612c8d61324d565b612c95613295565b612c9d6132ee565b6000828152601a60209081526040918290208251606081018452815481526001808301549382019390935260029091015460ff16151592810183905291612ce391613354565b8051612cf29015156002613354565b612cfc6002610d98565b6000612d0784611f78565b90506000612d1485611797565b60175460405163379607f560e01b8152600481018890529192506001600160a01b03169063379607f590602401600060405180830381600087803b158015612d5b57600080fd5b505af1158015612d6f573d6000803e3d6000fd5b50505050612d7c85613378565b612d898215156004613354565b60006001600160a01b0382163314612dd457612da9620f42406064615534565b601e54612db69085615534565b612dc0919061554b565b9050612dd181601c60030154613aea565b90505b612dde8184615521565b8451604080519182526020820189905281018290529093506001600160a01b038316907fb0ecf14e184effded5473bba77dcfab32b094b77ac1fbb36beec2aef555879709060600160405180910390a26000600f546001612e3f91906154c6565b905083601860008381526020019081526020016000206002016000828254612e6791906154c6565b90915550506000818152601860205260408120600b018054869290612e8d9084906154c6565b90915550612e9c905083613849565b60408051606081018252838152602080820188815260018385018181526000878152601a9094529490922092518355519082015590516002909101805460ff1916911515919091179055601054909650612f00906001600160a01b0316338461341b565b60408051828152602081018690526001818301526001600160a01b03851660608201819052608082015260a0810188905290517f14c0e56f4125d5707194bbf1beff49bb39b170a0f49574bcf25d8616f4df1cf69181900360c00190a15050505050610ea96001600055565b60006001600160e01b03198216637965db0b60e01b1480610b075750610b0782613f3d565b6000818152600360205260409020546001600160a01b03166115485760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c3a565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061302582611797565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061306a83611797565b9050806001600160a01b0316846001600160a01b031614806130b157506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b806126835750836001600160a01b03166130ca84610b9f565b6001600160a01b031614949350505050565b826001600160a01b03166130ef82611797565b6001600160a01b0316146131155760405162461bcd60e51b8152600401610c3a9061559c565b6001600160a01b0382166131775760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c3a565b6131848383836001613f62565b826001600160a01b031661319782611797565b6001600160a01b0316146131bd5760405162461bcd60e51b8152600401610c3a9061559c565b600081815260056020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260048552838620805460001901905590871680865283862080546001019055868652600390945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600c5460ff16156132935760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610c3a565b565b6002600054036132e75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c3a565b6002600055565b33321461329357336000908152600d602052604090205460ff166132935760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c6973746564000000006044820152606401610c3a565b81611201576040516001623cd50760e01b0319815260048101829052602401610c3a565b600061338382611797565b9050613393816000846001613f62565b61339c82611797565b600083815260056020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526004845282852080546000190190558785526003909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6040516001600160a01b038316602482015260448101829052610cdb90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613f6e565b6115488133614040565b61349282826125ef565b611201576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134ca3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61351882826125ef565b15611201576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61357d613a64565b600c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6011546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa158015613614573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136389190615508565b6010546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015613686573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136aa9190615508565b90506136be856136b986615769565b614099565b6010546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015613707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061372b9190615508565b6137359083615521565b6011546040516370a0823160e01b815230600482015291925084916001600160a01b03909116906370a0823190602401602060405180830381865afa158015613782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a69190615508565b6137b09190615521565b93506137bf818714600d613354565b600f546000908152601860205260408120600b0180548392906137e3908490615521565b90915550939695505050505050565b600081831161380a576138058383615521565b613814565b6138148284615521565b602254909150610cdb908361382d6064620f424061554b565b6138379085615534565b613841919061554b565b10600c613354565b6000613854600e5490565b9050613864600e80546001019055565b610ea98282614213565b6040516001600160a01b0380851660248301528316604482015260648101829052612a179085906323b872dd60e01b90608401613447565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156138f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061391b9190615508565b61392591906154c6565b6040516001600160a01b038516602482015260448101829052909150612a1790859063095ea7b360e01b90606401613447565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156139a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139cc9190615508565b905081811015613a305760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b6064820152608401610c3a565b6040516001600160a01b0384166024820152828203604482018190529061220b90869063095ea7b360e01b90606401613447565b600c5460ff166132935760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c3a565b613ab561324d565b600c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135aa3390565b6000818310613af95781611ffc565b5090919050565b816001600160a01b0316836001600160a01b031603613b615760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c3a565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6010546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa158015613c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c3f9190615508565b9050613c4e846136b985615769565b6010546040516370a0823160e01b815230600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa158015613c96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cba9190615508565b6126839190615521565b803b613d125760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e74726163740000000000006044820152606401610c3a565b6001600160a01b0381166000908152600d602052604090205460ff1615613d7b5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c6973746564000000006044820152606401610c3a565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b613dd28484846130dc565b613dde8484848461422d565b612a175760405162461bcd60e51b8152600401610c3a90615850565b6001600160a01b0381166000908152600d602052604090205460ff16613e625760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c697374656400000000000000006044820152606401610c3a565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b60606000613eb88361432e565b60010190506000816001600160401b03811115613ed757613ed7614e44565b6040519080825280601f01601f191660200182016040528015613f01576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613f0b57509392505050565b60006001600160e01b0319821663780e9d6360e01b1480610b075750610b0782614406565b612a1784848484614456565b6000613fc3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661458f9092919063ffffffff16565b805190915015610cdb5780806020019051810190613fe191906158a2565b610cdb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c3a565b61404a82826125ef565b611201576140578161459e565b6140628360206145b0565b6040516020016140739291906158bf565b60408051601f198184030181529082905262461bcd60e51b8252610c3a91600401614d2b565b805160000361412857601654602082015180516040808301516060909301519051630502b1c560e01b81526001600160a01b0390941693630502b1c5936140e593928892600401615934565b6020604051808303816000875af1158015614104573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdb9190615508565b8051600103614172576016546040808301516020810151908201519151637224811760e11b81526001600160a01b039093169263e449022e926140e5928792909190600401615961565b805160020361120157606080820180516020908101516080018590526016549151805191810151604080830151929095015194516312aa3caf60e01b81526001600160a01b03909416946312aa3caf946141d194939190600401615980565b60408051808303816000875af11580156141ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a179190615a05565b61120182826040518060200160405280600081525061474b565b60006001600160a01b0384163b1561432357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614271903390899088908890600401615a29565b6020604051808303816000875af19250505080156142ac575060408051601f3d908101601f191682019092526142a991810190615a5c565b60015b614309573d8080156142da576040519150601f19603f3d011682016040523d82523d6000602084013e6142df565b606091505b5080516000036143015760405162461bcd60e51b8152600401610c3a90615850565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612683565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061436d5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310614399576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106143b757662386f26fc10000830492506010015b6305f5e10083106143cf576305f5e100830492506008015b61271083106143e357612710830492506004015b606483106143f5576064830492506002015b600a8310610b075760010192915050565b60006001600160e01b031982166380ac58cd60e01b148061443757506001600160e01b03198216635b5e139f60e01b145b80610b0757506301ffc9a760e01b6001600160e01b0319831614610b07565b6144628484848461477e565b60018111156144d15760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610c3a565b816001600160a01b03851661452d5761452881600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b614550565b836001600160a01b0316856001600160a01b031614614550576145508582614806565b6001600160a01b03841661456c57614567816148a3565b61220b565b846001600160a01b0316846001600160a01b03161461220b5761220b8482614952565b60606126838484600085614996565b6060610b076001600160a01b03831660145b606060006145bf836002615534565b6145ca9060026154c6565b6001600160401b038111156145e1576145e1614e44565b6040519080825280601f01601f19166020018201604052801561460b576020820181803683370190505b509050600360fc1b81600081518110614626576146266154d9565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614655576146556154d9565b60200101906001600160f81b031916908160001a9053506000614679846002615534565b6146849060016154c6565b90505b60018111156146fc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106146b8576146b86154d9565b1a60f81b8282815181106146ce576146ce6154d9565b60200101906001600160f81b031916908160001a90535060049490941c936146f581615a79565b9050614687565b508315611ffc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c3a565b6147558383614a71565b614762600084848461422d565b610cdb5760405162461bcd60e51b8152600401610c3a90615850565b6001811115612a17576001600160a01b038416156147c4576001600160a01b038416600090815260046020526040812080548392906147be908490615521565b90915550505b6001600160a01b03831615612a17576001600160a01b038316600090815260046020526040812080548392906147fb9084906154c6565b909155505050505050565b6000600161481384611e58565b61481d9190615521565b600083815260086020526040902054909150808214614870576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b5060009182526008602090815260408084208490556001600160a01b039094168352600781528383209183525290812055565b6009546000906148b590600190615521565b6000838152600a6020526040812054600980549394509092849081106148dd576148dd6154d9565b9060005260206000200154905080600983815481106148fe576148fe6154d9565b6000918252602080832090910192909255828152600a9091526040808220849055858252812055600980548061493657614936615a90565b6001900381819060005260206000200160009055905550505050565b600061495d83611e58565b6001600160a01b039093166000908152600760209081526040808320868452825280832085905593825260089052919091209190915550565b6060824710156149f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c3a565b600080866001600160a01b03168587604051614a139190615aa6565b60006040518083038185875af1925050503d8060008114614a50576040519150601f19603f3d011682016040523d82523d6000602084013e614a55565b606091505b5091509150614a6687838387614c0a565b979650505050505050565b6001600160a01b038216614ac75760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c3a565b6000818152600360205260409020546001600160a01b031615614b2c5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c3a565b614b3a600083836001613f62565b6000818152600360205260409020546001600160a01b031615614b9f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c3a565b6001600160a01b038216600081815260046020908152604080832080546001019055848352600390915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315614c79578251600003614c72576001600160a01b0385163b614c725760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c3a565b5081612683565b6126838383815115614c8e5781518083602001fd5b8060405162461bcd60e51b8152600401610c3a9190614d2b565b6001600160e01b03198116811461154857600080fd5b600060208284031215614cd057600080fd5b8135611ffc81614ca8565b60005b83811015614cf6578181015183820152602001614cde565b50506000910152565b60008151808452614d17816020860160208601614cdb565b601f01601f19169290920160200192915050565b602081526000611ffc6020830184614cff565b600060208284031215614d5057600080fd5b5035919050565b6001600160a01b038116811461154857600080fd5b8035610ea981614d57565b60008060408385031215614d8a57600080fd5b8235614d9581614d57565b946020939093013593505050565b600060208284031215614db557600080fd5b8135611ffc81614d57565b600080600060608486031215614dd557600080fd5b8335614de081614d57565b92506020840135614df081614d57565b929592945050506040919091013590565b60008060408385031215614e1457600080fd5b823591506020830135614e2681614d57565b809150509250929050565b6000610100828403121561138257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b0381118282101715614e7c57614e7c614e44565b60405290565b60405160e081016001600160401b0381118282101715614e7c57614e7c614e44565b604051601f8201601f191681016001600160401b0381118282101715614ecc57614ecc614e44565b604052919050565b6000610100808385031215614ee857600080fd5b604051908101906001600160401b0382118183101715614f0a57614f0a614e44565b8160405283359150614f1b82614d57565b818152614f2a60208501614d6c565b6020820152614f3b60408501614d6c565b6040820152614f4c60608501614d6c565b6060820152614f5d60808501614d6c565b6080820152614f6e60a08501614d6c565b60a0820152614f7f60c08501614d6c565b60c0820152614f9060e08501614d6c565b60e0820152949350505050565b600082601f830112614fae57600080fd5b813560206001600160401b03821115614fc957614fc9614e44565b8160051b614fd8828201614ea4565b9283528481018201928281019087851115614ff257600080fd5b83870192505b84831015614a6657823582529183019190830190614ff8565b60006020828403121561502357600080fd5b81356001600160401b0381111561503957600080fd5b61268384828501614f9d565b600081518084526020808501945080840160005b8381101561507557815187529582019590820190600101615059565b509495945050505050565b602081526000611ffc6020830184615045565b60006080828403121561138257600080fd5b600080600080608085870312156150bb57600080fd5b843593506020850135925060408501356150d481614d57565b915060608501356001600160401b038111156150ef57600080fd5b6150fb87828801615093565b91505092959194509250565b801515811461154857600080fd5b60008060006060848603121561512a57600080fd5b833561513581614d57565b925060208401359150604084013561514c81615107565b809150509250925092565b60008060006040848603121561516c57600080fd5b83356001600160401b038082111561518357600080fd5b818601915086601f83011261519757600080fd5b8135818111156151a657600080fd5b8760208260051b85010111156151bb57600080fd5b6020928301955093505084013561514c81615107565b6000806000606084860312156151e657600080fd5b8335925060208401356151f881615107565b9150604084013561514c81614d57565b60008060006060848603121561521d57600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561524757600080fd5b823561525281614d57565b91506020830135614e2681615107565b60008060006060848603121561527757600080fd5b833592506020840135915060408401356001600160401b0381111561529b57600080fd5b6152a786828701615093565b9150509250925092565b600082601f8301126152c257600080fd5b81356001600160401b038111156152db576152db614e44565b6152ee601f8201601f1916602001614ea4565b81815284602083860101111561530357600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561533657600080fd5b843561534181614d57565b9350602085013561535181614d57565b92506040850135915060608501356001600160401b0381111561537357600080fd5b6150fb878288016152b1565b600080600080600060a0868803121561539757600080fd5b85356153a281615107565b97602087013597506040870135966060810135965060800135945092505050565b600080604083850312156153d657600080fd5b82356153e181614d57565b91506020830135614e2681614d57565b634e487b7160e01b600052602160045260246000fd5b602081016004831061542957634e487b7160e01b600052602160045260246000fd5b91905290565b600181811c9082168061544357607f821691505b60208210810361138257634e487b7160e01b600052602260045260246000fd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b0757610b076154b0565b634e487b7160e01b600052603260045260246000fd5b600060018201615501576155016154b0565b5060010190565b60006020828403121561551a57600080fd5b5051919050565b81810381811115610b0757610b076154b0565b8082028115828204841417610b0757610b076154b0565b60008261556857634e487b7160e01b600052601260045260246000fd5b500490565b6000835161557f818460208801614cdb565b835190830190615593818360208801614cdb565b01949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6000606082840312156155f357600080fd5b604051606081016001600160401b03828210818311171561561657615616614e44565b816040528293508435835260208501356020840152604085013591508082111561563f57600080fd5b5061564c85828601614f9d565b6040830152505092915050565b600081830361014081121561566d57600080fd5b615675614e5a565b9150823561568281614d57565b825260e0601f198201121561569657600080fd5b5061569f614e82565b60208301356156ad81614d57565b815260408301356156bd81614d57565b602082015260608301356156d081614d57565b604082015260808301356156e381614d57565b8060608301525060a0830135608082015260c083013560a082015260e083013560c0820152806020830152506101008201356001600160401b038082111561572a57600080fd5b615736858386016152b1565b604084015261012084013591508082111561575057600080fd5b5061575d848285016152b1565b60608301525092915050565b60006080823603121561577b57600080fd5b615783614e5a565b8235815260208301356001600160401b03808211156157a157600080fd5b8185019150608082360312156157b657600080fd5b6157be614e5a565b82356157c981614d57565b8082525060208301356020820152604083013560408201526060830135828111156157f357600080fd5b6157ff36828601614f9d565b6060830152506020840152604085013591508082111561581e57600080fd5b61582a368387016155e1565b6040840152606085013591508082111561584357600080fd5b5061575d36828601615659565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000602082840312156158b457600080fd5b8151611ffc81615107565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516158f7816017850160208801614cdb565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615928816028840160208801614cdb565b01602801949350505050565b60018060a01b0385168152836020820152826040820152608060608201526000612bde6080830184615045565b83815282602082015260606040820152600061178e6060830184615045565b600061014060018060a01b03808816845280875116602085015280602088015116604085015280604088015116606085015280606088015116608085015250608086015160a084015260a086015160c084015260c086015160e0840152806101008401526159f081840186614cff565b9050828103610120840152614a668185614cff565b60008060408385031215615a1857600080fd5b505080516020909101519092909150565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612bde90830184614cff565b600060208284031215615a6e57600080fd5b8151611ffc81614ca8565b600081615a8857615a886154b0565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251615ab8818460208701614cdb565b919091019291505056fe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a264697066735822122004933e9503cd5ddfcfbceeb52eb93014398360c56233e3cc6863a2ac0e8b835864736f6c6343000811003300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001a4d415449432041746c616e746963205374726164646c65205632000000000000000000000000000000000000000000000000000000000000000000000000001a4d415449432d41544c414e5449432d5354524144444c452d5632000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103e65760003560e01c806370a082311161020a578063acc3a00611610125578063da0321cd116100b8578063ec87621c11610087578063ec87621c14610a55578063ee0d82c114610a6a578063ef2bb7e214610ab9578063f9aa6e0f14610acc578063ffe8e3721461048e57600080fd5b8063da0321cd14610963578063de40e873146109f3578063de8b007a14610a06578063e985e9c514610a1957600080fd5b8063c3d9ed39116100f4578063c3d9ed39146108c9578063c87b56dd146108dc578063d547741f146108ef578063d966e18f1461090257600080fd5b8063acc3a00614610890578063b88d4fde146108a3578063c1419def1461048e578063c189c19b146108b657600080fd5b80638df828001161019d5780639ce990ea1161016c5780639ce990ea1461084f578063a217fddf14610862578063a22cb4651461086a578063a7de2a0d1461087d57600080fd5b80638df82800146107cc57806390bb5855146107df57806391d148541461083457806395d89b411461084757600080fd5b806379271130116101d9578063792711301461078b5780637c4b52cb1461079e57806380ed71e4146107b15780638456cb59146107c457600080fd5b806370a082311461074957806372cadb901461075c57806375153f3e1461076f578063766718081461078257600080fd5b8063391feebb116103055780635387b84c116102985780636352211e116102675780636352211e1461062657806366a1d0e7146106395780636c1085a1146106675780636db29f6d1461067a5780636e821b2e1461068257600080fd5b80635387b84c146105ef57806354545bfb14610602578063562b98d8146106105780635c975abb1461061b57600080fd5b806342842e0e116102d457806342842e0e146105b1578063468f02d2146105c45780634c3ea057146105cc5780634f6ccce7146105dc57600080fd5b8063391feebb146105535780633dbb196d146105765780633ec21260146105965780633f4ba83a146105a957600080fd5b8063248a9ca31161037d578063306b8ac21161034c578063306b8ac214610507578063337847b21461051a57806336568abe1461052d5780633686a39e1461054057600080fd5b8063248a9ca3146104ab5780632e1a7d4d146104ce5780632f2ff15d146104e15780632f745c59146104f457600080fd5b806316279055116103b9578063162790551461046857806318160ddd1461047c5780631ea30fef1461048e57806323b872dd1461049857600080fd5b806301ffc9a7146103eb57806306fdde0314610413578063081812fc14610428578063095ea7b314610453575b600080fd5b6103fe6103f9366004614cbe565b610afc565b60405190151581526020015b60405180910390f35b61041b610b0d565b60405161040a9190614d2b565b61043b610436366004614d3e565b610b9f565b6040516001600160a01b03909116815260200161040a565b610466610461366004614d77565b610bc6565b005b6103fe610476366004614da3565b3b151590565b6009545b60405190815260200161040a565b610480620f424081565b6104666104a6366004614dc0565b610ce0565b6104806104b9366004614d3e565b6000908152600b602052604090206001015490565b6104806104dc366004614d3e565b610d11565b6104666104ef366004614e01565b610eae565b610480610502366004614d77565b610ed3565b610466610515366004614e31565b610f69565b610466610528366004614ed4565b611039565b61046661053b366004614e01565b611187565b6103fe61054e366004614d3e565b611205565b6103fe610561366004614da3565b600d6020526000908152604090205460ff1681565b610589610584366004615011565b611388565b60405161040a9190615080565b6105896105a4366004614da3565b61142a565b610466611535565b6104666105bf366004614dc0565b61154b565b610480611566565b61048068056bc75e2d6310000081565b6104806105ea366004614d3e565b6115d9565b6104806105fd366004614d3e565b61166c565b610480662386f26fc1000081565b6104806301e1338081565b600c5460ff166103fe565b61043b610634366004614d3e565b611797565b61064c6106473660046150a5565b6117f7565b6040805193845260208401929092529082015260600161040a565b610466610675366004614d3e565b611ca3565b610466611d51565b6106f0610690366004614d3e565b601860205280600052604060002060009150905080600001549080600101549080600201549080600301549080600401549080600501549080600601549080600701549080600801549080600901549080600a01549080600b015490508c565b604080519c8d5260208d019b909b52998b019890985260608a0196909652608089019490945260a088019290925260c087015260e08601526101008501526101208401526101408301526101608201526101800161040a565b610480610757366004614da3565b611e58565b61046661076a366004615115565b611ede565b61048061077d366004614d3e565b611f78565b610480600f5481565b610589610799366004614da3565b612003565b6104666107ac366004615157565b612105565b6104806107bf3660046151d1565b612212565b610466612379565b6104806107da366004614d3e565b61238c565b6108146107ed366004614d3e565b601b6020526000908152604090208054600182015460028301546003909301549192909184565b60408051948552602085019390935291830152606082015260800161040a565b6103fe610842366004614e01565b6125ef565b61041b61261a565b61048061085d366004615208565b612629565b610480600081565b610466610878366004615234565b61268b565b61048061088b366004615262565b612696565b61046661089e366004614da3565b6129d1565b6104666108b1366004615320565b6129e5565b6104806108c4366004614d3e565b612a1d565b6104666108d7366004614da3565b612a8b565b61041b6108ea366004614d3e565b612a9f565b6104666108fd366004614e01565b612b12565b601c54601d54601e54601f54602054602154602254602354610928979695949392919088565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c083015260e08201526101000161040a565b6010546011546012546013546014546015546016546017546109a1976001600160a01b03908116978116968116958116948116938116928116911688565b604080516001600160a01b03998a16815297891660208901529588169587019590955292861660608601529085166080850152841660a0840152831660c083015290911660e08201526101000161040a565b610480610a0136600461537f565b612b37565b610589610a14366004615011565b612be8565b6103fe610a273660046153c3565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b610480600080516020615ac383398151915281565b610a9c610a78366004614d3e565b601a6020526000908152604090208054600182015460029092015490919060ff1683565b60408051938452602084019290925215159082015260600161040a565b610480610ac7366004614d3e565b612c83565b610aef610ada366004614d3e565b60196020526000908152604090205460ff1681565b60405161040a9190615407565b6000610b0782612f6c565b92915050565b606060018054610b1c9061542f565b80601f0160208091040260200160405190810160405280929190818152602001828054610b489061542f565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b6000610baa82612f91565b506000908152600560205260409020546001600160a01b031690565b6000610bd182611797565b9050806001600160a01b0316836001600160a01b031603610c435760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610c5f5750610c5f8133610a27565b610cd15760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610c3a565b610cdb8383612ff0565b505050565b610cea338261305e565b610d065760405162461bcd60e51b8152600401610c3a90615463565b610cdb8383836130dc565b6000610d1b61324d565b610d23613295565b610d2b6132ee565b610d4933610d3884611797565b6001600160a01b0316146005613354565b6000828152601a60209081526040918290208251606081018452815480825260018301549382019390935260029182015460ff16151593810193909352610d9291151590613354565b610dc560025b825160009081526019602052604090205460ff166003811115610dbd57610dbd6153f1565b146003613354565b610dce83611f78565b60175460405163379607f560e01b8152600481018690529193506001600160a01b03169063379607f590602401600060405180830381600087803b158015610e1557600080fd5b505af1158015610e29573d6000803e3d6000fd5b50505050610e3683613378565b610e438215156004613354565b601054610e5a906001600160a01b0316338461341b565b80516040805191825260208201859052810183905233907fb0ecf14e184effded5473bba77dcfab32b094b77ac1fbb36beec2aef555879709060600160405180910390a250610ea96001600055565b919050565b6000828152600b6020526040902060010154610ec98161347e565b610cdb8383613488565b6000610ede83611e58565b8210610f405760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c3a565b506001600160a01b03919091166000908152600760209081526040808320938352929052205490565b6000610f748161347e565b8135601c908155602080840135601d556040840135601e556060840135601f556080840135905560a083013560215560c083013560225560e0830135602355829050506040805183358152602080850135908201528184013591810191909152606080840135908201526080808401359082015260a0808401359082015260c0808401359082015260e080840135908201527fe90df7b8aa72d1a01765ac1d8aca43d7602c0d8d0c5920a7dde72d3761a148ee90610100015b60405180910390a15050565b60006110448161347e565b8151601080546001600160a01b03199081166001600160a01b039384161790915560208401516011805483169184169190911790556040808501516012805484169185169190911790556060850151601380548416918516919091179055608085015160148054841691851691909117905560a085015160158054841691851691909117905560c085015160168054841691851691909117905560e0850151601780549093169316929092179055517fefec2a608e6651b7f9dc06efa56139088896e798f1c1055a373672640d37e4b49061102d90849081516001600160a01b03908116825260208084015182169083015260408084015182169083015260608084015182169083015260808084015182169083015260a08084015182169083015260c08084015182169083015260e09283015116918101919091526101000190565b6001600160a01b03811633146111f75760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c3a565b611201828261350e565b5050565b600061120f61324d565b600080516020615ac38339815191526112278161347e565b6000600f54600161123891906154c6565b9050611247844210600e613354565b6112766000808381526019602052604090205460ff16600381111561126e5761126e6153f1565b14600f613354565b600f54156112b1576112b16002600f5460009081526019602052604090205460ff1660038111156112a9576112a96153f1565b146010613354565b60008181526018602090815260408083204281556001908101889055601990925291829020805460ff19169091179055600f8290556017549051631b4351cf60e11b8152600481018390526001600160a01b0390911690633686a39e90602401600060405180830381600087803b15801561132b57600080fd5b505af115801561133f573d6000803e3d6000fd5b505050507fb5ca1ca1b7b47549eb8af476f3ef702fc63bcd8b8c01dc163b009bb818f979978160405161137491815260200190565b60405180910390a160019250505b50919050565b8051606090806001600160401b038111156113a5576113a5614e44565b6040519080825280602002602001820160405280156113ce578160200160208202803683370190505b50915060005b81811015611423576113fe8482815181106113f1576113f16154d9565b602002602001015161238c565b838281518110611410576114106154d9565b60209081029190910101526001016113d4565b5050919050565b6060600061143783611e58565b90506000805b8281101561147d5760006114518683610ed3565b6000818152601b60205260409020549091501561147457611471836154ef565b92505b5060010161143d565b50806001600160401b0381111561149657611496614e44565b6040519080825280602002602001820160405280156114bf578160200160208202803683370190505b5092506000805b8282101561152c5760006114da8783610ed3565b6000818152601b60205260409020549091501561151b5780868481518110611504576115046154d9565b6020908102919091010152611518836154ef565b92505b611524826154ef565b9150506114c6565b50505050919050565b60006115408161347e565b611548613575565b50565b610cdb838383604051806020016040528060008152506129e5565b60125460408051632347816960e11b815290516000926001600160a01b03169163468f02d29160048083019260209291908290030181865afa1580156115b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d49190615508565b905090565b60006115e460095490565b82106116475760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c3a565b6009828154811061165a5761165a6154d9565b90600052602060002001549050919050565b6000818152601b6020908152604080832081516080810183528154808252600183015494820194909452600280830154938201939093526003909101546060820152916116bc9190151590613354565b8051600090815260186020526040908190206004015490820151818111156117245760208301516116ed8383615521565b6116f79190615534565b60608401519094506117098383615521565b6117139190615534565b61171d9085615521565b935061174a565b60608301516117338284615521565b61173d9190615534565b61174790856154c6565b93505b61175d68056bc75e2d631000008561554b565b935061176d620f42406064615534565b60215461177a9086615534565b611784919061554b565b61178e9085615521565b95945050505050565b6000818152600360205260408120546001600160a01b031680610b075760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c3a565b600080600061180461324d565b61180c613295565b6118146132ee565b6118246000600f54116006613354565b611838662386f26fc1000088116000613354565b602354600f546000908152601860205260409020600101546118669161185d91615521565b42106007613354565b6000611870611566565b90506118e468056bc75e2d631000006118898a84615534565b611893919061554b565b600f546000908152601860205260409020600301546118bc9068056bc75e2d631000009061554b565b600f546000908152601860205260409020600201546118db9190615521565b10156008613354565b600061191968056bc75e2d6310000060026118ff8c86615534565b611909919061554b565b611913919061554b565b876135c7565b9050611929888210156009613354565b6000611936826002615534565b6119408b85615534565b61194a919061554b565b905061195681846137f2565b600f546000908152601860205260408120600601805484929061197a9084906154c6565b9091555061198b9050826002615534565b6119959082615534565b600f54600090815260186020526040812060030180549091906119b99084906154c6565b90915550600090506119ed600183806119d3876002615534565b600f54600090815260186020526040902060010154612b37565b90506000611a2083611a00866002615534565b600f5460009081526018602052604090206001015461085d904290615521565b90508160186000600f5481526020019081526020016000206007016000828254611a4a91906154c6565b9091555050600f5460009081526018602052604081206008018054839290611a739084906154c6565b90915550611a849050846002615534565b600f5460009081526018602052604081206009018054909190611aa89084906154c6565b9091555050600f546000908152601860205260408120600a01805460019290611ad29084906154c6565b90915550611ae190508a613849565b97506040518060800160405280600f548152602001856002611b039190615534565b81526020808201869052604091820187905260008b8152601b825282902083518155908301516001820155908201516002820155606090910151600390910155611b5968056bc75e2d63100000620f4240615534565b611b64906064615534565b601c54611b71878f615534565b611b7b9190615534565b611b85919061554b565b965068056bc75e2d63100000611b9b82846154c6565b611ba5919061554b565b9550611bca3330611bb68a8a6154c6565b6010546001600160a01b031692919061386e565b601554601054611be7916001600160a01b0391821691168961341b565b68056bc75e2d63100000611bfb82846154c6565b611c05919061554b565b600f546000908152601860205260408120600b018054909190611c299084906154c6565b9091555050600f547f9d507133ca47d3afd7d870243115c9867ea2325ba4c3014950405d35dae67cd6908b8a611c5f85876154c6565b604080519485526001600160a01b03909316602085015291830152606082015260800160405180910390a15050505050611c996001600055565b9450945094915050565b611cab61324d565b611cb3613295565b611cbb6132ee565b611cc833610d3883611797565b6000818152601a6020526040902054611ce49015156002613354565b6000818152601a6020908152604091829020600201805460ff8082161560ff199092168217909255835185815291161515918101919091527fb5e95d468eadd79446f495b23ddf06bb55ff5717a821eb2cc57154a31cd5ee22910160405180910390a16115486001600055565b611d5961324d565b600080516020615ac3833981519152611d718161347e565b600f54600090815260186020526040902060010154611d94904210156011613354565b611dc76003600f5460009081526019602052604090205460ff166003811115611dbf57611dbf6153f1565b14600a613354565b600f546000908152601860205260408120600a01549003611e0357600f546000908152601960205260409020805460ff19166002179055611e22565b6040516001623cd50760e01b0319815260156004820152602401610c3a565b6040513381527f6a4de20bb9fa8fea199f1022f29eff6be1752c446674d16913f2afc2b3c5a8a59060200160405180910390a150565b60006001600160a01b038216611ec25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610c3a565b506001600160a01b031660009081526004602052604090205490565b6000611ee98161347e565b8115611f0e57601654611f09906001600160a01b038681169116856138a6565b611f28565b601654611f28906001600160a01b03868116911685613958565b604080516001600160a01b0386168152602081018590528315158183015290517f2482ddca0c9600e77de3f9629ffa0660a0104e6e45a24b21de67c69d5b35fe849181900360600190a150505050565b6000818152601a602090815260408083208151606081018352815480825260018301549482019490945260029182015460ff161515928101929092529091611fc39190151590613354565b8051600090815260186020908152604080832060020154845184529220600b015490830151611ff29190615534565b611ffc919061554b565b9392505050565b6060600061201083611e58565b90506000805b8281101561205657600061202a8683610ed3565b6000818152601a60205260409020549091501561204d5761204a836154ef565b92505b50600101612016565b50806001600160401b0381111561206f5761206f614e44565b604051908082528060200260200182016040528015612098578160200160208202803683370190505b5092506000805b8282101561152c5760006120b38783610ed3565b6000818152601a6020526040902054909150156120f457808684815181106120dd576120dd6154d9565b60209081029190910101526120f1836154ef565b92505b6120fd826154ef565b91505061209f565b60006121108161347e565b612118613a64565b811561214c5760405133904780156108fc02916000818181858888f1935050505015801561214a573d6000803e3d6000fd5b505b60005b8381101561220b57600085858381811061216b5761216b6154d9565b90506020020160208101906121809190614da3565b6040516370a0823160e01b81523060048201529091506122029033906001600160a01b038416906370a0823190602401602060405180830381865afa1580156121cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f19190615508565b6001600160a01b038416919061341b565b5060010161214f565b5050505050565b600061221c61324d565b612224613295565b61222c6132ee565b61223c620f424085116000613354565b6000600f54600161224d91906154c6565b90508460186000838152602001908152602001600020600201600082825461227591906154c6565b90915550506000818152601860205260408120600b01805487929061229b9084906154c6565b909155506122aa905083613849565b6040805160608101825283815260208082018981528815158385019081526000868152601a909352939091209151825551600182015590516002909101805460ff1916911515919091179055601054909250612311906001600160a01b031633308861386e565b6040805182815260208101879052851515818301526001600160a01b038516606082015233608082015260a0810184905290517f14c0e56f4125d5707194bbf1beff49bb39b170a0f49574bcf25d8616f4df1cf69181900360c00190a150611ffc6001600055565b60006123848161347e565b611548613aad565b600061239661324d565b61239e613295565b6123a66132ee565b6000828152601b602090815260409182902082516080810184528154808252600183015493820193909352600280830154948201949094526003909101546060820152916123f691151590613354565b6124206003825160009081526019602052604090205460ff166003811115611dbf57611dbf6153f1565b600061242b8461166c565b9050600061243885611797565b905061244385613378565b612450821515600b613354565b6000612460620f42406064615534565b601d5461246d9085615534565b612477919061554b565b905060006001600160a01b03831633146124c457612499620f42406064615534565b601e546124a69086615534565b6124b0919061554b565b90506124c181601c60030154613aea565b90505b6124ce81836154c6565b6124d89085615521565b85516000908152601860205260408120600a018054929650600192909190612501908490615521565b9091555081905061251283866154c6565b61251c91906154c6565b85516000908152601860205260408120600b01805490919061253f908490615521565b9091555050601554601054612561916001600160a01b0391821691168461341b565b601054612578906001600160a01b0316848661341b565b60105461258f906001600160a01b0316338361341b565b8451604080519182526020820189905281018590526001600160a01b0384169033907f5c6a917207417d39f68f90bcada5466a46efe20df97c2ac0046789b071b135ca9060600160405180910390a350919350505050610ea96001600055565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060028054610b1c9061542f565b600060026064612640620f42406301e13380615534565b60205486908690612651908a615534565b61265b9190615534565b6126659190615534565b61266f919061554b565b612679919061554b565b612683919061554b565b949350505050565b611201338383613b00565b60006126a061324d565b600080516020615ac38339815191526126b88161347e565b600f546000908152601860209081526040918290208251610180810184528154815260018201549281018390526002820154938101939093526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e084015260088101546101008401526009810154610120840152600a810154610140840152600b015461016083015261275c904210156011613354565b61278f6001600f5460009081526019602052604090205460ff166003811115612787576127876153f1565b146012613354565b60c0810151600090156128df576127a68786613bce565b935060006127b2611566565b90506000886127c987670de0b6b3a7640000615534565b6127d4906064615534565b6127de919061554b565b90506127ea81836137f2565b6127f8888710156013613354565b6128198460c001518a8660a0015161281091906154c6565b11156014613354565b600f546000908152601860205260408120600b01805488929061283d9084906154c6565b90915550600090508961285968056bc75e2d6310000089615534565b612863919061554b565b9050898560a0015161287591906154c6565b61287f8b83615534565b8660a0015187608001516128939190615534565b61289d91906154c6565b6128a7919061554b565b93508960186000600f54815260200190815260200160002060050160008282546128d191906154c6565b909155506128ea9350505050565b6128e7611566565b90505b600f54600090815260186020526040812060040154900361292157600f546000908152601860205260409020600401819055612956565b600f546000908152601860205260409020600401546129409082613aea565b600f546000908152601860205260409020600401555b600f54600090815260186020526040902060068101546005909101540361299457600f546000908152601960205260409020805460ff191660031790555b6040513381527fe299059e3adc918e4f4ab456527f6220987ed7fce29c2bc9a416f9336822bdd29060200160405180910390a15050509392505050565b60006129dc8161347e565b61120182613cc4565b6129ef338361305e565b612a0b5760405162461bcd60e51b8152600401610c3a90615463565b612a1784848484613dc7565b50505050565b60135460405163c189c19b60e01b8152600481018390526000916001600160a01b03169063c189c19b90602401602060405180830381865afa158015612a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b079190615508565b6000612a968161347e565b61120182613dfa565b6060612aaa82612f91565b6000612ac160408051602081019091526000815290565b90506000815111612ae15760405180602001604052806000815250611ffc565b80612aeb84613eab565b604051602001612afc92919061556d565b6040516020818303038152906040529392505050565b6000828152600b6020526040902060010154612b2d8161347e565b610cdb838361350e565b60145460009083906001600160a01b0316635b7b6d888885888a612b5a82612a1d565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a401602060405180830381865afa158015612bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd49190615508565b612bde9190615534565b9695505050505050565b8051606090806001600160401b03811115612c0557612c05614e44565b604051908082528060200260200182016040528015612c2e578160200160208202803683370190505b50915060005b8181101561142357612c5e848281518110612c5157612c516154d9565b6020026020010151612c83565b838281518110612c7057612c706154d9565b6020908102919091010152600101612c34565b6000612c8d61324d565b612c95613295565b612c9d6132ee565b6000828152601a60209081526040918290208251606081018452815481526001808301549382019390935260029091015460ff16151592810183905291612ce391613354565b8051612cf29015156002613354565b612cfc6002610d98565b6000612d0784611f78565b90506000612d1485611797565b60175460405163379607f560e01b8152600481018890529192506001600160a01b03169063379607f590602401600060405180830381600087803b158015612d5b57600080fd5b505af1158015612d6f573d6000803e3d6000fd5b50505050612d7c85613378565b612d898215156004613354565b60006001600160a01b0382163314612dd457612da9620f42406064615534565b601e54612db69085615534565b612dc0919061554b565b9050612dd181601c60030154613aea565b90505b612dde8184615521565b8451604080519182526020820189905281018290529093506001600160a01b038316907fb0ecf14e184effded5473bba77dcfab32b094b77ac1fbb36beec2aef555879709060600160405180910390a26000600f546001612e3f91906154c6565b905083601860008381526020019081526020016000206002016000828254612e6791906154c6565b90915550506000818152601860205260408120600b018054869290612e8d9084906154c6565b90915550612e9c905083613849565b60408051606081018252838152602080820188815260018385018181526000878152601a9094529490922092518355519082015590516002909101805460ff1916911515919091179055601054909650612f00906001600160a01b0316338461341b565b60408051828152602081018690526001818301526001600160a01b03851660608201819052608082015260a0810188905290517f14c0e56f4125d5707194bbf1beff49bb39b170a0f49574bcf25d8616f4df1cf69181900360c00190a15050505050610ea96001600055565b60006001600160e01b03198216637965db0b60e01b1480610b075750610b0782613f3d565b6000818152600360205260409020546001600160a01b03166115485760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c3a565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061302582611797565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061306a83611797565b9050806001600160a01b0316846001600160a01b031614806130b157506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b806126835750836001600160a01b03166130ca84610b9f565b6001600160a01b031614949350505050565b826001600160a01b03166130ef82611797565b6001600160a01b0316146131155760405162461bcd60e51b8152600401610c3a9061559c565b6001600160a01b0382166131775760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c3a565b6131848383836001613f62565b826001600160a01b031661319782611797565b6001600160a01b0316146131bd5760405162461bcd60e51b8152600401610c3a9061559c565b600081815260056020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260048552838620805460001901905590871680865283862080546001019055868652600390945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600c5460ff16156132935760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610c3a565b565b6002600054036132e75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c3a565b6002600055565b33321461329357336000908152600d602052604090205460ff166132935760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c6973746564000000006044820152606401610c3a565b81611201576040516001623cd50760e01b0319815260048101829052602401610c3a565b600061338382611797565b9050613393816000846001613f62565b61339c82611797565b600083815260056020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526004845282852080546000190190558785526003909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6040516001600160a01b038316602482015260448101829052610cdb90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613f6e565b6115488133614040565b61349282826125ef565b611201576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134ca3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61351882826125ef565b15611201576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61357d613a64565b600c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6011546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa158015613614573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136389190615508565b6010546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015613686573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136aa9190615508565b90506136be856136b986615769565b614099565b6010546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015613707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061372b9190615508565b6137359083615521565b6011546040516370a0823160e01b815230600482015291925084916001600160a01b03909116906370a0823190602401602060405180830381865afa158015613782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a69190615508565b6137b09190615521565b93506137bf818714600d613354565b600f546000908152601860205260408120600b0180548392906137e3908490615521565b90915550939695505050505050565b600081831161380a576138058383615521565b613814565b6138148284615521565b602254909150610cdb908361382d6064620f424061554b565b6138379085615534565b613841919061554b565b10600c613354565b6000613854600e5490565b9050613864600e80546001019055565b610ea98282614213565b6040516001600160a01b0380851660248301528316604482015260648101829052612a179085906323b872dd60e01b90608401613447565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156138f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061391b9190615508565b61392591906154c6565b6040516001600160a01b038516602482015260448101829052909150612a1790859063095ea7b360e01b90606401613447565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156139a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139cc9190615508565b905081811015613a305760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b6064820152608401610c3a565b6040516001600160a01b0384166024820152828203604482018190529061220b90869063095ea7b360e01b90606401613447565b600c5460ff166132935760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c3a565b613ab561324d565b600c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135aa3390565b6000818310613af95781611ffc565b5090919050565b816001600160a01b0316836001600160a01b031603613b615760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c3a565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6010546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa158015613c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c3f9190615508565b9050613c4e846136b985615769565b6010546040516370a0823160e01b815230600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa158015613c96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cba9190615508565b6126839190615521565b803b613d125760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e74726163740000000000006044820152606401610c3a565b6001600160a01b0381166000908152600d602052604090205460ff1615613d7b5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c6973746564000000006044820152606401610c3a565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b613dd28484846130dc565b613dde8484848461422d565b612a175760405162461bcd60e51b8152600401610c3a90615850565b6001600160a01b0381166000908152600d602052604090205460ff16613e625760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c697374656400000000000000006044820152606401610c3a565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b60606000613eb88361432e565b60010190506000816001600160401b03811115613ed757613ed7614e44565b6040519080825280601f01601f191660200182016040528015613f01576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613f0b57509392505050565b60006001600160e01b0319821663780e9d6360e01b1480610b075750610b0782614406565b612a1784848484614456565b6000613fc3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661458f9092919063ffffffff16565b805190915015610cdb5780806020019051810190613fe191906158a2565b610cdb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c3a565b61404a82826125ef565b611201576140578161459e565b6140628360206145b0565b6040516020016140739291906158bf565b60408051601f198184030181529082905262461bcd60e51b8252610c3a91600401614d2b565b805160000361412857601654602082015180516040808301516060909301519051630502b1c560e01b81526001600160a01b0390941693630502b1c5936140e593928892600401615934565b6020604051808303816000875af1158015614104573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdb9190615508565b8051600103614172576016546040808301516020810151908201519151637224811760e11b81526001600160a01b039093169263e449022e926140e5928792909190600401615961565b805160020361120157606080820180516020908101516080018590526016549151805191810151604080830151929095015194516312aa3caf60e01b81526001600160a01b03909416946312aa3caf946141d194939190600401615980565b60408051808303816000875af11580156141ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a179190615a05565b61120182826040518060200160405280600081525061474b565b60006001600160a01b0384163b1561432357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614271903390899088908890600401615a29565b6020604051808303816000875af19250505080156142ac575060408051601f3d908101601f191682019092526142a991810190615a5c565b60015b614309573d8080156142da576040519150601f19603f3d011682016040523d82523d6000602084013e6142df565b606091505b5080516000036143015760405162461bcd60e51b8152600401610c3a90615850565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612683565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061436d5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310614399576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106143b757662386f26fc10000830492506010015b6305f5e10083106143cf576305f5e100830492506008015b61271083106143e357612710830492506004015b606483106143f5576064830492506002015b600a8310610b075760010192915050565b60006001600160e01b031982166380ac58cd60e01b148061443757506001600160e01b03198216635b5e139f60e01b145b80610b0757506301ffc9a760e01b6001600160e01b0319831614610b07565b6144628484848461477e565b60018111156144d15760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610c3a565b816001600160a01b03851661452d5761452881600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b614550565b836001600160a01b0316856001600160a01b031614614550576145508582614806565b6001600160a01b03841661456c57614567816148a3565b61220b565b846001600160a01b0316846001600160a01b03161461220b5761220b8482614952565b60606126838484600085614996565b6060610b076001600160a01b03831660145b606060006145bf836002615534565b6145ca9060026154c6565b6001600160401b038111156145e1576145e1614e44565b6040519080825280601f01601f19166020018201604052801561460b576020820181803683370190505b509050600360fc1b81600081518110614626576146266154d9565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614655576146556154d9565b60200101906001600160f81b031916908160001a9053506000614679846002615534565b6146849060016154c6565b90505b60018111156146fc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106146b8576146b86154d9565b1a60f81b8282815181106146ce576146ce6154d9565b60200101906001600160f81b031916908160001a90535060049490941c936146f581615a79565b9050614687565b508315611ffc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c3a565b6147558383614a71565b614762600084848461422d565b610cdb5760405162461bcd60e51b8152600401610c3a90615850565b6001811115612a17576001600160a01b038416156147c4576001600160a01b038416600090815260046020526040812080548392906147be908490615521565b90915550505b6001600160a01b03831615612a17576001600160a01b038316600090815260046020526040812080548392906147fb9084906154c6565b909155505050505050565b6000600161481384611e58565b61481d9190615521565b600083815260086020526040902054909150808214614870576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b5060009182526008602090815260408084208490556001600160a01b039094168352600781528383209183525290812055565b6009546000906148b590600190615521565b6000838152600a6020526040812054600980549394509092849081106148dd576148dd6154d9565b9060005260206000200154905080600983815481106148fe576148fe6154d9565b6000918252602080832090910192909255828152600a9091526040808220849055858252812055600980548061493657614936615a90565b6001900381819060005260206000200160009055905550505050565b600061495d83611e58565b6001600160a01b039093166000908152600760209081526040808320868452825280832085905593825260089052919091209190915550565b6060824710156149f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c3a565b600080866001600160a01b03168587604051614a139190615aa6565b60006040518083038185875af1925050503d8060008114614a50576040519150601f19603f3d011682016040523d82523d6000602084013e614a55565b606091505b5091509150614a6687838387614c0a565b979650505050505050565b6001600160a01b038216614ac75760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c3a565b6000818152600360205260409020546001600160a01b031615614b2c5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c3a565b614b3a600083836001613f62565b6000818152600360205260409020546001600160a01b031615614b9f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c3a565b6001600160a01b038216600081815260046020908152604080832080546001019055848352600390915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315614c79578251600003614c72576001600160a01b0385163b614c725760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c3a565b5081612683565b6126838383815115614c8e5781518083602001fd5b8060405162461bcd60e51b8152600401610c3a9190614d2b565b6001600160e01b03198116811461154857600080fd5b600060208284031215614cd057600080fd5b8135611ffc81614ca8565b60005b83811015614cf6578181015183820152602001614cde565b50506000910152565b60008151808452614d17816020860160208601614cdb565b601f01601f19169290920160200192915050565b602081526000611ffc6020830184614cff565b600060208284031215614d5057600080fd5b5035919050565b6001600160a01b038116811461154857600080fd5b8035610ea981614d57565b60008060408385031215614d8a57600080fd5b8235614d9581614d57565b946020939093013593505050565b600060208284031215614db557600080fd5b8135611ffc81614d57565b600080600060608486031215614dd557600080fd5b8335614de081614d57565b92506020840135614df081614d57565b929592945050506040919091013590565b60008060408385031215614e1457600080fd5b823591506020830135614e2681614d57565b809150509250929050565b6000610100828403121561138257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b0381118282101715614e7c57614e7c614e44565b60405290565b60405160e081016001600160401b0381118282101715614e7c57614e7c614e44565b604051601f8201601f191681016001600160401b0381118282101715614ecc57614ecc614e44565b604052919050565b6000610100808385031215614ee857600080fd5b604051908101906001600160401b0382118183101715614f0a57614f0a614e44565b8160405283359150614f1b82614d57565b818152614f2a60208501614d6c565b6020820152614f3b60408501614d6c565b6040820152614f4c60608501614d6c565b6060820152614f5d60808501614d6c565b6080820152614f6e60a08501614d6c565b60a0820152614f7f60c08501614d6c565b60c0820152614f9060e08501614d6c565b60e0820152949350505050565b600082601f830112614fae57600080fd5b813560206001600160401b03821115614fc957614fc9614e44565b8160051b614fd8828201614ea4565b9283528481018201928281019087851115614ff257600080fd5b83870192505b84831015614a6657823582529183019190830190614ff8565b60006020828403121561502357600080fd5b81356001600160401b0381111561503957600080fd5b61268384828501614f9d565b600081518084526020808501945080840160005b8381101561507557815187529582019590820190600101615059565b509495945050505050565b602081526000611ffc6020830184615045565b60006080828403121561138257600080fd5b600080600080608085870312156150bb57600080fd5b843593506020850135925060408501356150d481614d57565b915060608501356001600160401b038111156150ef57600080fd5b6150fb87828801615093565b91505092959194509250565b801515811461154857600080fd5b60008060006060848603121561512a57600080fd5b833561513581614d57565b925060208401359150604084013561514c81615107565b809150509250925092565b60008060006040848603121561516c57600080fd5b83356001600160401b038082111561518357600080fd5b818601915086601f83011261519757600080fd5b8135818111156151a657600080fd5b8760208260051b85010111156151bb57600080fd5b6020928301955093505084013561514c81615107565b6000806000606084860312156151e657600080fd5b8335925060208401356151f881615107565b9150604084013561514c81614d57565b60008060006060848603121561521d57600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561524757600080fd5b823561525281614d57565b91506020830135614e2681615107565b60008060006060848603121561527757600080fd5b833592506020840135915060408401356001600160401b0381111561529b57600080fd5b6152a786828701615093565b9150509250925092565b600082601f8301126152c257600080fd5b81356001600160401b038111156152db576152db614e44565b6152ee601f8201601f1916602001614ea4565b81815284602083860101111561530357600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561533657600080fd5b843561534181614d57565b9350602085013561535181614d57565b92506040850135915060608501356001600160401b0381111561537357600080fd5b6150fb878288016152b1565b600080600080600060a0868803121561539757600080fd5b85356153a281615107565b97602087013597506040870135966060810135965060800135945092505050565b600080604083850312156153d657600080fd5b82356153e181614d57565b91506020830135614e2681614d57565b634e487b7160e01b600052602160045260246000fd5b602081016004831061542957634e487b7160e01b600052602160045260246000fd5b91905290565b600181811c9082168061544357607f821691505b60208210810361138257634e487b7160e01b600052602260045260246000fd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b0757610b076154b0565b634e487b7160e01b600052603260045260246000fd5b600060018201615501576155016154b0565b5060010190565b60006020828403121561551a57600080fd5b5051919050565b81810381811115610b0757610b076154b0565b8082028115828204841417610b0757610b076154b0565b60008261556857634e487b7160e01b600052601260045260246000fd5b500490565b6000835161557f818460208801614cdb565b835190830190615593818360208801614cdb565b01949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6000606082840312156155f357600080fd5b604051606081016001600160401b03828210818311171561561657615616614e44565b816040528293508435835260208501356020840152604085013591508082111561563f57600080fd5b5061564c85828601614f9d565b6040830152505092915050565b600081830361014081121561566d57600080fd5b615675614e5a565b9150823561568281614d57565b825260e0601f198201121561569657600080fd5b5061569f614e82565b60208301356156ad81614d57565b815260408301356156bd81614d57565b602082015260608301356156d081614d57565b604082015260808301356156e381614d57565b8060608301525060a0830135608082015260c083013560a082015260e083013560c0820152806020830152506101008201356001600160401b038082111561572a57600080fd5b615736858386016152b1565b604084015261012084013591508082111561575057600080fd5b5061575d848285016152b1565b60608301525092915050565b60006080823603121561577b57600080fd5b615783614e5a565b8235815260208301356001600160401b03808211156157a157600080fd5b8185019150608082360312156157b657600080fd5b6157be614e5a565b82356157c981614d57565b8082525060208301356020820152604083013560408201526060830135828111156157f357600080fd5b6157ff36828601614f9d565b6060830152506020840152604085013591508082111561581e57600080fd5b61582a368387016155e1565b6040840152606085013591508082111561584357600080fd5b5061575d36828601615659565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000602082840312156158b457600080fd5b8151611ffc81615107565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516158f7816017850160208801614cdb565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615928816028840160208801614cdb565b01602801949350505050565b60018060a01b0385168152836020820152826040820152608060608201526000612bde6080830184615045565b83815282602082015260606040820152600061178e6060830184615045565b600061014060018060a01b03808816845280875116602085015280602088015116604085015280604088015116606085015280606088015116608085015250608086015160a084015260a086015160c084015260c086015160e0840152806101008401526159f081840186614cff565b9050828103610120840152614a668185614cff565b60008060408385031215615a1857600080fd5b505080516020909101519092909150565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612bde90830184614cff565b600060208284031215615a6e57600080fd5b8151611ffc81614ca8565b600081615a8857615a886154b0565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251615ab8818460208701614cdb565b919091019291505056fe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a264697066735822122004933e9503cd5ddfcfbceeb52eb93014398360c56233e3cc6863a2ac0e8b835864736f6c63430008110033

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

00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001a4d415449432041746c616e746963205374726164646c65205632000000000000000000000000000000000000000000000000000000000000000000000000001a4d415449432d41544c414e5449432d5354524144444c452d5632000000000000

-----Decoded View---------------
Arg [0] : _name (string): MATIC Atlantic Straddle V2
Arg [1] : _symbol (string): MATIC-ATLANTIC-STRADDLE-V2

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 000000000000000000000000000000000000000000000000000000000000001a
Arg [3] : 4d415449432041746c616e746963205374726164646c65205632000000000000
Arg [4] : 000000000000000000000000000000000000000000000000000000000000001a
Arg [5] : 4d415449432d41544c414e5449432d5354524144444c452d5632000000000000


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.