ETH Price: $3,391.16 (-1.62%)
Gas: 1 Gwei

Contract

0x97bDb4aeD0B50a335A78Ed24F68528ce3222Af72
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x61016060171631662023-05-01 2:59:11424 days ago1682909951IN
 Create: Blend
0 ETH0.2778135852

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Blend

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 23 : Blend.sol
// SPDX-License-Identifier: BSL 1.1 - Blend (c) Non Fungible Trading Ltd.
pragma solidity 0.8.17;

import "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol";

import "./CalculationHelpers.sol";
import "./lib/Structs.sol";
import "./OfferController.sol";
import "./interfaces/IBlend.sol";
import "./interfaces/IBlurPool.sol";

interface IExchange {
    function execute(Input calldata sell, Input calldata buy) external payable;
}

contract Blend is IBlend, OfferController, UUPSUpgradeable {
    uint256 private constant _BASIS_POINTS = 10_000;
    uint256 private constant _MAX_AUCTION_DURATION = 432_000;
    IBlurPool private immutable pool;
    uint256 private _nextLienId;

    mapping(uint256 => bytes32) public liens;
    mapping(bytes32 => uint256) public amountTaken;

    // required by the OZ UUPS module
    function _authorizeUpgrade(address) internal override onlyOwner {}

    constructor(IBlurPool _pool) {
        pool = _pool;
        _disableInitializers();
    }

    function initialize() external initializer {
        __UUPSUpgradeable_init();
        __Ownable_init();
    }

    /*//////////////////////////////////////////////////
                    BORROW FLOWS
    //////////////////////////////////////////////////*/

    /**
     * @notice Verifies and takes loan offer; then transfers loan and collateral assets
     * @param offer Loan offer
     * @param signature Lender offer signature
     * @param loanAmount Loan amount in ETH
     * @param collateralTokenId Token id to provide as collateral
     * @return lienId New lien id
     */
    function borrow(
        LoanOffer calldata offer,
        bytes calldata signature,
        uint256 loanAmount,
        uint256 collateralTokenId
    ) external returns (uint256 lienId) {
        lienId = _borrow(offer, signature, loanAmount, collateralTokenId);

        /* Lock collateral token. */
        offer.collection.safeTransferFrom(msg.sender, address(this), collateralTokenId);

        /* Transfer loan to borrower. */
        pool.transferFrom(offer.lender, msg.sender, loanAmount);
    }

    /**
     * @notice Repays loan and retrieves collateral
     * @param lien Lien preimage
     * @param lienId Lien id
     */
    function repay(
        Lien calldata lien,
        uint256 lienId
    ) external validateLien(lien, lienId) lienIsActive(lien) {
        uint256 debt = _repay(lien, lienId);

        /* Return NFT to borrower. */
        lien.collection.safeTransferFrom(address(this), lien.borrower, lien.tokenId);

        /* Repay loan to lender. */
        pool.transferFrom(msg.sender, lien.lender, debt);
    }

    /**
     * @notice Verifies and takes loan offer; creates new lien
     * @param offer Loan offer
     * @param signature Lender offer signature
     * @param loanAmount Loan amount in ETH
     * @param collateralTokenId Token id to provide as collateral
     * @return lienId New lien id
     */
    function _borrow(
        LoanOffer calldata offer,
        bytes calldata signature,
        uint256 loanAmount,
        uint256 collateralTokenId
    ) internal returns (uint256 lienId) {
        if (offer.auctionDuration > _MAX_AUCTION_DURATION) {
            revert InvalidAuctionDuration();
        }

        Lien memory lien = Lien({
            lender: offer.lender,
            borrower: msg.sender,
            collection: offer.collection,
            tokenId: collateralTokenId,
            amount: loanAmount,
            startTime: block.timestamp,
            rate: offer.rate,
            auctionStartBlock: 0,
            auctionDuration: offer.auctionDuration
        });

        /* Create lien. */
        unchecked {
            liens[lienId = _nextLienId++] = keccak256(abi.encode(lien));
        }

        /* Take the loan offer. */
        _takeLoanOffer(offer, signature, lien, lienId);
    }

    /**
     * @notice Computes the current debt repayment and burns the lien
     * @dev Does not transfer assets
     * @param lien Lien preimage
     * @param lienId Lien id
     * @return debt Current amount of debt owed on the lien
     */
    function _repay(Lien calldata lien, uint256 lienId) internal returns (uint256 debt) {
        debt = CalculationHelpers.computeCurrentDebt(lien.amount, lien.rate, lien.startTime);

        delete liens[lienId];

        emit Repay(lienId, address(lien.collection));
    }

    /**
     * @notice Verifies and takes loan offer
     * @dev Does not transfer loan and collateral assets; does not update lien hash
     * @param offer Loan offer
     * @param signature Lender offer signature
     * @param lien Lien preimage
     * @param lienId Lien id
     */
    function _takeLoanOffer(
        LoanOffer calldata offer,
        bytes calldata signature,
        Lien memory lien,
        uint256 lienId
    ) internal {
        bytes32 hash = _hashOffer(offer);

        _validateOffer(
            hash,
            offer.lender,
            offer.oracle,
            signature,
            offer.expirationTime,
            offer.salt
        );

        if (offer.rate > _LIQUIDATION_THRESHOLD) {
            revert RateTooHigh();
        }
        if (lien.amount > offer.maxAmount || lien.amount < offer.minAmount) {
            revert InvalidLoan();
        }
        uint256 _amountTaken = amountTaken[hash];
        if (offer.totalAmount - _amountTaken < lien.amount) {
            revert InsufficientOffer();
        }

        unchecked {
            amountTaken[hash] = _amountTaken + lien.amount;
        }

        emit LoanOfferTaken(
            hash,
            lienId,
            address(offer.collection),
            lien.lender,
            lien.borrower,
            lien.amount,
            lien.rate,
            lien.tokenId,
            lien.auctionDuration
        );
    }

    /*//////////////////////////////////////////////////
                    REFINANCING FLOWS
    //////////////////////////////////////////////////*/

    /**
     * @notice Starts Dutch Auction on lien ownership
     * @dev Must be called by lien owner
     * @param lienId Lien token id
     */
    function startAuction(Lien calldata lien, uint256 lienId) external validateLien(lien, lienId) {
        if (msg.sender != lien.lender) {
            revert Unauthorized();
        }

        /* Cannot start if auction has already started. */
        if (lien.auctionStartBlock != 0) {
            revert AuctionIsActive();
        }

        /* Add auction start block to lien. */
        liens[lienId] = keccak256(
            abi.encode(
                Lien({
                    lender: lien.lender,
                    borrower: lien.borrower,
                    collection: lien.collection,
                    tokenId: lien.tokenId,
                    amount: lien.amount,
                    startTime: lien.startTime,
                    rate: lien.rate,
                    auctionStartBlock: block.number,
                    auctionDuration: lien.auctionDuration
                })
            )
        );

        emit StartAuction(lienId, address(lien.collection));
    }

    /**
     * @notice Seizes collateral from defaulted lien, skipping liens that are not defaulted
     * @param lienPointers List of lien, lienId pairs
     */
    function seize(LienPointer[] calldata lienPointers) external {
        uint256 length = lienPointers.length;
        for (uint256 i; i < length; ) {
            Lien calldata lien = lienPointers[i].lien;
            uint256 lienId = lienPointers[i].lienId;

            if (msg.sender != lien.lender) {
                revert Unauthorized();
            }
            if (!_validateLien(lien, lienId)) {
                revert InvalidLien();
            }

            /* Check that the auction has ended and lien is defaulted. */
            if (_lienIsDefaulted(lien)) {
                delete liens[lienId];

                /* Seize collateral to lender. */
                lien.collection.safeTransferFrom(address(this), lien.lender, lien.tokenId);

                emit Seize(lienId, address(lien.collection));
            }

            unchecked {
                ++i;
            }
        }
    }

    /**
     * @notice Refinances to different loan amount and repays previous loan
     * @dev Must be called by lender; previous loan must be repaid with interest
     * @param lien Lien struct
     * @param lienId Lien id
     * @param offer Loan offer
     * @param signature Offer signatures
     */
    function refinance(
        Lien calldata lien,
        uint256 lienId,
        LoanOffer calldata offer,
        bytes calldata signature
    ) external validateLien(lien, lienId) lienIsActive(lien) {
        if (msg.sender != lien.lender) {
            revert Unauthorized();
        }

        /* Interest rate must be at least as good as current. */
        if (offer.rate > lien.rate || offer.auctionDuration != lien.auctionDuration) {
            revert InvalidRefinance();
        }

        uint256 debt = CalculationHelpers.computeCurrentDebt(lien.amount, lien.rate, lien.startTime);

        _refinance(lien, lienId, debt, offer, signature);

        /* Repay initial loan. */
        pool.transferFrom(offer.lender, lien.lender, debt);
    }

    /**
     * @notice Refinance lien in auction at the current debt amount where the interest rate ceiling increases over time
     * @dev Interest rate must be lower than the interest rate ceiling
     * @param lien Lien struct
     * @param lienId Lien token id
     * @param rate Interest rate (in bips)
     * @dev Formula: https://www.desmos.com/calculator/urasr71dhb
     */
    function refinanceAuction(
        Lien calldata lien,
        uint256 lienId,
        uint256 rate
    ) external validateLien(lien, lienId) auctionIsActive(lien) {
        /* Rate must be below current rate limit. */
        uint256 rateLimit = CalculationHelpers.calcRefinancingAuctionRate(
            lien.auctionStartBlock,
            lien.auctionDuration,
            lien.rate
        );
        if (rate > rateLimit) {
            revert RateTooHigh();
        }

        uint256 debt = CalculationHelpers.computeCurrentDebt(lien.amount, lien.rate, lien.startTime);

        /* Reset the lien with the new lender and interest rate. */
        liens[lienId] = keccak256(
            abi.encode(
                Lien({
                    lender: msg.sender, // set new lender
                    borrower: lien.borrower,
                    collection: lien.collection,
                    tokenId: lien.tokenId,
                    amount: debt, // new loan begins with previous debt
                    startTime: block.timestamp,
                    rate: rate,
                    auctionStartBlock: 0, // close the auction
                    auctionDuration: lien.auctionDuration
                })
            )
        );

        emit Refinance(
            lienId,
            address(lien.collection),
            msg.sender,
            debt,
            rate,
            lien.auctionDuration
        );

        /* Repay the initial loan. */
        pool.transferFrom(msg.sender, lien.lender, debt);
    }

    /**
     * @notice Refinances to different loan amount and repays previous loan
     * @param lien Lien struct
     * @param lienId Lien id
     * @param offer Loan offer
     * @param signature Offer signatures
     */
    function refinanceAuctionByOther(
        Lien calldata lien,
        uint256 lienId,
        LoanOffer calldata offer,
        bytes calldata signature
    ) external validateLien(lien, lienId) auctionIsActive(lien) {
        /* Rate must be below current rate limit and auction duration must be the same. */
        uint256 rateLimit = CalculationHelpers.calcRefinancingAuctionRate(
            lien.auctionStartBlock,
            lien.auctionDuration,
            lien.rate
        );
        if (offer.rate > rateLimit || offer.auctionDuration != lien.auctionDuration) {
            revert InvalidRefinance();
        }

        uint256 debt = CalculationHelpers.computeCurrentDebt(lien.amount, lien.rate, lien.startTime);

        _refinance(lien, lienId, debt, offer, signature);

        /* Repay initial loan. */
        pool.transferFrom(offer.lender, lien.lender, debt);
    }

    /**
     * @notice Refinances to different loan amount and repays previous loan
     * @dev Must be called by borrower; previous loan must be repaid with interest
     * @param lien Lien struct
     * @param lienId Lien id
     * @param loanAmount New loan amount
     * @param offer Loan offer
     * @param signature Offer signatures
     */
    function borrowerRefinance(
        Lien calldata lien,
        uint256 lienId,
        uint256 loanAmount,
        LoanOffer calldata offer,
        bytes calldata signature
    ) external validateLien(lien, lienId) lienIsActive(lien) {
        if (msg.sender != lien.borrower) {
            revert Unauthorized();
        }
        if (offer.auctionDuration > _MAX_AUCTION_DURATION) {
            revert InvalidAuctionDuration();
        }

        _refinance(lien, lienId, loanAmount, offer, signature);

        uint256 debt = CalculationHelpers.computeCurrentDebt(lien.amount, lien.rate, lien.startTime);

        if (loanAmount >= debt) {
            /* If new loan is more than the previous, repay the initial loan and send the remaining to the borrower. */
            pool.transferFrom(offer.lender, lien.lender, debt);
            unchecked {
                pool.transferFrom(offer.lender, lien.borrower, loanAmount - debt);
            }
        } else {
            /* If new loan is less than the previous, borrower must supply the difference to repay the initial loan. */
            pool.transferFrom(offer.lender, lien.lender, loanAmount);
            unchecked {
                pool.transferFrom(lien.borrower, lien.lender, debt - loanAmount);
            }
        }
    }

    function _refinance(
        Lien calldata lien,
        uint256 lienId,
        uint256 loanAmount,
        LoanOffer calldata offer,
        bytes calldata signature
    ) internal {
        if (lien.collection != offer.collection) {
            revert CollectionsDoNotMatch();
        }

        /* Update lien with new loan details. */
        Lien memory newLien = Lien({
            lender: offer.lender, // set new lender
            borrower: lien.borrower,
            collection: lien.collection,
            tokenId: lien.tokenId,
            amount: loanAmount,
            startTime: block.timestamp,
            rate: offer.rate,
            auctionStartBlock: 0, // close the auction
            auctionDuration: offer.auctionDuration
        });
        liens[lienId] = keccak256(abi.encode(newLien));

        /* Take the loan offer. */
        _takeLoanOffer(offer, signature, newLien, lienId);

        emit Refinance(
            lienId,
            address(offer.collection),
            offer.lender,
            loanAmount,
            offer.rate,
            offer.auctionDuration
        );
    }

    /*/////////////////////////////////////////////////////////////
                          MARKETPLACE FLOWS
    /////////////////////////////////////////////////////////////*/

    IExchange private constant _EXCHANGE = IExchange(0x000000000000Ad05Ccc4F10045630fb830B95127);
    address private constant _SELL_MATCHING_POLICY = 0x0000000000daB4A563819e8fd93dbA3b25BC3495;
    address private constant _BID_MATCHING_POLICY = 0x0000000000b92D5d043FaF7CECf7E2EE6aaeD232;
    address private constant _DELEGATE = 0x00000000000111AbE46ff893f3B2fdF1F759a8A8;

    /**
     * @notice Purchase an NFT and use as collateral for a loan
     * @param offer Loan offer to take
     * @param signature Lender offer signature
     * @param loanAmount Loan amount in ETH
     * @param execution Marketplace execution data
     * @return lienId Lien id
     */
    function buyToBorrow(
        LoanOffer calldata offer,
        bytes calldata signature,
        uint256 loanAmount,
        Execution calldata execution
    ) public returns (uint256 lienId) {
        if (execution.makerOrder.order.trader == address(this)) {
            revert Unauthorized();
        }
        if (offer.auctionDuration > _MAX_AUCTION_DURATION) {
            revert InvalidAuctionDuration();
        }

        uint256 collateralTokenId = execution.makerOrder.order.tokenId;
        uint256 price = execution.makerOrder.order.price;

        /* Create lien. */
        Lien memory lien = Lien({
            lender: offer.lender,
            borrower: msg.sender,
            collection: offer.collection,
            tokenId: collateralTokenId,
            amount: loanAmount,
            startTime: block.timestamp,
            rate: offer.rate,
            auctionStartBlock: 0,
            auctionDuration: offer.auctionDuration
        });
        unchecked {
            liens[lienId = _nextLienId++] = keccak256(abi.encode(lien));
        }

        /* Take the loan offer. */
        _takeLoanOffer(offer, signature, lien, lienId);

        /* Transfer funds. */
        /* Need to retrieve the ETH to funds the marketplace execution. */
        if (loanAmount < price) {
            /* Take funds from lender. */
            pool.withdrawFrom(offer.lender, address(this), loanAmount);

            /* Supplement difference from borrower. */
            unchecked {
                pool.withdrawFrom(msg.sender, address(this), price - loanAmount);
            }
        } else {
            /* Take funds from lender. */
            pool.withdrawFrom(offer.lender, address(this), price);

            /* Send surplus to borrower. */
            unchecked {
                pool.transferFrom(offer.lender, msg.sender, loanAmount - price);
            }
        }

        /* Create the buy side order coming from Blend. */
        Order memory buyOrder = Order({
            trader: address(this),
            side: Side.Buy,
            matchingPolicy: _SELL_MATCHING_POLICY,
            collection: address(offer.collection),
            tokenId: collateralTokenId,
            amount: 1,
            paymentToken: address(0),
            price: price,
            listingTime: execution.makerOrder.order.listingTime + 1, // listingTime determines maker/taker
            expirationTime: type(uint256).max,
            fees: new Fee[](0),
            salt: uint160(execution.makerOrder.order.trader), // prevent reused order hash
            extraParams: "\x01" // require oracle signature
        });
        Input memory buy = Input({
            order: buyOrder,
            v: 0,
            r: bytes32(0),
            s: bytes32(0),
            extraSignature: execution.extraSignature,
            signatureVersion: SignatureVersion.Single,
            blockNumber: execution.blockNumber
        });

        /* Execute order using ETH currently in contract. */
        _EXCHANGE.execute{ value: price }(execution.makerOrder, buy);
    }

    /**
     * @notice Purchase a locked NFT; repay the initial loan; lock the token as collateral for a new loan
     * @param lien Lien preimage struct
     * @param sellInput Sell offer and signature
     * @param loanInput Loan offer and signature
     * @return lienId Lien id
     */
    function buyToBorrowLocked(
        Lien calldata lien,
        SellInput calldata sellInput,
        LoanInput calldata loanInput,
        uint256 loanAmount
    )
        public
        validateLien(lien, sellInput.offer.lienId)
        lienIsActive(lien)
        returns (uint256 lienId)
    {
        if (lien.collection != loanInput.offer.collection) {
            revert CollectionsDoNotMatch();
        }

        (uint256 priceAfterFees, uint256 debt) = _buyLocked(
            lien,
            sellInput.offer,
            sellInput.signature
        );

        lienId = _borrow(loanInput.offer, loanInput.signature, loanAmount, lien.tokenId);

        /* Transfer funds. */
        /* Need to repay the original loan and payout any surplus from the sell or loan funds. */
        if (loanAmount < debt) {
            /* loanAmount < debt < priceAfterFees */

            /* Repay loan with funds from new lender to old lender. */
            pool.transferFrom(loanInput.offer.lender, lien.lender, loanAmount); // doesn't cover debt

            unchecked {
                /* Supplement difference from new borrower. */
                pool.transferFrom(msg.sender, lien.lender, debt - loanAmount); // cover rest of debt

                /* Send rest of sell funds to borrower. */
                pool.transferFrom(msg.sender, sellInput.offer.borrower, priceAfterFees - debt);
            }
        } else if (loanAmount < priceAfterFees) {
            /* debt < loanAmount < priceAfterFees */

            /* Repay loan with funds from new lender to old lender. */
            pool.transferFrom(loanInput.offer.lender, lien.lender, debt);

            unchecked {
                /* Send rest of loan from new lender to old borrower. */
                pool.transferFrom(
                    loanInput.offer.lender,
                    sellInput.offer.borrower,
                    loanAmount - debt
                );

                /* Send rest of sell funds from new borrower to old borrower. */
                pool.transferFrom(
                    msg.sender,
                    sellInput.offer.borrower,
                    priceAfterFees - loanAmount
                );
            }
        } else {
            /* debt < priceAfterFees < loanAmount */

            /* Repay loan with funds from new lender to old lender. */
            pool.transferFrom(loanInput.offer.lender, lien.lender, debt);

            unchecked {
                /* Send rest of sell funds from new lender to old borrower. */
                pool.transferFrom(
                    loanInput.offer.lender,
                    sellInput.offer.borrower,
                    priceAfterFees - debt
                );

                /* Send rest of loan from new lender to new borrower. */
                pool.transferFrom(loanInput.offer.lender, msg.sender, loanAmount - priceAfterFees);
            }
        }
    }

    /**
     * @notice Purchases a locked NFT and uses the funds to repay the loan
     * @param lien Lien preimage
     * @param offer Sell offer
     * @param signature Lender offer signature
     */
    function buyLocked(
        Lien calldata lien,
        SellOffer calldata offer,
        bytes calldata signature
    ) public validateLien(lien, offer.lienId) lienIsActive(lien) {
        (uint256 priceAfterFees, uint256 debt) = _buyLocked(lien, offer, signature);

        /* Send token to buyer. */
        lien.collection.safeTransferFrom(address(this), msg.sender, lien.tokenId);

        /* Repay lender. */
        pool.transferFrom(msg.sender, lien.lender, debt);

        /* Send surplus to borrower. */
        unchecked {
            pool.transferFrom(msg.sender, lien.borrower, priceAfterFees - debt);
        }
    }

    /**
     * @notice Takes a bid on a locked NFT and use the funds to repay the lien
     * @dev Must be called by the borrower
     * @param lien Lien preimage
     * @param lienId Lien id
     * @param execution Marketplace execution data
     */
    function takeBid(
        Lien calldata lien,
        uint256 lienId,
        Execution calldata execution
    ) external validateLien(lien, lienId) lienIsActive(lien) {
        if (execution.makerOrder.order.trader == address(this) || msg.sender != lien.borrower) {
            revert Unauthorized();
        }

        /* Repay loan with funds received from the sale. */
        uint256 debt = _repay(lien, lienId);

        /* Create sell side order from Blend. */
        Order memory sellOrder = Order({
            trader: address(this),
            side: Side.Sell,
            matchingPolicy: _BID_MATCHING_POLICY,
            collection: address(lien.collection),
            tokenId: lien.tokenId,
            amount: 1,
            paymentToken: address(pool),
            price: execution.makerOrder.order.price,
            listingTime: execution.makerOrder.order.listingTime + 1, // listingTime determines maker/taker
            expirationTime: type(uint256).max,
            fees: new Fee[](0),
            salt: lienId, // prevent reused order hash
            extraParams: "\x01" // require oracle signature
        });
        Input memory sell = Input({
            order: sellOrder,
            v: 0,
            r: bytes32(0),
            s: bytes32(0),
            extraSignature: execution.extraSignature,
            signatureVersion: SignatureVersion.Single,
            blockNumber: execution.blockNumber
        });

        /* Execute marketplace order. */
        uint256 balanceBefore = pool.balanceOf(address(this));
        lien.collection.approve(_DELEGATE, lien.tokenId);
        _EXCHANGE.execute(sell, execution.makerOrder);

        /* Determine the funds received from the sale (after fees). */
        uint256 amountReceivedFromSale = pool.balanceOf(address(this)) - balanceBefore;
        if (amountReceivedFromSale < debt) {
            revert InvalidRepayment();
        }

        /* Repay lender. */
        pool.transferFrom(address(this), lien.lender, debt);

        /* Send surplus to borrower. */
        unchecked {
            pool.transferFrom(address(this), lien.borrower, amountReceivedFromSale - debt);
        }
    }

    /**
     * @notice Verify and take sell offer for token locked in lien; use the funds to repay the debt on the lien
     * @dev Does not transfer assets
     * @param lien Lien preimage
     * @param offer Loan offer
     * @param signature Loan offer signature
     * @return priceAfterFees Price of the token (after fees), debt Current debt amount
     */
    function _buyLocked(
        Lien calldata lien,
        SellOffer calldata offer,
        bytes calldata signature
    ) internal returns (uint256 priceAfterFees, uint256 debt) {
        if (lien.borrower != offer.borrower) {
            revert Unauthorized();
        }

        priceAfterFees = _takeSellOffer(offer, signature);

        /* Repay loan with funds received from the sale. */
        debt = _repay(lien, offer.lienId);
        if (priceAfterFees < debt) {
            revert InvalidRepayment();
        }

        emit BuyLocked(
            offer.lienId,
            address(lien.collection),
            msg.sender,
            lien.borrower,
            lien.tokenId
        );
    }

    /**
     * @notice Validates, fulfills, and transfers fees on sell offer
     * @param sellOffer Sell offer
     * @param sellSignature Sell offer signature
     */
    function _takeSellOffer(
        SellOffer calldata sellOffer,
        bytes calldata sellSignature
    ) internal returns (uint256 priceAfterFees) {
        _validateOffer(
            _hashSellOffer(sellOffer),
            sellOffer.borrower,
            sellOffer.oracle,
            sellSignature,
            sellOffer.expirationTime,
            sellOffer.salt
        );

        /* Mark the sell offer as fulfilled. */
        cancelledOrFulfilled[sellOffer.borrower][sellOffer.salt] = 1;

        /* Transfer fees. */
        uint256 totalFees = _transferFees(sellOffer.fees, msg.sender, sellOffer.price);
        unchecked {
            priceAfterFees = sellOffer.price - totalFees;
        }
    }

    function _transferFees(
        Fee[] calldata fees,
        address from,
        uint256 price
    ) internal returns (uint256 totalFee) {
        uint256 feesLength = fees.length;
        for (uint256 i = 0; i < feesLength; ) {
            uint256 fee = (price * fees[i].rate) / _BASIS_POINTS;
            pool.transferFrom(from, fees[i].recipient, fee);
            totalFee += fee;
            unchecked {
                ++i;
            }
        }
        if (totalFee > price) {
            revert FeesTooHigh();
        }
    }

    receive() external payable {
        if (msg.sender != address(pool)) {
            revert Unauthorized();
        }
    }

    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external pure returns (bytes4) {
        return this.onERC721Received.selector;
    }

    /*/////////////////////////////////////////////////////////////
                          CALCULATION HELPERS
    /////////////////////////////////////////////////////////////*/

    int256 private constant _YEAR_WAD = 365 days * 1e18;
    uint256 private constant _LIQUIDATION_THRESHOLD = 100_000;

    /*/////////////////////////////////////////////////////////////
                        PAYABLE WRAPPERS
    /////////////////////////////////////////////////////////////*/

    /**
     * @notice buyToBorrow wrapper that deposits ETH to pool
     */
    function buyToBorrowETH(
        LoanOffer calldata offer,
        bytes calldata signature,
        uint256 loanAmount,
        Execution calldata execution
    ) external payable returns (uint256 lienId) {
        pool.deposit{ value: msg.value }(msg.sender);
        return buyToBorrow(offer, signature, loanAmount, execution);
    }

    /**
     * @notice buyToBorrowLocked wrapper that deposits ETH to pool
     */
    function buyToBorrowLockedETH(
        Lien calldata lien,
        SellInput calldata sellInput,
        LoanInput calldata loanInput,
        uint256 loanAmount
    ) external payable returns (uint256 lienId) {
        pool.deposit{ value: msg.value }(msg.sender);
        return buyToBorrowLocked(lien, sellInput, loanInput, loanAmount);
    }

    /**
     * @notice buyLocked wrapper that deposits ETH to pool
     */
    function buyLockedETH(
        Lien calldata lien,
        SellOffer calldata offer,
        bytes calldata signature
    ) external payable {
        pool.deposit{ value: msg.value }(msg.sender);
        return buyLocked(lien, offer, signature);
    }

    /*/////////////////////////////////////////////////////////////
                        VALIDATION MODIFIERS
    /////////////////////////////////////////////////////////////*/

    modifier validateLien(Lien calldata lien, uint256 lienId) {
        if (!_validateLien(lien, lienId)) {
            revert InvalidLien();
        }

        _;
    }

    modifier lienIsActive(Lien calldata lien) {
        if (_lienIsDefaulted(lien)) {
            revert LienIsDefaulted();
        }

        _;
    }

    modifier auctionIsActive(Lien calldata lien) {
        if (!_auctionIsActive(lien)) {
            revert AuctionIsNotActive();
        }

        _;
    }

    function _validateLien(Lien calldata lien, uint256 lienId) internal view returns (bool) {
        return liens[lienId] == keccak256(abi.encode(lien));
    }

    function _lienIsDefaulted(Lien calldata lien) internal view returns (bool) {
        return
            lien.auctionStartBlock != 0 &&
            lien.auctionStartBlock + lien.auctionDuration < block.number;
    }

    function _auctionIsActive(Lien calldata lien) internal view returns (bool) {
        return
            lien.auctionStartBlock != 0 &&
            lien.auctionStartBlock + lien.auctionDuration >= block.number;
    }
}

File 2 of 23 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 3 of 23 : CalculationHelpers.sol
// SPDX-License-Identifier: BSL 1.1 - Blend (c) Non Fungible Trading Ltd.
pragma solidity 0.8.17;

import "lib/solmate/src/utils/SignedWadMath.sol";

library CalculationHelpers {
    int256 private constant _YEAR_WAD = 365 days * 1e18;
    uint256 private constant _LIQUIDATION_THRESHOLD = 100_000;
    uint256 private constant _BASIS_POINTS = 10_000;
    uint256 private constant _MIN_LOAN_TIME = 7200; // 2 hours

    /**
     * @dev Computes the current debt of a borrow given the last time it was touched and the last computed debt.
     * @param amount Principal in ETH
     * @param startTime Start time of the loan
     * @param rate Interest rate (in bips)
     * @dev Formula: https://www.desmos.com/calculator/l6omp0rwnh
     */
    function computeCurrentDebt(
        uint256 amount,
        uint256 rate,
        uint256 startTime
    ) external view returns (uint256) {
        uint256 loanTime = block.timestamp - startTime;
        if (loanTime < _MIN_LOAN_TIME) {
            loanTime = _MIN_LOAN_TIME;
        }
        int256 yearsWad = wadDiv(int256(loanTime) * 1e18, _YEAR_WAD);
        return uint256(wadMul(int256(amount), wadExp(wadMul(yearsWad, bipsToSignedWads(rate)))));
    }

    /**
     * @dev Calculates the current maximum interest rate a specific refinancing
     * auction could settle at currently given the auction's start block and duration.
     * @param startBlock The block the auction started at
     * @param oldRate Previous interest rate (in bips)
     * @dev Formula: https://www.desmos.com/calculator/urasr71dhb
     */
    function calcRefinancingAuctionRate(
        uint256 startBlock,
        uint256 auctionDuration,
        uint256 oldRate
    ) external view returns (uint256) {
        uint256 currentAuctionBlock = block.number - startBlock;
        int256 oldRateWads = bipsToSignedWads(oldRate);

        uint256 auctionT1 = auctionDuration / 5;
        uint256 auctionT2 = (4 * auctionDuration) / 5;

        int256 maxRateWads;
        {
            int256 aInverse = -bipsToSignedWads(15000);
            int256 b = 2;
            int256 maxMinRateWads = bipsToSignedWads(500);

            if (oldRateWads < -((b * aInverse) / 2)) {
                maxRateWads = maxMinRateWads + (oldRateWads ** 2) / aInverse + b * oldRateWads;
            } else {
                maxRateWads = maxMinRateWads - ((b ** 2) * aInverse) / 4;
            }
        }

        int256 startSlope = maxRateWads / int256(auctionT1); // wad-bips per block

        int256 middleSlope = bipsToSignedWads(9000) / int256(3 * auctionDuration / 5) + 1; // wad-bips per block (add one to account for rounding)
        int256 middleB = maxRateWads - int256(auctionT1) * middleSlope;

        if (currentAuctionBlock < auctionT1) {
            return signedWadsToBips(startSlope * int256(currentAuctionBlock));
        } else if (currentAuctionBlock < auctionT2) {
            return signedWadsToBips(middleSlope * int256(currentAuctionBlock) + middleB);
        } else if (currentAuctionBlock < auctionDuration) {
            int256 endSlope;
            int256 endB;
            {
                endSlope =
                    (bipsToSignedWads(_LIQUIDATION_THRESHOLD) -
                        ((int256(auctionT2) * middleSlope) + middleB)) /
                    int256(auctionDuration - auctionT2); // wad-bips per block
                endB =
                    bipsToSignedWads(_LIQUIDATION_THRESHOLD) -
                    int256(auctionDuration) *
                    endSlope;
            }

            return signedWadsToBips(endSlope * int256(currentAuctionBlock) + endB);
        } else {
            return _LIQUIDATION_THRESHOLD;
        }
    }

    /**
     * @dev Converts an integer bips value to a signed wad value.
     */
    function bipsToSignedWads(uint256 bips) public pure returns (int256) {
        return int256((bips * 1e18) / _BASIS_POINTS);
    }

    /**
     * @dev Converts a signed wad value to an integer bips value.
     */
    function signedWadsToBips(int256 wads) public pure returns (uint256) {
        return uint256((wads * int256(_BASIS_POINTS)) / 1e18);
    }
}

File 4 of 23 : Structs.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "lib/solmate/src/tokens/ERC721.sol";
import "./ExchangeStructs.sol";

struct LienPointer {
    Lien lien;
    uint256 lienId;
}

struct SellOffer {
    address borrower;
    uint256 lienId;
    uint256 price;
    uint256 expirationTime;
    uint256 salt;
    address oracle;
    Fee[] fees;
}

struct Lien {
    address lender;
    address borrower;
    ERC721 collection;
    uint256 tokenId;
    uint256 amount;
    uint256 startTime;
    uint256 rate;
    uint256 auctionStartBlock;
    uint256 auctionDuration;
}

struct LoanOffer {
    address lender;
    ERC721 collection;
    uint256 totalAmount;
    uint256 minAmount;
    uint256 maxAmount;
    uint256 auctionDuration;
    uint256 salt;
    uint256 expirationTime;
    uint256 rate;
    address oracle;
}

struct LoanInput {
    LoanOffer offer;
    bytes signature;
}

struct SellInput {
    SellOffer offer;
    bytes signature;
}

struct Execution {
    Input makerOrder;
    bytes extraSignature;
    uint256 blockNumber;
}

File 5 of 23 : OfferController.sol
// SPDX-License-Identifier: BSL 1.1 - Blend (c) Non Fungible Trading Ltd.
pragma solidity 0.8.17;

import "lib/openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol";

import "./lib/Signatures.sol";
import "./interfaces/IOfferController.sol";

abstract contract OfferController is IOfferController, Signatures, Ownable2StepUpgradeable {
    mapping(address => mapping(uint256 => uint256)) public cancelledOrFulfilled;
    uint256[50] private _gap;

    /**
     * @notice Assert offer validity
     * @param offerHash Offer hash
     * @param signer Address of offer signer
     * @param oracle Address of oracle
     * @param signature Packed signature array
     * @param expirationTime Offer expiration time
     * @param salt Offer salt
     */
    function _validateOffer(
        bytes32 offerHash,
        address signer,
        address oracle,
        bytes calldata signature,
        uint256 expirationTime,
        uint256 salt
    ) internal view {
        _verifyOfferAuthorization(offerHash, signer, oracle, signature);

        if (expirationTime < block.timestamp) {
            revert OfferExpired();
        }
        if (cancelledOrFulfilled[signer][salt] == 1) {
            revert OfferUnavailable();
        }
    }

    /*/////////////////////////////////////////
                  CANCEL FUNCTIONS
    /////////////////////////////////////////*/
    /**
     * @notice Cancels offer salt for caller
     * @param salt Unique offer salt
     */
    function cancelOffer(uint256 salt) external {
        _cancelOffer(msg.sender, salt);
    }

    /**
     * @notice Cancels offers in bulk for caller
     * @param salts List of offer salts
     */
    function cancelOffers(uint256[] calldata salts) external {
        uint256 saltsLength = salts.length;
        for (uint256 i; i < saltsLength; ) {
            _cancelOffer(msg.sender, salts[i]);
            unchecked {
                ++i;
            }
        }
    }

    /**
     * @notice Cancels all offers by incrementing caller nonce
     */
    function incrementNonce() external {
        _incrementNonce(msg.sender);
    }

    /**
     * @notice Cancel offer by user and salt
     * @param user Address of user
     * @param salt Unique offer salt
     */
    function _cancelOffer(address user, uint256 salt) private {
        cancelledOrFulfilled[user][salt] = 1;
        emit OfferCancelled(user, salt);
    }

    /**
     * @notice Cancel all orders by incrementing the user nonce
     * @param user Address of user
     */
    function _incrementNonce(address user) internal {
        emit NonceIncremented(user, ++nonces[user]);
    }

    /*/////////////////////////////////////////
                  ADMIN FUNCTIONS
    /////////////////////////////////////////*/

    /**
     * @notice Set approval for an oracle address
     * @param oracle Address of oracle
     * @param approved Whether the oracle is approved
     */
    function setOracle(address oracle, bool approved) external onlyOwner {
        if (approved) {
            oracles[oracle] = 1;
        } else {
            oracles[oracle] = 0;
        }
    }

    /**
     * @notice Set the block range expiry of oracle signatures
     * @param _blockRange Block range
     */
    function setBlockRange(uint256 _blockRange) external onlyOwner {
        blockRange = _blockRange;
    }
}

File 6 of 23 : IBlend.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../lib/Structs.sol";
import "./IOfferController.sol";

interface IBlend is IOfferController {
    event LoanOfferTaken(
        bytes32 offerHash,
        uint256 lienId,
        address collection,
        address lender,
        address borrower,
        uint256 loanAmount,
        uint256 rate,
        uint256 tokenId,
        uint256 auctionDuration
    );

    event Repay(uint256 lienId, address collection);

    event StartAuction(uint256 lienId, address collection);

    event Refinance(
        uint256 lienId,
        address collection,
        address newLender,
        uint256 newAmount,
        uint256 newRate,
        uint256 newAuctionDuration
    );

    event Seize(uint256 lienId, address collection);

    event BuyLocked(
        uint256 lienId,
        address collection,
        address buyer,
        address seller,
        uint256 tokenId
    );

    function amountTaken(bytes32 offerHash) external view returns (uint256);

    function liens(uint256 lienId) external view returns (bytes32);

    /*//////////////////////////////////////////////////
                    BORROW FLOWS
    //////////////////////////////////////////////////*/
    function borrow(
        LoanOffer calldata offer,
        bytes calldata signature,
        uint256 loanAmount,
        uint256 collateralId
    ) external returns (uint256 lienId);

    function repay(Lien calldata lien, uint256 lienId) external;

    /*//////////////////////////////////////////////////
                    REFINANCING FLOWS
    //////////////////////////////////////////////////*/
    function startAuction(Lien calldata lien, uint256 lienId) external;

    function seize(LienPointer[] calldata lienPointers) external;

    function refinance(
        Lien calldata lien,
        uint256 lienId,
        LoanOffer calldata offer,
        bytes calldata signature
    ) external;

    function refinanceAuction(Lien calldata lien, uint256 lienId, uint256 rate) external;

    function refinanceAuctionByOther(
        Lien calldata lien,
        uint256 lienId,
        LoanOffer calldata offer,
        bytes calldata signature
    ) external;

    function borrowerRefinance(
        Lien calldata lien,
        uint256 lienId,
        uint256 loanAmount,
        LoanOffer calldata offer,
        bytes calldata signature
    ) external;

    /*//////////////////////////////////////////////////
                    MARKETPLACE FLOWS
    //////////////////////////////////////////////////*/
    function buyToBorrow(
        LoanOffer calldata offer,
        bytes calldata signature,
        uint256 loanAmount,
        Execution calldata execution
    ) external returns (uint256 lienId);

    function buyToBorrowETH(
        LoanOffer calldata offer,
        bytes calldata signature,
        uint256 loanAmount,
        Execution calldata execution
    ) external payable returns (uint256 lienId);

    function buyToBorrowLocked(
        Lien calldata lien,
        SellInput calldata sellInput,
        LoanInput calldata loanInput,
        uint256 loanAmount
    ) external returns (uint256 lienId);

    function buyToBorrowLockedETH(
        Lien calldata lien,
        SellInput calldata sellInput,
        LoanInput calldata loanInput,
        uint256 loanAmount
    ) external payable returns (uint256 lienId);

    function buyLocked(
        Lien calldata lien,
        SellOffer calldata offer,
        bytes calldata signature
    ) external;

    function buyLockedETH(
        Lien calldata lien,
        SellOffer calldata offer,
        bytes calldata signature
    ) external payable;

    function takeBid(Lien calldata lien, uint256 lienId, Execution calldata execution) external;
}

File 7 of 23 : IBlurPool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IBlurPool {
    event Transfer(address indexed from, address indexed to, uint256 amount);

    function initialize() external;
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint256);
    function balanceOf(address user) external view returns (uint256);
    function deposit() external payable;
    function deposit(address user) external payable;
    function withdraw(uint256 amount) external;
    function withdrawFrom(address from, address to, uint256 amount) external;
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 8 of 23 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822ProxiableUpgradeable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 9 of 23 : ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable {
    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @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) private returns (bytes memory) {
        require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 10 of 23 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 11 of 23 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

File 13 of 23 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }
}

File 14 of 23 : SignedWadMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/// @notice Signed 18 decimal fixed point (wad) arithmetic library.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SignedWadMath.sol)
/// @author Modified from Remco Bloemen (https://xn--2-umb.com/22/exp-ln/index.html)

/// @dev Will not revert on overflow, only use where overflow is not possible.
function toWadUnsafe(uint256 x) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by 1e18.
        r := mul(x, 1000000000000000000)
    }
}

/// @dev Takes an integer amount of seconds and converts it to a wad amount of days.
/// @dev Will not revert on overflow, only use where overflow is not possible.
/// @dev Not meant for negative second amounts, it assumes x is positive.
function toDaysWadUnsafe(uint256 x) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by 1e18 and then divide it by 86400.
        r := div(mul(x, 1000000000000000000), 86400)
    }
}

/// @dev Takes a wad amount of days and converts it to an integer amount of seconds.
/// @dev Will not revert on overflow, only use where overflow is not possible.
/// @dev Not meant for negative day amounts, it assumes x is positive.
function fromDaysWadUnsafe(int256 x) pure returns (uint256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by 86400 and then divide it by 1e18.
        r := div(mul(x, 86400), 1000000000000000000)
    }
}

/// @dev Will not revert on overflow, only use where overflow is not possible.
function unsafeWadMul(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by y and divide by 1e18.
        r := sdiv(mul(x, y), 1000000000000000000)
    }
}

/// @dev Will return 0 instead of reverting if y is zero and will
/// not revert on overflow, only use where overflow is not possible.
function unsafeWadDiv(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by 1e18 and divide it by y.
        r := sdiv(mul(x, 1000000000000000000), y)
    }
}

function wadMul(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Store x * y in r for now.
        r := mul(x, y)

        // Equivalent to require(x == 0 || (x * y) / x == y)
        if iszero(or(iszero(x), eq(sdiv(r, x), y))) {
            revert(0, 0)
        }

        // Scale the result down by 1e18.
        r := sdiv(r, 1000000000000000000)
    }
}

function wadDiv(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Store x * 1e18 in r for now.
        r := mul(x, 1000000000000000000)

        // Equivalent to require(y != 0 && ((x * 1e18) / 1e18 == x))
        if iszero(and(iszero(iszero(y)), eq(sdiv(r, 1000000000000000000), x))) {
            revert(0, 0)
        }

        // Divide r by y.
        r := sdiv(r, y)
    }
}

/// @dev Will not work with negative bases, only use when x is positive.
function wadPow(int256 x, int256 y) pure returns (int256) {
    // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)
    return wadExp((wadLn(x) * y) / 1e18); // Using ln(x) means x must be greater than 0.
}

function wadExp(int256 x) pure returns (int256 r) {
    unchecked {
        // When the result is < 0.5 we return zero. This happens when
        // x <= floor(log(0.5e18) * 1e18) ~ -42e18
        if (x <= -42139678854452767551) return 0;

        // When the result is > (2**255 - 1) / 1e18 we can not represent it as an
        // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.
        if (x >= 135305999368893231589) revert("EXP_OVERFLOW");

        // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96
        // for more intermediate precision and a binary basis. This base conversion
        // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.
        x = (x << 78) / 5**18;

        // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers
        // of two such that exp(x) = exp(x') * 2**k, where k is an integer.
        // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).
        int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;
        x = x - k * 54916777467707473351141471128;

        // k is in the range [-61, 195].

        // Evaluate using a (6, 7)-term rational approximation.
        // p is made monic, we'll multiply by a scale factor later.
        int256 y = x + 1346386616545796478920950773328;
        y = ((y * x) >> 96) + 57155421227552351082224309758442;
        int256 p = y + x - 94201549194550492254356042504812;
        p = ((p * y) >> 96) + 28719021644029726153956944680412240;
        p = p * x + (4385272521454847904659076985693276 << 96);

        // We leave p in 2**192 basis so we don't need to scale it back up for the division.
        int256 q = x - 2855989394907223263936484059900;
        q = ((q * x) >> 96) + 50020603652535783019961831881945;
        q = ((q * x) >> 96) - 533845033583426703283633433725380;
        q = ((q * x) >> 96) + 3604857256930695427073651918091429;
        q = ((q * x) >> 96) - 14423608567350463180887372962807573;
        q = ((q * x) >> 96) + 26449188498355588339934803723976023;

        /// @solidity memory-safe-assembly
        assembly {
            // Div in assembly because solidity adds a zero check despite the unchecked.
            // The q polynomial won't have zeros in the domain as all its roots are complex.
            // No scaling is necessary because p is already 2**96 too large.
            r := sdiv(p, q)
        }

        // r should be in the range (0.09, 0.25) * 2**96.

        // We now need to multiply r by:
        // * the scale factor s = ~6.031367120.
        // * the 2**k factor from the range reduction.
        // * the 1e18 / 2**96 factor for base conversion.
        // We do this all at once, with an intermediate result in 2**213
        // basis, so the final right shift is always by a positive amount.
        r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));
    }
}

function wadLn(int256 x) pure returns (int256 r) {
    unchecked {
        require(x > 0, "UNDEFINED");

        // We want to convert x from 10**18 fixed point to 2**96 fixed point.
        // We do this by multiplying by 2**96 / 10**18. But since
        // ln(x * C) = ln(x) + ln(C), we can simply do nothing here
        // and add ln(2**96 / 10**18) at the end.

        /// @solidity memory-safe-assembly
        assembly {
            r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
            r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
            r := or(r, shl(4, lt(0xffff, shr(r, x))))
            r := or(r, shl(3, lt(0xff, shr(r, x))))
            r := or(r, shl(2, lt(0xf, shr(r, x))))
            r := or(r, shl(1, lt(0x3, shr(r, x))))
            r := or(r, lt(0x1, shr(r, x)))
        }

        // Reduce range of x to (1, 2) * 2**96
        // ln(2^k * x) = k * ln(2) + ln(x)
        int256 k = r - 96;
        x <<= uint256(159 - k);
        x = int256(uint256(x) >> 159);

        // Evaluate using a (8, 8)-term rational approximation.
        // p is made monic, we will multiply by a scale factor later.
        int256 p = x + 3273285459638523848632254066296;
        p = ((p * x) >> 96) + 24828157081833163892658089445524;
        p = ((p * x) >> 96) + 43456485725739037958740375743393;
        p = ((p * x) >> 96) - 11111509109440967052023855526967;
        p = ((p * x) >> 96) - 45023709667254063763336534515857;
        p = ((p * x) >> 96) - 14706773417378608786704636184526;
        p = p * x - (795164235651350426258249787498 << 96);

        // We leave p in 2**192 basis so we don't need to scale it back up for the division.
        // q is monic by convention.
        int256 q = x + 5573035233440673466300451813936;
        q = ((q * x) >> 96) + 71694874799317883764090561454958;
        q = ((q * x) >> 96) + 283447036172924575727196451306956;
        q = ((q * x) >> 96) + 401686690394027663651624208769553;
        q = ((q * x) >> 96) + 204048457590392012362485061816622;
        q = ((q * x) >> 96) + 31853899698501571402653359427138;
        q = ((q * x) >> 96) + 909429971244387300277376558375;
        /// @solidity memory-safe-assembly
        assembly {
            // Div in assembly because solidity adds a zero check despite the unchecked.
            // The q polynomial is known not to have zeros in the domain.
            // No scaling required because p is already 2**96 too large.
            r := sdiv(p, q)
        }

        // r is in the range (0, 0.125) * 2**96

        // Finalization, we need to:
        // * multiply by the scale factor s = 5.549…
        // * add ln(2**96 / 10**18)
        // * add k * ln(2)
        // * multiply by 10**18 / 2**96 = 5**18 >> 78

        // mul s * 5e18 * 2**96, base is now 5**18 * 2**192
        r *= 1677202110996718588342820967067443963516166;
        // add ln(2) * k * 5e18 * 2**192
        r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;
        // add ln(2**96 / 10**18) * 5e18 * 2**192
        r += 600920179829731861736702779321621459595472258049074101567377883020018308;
        // base conversion: mul 2**18 / 2**192
        r >>= 174;
    }
}

/// @dev Will return 0 instead of reverting if y is zero.
function unsafeDiv(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Divide x by y.
        r := sdiv(x, y)
    }
}

File 15 of 23 : ERC721.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern, minimalist, and gas efficient ERC-721 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 indexed id);

    event Approval(address indexed owner, address indexed spender, uint256 indexed id);

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /*//////////////////////////////////////////////////////////////
                         METADATA STORAGE/LOGIC
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    function tokenURI(uint256 id) public view virtual returns (string memory);

    /*//////////////////////////////////////////////////////////////
                      ERC721 BALANCE/OWNER STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => address) internal _ownerOf;

    mapping(address => uint256) internal _balanceOf;

    function ownerOf(uint256 id) public view virtual returns (address owner) {
        require((owner = _ownerOf[id]) != address(0), "NOT_MINTED");
    }

    function balanceOf(address owner) public view virtual returns (uint256) {
        require(owner != address(0), "ZERO_ADDRESS");

        return _balanceOf[owner];
    }

    /*//////////////////////////////////////////////////////////////
                         ERC721 APPROVAL STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => address) public getApproved;

    mapping(address => mapping(address => bool)) public isApprovedForAll;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
    }

    /*//////////////////////////////////////////////////////////////
                              ERC721 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 id) public virtual {
        address owner = _ownerOf[id];

        require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED");

        getApproved[id] = spender;

        emit Approval(owner, spender, id);
    }

    function setApprovalForAll(address operator, bool approved) public virtual {
        isApprovedForAll[msg.sender][operator] = approved;

        emit ApprovalForAll(msg.sender, operator, approved);
    }

    function transferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        require(from == _ownerOf[id], "WRONG_FROM");

        require(to != address(0), "INVALID_RECIPIENT");

        require(
            msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id],
            "NOT_AUTHORIZED"
        );

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        unchecked {
            _balanceOf[from]--;

            _balanceOf[to]++;
        }

        _ownerOf[id] = to;

        delete getApproved[id];

        emit Transfer(from, to, id);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        transferFrom(from, to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        bytes calldata data
    ) public virtual {
        transferFrom(from, to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    /*//////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721
            interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 id) internal virtual {
        require(to != address(0), "INVALID_RECIPIENT");

        require(_ownerOf[id] == address(0), "ALREADY_MINTED");

        // Counter overflow is incredibly unrealistic.
        unchecked {
            _balanceOf[to]++;
        }

        _ownerOf[id] = to;

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

    function _burn(uint256 id) internal virtual {
        address owner = _ownerOf[id];

        require(owner != address(0), "NOT_MINTED");

        // Ownership check above ensures no underflow.
        unchecked {
            _balanceOf[owner]--;
        }

        delete _ownerOf[id];

        delete getApproved[id];

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

    /*//////////////////////////////////////////////////////////////
                        INTERNAL SAFE MINT LOGIC
    //////////////////////////////////////////////////////////////*/

    function _safeMint(address to, uint256 id) internal virtual {
        _mint(to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function _safeMint(
        address to,
        uint256 id,
        bytes memory data
    ) internal virtual {
        _mint(to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }
}

/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721TokenReceiver {
    function onERC721Received(
        address,
        address,
        uint256,
        bytes calldata
    ) external virtual returns (bytes4) {
        return ERC721TokenReceiver.onERC721Received.selector;
    }
}

File 16 of 23 : ExchangeStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

enum Side {
    Buy,
    Sell
}
enum SignatureVersion {
    Single,
    Bulk
}

struct Fee {
    uint16 rate;
    address recipient;
}

struct Order {
    address trader;
    Side side;
    address matchingPolicy;
    address collection;
    uint256 tokenId;
    uint256 amount;
    address paymentToken;
    uint256 price;
    uint256 listingTime;
    uint256 expirationTime;
    Fee[] fees;
    uint256 salt;
    bytes extraParams;
}

struct Input {
    Order order;
    uint8 v;
    bytes32 r;
    bytes32 s;
    bytes extraSignature;
    SignatureVersion signatureVersion;
    uint256 blockNumber;
}

File 17 of 23 : Ownable2StepUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./OwnableUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
    function __Ownable2Step_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable2Step_init_unchained() internal onlyInitializing {
    }
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() external {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 18 of 23 : Signatures.sol
// SPDX-License-Identifier: BSL 1.1 - Blend (c) Non Fungible Trading Ltd.
pragma solidity 0.8.17;

import "./Structs.sol";
import "./Errors.sol";
import "../interfaces/ISignatures.sol";

abstract contract Signatures is ISignatures {
    bytes32 private immutable _LOAN_OFFER_TYPEHASH;
    bytes32 private immutable _FEE_TYPEHASH;
    bytes32 private immutable _SELL_OFFER_TYPEHASH;
    bytes32 private immutable _ORACLE_OFFER_TYPEHASH;
    bytes32 private immutable _EIP_712_DOMAIN_TYPEHASH;

    string private constant _NAME = "Blend";
    string private constant _VERSION = "1.0";

    mapping(address => uint256) public nonces;
    mapping(address => uint256) public oracles;
    uint256 public blockRange;

    uint256[50] private _gap;

    constructor() {
        (
            _LOAN_OFFER_TYPEHASH,
            _SELL_OFFER_TYPEHASH,
            _FEE_TYPEHASH,
            _ORACLE_OFFER_TYPEHASH,
            _EIP_712_DOMAIN_TYPEHASH
        ) = _createTypehashes();
    }

    function information() external view returns (string memory version, bytes32 domainSeparator) {
        version = _VERSION;
        domainSeparator = _hashDomain(
            _EIP_712_DOMAIN_TYPEHASH,
            keccak256(bytes(_NAME)),
            keccak256(bytes(_VERSION))
        );
    }

    function getSellOfferHash(SellOffer calldata offer) external view returns (bytes32) {
        return _hashSellOffer(offer);
    }

    function getOfferHash(LoanOffer calldata offer) external view returns (bytes32) {
        return _hashOffer(offer);
    }

    function getOracleOfferHash(bytes32 hash, uint256 blockNumber) external view returns (bytes32) {
        return _hashOracleOffer(hash, blockNumber);
    }

    /**
     * @notice Generate all EIP712 Typehashes
     */
    function _createTypehashes()
        internal
        view
        returns (
            bytes32 loanOfferTypehash,
            bytes32 sellOfferTypehash,
            bytes32 feeTypehash,
            bytes32 oracleOfferTypehash,
            bytes32 eip712DomainTypehash
        )
    {
        eip712DomainTypehash = keccak256(
            bytes.concat(
                "EIP712Domain(",
                "string name,",
                "string version,",
                "uint256 chainId,",
                "address verifyingContract",
                ")"
            )
        );

        oracleOfferTypehash = keccak256(
            bytes.concat("OracleOffer(", "bytes32 hash,", "uint256 blockNumber", ")")
        );

        loanOfferTypehash = keccak256(
            bytes.concat(
                "LoanOffer(",
                "address lender,",
                "address collection,",
                "uint256 totalAmount,",
                "uint256 minAmount,",
                "uint256 maxAmount,",
                "uint256 auctionDuration,",
                "uint256 salt,",
                "uint256 expirationTime,",
                "uint256 rate,",
                "address oracle,",
                "uint256 nonce",
                ")"
            )
        );

        bytes memory feeTypestring = bytes.concat("Fee(", "uint16 rate,", "address recipient", ")");

        feeTypehash = keccak256(feeTypestring);
        sellOfferTypehash = keccak256(
            bytes.concat(
                "SellOffer(",
                "address borrower,",
                "uint256 lienId,",
                "uint256 price,",
                "uint256 expirationTime,",
                "uint256 salt,",
                "address oracle,",
                "Fee[] fees,",
                "uint256 nonce",
                ")",
                feeTypestring
            )
        );
    }

    function _hashDomain(
        bytes32 eip712DomainTypehash,
        bytes32 nameHash,
        bytes32 versionHash
    ) internal view returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    eip712DomainTypehash,
                    nameHash,
                    versionHash,
                    block.chainid,
                    address(this)
                )
            );
    }

    function _hashFee(Fee calldata fee) internal view returns (bytes32) {
        return keccak256(abi.encode(_FEE_TYPEHASH, fee.rate, fee.recipient));
    }

    function _packFees(Fee[] calldata fees) internal view returns (bytes32) {
        bytes32[] memory feeHashes = new bytes32[](fees.length);
        uint256 feesLength = fees.length;
        for (uint256 i; i < feesLength; ) {
            feeHashes[i] = _hashFee(fees[i]);
            unchecked {
                ++i;
            }
        }
        return keccak256(abi.encodePacked(feeHashes));
    }

    function _hashSellOffer(SellOffer calldata offer) internal view returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    _SELL_OFFER_TYPEHASH,
                    offer.borrower,
                    offer.lienId,
                    offer.price,
                    offer.expirationTime,
                    offer.salt,
                    offer.oracle,
                    _packFees(offer.fees),
                    nonces[offer.borrower]
                )
            );
    }

    function _hashOffer(LoanOffer calldata offer) internal view returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    _LOAN_OFFER_TYPEHASH,
                    offer.lender,
                    offer.collection,
                    offer.totalAmount,
                    offer.minAmount,
                    offer.maxAmount,
                    offer.auctionDuration,
                    offer.salt,
                    offer.expirationTime,
                    offer.rate,
                    offer.oracle,
                    nonces[offer.lender]
                )
            );
    }

    function _hashOracleOffer(bytes32 hash, uint256 blockNumber) internal view returns (bytes32) {
        return keccak256(abi.encode(_ORACLE_OFFER_TYPEHASH, hash, blockNumber));
    }

    function _hashToSign(bytes32 hash) internal view returns (bytes32) {
        return keccak256(
            bytes.concat(
                bytes2(0x1901),
                _hashDomain(
                    _EIP_712_DOMAIN_TYPEHASH,
                    keccak256(bytes(_NAME)),
                    keccak256(bytes(_VERSION))
                ),
                hash
            )
        );
    }

    function _hashToSignOracle(bytes32 hash, uint256 blockNumber) internal view returns (bytes32) {
        return
            keccak256(
                bytes.concat(
                    bytes2(0x1901),
                    _hashDomain(
                        _EIP_712_DOMAIN_TYPEHASH,
                        keccak256(bytes(_NAME)),
                        keccak256(bytes(_VERSION))
                    ),
                    _hashOracleOffer(hash, blockNumber)
                )
            );
    }

    /**
     * @notice Verify authorization of offer
     * @param offerHash Hash of offer struct
     * @param lender Lender address
     * @param oracle Oracle address
     * @param signature Packed offer signature (with oracle signature if necessary)
     */
    function _verifyOfferAuthorization(
        bytes32 offerHash,
        address lender,
        address oracle,
        bytes calldata signature
    ) internal view {
        bytes32 hashToSign = _hashToSign(offerHash);
        bytes32 r;
        bytes32 s;
        uint8 v;
        assembly {
            r := calldataload(signature.offset)
            s := calldataload(add(signature.offset, 0x20))
            v := shr(248, calldataload(add(signature.offset, 0x40)))
        }
        _verify(lender, hashToSign, v, r, s);

        /* Verify oracle signature if required. */
        if (oracle != address(0)) {
            uint256 blockNumber;
            assembly {
                r := calldataload(add(signature.offset, 0x41))
                s := calldataload(add(signature.offset, 0x61))
                v := shr(248, calldataload(add(signature.offset, 0x81)))
                blockNumber := calldataload(add(signature.offset, 0x82))
            }
            if (oracles[oracle] == 0) {
                revert UnauthorizedOracle();
            }
            if (blockNumber + blockRange < block.number) {
                revert SignatureExpired();
            }

            hashToSign = _hashToSignOracle(offerHash, blockNumber);
            _verify(oracle, hashToSign, v, r, s);
        }
    }

    /**
     * @notice Verify signature of digest
     * @param signer Address of expected signer
     * @param digest Signature digest
     * @param v v parameter
     * @param r r parameter
     * @param s s parameter
     */
    function _verify(address signer, bytes32 digest, uint8 v, bytes32 r, bytes32 s) internal pure {
        if (v != 27 && v != 28) {
            revert InvalidVParameter();
        }
        address recoveredSigner = ecrecover(digest, v, r, s);
        if (recoveredSigner == address(0) || signer != recoveredSigner) {
            revert InvalidSignature();
        }
    }
}

File 19 of 23 : IOfferController.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./ISignatures.sol";

interface IOfferController is ISignatures {
    event OfferCancelled(address indexed user, uint256 salt);
    event NonceIncremented(address indexed user, uint256 newNonce);

    function cancelOffer(uint256 salt) external;

    function cancelOffers(uint256[] calldata salts) external;

    function incrementNonce() external;

    /* Admin */
    function setOracle(address oracle, bool approved) external;

    function setBlockRange(uint256 blockRange) external;
}

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 21 of 23 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 22 of 23 : Errors.sol
// SPDX-License-Identifier: BSL 1.1 - Blend (c) Non Fungible Trading Ltd.
pragma solidity 0.8.17;

// Blend
error Unauthorized();
error InvalidLoan();
error InvalidLien();
error InsufficientOffer();
error InvalidRepayment();
error LienIsDefaulted();
error LienNotDefaulted();
error AuctionIsActive();
error AuctionIsNotActive();
error InvalidRefinance();
error RateTooHigh();
error FeesTooHigh();
error CollectionsDoNotMatch();
error InvalidAuctionDuration();

// OfferController
error OfferExpired();
error OfferUnavailable();

// Signatures
error UnauthorizedOracle();
error SignatureExpired();
error InvalidSignature();
error InvalidVParameter();

File 23 of 23 : ISignatures.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../lib/Structs.sol";

interface ISignatures {
    function information()
        external
        view
        returns (
            string memory version,
            bytes32 domainSeparator
        );
    function getOracleOfferHash(bytes32 hash, uint256 blockNumber) external view returns (bytes32);
    function getSellOfferHash(SellOffer calldata offer) external view returns (bytes32);
    function getOfferHash(LoanOffer calldata offer) external view returns (bytes32);
    function cancelledOrFulfilled(address user, uint256 salt) external view returns (uint256);
    function nonces(address user) external view returns (uint256);
}

Settings
{
  "metadata": {
    "bytecodeHash": "none"
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/CalculationHelpers.sol": {
      "CalculationHelpers": "0x5c06da8ec7945c05304d79895046d01a7943826d"
    }
  },
  "remappings": [
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solmate/=lib/solmate/src/"
  ]
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IBlurPool","name":"_pool","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AuctionIsActive","type":"error"},{"inputs":[],"name":"AuctionIsNotActive","type":"error"},{"inputs":[],"name":"CollectionsDoNotMatch","type":"error"},{"inputs":[],"name":"FeesTooHigh","type":"error"},{"inputs":[],"name":"InsufficientOffer","type":"error"},{"inputs":[],"name":"InvalidAuctionDuration","type":"error"},{"inputs":[],"name":"InvalidLien","type":"error"},{"inputs":[],"name":"InvalidLoan","type":"error"},{"inputs":[],"name":"InvalidRefinance","type":"error"},{"inputs":[],"name":"InvalidRepayment","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidVParameter","type":"error"},{"inputs":[],"name":"LienIsDefaulted","type":"error"},{"inputs":[],"name":"OfferExpired","type":"error"},{"inputs":[],"name":"OfferUnavailable","type":"error"},{"inputs":[],"name":"RateTooHigh","type":"error"},{"inputs":[],"name":"SignatureExpired","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnauthorizedOracle","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lienId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"BuyLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"offerHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"lienId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"loanAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"name":"LoanOfferTaken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"newNonce","type":"uint256"}],"name":"NonceIncremented","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"salt","type":"uint256"}],"name":"OfferCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lienId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"address","name":"newLender","type":"address"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAuctionDuration","type":"uint256"}],"name":"Refinance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lienId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"}],"name":"Repay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lienId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"}],"name":"Seize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lienId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"}],"name":"StartAuction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"amountTaken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockRange","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"loanAmount","type":"uint256"},{"internalType":"uint256","name":"collateralTokenId","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"lienId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"internalType":"uint256","name":"loanAmount","type":"uint256"},{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"borrowerRefinance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"},{"components":[{"internalType":"uint16","name":"rate","type":"uint16"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct Fee[]","name":"fees","type":"tuple[]"}],"internalType":"struct SellOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"buyLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"},{"components":[{"internalType":"uint16","name":"rate","type":"uint16"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct Fee[]","name":"fees","type":"tuple[]"}],"internalType":"struct SellOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"buyLockedETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"loanAmount","type":"uint256"},{"components":[{"components":[{"components":[{"internalType":"address","name":"trader","type":"address"},{"internalType":"enum Side","name":"side","type":"uint8"},{"internalType":"address","name":"matchingPolicy","type":"address"},{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"components":[{"internalType":"uint16","name":"rate","type":"uint16"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct Fee[]","name":"fees","type":"tuple[]"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"bytes","name":"extraParams","type":"bytes"}],"internalType":"struct Order","name":"order","type":"tuple"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"bytes","name":"extraSignature","type":"bytes"},{"internalType":"enum SignatureVersion","name":"signatureVersion","type":"uint8"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"internalType":"struct Input","name":"makerOrder","type":"tuple"},{"internalType":"bytes","name":"extraSignature","type":"bytes"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"internalType":"struct Execution","name":"execution","type":"tuple"}],"name":"buyToBorrow","outputs":[{"internalType":"uint256","name":"lienId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"loanAmount","type":"uint256"},{"components":[{"components":[{"components":[{"internalType":"address","name":"trader","type":"address"},{"internalType":"enum Side","name":"side","type":"uint8"},{"internalType":"address","name":"matchingPolicy","type":"address"},{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"components":[{"internalType":"uint16","name":"rate","type":"uint16"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct Fee[]","name":"fees","type":"tuple[]"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"bytes","name":"extraParams","type":"bytes"}],"internalType":"struct Order","name":"order","type":"tuple"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"bytes","name":"extraSignature","type":"bytes"},{"internalType":"enum SignatureVersion","name":"signatureVersion","type":"uint8"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"internalType":"struct Input","name":"makerOrder","type":"tuple"},{"internalType":"bytes","name":"extraSignature","type":"bytes"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"internalType":"struct Execution","name":"execution","type":"tuple"}],"name":"buyToBorrowETH","outputs":[{"internalType":"uint256","name":"lienId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"},{"components":[{"internalType":"uint16","name":"rate","type":"uint16"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct Fee[]","name":"fees","type":"tuple[]"}],"internalType":"struct SellOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct SellInput","name":"sellInput","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct LoanInput","name":"loanInput","type":"tuple"},{"internalType":"uint256","name":"loanAmount","type":"uint256"}],"name":"buyToBorrowLocked","outputs":[{"internalType":"uint256","name":"lienId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"},{"components":[{"internalType":"uint16","name":"rate","type":"uint16"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct Fee[]","name":"fees","type":"tuple[]"}],"internalType":"struct SellOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct SellInput","name":"sellInput","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct LoanInput","name":"loanInput","type":"tuple"},{"internalType":"uint256","name":"loanAmount","type":"uint256"}],"name":"buyToBorrowLockedETH","outputs":[{"internalType":"uint256","name":"lienId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"salt","type":"uint256"}],"name":"cancelOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"salts","type":"uint256[]"}],"name":"cancelOffers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"cancelledOrFulfilled","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"}],"name":"getOfferHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getOracleOfferHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"},{"components":[{"internalType":"uint16","name":"rate","type":"uint16"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct Fee[]","name":"fees","type":"tuple[]"}],"internalType":"struct SellOffer","name":"offer","type":"tuple"}],"name":"getSellOfferHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incrementNonce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"information","outputs":[{"internalType":"string","name":"version","type":"string"},{"internalType":"bytes32","name":"domainSeparator","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"liens","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"oracles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"refinance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"}],"name":"refinanceAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct LoanOffer","name":"offer","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"refinanceAuctionByOther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"internalType":"uint256","name":"lienId","type":"uint256"}],"name":"repay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"internalType":"uint256","name":"lienId","type":"uint256"}],"internalType":"struct LienPointer[]","name":"lienPointers","type":"tuple[]"}],"name":"seize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_blockRange","type":"uint256"}],"name":"setBlockRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oracle","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"internalType":"uint256","name":"lienId","type":"uint256"}],"name":"startAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract ERC721","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"auctionStartBlock","type":"uint256"},{"internalType":"uint256","name":"auctionDuration","type":"uint256"}],"internalType":"struct Lien","name":"lien","type":"tuple"},{"internalType":"uint256","name":"lienId","type":"uint256"},{"components":[{"components":[{"components":[{"internalType":"address","name":"trader","type":"address"},{"internalType":"enum Side","name":"side","type":"uint8"},{"internalType":"address","name":"matchingPolicy","type":"address"},{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"listingTime","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"components":[{"internalType":"uint16","name":"rate","type":"uint16"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct Fee[]","name":"fees","type":"tuple[]"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"bytes","name":"extraParams","type":"bytes"}],"internalType":"struct Order","name":"order","type":"tuple"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"bytes","name":"extraSignature","type":"bytes"},{"internalType":"enum SignatureVersion","name":"signatureVersion","type":"uint8"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"internalType":"struct Input","name":"makerOrder","type":"tuple"},{"internalType":"bytes","name":"extraSignature","type":"bytes"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"internalType":"struct Execution","name":"execution","type":"tuple"}],"name":"takeBid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

61016060405230610120523480156200001757600080fd5b5060405162006644380380620066448339810160408190526200003a9162000497565b6200004462000073565b6101005260e05260a05260c0526080526001600160a01b038116610140526200006c620003d5565b50620005e1565b600080600080600060405160200162000115906c08a92a06e626488dedac2d2dc5609b1b81526b1cdd1c9a5b99c81b985b594b60a21b600d8201526e1cdd1c9a5b99c81d995c9cda5bdb8b608a1b60198201526f1d5a5b9d0c8d4d8818da185a5b92590b60821b60288201527f6164647265737320766572696679696e67436f6e7472616374000000000000006038820152602960f81b605182015260520190565b60405160208183030381529060405280519060200120905060405160200162000196906b09ee4c2c6d8ca9ecccccae4560a31b81526c189e5d195ccccc881a185cda0b609a1b600c8201527f75696e7432353620626c6f636b4e756d626572000000000000000000000000006019820152602960f81b602c820152602d0190565b604051602081830303815290604052805190602001209150604051602001620003199069098dec2dc9ecccccae4560b31b81526e1859191c995cdcc81b195b99195c8b608a1b600a8201527f6164647265737320636f6c6c656374696f6e2c0000000000000000000000000060198201527f75696e7432353620746f74616c416d6f756e742c000000000000000000000000602c820152711d5a5b9d0c8d4d881b5a5b905b5bdd5b9d0b60721b6040820152711d5a5b9d0c8d4d881b585e105b5bdd5b9d0b60721b60528201527f75696e743235362061756374696f6e4475726174696f6e2c000000000000000060648201526c1d5a5b9d0c8d4d881cd85b1d0b609a1b607c8201527f75696e743235362065787069726174696f6e54696d652c00000000000000000060898201526c1d5a5b9d0c8d4d881c985d194b609a1b60a08201526e1859191c995cdcc81bdc9858db194b608a1b60ad8201526c75696e74323536206e6f6e636560981b60bc820152602960f81b60c982015260ca0190565b604051602081830303815290604052805190602001209450600060405160200162000387906308ccaca560e31b81526b1d5a5b9d0c4d881c985d194b60a21b6004820152701859191c995cdcc81c9958da5c1a595b9d607a1b6010820152602960f81b602182015260220190565b60405160208183030381529060405290508080519060200120935080604051602001620003b59190620004c9565b604051602081830303815290604052805190602001209450509091929394565b603554610100900460ff1615620004425760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60355460ff908116101562000495576035805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b600060208284031215620004aa57600080fd5b81516001600160a01b0381168114620004c257600080fd5b9392505050565b690a6cad8d89ecccccae4560b31b8152701859191c995cdcc8189bdc9c9bddd95c8b607a1b600a8201526e1d5a5b9d0c8d4d881b1a595b92590b608a1b601b8201526d1d5a5b9d0c8d4d881c1c9a58d94b60921b602a8201527f75696e743235362065787069726174696f6e54696d652c00000000000000000060388201526c1d5a5b9d0c8d4d881cd85b1d0b609a1b604f8201526e1859191c995cdcc81bdc9858db194b608a1b605c8201526a11995956d7481999595ccb60aa1b606b8201526c75696e74323536206e6f6e636560981b6076820152602960f81b60838201526000825160005b81811015620005d05760208186018101516084868401015201620005b1565b506000920160840191825250919050565b60805160a05160c05160e051610100516101205161014051615ef76200074d6000396000818161024f015281816108ef01528181610a7901528181610c0501528181610ca701528181610d3f01528181610efb01528181610fa70152818161104901528181611103015281816111af01528181611268015281816112d10152818161137d01528181611436015281816115e40152818161181c01528181611a3201528181611ade01528181611b9401528181611c40015281816123cd0152818161261201528181612825015281816128be0152818161293c015281816129c801528181612f8501528181613045015281816131ae015281816132da015281816134760152818161351a01526147080152600081816114e60152818161152f01528181611cf501528181611d350152611dc801526000818161363901528181614acb0152614c7d015260006142ea015260006140d701526000614a07015260006141d80152615ef76000f3fe60806040526004361061023f5760003560e01c80637ecebe001161012e578063c2438267116100ab578063e65e9f191161006f578063e65e9f1914610714578063e7efc17814610734578063ef706adf14610754578063f2fde38b14610774578063f47b77401461079457600080fd5b8063c243826714610668578063c63f605214610688578063c87df1c2146106b6578063e263967e146106d6578063e30c3978146106f657600080fd5b8063906524fc116100f2578063906524fc146105d2578063a49c04be146105f2578063a4b2c67414610612578063addd509914610628578063b2a0bb861461065557600080fd5b80637ecebe001461052b5780638129fc1c146105585780638553b2341461056d5780638593d5fc146105805780638da5cb5b146105a057600080fd5b80634f1ef286116101bc578063653608431161018057806365360843146104a15780636992aa36146104c1578063715018a6146104e1578063736da5ad146104f657806379ba50971461051657600080fd5b80634f1ef2861461042457806352d1902d146104375780635b43226f1461044c5780635e05b33c1461046c578063627cdcb91461048c57600080fd5b80633659cfe6116102035780633659cfe6146103915780633ed7d74d146103b157806341af3763146103c45780634658ad62146103e45780634ae25a861461040457600080fd5b8063017d0ae01461029357806306aec5ef146102de57806308a8e4a3146102fe578063150b7a021461032c5780632e2fb18b1461037157600080fd5b3661028e57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461028c576040516282b42960e81b815260040160405180910390fd5b005b600080fd5b34801561029f57600080fd5b506102cb6102ae366004614d65565b60cc60209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b3480156102ea57600080fd5b5061028c6102f9366004614dbc565b6107b7565b34801561030a57600080fd5b506102cb610319366004614e16565b6101656020526000908152604090205481565b34801561033857600080fd5b50610358610347366004614e77565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016102d5565b34801561037d57600080fd5b506102cb61038c366004614ee9565b610df2565b34801561039d57600080fd5b5061028c6103ac366004614f76565b6114dc565b6102cb6103bf366004614fa6565b6115c4565b3480156103d057600080fd5b5061028c6103df36600461502e565b611659565b3480156103f057600080fd5b5061028c6103ff366004615085565b6118ca565b34801561041057600080fd5b5061028c61041f366004615103565b611caf565b61028c61043236600461518d565b611ceb565b34801561044357600080fd5b506102cb611dbb565b34801561045857600080fd5b5061028c610467366004615250565b611e6e565b34801561047857600080fd5b5061028c6104873660046152b3565b612028565b34801561049857600080fd5b5061028c6121e8565b3480156104ad57600080fd5b5061028c6104bc3660046152ee565b6121f3565b3480156104cd57600080fd5b5061028c6104dc366004614e16565b61223a565b3480156104ed57600080fd5b5061028c612247565b34801561050257600080fd5b5061028c61051136600461502e565b612259565b34801561052257600080fd5b5061028c61246e565b34801561053757600080fd5b506102cb610546366004614f76565b60006020819052908152604090205481565b34801561056457600080fd5b5061028c6124e5565b61028c61057b366004615339565b6125fd565b34801561058c57600080fd5b506102cb61059b366004614fa6565b612684565b3480156105ac57600080fd5b506068546001600160a01b03165b6040516001600160a01b0390911681526020016102d5565b3480156105de57600080fd5b506102cb6105ed3660046153b3565b612c9f565b3480156105fe57600080fd5b5061028c61060d3660046153ef565b612cb0565b34801561061e57600080fd5b506102cb60025481565b34801561063457600080fd5b506102cb610643366004614f76565b60016020526000908152604090205481565b6102cb610663366004614ee9565b613025565b34801561067457600080fd5b506102cb610683366004615426565b6130b8565b34801561069457600080fd5b506102cb6106a3366004614e16565b6101646020526000908152604090205481565b3480156106c257600080fd5b5061028c6106d13660046152b3565b6130c3565b3480156106e257600080fd5b506102cb6106f1366004615443565b613250565b34801561070257600080fd5b50609a546001600160a01b03166105ba565b34801561072057600080fd5b506102cb61072f3660046154ac565b61337d565b34801561074057600080fd5b5061028c61074f366004615339565b613390565b34801561076057600080fd5b5061028c61076f366004614e16565b613571565b34801561078057600080fd5b5061028c61078f366004614f76565b61357b565b3480156107a057600080fd5b506107a96135ec565b6040516102d592919061551e565b82826107c382826136a5565b6107e057604051636946eab760e01b815260040160405180910390fd5b846107ea816136e7565b1561080857604051632e42ba1f60e01b815260040160405180910390fd5b306108138580615540565b61081d9080615560565b61082b906020810190614f76565b6001600160a01b03161480610861575061084b6040870160208801614f76565b6001600160a01b0316336001600160a01b031614155b1561087e576040516282b42960e81b815260040160405180910390fd5b600061088a8787613712565b604080516101a081018252308152600160208201526eb92d5d043faf7cecf7e2ee6aaed23281830152919250600091906060808301916108ce918c01908c01614f76565b6001600160a01b0390811682526060808c01356020840152600160408401527f0000000000000000000000000000000000000000000000000000000000000000909116908201526080016109228880615540565b61092c9080615560565b60e00135815260200161093f8880615540565b6109499080615560565b610959906101000135600161558d565b8152600019602082015260400160006040519080825280602002602001820160405280156109ad57816020015b60408051808201909152600080825260208201528152602001906001900390816109865790505b508152602001888152602001604051806040016040528060018152602001600160f81b815250815250905060006040518060e00160405280838152602001600060ff1681526020016000801b81526020016000801b8152602001888060200190610a1791906155a0565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050506020820181905260408a8101359281019290925290516370a0823160e01b8152306004820152919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec91906155e6565b9050610afe60608b0160408c01614f76565b60405163095ea7b360e01b81526e0111abe46ff893f3b2fdf1f759a8a8600482015260608c013560248201526001600160a01b03919091169063095ea7b390604401600060405180830381600087803b158015610b5a57600080fd5b505af1158015610b6e573d6000803e3d6000fd5b506dad05ccc4f10045630fb830b951279250639a1fc3a79150849050610b948b80615540565b6040518363ffffffff1660e01b8152600401610bb1929190615af3565b600060405180830381600087803b158015610bcb57600080fd5b505af1158015610bdf573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092508391506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610c4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7091906155e6565b610c7a9190615b18565b905084811015610c9d5760405163166877a960e21b815260040160405180910390fd5b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd30610cda60208f018f614f76565b886040518463ffffffff1660e01b8152600401610cf993929190615b2b565b6020604051808303816000875af1158015610d18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3c9190615b4f565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166323b872dd308d6020016020810190610d809190614f76565b8885036040518463ffffffff1660e01b8152600401610da193929190615b2b565b6020604051808303816000875af1158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de49190615b4f565b505050505050505050505050565b600084610dff8580615540565b60200135610e0d82826136a5565b610e2a57604051636946eab760e01b815260040160405180910390fd5b86610e34816136e7565b15610e5257604051632e42ba1f60e01b815260040160405180910390fd5b610e626040870160208801614f76565b6001600160a01b0316610e7b60608a0160408b01614f76565b6001600160a01b031614610ea25760405163f8492b0160e01b815260040160405180910390fd5b600080610ec58a610eb38b80615540565b610ec060208d018d6155a0565b613811565b9092509050610ee788610edc6101408201826155a0565b8a8e6060013561392a565b9550808710156110f1576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd610f2d60208b018b614f76565b610f3a60208e018e614f76565b8a6040518463ffffffff1660e01b8152600401610f5993929190615b2b565b6020604051808303816000875af1158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c9190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd33610fda60208e018e614f76565b8a85036040518463ffffffff1660e01b8152600401610ffb93929190615b2b565b6020604051808303816000875af115801561101a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103e9190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd336110798c80615540565b611087906020810190614f76565b8486036040518463ffffffff1660e01b81526004016110a893929190615b2b565b6020604051808303816000875af11580156110c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110eb9190615b4f565b506114cf565b818710156112c7576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd61113560208b018b614f76565b61114260208e018e614f76565b846040518463ffffffff1660e01b815260040161116193929190615b2b565b6020604051808303816000875af1158015611180573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a49190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd6111e160208b018b614f76565b6111eb8c80615540565b6111f9906020810190614f76565b848b036040518463ffffffff1660e01b815260040161121a93929190615b2b565b6020604051808303816000875af1158015611239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125d9190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd336112988c80615540565b6112a6906020810190614f76565b8a86036040518463ffffffff1660e01b81526004016110a893929190615b2b565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd61130360208b018b614f76565b61131060208e018e614f76565b846040518463ffffffff1660e01b815260040161132f93929190615b2b565b6020604051808303816000875af115801561134e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113729190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd6113af60208b018b614f76565b6113b98c80615540565b6113c7906020810190614f76565b8486036040518463ffffffff1660e01b81526004016113e893929190615b2b565b6020604051808303816000875af1158015611407573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142b9190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd61146860208b018b614f76565b33858b036040518463ffffffff1660e01b815260040161148a93929190615b2b565b6020604051808303816000875af11580156114a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cd9190615b4f565b505b5050505050949350505050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361152d5760405162461bcd60e51b815260040161152490615b6c565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611576600080516020615ea4833981519152546001600160a01b031690565b6001600160a01b03161461159c5760405162461bcd60e51b815260040161152490615bb8565b6115a581613a34565b604080516000808252602082019092526115c191839190613a3c565b50565b60405163f340fa0160e01b81523360048201526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f340fa019034906024016000604051808303818588803b15801561162957600080fd5b505af115801561163d573d6000803e3d6000fd5b505050505061164f8686868686612684565b9695505050505050565b848461166582826136a5565b61168257604051636946eab760e01b815260040160405180910390fd5b8661168c81613bac565b6116a9576040516311836dc560e01b815260040160405180910390fd5b604051637e8c1b2d60e01b815260e08901356004820152610100890135602482015260c08901356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90637e8c1b2d90606401602060405180830381865af4158015611714573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173891906155e6565b905080876101000135118061175657508861010001358760a0013514155b15611774576040516369a61bf560e11b815260040160405180910390fd5b60405163036e164f60e31b815260808a0135600482015260c08a0135602482015260a08a01356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af41580156117de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180291906155e6565b90506118128a8a838b8b8b613bd8565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd61184e60208b018b614f76565b61185b60208e018e614f76565b846040518463ffffffff1660e01b815260040161187a93929190615b2b565b6020604051808303816000875af1158015611899573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118bd9190615b4f565b5050505050505050505050565b85856118d682826136a5565b6118f357604051636946eab760e01b815260040160405180910390fd5b876118fd816136e7565b1561191b57604051632e42ba1f60e01b815260040160405180910390fd5b61192b60408a0160208b01614f76565b6001600160a01b0316336001600160a01b03161461195b576040516282b42960e81b815260040160405180910390fd5b620697808660a00135111561198357604051635177028760e11b815260040160405180910390fd5b611991898989898989613bd8565b60405163036e164f60e31b815260808a0135600482015260c08a0135602482015260a08a01356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af41580156119fb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a1f91906155e6565b9050808810611b8a576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd611a6460208a018a614f76565b611a7160208e018e614f76565b846040518463ffffffff1660e01b8152600401611a9093929190615b2b565b6020604051808303816000875af1158015611aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad39190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd611b1060208a018a614f76565b611b2060408e0160208f01614f76565b848c036040518463ffffffff1660e01b8152600401611b4193929190615b2b565b6020604051808303816000875af1158015611b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b849190615b4f565b50611ca3565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd611bc660208a018a614f76565b611bd360208e018e614f76565b8b6040518463ffffffff1660e01b8152600401611bf293929190615b2b565b6020604051808303816000875af1158015611c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c359190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd611c7560408d0160208e01614f76565b611c8260208e018e614f76565b8b85036040518463ffffffff1660e01b815260040161187a93929190615b2b565b50505050505050505050565b8060005b81811015611ce557611cdd33858584818110611cd157611cd1615c04565b90506020020135613d95565b600101611cb3565b50505050565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003611d335760405162461bcd60e51b815260040161152490615b6c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611d7c600080516020615ea4833981519152546001600160a01b031690565b6001600160a01b031614611da25760405162461bcd60e51b815260040161152490615bb8565b611dab82613a34565b611db782826001613a3c565b5050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611e5b5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611524565b50600080516020615ea483398151915290565b8060005b81811015611ce55736848483818110611e8d57611e8d615c04565b9050610140020160000190506000858584818110611ead57611ead615c04565b9050610140020161012001359050816000016020810190611ece9190614f76565b6001600160a01b0316336001600160a01b031614611efe576040516282b42960e81b815260040160405180910390fd5b611f0882826136a5565b611f2557604051636946eab760e01b815260040160405180910390fd5b611f2e826136e7565b1561201e576000818152610164602052604080822091909155611f579060608401908401614f76565b6001600160a01b03166342842e0e30611f736020860186614f76565b85606001356040518463ffffffff1660e01b8152600401611f9693929190615b2b565b600060405180830381600087803b158015611fb057600080fd5b505af1158015611fc4573d6000803e3d6000fd5b505050507fb71caf41fe0e019dbe21a1ae3493f11a729c31548ed1e304ae7f6e8c8df275de81836040016020810190611ffd9190614f76565b604080519283526001600160a01b0390911660208301520160405180910390a15b5050600101611e72565b818161203482826136a5565b61205157604051636946eab760e01b815260040160405180910390fd5b61205e6020850185614f76565b6001600160a01b0316336001600160a01b03161461208e576040516282b42960e81b815260040160405180910390fd5b60e0840135156120b157604051635bd3f04f60e01b815260040160405180910390fd5b604080516101208101909152806120cb6020870187614f76565b6001600160a01b031681526020018560200160208101906120ec9190614f76565b6001600160a01b0316815260200161210a6060870160408801614f76565b6001600160a01b0316815260200185606001358152602001856080013581526020018560a0013581526020018560c00135815260200143815260200185610100013581525060405160200161215f9190615c1a565b604051602081830303815290604052805190602001206101646000858152602001908152602001600020819055507fe5095dc360d1a56740c946cccc76520c1a1a57381c950520062adeda68dbf572838560400160208101906121c29190614f76565b604080519283526001600160a01b0390911660208301520160405180910390a150505050565b6121f133613df1565b565b6121fb613e50565b801561221f57506001600160a01b0316600090815260016020819052604090912055565b506001600160a01b0316600090815260016020526040812055565b612242613e50565b600255565b61224f613e50565b6121f16000613eaa565b848461226582826136a5565b61228257604051636946eab760e01b815260040160405180910390fd5b8661228c816136e7565b156122aa57604051632e42ba1f60e01b815260040160405180910390fd5b6122b76020890189614f76565b6001600160a01b0316336001600160a01b0316146122e7576040516282b42960e81b815260040160405180910390fd5b8760c00135866101000135118061230757508761010001358660a0013514155b15612325576040516369a61bf560e11b815260040160405180910390fd5b60405163036e164f60e31b81526080890135600482015260c0890135602482015260a08901356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af415801561238f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b391906155e6565b90506123c38989838a8a8a613bd8565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd6123ff60208a018a614f76565b61240c60208d018d614f76565b846040518463ffffffff1660e01b815260040161242b93929190615b2b565b6020604051808303816000875af115801561244a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca39190615b4f565b609a5433906001600160a01b031681146124dc5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401611524565b6115c181613eaa565b603554610100900460ff16158080156125055750603554600160ff909116105b8061251f5750303b15801561251f575060355460ff166001145b6125825760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611524565b6035805460ff1916600117905580156125a5576035805461ff0019166101001790555b6125ad613ec3565b6125b5613eea565b80156115c1576035805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60405163f340fa0160e01b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f340fa019034906024016000604051808303818588803b15801561265f57600080fd5b505af1158015612673573d6000803e3d6000fd5b5050505050611ce584848484613390565b6000306126918380615540565b61269b9080615560565b6126a9906020810190614f76565b6001600160a01b0316036126cf576040516282b42960e81b815260040160405180910390fd5b620697808660a0013511156126f757604051635177028760e11b815260040160405180910390fd5b60006127038380615540565b61270d9080615560565b608001359050600061271f8480615540565b6127299080615560565b60e00135905060006040518061012001604052808a60000160208101906127509190614f76565b6001600160a01b03168152602001336001600160a01b031681526020018a60200160208101906127809190614f76565b6001600160a01b031681526020018481526020018781526020014281526020018a61010001358152602001600081526020018a60a001358152509050806040516020016127cd9190615c1a565b60408051601f1981840301815291815281516020928301206101638054600181019091556000818152610164909452919092209190915593506128138989898488613f19565b81861015612932576001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016639555a94261285760208c018c614f76565b30896040518463ffffffff1660e01b815260040161287793929190615b2b565b600060405180830381600087803b15801561289157600080fd5b505af11580156128a5573d6000803e3d6000fd5b5050604051634aaad4a160e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169250639555a94291506128fb90339030908b880390600401615b2b565b600060405180830381600087803b15801561291557600080fd5b505af1158015612929573d6000803e3d6000fd5b50505050612a65565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016639555a94261296e60208c018c614f76565b30856040518463ffffffff1660e01b815260040161298e93929190615b2b565b600060405180830381600087803b1580156129a857600080fd5b505af11580156129bc573d6000803e3d6000fd5b50506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691506323b872dd90506129fe60208c018c614f76565b33858a036040518463ffffffff1660e01b8152600401612a2093929190615b2b565b6020604051808303816000875af1158015612a3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a639190615b4f565b505b604080516101a081018252308152600060208083018290526edab4a563819e8fd93dba3b25bc34958385015290926060830191612aa6918e01908e01614f76565b6001600160a01b031681526020810186905260016040820152600060608201526080810185905260a001612ada8880615540565b612ae49080615560565b612af4906101000135600161558d565b815260001960208201526040016000604051908082528060200260200182016040528015612b4857816020015b6040805180820190915260008082526020820152815260200190600190039081612b215790505b508152602001612b588880615540565b612b629080615560565b612b70906020810190614f76565b6001600160a01b03168152602001604051806040016040528060018152602001600160f81b815250815250905060006040518060e00160405280838152602001600060ff1681526020016000801b81526020016000801b8152602001888060200190612bdc91906155a0565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505050602082015260408981013591015290506dad05ccc4f10045630fb830b95127639a1fc3a785612c418a80615540565b846040518463ffffffff1660e01b8152600401612c5f929190615c8d565b6000604051808303818588803b158015612c7857600080fd5b505af1158015612c8c573d6000803e3d6000fd5b5050505050505050505095945050505050565b6000612caa826140d3565b92915050565b8282612cbc82826136a5565b612cd957604051636946eab760e01b815260040160405180910390fd5b84612ce381613bac565b612d00576040516311836dc560e01b815260040160405180910390fd5b604051637e8c1b2d60e01b815260e08701356004820152610100870135602482015260c08701356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90637e8c1b2d90606401602060405180830381865af4158015612d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d8f91906155e6565b905080851115612db2576040516347765d3b60e11b815260040160405180910390fd5b60405163036e164f60e31b81526080880135600482015260c0880135602482015260a08801356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af4158015612e1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e4091906155e6565b9050604051806101200160405280336001600160a01b03168152602001896020016020810190612e709190614f76565b6001600160a01b03168152602001612e8e60608b0160408c01614f76565b6001600160a01b031681526020018960600135815260200182815260200142815260200187815260200160008152602001896101000135815250604051602001612ed89190615c1a565b604051602081830303815290604052805190602001206101646000898152602001908152602001600020819055507f558a9295c62e9e1b12a21c8fe816f4816a2e0269a53157edbfa16017b11b9ac987896040016020810190612f3b9190614f76565b604080519283526001600160a01b039091166020830152339082015260608101839052608081018890526101008a013560a082015260c00160405180910390a16001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd33612fb860208c018c614f76565b846040518463ffffffff1660e01b8152600401612fd793929190615b2b565b6020604051808303816000875af1158015612ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301a9190615b4f565b505050505050505050565b60405163f340fa0160e01b81523360048201526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f340fa019034906024016000604051808303818588803b15801561308a57600080fd5b505af115801561309e573d6000803e3d6000fd5b50505050506130af85858585610df2565b95945050505050565b6000612caa826141d4565b81816130cf82826136a5565b6130ec57604051636946eab760e01b815260040160405180910390fd5b836130f6816136e7565b1561311457604051632e42ba1f60e01b815260040160405180910390fd5b60006131208686613712565b90506131326060870160408801614f76565b6001600160a01b03166342842e0e3061315160408a0160208b01614f76565b89606001356040518463ffffffff1660e01b815260040161317493929190615b2b565b600060405180830381600087803b15801561318e57600080fd5b505af11580156131a2573d6000803e3d6000fd5b50506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691506323b872dd9050336131e560208a018a614f76565b846040518463ffffffff1660e01b815260040161320493929190615b2b565b6020604051808303816000875af1158015613223573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132479190615b4f565b50505050505050565b600061325f868686868661392a565b90506132716040870160208801614f76565b6001600160a01b03166342842e0e3330856040518463ffffffff1660e01b81526004016132a093929190615b2b565b600060405180830381600087803b1580156132ba57600080fd5b505af11580156132ce573d6000803e3d6000fd5b50506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691506323b872dd90506133106020890189614f76565b33866040518463ffffffff1660e01b815260040161333093929190615b2b565b6020604051808303816000875af115801561334f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133739190615b4f565b5095945050505050565b600061338983836142e4565b9392505050565b8383602001356133a082826136a5565b6133bd57604051636946eab760e01b815260040160405180910390fd5b856133c7816136e7565b156133e557604051632e42ba1f60e01b815260040160405180910390fd5b6000806133f489898989613811565b909250905061340960608a0160408b01614f76565b6001600160a01b03166342842e0e30338c606001356040518463ffffffff1660e01b815260040161343c93929190615b2b565b600060405180830381600087803b15801561345657600080fd5b505af115801561346a573d6000803e3d6000fd5b50506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691506323b872dd9050336134ad60208d018d614f76565b846040518463ffffffff1660e01b81526004016134cc93929190615b2b565b6020604051808303816000875af11580156134eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061350f9190615b4f565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd3361355060408d0160208e01614f76565b8486036040518463ffffffff1660e01b815260040161242b93929190615b2b565b6115c13382613d95565b613583613e50565b609a80546001600160a01b0383166001600160a01b031990911681179091556135b46068546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6040805180820182526003808252620312e360ec1b6020808401829052845180860186526005815264109b195b9960da1b908201528451808601909552918452920191909152600061369f7f00000000000000000000000000000000000000000000000000000000000000007fc4b8616ae0489f3c1b902f3ab01ae0a19589748eb5da617af5a0e62f9d3b72bf7fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b3614340565b90509091565b6000826040516020016136b89190615cb2565b60408051601f198184030181529181528151602092830120600085815261016490935291205414905092915050565b600060e082013515801590612caa57504361370b61010084013560e085013561558d565b1092915050565b60405163036e164f60e31b81526080830135600482015260c0830135602482015260a08301356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af415801561377c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a091906155e6565b60008381526101646020526040808220919091559091507f2469cc9e12e74c63438d5b1117b318cd3a4cdaf9d659d9eac6d975d14d9632549083906137eb9060608701908701614f76565b604080519283526001600160a01b0390911660208301520160405180910390a192915050565b6000806138216020860186614f76565b6001600160a01b031661383a6040880160208901614f76565b6001600160a01b031614613860576040516282b42960e81b815260040160405180910390fd5b61386b858585614389565b915061387b868660200135613712565b90508082101561389e5760405163166877a960e21b815260040160405180910390fd5b7f7ffb5bd9cdc79a6f9bc6e00c82f43836e0afbb204d47972001f6e853764a8ef160208601356138d46060890160408a01614f76565b336138e560408b0160208c01614f76565b604080519485526001600160a01b039384166020860152918316848301529091166060808401919091528901356080830152519081900360a00190a194509492505050565b6000620697808660a00135111561395457604051635177028760e11b815260040160405180910390fd5b6040805161012081019091526000908061397160208a018a614f76565b6001600160a01b03168152602001336001600160a01b031681526020018860200160208101906139a19190614f76565b6001600160a01b031681526020018481526020018581526020014281526020018861010001358152602001600081526020018860a001358152509050806040516020016139ee9190615c1a565b60408051601f1981840301815291815281516020928301206101638054600181019091556000818152610164909452919092209190915591506133738787878486613f19565b6115c1613e50565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613a7457613a6f83614433565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613ace575060408051601f3d908101601f19168201909252613acb918101906155e6565b60015b613b315760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611524565b600080516020615ea48339815191528114613ba05760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611524565b50613a6f8383836144cf565b600060e082013515801590612caa575043613bd061010084013560e085013561558d565b101592915050565b613be86040840160208501614f76565b6001600160a01b0316613c016060880160408901614f76565b6001600160a01b031614613c285760405163f8492b0160e01b815260040160405180910390fd5b60408051610120810190915260009080613c456020870187614f76565b6001600160a01b03168152602001886020016020810190613c669190614f76565b6001600160a01b03168152602001613c8460608a0160408b01614f76565b6001600160a01b03168152602001886060013581526020018681526020014281526020018561010001358152602001600081526020018560a00135815250905080604051602001613cd59190615c1a565b60408051601f1981840301815291815281516020928301206000898152610164909352912055613d08848484848a613f19565b7f558a9295c62e9e1b12a21c8fe816f4816a2e0269a53157edbfa16017b11b9ac986613d3a6040870160208801614f76565b613d476020880188614f76565b604080519384526001600160a01b03928316602085015291169082015260608101879052610100860135608082015260a0808701359082015260c0015b60405180910390a150505050505050565b6001600160a01b038216600081815260cc602090815260408083208584528252918290206001905590518381527f899cab278284ae4a91172caa0943607a0bcb19766254c3ebe1139be00650b102910160405180910390a25050565b6001600160a01b038116600081815260208190526040812080547fa82a649bbd060c9099cd7b7326e2b0dc9e9af0836480e0f849dc9eaa79710b3b9290613e3790615d47565b918290555060405190815260200160405180910390a250565b6068546001600160a01b031633146121f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611524565b609a80546001600160a01b03191690556115c1816144f4565b603554610100900460ff166121f15760405162461bcd60e51b815260040161152490615d60565b603554610100900460ff16613f115760405162461bcd60e51b815260040161152490615d60565b6121f1614546565b6000613f24866141d4565b9050613f5a81613f376020890189614f76565b613f496101408a016101208b01614f76565b88888b60e001358c60c00135614576565b620186a08661010001351115613f83576040516347765d3b60e11b815260040160405180910390fd5b856080013583608001511180613fa0575085606001358360800151105b15613fbe5760405163045f33d160e01b815260040160405180910390fd5b60008181526101656020526040908190205460808501519091613fe59083908a0135615b18565b10156140045760405163cfe9d93160e01b815260040160405180910390fd5b836080015181016101656000848152602001908152602001600020819055507f06a333c2d6fe967ca967f7a35be2eb45e8caeb6cf05e16f55d42b91b5fe3125582848960200160208101906140599190614f76565b8751602089015160808a015160c08b015160608c01516101008d0151604051613d849998979695949392919098895260208901979097526001600160a01b039586166040890152938516606088015291909316608086015260a085019290925260c084019190915260e08301526101008201526101200190565b60007f00000000000000000000000000000000000000000000000000000000000000006141036020840184614f76565b602084013560408501356060860135608087013561412760c0890160a08a01614f76565b61413c61413760c08b018b615dab565b6145e8565b60008061414c60208d018d614f76565b6001600160a01b03908116825260208083019390935260409182016000205482519384019b909b52988916908201526060810196909652608086019490945260a085019290925260c084015290921660e0820152610100810191909152610120810191909152610140015b604051602081830303815290604052805190602001209050919050565b60007f00000000000000000000000000000000000000000000000000000000000000006142046020840184614f76565b6142146040850160208601614f76565b60408501356060860135608087013560a088013560c089013560e08a01356101008b013561424a6101408d016101208e01614f76565b6000808e60000160208101906142609190614f76565b6001600160a01b03908116825260208083019390935260409182016000205482519384019e909e529b8c1690820152988a1660608a0152608089019790975260a088019590955260c087019390935260e08601919091526101008501526101208401526101408301529091166101608201526101808101919091526101a0016141b7565b604080517f00000000000000000000000000000000000000000000000000000000000000006020820152908101839052606081018290526000906080015b60405160208183030381529060405280519060200120905092915050565b6040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b60006143c5614397856140d3565b6143a46020870187614f76565b6143b460c0880160a08901614f76565b868689606001358a60800135614576565b600160cc60006143d86020880188614f76565b6001600160a01b03168152602080820192909252604090810160009081206080890135825290925281209190915561442161441660c0870187615dab565b3388604001356146b2565b60409095013594909403949350505050565b6001600160a01b0381163b6144a05760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611524565b600080516020615ea483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6144d883614803565b6000825111806144e55750805b15613a6f57611ce58383614843565b606880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b603554610100900460ff1661456d5760405162461bcd60e51b815260040161152490615d60565b6121f133613eaa565b614583878787878761492e565b428210156145a457604051639cb1308760e01b815260040160405180910390fd5b6001600160a01b038616600090815260cc60209081526040808320848452909152902054600103613247576040516305c934c360e01b815260040160405180910390fd5b600080826001600160401b0381111561460357614603615177565b60405190808252806020026020018201604052801561462c578160200160208202803683370190505b5090508260005b818110156146805761465b86868381811061465057614650615c04565b905060400201614a03565b83828151811061466d5761466d615c04565b6020908102919091010152600101614633565b50816040516020016146929190615df4565b604051602081830303815290604052805190602001209250505092915050565b600083815b818110156147d85760006127108888848181106146d6576146d6615c04565b6146ec9260206040909202019081019150615e2a565b6146fa9061ffff1687615e45565b6147049190615e5c565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166323b872dd878a8a8681811061474857614748615c04565b90506040020160200160208101906147609190614f76565b846040518463ffffffff1660e01b815260040161477f93929190615b2b565b6020604051808303816000875af115801561479e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147c29190615b4f565b506147cd818561558d565b9350506001016146b7565b50828211156147fa5760405163192069c360e31b815260040160405180910390fd5b50949350505050565b61480c81614433565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6148ab5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611524565b600080846001600160a01b0316846040516148c69190615e7e565b600060405180830381855af49150503d8060008114614901576040519150601f19603f3d011682016040523d82523d6000602084013e614906565b606091505b50915091506130af8282604051806060016040528060278152602001615ec460279139614a73565b600061493986614a8c565b905082356020840135604085013560f81c6149578885838686614b59565b6001600160a01b0387161561301a575050506001600160a01b038416600090815260016020526040812054604185013591606186013591608187013560f81c9160828801359190036149bc5760405163db8d1fb760e01b815260040160405180910390fd5b43600254826149cb919061558d565b10156149ea57604051630819bdcd60e01b815260040160405180910390fd5b6149f48a82614c3e565b9450611ca38886848787614b59565b60007f0000000000000000000000000000000000000000000000000000000000000000614a336020840184615e2a565b614a436040850160208601614f76565b6040516020016141b79392919092835261ffff9190911660208301526001600160a01b0316604082015260600190565b60608315614a82575081613389565b6133898383614d16565b6040805180820182526005815264109b195b9960da1b602091820152815180830190925260038252620312e360ec1b910152600061190160f01b614b317f00000000000000000000000000000000000000000000000000000000000000007fc4b8616ae0489f3c1b902f3ab01ae0a19589748eb5da617af5a0e62f9d3b72bf7fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b3614340565b6040516001600160f01b031990921660208301526022820152604281018390526062016141b7565b8260ff16601b14158015614b7157508260ff16601c14155b15614b8f57604051630424f48960e41b815260040160405180910390fd5b6040805160008082526020820180845287905260ff861692820192909252606081018490526080810183905260019060a0016020604051602081039080840390855afa158015614be3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580614c185750806001600160a01b0316866001600160a01b031614155b15614c3657604051638baa579f60e01b815260040160405180910390fd5b505050505050565b6040805180820182526005815264109b195b9960da1b602091820152815180830190925260038252620312e360ec1b910152600061190160f01b614ce37f00000000000000000000000000000000000000000000000000000000000000007fc4b8616ae0489f3c1b902f3ab01ae0a19589748eb5da617af5a0e62f9d3b72bf7fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b3614340565b614ced85856142e4565b6040516001600160f01b0319909316602084015260228301919091526042820152606201614322565b815115614d265781518083602001fd5b8060405162461bcd60e51b81526004016115249190615e90565b6001600160a01b03811681146115c157600080fd5b8035614d6081614d40565b919050565b60008060408385031215614d7857600080fd5b8235614d8381614d40565b946020939093013593505050565b60006101208284031215614da457600080fd5b50919050565b600060608284031215614da457600080fd5b60008060006101608486031215614dd257600080fd5b614ddc8585614d91565b925061012084013591506101408401356001600160401b03811115614e0057600080fd5b614e0c86828701614daa565b9150509250925092565b600060208284031215614e2857600080fd5b5035919050565b60008083601f840112614e4157600080fd5b5081356001600160401b03811115614e5857600080fd5b602083019150836020828501011115614e7057600080fd5b9250929050565b600080600080600060808688031215614e8f57600080fd5b8535614e9a81614d40565b94506020860135614eaa81614d40565b93506040860135925060608601356001600160401b03811115614ecc57600080fd5b614ed888828901614e2f565b969995985093965092949392505050565b6000806000806101808587031215614f0057600080fd5b614f0a8686614d91565b93506101208501356001600160401b0380821115614f2757600080fd5b9086019060408289031215614f3b57600080fd5b9093506101408601359080821115614f5257600080fd5b508501610160818803811315614f6757600080fd5b94979396509490930135925050565b600060208284031215614f8857600080fd5b813561338981614d40565b60006101408284031215614da457600080fd5b60008060008060006101a08688031215614fbf57600080fd5b614fc98787614f93565b94506101408601356001600160401b0380821115614fe657600080fd5b614ff289838a01614e2f565b9096509450610160880135935061018088013591508082111561501457600080fd5b5061502188828901614daa565b9150509295509295909350565b60008060008060006102a0868803121561504757600080fd5b6150518787614d91565b94506101208601359350615069876101408801614f93565b92506102808601356001600160401b03811115614ecc57600080fd5b6000806000806000806102c0878903121561509f57600080fd5b6150a98888614d91565b9550610120870135945061014087013593506150c9886101608901614f93565b92506102a08701356001600160401b038111156150e557600080fd5b6150f189828a01614e2f565b979a9699509497509295939492505050565b6000806020838503121561511657600080fd5b82356001600160401b038082111561512d57600080fd5b818501915085601f83011261514157600080fd5b81358181111561515057600080fd5b8660208260051b850101111561516557600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156151a057600080fd5b82356151ab81614d40565b915060208301356001600160401b03808211156151c757600080fd5b818501915085601f8301126151db57600080fd5b8135818111156151ed576151ed615177565b604051601f8201601f19908116603f0116810190838211818310171561521557615215615177565b8160405282815288602084870101111561522e57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000806020838503121561526357600080fd5b82356001600160401b038082111561527a57600080fd5b818501915085601f83011261528e57600080fd5b81358181111561529d57600080fd5b8660206101408302850101111561516557600080fd5b60008061014083850312156152c757600080fd5b6152d18484614d91565b94610120939093013593505050565b80151581146115c157600080fd5b6000806040838503121561530157600080fd5b823561530c81614d40565b9150602083013561531c816152e0565b809150509250929050565b600060e08284031215614da457600080fd5b600080600080610160858703121561535057600080fd5b61535a8686614d91565b93506101208501356001600160401b038082111561537757600080fd5b61538388838901615327565b945061014087013591508082111561539a57600080fd5b506153a787828801614e2f565b95989497509550505050565b6000602082840312156153c557600080fd5b81356001600160401b038111156153db57600080fd5b6153e784828501615327565b949350505050565b6000806000610160848603121561540557600080fd5b61540f8585614d91565b956101208501359550610140909401359392505050565b6000610140828403121561543957600080fd5b6133898383614f93565b60008060008060006101a0868803121561545c57600080fd5b6154668787614f93565b94506101408601356001600160401b0381111561548257600080fd5b61548e88828901614e2f565b96999098509596610160810135966101809091013595509350505050565b600080604083850312156154bf57600080fd5b50508035926020909101359150565b60005b838110156154e95781810151838201526020016154d1565b50506000910152565b6000815180845261550a8160208601602086016154ce565b601f01601f19169290920160200192915050565b60408152600061553160408301856154f2565b90508260208301529392505050565b6000823560de1983360301811261555657600080fd5b9190910192915050565b6000823561019e1983360301811261555657600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115612caa57612caa615577565b6000808335601e198436030181126155b757600080fd5b8301803591506001600160401b038211156155d157600080fd5b602001915036819003821315614e7057600080fd5b6000602082840312156155f857600080fd5b5051919050565b6002811061561d57634e487b7160e01b600052602160045260246000fd5b9052565b600081518084526020808501945080840160005b83811015615669578151805161ffff1688528301516001600160a01b03168388015260409096019590820190600101615635565b509495945050505050565b6000815160e0845261569260e0850182516001600160a01b03169052565b60208101516101006156a6818701836155ff565b604083015191506101206156c4818801846001600160a01b03169052565b606084015192506101406156e2818901856001600160a01b03169052565b6080850151935061016084818a015260a0860151945061018085818b015260c087015195506101a061571e818c01886001600160a01b03169052565b60e08801516101c08c0152858801516101e08c0152848801516102008c0152838801519650806102208c0152506157596102808b0187615621565b918701516102408b01529095015188860360df19016102608a015294935061578792508391508490506154f2565b915050602083015161579e602086018260ff169052565b506040830151604085015260608301516060850152608083015184820360808601526157ca82826154f2565b91505060a08301516157df60a08601826155ff565b5060c083015160c08501528091505092915050565b803560028110614d6057600080fd5b6000808335601e1984360301811261581a57600080fd5b83016020810192503590506001600160401b0381111561583957600080fd5b8060061b3603821315614e7057600080fd5b803561ffff81168114614d6057600080fd5b8183526000602080850194508260005b858110156156695761ffff6158818361584b565b1687528282013561589181614d40565b6001600160a01b031687840152604096870196919091019060010161586d565b6000808335601e198436030181126158c857600080fd5b83016020810192503590506001600160401b038111156158e757600080fd5b803603821315614e7057600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60006101a061593e8461593185614d55565b6001600160a01b03169052565b61594a602084016157f4565b61595760208601826155ff565b5061596460408401614d55565b6001600160a01b0316604085015261597e60608401614d55565b6001600160a01b0381166060860152506080830135608085015260a083013560a08501526159ae60c08401614d55565b6001600160a01b031660c085015260e08381013590850152610100808401359085015261012080840135908501526101406159eb81850185615803565b83838801526159fd848801828461585d565b9350505050610160808401358186015250610180615a1d818501856158b1565b86840383880152615a2f8482846158f6565b979650505050505050565b803560ff81168114614d6057600080fd5b6000813561019e19833603018112615a6257600080fd5b60e08452615a7560e0850184830161591f565b9050615a8360208401615a3a565b60ff81166020860152506040830135604085015260608301356060850152615aae60808401846158b1565b8583036080870152615ac18382846158f6565b92505050615ad160a084016157f4565b615ade60a08601826155ff565b5060c083013560c08501528091505092915050565b604081526000615b066040830185615674565b82810360208401526130af8185615a4b565b81810381811115612caa57612caa615577565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215615b6157600080fd5b8151613389816152e0565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b81516001600160a01b0390811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525092915050565b604081526000615ca06040830185615a4b565b82810360208401526130af8185615674565b61012081018235615cc281614d40565b6001600160a01b03168252615cd960208401614d55565b6001600160a01b03166020830152615cf360408401614d55565b6001600160a01b038116604084015250606083013560608301526080830135608083015260a083013560a083015260c083013560c083015260e083013560e083015261010080840135818401525092915050565b600060018201615d5957615d59615577565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000808335601e19843603018112615dc257600080fd5b8301803591506001600160401b03821115615ddc57600080fd5b6020019150600681901b3603821315614e7057600080fd5b815160009082906020808601845b83811015615e1e57815185529382019390820190600101615e02565b50929695505050505050565b600060208284031215615e3c57600080fd5b6133898261584b565b8082028115828204841417612caa57612caa615577565b600082615e7957634e487b7160e01b600052601260045260246000fd5b500490565b600082516155568184602087016154ce565b60208152600061338960208301846154f256fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000811000a0000000000000000000000000000000000a39bb272e79075ade125fd351887ac

Deployed Bytecode

0x60806040526004361061023f5760003560e01c80637ecebe001161012e578063c2438267116100ab578063e65e9f191161006f578063e65e9f1914610714578063e7efc17814610734578063ef706adf14610754578063f2fde38b14610774578063f47b77401461079457600080fd5b8063c243826714610668578063c63f605214610688578063c87df1c2146106b6578063e263967e146106d6578063e30c3978146106f657600080fd5b8063906524fc116100f2578063906524fc146105d2578063a49c04be146105f2578063a4b2c67414610612578063addd509914610628578063b2a0bb861461065557600080fd5b80637ecebe001461052b5780638129fc1c146105585780638553b2341461056d5780638593d5fc146105805780638da5cb5b146105a057600080fd5b80634f1ef286116101bc578063653608431161018057806365360843146104a15780636992aa36146104c1578063715018a6146104e1578063736da5ad146104f657806379ba50971461051657600080fd5b80634f1ef2861461042457806352d1902d146104375780635b43226f1461044c5780635e05b33c1461046c578063627cdcb91461048c57600080fd5b80633659cfe6116102035780633659cfe6146103915780633ed7d74d146103b157806341af3763146103c45780634658ad62146103e45780634ae25a861461040457600080fd5b8063017d0ae01461029357806306aec5ef146102de57806308a8e4a3146102fe578063150b7a021461032c5780632e2fb18b1461037157600080fd5b3661028e57336001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac161461028c576040516282b42960e81b815260040160405180910390fd5b005b600080fd5b34801561029f57600080fd5b506102cb6102ae366004614d65565b60cc60209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b3480156102ea57600080fd5b5061028c6102f9366004614dbc565b6107b7565b34801561030a57600080fd5b506102cb610319366004614e16565b6101656020526000908152604090205481565b34801561033857600080fd5b50610358610347366004614e77565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016102d5565b34801561037d57600080fd5b506102cb61038c366004614ee9565b610df2565b34801561039d57600080fd5b5061028c6103ac366004614f76565b6114dc565b6102cb6103bf366004614fa6565b6115c4565b3480156103d057600080fd5b5061028c6103df36600461502e565b611659565b3480156103f057600080fd5b5061028c6103ff366004615085565b6118ca565b34801561041057600080fd5b5061028c61041f366004615103565b611caf565b61028c61043236600461518d565b611ceb565b34801561044357600080fd5b506102cb611dbb565b34801561045857600080fd5b5061028c610467366004615250565b611e6e565b34801561047857600080fd5b5061028c6104873660046152b3565b612028565b34801561049857600080fd5b5061028c6121e8565b3480156104ad57600080fd5b5061028c6104bc3660046152ee565b6121f3565b3480156104cd57600080fd5b5061028c6104dc366004614e16565b61223a565b3480156104ed57600080fd5b5061028c612247565b34801561050257600080fd5b5061028c61051136600461502e565b612259565b34801561052257600080fd5b5061028c61246e565b34801561053757600080fd5b506102cb610546366004614f76565b60006020819052908152604090205481565b34801561056457600080fd5b5061028c6124e5565b61028c61057b366004615339565b6125fd565b34801561058c57600080fd5b506102cb61059b366004614fa6565b612684565b3480156105ac57600080fd5b506068546001600160a01b03165b6040516001600160a01b0390911681526020016102d5565b3480156105de57600080fd5b506102cb6105ed3660046153b3565b612c9f565b3480156105fe57600080fd5b5061028c61060d3660046153ef565b612cb0565b34801561061e57600080fd5b506102cb60025481565b34801561063457600080fd5b506102cb610643366004614f76565b60016020526000908152604090205481565b6102cb610663366004614ee9565b613025565b34801561067457600080fd5b506102cb610683366004615426565b6130b8565b34801561069457600080fd5b506102cb6106a3366004614e16565b6101646020526000908152604090205481565b3480156106c257600080fd5b5061028c6106d13660046152b3565b6130c3565b3480156106e257600080fd5b506102cb6106f1366004615443565b613250565b34801561070257600080fd5b50609a546001600160a01b03166105ba565b34801561072057600080fd5b506102cb61072f3660046154ac565b61337d565b34801561074057600080fd5b5061028c61074f366004615339565b613390565b34801561076057600080fd5b5061028c61076f366004614e16565b613571565b34801561078057600080fd5b5061028c61078f366004614f76565b61357b565b3480156107a057600080fd5b506107a96135ec565b6040516102d592919061551e565b82826107c382826136a5565b6107e057604051636946eab760e01b815260040160405180910390fd5b846107ea816136e7565b1561080857604051632e42ba1f60e01b815260040160405180910390fd5b306108138580615540565b61081d9080615560565b61082b906020810190614f76565b6001600160a01b03161480610861575061084b6040870160208801614f76565b6001600160a01b0316336001600160a01b031614155b1561087e576040516282b42960e81b815260040160405180910390fd5b600061088a8787613712565b604080516101a081018252308152600160208201526eb92d5d043faf7cecf7e2ee6aaed23281830152919250600091906060808301916108ce918c01908c01614f76565b6001600160a01b0390811682526060808c01356020840152600160408401527f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac909116908201526080016109228880615540565b61092c9080615560565b60e00135815260200161093f8880615540565b6109499080615560565b610959906101000135600161558d565b8152600019602082015260400160006040519080825280602002602001820160405280156109ad57816020015b60408051808201909152600080825260208201528152602001906001900390816109865790505b508152602001888152602001604051806040016040528060018152602001600160f81b815250815250905060006040518060e00160405280838152602001600060ff1681526020016000801b81526020016000801b8152602001888060200190610a1791906155a0565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050506020820181905260408a8101359281019290925290516370a0823160e01b8152306004820152919250907f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac6001600160a01b0316906370a0823190602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec91906155e6565b9050610afe60608b0160408c01614f76565b60405163095ea7b360e01b81526e0111abe46ff893f3b2fdf1f759a8a8600482015260608c013560248201526001600160a01b03919091169063095ea7b390604401600060405180830381600087803b158015610b5a57600080fd5b505af1158015610b6e573d6000803e3d6000fd5b506dad05ccc4f10045630fb830b951279250639a1fc3a79150849050610b948b80615540565b6040518363ffffffff1660e01b8152600401610bb1929190615af3565b600060405180830381600087803b158015610bcb57600080fd5b505af1158015610bdf573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092508391506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac16906370a0823190602401602060405180830381865afa158015610c4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7091906155e6565b610c7a9190615b18565b905084811015610c9d5760405163166877a960e21b815260040160405180910390fd5b6001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd30610cda60208f018f614f76565b886040518463ffffffff1660e01b8152600401610cf993929190615b2b565b6020604051808303816000875af1158015610d18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3c9190615b4f565b507f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac6001600160a01b03166323b872dd308d6020016020810190610d809190614f76565b8885036040518463ffffffff1660e01b8152600401610da193929190615b2b565b6020604051808303816000875af1158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de49190615b4f565b505050505050505050505050565b600084610dff8580615540565b60200135610e0d82826136a5565b610e2a57604051636946eab760e01b815260040160405180910390fd5b86610e34816136e7565b15610e5257604051632e42ba1f60e01b815260040160405180910390fd5b610e626040870160208801614f76565b6001600160a01b0316610e7b60608a0160408b01614f76565b6001600160a01b031614610ea25760405163f8492b0160e01b815260040160405180910390fd5b600080610ec58a610eb38b80615540565b610ec060208d018d6155a0565b613811565b9092509050610ee788610edc6101408201826155a0565b8a8e6060013561392a565b9550808710156110f1576001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd610f2d60208b018b614f76565b610f3a60208e018e614f76565b8a6040518463ffffffff1660e01b8152600401610f5993929190615b2b565b6020604051808303816000875af1158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c9190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd33610fda60208e018e614f76565b8a85036040518463ffffffff1660e01b8152600401610ffb93929190615b2b565b6020604051808303816000875af115801561101a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103e9190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd336110798c80615540565b611087906020810190614f76565b8486036040518463ffffffff1660e01b81526004016110a893929190615b2b565b6020604051808303816000875af11580156110c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110eb9190615b4f565b506114cf565b818710156112c7576001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd61113560208b018b614f76565b61114260208e018e614f76565b846040518463ffffffff1660e01b815260040161116193929190615b2b565b6020604051808303816000875af1158015611180573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a49190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd6111e160208b018b614f76565b6111eb8c80615540565b6111f9906020810190614f76565b848b036040518463ffffffff1660e01b815260040161121a93929190615b2b565b6020604051808303816000875af1158015611239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125d9190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd336112988c80615540565b6112a6906020810190614f76565b8a86036040518463ffffffff1660e01b81526004016110a893929190615b2b565b6001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd61130360208b018b614f76565b61131060208e018e614f76565b846040518463ffffffff1660e01b815260040161132f93929190615b2b565b6020604051808303816000875af115801561134e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113729190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd6113af60208b018b614f76565b6113b98c80615540565b6113c7906020810190614f76565b8486036040518463ffffffff1660e01b81526004016113e893929190615b2b565b6020604051808303816000875af1158015611407573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142b9190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd61146860208b018b614f76565b33858b036040518463ffffffff1660e01b815260040161148a93929190615b2b565b6020604051808303816000875af11580156114a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cd9190615b4f565b505b5050505050949350505050565b6001600160a01b037f00000000000000000000000097bdb4aed0b50a335a78ed24f68528ce3222af7216300361152d5760405162461bcd60e51b815260040161152490615b6c565b60405180910390fd5b7f00000000000000000000000097bdb4aed0b50a335a78ed24f68528ce3222af726001600160a01b0316611576600080516020615ea4833981519152546001600160a01b031690565b6001600160a01b03161461159c5760405162461bcd60e51b815260040161152490615bb8565b6115a581613a34565b604080516000808252602082019092526115c191839190613a3c565b50565b60405163f340fa0160e01b81523360048201526000906001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac169063f340fa019034906024016000604051808303818588803b15801561162957600080fd5b505af115801561163d573d6000803e3d6000fd5b505050505061164f8686868686612684565b9695505050505050565b848461166582826136a5565b61168257604051636946eab760e01b815260040160405180910390fd5b8661168c81613bac565b6116a9576040516311836dc560e01b815260040160405180910390fd5b604051637e8c1b2d60e01b815260e08901356004820152610100890135602482015260c08901356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90637e8c1b2d90606401602060405180830381865af4158015611714573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173891906155e6565b905080876101000135118061175657508861010001358760a0013514155b15611774576040516369a61bf560e11b815260040160405180910390fd5b60405163036e164f60e31b815260808a0135600482015260c08a0135602482015260a08a01356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af41580156117de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180291906155e6565b90506118128a8a838b8b8b613bd8565b6001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd61184e60208b018b614f76565b61185b60208e018e614f76565b846040518463ffffffff1660e01b815260040161187a93929190615b2b565b6020604051808303816000875af1158015611899573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118bd9190615b4f565b5050505050505050505050565b85856118d682826136a5565b6118f357604051636946eab760e01b815260040160405180910390fd5b876118fd816136e7565b1561191b57604051632e42ba1f60e01b815260040160405180910390fd5b61192b60408a0160208b01614f76565b6001600160a01b0316336001600160a01b03161461195b576040516282b42960e81b815260040160405180910390fd5b620697808660a00135111561198357604051635177028760e11b815260040160405180910390fd5b611991898989898989613bd8565b60405163036e164f60e31b815260808a0135600482015260c08a0135602482015260a08a01356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af41580156119fb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a1f91906155e6565b9050808810611b8a576001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd611a6460208a018a614f76565b611a7160208e018e614f76565b846040518463ffffffff1660e01b8152600401611a9093929190615b2b565b6020604051808303816000875af1158015611aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad39190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd611b1060208a018a614f76565b611b2060408e0160208f01614f76565b848c036040518463ffffffff1660e01b8152600401611b4193929190615b2b565b6020604051808303816000875af1158015611b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b849190615b4f565b50611ca3565b6001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd611bc660208a018a614f76565b611bd360208e018e614f76565b8b6040518463ffffffff1660e01b8152600401611bf293929190615b2b565b6020604051808303816000875af1158015611c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c359190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd611c7560408d0160208e01614f76565b611c8260208e018e614f76565b8b85036040518463ffffffff1660e01b815260040161187a93929190615b2b565b50505050505050505050565b8060005b81811015611ce557611cdd33858584818110611cd157611cd1615c04565b90506020020135613d95565b600101611cb3565b50505050565b6001600160a01b037f00000000000000000000000097bdb4aed0b50a335a78ed24f68528ce3222af72163003611d335760405162461bcd60e51b815260040161152490615b6c565b7f00000000000000000000000097bdb4aed0b50a335a78ed24f68528ce3222af726001600160a01b0316611d7c600080516020615ea4833981519152546001600160a01b031690565b6001600160a01b031614611da25760405162461bcd60e51b815260040161152490615bb8565b611dab82613a34565b611db782826001613a3c565b5050565b6000306001600160a01b037f00000000000000000000000097bdb4aed0b50a335a78ed24f68528ce3222af721614611e5b5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611524565b50600080516020615ea483398151915290565b8060005b81811015611ce55736848483818110611e8d57611e8d615c04565b9050610140020160000190506000858584818110611ead57611ead615c04565b9050610140020161012001359050816000016020810190611ece9190614f76565b6001600160a01b0316336001600160a01b031614611efe576040516282b42960e81b815260040160405180910390fd5b611f0882826136a5565b611f2557604051636946eab760e01b815260040160405180910390fd5b611f2e826136e7565b1561201e576000818152610164602052604080822091909155611f579060608401908401614f76565b6001600160a01b03166342842e0e30611f736020860186614f76565b85606001356040518463ffffffff1660e01b8152600401611f9693929190615b2b565b600060405180830381600087803b158015611fb057600080fd5b505af1158015611fc4573d6000803e3d6000fd5b505050507fb71caf41fe0e019dbe21a1ae3493f11a729c31548ed1e304ae7f6e8c8df275de81836040016020810190611ffd9190614f76565b604080519283526001600160a01b0390911660208301520160405180910390a15b5050600101611e72565b818161203482826136a5565b61205157604051636946eab760e01b815260040160405180910390fd5b61205e6020850185614f76565b6001600160a01b0316336001600160a01b03161461208e576040516282b42960e81b815260040160405180910390fd5b60e0840135156120b157604051635bd3f04f60e01b815260040160405180910390fd5b604080516101208101909152806120cb6020870187614f76565b6001600160a01b031681526020018560200160208101906120ec9190614f76565b6001600160a01b0316815260200161210a6060870160408801614f76565b6001600160a01b0316815260200185606001358152602001856080013581526020018560a0013581526020018560c00135815260200143815260200185610100013581525060405160200161215f9190615c1a565b604051602081830303815290604052805190602001206101646000858152602001908152602001600020819055507fe5095dc360d1a56740c946cccc76520c1a1a57381c950520062adeda68dbf572838560400160208101906121c29190614f76565b604080519283526001600160a01b0390911660208301520160405180910390a150505050565b6121f133613df1565b565b6121fb613e50565b801561221f57506001600160a01b0316600090815260016020819052604090912055565b506001600160a01b0316600090815260016020526040812055565b612242613e50565b600255565b61224f613e50565b6121f16000613eaa565b848461226582826136a5565b61228257604051636946eab760e01b815260040160405180910390fd5b8661228c816136e7565b156122aa57604051632e42ba1f60e01b815260040160405180910390fd5b6122b76020890189614f76565b6001600160a01b0316336001600160a01b0316146122e7576040516282b42960e81b815260040160405180910390fd5b8760c00135866101000135118061230757508761010001358660a0013514155b15612325576040516369a61bf560e11b815260040160405180910390fd5b60405163036e164f60e31b81526080890135600482015260c0890135602482015260a08901356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af415801561238f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b391906155e6565b90506123c38989838a8a8a613bd8565b6001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd6123ff60208a018a614f76565b61240c60208d018d614f76565b846040518463ffffffff1660e01b815260040161242b93929190615b2b565b6020604051808303816000875af115801561244a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca39190615b4f565b609a5433906001600160a01b031681146124dc5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401611524565b6115c181613eaa565b603554610100900460ff16158080156125055750603554600160ff909116105b8061251f5750303b15801561251f575060355460ff166001145b6125825760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611524565b6035805460ff1916600117905580156125a5576035805461ff0019166101001790555b6125ad613ec3565b6125b5613eea565b80156115c1576035805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60405163f340fa0160e01b81523360048201527f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac6001600160a01b03169063f340fa019034906024016000604051808303818588803b15801561265f57600080fd5b505af1158015612673573d6000803e3d6000fd5b5050505050611ce584848484613390565b6000306126918380615540565b61269b9080615560565b6126a9906020810190614f76565b6001600160a01b0316036126cf576040516282b42960e81b815260040160405180910390fd5b620697808660a0013511156126f757604051635177028760e11b815260040160405180910390fd5b60006127038380615540565b61270d9080615560565b608001359050600061271f8480615540565b6127299080615560565b60e00135905060006040518061012001604052808a60000160208101906127509190614f76565b6001600160a01b03168152602001336001600160a01b031681526020018a60200160208101906127809190614f76565b6001600160a01b031681526020018481526020018781526020014281526020018a61010001358152602001600081526020018a60a001358152509050806040516020016127cd9190615c1a565b60408051601f1981840301815291815281516020928301206101638054600181019091556000818152610164909452919092209190915593506128138989898488613f19565b81861015612932576001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac16639555a94261285760208c018c614f76565b30896040518463ffffffff1660e01b815260040161287793929190615b2b565b600060405180830381600087803b15801561289157600080fd5b505af11580156128a5573d6000803e3d6000fd5b5050604051634aaad4a160e11b81526001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac169250639555a94291506128fb90339030908b880390600401615b2b565b600060405180830381600087803b15801561291557600080fd5b505af1158015612929573d6000803e3d6000fd5b50505050612a65565b6001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac16639555a94261296e60208c018c614f76565b30856040518463ffffffff1660e01b815260040161298e93929190615b2b565b600060405180830381600087803b1580156129a857600080fd5b505af11580156129bc573d6000803e3d6000fd5b50506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac1691506323b872dd90506129fe60208c018c614f76565b33858a036040518463ffffffff1660e01b8152600401612a2093929190615b2b565b6020604051808303816000875af1158015612a3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a639190615b4f565b505b604080516101a081018252308152600060208083018290526edab4a563819e8fd93dba3b25bc34958385015290926060830191612aa6918e01908e01614f76565b6001600160a01b031681526020810186905260016040820152600060608201526080810185905260a001612ada8880615540565b612ae49080615560565b612af4906101000135600161558d565b815260001960208201526040016000604051908082528060200260200182016040528015612b4857816020015b6040805180820190915260008082526020820152815260200190600190039081612b215790505b508152602001612b588880615540565b612b629080615560565b612b70906020810190614f76565b6001600160a01b03168152602001604051806040016040528060018152602001600160f81b815250815250905060006040518060e00160405280838152602001600060ff1681526020016000801b81526020016000801b8152602001888060200190612bdc91906155a0565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505050602082015260408981013591015290506dad05ccc4f10045630fb830b95127639a1fc3a785612c418a80615540565b846040518463ffffffff1660e01b8152600401612c5f929190615c8d565b6000604051808303818588803b158015612c7857600080fd5b505af1158015612c8c573d6000803e3d6000fd5b5050505050505050505095945050505050565b6000612caa826140d3565b92915050565b8282612cbc82826136a5565b612cd957604051636946eab760e01b815260040160405180910390fd5b84612ce381613bac565b612d00576040516311836dc560e01b815260040160405180910390fd5b604051637e8c1b2d60e01b815260e08701356004820152610100870135602482015260c08701356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90637e8c1b2d90606401602060405180830381865af4158015612d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d8f91906155e6565b905080851115612db2576040516347765d3b60e11b815260040160405180910390fd5b60405163036e164f60e31b81526080880135600482015260c0880135602482015260a08801356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af4158015612e1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e4091906155e6565b9050604051806101200160405280336001600160a01b03168152602001896020016020810190612e709190614f76565b6001600160a01b03168152602001612e8e60608b0160408c01614f76565b6001600160a01b031681526020018960600135815260200182815260200142815260200187815260200160008152602001896101000135815250604051602001612ed89190615c1a565b604051602081830303815290604052805190602001206101646000898152602001908152602001600020819055507f558a9295c62e9e1b12a21c8fe816f4816a2e0269a53157edbfa16017b11b9ac987896040016020810190612f3b9190614f76565b604080519283526001600160a01b039091166020830152339082015260608101839052608081018890526101008a013560a082015260c00160405180910390a16001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd33612fb860208c018c614f76565b846040518463ffffffff1660e01b8152600401612fd793929190615b2b565b6020604051808303816000875af1158015612ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301a9190615b4f565b505050505050505050565b60405163f340fa0160e01b81523360048201526000906001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac169063f340fa019034906024016000604051808303818588803b15801561308a57600080fd5b505af115801561309e573d6000803e3d6000fd5b50505050506130af85858585610df2565b95945050505050565b6000612caa826141d4565b81816130cf82826136a5565b6130ec57604051636946eab760e01b815260040160405180910390fd5b836130f6816136e7565b1561311457604051632e42ba1f60e01b815260040160405180910390fd5b60006131208686613712565b90506131326060870160408801614f76565b6001600160a01b03166342842e0e3061315160408a0160208b01614f76565b89606001356040518463ffffffff1660e01b815260040161317493929190615b2b565b600060405180830381600087803b15801561318e57600080fd5b505af11580156131a2573d6000803e3d6000fd5b50506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac1691506323b872dd9050336131e560208a018a614f76565b846040518463ffffffff1660e01b815260040161320493929190615b2b565b6020604051808303816000875af1158015613223573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132479190615b4f565b50505050505050565b600061325f868686868661392a565b90506132716040870160208801614f76565b6001600160a01b03166342842e0e3330856040518463ffffffff1660e01b81526004016132a093929190615b2b565b600060405180830381600087803b1580156132ba57600080fd5b505af11580156132ce573d6000803e3d6000fd5b50506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac1691506323b872dd90506133106020890189614f76565b33866040518463ffffffff1660e01b815260040161333093929190615b2b565b6020604051808303816000875af115801561334f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133739190615b4f565b5095945050505050565b600061338983836142e4565b9392505050565b8383602001356133a082826136a5565b6133bd57604051636946eab760e01b815260040160405180910390fd5b856133c7816136e7565b156133e557604051632e42ba1f60e01b815260040160405180910390fd5b6000806133f489898989613811565b909250905061340960608a0160408b01614f76565b6001600160a01b03166342842e0e30338c606001356040518463ffffffff1660e01b815260040161343c93929190615b2b565b600060405180830381600087803b15801561345657600080fd5b505af115801561346a573d6000803e3d6000fd5b50506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac1691506323b872dd9050336134ad60208d018d614f76565b846040518463ffffffff1660e01b81526004016134cc93929190615b2b565b6020604051808303816000875af11580156134eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061350f9190615b4f565b506001600160a01b037f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac166323b872dd3361355060408d0160208e01614f76565b8486036040518463ffffffff1660e01b815260040161242b93929190615b2b565b6115c13382613d95565b613583613e50565b609a80546001600160a01b0383166001600160a01b031990911681179091556135b46068546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6040805180820182526003808252620312e360ec1b6020808401829052845180860186526005815264109b195b9960da1b908201528451808601909552918452920191909152600061369f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7fc4b8616ae0489f3c1b902f3ab01ae0a19589748eb5da617af5a0e62f9d3b72bf7fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b3614340565b90509091565b6000826040516020016136b89190615cb2565b60408051601f198184030181529181528151602092830120600085815261016490935291205414905092915050565b600060e082013515801590612caa57504361370b61010084013560e085013561558d565b1092915050565b60405163036e164f60e31b81526080830135600482015260c0830135602482015260a08301356044820152600090735c06da8ec7945c05304d79895046d01a7943826d90631b70b27890606401602060405180830381865af415801561377c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a091906155e6565b60008381526101646020526040808220919091559091507f2469cc9e12e74c63438d5b1117b318cd3a4cdaf9d659d9eac6d975d14d9632549083906137eb9060608701908701614f76565b604080519283526001600160a01b0390911660208301520160405180910390a192915050565b6000806138216020860186614f76565b6001600160a01b031661383a6040880160208901614f76565b6001600160a01b031614613860576040516282b42960e81b815260040160405180910390fd5b61386b858585614389565b915061387b868660200135613712565b90508082101561389e5760405163166877a960e21b815260040160405180910390fd5b7f7ffb5bd9cdc79a6f9bc6e00c82f43836e0afbb204d47972001f6e853764a8ef160208601356138d46060890160408a01614f76565b336138e560408b0160208c01614f76565b604080519485526001600160a01b039384166020860152918316848301529091166060808401919091528901356080830152519081900360a00190a194509492505050565b6000620697808660a00135111561395457604051635177028760e11b815260040160405180910390fd5b6040805161012081019091526000908061397160208a018a614f76565b6001600160a01b03168152602001336001600160a01b031681526020018860200160208101906139a19190614f76565b6001600160a01b031681526020018481526020018581526020014281526020018861010001358152602001600081526020018860a001358152509050806040516020016139ee9190615c1a565b60408051601f1981840301815291815281516020928301206101638054600181019091556000818152610164909452919092209190915591506133738787878486613f19565b6115c1613e50565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613a7457613a6f83614433565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613ace575060408051601f3d908101601f19168201909252613acb918101906155e6565b60015b613b315760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611524565b600080516020615ea48339815191528114613ba05760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611524565b50613a6f8383836144cf565b600060e082013515801590612caa575043613bd061010084013560e085013561558d565b101592915050565b613be86040840160208501614f76565b6001600160a01b0316613c016060880160408901614f76565b6001600160a01b031614613c285760405163f8492b0160e01b815260040160405180910390fd5b60408051610120810190915260009080613c456020870187614f76565b6001600160a01b03168152602001886020016020810190613c669190614f76565b6001600160a01b03168152602001613c8460608a0160408b01614f76565b6001600160a01b03168152602001886060013581526020018681526020014281526020018561010001358152602001600081526020018560a00135815250905080604051602001613cd59190615c1a565b60408051601f1981840301815291815281516020928301206000898152610164909352912055613d08848484848a613f19565b7f558a9295c62e9e1b12a21c8fe816f4816a2e0269a53157edbfa16017b11b9ac986613d3a6040870160208801614f76565b613d476020880188614f76565b604080519384526001600160a01b03928316602085015291169082015260608101879052610100860135608082015260a0808701359082015260c0015b60405180910390a150505050505050565b6001600160a01b038216600081815260cc602090815260408083208584528252918290206001905590518381527f899cab278284ae4a91172caa0943607a0bcb19766254c3ebe1139be00650b102910160405180910390a25050565b6001600160a01b038116600081815260208190526040812080547fa82a649bbd060c9099cd7b7326e2b0dc9e9af0836480e0f849dc9eaa79710b3b9290613e3790615d47565b918290555060405190815260200160405180910390a250565b6068546001600160a01b031633146121f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611524565b609a80546001600160a01b03191690556115c1816144f4565b603554610100900460ff166121f15760405162461bcd60e51b815260040161152490615d60565b603554610100900460ff16613f115760405162461bcd60e51b815260040161152490615d60565b6121f1614546565b6000613f24866141d4565b9050613f5a81613f376020890189614f76565b613f496101408a016101208b01614f76565b88888b60e001358c60c00135614576565b620186a08661010001351115613f83576040516347765d3b60e11b815260040160405180910390fd5b856080013583608001511180613fa0575085606001358360800151105b15613fbe5760405163045f33d160e01b815260040160405180910390fd5b60008181526101656020526040908190205460808501519091613fe59083908a0135615b18565b10156140045760405163cfe9d93160e01b815260040160405180910390fd5b836080015181016101656000848152602001908152602001600020819055507f06a333c2d6fe967ca967f7a35be2eb45e8caeb6cf05e16f55d42b91b5fe3125582848960200160208101906140599190614f76565b8751602089015160808a015160c08b015160608c01516101008d0151604051613d849998979695949392919098895260208901979097526001600160a01b039586166040890152938516606088015291909316608086015260a085019290925260c084019190915260e08301526101008201526101200190565b60007f0788f777943101fd75ce00572555c09ccb9d6947462e151eb1c30a3abb7e4d536141036020840184614f76565b602084013560408501356060860135608087013561412760c0890160a08a01614f76565b61413c61413760c08b018b615dab565b6145e8565b60008061414c60208d018d614f76565b6001600160a01b03908116825260208083019390935260409182016000205482519384019b909b52988916908201526060810196909652608086019490945260a085019290925260c084015290921660e0820152610100810191909152610120810191909152610140015b604051602081830303815290604052805190602001209050919050565b60007f72610d1bcebb1278eadeb92d76dcd0fb5be6da0615264c9f7f800f6f93be5ea16142046020840184614f76565b6142146040850160208601614f76565b60408501356060860135608087013560a088013560c089013560e08a01356101008b013561424a6101408d016101208e01614f76565b6000808e60000160208101906142609190614f76565b6001600160a01b03908116825260208083019390935260409182016000205482519384019e909e529b8c1690820152988a1660608a0152608089019790975260a088019590955260c087019390935260e08601919091526101008501526101208401526101408301529091166101608201526101808101919091526101a0016141b7565b604080517f03fe346919ffc22a12814b7258c8a530a4932f55d4171092ca76977784a577d46020820152908101839052606081018290526000906080015b60405160208183030381529060405280519060200120905092915050565b6040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b60006143c5614397856140d3565b6143a46020870187614f76565b6143b460c0880160a08901614f76565b868689606001358a60800135614576565b600160cc60006143d86020880188614f76565b6001600160a01b03168152602080820192909252604090810160009081206080890135825290925281209190915561442161441660c0870187615dab565b3388604001356146b2565b60409095013594909403949350505050565b6001600160a01b0381163b6144a05760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611524565b600080516020615ea483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6144d883614803565b6000825111806144e55750805b15613a6f57611ce58383614843565b606880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b603554610100900460ff1661456d5760405162461bcd60e51b815260040161152490615d60565b6121f133613eaa565b614583878787878761492e565b428210156145a457604051639cb1308760e01b815260040160405180910390fd5b6001600160a01b038616600090815260cc60209081526040808320848452909152902054600103613247576040516305c934c360e01b815260040160405180910390fd5b600080826001600160401b0381111561460357614603615177565b60405190808252806020026020018201604052801561462c578160200160208202803683370190505b5090508260005b818110156146805761465b86868381811061465057614650615c04565b905060400201614a03565b83828151811061466d5761466d615c04565b6020908102919091010152600101614633565b50816040516020016146929190615df4565b604051602081830303815290604052805190602001209250505092915050565b600083815b818110156147d85760006127108888848181106146d6576146d6615c04565b6146ec9260206040909202019081019150615e2a565b6146fa9061ffff1687615e45565b6147049190615e5c565b90507f0000000000000000000000000000000000a39bb272e79075ade125fd351887ac6001600160a01b03166323b872dd878a8a8681811061474857614748615c04565b90506040020160200160208101906147609190614f76565b846040518463ffffffff1660e01b815260040161477f93929190615b2b565b6020604051808303816000875af115801561479e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147c29190615b4f565b506147cd818561558d565b9350506001016146b7565b50828211156147fa5760405163192069c360e31b815260040160405180910390fd5b50949350505050565b61480c81614433565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6148ab5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611524565b600080846001600160a01b0316846040516148c69190615e7e565b600060405180830381855af49150503d8060008114614901576040519150601f19603f3d011682016040523d82523d6000602084013e614906565b606091505b50915091506130af8282604051806060016040528060278152602001615ec460279139614a73565b600061493986614a8c565b905082356020840135604085013560f81c6149578885838686614b59565b6001600160a01b0387161561301a575050506001600160a01b038416600090815260016020526040812054604185013591606186013591608187013560f81c9160828801359190036149bc5760405163db8d1fb760e01b815260040160405180910390fd5b43600254826149cb919061558d565b10156149ea57604051630819bdcd60e01b815260040160405180910390fd5b6149f48a82614c3e565b9450611ca38886848787614b59565b60007f05b43f730f67de334a342883f867101fc7ef3361dfdff4a29a7aa97e0920ef7a614a336020840184615e2a565b614a436040850160208601614f76565b6040516020016141b79392919092835261ffff9190911660208301526001600160a01b0316604082015260600190565b60608315614a82575081613389565b6133898383614d16565b6040805180820182526005815264109b195b9960da1b602091820152815180830190925260038252620312e360ec1b910152600061190160f01b614b317f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7fc4b8616ae0489f3c1b902f3ab01ae0a19589748eb5da617af5a0e62f9d3b72bf7fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b3614340565b6040516001600160f01b031990921660208301526022820152604281018390526062016141b7565b8260ff16601b14158015614b7157508260ff16601c14155b15614b8f57604051630424f48960e41b815260040160405180910390fd5b6040805160008082526020820180845287905260ff861692820192909252606081018490526080810183905260019060a0016020604051602081039080840390855afa158015614be3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580614c185750806001600160a01b0316866001600160a01b031614155b15614c3657604051638baa579f60e01b815260040160405180910390fd5b505050505050565b6040805180820182526005815264109b195b9960da1b602091820152815180830190925260038252620312e360ec1b910152600061190160f01b614ce37f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7fc4b8616ae0489f3c1b902f3ab01ae0a19589748eb5da617af5a0e62f9d3b72bf7fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b3614340565b614ced85856142e4565b6040516001600160f01b0319909316602084015260228301919091526042820152606201614322565b815115614d265781518083602001fd5b8060405162461bcd60e51b81526004016115249190615e90565b6001600160a01b03811681146115c157600080fd5b8035614d6081614d40565b919050565b60008060408385031215614d7857600080fd5b8235614d8381614d40565b946020939093013593505050565b60006101208284031215614da457600080fd5b50919050565b600060608284031215614da457600080fd5b60008060006101608486031215614dd257600080fd5b614ddc8585614d91565b925061012084013591506101408401356001600160401b03811115614e0057600080fd5b614e0c86828701614daa565b9150509250925092565b600060208284031215614e2857600080fd5b5035919050565b60008083601f840112614e4157600080fd5b5081356001600160401b03811115614e5857600080fd5b602083019150836020828501011115614e7057600080fd5b9250929050565b600080600080600060808688031215614e8f57600080fd5b8535614e9a81614d40565b94506020860135614eaa81614d40565b93506040860135925060608601356001600160401b03811115614ecc57600080fd5b614ed888828901614e2f565b969995985093965092949392505050565b6000806000806101808587031215614f0057600080fd5b614f0a8686614d91565b93506101208501356001600160401b0380821115614f2757600080fd5b9086019060408289031215614f3b57600080fd5b9093506101408601359080821115614f5257600080fd5b508501610160818803811315614f6757600080fd5b94979396509490930135925050565b600060208284031215614f8857600080fd5b813561338981614d40565b60006101408284031215614da457600080fd5b60008060008060006101a08688031215614fbf57600080fd5b614fc98787614f93565b94506101408601356001600160401b0380821115614fe657600080fd5b614ff289838a01614e2f565b9096509450610160880135935061018088013591508082111561501457600080fd5b5061502188828901614daa565b9150509295509295909350565b60008060008060006102a0868803121561504757600080fd5b6150518787614d91565b94506101208601359350615069876101408801614f93565b92506102808601356001600160401b03811115614ecc57600080fd5b6000806000806000806102c0878903121561509f57600080fd5b6150a98888614d91565b9550610120870135945061014087013593506150c9886101608901614f93565b92506102a08701356001600160401b038111156150e557600080fd5b6150f189828a01614e2f565b979a9699509497509295939492505050565b6000806020838503121561511657600080fd5b82356001600160401b038082111561512d57600080fd5b818501915085601f83011261514157600080fd5b81358181111561515057600080fd5b8660208260051b850101111561516557600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156151a057600080fd5b82356151ab81614d40565b915060208301356001600160401b03808211156151c757600080fd5b818501915085601f8301126151db57600080fd5b8135818111156151ed576151ed615177565b604051601f8201601f19908116603f0116810190838211818310171561521557615215615177565b8160405282815288602084870101111561522e57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000806020838503121561526357600080fd5b82356001600160401b038082111561527a57600080fd5b818501915085601f83011261528e57600080fd5b81358181111561529d57600080fd5b8660206101408302850101111561516557600080fd5b60008061014083850312156152c757600080fd5b6152d18484614d91565b94610120939093013593505050565b80151581146115c157600080fd5b6000806040838503121561530157600080fd5b823561530c81614d40565b9150602083013561531c816152e0565b809150509250929050565b600060e08284031215614da457600080fd5b600080600080610160858703121561535057600080fd5b61535a8686614d91565b93506101208501356001600160401b038082111561537757600080fd5b61538388838901615327565b945061014087013591508082111561539a57600080fd5b506153a787828801614e2f565b95989497509550505050565b6000602082840312156153c557600080fd5b81356001600160401b038111156153db57600080fd5b6153e784828501615327565b949350505050565b6000806000610160848603121561540557600080fd5b61540f8585614d91565b956101208501359550610140909401359392505050565b6000610140828403121561543957600080fd5b6133898383614f93565b60008060008060006101a0868803121561545c57600080fd5b6154668787614f93565b94506101408601356001600160401b0381111561548257600080fd5b61548e88828901614e2f565b96999098509596610160810135966101809091013595509350505050565b600080604083850312156154bf57600080fd5b50508035926020909101359150565b60005b838110156154e95781810151838201526020016154d1565b50506000910152565b6000815180845261550a8160208601602086016154ce565b601f01601f19169290920160200192915050565b60408152600061553160408301856154f2565b90508260208301529392505050565b6000823560de1983360301811261555657600080fd5b9190910192915050565b6000823561019e1983360301811261555657600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115612caa57612caa615577565b6000808335601e198436030181126155b757600080fd5b8301803591506001600160401b038211156155d157600080fd5b602001915036819003821315614e7057600080fd5b6000602082840312156155f857600080fd5b5051919050565b6002811061561d57634e487b7160e01b600052602160045260246000fd5b9052565b600081518084526020808501945080840160005b83811015615669578151805161ffff1688528301516001600160a01b03168388015260409096019590820190600101615635565b509495945050505050565b6000815160e0845261569260e0850182516001600160a01b03169052565b60208101516101006156a6818701836155ff565b604083015191506101206156c4818801846001600160a01b03169052565b606084015192506101406156e2818901856001600160a01b03169052565b6080850151935061016084818a015260a0860151945061018085818b015260c087015195506101a061571e818c01886001600160a01b03169052565b60e08801516101c08c0152858801516101e08c0152848801516102008c0152838801519650806102208c0152506157596102808b0187615621565b918701516102408b01529095015188860360df19016102608a015294935061578792508391508490506154f2565b915050602083015161579e602086018260ff169052565b506040830151604085015260608301516060850152608083015184820360808601526157ca82826154f2565b91505060a08301516157df60a08601826155ff565b5060c083015160c08501528091505092915050565b803560028110614d6057600080fd5b6000808335601e1984360301811261581a57600080fd5b83016020810192503590506001600160401b0381111561583957600080fd5b8060061b3603821315614e7057600080fd5b803561ffff81168114614d6057600080fd5b8183526000602080850194508260005b858110156156695761ffff6158818361584b565b1687528282013561589181614d40565b6001600160a01b031687840152604096870196919091019060010161586d565b6000808335601e198436030181126158c857600080fd5b83016020810192503590506001600160401b038111156158e757600080fd5b803603821315614e7057600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60006101a061593e8461593185614d55565b6001600160a01b03169052565b61594a602084016157f4565b61595760208601826155ff565b5061596460408401614d55565b6001600160a01b0316604085015261597e60608401614d55565b6001600160a01b0381166060860152506080830135608085015260a083013560a08501526159ae60c08401614d55565b6001600160a01b031660c085015260e08381013590850152610100808401359085015261012080840135908501526101406159eb81850185615803565b83838801526159fd848801828461585d565b9350505050610160808401358186015250610180615a1d818501856158b1565b86840383880152615a2f8482846158f6565b979650505050505050565b803560ff81168114614d6057600080fd5b6000813561019e19833603018112615a6257600080fd5b60e08452615a7560e0850184830161591f565b9050615a8360208401615a3a565b60ff81166020860152506040830135604085015260608301356060850152615aae60808401846158b1565b8583036080870152615ac18382846158f6565b92505050615ad160a084016157f4565b615ade60a08601826155ff565b5060c083013560c08501528091505092915050565b604081526000615b066040830185615674565b82810360208401526130af8185615a4b565b81810381811115612caa57612caa615577565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215615b6157600080fd5b8151613389816152e0565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b81516001600160a01b0390811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525092915050565b604081526000615ca06040830185615a4b565b82810360208401526130af8185615674565b61012081018235615cc281614d40565b6001600160a01b03168252615cd960208401614d55565b6001600160a01b03166020830152615cf360408401614d55565b6001600160a01b038116604084015250606083013560608301526080830135608083015260a083013560a083015260c083013560c083015260e083013560e083015261010080840135818401525092915050565b600060018201615d5957615d59615577565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000808335601e19843603018112615dc257600080fd5b8301803591506001600160401b03821115615ddc57600080fd5b6020019150600681901b3603821315614e7057600080fd5b815160009082906020808601845b83811015615e1e57815185529382019390820190600101615e02565b50929695505050505050565b600060208284031215615e3c57600080fd5b6133898261584b565b8082028115828204841417612caa57612caa615577565b600082615e7957634e487b7160e01b600052601260045260246000fd5b500490565b600082516155568184602087016154ce565b60208152600061338960208301846154f256fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000811000a

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

0000000000000000000000000000000000a39bb272e79075ade125fd351887ac

-----Decoded View---------------
Arg [0] : _pool (address): 0x0000000000A39bb272e79075ade125fd351887Ac

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000a39bb272e79075ade125fd351887ac


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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