CELO Price: $1.26 (-2.55%)
Gas: 5 GWei

Contract

0x9627385D21387e15c3F306eFc4247C0123f75Dd5

Overview

CELO Balance

Celo Chain LogoCelo Chain LogoCelo Chain Logo0 CELO

CELO Value

$0.00

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Value
0x60a06040147230682022-08-23 19:33:24583 days ago1661283204IN
 Create: BorrowModule
0 CELO0.002141530.5

Parent Txn Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BorrowModule

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 16 : BorrowModule.sol
// SPDX-License-Identifier: bsl-1.1
/**
 * Copyright 2022 Unit Protocol V2: Artem Zakharov ([email protected]).
 */
pragma solidity ^0.8.0;
pragma abicoder v2;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";

import "./Auth.sol";
import "./Parameters.sol";
import "./Assets.sol";


contract BorrowModule is IVersioned, Auth, ReentrancyGuard {
    using Parameters for IParametersStorage;
    using Assets for address;
    using EnumerableSet for EnumerableSet.UintSet;

    string public constant VERSION = '0.1.0';

    enum LoanState { WasNotCreated, AuctionStarted, AuctionCancelled, Issued, Finished, Liquidated }

    struct AuctionInfo {
        address borrower;
        uint32 startTS;
        uint16 interestRateMin;
        uint16 interestRateMax;
    }

    struct Loan {
        // slot 256 bits (Nested struct takes up the whole slot. We have to do this since error "Stack too deep..")
        AuctionInfo auctionInfo;

        // slot 240 bits
        LoanState state;
        uint16 durationDays;
        uint32 startTS;
        uint16 interestRate;
        address collateral;
        Assets.AssetType collateralType;

        // slot 256 bits
        uint collateralIdOrAmount;

        // slot 160 bits
        address lender;

        // slot 160 bits
        address debtCurrency;

        // slot 256 bits
        uint debtAmount;
    }

    struct AuctionStartParams {
        uint16 durationDays;

        uint16 interestRateMin;
        uint16 interestRateMax;

        address collateral;
        Assets.AssetType collateralType;
        uint collateralIdOrAmount;

        address debtCurrency;
        uint debtAmount;
    }

    event AuctionStarted(uint indexed loanId, address indexed borrower);
    event AuctionInterestRateMaxUpdated(uint indexed loanId, address indexed borrower, uint16 newInterestRateMax);
    event AuctionCancelled(uint indexed loanId, address indexed borrower);

    event LoanIssued(uint indexed loanId, address indexed lender);
    event LoanRepaid(uint indexed loanId, address indexed borrower);
    event LoanLiquidated(uint indexed loanId, address indexed liquidator);

    uint public constant BASIS_POINTS_IN_1 = 1e4;
    uint public constant MAX_DURATION_DAYS = 365 * 2;

    Loan[] public loans;
    mapping(address => uint[]) public loanIdsByUser;
    EnumerableSet.UintSet private activeAuctions;
    EnumerableSet.UintSet private activeLoans;

    constructor(address _parametersStorage) Auth(_parametersStorage) {}

    function startAuction(AuctionStartParams memory _params) external nonReentrant returns (uint _loanId) {
        require(0 < _params.durationDays &&_params.durationDays <= MAX_DURATION_DAYS, 'UP borrow module: INVALID_LOAN_DURATION');
        require(0 < _params.interestRateMin && _params.interestRateMin <= _params.interestRateMax, 'UP borrow module: INVALID_INTEREST_RATE');
        require(_params.collateral != address(0), 'UP borrow module: INVALID_COLLATERAL');
        require(_params.collateralType != Assets.AssetType.Unknown, 'UP borrow module: INVALID_COLLATERAL_TYPE');
        require(_params.collateralType == Assets.AssetType.ERC721 || _params.collateralIdOrAmount > 0, 'UP borrow module: INVALID_COLLATERAL_AMOUNT');
        require(_params.debtCurrency != address(0) && _params.debtAmount > 0, 'UP borrow module: INVALID_DEBT_CURRENCY');
        _calcTotalDebt(_params.debtAmount, _params.interestRateMax, _params.durationDays); // just check that there is no overflow on total debt

        _loanId = loans.length;
        loans.push(
            Loan(
                AuctionInfo(
                    msg.sender,
                    uint32(block.timestamp),
                    _params.interestRateMin,
                    _params.interestRateMax
                ),

                LoanState.AuctionStarted,
                _params.durationDays,
                0, // startTS
                0, // interestRate
                _params.collateral,
                _params.collateralType,

                _params.collateralIdOrAmount,

                address(0),

                _params.debtCurrency,

                _params.debtAmount
            )
        );

        loanIdsByUser[msg.sender].push(_loanId);
        require(activeAuctions.add(_loanId), 'UP borrow module: BROKEN_STRUCTURE');

        _params.collateral.getFrom(_params.collateralType, msg.sender, address(this), _params.collateralIdOrAmount);

        emit AuctionStarted(_loanId, msg.sender);
    }

    function updateAuctionInterestRateMax(uint _loanId, uint16 _newInterestRateMax) external nonReentrant {
        Loan storage loan = requireLoan(_loanId);
        require(loan.auctionInfo.borrower == msg.sender, 'UP borrow module: AUTH_FAILED');
        require(loan.state == LoanState.AuctionStarted, 'UP borrow module: INVALID_LOAN_STATE');
        require(loan.auctionInfo.startTS + parameters.getAuctionDuration() <= block.timestamp, 'UP borrow module: TOO_EARLY_UPDATE');
        require(_newInterestRateMax > loan.auctionInfo.interestRateMax, 'UP borrow module: NEW_RATE_TOO_SMALL');

        loan.auctionInfo.interestRateMax = _newInterestRateMax;

        emit AuctionInterestRateMaxUpdated(_loanId, msg.sender, _newInterestRateMax);
    }

    function cancelAuction(uint _loanId) external nonReentrant {
        Loan storage loan = requireLoan(_loanId);
        require(loan.auctionInfo.borrower == msg.sender, 'UP borrow module: AUTH_FAILED');

        changeLoanState(loan, LoanState.AuctionCancelled);
        require(activeAuctions.remove(_loanId), 'UP borrow module: BROKEN_STRUCTURE');

        loan.collateral.sendTo(loan.collateralType, loan.auctionInfo.borrower, loan.collateralIdOrAmount);

        emit AuctionCancelled(_loanId, msg.sender);
    }

    /**
     * @dev acceptance after auction ended is allowed
     */
    function accept(uint _loanId) external nonReentrant {
        Loan storage loan = requireLoan(_loanId);

        require(loan.auctionInfo.borrower != msg.sender, 'UP borrow module: OWN_AUCTION');

        changeLoanState(loan, LoanState.Issued);
        require(activeAuctions.remove(_loanId), 'UP borrow module: BROKEN_STRUCTURE');
        require(activeLoans.add(_loanId), 'UP borrow module: BROKEN_STRUCTURE');

        loan.startTS = uint32(block.timestamp);
        loan.lender = msg.sender;
        loan.interestRate =  _calcCurrentInterestRate(loan.auctionInfo.startTS, loan.auctionInfo.interestRateMin, loan.auctionInfo.interestRateMax);

        loanIdsByUser[msg.sender].push(_loanId);

        (uint feeAmount, uint operatorFeeAmount, uint amountWithoutFee) = _calcFeeAmount(loan.debtCurrency, loan.debtAmount);

        loan.debtCurrency.getFrom(Assets.AssetType.ERC20, msg.sender, address(this), loan.debtAmount);
        if (feeAmount > 0) {
            loan.debtCurrency.sendTo(Assets.AssetType.ERC20, parameters.treasury(), feeAmount);
        }
        if (operatorFeeAmount > 0) {
            loan.debtCurrency.sendTo(Assets.AssetType.ERC20, parameters.operatorTreasury(), operatorFeeAmount);
        }
        loan.debtCurrency.sendTo(Assets.AssetType.ERC20, loan.auctionInfo.borrower, amountWithoutFee);

        emit LoanIssued(_loanId, msg.sender);
    }

    /**
     * @notice Repay loan debt. In any time debt + full interest rate for loan period must be repaid.
     * MUST be repaid before loan period end to avoid liquidations. MAY be repaid after loan period end, but before liquidation.
     */
    function repay(uint _loanId) external nonReentrant {
        Loan storage loan = requireLoan(_loanId);
        require(loan.auctionInfo.borrower == msg.sender, 'UP borrow module: AUTH_FAILED');

        changeLoanState(loan, LoanState.Finished);
        require(activeLoans.remove(_loanId), 'UP borrow module: BROKEN_STRUCTURE');

        uint totalDebt = _calcTotalDebt(loan.debtAmount, loan.interestRate, loan.durationDays);
        loan.debtCurrency.getFrom(Assets.AssetType.ERC20, msg.sender, loan.lender, totalDebt);
        loan.collateral.sendTo(loan.collateralType, loan.auctionInfo.borrower, loan.collateralIdOrAmount);

        emit LoanRepaid(_loanId, msg.sender);
    }

    function liquidate(uint _loanId) external nonReentrant {
        Loan storage loan = requireLoan(_loanId);

        changeLoanState(loan, LoanState.Liquidated);
        require(uint(loan.startTS) + uint(loan.durationDays) * 1 days < block.timestamp, 'UP borrow module: LOAN_IS_ACTIVE');
        require(activeLoans.remove(_loanId), 'UP borrow module: BROKEN_STRUCTURE');

        loan.collateral.sendTo(loan.collateralType, loan.lender, loan.collateralIdOrAmount);

        emit LoanLiquidated(_loanId, msg.sender);
    }

    function requireLoan(uint _loanId) internal view returns (Loan storage _loan) {
        require(_loanId < loans.length, 'UP borrow module: INVALID_LOAN_ID');
        _loan = loans[_loanId];
    }

    function changeLoanState(Loan storage _loan, LoanState _newState) internal {
        LoanState currentState = _loan.state;
        if (currentState == LoanState.AuctionStarted) {
            require(_newState == LoanState.AuctionCancelled || _newState == LoanState.Issued, 'UP borrow module: INVALID_LOAN_STATE');
        } else if (currentState == LoanState.Issued) {
            require(_newState == LoanState.Finished || _newState == LoanState.Liquidated, 'UP borrow module: INVALID_LOAN_STATE');
        } else if (currentState == LoanState.AuctionCancelled || currentState == LoanState.Finished || currentState == LoanState.Liquidated) {
            revert('UP borrow module: INVALID_LOAN_STATE');
        } else {
            revert('UP borrow module: BROKEN_LOGIC'); // just to be sure that all states are covered
        }

        _loan.state = _newState;
    }

    //////

    function getLoansCount() external view returns (uint) {
        return loans.length;
    }

    /**
     * @dev may not work on huge amount of loans, in this case use version with limits
     */
    function getLoans() external view returns(Loan[] memory) {
        return loans;
    }

    /**
     * @dev returns empty array with offset >= count
     */
    function getLoansLimited(uint _offset, uint _limit) external view returns(Loan[] memory _loans) {
        uint loansCount = loans.length;
        if (_offset > loansCount) {
            return new Loan[](0);
        }

        uint resultCount = Math.min(loansCount - _offset, _limit);
        _loans = new Loan[](resultCount);
        for (uint i = 0; i < resultCount; i++) {
            _loans[i] = loans[_offset + i];
        }
    }

    //////

    function getActiveAuctionsCount() public view returns (uint) {
        return activeAuctions.length();
    }

    /**
     * @dev may not work on huge amount of loans, in this case use version with limits
     */
    function getActiveAuctions() public view returns (uint[] memory _ids, Loan[] memory _loans) {
        return _getLoansWithIds(activeAuctions);
    }

    /**
     * @dev returns empty arrays with offset >= count
     */
    function getActiveAuctionsLimited(uint _offset, uint _limit) public view returns (uint[] memory _ids, Loan[] memory _loans) {
        return _getLoansWithIdsLimited(activeAuctions, _offset, _limit);
    }

    //////

    function getActiveLoansCount() public view returns (uint) {
        return activeLoans.length();
    }

    /**
     * @dev may not work on huge amount of loans, in this case use version with limits
     */
    function getActiveLoans() public view returns (uint[] memory _ids, Loan[] memory _loans) {
        return _getLoansWithIds(activeLoans);
    }

    /**
     * @dev returns empty arrays with offset >= count
     */
    function getActiveLoansLimited(uint _offset, uint _limit) public view returns (uint[] memory _ids, Loan[] memory _loans) {
        return _getLoansWithIdsLimited(activeLoans, _offset, _limit);
    }

    //////

    function getUserLoansCount(address _user) public view returns (uint) {
        return loanIdsByUser[_user].length;
    }

    /**
     * @dev may not work on huge amount of loans, in this case use version with limits
     */
    function getUserLoans(address _user) external view returns(uint[] memory _ids, Loan[] memory _loans) {
        _ids = loanIdsByUser[_user];
        _loans = new Loan[](_ids.length);
        for (uint i=0; i<_ids.length; i++) {
            _loans[i] = loans[ _ids[i] ];
        }
    }

    /**
     * @dev returns empty arrays with offset >= count
     */
    function getUserLoansLimited(address _user, uint _offset, uint _limit) public view returns (uint[] memory _ids, Loan[] memory _loans) {
        uint loansCount = loanIdsByUser[_user].length;
        if (_offset > loansCount) {
            return (new uint[](0), new Loan[](0));
        }

        uint resultCount = Math.min(loansCount - _offset, _limit);
        _ids = new uint[](resultCount);
        _loans = new Loan[](resultCount);
        for (uint i = 0; i < resultCount; i++) {
            _ids[i] = loanIdsByUser[_user][_offset + i];
            _loans[i] = loans[ _ids[i] ];
        }
    }


    //////

    function _calcFeeAmount(address _asset, uint _amount) internal view returns (uint _feeAmount, uint _operatorFeeAmount, uint _amountWithoutFee) {
        uint feeBasisPoints = parameters.getAssetFee(_asset);
        uint _totalFeeAmount = _amount * feeBasisPoints / BASIS_POINTS_IN_1;

        _operatorFeeAmount = _totalFeeAmount * parameters.operatorFeePercent() / 100;
        _feeAmount = _totalFeeAmount - _operatorFeeAmount;

        _amountWithoutFee = _amount - _totalFeeAmount;

        require(_amount == _feeAmount + _operatorFeeAmount + _amountWithoutFee, 'UP borrow module: BROKEN_FEE_LOGIC'); // assert
    }

    function _calcTotalDebt(uint debtAmount, uint interestRateBasisPoints, uint durationDays) internal pure returns (uint) {
        return debtAmount + debtAmount * interestRateBasisPoints * durationDays / BASIS_POINTS_IN_1 / 365;
    }

    function _calcCurrentInterestRate(uint auctionStartTS, uint16 interestRateMin, uint16 interestRateMax) internal view returns (uint16) {
        require(auctionStartTS < block.timestamp, 'UP borrow module: TOO_EARLY');
        require(0 < interestRateMin && interestRateMin <= interestRateMax, 'UP borrow module: INVALID_INTEREST_RATES'); // assert

        uint auctionEndTs = auctionStartTS + parameters.getAuctionDuration();
        uint onTime = Math.min(block.timestamp, auctionEndTs);

        return interestRateMin + uint16((interestRateMax - interestRateMin) * (onTime - auctionStartTS) / (auctionEndTs - auctionStartTS));
    }

    //////

    function _getLoansWithIds(EnumerableSet.UintSet storage _loansSet) internal view returns (uint[] memory _ids, Loan[] memory _loans) {
        _ids = _loansSet.values();
        _loans = new Loan[](_ids.length);
        for (uint i=0; i<_ids.length; i++) {
            _loans[i] = loans[ _ids[i] ];
        }
    }

    function _getLoansWithIdsLimited(EnumerableSet.UintSet storage _loansSet, uint _offset, uint _limit) internal view returns (uint[] memory _ids, Loan[] memory _loans) {
        uint loansCount = _loansSet.length();
        if (_offset > loansCount) {
            return (new uint[](0), new Loan[](0));
        }

        uint resultCount = Math.min(loansCount - _offset, _limit);
        _ids = new uint[](resultCount);
        _loans = new Loan[](resultCount);
        for (uint i = 0; i < resultCount; i++) {
            _ids[i] = _loansSet.at(_offset + i);
            _loans[i] = loans[ _ids[i] ];
        }
    }

    //////

    function onERC721Received(
        address operator,
        address /* from */,
        uint256 /* tokenId */,
        bytes calldata /* data */
    ) external view returns (bytes4) {
        require(operator == address(this), "UP borrow module: TRANSFER_NOT_ALLOWED");

        return IERC721Receiver.onERC721Received.selector;
    }
}

File 2 of 16 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 4 of 16 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 5 of 16 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 6 of 16 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

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

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

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

File 7 of 16 : Auth.sol
// SPDX-License-Identifier: bsl-1.1
/**
 * Copyright 2022 Unit Protocol V2: Artem Zakharov ([email protected]).
 */
pragma solidity ^0.8.0;

import "./interfaces/IParametersStorage.sol";


contract Auth {

    // address of the the contract with parameters
    IParametersStorage public immutable parameters;

    constructor(address _parameters) {
        require(_parameters != address(0), "UP borrow module: ZERO_ADDRESS");

        parameters = IParametersStorage(_parameters);
    }

    // ensures tx's sender is a manager
    modifier onlyManager() {
        require(parameters.isManager(msg.sender), "UP borrow module: AUTH_FAILED");
        _;
    }
}

File 8 of 16 : Parameters.sol
// SPDX-License-Identifier: bsl-1.1
/**
 * Copyright 2022 Unit Protocol V2: Artem Zakharov ([email protected]).
 */
pragma solidity ^0.8.0;

import "./interfaces/IParametersStorage.sol";


/**
 * @dev After new parameter is introduced new lib Parameters(n+1) inherited from Parameters(n) must be created
 * @dev Then use Parameters(n+1) for IParametersStorage
 */
library Parameters {

    /// @dev auction duration in seconds
    uint public constant PARAM_AUCTION_DURATION = 0;

    function getAuctionDuration(IParametersStorage _storage) internal view returns (uint _auctionDurationSeconds) {
        _auctionDurationSeconds = uint(_storage.customParams(PARAM_AUCTION_DURATION));
        require(_auctionDurationSeconds > 0);
    }
}

File 9 of 16 : Assets.sol
// SPDX-License-Identifier: bsl-1.1
/**
 * Copyright 2022 Unit Protocol V2: Artem Zakharov ([email protected]).
 */
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";


library Assets {
    using SafeERC20 for IERC20;
    using ERC165Checker for address;

    enum AssetType {Unknown, ERC20, ERC721}

    function getFrom(address _assetAddr, AssetType _assetType, address _from, address _to, uint _idOrAmount) internal {
        if (_assetType == AssetType.ERC20) {
            require(!_assetAddr.supportsInterface(type(IERC721).interfaceId), "UP borrow module: WRONG_ASSET_TYPE");
            IERC20(_assetAddr).safeTransferFrom(_from, _to, _idOrAmount);
        } else if (_assetType == AssetType.ERC721) {
            require(_assetAddr.supportsInterface(type(IERC721).interfaceId), "UP borrow module: WRONG_ASSET_TYPE");
            IERC721(_assetAddr).safeTransferFrom(_from, _to, _idOrAmount);
        } else {
            revert("UP borrow module: UNSUPPORTED_ASSET_TYPE");
        }
    }

    function sendTo(address _assetAddr, AssetType _assetType, address _to, uint _idOrAmount) internal {
        if (_assetType == AssetType.ERC20) {
            require(!_assetAddr.supportsInterface(type(IERC721).interfaceId), "UP borrow module: WRONG_ASSET_TYPE");
            IERC20(_assetAddr).safeTransfer(_to, _idOrAmount);
        } else if (_assetType == AssetType.ERC721) {
            require(_assetAddr.supportsInterface(type(IERC721).interfaceId), "UP borrow module: WRONG_ASSET_TYPE");
            IERC721(_assetAddr).safeTransferFrom(address(this), _to, _idOrAmount);
        } else {
            revert("UP borrow module: UNSUPPORTED_ASSET_TYPE");
        }
    }
}

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

pragma solidity ^0.8.0;

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

File 11 of 16 : IParametersStorage.sol
// SPDX-License-Identifier: bsl-1.1
/**
 * Copyright 2022 Unit Protocol V2: Artem Zakharov ([email protected]).
 */
pragma solidity ^0.8.0;
pragma abicoder v2;

import "./IVersioned.sol";


interface IParametersStorage is IVersioned {

    struct CustomFee {
        bool enabled; // is custom fee for asset enabled
        uint16 feeBasisPoints; // fee basis points, 1 basis point = 0.0001
    }

    event ManagerAdded(address manager);
    event ManagerRemoved(address manager);
    event TreasuryChanged(address newTreasury);
    event OperatorTreasuryChanged(address newOperatorTreasury);
    event BaseFeeChanged(uint newFeeBasisPoints);
    event AssetCustomFeeEnabled(address indexed _asset, uint16 _feeBasisPoints);
    event AssetCustomFeeDisabled(address indexed _asset);
    event OperatorFeeChanged(uint newOperatorFeePercent);
    event CustomParamChanged(uint indexed param, bytes32 value);
    event AssetCustomParamChanged(address indexed asset, uint indexed param, bytes32 value);

    function isManager(address) external view returns (bool);

    function treasury() external view returns (address);
    function operatorTreasury() external view returns (address);

    function baseFeeBasisPoints() external view returns (uint);
    function assetCustomFee(address) external view returns (bool _enabled, uint16 _feeBasisPoints);
    function operatorFeePercent() external view returns (uint);

    function getAssetFee(address _asset) external view returns (uint _feeBasisPoints);

    function customParams(uint _param) external view returns (bytes32);
    function assetCustomParams(address _asset, uint _param) external view returns (bytes32);

    function setManager(address _who, bool _permit) external;
    function setTreasury(address _treasury) external;
    function setOperatorTreasury(address _operatorTreasury) external;

    function setBaseFee(uint _feeBasisPoints) external;
    function setAssetCustomFee(address _asset, bool _enabled, uint16 _feeBasisPoints) external;
    function setOperatorFee(uint _feeBasisPoints) external;

    function setCustomParam(uint _param, bytes32 _value) external;
    function setCustomParamAsUint(uint _param, uint _value) external;
    function setCustomParamAsAddress(uint _param, address _value) external;

    function setAssetCustomParam(address _asset, uint _param, bytes32 _value) external;
    function setAssetCustomParamAsUint(address _asset, uint _param, uint _value) external;
    function setAssetCustomParamAsAddress(address _asset, uint _param, address _value) external;
}

File 12 of 16 : IVersioned.sol
// SPDX-License-Identifier: bsl-1.1
/**
 * Copyright 2022 Unit Protocol V2: Artem Zakharov ([email protected]).
 */
pragma solidity ^0.8.0;

/// @title Contract supporting versioning using SemVer version scheme.
interface IVersioned {
    /// @notice Contract version, using SemVer version scheme.
    function VERSION() external view returns (string memory);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 14 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

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

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

File 15 of 16 : ERC165Checker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface,
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            _supportsERC165Interface(account, type(IERC165).interfaceId) &&
            !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in _interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!_supportsERC165Interface(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     * Interface identification is specified in ERC-165.
     */
    function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);
        (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);
        if (result.length < 32) return false;
        return success && abi.decode(result, (bool));
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_parametersStorage","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"loanId","type":"uint256"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"loanId","type":"uint256"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint16","name":"newInterestRateMax","type":"uint16"}],"name":"AuctionInterestRateMaxUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"loanId","type":"uint256"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"}],"name":"AuctionStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"loanId","type":"uint256"},{"indexed":true,"internalType":"address","name":"lender","type":"address"}],"name":"LoanIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"loanId","type":"uint256"},{"indexed":true,"internalType":"address","name":"liquidator","type":"address"}],"name":"LoanLiquidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"loanId","type":"uint256"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"}],"name":"LoanRepaid","type":"event"},{"inputs":[],"name":"BASIS_POINTS_IN_1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DURATION_DAYS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_loanId","type":"uint256"}],"name":"accept","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_loanId","type":"uint256"}],"name":"cancelAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getActiveAuctions","outputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.Loan[]","name":"_loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveAuctionsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"getActiveAuctionsLimited","outputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.Loan[]","name":"_loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveLoans","outputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.Loan[]","name":"_loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveLoansCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"getActiveLoansLimited","outputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.Loan[]","name":"_loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLoans","outputs":[{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.Loan[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLoansCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"getLoansLimited","outputs":[{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.Loan[]","name":"_loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserLoans","outputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.Loan[]","name":"_loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserLoansCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"getUserLoansLimited","outputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.Loan[]","name":"_loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_loanId","type":"uint256"}],"name":"liquidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"loanIdsByUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"loans","outputs":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"}],"internalType":"struct BorrowModule.AuctionInfo","name":"auctionInfo","type":"tuple"},{"internalType":"enum BorrowModule.LoanState","name":"state","type":"uint8"},{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint32","name":"startTS","type":"uint32"},{"internalType":"uint16","name":"interestRate","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameters","outputs":[{"internalType":"contract IParametersStorage","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_loanId","type":"uint256"}],"name":"repay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"durationDays","type":"uint16"},{"internalType":"uint16","name":"interestRateMin","type":"uint16"},{"internalType":"uint16","name":"interestRateMax","type":"uint16"},{"internalType":"address","name":"collateral","type":"address"},{"internalType":"enum Assets.AssetType","name":"collateralType","type":"uint8"},{"internalType":"uint256","name":"collateralIdOrAmount","type":"uint256"},{"internalType":"address","name":"debtCurrency","type":"address"},{"internalType":"uint256","name":"debtAmount","type":"uint256"}],"internalType":"struct BorrowModule.AuctionStartParams","name":"_params","type":"tuple"}],"name":"startAuction","outputs":[{"internalType":"uint256","name":"_loanId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_loanId","type":"uint256"},{"internalType":"uint16","name":"_newInterestRateMax","type":"uint16"}],"name":"updateAuctionInterestRateMax","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Contract Creation Code

60a06040523480156200001157600080fd5b5060405162004dcc38038062004dcc8339810160408190526200003491620000a8565b806001600160a01b038116620000905760405162461bcd60e51b815260206004820152601e60248201527f555020626f72726f77206d6f64756c653a205a45524f5f414444524553530000604482015260640160405180910390fd5b6001600160a01b0316608052506001600055620000da565b600060208284031215620000bb57600080fd5b81516001600160a01b0381168114620000d357600080fd5b9392505050565b608051614cac62000120600039600081816102ba01528181610b9401528181610c37015281816112fd015281816131f6015281816132c801526133540152614cac6000f3fe608060405234801561001057600080fd5b50600436106101a35760003560e01c806389035730116100ee578063c8e0c78811610097578063e0a771f711610071578063e0a771f71461038e578063e1ec3c68146103a1578063ef98fbbf146103cb578063ffa1ad74146103d457600080fd5b8063c8e0c7881461034a578063cf44b5d514610373578063ddb1ddd31461037b57600080fd5b8063bb0bab7c116100c8578063bb0bab7c1461031c578063c1751cc61461032f578063c6315e601461034257600080fd5b806389035730146102b557806396b5a755146102f4578063aa4a87111461030757600080fd5b80633a1a411d1161015057806351c4e7b21161012a57806351c4e7b214610291578063756756701461029957806387f21ac7146102ac57600080fd5b80633a1a411d14610258578063415f12401461026b5780634bfa49a21461027e57600080fd5b8063150b7a0211610181578063150b7a02146101ec57806319b05f4914610230578063371fd8e61461024557600080fd5b806302bf321f146101a85780630c97200a146101d2578063121ed2a7146101e4575b600080fd5b6101bb6101b6366004614498565b61041d565b6040516101c9929190614652565b60405180910390f35b6001545b6040519081526020016101c9565b6101bb61077a565b6101ff6101fa36600461469f565b61078f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101c9565b61024361023e36600461473e565b61083f565b005b61024361025336600461473e565b610d27565b6101d6610266366004614757565b610f50565b61024361027936600461473e565b610f81565b6101bb61028c366004614783565b611182565b6101d661119c565b6102436102a73660046147b7565b6111ad565b6101d661271081565b6102dc7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101c9565b61024361030236600461473e565b6114f2565b61030f6116c4565b6040516101c991906147e3565b6101d661032a366004614834565b6118bf565b6101bb61033d366004614783565b612199565b6101d66121a8565b6101d6610358366004614498565b6001600160a01b031660009081526002602052604090205490565b6101bb6121b4565b61030f610389366004614783565b6121c1565b6101bb61039c366004614915565b612563565b6103b46103af36600461473e565b6129d9565b6040516101c99b9a9998979695949392919061494a565b6101d66102da81565b6104106040518060400160405280600581526020017f302e312e3000000000000000000000000000000000000000000000000000000081525081565b6040516101c99190614a38565b60608060026000846001600160a01b03166001600160a01b0316815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561048f57602002820191906000526020600020905b81548152602001906001019080831161047b575b50505050509150815167ffffffffffffffff8111156104b0576104b06147f6565b60405190808252806020026020018201604052801561055657816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816104ce5790505b50905060005b825181101561077457600183828151811061057957610579614a89565b60200260200101518154811061059157610591614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff166005811115610658576106586144b5565b6005811115610669576106696144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d0100000000000000000000000000000000000000000000000000000000009091041660028111156106f9576106f96144b5565b600281111561070a5761070a6144b5565b81526002820154602082015260038201546001600160a01b0390811660408301526004830154166060820152600590910154608090910152825183908390811061075657610756614a89565b6020026020010181905250808061076c90614ae7565b91505061055c565b50915091565b6060806107876005612b0e565b915091509091565b60006001600160a01b03861630146108145760405162461bcd60e51b815260206004820152602660248201527f555020626f72726f77206d6f64756c653a205452414e534645525f4e4f545f4160448201527f4c4c4f574544000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b507f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6002600054036108915760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b600260009081556108a182612dfa565b8054909150336001600160a01b03909116036108ff5760405162461bcd60e51b815260206004820152601d60248201527f555020626f72726f77206d6f64756c653a204f574e5f41554354494f4e000000604482015260640161080b565b61090a816003612e9c565b6109156003836130f1565b6109875760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b610992600583613104565b610a045760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60018101805463ffffffff4281166301000000027fffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffff909216919091179091556003820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790558154610ad591740100000000000000000000000000000000000000008204169061ffff780100000000000000000000000000000000000000000000000082048116917a010000000000000000000000000000000000000000000000000000900416613110565b6001808301805461ffff93909316670100000000000000027fffffffffffffffffffffffffffffffffffffffffffffff0000ffffffffffffff90931692909217909155336000908152600260209081526040822080549384018155825281209091018390556004820154600583015482918291610b5b916001600160a01b031690613287565b600587015460048801549396509194509250610b87916001600160a01b03169060019033903090613494565b8215610c2a57610c2a60017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c149190614b01565b60048701546001600160a01b0316919086613728565b8115610ccd57610ccd60017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663717fadc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb79190614b01565b60048701546001600160a01b0316919085613728565b83546004850154610cee916001600160a01b03918216916001911684613728565b604051339086907fc50b8be185ff56251d3594a960bda150e5d529b8ba3933c226c8cce91114082290600090a350506001600055505050565b600260005403610d795760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b60026000908155610d8982612dfa565b80549091506001600160a01b03163314610de55760405162461bcd60e51b815260206004820152601d60248201527f555020626f72726f77206d6f64756c653a20415554485f4641494c4544000000604482015260640161080b565b610df0816004612e9c565b610dfb6005836130f1565b610e6d5760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60058101546001820154600091610e9a9161ffff6701000000000000008204811691610100900416613946565b60038301546004840154919250610ec3916001600160a01b039081169160019133911685613494565b600182015482546002840154610f19926001600160a01b03690100000000000000000082048116937d01000000000000000000000000000000000000000000000000000000000090920460ff1692911690613728565b604051339084907fe69d7686a8bc68278b8c5419579f91716b3ef2ac2fac0d8cf80b8011f8f458a490600090a35050600160005550565b60026020528160005260406000208181548110610f6c57600080fd5b90600052602060002001600091509150505481565b600260005403610fd35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b60026000908155610fe382612dfa565b9050610ff0816005612e9c565b6001810154429061100d90610100900461ffff1662015180614b1e565b600183015461102991906301000000900463ffffffff16614b3d565b106110765760405162461bcd60e51b815260206004820181905260248201527f555020626f72726f77206d6f64756c653a204c4f414e5f49535f414354495645604482015260640161080b565b6110816005836130f1565b6110f35760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60018101546003820154600283015461114c926001600160a01b03690100000000000000000082048116937d01000000000000000000000000000000000000000000000000000000000090920460ff1692911690613728565b604051339083907f73de9acc561f27528ab0a3b5dd63fefb4e59f95575891299a6f862a78779817690600090a350506001600055565b60608061119160038585613989565b915091509250929050565b60006111a86005613d23565b905090565b6002600054036111ff5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b6002600090815561120f83612dfa565b80549091506001600160a01b0316331461126b5760405162461bcd60e51b815260206004820152601d60248201527f555020626f72726f77206d6f64756c653a20415554485f4641494c4544000000604482015260640161080b565b60018082015460ff166005811115611285576112856144b5565b146112f75760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f5360448201527f5441544500000000000000000000000000000000000000000000000000000000606482015260840161080b565b4261132a7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316613d2d565b8254611354919074010000000000000000000000000000000000000000900463ffffffff16614b3d565b11156113c85760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a20544f4f5f4541524c595f5550444160448201527f5445000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b805461ffff7a0100000000000000000000000000000000000000000000000000009091048116908316116114635760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a204e45575f524154455f544f4f5f5360448201527f4d414c4c00000000000000000000000000000000000000000000000000000000606482015260840161080b565b80547fffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffff167a01000000000000000000000000000000000000000000000000000061ffff8416908102919091178255604051908152339084907f9c0777b36d2e766597aefb484e11717a6cb888fafa68f450984d7fd36a2abe5b9060200160405180910390a35050600160005550565b6002600054036115445760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b6002600090815561155482612dfa565b80549091506001600160a01b031633146115b05760405162461bcd60e51b815260206004820152601d60248201527f555020626f72726f77206d6f64756c653a20415554485f4641494c4544000000604482015260640161080b565b6115bb816002612e9c565b6115c66003836130f1565b6116385760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60018101548154600283015461168e926001600160a01b03690100000000000000000082048116937d01000000000000000000000000000000000000000000000000000000000090920460ff1692911690613728565b604051339083907f10ac9f0bb365b5d22d7bec500408692f23fdf83eadfec71615ef88b4c1134f0e90600090a350506001600055565b60606001805480602002602001604051908101604052809291908181526020016000905b828210156118b6576000848152602090819020604080516101e081019091526006850290910180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff1660058111156117b8576117b86144b5565b60058111156117c9576117c96144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d010000000000000000000000000000000000000000000000000000000000909104166002811115611859576118596144b5565b600281111561186a5761186a6144b5565b8152600282015460208083019190915260038301546001600160a01b039081166040840152600484015416606083015260059092015460809091015290825260019290920191016116e8565b50505050905090565b60006002600054036119135760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b6002600055815161ffff161580159061193657506102da826000015161ffff1611155b6119a85760405162461bcd60e51b815260206004820152602760248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f4460448201527f55524154494f4e00000000000000000000000000000000000000000000000000606482015260840161080b565b816020015161ffff1660001080156119d05750816040015161ffff16826020015161ffff1611155b611a425760405162461bcd60e51b815260206004820152602760248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f494e5445524560448201527f53545f5241544500000000000000000000000000000000000000000000000000606482015260840161080b565b60608201516001600160a01b0316611ac15760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a20494e56414c49445f434f4c4c415460448201527f4552414c00000000000000000000000000000000000000000000000000000000606482015260840161080b565b600082608001516002811115611ad957611ad96144b5565b03611b4c5760405162461bcd60e51b815260206004820152602960248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f434f4c4c415460448201527f4552414c5f545950450000000000000000000000000000000000000000000000606482015260840161080b565b600282608001516002811115611b6457611b646144b5565b1480611b74575060008260a00151115b611be65760405162461bcd60e51b815260206004820152602b60248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f434f4c4c415460448201527f4552414c5f414d4f554e54000000000000000000000000000000000000000000606482015260840161080b565b60c08201516001600160a01b031615801590611c06575060008260e00151115b611c785760405162461bcd60e51b815260206004820152602760248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f444542545f4360448201527f555252454e435900000000000000000000000000000000000000000000000000606482015260840161080b565b611c978260e00151836040015161ffff16846000015161ffff16613946565b505060018054604080516101e08101825233610160820190815263ffffffff421661018083015260208681015161ffff9081166101a0850152938701519093166101c08301528152919291908101828152602001846000015161ffff168152602001600063ffffffff168152602001600061ffff16815260200184606001516001600160a01b0316815260200184608001516002811115611d3a57611d3a6144b5565b815260a08501516020808301919091526000604080840182905260c08801516001600160a01b0390811660608087019190915260e08a01516080909601959095528654600181810189559784529284902086518051600690950290910180548287015194830151929097015161ffff9081167a010000000000000000000000000000000000000000000000000000027fffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffff91909316780100000000000000000000000000000000000000000000000002167fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff90951674010000000000000000000000000000000000000000027fffffffffffffffff0000000000000000000000000000000000000000000000009098169590931694909417959095179190911617929092178255820151818401805493949293919290917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690836005811115611eca57611eca6144b5565b021790555060408201516001820180546060850151608086015160a08701516001600160a01b03166901000000000000000000027fffffff0000000000000000000000000000000000000000ffffffffffffffffff61ffff92831667010000000000000002167fffffff00000000000000000000000000000000000000000000ffffffffffffff63ffffffff9094166301000000027fffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffff9390971661010002929092167fffffffffffffffffffffffffffffffffffffffffffffffffff000000000000ff909416939093179490941716929092179190911780825560c084015191907fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167d01000000000000000000000000000000000000000000000000000000000083600281111561201e5761201e6144b5565b021790555060e0820151600280830191909155610100830151600380840180546001600160a01b039384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915561012086015160048601805491909416911617909155610140909301516005909201919091553360009081526020918252604081208054600181018255908252919020018290556120c29082613104565b6121345760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b612162826080015133308560a0015186606001516001600160a01b031661349490949392919063ffffffff16565b604051339082907f16da476d7265fc95576888b93de4fa4849d6cea1228235887f569c6530ddfec190600090a36001600055919050565b60608061119160058585613989565b60006111a86003613d23565b6060806107876003612b0e565b6001546060908084111561227657604080516000808252602082019092529061226d565b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816121e55790505b5091505061255d565b600061228b6122858684614b55565b85613dc3565b90508067ffffffffffffffff8111156122a6576122a66147f6565b60405190808252806020026020018201604052801561234c57816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816122c45790505b50925060005b818110156125595760016123668288614b3d565b8154811061237657612376614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff16600581111561243d5761243d6144b5565b600581111561244e5761244e6144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d0100000000000000000000000000000000000000000000000000000000009091041660028111156124de576124de6144b5565b60028111156124ef576124ef6144b5565b81526002820154602082015260038201546001600160a01b0390811660408301526004830154166060820152600590910154608090910152845185908390811061253b5761253b614a89565b6020026020010181905250808061255190614ae7565b915050612352565b5050505b92915050565b6001600160a01b03831660009081526002602052604090205460609081908085111561263a576040805160008082526020820181815282840190935290919061262f565b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816125a75790505b5092509250506129d1565b600061264f6126498784614b55565b86613dc3565b90508067ffffffffffffffff81111561266a5761266a6147f6565b604051908082528060200260200182016040528015612693578160200160208202803683370190505b5093508067ffffffffffffffff8111156126af576126af6147f6565b60405190808252806020026020018201604052801561275557816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816126cd5790505b50925060005b818110156129cd576001600160a01b03881660009081526002602052604090206127858289614b3d565b8154811061279557612795614a89565b90600052602060002001548582815181106127b2576127b2614a89565b60200260200101818152505060018582815181106127d2576127d2614a89565b6020026020010151815481106127ea576127ea614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff1660058111156128b1576128b16144b5565b60058111156128c2576128c26144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d010000000000000000000000000000000000000000000000000000000000909104166002811115612952576129526144b5565b6002811115612963576129636144b5565b81526002820154602082015260038201546001600160a01b039081166040830152600483015416606082015260059091015460809091015284518590839081106129af576129af614a89565b602002602001018190525080806129c590614ae7565b91505061275b565b5050505b935093915050565b600181815481106129e957600080fd5b600091825260209182902060408051608081018252600690930290910180546001600160a01b03808216855263ffffffff74010000000000000000000000000000000000000000830481169686019690965261ffff780100000000000000000000000000000000000000000000000083048116948601949094527a01000000000000000000000000000000000000000000000000000090910483166060850152600182015460028301546003840154600485015460059095015496985060ff808416986101008504881698630100000086049091169767010000000000000086041696690100000000000000000086048716967d010000000000000000000000000000000000000000000000000000000000909604909216949283169291909116908b565b606080612b1a83613dd9565b9150815167ffffffffffffffff811115612b3657612b366147f6565b604051908082528060200260200182016040528015612bdc57816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201528252600019909201910181612b545790505b50905060005b8251811015610774576001838281518110612bff57612bff614a89565b602002602001015181548110612c1757612c17614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff166005811115612cde57612cde6144b5565b6005811115612cef57612cef6144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d010000000000000000000000000000000000000000000000000000000000909104166002811115612d7f57612d7f6144b5565b6002811115612d9057612d906144b5565b81526002820154602082015260038201546001600160a01b03908116604083015260048301541660608201526005909101546080909101528251839083908110612ddc57612ddc614a89565b60200260200101819052508080612df290614ae7565b915050612be2565b6001546000908210612e745760405162461bcd60e51b815260206004820152602160248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f4960448201527f4400000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60018281548110612e8757612e87614a89565b90600052602060002090600602019050919050565b60018083015460ff1690816005811115612eb857612eb86144b5565b03612f65576002826005811115612ed157612ed16144b5565b1480612eef575060035b826005811115612eed57612eed6144b5565b145b612f605760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f5360448201527f5441544500000000000000000000000000000000000000000000000000000000606482015260840161080b565b6130a7565b6003816005811115612f7957612f796144b5565b03612fa0576004826005811115612f9257612f926144b5565b1480612eef57506005612edb565b6002816005811115612fb457612fb46144b5565b1480612fd157506004816005811115612fcf57612fcf6144b5565b145b80612fed57506005816005811115612feb57612feb6144b5565b145b1561305f5760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f5360448201527f5441544500000000000000000000000000000000000000000000000000000000606482015260840161080b565b60405162461bcd60e51b815260206004820152601e60248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f4c4f4749430000604482015260640161080b565b6001808401805484927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116908360058111156130e7576130e76144b5565b0217905550505050565b60006130fd8383613de6565b9392505050565b60006130fd8383613ed9565b60004284106131615760405162461bcd60e51b815260206004820152601b60248201527f555020626f72726f77206d6f64756c653a20544f4f5f4541524c590000000000604482015260640161080b565b8261ffff16600010801561317d57508161ffff168361ffff1611155b6131ef5760405162461bcd60e51b815260206004820152602860248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f494e5445524560448201527f53545f5241544553000000000000000000000000000000000000000000000000606482015260840161080b565b60006132237f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316613d2d565b61322d9086614b3d565b9050600061323b4283613dc3565b90506132478683614b55565b6132518783614b55565b61325b8787614b6c565b61ffff166132699190614b1e565b6132739190614b8f565b61327d9086614bca565b9695505050505050565b6040517f11c8bb380000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526000918291829182917f000000000000000000000000000000000000000000000000000000000000000016906311c8bb3890602401602060405180830381865afa15801561330f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133339190614bf0565b905060006127106133448388614b1e565b61334e9190614b8f565b905060647f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d62bb34d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156133b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133d49190614bf0565b6133de9083614b1e565b6133e89190614b8f565b93506133f48482614b55565b94506134008187614b55565b92508261340d8587614b3d565b6134179190614b3d565b861461348b5760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f4645455f4c4f4760448201527f4943000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b50509250925092565b60018460028111156134a8576134a86144b5565b0361356d576134e06001600160a01b0386167f80ac58cd00000000000000000000000000000000000000000000000000000000613f28565b156135535760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2057524f4e475f41535345545f545960448201527f5045000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b6135686001600160a01b038616848484613f44565b613721565b6002846002811115613581576135816144b5565b036136b3576135b96001600160a01b0386167f80ac58cd00000000000000000000000000000000000000000000000000000000613f28565b61362b5760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2057524f4e475f41535345545f545960448201527f5045000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528381166024830152604482018390528616906342842e0e90606401600060405180830381600087803b15801561369657600080fd5b505af11580156136aa573d6000803e3d6000fd5b50505050613721565b60405162461bcd60e51b815260206004820152602860248201527f555020626f72726f77206d6f64756c653a20554e535550504f525445445f415360448201527f5345545f54595045000000000000000000000000000000000000000000000000606482015260840161080b565b5050505050565b600183600281111561373c5761373c6144b5565b03613800576137746001600160a01b0385167f80ac58cd00000000000000000000000000000000000000000000000000000000613f28565b156137e75760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2057524f4e475f41535345545f545960448201527f5045000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b6137fb6001600160a01b0385168383614013565b613940565b6002836002811115613814576138146144b5565b036136b35761384c6001600160a01b0385167f80ac58cd00000000000000000000000000000000000000000000000000000000613f28565b6138be5760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2057524f4e475f41535345545f545960448201527f5045000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152604482018390528516906342842e0e90606401600060405180830381600087803b15801561392757600080fd5b505af115801561393b573d6000803e3d6000fd5b505050505b50505050565b600061016d612710836139598688614b1e565b6139639190614b1e565b61396d9190614b8f565b6139779190614b8f565b6139819085614b3d565b949350505050565b606080600061399786613d23565b9050808511156139bf576040805160008082526020820181815282840190935290919061262f565b60006139ce6126498784614b55565b90508067ffffffffffffffff8111156139e9576139e96147f6565b604051908082528060200260200182016040528015613a12578160200160208202803683370190505b5093508067ffffffffffffffff811115613a2e57613a2e6147f6565b604051908082528060200260200182016040528015613ad457816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201528252600019909201910181613a4c5790505b50925060005b818110156129cd57613af6613aef8289614b3d565b8990614061565b858281518110613b0857613b08614a89565b6020026020010181815250506001858281518110613b2857613b28614a89565b602002602001015181548110613b4057613b40614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff166005811115613c0757613c076144b5565b6005811115613c1857613c186144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d010000000000000000000000000000000000000000000000000000000000909104166002811115613ca857613ca86144b5565b6002811115613cb957613cb96144b5565b81526002820154602082015260038201546001600160a01b03908116604083015260048301541660608201526005909101546080909101528451859083908110613d0557613d05614a89565b60200260200101819052508080613d1b90614ae7565b915050613ada565b600061255d825490565b6040517f1c16b74a000000000000000000000000000000000000000000000000000000008152600060048201819052906001600160a01b03831690631c16b74a90602401602060405180830381865afa158015613d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db29190614bf0565b905080613dbe57600080fd5b919050565b6000818310613dd257816130fd565b5090919050565b606060006130fd8361406d565b60008181526001830160205260408120548015613ecf576000613e0a600183614b55565b8554909150600090613e1e90600190614b55565b9050818114613e83576000866000018281548110613e3e57613e3e614a89565b9060005260206000200154905080876000018481548110613e6157613e61614a89565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613e9457613e94614c09565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061255d565b600091505061255d565b6000818152600183016020526040812054613f205750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561255d565b50600061255d565b6000613f33836140c9565b80156130fd57506130fd838361412d565b6040516001600160a01b03808516602483015283166044820152606481018290526139409085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152614252565b6040516001600160a01b03831660248201526044810182905261405c9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401613f91565b505050565b60006130fd8383614337565b6060816000018054806020026020016040519081016040528092919081815260200182805480156140bd57602002820191906000526020600020905b8154815260200190600101908083116140a9575b50505050509050919050565b60006140f5827f01ffc9a70000000000000000000000000000000000000000000000000000000061412d565b801561255d5750614126827fffffffff0000000000000000000000000000000000000000000000000000000061412d565b1592915050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052905160009190829081906001600160a01b03871690617530906141da908690614c38565b6000604051808303818686fa925050503d8060008114614216576040519150601f19603f3d011682016040523d82523d6000602084013e61421b565b606091505b5091509150602081511015614236576000935050505061255d565b81801561327d57508080602001905181019061327d9190614c54565b60006142a7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166143619092919063ffffffff16565b80519091501561405c57808060200190518101906142c59190614c54565b61405c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161080b565b600082600001828154811061434e5761434e614a89565b9060005260206000200154905092915050565b60606139818484600085856001600160a01b0385163b6143c35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161080b565b600080866001600160a01b031685876040516143df9190614c38565b60006040518083038185875af1925050503d806000811461441c576040519150601f19603f3d011682016040523d82523d6000602084013e614421565b606091505b509150915061443182828661443c565b979650505050505050565b6060831561444b5750816130fd565b82511561445b5782518084602001fd5b8160405162461bcd60e51b815260040161080b9190614a38565b6001600160a01b038116811461448a57600080fd5b50565b8035613dbe81614475565b6000602082840312156144aa57600080fd5b81356130fd81614475565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600681106144f4576144f46144b5565b9052565b600381106144f4576144f46144b5565b600081518084526020808501945080840160005b8381101561464757815161456b8882516001600160a01b03815116825263ffffffff6020820151166020830152604081015161ffff808216604085015280606084015116606085015250505050565b83810151608061457d818b01836144e4565b6040830151915060a0614595818c018461ffff169052565b6060840151925060c06145af818d018563ffffffff169052565b91840151925060e0916145c78c84018561ffff169052565b908401519250610100906145e58c8301856001600160a01b03169052565b84015192506101206145f98c8201856144f8565b918401516101408c810191909152908401516001600160a01b039081166101608d0152918401519091166101808b0152909101516101a0890152506101c0909601959082019060010161451c565b509495945050505050565b604080825283519082018190526000906020906060840190828701845b8281101561468b5781518452928401929084019060010161466f565b5050508381038285015261327d8186614508565b6000806000806000608086880312156146b757600080fd5b85356146c281614475565b945060208601356146d281614475565b935060408601359250606086013567ffffffffffffffff808211156146f657600080fd5b818801915088601f83011261470a57600080fd5b81358181111561471957600080fd5b89602082850101111561472b57600080fd5b9699959850939650602001949392505050565b60006020828403121561475057600080fd5b5035919050565b6000806040838503121561476a57600080fd5b823561477581614475565b946020939093013593505050565b6000806040838503121561479657600080fd5b50508035926020909101359150565b803561ffff81168114613dbe57600080fd5b600080604083850312156147ca57600080fd5b823591506147da602084016147a5565b90509250929050565b6020815260006130fd6020830184614508565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b803560038110613dbe57600080fd5b600061010080838503121561484857600080fd5b6040519081019067ffffffffffffffff82118183101715614892577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8160405261489f846147a5565b81526148ad602085016147a5565b60208201526148be604085016147a5565b60408201526148cf6060850161448d565b60608201526148e060808501614825565b608082015260a084013560a08201526148fb60c0850161448d565b60c082015260e084013560e0820152809250505092915050565b60008060006060848603121561492a57600080fd5b833561493581614475565b95602085013595506040909401359392505050565b6101c08101614993828e6001600160a01b03815116825263ffffffff6020820151166020830152604081015161ffff808216604085015280606084015116606085015250505050565b6149a0608083018d6144e4565b61ffff8b811660a084015263ffffffff8b1660c0840152891660e08301526001600160a01b038881166101008401526149dd6101208401896144f8565b610140830196909652938516610160820152919093166101808201526101a00191909152979650505050505050565b60005b83811015614a27578181015183820152602001614a0f565b838111156139405750506000910152565b6020815260008251806020840152614a57816040850160208701614a0c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006000198203614afa57614afa614ab8565b5060010190565b600060208284031215614b1357600080fd5b81516130fd81614475565b6000816000190483118215151615614b3857614b38614ab8565b500290565b60008219821115614b5057614b50614ab8565b500190565b600082821015614b6757614b67614ab8565b500390565b600061ffff83811690831681811015614b8757614b87614ab8565b039392505050565b600082614bc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600061ffff808316818516808303821115614be757614be7614ab8565b01949350505050565b600060208284031215614c0257600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251614c4a818460208701614a0c565b9190910192915050565b600060208284031215614c6657600080fd5b815180151581146130fd57600080fdfea264697066735822122038bd4e311c7d0937bf479df98d1aacdc439b017b8091561ef2fcb07aab4e16c364736f6c634300080e003300000000000000000000000003d448b704f52ee966de0770708ea226640e6c26

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101a35760003560e01c806389035730116100ee578063c8e0c78811610097578063e0a771f711610071578063e0a771f71461038e578063e1ec3c68146103a1578063ef98fbbf146103cb578063ffa1ad74146103d457600080fd5b8063c8e0c7881461034a578063cf44b5d514610373578063ddb1ddd31461037b57600080fd5b8063bb0bab7c116100c8578063bb0bab7c1461031c578063c1751cc61461032f578063c6315e601461034257600080fd5b806389035730146102b557806396b5a755146102f4578063aa4a87111461030757600080fd5b80633a1a411d1161015057806351c4e7b21161012a57806351c4e7b214610291578063756756701461029957806387f21ac7146102ac57600080fd5b80633a1a411d14610258578063415f12401461026b5780634bfa49a21461027e57600080fd5b8063150b7a0211610181578063150b7a02146101ec57806319b05f4914610230578063371fd8e61461024557600080fd5b806302bf321f146101a85780630c97200a146101d2578063121ed2a7146101e4575b600080fd5b6101bb6101b6366004614498565b61041d565b6040516101c9929190614652565b60405180910390f35b6001545b6040519081526020016101c9565b6101bb61077a565b6101ff6101fa36600461469f565b61078f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101c9565b61024361023e36600461473e565b61083f565b005b61024361025336600461473e565b610d27565b6101d6610266366004614757565b610f50565b61024361027936600461473e565b610f81565b6101bb61028c366004614783565b611182565b6101d661119c565b6102436102a73660046147b7565b6111ad565b6101d661271081565b6102dc7f00000000000000000000000003d448b704f52ee966de0770708ea226640e6c2681565b6040516001600160a01b0390911681526020016101c9565b61024361030236600461473e565b6114f2565b61030f6116c4565b6040516101c991906147e3565b6101d661032a366004614834565b6118bf565b6101bb61033d366004614783565b612199565b6101d66121a8565b6101d6610358366004614498565b6001600160a01b031660009081526002602052604090205490565b6101bb6121b4565b61030f610389366004614783565b6121c1565b6101bb61039c366004614915565b612563565b6103b46103af36600461473e565b6129d9565b6040516101c99b9a9998979695949392919061494a565b6101d66102da81565b6104106040518060400160405280600581526020017f302e312e3000000000000000000000000000000000000000000000000000000081525081565b6040516101c99190614a38565b60608060026000846001600160a01b03166001600160a01b0316815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561048f57602002820191906000526020600020905b81548152602001906001019080831161047b575b50505050509150815167ffffffffffffffff8111156104b0576104b06147f6565b60405190808252806020026020018201604052801561055657816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816104ce5790505b50905060005b825181101561077457600183828151811061057957610579614a89565b60200260200101518154811061059157610591614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff166005811115610658576106586144b5565b6005811115610669576106696144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d0100000000000000000000000000000000000000000000000000000000009091041660028111156106f9576106f96144b5565b600281111561070a5761070a6144b5565b81526002820154602082015260038201546001600160a01b0390811660408301526004830154166060820152600590910154608090910152825183908390811061075657610756614a89565b6020026020010181905250808061076c90614ae7565b91505061055c565b50915091565b6060806107876005612b0e565b915091509091565b60006001600160a01b03861630146108145760405162461bcd60e51b815260206004820152602660248201527f555020626f72726f77206d6f64756c653a205452414e534645525f4e4f545f4160448201527f4c4c4f574544000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b507f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6002600054036108915760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b600260009081556108a182612dfa565b8054909150336001600160a01b03909116036108ff5760405162461bcd60e51b815260206004820152601d60248201527f555020626f72726f77206d6f64756c653a204f574e5f41554354494f4e000000604482015260640161080b565b61090a816003612e9c565b6109156003836130f1565b6109875760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b610992600583613104565b610a045760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60018101805463ffffffff4281166301000000027fffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffff909216919091179091556003820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790558154610ad591740100000000000000000000000000000000000000008204169061ffff780100000000000000000000000000000000000000000000000082048116917a010000000000000000000000000000000000000000000000000000900416613110565b6001808301805461ffff93909316670100000000000000027fffffffffffffffffffffffffffffffffffffffffffffff0000ffffffffffffff90931692909217909155336000908152600260209081526040822080549384018155825281209091018390556004820154600583015482918291610b5b916001600160a01b031690613287565b600587015460048801549396509194509250610b87916001600160a01b03169060019033903090613494565b8215610c2a57610c2a60017f00000000000000000000000003d448b704f52ee966de0770708ea226640e6c266001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c149190614b01565b60048701546001600160a01b0316919086613728565b8115610ccd57610ccd60017f00000000000000000000000003d448b704f52ee966de0770708ea226640e6c266001600160a01b031663717fadc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb79190614b01565b60048701546001600160a01b0316919085613728565b83546004850154610cee916001600160a01b03918216916001911684613728565b604051339086907fc50b8be185ff56251d3594a960bda150e5d529b8ba3933c226c8cce91114082290600090a350506001600055505050565b600260005403610d795760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b60026000908155610d8982612dfa565b80549091506001600160a01b03163314610de55760405162461bcd60e51b815260206004820152601d60248201527f555020626f72726f77206d6f64756c653a20415554485f4641494c4544000000604482015260640161080b565b610df0816004612e9c565b610dfb6005836130f1565b610e6d5760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60058101546001820154600091610e9a9161ffff6701000000000000008204811691610100900416613946565b60038301546004840154919250610ec3916001600160a01b039081169160019133911685613494565b600182015482546002840154610f19926001600160a01b03690100000000000000000082048116937d01000000000000000000000000000000000000000000000000000000000090920460ff1692911690613728565b604051339084907fe69d7686a8bc68278b8c5419579f91716b3ef2ac2fac0d8cf80b8011f8f458a490600090a35050600160005550565b60026020528160005260406000208181548110610f6c57600080fd5b90600052602060002001600091509150505481565b600260005403610fd35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b60026000908155610fe382612dfa565b9050610ff0816005612e9c565b6001810154429061100d90610100900461ffff1662015180614b1e565b600183015461102991906301000000900463ffffffff16614b3d565b106110765760405162461bcd60e51b815260206004820181905260248201527f555020626f72726f77206d6f64756c653a204c4f414e5f49535f414354495645604482015260640161080b565b6110816005836130f1565b6110f35760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60018101546003820154600283015461114c926001600160a01b03690100000000000000000082048116937d01000000000000000000000000000000000000000000000000000000000090920460ff1692911690613728565b604051339083907f73de9acc561f27528ab0a3b5dd63fefb4e59f95575891299a6f862a78779817690600090a350506001600055565b60608061119160038585613989565b915091509250929050565b60006111a86005613d23565b905090565b6002600054036111ff5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b6002600090815561120f83612dfa565b80549091506001600160a01b0316331461126b5760405162461bcd60e51b815260206004820152601d60248201527f555020626f72726f77206d6f64756c653a20415554485f4641494c4544000000604482015260640161080b565b60018082015460ff166005811115611285576112856144b5565b146112f75760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f5360448201527f5441544500000000000000000000000000000000000000000000000000000000606482015260840161080b565b4261132a7f00000000000000000000000003d448b704f52ee966de0770708ea226640e6c266001600160a01b0316613d2d565b8254611354919074010000000000000000000000000000000000000000900463ffffffff16614b3d565b11156113c85760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a20544f4f5f4541524c595f5550444160448201527f5445000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b805461ffff7a0100000000000000000000000000000000000000000000000000009091048116908316116114635760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a204e45575f524154455f544f4f5f5360448201527f4d414c4c00000000000000000000000000000000000000000000000000000000606482015260840161080b565b80547fffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffff167a01000000000000000000000000000000000000000000000000000061ffff8416908102919091178255604051908152339084907f9c0777b36d2e766597aefb484e11717a6cb888fafa68f450984d7fd36a2abe5b9060200160405180910390a35050600160005550565b6002600054036115445760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b6002600090815561155482612dfa565b80549091506001600160a01b031633146115b05760405162461bcd60e51b815260206004820152601d60248201527f555020626f72726f77206d6f64756c653a20415554485f4641494c4544000000604482015260640161080b565b6115bb816002612e9c565b6115c66003836130f1565b6116385760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60018101548154600283015461168e926001600160a01b03690100000000000000000082048116937d01000000000000000000000000000000000000000000000000000000000090920460ff1692911690613728565b604051339083907f10ac9f0bb365b5d22d7bec500408692f23fdf83eadfec71615ef88b4c1134f0e90600090a350506001600055565b60606001805480602002602001604051908101604052809291908181526020016000905b828210156118b6576000848152602090819020604080516101e081019091526006850290910180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff1660058111156117b8576117b86144b5565b60058111156117c9576117c96144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d010000000000000000000000000000000000000000000000000000000000909104166002811115611859576118596144b5565b600281111561186a5761186a6144b5565b8152600282015460208083019190915260038301546001600160a01b039081166040840152600484015416606083015260059092015460809091015290825260019290920191016116e8565b50505050905090565b60006002600054036119135760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080b565b6002600055815161ffff161580159061193657506102da826000015161ffff1611155b6119a85760405162461bcd60e51b815260206004820152602760248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f4460448201527f55524154494f4e00000000000000000000000000000000000000000000000000606482015260840161080b565b816020015161ffff1660001080156119d05750816040015161ffff16826020015161ffff1611155b611a425760405162461bcd60e51b815260206004820152602760248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f494e5445524560448201527f53545f5241544500000000000000000000000000000000000000000000000000606482015260840161080b565b60608201516001600160a01b0316611ac15760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a20494e56414c49445f434f4c4c415460448201527f4552414c00000000000000000000000000000000000000000000000000000000606482015260840161080b565b600082608001516002811115611ad957611ad96144b5565b03611b4c5760405162461bcd60e51b815260206004820152602960248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f434f4c4c415460448201527f4552414c5f545950450000000000000000000000000000000000000000000000606482015260840161080b565b600282608001516002811115611b6457611b646144b5565b1480611b74575060008260a00151115b611be65760405162461bcd60e51b815260206004820152602b60248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f434f4c4c415460448201527f4552414c5f414d4f554e54000000000000000000000000000000000000000000606482015260840161080b565b60c08201516001600160a01b031615801590611c06575060008260e00151115b611c785760405162461bcd60e51b815260206004820152602760248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f444542545f4360448201527f555252454e435900000000000000000000000000000000000000000000000000606482015260840161080b565b611c978260e00151836040015161ffff16846000015161ffff16613946565b505060018054604080516101e08101825233610160820190815263ffffffff421661018083015260208681015161ffff9081166101a0850152938701519093166101c08301528152919291908101828152602001846000015161ffff168152602001600063ffffffff168152602001600061ffff16815260200184606001516001600160a01b0316815260200184608001516002811115611d3a57611d3a6144b5565b815260a08501516020808301919091526000604080840182905260c08801516001600160a01b0390811660608087019190915260e08a01516080909601959095528654600181810189559784529284902086518051600690950290910180548287015194830151929097015161ffff9081167a010000000000000000000000000000000000000000000000000000027fffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffff91909316780100000000000000000000000000000000000000000000000002167fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff90951674010000000000000000000000000000000000000000027fffffffffffffffff0000000000000000000000000000000000000000000000009098169590931694909417959095179190911617929092178255820151818401805493949293919290917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690836005811115611eca57611eca6144b5565b021790555060408201516001820180546060850151608086015160a08701516001600160a01b03166901000000000000000000027fffffff0000000000000000000000000000000000000000ffffffffffffffffff61ffff92831667010000000000000002167fffffff00000000000000000000000000000000000000000000ffffffffffffff63ffffffff9094166301000000027fffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffff9390971661010002929092167fffffffffffffffffffffffffffffffffffffffffffffffffff000000000000ff909416939093179490941716929092179190911780825560c084015191907fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167d01000000000000000000000000000000000000000000000000000000000083600281111561201e5761201e6144b5565b021790555060e0820151600280830191909155610100830151600380840180546001600160a01b039384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915561012086015160048601805491909416911617909155610140909301516005909201919091553360009081526020918252604081208054600181018255908252919020018290556120c29082613104565b6121345760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f5354525543545560448201527f5245000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b612162826080015133308560a0015186606001516001600160a01b031661349490949392919063ffffffff16565b604051339082907f16da476d7265fc95576888b93de4fa4849d6cea1228235887f569c6530ddfec190600090a36001600055919050565b60608061119160058585613989565b60006111a86003613d23565b6060806107876003612b0e565b6001546060908084111561227657604080516000808252602082019092529061226d565b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816121e55790505b5091505061255d565b600061228b6122858684614b55565b85613dc3565b90508067ffffffffffffffff8111156122a6576122a66147f6565b60405190808252806020026020018201604052801561234c57816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816122c45790505b50925060005b818110156125595760016123668288614b3d565b8154811061237657612376614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff16600581111561243d5761243d6144b5565b600581111561244e5761244e6144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d0100000000000000000000000000000000000000000000000000000000009091041660028111156124de576124de6144b5565b60028111156124ef576124ef6144b5565b81526002820154602082015260038201546001600160a01b0390811660408301526004830154166060820152600590910154608090910152845185908390811061253b5761253b614a89565b6020026020010181905250808061255190614ae7565b915050612352565b5050505b92915050565b6001600160a01b03831660009081526002602052604090205460609081908085111561263a576040805160008082526020820181815282840190935290919061262f565b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816125a75790505b5092509250506129d1565b600061264f6126498784614b55565b86613dc3565b90508067ffffffffffffffff81111561266a5761266a6147f6565b604051908082528060200260200182016040528015612693578160200160208202803683370190505b5093508067ffffffffffffffff8111156126af576126af6147f6565b60405190808252806020026020018201604052801561275557816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816126cd5790505b50925060005b818110156129cd576001600160a01b03881660009081526002602052604090206127858289614b3d565b8154811061279557612795614a89565b90600052602060002001548582815181106127b2576127b2614a89565b60200260200101818152505060018582815181106127d2576127d2614a89565b6020026020010151815481106127ea576127ea614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff1660058111156128b1576128b16144b5565b60058111156128c2576128c26144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d010000000000000000000000000000000000000000000000000000000000909104166002811115612952576129526144b5565b6002811115612963576129636144b5565b81526002820154602082015260038201546001600160a01b039081166040830152600483015416606082015260059091015460809091015284518590839081106129af576129af614a89565b602002602001018190525080806129c590614ae7565b91505061275b565b5050505b935093915050565b600181815481106129e957600080fd5b600091825260209182902060408051608081018252600690930290910180546001600160a01b03808216855263ffffffff74010000000000000000000000000000000000000000830481169686019690965261ffff780100000000000000000000000000000000000000000000000083048116948601949094527a01000000000000000000000000000000000000000000000000000090910483166060850152600182015460028301546003840154600485015460059095015496985060ff808416986101008504881698630100000086049091169767010000000000000086041696690100000000000000000086048716967d010000000000000000000000000000000000000000000000000000000000909604909216949283169291909116908b565b606080612b1a83613dd9565b9150815167ffffffffffffffff811115612b3657612b366147f6565b604051908082528060200260200182016040528015612bdc57816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201528252600019909201910181612b545790505b50905060005b8251811015610774576001838281518110612bff57612bff614a89565b602002602001015181548110612c1757612c17614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff166005811115612cde57612cde6144b5565b6005811115612cef57612cef6144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d010000000000000000000000000000000000000000000000000000000000909104166002811115612d7f57612d7f6144b5565b6002811115612d9057612d906144b5565b81526002820154602082015260038201546001600160a01b03908116604083015260048301541660608201526005909101546080909101528251839083908110612ddc57612ddc614a89565b60200260200101819052508080612df290614ae7565b915050612be2565b6001546000908210612e745760405162461bcd60e51b815260206004820152602160248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f4960448201527f4400000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b60018281548110612e8757612e87614a89565b90600052602060002090600602019050919050565b60018083015460ff1690816005811115612eb857612eb86144b5565b03612f65576002826005811115612ed157612ed16144b5565b1480612eef575060035b826005811115612eed57612eed6144b5565b145b612f605760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f5360448201527f5441544500000000000000000000000000000000000000000000000000000000606482015260840161080b565b6130a7565b6003816005811115612f7957612f796144b5565b03612fa0576004826005811115612f9257612f926144b5565b1480612eef57506005612edb565b6002816005811115612fb457612fb46144b5565b1480612fd157506004816005811115612fcf57612fcf6144b5565b145b80612fed57506005816005811115612feb57612feb6144b5565b145b1561305f5760405162461bcd60e51b8152602060048201526024808201527f555020626f72726f77206d6f64756c653a20494e56414c49445f4c4f414e5f5360448201527f5441544500000000000000000000000000000000000000000000000000000000606482015260840161080b565b60405162461bcd60e51b815260206004820152601e60248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f4c4f4749430000604482015260640161080b565b6001808401805484927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116908360058111156130e7576130e76144b5565b0217905550505050565b60006130fd8383613de6565b9392505050565b60006130fd8383613ed9565b60004284106131615760405162461bcd60e51b815260206004820152601b60248201527f555020626f72726f77206d6f64756c653a20544f4f5f4541524c590000000000604482015260640161080b565b8261ffff16600010801561317d57508161ffff168361ffff1611155b6131ef5760405162461bcd60e51b815260206004820152602860248201527f555020626f72726f77206d6f64756c653a20494e56414c49445f494e5445524560448201527f53545f5241544553000000000000000000000000000000000000000000000000606482015260840161080b565b60006132237f00000000000000000000000003d448b704f52ee966de0770708ea226640e6c266001600160a01b0316613d2d565b61322d9086614b3d565b9050600061323b4283613dc3565b90506132478683614b55565b6132518783614b55565b61325b8787614b6c565b61ffff166132699190614b1e565b6132739190614b8f565b61327d9086614bca565b9695505050505050565b6040517f11c8bb380000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526000918291829182917f00000000000000000000000003d448b704f52ee966de0770708ea226640e6c2616906311c8bb3890602401602060405180830381865afa15801561330f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133339190614bf0565b905060006127106133448388614b1e565b61334e9190614b8f565b905060647f00000000000000000000000003d448b704f52ee966de0770708ea226640e6c266001600160a01b031663d62bb34d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156133b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133d49190614bf0565b6133de9083614b1e565b6133e89190614b8f565b93506133f48482614b55565b94506134008187614b55565b92508261340d8587614b3d565b6134179190614b3d565b861461348b5760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2042524f4b454e5f4645455f4c4f4760448201527f4943000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b50509250925092565b60018460028111156134a8576134a86144b5565b0361356d576134e06001600160a01b0386167f80ac58cd00000000000000000000000000000000000000000000000000000000613f28565b156135535760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2057524f4e475f41535345545f545960448201527f5045000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b6135686001600160a01b038616848484613f44565b613721565b6002846002811115613581576135816144b5565b036136b3576135b96001600160a01b0386167f80ac58cd00000000000000000000000000000000000000000000000000000000613f28565b61362b5760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2057524f4e475f41535345545f545960448201527f5045000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528381166024830152604482018390528616906342842e0e90606401600060405180830381600087803b15801561369657600080fd5b505af11580156136aa573d6000803e3d6000fd5b50505050613721565b60405162461bcd60e51b815260206004820152602860248201527f555020626f72726f77206d6f64756c653a20554e535550504f525445445f415360448201527f5345545f54595045000000000000000000000000000000000000000000000000606482015260840161080b565b5050505050565b600183600281111561373c5761373c6144b5565b03613800576137746001600160a01b0385167f80ac58cd00000000000000000000000000000000000000000000000000000000613f28565b156137e75760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2057524f4e475f41535345545f545960448201527f5045000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b6137fb6001600160a01b0385168383614013565b613940565b6002836002811115613814576138146144b5565b036136b35761384c6001600160a01b0385167f80ac58cd00000000000000000000000000000000000000000000000000000000613f28565b6138be5760405162461bcd60e51b815260206004820152602260248201527f555020626f72726f77206d6f64756c653a2057524f4e475f41535345545f545960448201527f5045000000000000000000000000000000000000000000000000000000000000606482015260840161080b565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152604482018390528516906342842e0e90606401600060405180830381600087803b15801561392757600080fd5b505af115801561393b573d6000803e3d6000fd5b505050505b50505050565b600061016d612710836139598688614b1e565b6139639190614b1e565b61396d9190614b8f565b6139779190614b8f565b6139819085614b3d565b949350505050565b606080600061399786613d23565b9050808511156139bf576040805160008082526020820181815282840190935290919061262f565b60006139ce6126498784614b55565b90508067ffffffffffffffff8111156139e9576139e96147f6565b604051908082528060200260200182016040528015613a12578160200160208202803683370190505b5093508067ffffffffffffffff811115613a2e57613a2e6147f6565b604051908082528060200260200182016040528015613ad457816020015b604080516101e0810182526000610160820181815261018083018290526101a083018290526101c0830182905282526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201528252600019909201910181613a4c5790505b50925060005b818110156129cd57613af6613aef8289614b3d565b8990614061565b858281518110613b0857613b08614a89565b6020026020010181815250506001858281518110613b2857613b28614a89565b602002602001015181548110613b4057613b40614a89565b6000918252602091829020604080516101e0810190915260069092020180546001600160a01b038116610160840190815263ffffffff7401000000000000000000000000000000000000000083041661018085015261ffff7801000000000000000000000000000000000000000000000000830481166101a08601527a0100000000000000000000000000000000000000000000000000009092049091166101c084015282526001810154919290919083019060ff166005811115613c0757613c076144b5565b6005811115613c1857613c186144b5565b8152600182015461ffff61010082048116602084015263ffffffff6301000000830416604084015267010000000000000082041660608301526001600160a01b036901000000000000000000820416608083015260a09091019060ff7d010000000000000000000000000000000000000000000000000000000000909104166002811115613ca857613ca86144b5565b6002811115613cb957613cb96144b5565b81526002820154602082015260038201546001600160a01b03908116604083015260048301541660608201526005909101546080909101528451859083908110613d0557613d05614a89565b60200260200101819052508080613d1b90614ae7565b915050613ada565b600061255d825490565b6040517f1c16b74a000000000000000000000000000000000000000000000000000000008152600060048201819052906001600160a01b03831690631c16b74a90602401602060405180830381865afa158015613d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db29190614bf0565b905080613dbe57600080fd5b919050565b6000818310613dd257816130fd565b5090919050565b606060006130fd8361406d565b60008181526001830160205260408120548015613ecf576000613e0a600183614b55565b8554909150600090613e1e90600190614b55565b9050818114613e83576000866000018281548110613e3e57613e3e614a89565b9060005260206000200154905080876000018481548110613e6157613e61614a89565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613e9457613e94614c09565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061255d565b600091505061255d565b6000818152600183016020526040812054613f205750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561255d565b50600061255d565b6000613f33836140c9565b80156130fd57506130fd838361412d565b6040516001600160a01b03808516602483015283166044820152606481018290526139409085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152614252565b6040516001600160a01b03831660248201526044810182905261405c9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401613f91565b505050565b60006130fd8383614337565b6060816000018054806020026020016040519081016040528092919081815260200182805480156140bd57602002820191906000526020600020905b8154815260200190600101908083116140a9575b50505050509050919050565b60006140f5827f01ffc9a70000000000000000000000000000000000000000000000000000000061412d565b801561255d5750614126827fffffffff0000000000000000000000000000000000000000000000000000000061412d565b1592915050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052905160009190829081906001600160a01b03871690617530906141da908690614c38565b6000604051808303818686fa925050503d8060008114614216576040519150601f19603f3d011682016040523d82523d6000602084013e61421b565b606091505b5091509150602081511015614236576000935050505061255d565b81801561327d57508080602001905181019061327d9190614c54565b60006142a7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166143619092919063ffffffff16565b80519091501561405c57808060200190518101906142c59190614c54565b61405c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161080b565b600082600001828154811061434e5761434e614a89565b9060005260206000200154905092915050565b60606139818484600085856001600160a01b0385163b6143c35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161080b565b600080866001600160a01b031685876040516143df9190614c38565b60006040518083038185875af1925050503d806000811461441c576040519150601f19603f3d011682016040523d82523d6000602084013e614421565b606091505b509150915061443182828661443c565b979650505050505050565b6060831561444b5750816130fd565b82511561445b5782518084602001fd5b8160405162461bcd60e51b815260040161080b9190614a38565b6001600160a01b038116811461448a57600080fd5b50565b8035613dbe81614475565b6000602082840312156144aa57600080fd5b81356130fd81614475565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600681106144f4576144f46144b5565b9052565b600381106144f4576144f46144b5565b600081518084526020808501945080840160005b8381101561464757815161456b8882516001600160a01b03815116825263ffffffff6020820151166020830152604081015161ffff808216604085015280606084015116606085015250505050565b83810151608061457d818b01836144e4565b6040830151915060a0614595818c018461ffff169052565b6060840151925060c06145af818d018563ffffffff169052565b91840151925060e0916145c78c84018561ffff169052565b908401519250610100906145e58c8301856001600160a01b03169052565b84015192506101206145f98c8201856144f8565b918401516101408c810191909152908401516001600160a01b039081166101608d0152918401519091166101808b0152909101516101a0890152506101c0909601959082019060010161451c565b509495945050505050565b604080825283519082018190526000906020906060840190828701845b8281101561468b5781518452928401929084019060010161466f565b5050508381038285015261327d8186614508565b6000806000806000608086880312156146b757600080fd5b85356146c281614475565b945060208601356146d281614475565b935060408601359250606086013567ffffffffffffffff808211156146f657600080fd5b818801915088601f83011261470a57600080fd5b81358181111561471957600080fd5b89602082850101111561472b57600080fd5b9699959850939650602001949392505050565b60006020828403121561475057600080fd5b5035919050565b6000806040838503121561476a57600080fd5b823561477581614475565b946020939093013593505050565b6000806040838503121561479657600080fd5b50508035926020909101359150565b803561ffff81168114613dbe57600080fd5b600080604083850312156147ca57600080fd5b823591506147da602084016147a5565b90509250929050565b6020815260006130fd6020830184614508565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b803560038110613dbe57600080fd5b600061010080838503121561484857600080fd5b6040519081019067ffffffffffffffff82118183101715614892577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8160405261489f846147a5565b81526148ad602085016147a5565b60208201526148be604085016147a5565b60408201526148cf6060850161448d565b60608201526148e060808501614825565b608082015260a084013560a08201526148fb60c0850161448d565b60c082015260e084013560e0820152809250505092915050565b60008060006060848603121561492a57600080fd5b833561493581614475565b95602085013595506040909401359392505050565b6101c08101614993828e6001600160a01b03815116825263ffffffff6020820151166020830152604081015161ffff808216604085015280606084015116606085015250505050565b6149a0608083018d6144e4565b61ffff8b811660a084015263ffffffff8b1660c0840152891660e08301526001600160a01b038881166101008401526149dd6101208401896144f8565b610140830196909652938516610160820152919093166101808201526101a00191909152979650505050505050565b60005b83811015614a27578181015183820152602001614a0f565b838111156139405750506000910152565b6020815260008251806020840152614a57816040850160208701614a0c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006000198203614afa57614afa614ab8565b5060010190565b600060208284031215614b1357600080fd5b81516130fd81614475565b6000816000190483118215151615614b3857614b38614ab8565b500290565b60008219821115614b5057614b50614ab8565b500190565b600082821015614b6757614b67614ab8565b500390565b600061ffff83811690831681811015614b8757614b87614ab8565b039392505050565b600082614bc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600061ffff808316818516808303821115614be757614be7614ab8565b01949350505050565b600060208284031215614c0257600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251614c4a818460208701614a0c565b9190910192915050565b600060208284031215614c6657600080fd5b815180151581146130fd57600080fdfea264697066735822122038bd4e311c7d0937bf479df98d1aacdc439b017b8091561ef2fcb07aab4e16c364736f6c634300080e0033

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

00000000000000000000000003d448b704f52ee966de0770708ea226640e6c26

-----Decoded View---------------
Arg [0] : _parametersStorage (address): 0x03D448B704F52eE966De0770708ea226640e6c26

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000003d448b704f52ee966de0770708ea226640e6c26


Block Transaction 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

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.