ETH Price: $2,950.56 (-0.48%)

Token

ERC20 ***

Overview

Max Total Supply

1,307 ERC20 ***

Holders

1,113

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 ERC20 ***
0x23f562a7d671fb41ef3fbec4a0e982bfcfe8f285
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
AtlanticStraddle

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license
File 1 of 27 : AtlanticStraddle.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";
import {IAssetSwapper} from "./asset-swapper/IAssetSwapper.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 {IPositionMinter} from "./interface/IPositionMinter.sol";

// Atlantic straddles
// ==============
// - Accept stable deposits
// - Deposits can only happen for next epoch
// - Stables are always sold as ATM puts
// - Tokenize deposit as NFT
// - 3 day epochs, deposits auto-rollover unless deactivated
// - Withdrawal considers performance of pool since deposit
// - On purchase of Atlantic straddle, use 50% of AP collateral to purchase underlying asset
// - At expiry, settle by selling purchased underlying asset to return AP and AC collateral
contract AtlanticStraddle 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;

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

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

    // Contract addresses
    Addresses public addresses;

    // Total deposits for epoch
    mapping(uint256 => EpochData) public epochData;

    // Data for premium and funding collections for an epoch
    mapping(uint256 => EpochCollectionsData) public epochCollectionsData;

    // Is vault ready for the epoch i.e can purchases begin
    mapping(uint256 => bool) public isVaultReady;

    // Toggled to true after an epoch has been marked pre-expired
    mapping(uint256 => bool) public isEpochPreExpired;

    // Toggled to true after an epoch has been marked expired
    mapping(uint256 => bool) public isEpochExpired;

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

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

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

    // usdc decimals
    uint256 public constant USDC_DECIMALS = 1e6;

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

    // seconds a year
    uint256 internal constant SECONDS_A_YEAR = 365 days;

    // Purchase fee percent
    uint256 public purchaseFeePercent = 15e4;

    // Delegation fee
    uint256 public MAX_DELEGATION_FEE = 10 * USDC_DECIMALS;

    // Settlement fee percent
    uint256 public settlementFeePercent = 1e5;

    // AP funding percent
    uint256 public apFundingPercent = 36 * PERCENT_PRECISION;

    // Fee percent charged to owner, default to 0.1%
    uint256 public settleDelegationFeePercent = PERCENT_PRECISION / 10;

    // Purchase time limit variable to prevent last min buyouts
    uint256 public blackoutPeriodBeforeExpiry = 4 hours;

    // PnL slippage percent
    uint256 public pnlSlippagePercent = 5e5;

    uint256 internal constant AMOUNT_PRICE_TO_USDC_DECIMALS =
        (1e18 * 1e8) / 1e6;

    struct Addresses {
        // Stablecoin token (1e6 precision)
        address usd;
        // Underlying token
        address underlying;
        // Asset Swapper
        address assetSwapper;
        // Price Oracle
        address priceOracle;
        // Volatility Oracle
        address volatilityOracle;
        // Option Pricing
        address optionPricing;
        // Fee Distributor
        address feeDistributor;
    }

    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;
        // Percentage of total settlement executed
        uint256 settlementPercentage;
        // Amount of underlying assets purchased
        uint256 underlyingPurchased;
    }

    struct EpochCollectionsData {
        // 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 finalUsdBalanceBeforeWithdaw;
    }

    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;
    }

    event Bootstrap(uint256 epoch);

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

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

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

    event Withdraw(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 SetBlackoutPeriod(uint256 period);

    event SetApFunding(uint256 apFunding);

    event SetPnlSlippagePercent(uint256 pnlSlippagePercent);

    event SetFeePercents(
        uint256 purchaseFeePercent,
        uint256 settlementFeePercent,
        uint256 settleDelegationFeePercent
    );

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

    constructor(
        string memory _name,
        string memory _symbol,
        Addresses memory _addresses
    ) ERC721(_name, _symbol) {
        addresses = _addresses;

        IERC20(addresses.usd).safeIncreaseAllowance(
            addresses.assetSwapper,
            type(uint256).max
        );
        IERC20(addresses.underlying).safeIncreaseAllowance(
            addresses.assetSwapper,
            type(uint256).max
        );

        _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();
        require(amount > 0, "Cannot deposit 0 amount");
        uint256 nextEpoch = currentEpoch + 1;

        epochData[nextEpoch].usdDeposits += amount;
        epochCollectionsData[nextEpoch].finalUsdBalanceBeforeWithdaw += 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];

        require(writePos.rollover, "Rollover not authorized");
        require(writePos.epoch != 0, "Invalid write position");
        require(isEpochExpired[writePos.epoch], "Epoch has not expired");

        uint256 depositPlusPnl = calculateWritePositionPnl(id);

        address user = ownerOf(id);

        _burn(id);

        require(depositPlusPnl != 0, "Write position pnl is 0");

        emit Withdraw(user, id, depositPlusPnl);

        uint256 nextEpoch = currentEpoch + 1;

        epochData[nextEpoch].usdDeposits += depositPlusPnl;
        epochCollectionsData[nextEpoch]
            .finalUsdBalanceBeforeWithdaw += depositPlusPnl;

        tokenId = _mintPositionToken(user);

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

        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)
    {
        tokenIds = new uint256[](ids.length);
        for (uint256 i = 0; i < ids.length; i++) {
            tokenIds[i] = rollover(ids[i]);
        }
    }

    /// @dev Toggle rollover for a write position
    /// @param id Write position token ID
    function toggleRollover(uint256 id) external whenNotPaused nonReentrant {
        _isEligibleSender();
        require(ownerOf(id) == msg.sender, "Invalid owner");
        require(writePositions[id].epoch != 0, "Invalid position");
        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();
        require(ownerOf(id) == msg.sender, "Invalid owner");

        WritePosition memory writePos = writePositions[id];

        require(writePos.epoch != 0, "Invalid write position");
        require(isEpochExpired[writePos.epoch], "Settlements not done");

        writePositionPnl = calculateWritePositionPnl(id);

        _burn(id);

        require(writePositionPnl != 0, "Write position pnl is 0");

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

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

    /// @dev Purchase a straddle
    /// @param amount Approx. amount of straddles to purchase (10 ** 18)
    /// @param swapperId Swapper ID of the swap method to use
    /// @param user Address to purchase straddles for
    /// @return tokenId Straddle position token ID
    function purchase(
        uint256 amount,
        uint256 swapperId,
        address user
    ) external whenNotPaused nonReentrant returns (uint256 tokenId) {
        _isEligibleSender();
        require(currentEpoch > 0, "Invalid epoch");
        require(amount > MIN_PURCHASE_AMOUNT, "Invalid amount");
        require(
            block.timestamp <
                epochData[currentEpoch].expiry - blackoutPeriodBeforeExpiry,
            "Cannot purchase during blackout period"
        );

        uint256 currentPrice = getUnderlyingPrice();
        uint256 timeToExpiry = epochData[currentEpoch].expiry - block.timestamp;

        require(
            epochData[currentEpoch].usdDeposits -
                (epochData[currentEpoch].activeUsdDeposits /
                    AMOUNT_PRICE_TO_USDC_DECIMALS) >=
                (currentPrice * amount) / AMOUNT_PRICE_TO_USDC_DECIMALS,
            "Not enough AP liquidity available"
        );

        // Swap half of AP to underlying
        uint256 underlyingPurchased = _swapToUnderlying(
            ((currentPrice * amount) / 2) / AMOUNT_PRICE_TO_USDC_DECIMALS,
            swapperId
        );
        epochCollectionsData[currentEpoch].finalUsdBalanceBeforeWithdaw -=
            ((currentPrice * amount) / 2) /
            AMOUNT_PRICE_TO_USDC_DECIMALS;

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

        epochData[currentEpoch].underlyingPurchased += underlyingPurchased;

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

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

        uint256 apFunding = calculateApFunding(
            swapPrice,
            underlyingPurchased * 2,
            timeToExpiry
        );

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

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

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

        IERC20(addresses.usd).safeTransferFrom(
            msg.sender,
            address(this),
            ((apPremium + apFunding) / AMOUNT_PRICE_TO_USDC_DECIMALS) +
                protocolFee
        );

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

        epochCollectionsData[currentEpoch]
            .finalUsdBalanceBeforeWithdaw += ((apPremium + apFunding) /
            AMOUNT_PRICE_TO_USDC_DECIMALS);

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

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

        StraddlePosition memory sp = straddlePositions[id];
        require(sp.epoch != 0, "Invalid straddle position");
        require(isEpochPreExpired[sp.epoch], "Epoch has not pre-expired");

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

        _burn(id);

        require(buyerPnl != 0, "buyerPnl cannot be 0");

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

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

        buyerPnl -= (protocolFee + delegationFee);

        epochCollectionsData[sp.epoch].straddleCounter -= 1;
        epochCollectionsData[sp.epoch]
            .finalUsdBalanceBeforeWithdaw -= (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(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)
    {
        pnls = new uint256[](ids.length);
        for (uint256 i = 0; i < ids.length; i++) {
            pnls[i] = settle(ids[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) private returns (uint256 tokenId) {
        tokenId = _tokenIdCounter.current();
        _tokenIdCounter.increment();
        _safeMint(to, tokenId);
    }

    /// @dev Internal function to swap USD to underlying tokens
    /// @param amount Amount of USD to swap
    /// @param swapperId Swapper ID
    function _swapToUnderlying(uint256 amount, uint256 swapperId)
        internal
        returns (uint256 underlyingPurchased)
    {
        underlyingPurchased = IAssetSwapper(addresses.assetSwapper).swapAsset(
            addresses.usd,
            addresses.underlying,
            amount,
            0,
            swapperId
        );
    }

    /// @dev Internal function to swap underlying tokens to USD
    /// @param amount Amount of underlying tokens to swap
    /// @param swapperId Swapper ID
    function _swapFromUnderlying(uint256 amount, uint256 swapperId)
        internal
        returns (uint256 usdObtained)
    {
        usdObtained = IAssetSwapper(addresses.assetSwapper).swapAsset(
            addresses.underlying,
            addresses.usd,
            amount,
            0,
            swapperId
        );
    }

    /*==== 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 _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 _strike,
        uint256 _amount,
        uint256 _expiry
    ) public view returns (uint256 premium) {
        premium = (IOptionPricing(addresses.optionPricing).getOptionPrice(
            _isPut,
            _expiry,
            _strike,
            getUnderlyingPrice(),
            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 * 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];
        require(writePos.epoch != 0, "Invalid write position");

        writePositionPnl =
            (writePos.usdDeposit *
                epochCollectionsData[writePos.epoch]
                    .finalUsdBalanceBeforeWithdaw) /
            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];

        require(sp.epoch != 0, "Invalid straddle position");

        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 * 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; ++i) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, i);
            if (writePositions[tokenId].epoch != 0) {
                ++count;
            }
        }

        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; ++i) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, i);
            if (straddlePositions[tokenId].epoch != 0) {
                ++count;
            }
        }

        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;
        require(
            block.timestamp < expiry,
            "Expiry cannot be before current time"
        );
        require(
            currentEpoch == 0 || !isVaultReady[nextEpoch],
            "Cannot bootstrap when vault is ready"
        );
        if (currentEpoch > 0) {
            require(
                isEpochExpired[currentEpoch],
                "Cannot bootstrap before the current epoch was expired & settled"
            );
        }

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

        emit Bootstrap(nextEpoch);

        return true;
    }

    /// @dev Swap a certain percentage of total purchased underlying
    /// @param percentage percentage of underlying to swap in 1e6
    /// @param swapperId Swapper ID of the swap method to use with AssetSwapper
    function preExpireEpoch(uint256 percentage, uint256 swapperId)
        external
        whenNotPaused
        onlyRole(MANAGER_ROLE)
        returns (bool)
    {
        EpochData memory data = epochData[currentEpoch];
        require(percentage > 0, "Percentage cannot be 0");
        require(
            block.timestamp >= data.expiry,
            "Time is not past epoch expiry"
        );
        require(
            !isEpochPreExpired[currentEpoch],
            "Epoch was already pre-expired"
        );
        require(!isEpochExpired[currentEpoch], "Epoch was already expired");
        require(
            data.settlementPercentage + percentage <= (100 * PERCENT_PRECISION),
            "You cannot swap more than 100%"
        );

        // Swap all purchased underlying at current price
        uint256 underlyingToSwap = (data.underlyingPurchased * percentage) /
            (100 * PERCENT_PRECISION);

        uint256 normalizedSettlementPrice;

        if (underlyingToSwap > 0) {
            uint256 usdObtained = _swapFromUnderlying(
                underlyingToSwap,
                swapperId
            );
            epochCollectionsData[currentEpoch]
                .finalUsdBalanceBeforeWithdaw += usdObtained;

            uint256 settlementPrice = (usdObtained *
                AMOUNT_PRICE_TO_USDC_DECIMALS) / underlyingToSwap;

            normalizedSettlementPrice =
                ((data.settlementPrice * data.settlementPercentage) +
                    (settlementPrice * percentage)) /
                (data.settlementPercentage + percentage);

            epochData[currentEpoch].settlementPercentage += percentage;
        } else {
            normalizedSettlementPrice = getUnderlyingPrice();

            epochData[currentEpoch].settlementPercentage =
                100 *
                PERCENT_PRECISION;
        }

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

        if (
            epochData[currentEpoch].settlementPercentage >
            (99 * PERCENT_PRECISION)
        ) {
            isEpochPreExpired[currentEpoch] = true;
        }

        emit EpochPreExpired(msg.sender);

        return true;
    }

    /// @dev Expire epoch and set the settlement price
    function expireEpoch()
        external
        whenNotPaused
        onlyRole(MANAGER_ROLE)
        returns (bool expired)
    {
        require(
            block.timestamp >= epochData[currentEpoch].expiry,
            "Time is not past epoch expiry"
        );
        require(isEpochPreExpired[currentEpoch], "Epoch has not pre-expired");
        require(!isEpochExpired[currentEpoch], "Epoch was already expired");

        if (epochCollectionsData[currentEpoch].straddleCounter == 0) {
            isEpochExpired[currentEpoch] = true;
            expired = true;
        } else {
            revert("All settlements have not been processed");
        }

        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 Change blackout period before expiry
    /// @dev Can only be called by governance
    function setBlackoutPeriodBeforeExpiry(uint256 period)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
        returns (bool)
    {
        require(period > 1 hours, "Blackout period must be more than 1 hour");
        blackoutPeriodBeforeExpiry = period;
        emit SetBlackoutPeriod(period);
        return true;
    }

    /// @notice Sets the apFunding
    /// @dev Can only be called by admin
    /// @param _apFundingPercent funding percentage number between 1% and 100%
    function setApFunding(uint256 _apFundingPercent)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(_apFundingPercent > 0, "Funding rate must be greater than 0");
        apFundingPercent = _apFundingPercent;
        emit SetApFunding(_apFundingPercent);
    }

    /// @notice Sets the pnlSlippagePercent
    /// @dev Can only be called by admin
    /// @param _pnlSlippagePercent The pnl slippage percent
    function setPnlSlippagePercent(uint256 _pnlSlippagePercent)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(_pnlSlippagePercent > 0, "Funding rate must be greater than 0");
        pnlSlippagePercent = _pnlSlippagePercent;
        emit SetPnlSlippagePercent(_pnlSlippagePercent);
    }

    /// @notice Sets the purchase/settlement fee percent
    /// @dev Can only be called by admin
    /// @param _purchaseFeePercent Purchase fee percent
    /// @param _settlementFeePercent Settlement fee percent
    /// @param _settleDelegationFeePercent Settle delegation fee percent
    function setFeePercents(
        uint256 _purchaseFeePercent,
        uint256 _settlementFeePercent,
        uint256 _settleDelegationFeePercent
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(
            _purchaseFeePercent > 0 &&
                _settlementFeePercent > 0 &&
                _settleDelegationFeePercent > 0,
            "Percents must be greater than 0"
        );
        purchaseFeePercent = _purchaseFeePercent;
        settlementFeePercent = _settlementFeePercent;
        settleDelegationFeePercent = _settleDelegationFeePercent;
        emit SetFeePercents(
            _purchaseFeePercent,
            _settlementFeePercent,
            _settleDelegationFeePercent
        );
    }

    /// @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 = 0; i < tokens.length; i++) {
            IERC20 token = IERC20(tokens[i]);
            token.safeTransfer(msg.sender, token.balanceOf(address(this)));
        }
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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(uint160(account), 20),
                        " 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());
        }
    }
}

// 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;
}

// 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 v4.4.1 (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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 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);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// 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;
    }
}

// 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;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

// 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;
    }
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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. It 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)`.
        // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
        // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
        // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
        // good first aproximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1;
        uint256 x = a;
        if (x >> 128 > 0) {
            x >>= 128;
            result <<= 64;
        }
        if (x >> 64 > 0) {
            x >>= 64;
            result <<= 32;
        }
        if (x >> 32 > 0) {
            x >>= 32;
            result <<= 16;
        }
        if (x >> 16 > 0) {
            x >>= 16;
            result <<= 8;
        }
        if (x >> 8 > 0) {
            x >>= 8;
            result <<= 4;
        }
        if (x >> 4 > 0) {
            x >>= 4;
            result <<= 2;
        }
        if (x >> 2 > 0) {
            result <<= 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) {
        uint256 result = sqrt(a);
        if (rounding == Rounding.Up && result * result < a) {
            result += 1;
        }
        return result;
    }
}

File 22 of 27 : IAssetSwapper.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.0;

interface IAssetSwapper {
    function swapAsset(
        address from,
        address to,
        uint256 amount,
        uint256 minAmountOut,
        uint256 swapperId
    ) external returns (uint256);
}

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

//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;

import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

interface IPositionMinter is IERC721Enumerable {
    function mint(address to) external returns (uint256 tokenId);

    function burnToken(uint256 tokenId) external;
}

//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;

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

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

//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;

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

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

API
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"components":[{"internalType":"address","name":"usd","type":"address"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"assetSwapper","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":"struct AtlanticStraddle.Addresses","name":"_addresses","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"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":"assetSwapper","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"}],"indexed":false,"internalType":"struct AtlanticStraddle.Addresses","name":"addresses","type":"tuple"}],"name":"SetAddresses","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"apFunding","type":"uint256"}],"name":"SetApFunding","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"}],"name":"SetBlackoutPeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"purchaseFeePercent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settlementFeePercent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settleDelegationFeePercent","type":"uint256"}],"name":"SetFeePercents","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"pnlSlippagePercent","type":"uint256"}],"name":"SetPnlSlippagePercent","type":"event"},{"anonymous":false,"inputs":[{"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":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":"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":"MAX_DELEGATION_FEE","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":"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":"assetSwapper","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"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"apFundingPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blackoutPeriodBeforeExpiry","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":"_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":"epochCollectionsData","outputs":[{"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":"finalUsdBalanceBeforeWithdaw","type":"uint256"}],"stateMutability":"view","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":"settlementPercentage","type":"uint256"},{"internalType":"uint256","name":"underlyingPurchased","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireEpoch","outputs":[{"internalType":"bool","name":"expired","type":"bool"}],"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":"","type":"uint256"}],"name":"isEpochExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isEpochPreExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isVaultReady","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":[],"name":"pnlSlippagePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"percentage","type":"uint256"},{"internalType":"uint256","name":"swapperId","type":"uint256"}],"name":"preExpireEpoch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"swapperId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"purchase","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"purchaseFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"assetSwapper","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":"struct AtlanticStraddle.Addresses","name":"_addresses","type":"tuple"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_apFundingPercent","type":"uint256"}],"name":"setApFunding","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"setBlackoutPeriodBeforeExpiry","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_purchaseFeePercent","type":"uint256"},{"internalType":"uint256","name":"_settlementFeePercent","type":"uint256"},{"internalType":"uint256","name":"_settleDelegationFeePercent","type":"uint256"}],"name":"setFeePercents","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pnlSlippagePercent","type":"uint256"}],"name":"setPnlSlippagePercent","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":[],"name":"settleDelegationFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"settlementFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"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"}]

6080604052620249f0601e556200001b620f4240600a620006cf565b601f55620186a060205562000035620f42406024620006cf565b60215562000048600a620f4240620006f1565b6022556138406023556207a1206024553480156200006557600080fd5b506040516200622a3803806200622a833981016040819052620000889162000832565b60016000819055835184918491620000a69190602085019062000613565b508051620000bc90600290602084019062000613565b5050600c805460ff19169055508051601080546001600160a01b03199081166001600160a01b03938416908117909255602080850151601180548416918616919091179055604085015160128054841691861691821790556060860151601380548516918716919091179055608086015160148054851691871691909117905560a086015160158054851691871691909117905560c0860151601680549094169516949094179091556200017e929060001990620001ed811b6200378017901c565b601254601154620001ab916001600160a01b039182169116600019620001ed602090811b6200378017901c565b620001b8600033620002e3565b620001e47f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0833620002e3565b50505062000a2e565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b1580156200023a57600080fd5b505afa1580156200024f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000275919062000945565b6200028191906200095f565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152919250620002dd91869190620002f316565b50505050565b620002ef8282620003da565b5050565b60006200034f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200047e60201b62003874179092919060201c565b805190915015620003d557808060200190518101906200037091906200097a565b620003d55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b505050565b6000828152600b602090815260408083206001600160a01b038516845290915290205460ff16620002ef576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200043a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60606200048f848460008562000499565b90505b9392505050565b606082471015620004fc5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620003cc565b6001600160a01b0385163b620005555760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620003cc565b600080866001600160a01b031685876040516200057391906200099e565b60006040518083038185875af1925050503d8060008114620005b2576040519150601f19603f3d011682016040523d82523d6000602084013e620005b7565b606091505b509092509050620005ca828286620005d5565b979650505050505050565b60608315620005e657508162000492565b825115620005f75782518084602001fd5b8160405162461bcd60e51b8152600401620003cc9190620009bc565b8280546200062190620009f1565b90600052602060002090601f01602090048101928262000645576000855562000690565b82601f106200066057805160ff191683800117855562000690565b8280016001018555821562000690579182015b828111156200069057825182559160200191906001019062000673565b506200069e929150620006a2565b5090565b5b808211156200069e5760008155600101620006a3565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615620006ec57620006ec620006b9565b500290565b6000826200070f57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b03811182821017156200074f576200074f62000714565b60405290565b60005b838110156200077257818101518382015260200162000758565b83811115620002dd5750506000910152565b600082601f8301126200079657600080fd5b81516001600160401b0380821115620007b357620007b362000714565b604051601f8301601f19908116603f01168101908282118183101715620007de57620007de62000714565b81604052838152866020858801011115620007f857600080fd5b6200080b84602083016020890162000755565b9695505050505050565b80516001600160a01b03811681146200082d57600080fd5b919050565b60008060008385036101208112156200084a57600080fd5b84516001600160401b03808211156200086257600080fd5b620008708883890162000784565b955060208701519150808211156200088757600080fd5b50620008968782880162000784565b93505060e0603f1982011215620008ac57600080fd5b50620008b76200072a565b620008c56040860162000815565b8152620008d56060860162000815565b6020820152620008e86080860162000815565b6040820152620008fb60a0860162000815565b60608201526200090e60c0860162000815565b60808201526200092160e0860162000815565b60a082015262000935610100860162000815565b60c0820152809150509250925092565b6000602082840312156200095857600080fd5b5051919050565b60008219821115620009755762000975620006b9565b500190565b6000602082840312156200098d57600080fd5b815180151581146200049257600080fd5b60008251620009b281846020870162000755565b9190910192915050565b6020815260008251806020840152620009dd81604085016020870162000755565b601f01601f19169190910160400192915050565b600181811c9082168062000a0657607f821691505b6020821081141562000a2857634e487b7160e01b600052602260045260246000fd5b50919050565b6157ec8062000a3e6000396000f3fe608060405234801561001057600080fd5b506004361061043e5760003560e01c80637927113011610236578063c1419def1161013b578063de8b007a116100c3578063ef2bb7e211610087578063ef2bb7e214610b28578063f55b5b1014610b3b578063f9bb30e214610b4e578063fcec046814610b61578063ffe8e3721461096657600080fd5b8063de8b007a14610a62578063e985e9c514610a75578063ea3bd5df14610ab1578063ec87621c14610ac4578063ee0d82c114610ad957600080fd5b8063cddd38931161010a578063cddd3893146109a9578063cf4b6805146109b2578063d547741f146109c5578063d706f3f0146109d8578063da0321cd146109e157600080fd5b8063c1419def14610966578063c189c19b14610970578063c3d9ed3914610983578063c87b56dd1461099657600080fd5b806395d89b41116101be578063a22cb4651161018d578063a22cb46514610911578063acc3a00614610924578063b375d49214610937578063b88d4fde1461094a578063bbdce1681461095d57600080fd5b806395d89b4114610889578063998e59ae146108915780639ce990ea146108f6578063a217fddf1461090957600080fd5b80638df82800116102055780638df82800146107e257806390bb5855146107f557806391d148541461084a578063931efa961461085d57806393c82c751461086657600080fd5b806379271130146107a15780637c4b52cb146107b457806380ed71e4146107c75780638456cb59146107da57600080fd5b80633dbb196d1161034757806354545bfb116102cf5780636db29f6d116102935780636db29f6d146106ea5780636e821b2e146106f257806370a082311461077257806375153f3e14610785578063766718081461079857600080fd5b806354545bfb146106985780635c975abb146106a65780636352211e146106b15780636ae78edf146106c45780636c1085a1146106d757600080fd5b806342842e0e1161031657806342842e0e14610634578063468f02d2146106475780634a2a60701461064f5780634f6ccce7146106725780635387b84c1461068557600080fd5b80633dbb196d146105d65780633ec21260146105f65780633f4ba83a146106095780633f83b8a51461061157600080fd5b80632e1a7d4d116103ca57806333f4bb991161039957806333f4bb991461057157806336568abe1461057a5780633686a39e1461058d578063391feebb146105a05780633b8f56a0146105c357600080fd5b80632e1a7d4d146105255780632f2ff15d146105385780632f745c591461054b57806333277bca1461055e57600080fd5b8063162790551161041157806316279055146104c057806318160ddd146104d457806323b872dd146104e6578063248a9ca3146104f957806326325a781461051c57600080fd5b806301ffc9a71461044357806306fdde031461046b578063081812fc14610480578063095ea7b3146104ab575b600080fd5b610456610451366004614dd9565b610b6a565b60405190151581526020015b60405180910390f35b610473610b7b565b6040516104629190614e4e565b61049361048e366004614e61565b610c0d565b6040516001600160a01b039091168152602001610462565b6104be6104b9366004614e91565b610c34565b005b6104566104ce366004614ebb565b3b151590565b6009545b604051908152602001610462565b6104be6104f4366004614ed6565b610d4f565b6104d8610507366004614e61565b6000908152600b602052604090206001015490565b6104d860205481565b6104d8610533366004614e61565b610d80565b6104be610546366004614f12565b610f72565b6104d8610559366004614e91565b610f97565b6104be61056c366004614f3e565b61102d565b6104d860225481565b6104be610588366004614f12565b6110f4565b61045661059b366004614e61565b611172565b6104566105ae366004614ebb565b600d6020526000908152604090205460ff1681565b6104566105d1366004614f6a565b611378565b6105e96105e4366004614fd3565b6117eb565b6040516104629190615079565b6105e9610604366004614ebb565b611890565b6104be6119a4565b61045661061f366004614e61565b60196020526000908152604090205460ff1681565b6104be610642366004614ed6565b6119ba565b6104d86119d5565b61045661065d366004614e61565b601a6020526000908152604090205460ff1681565b6104d8610680366004614e61565b611a57565b6104d8610693366004614e61565b611aea565b6104d8662386f26fc1000081565b600c5460ff16610456565b6104936106bf366004614e61565b611c4d565b6104d86106d23660046150cb565b611cad565b6104be6106e5366004614e61565b611d6a565b610456611eab565b61073d610700366004614e61565b6017602052600090815260409020805460018201546002830154600384015460048501546005860154600690960154949593949293919290919087565b604080519788526020880196909652948601939093526060850191909152608084015260a083015260c082015260e001610462565b6104d8610780366004614ebb565b6120ba565b6104d8610793366004614e61565b612140565b6104d8600f5481565b6105e96107af366004614ebb565b6121dd565b6104be6107c2366004615106565b6122e8565b6104d86107d536600461518c565b61240e565b6104be6125d7565b6104d86107f0366004614e61565b6125ea565b61082a610803366004614e61565b601d6020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610462565b610456610858366004614f12565b612900565b6104d860245481565b610456610874366004614e61565b601b6020526000908152604090205460ff1681565b61047361292b565b6108ce61089f366004614e61565b601860205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a001610462565b6104d8610904366004614f3e565b61293a565b6104d8600081565b6104be61091f3660046151ca565b61299b565b6104be610932366004614ebb565b6129a6565b6104be610945366004615201565b6129ba565b6104be6109583660046152b1565b612afa565b6104d860215481565b6104d8620f424081565b6104d861097e366004614e61565b612b32565b6104be610991366004614ebb565b612baf565b6104736109a4366004614e61565b612bc3565b6104d860235481565b6104566109c0366004614e61565b612c36565b6104be6109d3366004614f12565b612ce5565b6104d8601f5481565b601054601154601254601354601454601554601654610a19966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e001610462565b6105e9610a70366004614fd3565b612d0a565b610456610a83366004615371565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b6104d8610abf36600461539b565b612daf565b6104d860008051602061579783398151915281565b610b0b610ae7366004614e61565b601c6020526000908152604090208054600182015460029092015490919060ff1683565b604080519384526020840192909252151590820152606001610462565b6104d8610b36366004614e61565b6133b6565b6104be610b49366004614e61565b6136c0565b6104be610b5c366004614e61565b613720565b6104d8601e5481565b6000610b7582613883565b92915050565b606060018054610b8a906153c7565b80601f0160208091040260200160405190810160405280929190818152602001828054610bb6906153c7565b8015610c035780601f10610bd857610100808354040283529160200191610c03565b820191906000526020600020905b815481529060010190602001808311610be657829003601f168201915b5050505050905090565b6000610c18826138a8565b506000908152600560205260409020546001600160a01b031690565b6000610c3f82611c4d565b9050806001600160a01b0316836001600160a01b03161415610cb25760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610cce5750610cce8133610a83565b610d405760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610ca9565b610d4a8383613907565b505050565b610d593382613975565b610d755760405162461bcd60e51b8152600401610ca9906153fc565b610d4a8383836139f3565b6000610d8a613b9a565b60026000541415610dad5760405162461bcd60e51b8152600401610ca99061544a565b6002600055610dba613be2565b33610dc483611c4d565b6001600160a01b031614610e0a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b6044820152606401610ca9565b6000828152601c60209081526040918290208251606081018452815480825260018301549382019390935260029091015460ff16151592810192909252610e635760405162461bcd60e51b8152600401610ca990615481565b80516000908152601b602052604090205460ff16610eba5760405162461bcd60e51b8152602060048201526014602482015273536574746c656d656e7473206e6f7420646f6e6560601b6044820152606401610ca9565b610ec383612140565b9150610ece83613c48565b81610f155760405162461bcd60e51b81526020600482015260176024820152760577269746520706f736974696f6e20706e6c206973203604c1b6044820152606401610ca9565b601054610f2c906001600160a01b03163384613cef565b604080518481526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a2506001600055919050565b6000828152600b6020526040902060010154610f8d81613d1f565b610d4a8383613d29565b6000610fa2836120ba565b82106110045760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610ca9565b506001600160a01b03919091166000908152600760209081526040808320938352929052205490565b600061103881613d1f565b6000841180156110485750600083115b80156110545750600082115b6110a05760405162461bcd60e51b815260206004820152601f60248201527f50657263656e7473206d7573742062652067726561746572207468616e2030006044820152606401610ca9565b601e849055602083815560228390556040805186815291820185905281018390527f55098e58cb45f2010b003083b66e4a51d1e887ad51259c626dc46dcdd0019bd99060600160405180910390a150505050565b6001600160a01b03811633146111645760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ca9565b61116e8282613daf565b5050565b600061117c613b9a565b60008051602061579783398151915261119481613d1f565b6000600f5460016111a591906154c7565b90508342106112025760405162461bcd60e51b8152602060048201526024808201527f4578706972792063616e6e6f74206265206265666f72652063757272656e742060448201526374696d6560e01b6064820152608401610ca9565b600f541580611220575060008181526019602052604090205460ff16155b6112785760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420626f6f747374726170207768656e207661756c7420697320726044820152636561647960e01b6064820152608401610ca9565b600f541561130757600f546000908152601b602052604090205460ff166113075760405162461bcd60e51b815260206004820152603f60248201527f43616e6e6f7420626f6f747374726170206265666f726520746865206375727260448201527f656e742065706f6368207761732065787069726564202620736574746c6564006064820152608401610ca9565b600081815260176020908152604080832042815560019081018890556019835292819020805460ff1916909317909255600f83905590518281527fb5ca1ca1b7b47549eb8af476f3ef702fc63bcd8b8c01dc163b009bb818f97997910160405180910390a160019250505b50919050565b6000611382613b9a565b60008051602061579783398151915261139a81613d1f565b600f54600090815260176020908152604091829020825160e081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a082015260069091015460c0820152846114425760405162461bcd60e51b8152602060048201526016602482015275050657263656e746167652063616e6e6f7420626520360541b6044820152606401610ca9565b80602001514210156114965760405162461bcd60e51b815260206004820152601d60248201527f54696d65206973206e6f7420706173742065706f6368206578706972790000006044820152606401610ca9565b600f546000908152601a602052604090205460ff16156114f85760405162461bcd60e51b815260206004820152601d60248201527f45706f63682077617320616c7265616479207072652d657870697265640000006044820152606401610ca9565b600f546000908152601b602052604090205460ff16156115565760405162461bcd60e51b8152602060048201526019602482015278115c1bd8da081dd85cc8185b1c9958591e48195e1c1a5c9959603a1b6044820152606401610ca9565b611564620f424060646154df565b858260a0015161157491906154c7565b11156115c25760405162461bcd60e51b815260206004820152601e60248201527f596f752063616e6e6f742073776170206d6f7265207468616e203130302500006044820152606401610ca9565b60006115d2620f424060646154df565b868360c001516115e291906154df565b6115ec9190615514565b9050600081156116cd5760006116028388613e16565b90508060186000600f548152602001908152602001600020600401600082825461162c91906154c7565b90915550600090508361164868056bc75e2d63100000846154df565b6116529190615514565b9050888560a0015161166491906154c7565b61166e8a836154df565b8660a00151876080015161168291906154df565b61168c91906154c7565b6116969190615514565b92508860176000600f54815260200190815260200160002060050160008282546116c091906154c7565b909155506116fb92505050565b6116d56119d5565b90506116e5620f424060646154df565b600f546000908152601760205260409020600501555b600f5460009081526017602052604090206004015461173057600f546000908152601760205260409020600401819055611765565b600f5460009081526017602052604090206004015461174f9082613ebd565b600f546000908152601760205260409020600401555b611773620f424060636154df565b600f5460009081526017602052604090206005015411156117ab57600f546000908152601a60205260409020805460ff191660011790555b6040513381527fe299059e3adc918e4f4ab456527f6220987ed7fce29c2bc9a416f9336822bdd29060200160405180910390a15060019695505050505050565b6060815167ffffffffffffffff81111561180757611807614f8c565b604051908082528060200260200182016040528015611830578160200160208202803683370190505b50905060005b82518110156113725761186183828151811061185457611854615528565b60200260200101516125ea565b82828151811061187357611873615528565b6020908102919091010152806118888161553e565b915050611836565b6060600061189d836120ba565b90506000805b828110156118eb5760006118b78683610f97565b6000818152601d6020526040902054909150156118da576118d78361553e565b92505b506118e48161553e565b90506118a3565b508067ffffffffffffffff81111561190557611905614f8c565b60405190808252806020026020018201604052801561192e578160200160208202803683370190505b5092506000805b8282101561199b5760006119498783610f97565b6000818152601d60205260409020549091501561198a578086848151811061197357611973615528565b60209081029190910101526119878361553e565b92505b6119938261553e565b915050611935565b50505050919050565b60006119af81613d1f565b6119b7613ed3565b50565b610d4a83838360405180602001604052806000815250612afa565b60135460408051632347816960e11b815290516000926001600160a01b03169163468f02d2916004808301926020929190829003018186803b158015611a1a57600080fd5b505afa158015611a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a529190615559565b905090565b6000611a6260095490565b8210611ac55760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610ca9565b60098281548110611ad857611ad8615528565b90600052602060002001549050919050565b6000818152601d602090815260408083208151608081018352815480825260018301549482019490945260028201549281019290925260030154606082015290611b725760405162461bcd60e51b815260206004820152601960248201527824b73b30b634b21039ba3930b2323632903837b9b4ba34b7b760391b6044820152606401610ca9565b805160009081526017602052604090819020600401549082015181811115611bda576020830151611ba38383615572565b611bad91906154df565b6060840151909450611bbf8383615572565b611bc991906154df565b611bd39085615572565b9350611c00565b6060830151611be98284615572565b611bf391906154df565b611bfd90856154c7565b93505b611c1368056bc75e2d6310000085615514565b9350611c23620f424060646154df565b602454611c3090866154df565b611c3a9190615514565b611c449085615572565b95945050505050565b6000818152600360205260408120546001600160a01b031680610b755760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610ca9565b60155460009083906001600160a01b0316635b7b6d88878588611cce6119d5565b611cd78b612b32565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a40160206040518083038186803b158015611d2857600080fd5b505afa158015611d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d609190615559565b611c4491906154df565b611d72613b9a565b60026000541415611d955760405162461bcd60e51b8152600401610ca99061544a565b6002600055611da2613be2565b33611dac82611c4d565b6001600160a01b031614611df25760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b6044820152606401610ca9565b6000818152601c6020526040902054611e405760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103837b9b4ba34b7b760811b6044820152606401610ca9565b6000818152601c6020908152604091829020600201805460ff8082161560ff199092168217909255835185815291161515918101919091527fb5e95d468eadd79446f495b23ddf06bb55ff5717a821eb2cc57154a31cd5ee22910160405180910390a1506001600055565b6000611eb5613b9a565b600080516020615797833981519152611ecd81613d1f565b600f54600090815260176020526040902060010154421015611f315760405162461bcd60e51b815260206004820152601d60248201527f54696d65206973206e6f7420706173742065706f6368206578706972790000006044820152606401610ca9565b600f546000908152601a602052604090205460ff16611f8e5760405162461bcd60e51b8152602060048201526019602482015278115c1bd8da081a185cc81b9bdd081c1c994b595e1c1a5c9959603a1b6044820152606401610ca9565b600f546000908152601b602052604090205460ff1615611fec5760405162461bcd60e51b8152602060048201526019602482015278115c1bd8da081dd85cc8185b1c9958591e48195e1c1a5c9959603a1b6044820152606401610ca9565b600f5460009081526018602052604090206003015461202b57600f546000908152601b60205260409020805460ff191660019081179091559150612083565b60405162461bcd60e51b815260206004820152602760248201527f416c6c20736574746c656d656e74732068617665206e6f74206265656e2070726044820152661bd8d95cdcd95960ca1b6064820152608401610ca9565b6040513381527f6a4de20bb9fa8fea199f1022f29eff6be1752c446674d16913f2afc2b3c5a8a59060200160405180910390a15090565b60006001600160a01b0382166121245760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610ca9565b506001600160a01b031660009081526004602052604090205490565b6000818152601c602090815260408083208151606081018352815480825260018301549482019490945260029091015460ff16151591810191909152906121995760405162461bcd60e51b8152600401610ca990615481565b80516000908152601760209081526040808320600201548451845260188352922060040154908301516121cc91906154df565b6121d69190615514565b9392505050565b606060006121ea836120ba565b90506000805b828110156122385760006122048683610f97565b6000818152601c602052604090205490915015612227576122248361553e565b92505b506122318161553e565b90506121f0565b508067ffffffffffffffff81111561225257612252614f8c565b60405190808252806020026020018201604052801561227b578160200160208202803683370190505b5092506000805b8282101561199b5760006122968783610f97565b6000818152601c6020526040902054909150156122d757808684815181106122c0576122c0615528565b60209081029190910101526122d48361553e565b92505b6122e08261553e565b915050612282565b60006122f381613d1f565b6122fb613f25565b811561232f5760405133904780156108fc02916000818181858888f1935050505015801561232d573d6000803e3d6000fd5b505b60005b8381101561240757600085858381811061234e5761234e615528565b90506020020160208101906123639190614ebb565b6040516370a0823160e01b81523060048201529091506123f49033906001600160a01b038416906370a082319060240160206040518083038186803b1580156123ab57600080fd5b505afa1580156123bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e39190615559565b6001600160a01b0384169190613cef565b50806123ff8161553e565b915050612332565b5050505050565b6000612418613b9a565b6002600054141561243b5760405162461bcd60e51b8152600401610ca99061544a565b6002600055612448613be2565b600084116124985760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020616d6f756e740000000000000000006044820152606401610ca9565b6000600f5460016124a991906154c7565b9050846017600083815260200190815260200160002060020160008282546124d191906154c7565b9091555050600081815260186020526040812060040180548792906124f79084906154c7565b90915550612506905083613f6e565b6040805160608101825283815260208082018981528815158385019081526000868152601c909352939091209151825551600182015590516002909101805460ff191691151591909117905560105490925061256d906001600160a01b0316333088613f98565b6040805182815260208101879052851515818301526001600160a01b038516606082015233608082015260a0810184905290517f14c0e56f4125d5707194bbf1beff49bb39b170a0f49574bcf25d8616f4df1cf69181900360c00190a15060016000559392505050565b60006125e281613d1f565b6119b7613fd0565b60006125f4613b9a565b600260005414156126175760405162461bcd60e51b8152600401610ca99061544a565b6002600055612624613be2565b6000828152601d6020908152604091829020825160808101845281548082526001830154938201939093526002820154938101939093526003015460608301526126ac5760405162461bcd60e51b815260206004820152601960248201527824b73b30b634b21039ba3930b2323632903837b9b4ba34b7b760391b6044820152606401610ca9565b80516000908152601a602052604090205460ff166127085760405162461bcd60e51b8152602060048201526019602482015278115c1bd8da081a185cc81b9bdd081c1c994b595e1c1a5c9959603a1b6044820152606401610ca9565b600061271384611aea565b9050600061272085611c4d565b905061272b85613c48565b8161276f5760405162461bcd60e51b815260206004820152601460248201527306275796572506e6c2063616e6e6f7420626520360641b6044820152606401610ca9565b600061277f620f424060646154df565b60205461278c90856154df565b6127969190615514565b905060006001600160a01b03831633146127e0576127b8620f424060646154df565b6022546127c590866154df565b6127cf9190615514565b90506127dd81601f54613ebd565b90505b6127ea81836154c7565b6127f49085615572565b85516000908152601860205260408120600301805492965060019290919061281d908490615572565b9091555081905061282e83866154c7565b61283891906154c7565b85516000908152601860205260408120600401805490919061285b908490615572565b909155505060165460105461287d916001600160a01b03918216911684613cef565b601054612894906001600160a01b03168486613cef565b6010546128ab906001600160a01b03163383613cef565b60408051888152602081018690526001600160a01b0385169133917fddd2b8bfe59e2aa6d76b0600fa7f6e161b9ece46b47a20197e2755899e7e8837910160405180910390a350506001600055509392505050565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060028054610b8a906153c7565b600060026064612951620f42406301e133806154df565b85856021548961296191906154df565b61296b91906154df565b61297591906154df565b61297f9190615514565b6129899190615514565b6129939190615514565b949350505050565b61116e33838361400d565b60006129b181613d1f565b61116e826140dc565b60006129c581613d1f565b8151601080546001600160a01b039283166001600160a01b0319918216179091556020840151601180549184169183169190911790556040808501516012805491851691841691909117905560608501516013805491851691841691909117905560808501516014805491851691841691909117905560a08501516015805491851691841691909117905560c08501516016805491909416921691909117909155517f488865203db2c6efd677f2757b6433d6fd6f452390e796b6719252b8588fcdf990612aee90849081516001600160a01b03908116825260208084015182169083015260408084015182169083015260608084015182169083015260808084015182169083015260a08381015182169083015260c092830151169181019190915260e00190565b60405180910390a15050565b612b043383613975565b612b205760405162461bcd60e51b8152600401610ca9906153fc565b612b2c848484846141df565b50505050565b60145460405163c189c19b60e01b8152600481018390526000916001600160a01b03169063c189c19b9060240160206040518083038186803b158015612b7757600080fd5b505afa158015612b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b759190615559565b6000612bba81613d1f565b61116e82614212565b6060612bce826138a8565b6000612be560408051602081019091526000815290565b90506000815111612c0557604051806020016040528060008152506121d6565b80612c0f846142c3565b604051602001612c20929190615589565b6040516020818303038152906040529392505050565b600080612c4281613d1f565b610e108311612ca45760405162461bcd60e51b815260206004820152602860248201527f426c61636b6f757420706572696f64206d757374206265206d6f726520746861604482015267371018903437bab960c11b6064820152608401610ca9565b60238390556040518381527f32e6db6aab294383bb2b48c5adfb1100050e096a4ce0eed5b7568604fc09f10b9060200160405180910390a150600192915050565b6000828152600b6020526040902060010154612d0081613d1f565b610d4a8383613daf565b6060815167ffffffffffffffff811115612d2657612d26614f8c565b604051908082528060200260200182016040528015612d4f578160200160208202803683370190505b50905060005b825181101561137257612d80838281518110612d7357612d73615528565b60200260200101516133b6565b828281518110612d9257612d92615528565b602090810291909101015280612da78161553e565b915050612d55565b6000612db9613b9a565b60026000541415612ddc5760405162461bcd60e51b8152600401610ca99061544a565b6002600055612de9613be2565b6000600f5411612e2b5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840cae0dec6d609b1b6044820152606401610ca9565b662386f26fc100008411612e725760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610ca9565b602354600f54600090815260176020526040902060010154612e949190615572565b4210612ef15760405162461bcd60e51b815260206004820152602660248201527f43616e6e6f7420707572636861736520647572696e6720626c61636b6f7574206044820152651c195c9a5bd960d21b6064820152608401610ca9565b6000612efb6119d5565b600f5460009081526017602052604081206001015491925090612f1f904290615572565b905068056bc75e2d63100000612f3587846154df565b612f3f9190615514565b600f54600090815260176020526040902060030154612f689068056bc75e2d6310000090615514565b600f54600090815260176020526040902060020154612f879190615572565b1015612fdf5760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f756768204150206c697175696469747920617661696c61626c6044820152606560f81b6064820152608401610ca9565b600061301468056bc75e2d631000006002612ffa8a876154df565b6130049190615514565b61300e9190615514565b876143c1565b905068056bc75e2d63100000600261302c89866154df565b6130369190615514565b6130409190615514565b600f5460009081526018602052604081206004018054909190613064908490615572565b90915550600090506130778260026154df565b61308189866154df565b61308b9190615514565b90508160176000600f54815260200190815260200160002060060160008282546130b591906154c7565b909155506130c690508260026154df565b6130d090826154df565b600f54600090815260176020526040812060030180549091906130f49084906154c7565b909155506000905061312760018361310d8660026154df565b600f54600090815260176020526040902060010154611cad565b905060006131408361313a8660026154df565b8761293a565b600f546000908152601860205260408120805492935084929091906131669084906154c7565b9091555050600f546000908152601860205260408120600101805483929061318f9084906154c7565b909155506131a090508460026154df565b600f54600090815260186020526040812060020180549091906131c49084906154c7565b9091555050600f5460009081526018602052604081206003018054600192906131ee9084906154c7565b909155506131fd905088613f6e565b96506040518060800160405280600f54815260200185600261321f91906154df565b81526020808201869052604091820187905260008a8152601d82528281208451815591840151600183015591830151600282015560609092015160039092019190915561327868056bc75e2d63100000620f42406154df565b6132839060646154df565b601e54613290898e6154df565b61329a91906154df565b6132a49190615514565b90506132e833308368056bc75e2d631000006132c087896154c7565b6132ca9190615514565b6132d491906154c7565b6010546001600160a01b0316929190613f98565b601654601054613305916001600160a01b03918216911683613cef565b68056bc75e2d6310000061331983856154c7565b6133239190615514565b600f54600090815260186020526040812060040180549091906133479084906154c7565b909155507f12cb4648cf3058b17ceeb33e579f8b0bc269fe0843f3900b8e24b6c54871703c9050898961337a85876154c7565b604080516001600160a01b03909416845260208401929092529082015260600160405180910390a1505060016000555093979650505050505050565b60006133c0613b9a565b600260005414156133e35760405162461bcd60e51b8152600401610ca99061544a565b60026000556133f0613be2565b6000828152601c60209081526040918290208251606081018452815481526001820154928101929092526002015460ff161515918101829052906134765760405162461bcd60e51b815260206004820152601760248201527f526f6c6c6f766572206e6f7420617574686f72697a65640000000000000000006044820152606401610ca9565b80516134945760405162461bcd60e51b8152600401610ca990615481565b80516000908152601b602052604090205460ff166134ec5760405162461bcd60e51b8152602060048201526015602482015274115c1bd8da081a185cc81b9bdd08195e1c1a5c9959605a1b6044820152606401610ca9565b60006134f784612140565b9050600061350485611c4d565b905061350f85613c48565b816135565760405162461bcd60e51b81526020600482015260176024820152760577269746520706f736974696f6e20706e6c206973203604c1b6044820152606401610ca9565b60408051868152602081018490526001600160a01b038316917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a26000600f5460016135ab91906154c7565b9050826017600083815260200190815260200160002060020160008282546135d391906154c7565b9091555050600081815260186020526040812060040180548592906135f99084906154c7565b90915550613608905082613f6e565b6040805160608082018352848252602080830188815260018486018181526000888152601c85528790209551865591518582015590516002909401805460ff1916941515949094179093558351868152908101889052928301919091526001600160a01b038516908201819052608082015260a081018290529095507f14c0e56f4125d5707194bbf1beff49bb39b170a0f49574bcf25d8616f4df1cf69060c00160405180910390a150506001600055509092915050565b60006136cb81613d1f565b600082116136eb5760405162461bcd60e51b8152600401610ca9906155b8565b60248290556040518281527fe4d44cc62a77ab305c1c324248b29e91f621d65b1c231ee984dd6800b2ff7b4690602001612aee565b600061372b81613d1f565b6000821161374b5760405162461bcd60e51b8152600401610ca9906155b8565b60218290556040518281527fc5c758ec4001ae2dfceeb8a99ff59eacf17b62ca95bae713257b9dd494b9a84090602001612aee565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b1580156137cc57600080fd5b505afa1580156137e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138049190615559565b61380e91906154c7565b6040516001600160a01b038516602482015260448101829052909150612b2c90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261441a565b606061299384846000856144ec565b60006001600160e01b03198216637965db0b60e01b1480610b755750610b758261461d565b6000818152600360205260409020546001600160a01b03166119b75760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610ca9565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061393c82611c4d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061398183611c4d565b9050806001600160a01b0316846001600160a01b031614806139c857506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b806129935750836001600160a01b03166139e184610c0d565b6001600160a01b031614949350505050565b826001600160a01b0316613a0682611c4d565b6001600160a01b031614613a6a5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610ca9565b6001600160a01b038216613acc5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610ca9565b613ad7838383614642565b613ae2600082613907565b6001600160a01b0383166000908152600460205260408120805460019290613b0b908490615572565b90915550506001600160a01b0382166000908152600460205260408120805460019290613b399084906154c7565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600c5460ff1615613be05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610ca9565b565b333214613be057336000908152600d602052604090205460ff16613be05760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c6973746564000000006044820152606401610ca9565b6000613c5382611c4d565b9050613c6181600084614642565b613c6c600083613907565b6001600160a01b0381166000908152600460205260408120805460019290613c95908490615572565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6040516001600160a01b038316602482015260448101829052610d4a90849063a9059cbb60e01b9060640161383d565b6119b7813361464d565b613d338282612900565b61116e576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613d6b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b613db98282612900565b1561116e576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60125460115460105460405163b91ac49560e01b81526001600160a01b0392831660048201529082166024820152604481018590526000606482018190526084820185905292919091169063b91ac4959060a4015b602060405180830381600087803b158015613e8557600080fd5b505af1158015613e99573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d69190615559565b6000818310613ecc57816121d6565b5090919050565b613edb613f25565b600c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600c5460ff16613be05760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610ca9565b6000613f79600e5490565b9050613f89600e80546001019055565b613f9382826146b1565b919050565b6040516001600160a01b0380851660248301528316604482015260648101829052612b2c9085906323b872dd60e01b9060840161383d565b613fd8613b9a565b600c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613f083390565b816001600160a01b0316836001600160a01b0316141561406f5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610ca9565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b803b61412a5760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e74726163740000000000006044820152606401610ca9565b6001600160a01b0381166000908152600d602052604090205460ff16156141935760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c6973746564000000006044820152606401610ca9565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b6141ea8484846139f3565b6141f6848484846146cb565b612b2c5760405162461bcd60e51b8152600401610ca9906155fb565b6001600160a01b0381166000908152600d602052604090205460ff1661427a5760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c697374656400000000000000006044820152606401610ca9565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b6060816142e75750506040805180820190915260018152600360fc1b602082015290565b8160005b811561431157806142fb8161553e565b915061430a9050600a83615514565b91506142eb565b60008167ffffffffffffffff81111561432c5761432c614f8c565b6040519080825280601f01601f191660200182016040528015614356576020820181803683370190505b5090505b84156129935761436b600183615572565b9150614378600a8661564d565b6143839060306154c7565b60f81b81838151811061439857614398615528565b60200101906001600160f81b031916908160001a9053506143ba600a86615514565b945061435a565b60125460105460115460405163b91ac49560e01b81526001600160a01b0392831660048201529082166024820152604481018590526000606482018190526084820185905292919091169063b91ac4959060a401613e6b565b600061446f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166138749092919063ffffffff16565b805190915015610d4a578080602001905181019061448d9190615661565b610d4a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610ca9565b60608247101561454d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610ca9565b6001600160a01b0385163b6145a45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ca9565b600080866001600160a01b031685876040516145c0919061567e565b60006040518083038185875af1925050503d80600081146145fd576040519150601f19603f3d011682016040523d82523d6000602084013e614602565b606091505b50915091506146128282866147d5565b979650505050505050565b60006001600160e01b0319821663780e9d6360e01b1480610b755750610b758261480e565b610d4a83838361485e565b6146578282612900565b61116e5761466f816001600160a01b03166014614916565b61467a836020614916565b60405160200161468b92919061569a565b60408051601f198184030181529082905262461bcd60e51b8252610ca991600401614e4e565b61116e828260405180602001604052806000815250614ab2565b60006001600160a01b0384163b156147cd57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061470f90339089908890889060040161570f565b602060405180830381600087803b15801561472957600080fd5b505af1925050508015614759575060408051601f3d908101601f191682019092526147569181019061574c565b60015b6147b3573d808015614787576040519150601f19603f3d011682016040523d82523d6000602084013e61478c565b606091505b5080516147ab5760405162461bcd60e51b8152600401610ca9906155fb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612993565b506001612993565b606083156147e45750816121d6565b8251156147f45782518084602001fd5b8160405162461bcd60e51b8152600401610ca99190614e4e565b60006001600160e01b031982166380ac58cd60e01b148061483f57506001600160e01b03198216635b5e139f60e01b145b80610b7557506301ffc9a760e01b6001600160e01b0319831614610b75565b6001600160a01b0383166148b9576148b481600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b6148dc565b816001600160a01b0316836001600160a01b0316146148dc576148dc8382614ae5565b6001600160a01b0382166148f357610d4a81614b82565b826001600160a01b0316826001600160a01b031614610d4a57610d4a8282614c31565b606060006149258360026154df565b6149309060026154c7565b67ffffffffffffffff81111561494857614948614f8c565b6040519080825280601f01601f191660200182016040528015614972576020820181803683370190505b509050600360fc1b8160008151811061498d5761498d615528565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106149bc576149bc615528565b60200101906001600160f81b031916908160001a90535060006149e08460026154df565b6149eb9060016154c7565b90505b6001811115614a63576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614a1f57614a1f615528565b1a60f81b828281518110614a3557614a35615528565b60200101906001600160f81b031916908160001a90535060049490941c93614a5c81615769565b90506149ee565b5083156121d65760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ca9565b614abc8383614c75565b614ac960008484846146cb565b610d4a5760405162461bcd60e51b8152600401610ca9906155fb565b60006001614af2846120ba565b614afc9190615572565b600083815260086020526040902054909150808214614b4f576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b5060009182526008602090815260408084208490556001600160a01b039094168352600781528383209183525290812055565b600954600090614b9490600190615572565b6000838152600a602052604081205460098054939450909284908110614bbc57614bbc615528565b906000526020600020015490508060098381548110614bdd57614bdd615528565b6000918252602080832090910192909255828152600a90915260408082208490558582528120556009805480614c1557614c15615780565b6001900381819060005260206000200160009055905550505050565b6000614c3c836120ba565b6001600160a01b039093166000908152600760209081526040808320868452825280832085905593825260089052919091209190915550565b6001600160a01b038216614ccb5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610ca9565b6000818152600360205260409020546001600160a01b031615614d305760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610ca9565b614d3c60008383614642565b6001600160a01b0382166000908152600460205260408120805460019290614d659084906154c7565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160e01b0319811681146119b757600080fd5b600060208284031215614deb57600080fd5b81356121d681614dc3565b60005b83811015614e11578181015183820152602001614df9565b83811115612b2c5750506000910152565b60008151808452614e3a816020860160208601614df6565b601f01601f19169290920160200192915050565b6020815260006121d66020830184614e22565b600060208284031215614e7357600080fd5b5035919050565b80356001600160a01b0381168114613f9357600080fd5b60008060408385031215614ea457600080fd5b614ead83614e7a565b946020939093013593505050565b600060208284031215614ecd57600080fd5b6121d682614e7a565b600080600060608486031215614eeb57600080fd5b614ef484614e7a565b9250614f0260208501614e7a565b9150604084013590509250925092565b60008060408385031215614f2557600080fd5b82359150614f3560208401614e7a565b90509250929050565b600080600060608486031215614f5357600080fd5b505081359360208301359350604090920135919050565b60008060408385031215614f7d57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715614fcb57614fcb614f8c565b604052919050565b60006020808385031215614fe657600080fd5b823567ffffffffffffffff80821115614ffe57600080fd5b818501915085601f83011261501257600080fd5b81358181111561502457615024614f8c565b8060051b9150615035848301614fa2565b818152918301840191848101908884111561504f57600080fd5b938501935b8385101561506d57843582529385019390850190615054565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156150b157835183529284019291840191600101615095565b50909695505050505050565b80151581146119b757600080fd5b600080600080608085870312156150e157600080fd5b84356150ec816150bd565b966020860135965060408601359560600135945092505050565b60008060006040848603121561511b57600080fd5b833567ffffffffffffffff8082111561513357600080fd5b818601915086601f83011261514757600080fd5b81358181111561515657600080fd5b8760208260051b850101111561516b57600080fd5b60209283019550935050840135615181816150bd565b809150509250925092565b6000806000606084860312156151a157600080fd5b8335925060208401356151b3816150bd565b91506151c160408501614e7a565b90509250925092565b600080604083850312156151dd57600080fd5b6151e683614e7a565b915060208301356151f6816150bd565b809150509250929050565b600060e0828403121561521357600080fd5b60405160e0810181811067ffffffffffffffff8211171561523657615236614f8c565b60405261524283614e7a565b815261525060208401614e7a565b602082015261526160408401614e7a565b604082015261527260608401614e7a565b606082015261528360808401614e7a565b608082015261529460a08401614e7a565b60a08201526152a560c08401614e7a565b60c08201529392505050565b600080600080608085870312156152c757600080fd5b6152d085614e7a565b935060206152df818701614e7a565b935060408601359250606086013567ffffffffffffffff8082111561530357600080fd5b818801915088601f83011261531757600080fd5b81358181111561532957615329614f8c565b61533b601f8201601f19168501614fa2565b9150808252898482850101111561535157600080fd5b808484018584013760008482840101525080935050505092959194509250565b6000806040838503121561538457600080fd5b61538d83614e7a565b9150614f3560208401614e7a565b6000806000606084860312156153b057600080fd5b83359250602084013591506151c160408501614e7a565b600181811c908216806153db57607f821691505b6020821081141561137257634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526016908201527524b73b30b634b2103bb934ba32903837b9b4ba34b7b760511b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156154da576154da6154b1565b500190565b60008160001904831182151516156154f9576154f96154b1565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615523576155236154fe565b500490565b634e487b7160e01b600052603260045260246000fd5b6000600019821415615552576155526154b1565b5060010190565b60006020828403121561556b57600080fd5b5051919050565b600082821015615584576155846154b1565b500390565b6000835161559b818460208801614df6565b8351908301906155af818360208801614df6565b01949350505050565b60208082526023908201527f46756e64696e672072617465206d75737420626520677265617465722074686160408201526206e20360ec1b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008261565c5761565c6154fe565b500690565b60006020828403121561567357600080fd5b81516121d6816150bd565b60008251615690818460208701614df6565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516156d2816017850160208801614df6565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615703816028840160208801614df6565b01602801949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061574290830184614e22565b9695505050505050565b60006020828403121561575e57600080fd5b81516121d681614dc3565b600081615778576157786154b1565b506000190190565b634e487b7160e01b600052603160045260246000fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220743cd52fef48c9d48a87194ee18db5b980504ca6f39313b0c57780c6d223a96164736f6c6343000809003300000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc800000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000b854384baf57716df2231af260fcc9a548d2726c00000000000000000000000019e6ee4c2cbe7bcc4cd1ef0bcf7e764fece23cc60000000000000000000000007745370dfcc3780dd7675995b529d4e24960c0150000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b00000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c100000000000000000000000000000000000000000000000000000000000000174554482041746c616e746963205374726164646c65203300000000000000000000000000000000000000000000000000000000000000000000000000000000174554482d41544c414e5449432d5354524144444c452d33000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061043e5760003560e01c80637927113011610236578063c1419def1161013b578063de8b007a116100c3578063ef2bb7e211610087578063ef2bb7e214610b28578063f55b5b1014610b3b578063f9bb30e214610b4e578063fcec046814610b61578063ffe8e3721461096657600080fd5b8063de8b007a14610a62578063e985e9c514610a75578063ea3bd5df14610ab1578063ec87621c14610ac4578063ee0d82c114610ad957600080fd5b8063cddd38931161010a578063cddd3893146109a9578063cf4b6805146109b2578063d547741f146109c5578063d706f3f0146109d8578063da0321cd146109e157600080fd5b8063c1419def14610966578063c189c19b14610970578063c3d9ed3914610983578063c87b56dd1461099657600080fd5b806395d89b41116101be578063a22cb4651161018d578063a22cb46514610911578063acc3a00614610924578063b375d49214610937578063b88d4fde1461094a578063bbdce1681461095d57600080fd5b806395d89b4114610889578063998e59ae146108915780639ce990ea146108f6578063a217fddf1461090957600080fd5b80638df82800116102055780638df82800146107e257806390bb5855146107f557806391d148541461084a578063931efa961461085d57806393c82c751461086657600080fd5b806379271130146107a15780637c4b52cb146107b457806380ed71e4146107c75780638456cb59146107da57600080fd5b80633dbb196d1161034757806354545bfb116102cf5780636db29f6d116102935780636db29f6d146106ea5780636e821b2e146106f257806370a082311461077257806375153f3e14610785578063766718081461079857600080fd5b806354545bfb146106985780635c975abb146106a65780636352211e146106b15780636ae78edf146106c45780636c1085a1146106d757600080fd5b806342842e0e1161031657806342842e0e14610634578063468f02d2146106475780634a2a60701461064f5780634f6ccce7146106725780635387b84c1461068557600080fd5b80633dbb196d146105d65780633ec21260146105f65780633f4ba83a146106095780633f83b8a51461061157600080fd5b80632e1a7d4d116103ca57806333f4bb991161039957806333f4bb991461057157806336568abe1461057a5780633686a39e1461058d578063391feebb146105a05780633b8f56a0146105c357600080fd5b80632e1a7d4d146105255780632f2ff15d146105385780632f745c591461054b57806333277bca1461055e57600080fd5b8063162790551161041157806316279055146104c057806318160ddd146104d457806323b872dd146104e6578063248a9ca3146104f957806326325a781461051c57600080fd5b806301ffc9a71461044357806306fdde031461046b578063081812fc14610480578063095ea7b3146104ab575b600080fd5b610456610451366004614dd9565b610b6a565b60405190151581526020015b60405180910390f35b610473610b7b565b6040516104629190614e4e565b61049361048e366004614e61565b610c0d565b6040516001600160a01b039091168152602001610462565b6104be6104b9366004614e91565b610c34565b005b6104566104ce366004614ebb565b3b151590565b6009545b604051908152602001610462565b6104be6104f4366004614ed6565b610d4f565b6104d8610507366004614e61565b6000908152600b602052604090206001015490565b6104d860205481565b6104d8610533366004614e61565b610d80565b6104be610546366004614f12565b610f72565b6104d8610559366004614e91565b610f97565b6104be61056c366004614f3e565b61102d565b6104d860225481565b6104be610588366004614f12565b6110f4565b61045661059b366004614e61565b611172565b6104566105ae366004614ebb565b600d6020526000908152604090205460ff1681565b6104566105d1366004614f6a565b611378565b6105e96105e4366004614fd3565b6117eb565b6040516104629190615079565b6105e9610604366004614ebb565b611890565b6104be6119a4565b61045661061f366004614e61565b60196020526000908152604090205460ff1681565b6104be610642366004614ed6565b6119ba565b6104d86119d5565b61045661065d366004614e61565b601a6020526000908152604090205460ff1681565b6104d8610680366004614e61565b611a57565b6104d8610693366004614e61565b611aea565b6104d8662386f26fc1000081565b600c5460ff16610456565b6104936106bf366004614e61565b611c4d565b6104d86106d23660046150cb565b611cad565b6104be6106e5366004614e61565b611d6a565b610456611eab565b61073d610700366004614e61565b6017602052600090815260409020805460018201546002830154600384015460048501546005860154600690960154949593949293919290919087565b604080519788526020880196909652948601939093526060850191909152608084015260a083015260c082015260e001610462565b6104d8610780366004614ebb565b6120ba565b6104d8610793366004614e61565b612140565b6104d8600f5481565b6105e96107af366004614ebb565b6121dd565b6104be6107c2366004615106565b6122e8565b6104d86107d536600461518c565b61240e565b6104be6125d7565b6104d86107f0366004614e61565b6125ea565b61082a610803366004614e61565b601d6020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610462565b610456610858366004614f12565b612900565b6104d860245481565b610456610874366004614e61565b601b6020526000908152604090205460ff1681565b61047361292b565b6108ce61089f366004614e61565b601860205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a001610462565b6104d8610904366004614f3e565b61293a565b6104d8600081565b6104be61091f3660046151ca565b61299b565b6104be610932366004614ebb565b6129a6565b6104be610945366004615201565b6129ba565b6104be6109583660046152b1565b612afa565b6104d860215481565b6104d8620f424081565b6104d861097e366004614e61565b612b32565b6104be610991366004614ebb565b612baf565b6104736109a4366004614e61565b612bc3565b6104d860235481565b6104566109c0366004614e61565b612c36565b6104be6109d3366004614f12565b612ce5565b6104d8601f5481565b601054601154601254601354601454601554601654610a19966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e001610462565b6105e9610a70366004614fd3565b612d0a565b610456610a83366004615371565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b6104d8610abf36600461539b565b612daf565b6104d860008051602061579783398151915281565b610b0b610ae7366004614e61565b601c6020526000908152604090208054600182015460029092015490919060ff1683565b604080519384526020840192909252151590820152606001610462565b6104d8610b36366004614e61565b6133b6565b6104be610b49366004614e61565b6136c0565b6104be610b5c366004614e61565b613720565b6104d8601e5481565b6000610b7582613883565b92915050565b606060018054610b8a906153c7565b80601f0160208091040260200160405190810160405280929190818152602001828054610bb6906153c7565b8015610c035780601f10610bd857610100808354040283529160200191610c03565b820191906000526020600020905b815481529060010190602001808311610be657829003601f168201915b5050505050905090565b6000610c18826138a8565b506000908152600560205260409020546001600160a01b031690565b6000610c3f82611c4d565b9050806001600160a01b0316836001600160a01b03161415610cb25760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610cce5750610cce8133610a83565b610d405760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610ca9565b610d4a8383613907565b505050565b610d593382613975565b610d755760405162461bcd60e51b8152600401610ca9906153fc565b610d4a8383836139f3565b6000610d8a613b9a565b60026000541415610dad5760405162461bcd60e51b8152600401610ca99061544a565b6002600055610dba613be2565b33610dc483611c4d565b6001600160a01b031614610e0a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b6044820152606401610ca9565b6000828152601c60209081526040918290208251606081018452815480825260018301549382019390935260029091015460ff16151592810192909252610e635760405162461bcd60e51b8152600401610ca990615481565b80516000908152601b602052604090205460ff16610eba5760405162461bcd60e51b8152602060048201526014602482015273536574746c656d656e7473206e6f7420646f6e6560601b6044820152606401610ca9565b610ec383612140565b9150610ece83613c48565b81610f155760405162461bcd60e51b81526020600482015260176024820152760577269746520706f736974696f6e20706e6c206973203604c1b6044820152606401610ca9565b601054610f2c906001600160a01b03163384613cef565b604080518481526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a2506001600055919050565b6000828152600b6020526040902060010154610f8d81613d1f565b610d4a8383613d29565b6000610fa2836120ba565b82106110045760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610ca9565b506001600160a01b03919091166000908152600760209081526040808320938352929052205490565b600061103881613d1f565b6000841180156110485750600083115b80156110545750600082115b6110a05760405162461bcd60e51b815260206004820152601f60248201527f50657263656e7473206d7573742062652067726561746572207468616e2030006044820152606401610ca9565b601e849055602083815560228390556040805186815291820185905281018390527f55098e58cb45f2010b003083b66e4a51d1e887ad51259c626dc46dcdd0019bd99060600160405180910390a150505050565b6001600160a01b03811633146111645760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ca9565b61116e8282613daf565b5050565b600061117c613b9a565b60008051602061579783398151915261119481613d1f565b6000600f5460016111a591906154c7565b90508342106112025760405162461bcd60e51b8152602060048201526024808201527f4578706972792063616e6e6f74206265206265666f72652063757272656e742060448201526374696d6560e01b6064820152608401610ca9565b600f541580611220575060008181526019602052604090205460ff16155b6112785760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420626f6f747374726170207768656e207661756c7420697320726044820152636561647960e01b6064820152608401610ca9565b600f541561130757600f546000908152601b602052604090205460ff166113075760405162461bcd60e51b815260206004820152603f60248201527f43616e6e6f7420626f6f747374726170206265666f726520746865206375727260448201527f656e742065706f6368207761732065787069726564202620736574746c6564006064820152608401610ca9565b600081815260176020908152604080832042815560019081018890556019835292819020805460ff1916909317909255600f83905590518281527fb5ca1ca1b7b47549eb8af476f3ef702fc63bcd8b8c01dc163b009bb818f97997910160405180910390a160019250505b50919050565b6000611382613b9a565b60008051602061579783398151915261139a81613d1f565b600f54600090815260176020908152604091829020825160e081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a082015260069091015460c0820152846114425760405162461bcd60e51b8152602060048201526016602482015275050657263656e746167652063616e6e6f7420626520360541b6044820152606401610ca9565b80602001514210156114965760405162461bcd60e51b815260206004820152601d60248201527f54696d65206973206e6f7420706173742065706f6368206578706972790000006044820152606401610ca9565b600f546000908152601a602052604090205460ff16156114f85760405162461bcd60e51b815260206004820152601d60248201527f45706f63682077617320616c7265616479207072652d657870697265640000006044820152606401610ca9565b600f546000908152601b602052604090205460ff16156115565760405162461bcd60e51b8152602060048201526019602482015278115c1bd8da081dd85cc8185b1c9958591e48195e1c1a5c9959603a1b6044820152606401610ca9565b611564620f424060646154df565b858260a0015161157491906154c7565b11156115c25760405162461bcd60e51b815260206004820152601e60248201527f596f752063616e6e6f742073776170206d6f7265207468616e203130302500006044820152606401610ca9565b60006115d2620f424060646154df565b868360c001516115e291906154df565b6115ec9190615514565b9050600081156116cd5760006116028388613e16565b90508060186000600f548152602001908152602001600020600401600082825461162c91906154c7565b90915550600090508361164868056bc75e2d63100000846154df565b6116529190615514565b9050888560a0015161166491906154c7565b61166e8a836154df565b8660a00151876080015161168291906154df565b61168c91906154c7565b6116969190615514565b92508860176000600f54815260200190815260200160002060050160008282546116c091906154c7565b909155506116fb92505050565b6116d56119d5565b90506116e5620f424060646154df565b600f546000908152601760205260409020600501555b600f5460009081526017602052604090206004015461173057600f546000908152601760205260409020600401819055611765565b600f5460009081526017602052604090206004015461174f9082613ebd565b600f546000908152601760205260409020600401555b611773620f424060636154df565b600f5460009081526017602052604090206005015411156117ab57600f546000908152601a60205260409020805460ff191660011790555b6040513381527fe299059e3adc918e4f4ab456527f6220987ed7fce29c2bc9a416f9336822bdd29060200160405180910390a15060019695505050505050565b6060815167ffffffffffffffff81111561180757611807614f8c565b604051908082528060200260200182016040528015611830578160200160208202803683370190505b50905060005b82518110156113725761186183828151811061185457611854615528565b60200260200101516125ea565b82828151811061187357611873615528565b6020908102919091010152806118888161553e565b915050611836565b6060600061189d836120ba565b90506000805b828110156118eb5760006118b78683610f97565b6000818152601d6020526040902054909150156118da576118d78361553e565b92505b506118e48161553e565b90506118a3565b508067ffffffffffffffff81111561190557611905614f8c565b60405190808252806020026020018201604052801561192e578160200160208202803683370190505b5092506000805b8282101561199b5760006119498783610f97565b6000818152601d60205260409020549091501561198a578086848151811061197357611973615528565b60209081029190910101526119878361553e565b92505b6119938261553e565b915050611935565b50505050919050565b60006119af81613d1f565b6119b7613ed3565b50565b610d4a83838360405180602001604052806000815250612afa565b60135460408051632347816960e11b815290516000926001600160a01b03169163468f02d2916004808301926020929190829003018186803b158015611a1a57600080fd5b505afa158015611a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a529190615559565b905090565b6000611a6260095490565b8210611ac55760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610ca9565b60098281548110611ad857611ad8615528565b90600052602060002001549050919050565b6000818152601d602090815260408083208151608081018352815480825260018301549482019490945260028201549281019290925260030154606082015290611b725760405162461bcd60e51b815260206004820152601960248201527824b73b30b634b21039ba3930b2323632903837b9b4ba34b7b760391b6044820152606401610ca9565b805160009081526017602052604090819020600401549082015181811115611bda576020830151611ba38383615572565b611bad91906154df565b6060840151909450611bbf8383615572565b611bc991906154df565b611bd39085615572565b9350611c00565b6060830151611be98284615572565b611bf391906154df565b611bfd90856154c7565b93505b611c1368056bc75e2d6310000085615514565b9350611c23620f424060646154df565b602454611c3090866154df565b611c3a9190615514565b611c449085615572565b95945050505050565b6000818152600360205260408120546001600160a01b031680610b755760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610ca9565b60155460009083906001600160a01b0316635b7b6d88878588611cce6119d5565b611cd78b612b32565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a40160206040518083038186803b158015611d2857600080fd5b505afa158015611d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d609190615559565b611c4491906154df565b611d72613b9a565b60026000541415611d955760405162461bcd60e51b8152600401610ca99061544a565b6002600055611da2613be2565b33611dac82611c4d565b6001600160a01b031614611df25760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b6044820152606401610ca9565b6000818152601c6020526040902054611e405760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103837b9b4ba34b7b760811b6044820152606401610ca9565b6000818152601c6020908152604091829020600201805460ff8082161560ff199092168217909255835185815291161515918101919091527fb5e95d468eadd79446f495b23ddf06bb55ff5717a821eb2cc57154a31cd5ee22910160405180910390a1506001600055565b6000611eb5613b9a565b600080516020615797833981519152611ecd81613d1f565b600f54600090815260176020526040902060010154421015611f315760405162461bcd60e51b815260206004820152601d60248201527f54696d65206973206e6f7420706173742065706f6368206578706972790000006044820152606401610ca9565b600f546000908152601a602052604090205460ff16611f8e5760405162461bcd60e51b8152602060048201526019602482015278115c1bd8da081a185cc81b9bdd081c1c994b595e1c1a5c9959603a1b6044820152606401610ca9565b600f546000908152601b602052604090205460ff1615611fec5760405162461bcd60e51b8152602060048201526019602482015278115c1bd8da081dd85cc8185b1c9958591e48195e1c1a5c9959603a1b6044820152606401610ca9565b600f5460009081526018602052604090206003015461202b57600f546000908152601b60205260409020805460ff191660019081179091559150612083565b60405162461bcd60e51b815260206004820152602760248201527f416c6c20736574746c656d656e74732068617665206e6f74206265656e2070726044820152661bd8d95cdcd95960ca1b6064820152608401610ca9565b6040513381527f6a4de20bb9fa8fea199f1022f29eff6be1752c446674d16913f2afc2b3c5a8a59060200160405180910390a15090565b60006001600160a01b0382166121245760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610ca9565b506001600160a01b031660009081526004602052604090205490565b6000818152601c602090815260408083208151606081018352815480825260018301549482019490945260029091015460ff16151591810191909152906121995760405162461bcd60e51b8152600401610ca990615481565b80516000908152601760209081526040808320600201548451845260188352922060040154908301516121cc91906154df565b6121d69190615514565b9392505050565b606060006121ea836120ba565b90506000805b828110156122385760006122048683610f97565b6000818152601c602052604090205490915015612227576122248361553e565b92505b506122318161553e565b90506121f0565b508067ffffffffffffffff81111561225257612252614f8c565b60405190808252806020026020018201604052801561227b578160200160208202803683370190505b5092506000805b8282101561199b5760006122968783610f97565b6000818152601c6020526040902054909150156122d757808684815181106122c0576122c0615528565b60209081029190910101526122d48361553e565b92505b6122e08261553e565b915050612282565b60006122f381613d1f565b6122fb613f25565b811561232f5760405133904780156108fc02916000818181858888f1935050505015801561232d573d6000803e3d6000fd5b505b60005b8381101561240757600085858381811061234e5761234e615528565b90506020020160208101906123639190614ebb565b6040516370a0823160e01b81523060048201529091506123f49033906001600160a01b038416906370a082319060240160206040518083038186803b1580156123ab57600080fd5b505afa1580156123bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e39190615559565b6001600160a01b0384169190613cef565b50806123ff8161553e565b915050612332565b5050505050565b6000612418613b9a565b6002600054141561243b5760405162461bcd60e51b8152600401610ca99061544a565b6002600055612448613be2565b600084116124985760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020616d6f756e740000000000000000006044820152606401610ca9565b6000600f5460016124a991906154c7565b9050846017600083815260200190815260200160002060020160008282546124d191906154c7565b9091555050600081815260186020526040812060040180548792906124f79084906154c7565b90915550612506905083613f6e565b6040805160608101825283815260208082018981528815158385019081526000868152601c909352939091209151825551600182015590516002909101805460ff191691151591909117905560105490925061256d906001600160a01b0316333088613f98565b6040805182815260208101879052851515818301526001600160a01b038516606082015233608082015260a0810184905290517f14c0e56f4125d5707194bbf1beff49bb39b170a0f49574bcf25d8616f4df1cf69181900360c00190a15060016000559392505050565b60006125e281613d1f565b6119b7613fd0565b60006125f4613b9a565b600260005414156126175760405162461bcd60e51b8152600401610ca99061544a565b6002600055612624613be2565b6000828152601d6020908152604091829020825160808101845281548082526001830154938201939093526002820154938101939093526003015460608301526126ac5760405162461bcd60e51b815260206004820152601960248201527824b73b30b634b21039ba3930b2323632903837b9b4ba34b7b760391b6044820152606401610ca9565b80516000908152601a602052604090205460ff166127085760405162461bcd60e51b8152602060048201526019602482015278115c1bd8da081a185cc81b9bdd081c1c994b595e1c1a5c9959603a1b6044820152606401610ca9565b600061271384611aea565b9050600061272085611c4d565b905061272b85613c48565b8161276f5760405162461bcd60e51b815260206004820152601460248201527306275796572506e6c2063616e6e6f7420626520360641b6044820152606401610ca9565b600061277f620f424060646154df565b60205461278c90856154df565b6127969190615514565b905060006001600160a01b03831633146127e0576127b8620f424060646154df565b6022546127c590866154df565b6127cf9190615514565b90506127dd81601f54613ebd565b90505b6127ea81836154c7565b6127f49085615572565b85516000908152601860205260408120600301805492965060019290919061281d908490615572565b9091555081905061282e83866154c7565b61283891906154c7565b85516000908152601860205260408120600401805490919061285b908490615572565b909155505060165460105461287d916001600160a01b03918216911684613cef565b601054612894906001600160a01b03168486613cef565b6010546128ab906001600160a01b03163383613cef565b60408051888152602081018690526001600160a01b0385169133917fddd2b8bfe59e2aa6d76b0600fa7f6e161b9ece46b47a20197e2755899e7e8837910160405180910390a350506001600055509392505050565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060028054610b8a906153c7565b600060026064612951620f42406301e133806154df565b85856021548961296191906154df565b61296b91906154df565b61297591906154df565b61297f9190615514565b6129899190615514565b6129939190615514565b949350505050565b61116e33838361400d565b60006129b181613d1f565b61116e826140dc565b60006129c581613d1f565b8151601080546001600160a01b039283166001600160a01b0319918216179091556020840151601180549184169183169190911790556040808501516012805491851691841691909117905560608501516013805491851691841691909117905560808501516014805491851691841691909117905560a08501516015805491851691841691909117905560c08501516016805491909416921691909117909155517f488865203db2c6efd677f2757b6433d6fd6f452390e796b6719252b8588fcdf990612aee90849081516001600160a01b03908116825260208084015182169083015260408084015182169083015260608084015182169083015260808084015182169083015260a08381015182169083015260c092830151169181019190915260e00190565b60405180910390a15050565b612b043383613975565b612b205760405162461bcd60e51b8152600401610ca9906153fc565b612b2c848484846141df565b50505050565b60145460405163c189c19b60e01b8152600481018390526000916001600160a01b03169063c189c19b9060240160206040518083038186803b158015612b7757600080fd5b505afa158015612b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b759190615559565b6000612bba81613d1f565b61116e82614212565b6060612bce826138a8565b6000612be560408051602081019091526000815290565b90506000815111612c0557604051806020016040528060008152506121d6565b80612c0f846142c3565b604051602001612c20929190615589565b6040516020818303038152906040529392505050565b600080612c4281613d1f565b610e108311612ca45760405162461bcd60e51b815260206004820152602860248201527f426c61636b6f757420706572696f64206d757374206265206d6f726520746861604482015267371018903437bab960c11b6064820152608401610ca9565b60238390556040518381527f32e6db6aab294383bb2b48c5adfb1100050e096a4ce0eed5b7568604fc09f10b9060200160405180910390a150600192915050565b6000828152600b6020526040902060010154612d0081613d1f565b610d4a8383613daf565b6060815167ffffffffffffffff811115612d2657612d26614f8c565b604051908082528060200260200182016040528015612d4f578160200160208202803683370190505b50905060005b825181101561137257612d80838281518110612d7357612d73615528565b60200260200101516133b6565b828281518110612d9257612d92615528565b602090810291909101015280612da78161553e565b915050612d55565b6000612db9613b9a565b60026000541415612ddc5760405162461bcd60e51b8152600401610ca99061544a565b6002600055612de9613be2565b6000600f5411612e2b5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840cae0dec6d609b1b6044820152606401610ca9565b662386f26fc100008411612e725760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610ca9565b602354600f54600090815260176020526040902060010154612e949190615572565b4210612ef15760405162461bcd60e51b815260206004820152602660248201527f43616e6e6f7420707572636861736520647572696e6720626c61636b6f7574206044820152651c195c9a5bd960d21b6064820152608401610ca9565b6000612efb6119d5565b600f5460009081526017602052604081206001015491925090612f1f904290615572565b905068056bc75e2d63100000612f3587846154df565b612f3f9190615514565b600f54600090815260176020526040902060030154612f689068056bc75e2d6310000090615514565b600f54600090815260176020526040902060020154612f879190615572565b1015612fdf5760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f756768204150206c697175696469747920617661696c61626c6044820152606560f81b6064820152608401610ca9565b600061301468056bc75e2d631000006002612ffa8a876154df565b6130049190615514565b61300e9190615514565b876143c1565b905068056bc75e2d63100000600261302c89866154df565b6130369190615514565b6130409190615514565b600f5460009081526018602052604081206004018054909190613064908490615572565b90915550600090506130778260026154df565b61308189866154df565b61308b9190615514565b90508160176000600f54815260200190815260200160002060060160008282546130b591906154c7565b909155506130c690508260026154df565b6130d090826154df565b600f54600090815260176020526040812060030180549091906130f49084906154c7565b909155506000905061312760018361310d8660026154df565b600f54600090815260176020526040902060010154611cad565b905060006131408361313a8660026154df565b8761293a565b600f546000908152601860205260408120805492935084929091906131669084906154c7565b9091555050600f546000908152601860205260408120600101805483929061318f9084906154c7565b909155506131a090508460026154df565b600f54600090815260186020526040812060020180549091906131c49084906154c7565b9091555050600f5460009081526018602052604081206003018054600192906131ee9084906154c7565b909155506131fd905088613f6e565b96506040518060800160405280600f54815260200185600261321f91906154df565b81526020808201869052604091820187905260008a8152601d82528281208451815591840151600183015591830151600282015560609092015160039092019190915561327868056bc75e2d63100000620f42406154df565b6132839060646154df565b601e54613290898e6154df565b61329a91906154df565b6132a49190615514565b90506132e833308368056bc75e2d631000006132c087896154c7565b6132ca9190615514565b6132d491906154c7565b6010546001600160a01b0316929190613f98565b601654601054613305916001600160a01b03918216911683613cef565b68056bc75e2d6310000061331983856154c7565b6133239190615514565b600f54600090815260186020526040812060040180549091906133479084906154c7565b909155507f12cb4648cf3058b17ceeb33e579f8b0bc269fe0843f3900b8e24b6c54871703c9050898961337a85876154c7565b604080516001600160a01b03909416845260208401929092529082015260600160405180910390a1505060016000555093979650505050505050565b60006133c0613b9a565b600260005414156133e35760405162461bcd60e51b8152600401610ca99061544a565b60026000556133f0613be2565b6000828152601c60209081526040918290208251606081018452815481526001820154928101929092526002015460ff161515918101829052906134765760405162461bcd60e51b815260206004820152601760248201527f526f6c6c6f766572206e6f7420617574686f72697a65640000000000000000006044820152606401610ca9565b80516134945760405162461bcd60e51b8152600401610ca990615481565b80516000908152601b602052604090205460ff166134ec5760405162461bcd60e51b8152602060048201526015602482015274115c1bd8da081a185cc81b9bdd08195e1c1a5c9959605a1b6044820152606401610ca9565b60006134f784612140565b9050600061350485611c4d565b905061350f85613c48565b816135565760405162461bcd60e51b81526020600482015260176024820152760577269746520706f736974696f6e20706e6c206973203604c1b6044820152606401610ca9565b60408051868152602081018490526001600160a01b038316917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a26000600f5460016135ab91906154c7565b9050826017600083815260200190815260200160002060020160008282546135d391906154c7565b9091555050600081815260186020526040812060040180548592906135f99084906154c7565b90915550613608905082613f6e565b6040805160608082018352848252602080830188815260018486018181526000888152601c85528790209551865591518582015590516002909401805460ff1916941515949094179093558351868152908101889052928301919091526001600160a01b038516908201819052608082015260a081018290529095507f14c0e56f4125d5707194bbf1beff49bb39b170a0f49574bcf25d8616f4df1cf69060c00160405180910390a150506001600055509092915050565b60006136cb81613d1f565b600082116136eb5760405162461bcd60e51b8152600401610ca9906155b8565b60248290556040518281527fe4d44cc62a77ab305c1c324248b29e91f621d65b1c231ee984dd6800b2ff7b4690602001612aee565b600061372b81613d1f565b6000821161374b5760405162461bcd60e51b8152600401610ca9906155b8565b60218290556040518281527fc5c758ec4001ae2dfceeb8a99ff59eacf17b62ca95bae713257b9dd494b9a84090602001612aee565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b1580156137cc57600080fd5b505afa1580156137e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138049190615559565b61380e91906154c7565b6040516001600160a01b038516602482015260448101829052909150612b2c90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261441a565b606061299384846000856144ec565b60006001600160e01b03198216637965db0b60e01b1480610b755750610b758261461d565b6000818152600360205260409020546001600160a01b03166119b75760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610ca9565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061393c82611c4d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061398183611c4d565b9050806001600160a01b0316846001600160a01b031614806139c857506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b806129935750836001600160a01b03166139e184610c0d565b6001600160a01b031614949350505050565b826001600160a01b0316613a0682611c4d565b6001600160a01b031614613a6a5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610ca9565b6001600160a01b038216613acc5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610ca9565b613ad7838383614642565b613ae2600082613907565b6001600160a01b0383166000908152600460205260408120805460019290613b0b908490615572565b90915550506001600160a01b0382166000908152600460205260408120805460019290613b399084906154c7565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600c5460ff1615613be05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610ca9565b565b333214613be057336000908152600d602052604090205460ff16613be05760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c6973746564000000006044820152606401610ca9565b6000613c5382611c4d565b9050613c6181600084614642565b613c6c600083613907565b6001600160a01b0381166000908152600460205260408120805460019290613c95908490615572565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6040516001600160a01b038316602482015260448101829052610d4a90849063a9059cbb60e01b9060640161383d565b6119b7813361464d565b613d338282612900565b61116e576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613d6b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b613db98282612900565b1561116e576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60125460115460105460405163b91ac49560e01b81526001600160a01b0392831660048201529082166024820152604481018590526000606482018190526084820185905292919091169063b91ac4959060a4015b602060405180830381600087803b158015613e8557600080fd5b505af1158015613e99573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d69190615559565b6000818310613ecc57816121d6565b5090919050565b613edb613f25565b600c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600c5460ff16613be05760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610ca9565b6000613f79600e5490565b9050613f89600e80546001019055565b613f9382826146b1565b919050565b6040516001600160a01b0380851660248301528316604482015260648101829052612b2c9085906323b872dd60e01b9060840161383d565b613fd8613b9a565b600c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613f083390565b816001600160a01b0316836001600160a01b0316141561406f5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610ca9565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b803b61412a5760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e74726163740000000000006044820152606401610ca9565b6001600160a01b0381166000908152600d602052604090205460ff16156141935760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c6973746564000000006044820152606401610ca9565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b6141ea8484846139f3565b6141f6848484846146cb565b612b2c5760405162461bcd60e51b8152600401610ca9906155fb565b6001600160a01b0381166000908152600d602052604090205460ff1661427a5760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c697374656400000000000000006044820152606401610ca9565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b6060816142e75750506040805180820190915260018152600360fc1b602082015290565b8160005b811561431157806142fb8161553e565b915061430a9050600a83615514565b91506142eb565b60008167ffffffffffffffff81111561432c5761432c614f8c565b6040519080825280601f01601f191660200182016040528015614356576020820181803683370190505b5090505b84156129935761436b600183615572565b9150614378600a8661564d565b6143839060306154c7565b60f81b81838151811061439857614398615528565b60200101906001600160f81b031916908160001a9053506143ba600a86615514565b945061435a565b60125460105460115460405163b91ac49560e01b81526001600160a01b0392831660048201529082166024820152604481018590526000606482018190526084820185905292919091169063b91ac4959060a401613e6b565b600061446f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166138749092919063ffffffff16565b805190915015610d4a578080602001905181019061448d9190615661565b610d4a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610ca9565b60608247101561454d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610ca9565b6001600160a01b0385163b6145a45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ca9565b600080866001600160a01b031685876040516145c0919061567e565b60006040518083038185875af1925050503d80600081146145fd576040519150601f19603f3d011682016040523d82523d6000602084013e614602565b606091505b50915091506146128282866147d5565b979650505050505050565b60006001600160e01b0319821663780e9d6360e01b1480610b755750610b758261480e565b610d4a83838361485e565b6146578282612900565b61116e5761466f816001600160a01b03166014614916565b61467a836020614916565b60405160200161468b92919061569a565b60408051601f198184030181529082905262461bcd60e51b8252610ca991600401614e4e565b61116e828260405180602001604052806000815250614ab2565b60006001600160a01b0384163b156147cd57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061470f90339089908890889060040161570f565b602060405180830381600087803b15801561472957600080fd5b505af1925050508015614759575060408051601f3d908101601f191682019092526147569181019061574c565b60015b6147b3573d808015614787576040519150601f19603f3d011682016040523d82523d6000602084013e61478c565b606091505b5080516147ab5760405162461bcd60e51b8152600401610ca9906155fb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612993565b506001612993565b606083156147e45750816121d6565b8251156147f45782518084602001fd5b8160405162461bcd60e51b8152600401610ca99190614e4e565b60006001600160e01b031982166380ac58cd60e01b148061483f57506001600160e01b03198216635b5e139f60e01b145b80610b7557506301ffc9a760e01b6001600160e01b0319831614610b75565b6001600160a01b0383166148b9576148b481600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b6148dc565b816001600160a01b0316836001600160a01b0316146148dc576148dc8382614ae5565b6001600160a01b0382166148f357610d4a81614b82565b826001600160a01b0316826001600160a01b031614610d4a57610d4a8282614c31565b606060006149258360026154df565b6149309060026154c7565b67ffffffffffffffff81111561494857614948614f8c565b6040519080825280601f01601f191660200182016040528015614972576020820181803683370190505b509050600360fc1b8160008151811061498d5761498d615528565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106149bc576149bc615528565b60200101906001600160f81b031916908160001a90535060006149e08460026154df565b6149eb9060016154c7565b90505b6001811115614a63576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614a1f57614a1f615528565b1a60f81b828281518110614a3557614a35615528565b60200101906001600160f81b031916908160001a90535060049490941c93614a5c81615769565b90506149ee565b5083156121d65760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ca9565b614abc8383614c75565b614ac960008484846146cb565b610d4a5760405162461bcd60e51b8152600401610ca9906155fb565b60006001614af2846120ba565b614afc9190615572565b600083815260086020526040902054909150808214614b4f576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b5060009182526008602090815260408084208490556001600160a01b039094168352600781528383209183525290812055565b600954600090614b9490600190615572565b6000838152600a602052604081205460098054939450909284908110614bbc57614bbc615528565b906000526020600020015490508060098381548110614bdd57614bdd615528565b6000918252602080832090910192909255828152600a90915260408082208490558582528120556009805480614c1557614c15615780565b6001900381819060005260206000200160009055905550505050565b6000614c3c836120ba565b6001600160a01b039093166000908152600760209081526040808320868452825280832085905593825260089052919091209190915550565b6001600160a01b038216614ccb5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610ca9565b6000818152600360205260409020546001600160a01b031615614d305760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610ca9565b614d3c60008383614642565b6001600160a01b0382166000908152600460205260408120805460019290614d659084906154c7565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160e01b0319811681146119b757600080fd5b600060208284031215614deb57600080fd5b81356121d681614dc3565b60005b83811015614e11578181015183820152602001614df9565b83811115612b2c5750506000910152565b60008151808452614e3a816020860160208601614df6565b601f01601f19169290920160200192915050565b6020815260006121d66020830184614e22565b600060208284031215614e7357600080fd5b5035919050565b80356001600160a01b0381168114613f9357600080fd5b60008060408385031215614ea457600080fd5b614ead83614e7a565b946020939093013593505050565b600060208284031215614ecd57600080fd5b6121d682614e7a565b600080600060608486031215614eeb57600080fd5b614ef484614e7a565b9250614f0260208501614e7a565b9150604084013590509250925092565b60008060408385031215614f2557600080fd5b82359150614f3560208401614e7a565b90509250929050565b600080600060608486031215614f5357600080fd5b505081359360208301359350604090920135919050565b60008060408385031215614f7d57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715614fcb57614fcb614f8c565b604052919050565b60006020808385031215614fe657600080fd5b823567ffffffffffffffff80821115614ffe57600080fd5b818501915085601f83011261501257600080fd5b81358181111561502457615024614f8c565b8060051b9150615035848301614fa2565b818152918301840191848101908884111561504f57600080fd5b938501935b8385101561506d57843582529385019390850190615054565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156150b157835183529284019291840191600101615095565b50909695505050505050565b80151581146119b757600080fd5b600080600080608085870312156150e157600080fd5b84356150ec816150bd565b966020860135965060408601359560600135945092505050565b60008060006040848603121561511b57600080fd5b833567ffffffffffffffff8082111561513357600080fd5b818601915086601f83011261514757600080fd5b81358181111561515657600080fd5b8760208260051b850101111561516b57600080fd5b60209283019550935050840135615181816150bd565b809150509250925092565b6000806000606084860312156151a157600080fd5b8335925060208401356151b3816150bd565b91506151c160408501614e7a565b90509250925092565b600080604083850312156151dd57600080fd5b6151e683614e7a565b915060208301356151f6816150bd565b809150509250929050565b600060e0828403121561521357600080fd5b60405160e0810181811067ffffffffffffffff8211171561523657615236614f8c565b60405261524283614e7a565b815261525060208401614e7a565b602082015261526160408401614e7a565b604082015261527260608401614e7a565b606082015261528360808401614e7a565b608082015261529460a08401614e7a565b60a08201526152a560c08401614e7a565b60c08201529392505050565b600080600080608085870312156152c757600080fd5b6152d085614e7a565b935060206152df818701614e7a565b935060408601359250606086013567ffffffffffffffff8082111561530357600080fd5b818801915088601f83011261531757600080fd5b81358181111561532957615329614f8c565b61533b601f8201601f19168501614fa2565b9150808252898482850101111561535157600080fd5b808484018584013760008482840101525080935050505092959194509250565b6000806040838503121561538457600080fd5b61538d83614e7a565b9150614f3560208401614e7a565b6000806000606084860312156153b057600080fd5b83359250602084013591506151c160408501614e7a565b600181811c908216806153db57607f821691505b6020821081141561137257634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526016908201527524b73b30b634b2103bb934ba32903837b9b4ba34b7b760511b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156154da576154da6154b1565b500190565b60008160001904831182151516156154f9576154f96154b1565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615523576155236154fe565b500490565b634e487b7160e01b600052603260045260246000fd5b6000600019821415615552576155526154b1565b5060010190565b60006020828403121561556b57600080fd5b5051919050565b600082821015615584576155846154b1565b500390565b6000835161559b818460208801614df6565b8351908301906155af818360208801614df6565b01949350505050565b60208082526023908201527f46756e64696e672072617465206d75737420626520677265617465722074686160408201526206e20360ec1b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008261565c5761565c6154fe565b500690565b60006020828403121561567357600080fd5b81516121d6816150bd565b60008251615690818460208701614df6565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516156d2816017850160208801614df6565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615703816028840160208801614df6565b01602801949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061574290830184614e22565b9695505050505050565b60006020828403121561575e57600080fd5b81516121d681614dc3565b600081615778576157786154b1565b506000190190565b634e487b7160e01b600052603160045260246000fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220743cd52fef48c9d48a87194ee18db5b980504ca6f39313b0c57780c6d223a96164736f6c63430008090033

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

00000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000160000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc800000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000b854384baf57716df2231af260fcc9a548d2726c00000000000000000000000019e6ee4c2cbe7bcc4cd1ef0bcf7e764fece23cc60000000000000000000000007745370dfcc3780dd7675995b529d4e24960c0150000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b00000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c100000000000000000000000000000000000000000000000000000000000000174554482041746c616e746963205374726164646c65203300000000000000000000000000000000000000000000000000000000000000000000000000000000174554482d41544c414e5449432d5354524144444c452d33000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): ETH Atlantic Straddle 3
Arg [1] : _symbol (string): ETH-ATLANTIC-STRADDLE-3
Arg [2] : _addresses (tuple):
Arg [1] : usd (address): 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8
Arg [2] : underlying (address): 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
Arg [3] : assetSwapper (address): 0xB854384bAF57716df2231Af260fCC9A548d2726C
Arg [4] : priceOracle (address): 0x19e6eE4C2cBe7Bcc4cd1ef0BCF7e764fECe23cC6
Arg [5] : volatilityOracle (address): 0x7745370DFcC3780DD7675995b529d4e24960c015
Arg [6] : optionPricing (address): 0x2b99e3D67dAD973c1B9747Da742B7E26c8Bdd67B
Arg [7] : feeDistributor (address): 0x55594cCe8cC0014eA08C49fd820D731308f204c1


-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [2] : 000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8
Arg [3] : 00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1
Arg [4] : 000000000000000000000000b854384baf57716df2231af260fcc9a548d2726c
Arg [5] : 00000000000000000000000019e6ee4c2cbe7bcc4cd1ef0bcf7e764fece23cc6
Arg [6] : 0000000000000000000000007745370dfcc3780dd7675995b529d4e24960c015
Arg [7] : 0000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b
Arg [8] : 00000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c1
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000017
Arg [10] : 4554482041746c616e746963205374726164646c652033000000000000000000
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000017
Arg [12] : 4554482d41544c414e5449432d5354524144444c452d33000000000000000000


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

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