false
false

Contract Address Details

0x4F751398Beb53D882eD99bd82f98911D45b9afBf

Contract Name
XSwapper
Creator
0x013261–3cce0b at 0xdd3880–1e808f
Balance
0 KCS
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
37441317
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
XSwapper




Optimization enabled
true
Compiler version
v0.8.2+commit.661d1103




Optimization runs
200
Verified at
2022-09-02T04:07:51.826903Z

XSwapper.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.2;

import { Address } from "Address.sol";
import "AccessControlUpgradeable.sol";
import "UUPSUpgradeable.sol";
import "PausableUpgradeable.sol";
import "ERC20.sol";
import "ECDSA.sol";
import "SafeERC20.sol";
import "ReentrancyGuard.sol";

import "Supervisor.sol";
import "IDexAggregatorAdaptor.sol";
import "IYPoolVault.sol";


/// @title XSwapper contract
/// @notice Users call `swap` to swap asset to specified bridgeable asset and then initiate a cross-chain swap request.
/// YPool workers call `closeSwap` to complete a cross-chain swap, `claim` & `batchClaim` to claim the credit back.
/// YPool validators call `lockCloseSwap` & `refund` to lock the swap and refund asset back to user if no applicable
/// liquidity or a YPool worker sent an invalidated closeSwap tx.
/// - "User" and "Account" refer to the same thing
/// - "fromChain" and "source chain" refer to the same thing
/// - "toChain" and "target chain" refer to the same thing
/// - "XYChain" and "Settlement chain" refer to the same thing
contract XSwapper is AccessControlUpgradeable, UUPSUpgradeable, PausableUpgradeable, ReentrancyGuard {
    using SafeERC20 for IERC20;
    using ECDSA for bytes32;

    /* ========== STRUCTURE ========== */

    // Status of a swap request (on source chain)
    enum RequestStatus { Open, Closed }
    // Result of a swap when it's closed (on target chain)
    enum CloseSwapResult { NonSwapped, Success, Failed, Locked }
    // Type of how the asset is transferred when the swap is completed
    enum CompleteSwapType { Claimed, FreeClaimed, Refunded }

    // Fees settings on each chain
    // Fee is calculated as `inputAmount * FeeStructure.rate / (10 ** FeeStructure.decimals)`
    struct FeeStructure {
        bool isSet;
        uint256 gas;
        uint256 min;
        uint256 max;
        uint256 rate;
        uint256 decimals;
    }

    // Info of a swap request
    struct SwapRequest {
        uint32 toChainId;
        uint256 swapId;
        address receiver;
        address sender;
        uint256 YPoolTokenAmount;
        uint256 xyFee;
        uint256 gasFee;
        IERC20 YPoolToken;
        RequestStatus status;
    }

    // Info of an expecting swap on target chain of a swap request
    struct ToChainDescription {
        uint32 toChainId;
        IERC20 toChainToken;
        uint256 expectedToChainTokenAmount;
        uint32 slippage;
    }

    /* ========== STATE VARIABLES ========== */

    // Roles
    bytes32 public constant ROLE_OWNER = keccak256("ROLE_OWNER");
    bytes32 public constant ROLE_MANAGER = keccak256("ROLE_MANAGER");
    bytes32 public constant ROLE_STAFF = keccak256("ROLE_STAFF");
    bytes32 public constant ROLE_YPOOL_WORKER = keccak256("ROLE_YPOOL_WORKER");

    // Mapping of YPool token to its max amount in a single swap
    mapping (address => uint256) public maxYPoolTokenSwapAmount;

    // A contract that supervises each refund and claim by providing signatures
    Supervisor public supervisor;
    // A referenced address of native currency
    address public constant ETHER_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    // Id of the current chain
    uint32 public chainId;
    // Next available id of a swap request
    // Note: the value is monotonically increasing as there MUST NOT exist swap requests with same Id
    // Note: swapId must be set to start accepting swap requests.
    uint256 public swapId;
    // The starting swap Id of the XSwapper
    // Note: It is immutable after setting startSwapId
    uint256 public startSwapId;
    // Note: swapIdIsSet should only be set to True and freeze once in function `setStartSwapId`
    bool public swapIdIsSet;
    // Accept swap requests or not
    bool public acceptSwapRequest;
    // Close status of each swap
    mapping (bytes32 => bool) everClosed;

    // Supported YPool tokens
    mapping (address => bool) public YPoolSupportedToken;
    // YPoolVault of a YPoolSupportedToken
    mapping (address => address) public YPoolVaults;
    // Whitelist of AggregatorAdaptors
    mapping (address => bool) public isWhitelistedAggregatorAdaptor;
    // SwapValidator contract on XYChain that validates a `closeSwap` transaction
    // Note: this contract does not exist on periphery chains so its address is used only for signature verification purpose in `claim` and `batchClaim`
    address public swapValidatorXYChain;

    // Fees setting of a supported token on each chain
    mapping (bytes32 => FeeStructure) public feeStructures;
    // All swap requests initiated by users
    mapping (uint256 => SwapRequest) public swapRequests;

    receive() external payable {}
    function _authorizeUpgrade(address) internal override onlyRole(ROLE_OWNER) {}

    /// @notice Initialize XSwapper
    /// @param owner The owner address
    /// @param manager The manager address
    /// @param staff The staff address
    /// @param worker The swap worker address
    /// @param _supervisor The supervisor contract address
    /// @param _chainId The chain ID
    function initialize(address owner, address manager, address staff, address worker, address _supervisor, uint32 _chainId) initializer public {
        require(Address.isContract(_supervisor), "ERR_SUPERVISOR_NOT_CONTRACT");
        supervisor = Supervisor(_supervisor);
        chainId = _chainId;
        acceptSwapRequest = false;

        // Validate chainId
        uint256 _realChainId;
        assembly {
            _realChainId := chainid()
        }
        require(_chainId == _realChainId, "ERR_WRONG_CHAIN_ID");

        _setRoleAdmin(ROLE_OWNER, ROLE_OWNER);
        _setRoleAdmin(ROLE_MANAGER, ROLE_OWNER);
        _setRoleAdmin(ROLE_STAFF, ROLE_OWNER);
        _setRoleAdmin(ROLE_YPOOL_WORKER, ROLE_OWNER);
        _setupRole(ROLE_OWNER, owner);
        _setupRole(ROLE_MANAGER, manager);
        _setupRole(ROLE_STAFF, staff);
        _setupRole(ROLE_YPOOL_WORKER, worker);
    }

    /* ========== MODIFIERS ========== */

    modifier acceptSwap() {
        require(acceptSwapRequest, "ERR_NOT_ACCEPTING_SWAP_REQUESTS");
        _;
    }

    /* ========== PRIVATE FUNCTIONS ========== */

    function max(uint256 a, uint256 b) private pure returns (uint256) {
        return a >= b ? a : b;
    }

    function min(uint256 a, uint256 b) private pure returns (uint256) {
        return a < b ? a : b;
    }

    /// @notice Get the XY protocol fee setting of `_token` on chain `_toChainId`
    /// @param _toChainId Chain Id of the periphery chain
    /// @param _token YPool token
    function _getFeeStructure(uint32 _toChainId, address _token) private view returns (FeeStructure memory) {
        bytes32 universalTokenId = keccak256(abi.encodePacked(_toChainId, _token));
        return feeStructures[universalTokenId];
    }

    function _safeTransferAsset(address receiver, IERC20 token, uint256 amount) private {
        if (address(token) == ETHER_ADDRESS) {
            payable(receiver).transfer(amount);
        } else {
            token.safeTransfer(receiver, amount);
        }
    }

    function _safeTransferFromAsset(IERC20 fromToken, address from, uint256 amount) private {
        if (address(fromToken) == ETHER_ADDRESS)
            require(msg.value == amount, "ERR_INVALID_AMOUNT");
        else {
            uint256 _fromTokenBalance = getTokenBalance(fromToken, address(this));
            fromToken.safeTransferFrom(from, address(this), amount);
            require(getTokenBalance(fromToken, address(this)) - _fromTokenBalance == amount, "ERR_INVALID_AMOUNT");
        }
    }

    /// @notice Check whether the swap amount reaches the threshold or not
    /// @param _toChainId Chain Id of the target chain
    /// @param token YPool token
    /// @param amount Swap amount
    /// @dev A swap could be closed by YPool worker on target chain or get refunded on source chain, i.e., this chain,
    /// therefore, we require the `amount` not only be GTE the fee on target chain but also on source chain
    function _checkMinimumSwapAmount(uint32 _toChainId, IERC20 token, uint256 amount) private view returns (bool) {
        FeeStructure memory feeStructure = _getFeeStructure(_toChainId, address(token));
        require(feeStructure.isSet, "ERR_FEE_NOT_SET");
        uint256 minToChainFee = feeStructure.min;  // closeSwap

        feeStructure = _getFeeStructure(chainId, address(token));
        require(feeStructure.isSet, "ERR_FEE_NOT_SET");
        uint256 minFromChainFee = feeStructure.min;  // refund

        return amount >= max(minToChainFee, minFromChainFee);
    }

    /// @notice Calculate the XY protocol fee and gas fee
    /// @param _chainId Chain Id of the periphery chain
    /// @param token YPool token
    /// @param amount YPool token amount
    function _calculateFee(uint32 _chainId, IERC20 token, uint256 amount) private view returns (uint256 xyFee, uint256 gasFee) {
        FeeStructure memory feeStructure = _getFeeStructure(_chainId, address(token));
        require(feeStructure.isSet, "ERR_FEE_NOT_SET");

        xyFee = amount * feeStructure.rate / (10 ** feeStructure.decimals);
        xyFee = min(max(xyFee, feeStructure.min), feeStructure.max);
        gasFee = feeStructure.gas;
    }

    /* ========== VIEW FUNCTIONS ========== */

    /// @notice Get a certain swap request
    /// @dev TODO: Though swapRequests is a public mapping, here we keep getSwapRequest for those applications that need this interface. Should be removed since next upgrade.
    /// @param _swapId Swap Id of a swap request
    function getSwapRequest(uint256 _swapId) external view returns (SwapRequest memory) {
        return swapRequests[_swapId];
    }

    /// @notice Get the XY protocol fee setting of `_token` on chain `_toChainId`
    /// @param _chainId Chain Id of the periphery chain
    /// @param _token YPool token
    function getFeeStructure(uint32 _chainId, address _token) external view returns (FeeStructure memory) {
        FeeStructure memory feeStructure = _getFeeStructure(_chainId, _token);
        require(feeStructure.isSet, "ERR_FEE_NOT_SET");
        return feeStructure;
    }

    /// @notice Check whether a swap is closed or not on this chain, assuming this chain is the target chain
    /// @param _chainId Chain Id of the source chain
    /// @param _swapId Swap Id of a swap request
    function getEverClosed(uint32 _chainId, uint256 _swapId) external view returns (bool) {
        bytes32 universalSwapId = keccak256(abi.encodePacked(_chainId, _swapId));
        return everClosed[universalSwapId];
    }

    /// @notice Get the token or native token balance of given account
    /// @param _token ERC20 token address or ETHER_ADDRESS which stands for native token
    /// @param _account YPool token
    function getTokenBalance(IERC20 _token, address _account) public view returns (uint256 balance) {
        balance = address(_token) == ETHER_ADDRESS ? _account.balance : _token.balanceOf(_account);
    }

    /* ========== RESTRICTED FUNCTIONS (OWNER) ========== */

    /// @notice Set start swapId
    /// @dev swapId can only be set once and before any swap request comes in
    /// @param _swapId Swap Id of a swap request
    function setStartSwapId(uint256 _swapId) external onlyRole(ROLE_OWNER) {
        require(!swapIdIsSet, "ERR_SWAP_ID_ALREADY_SET");
        swapIdIsSet = true;
        startSwapId = _swapId;
        swapId = _swapId;
        emit StartSwapIdSet(_swapId);
    }

    /// @notice Set YPoolVault and its token
    /// @param _supportedToken YPool token
    /// @param _vault Address of the YPoolVault
    /// @param _isSet To Add or to remove
    function setYPoolVault(address _supportedToken, address _vault, bool _isSet) external onlyRole(ROLE_OWNER) {
        if (_supportedToken != ETHER_ADDRESS) {
            require(Address.isContract(_supportedToken), "ERR_YPOOL_TOKEN_NOT_CONTRACT");
        }
        require(Address.isContract(_vault), "ERR_YPOOL_VAULT_NOT_CONTRACT");
        YPoolSupportedToken[_supportedToken] = _isSet;
        YPoolVaults[_supportedToken] = _vault;
        emit YPoolVaultSet(_supportedToken, _vault, _isSet);
    }

    /// @notice Rescue fund accidentally sent to this contract. Can not rescue YPool token
    /// @param tokens List of token address to rescue
    function rescue(IERC20[] memory tokens) external onlyRole(ROLE_OWNER) {
        for (uint256 i; i < tokens.length; i++) {
            IERC20 token = tokens[i];
            require(!YPoolSupportedToken[address(token)], "ERR_CAN_NOT_RESCUE_YPOOL_TOKEN");
            uint256 _tokenBalance = token.balanceOf(address(this));
            token.safeTransfer(msg.sender, _tokenBalance);
        }
    }

    /* ========== RESTRICTED FUNCTIONS (MANAGER) ========== */

    /// @notice Set the maximum swap amount of a YPool token
    /// @param _supportedToken YPool token
    /// @param amount Maximum swap amount
    function setMaxYPoolTokenSwapAmount(address _supportedToken, uint256 amount) external onlyRole(ROLE_MANAGER) {
        require(YPoolSupportedToken[_supportedToken], "ERR_INVALID_YPOOL_TOKEN");
        maxYPoolTokenSwapAmount[_supportedToken] = amount;
    }

    /// @notice Set the dex aggregator
    /// @param _aggregatorAdaptor Address of the aggregator
    function setAggregatorAdaptor(address _aggregatorAdaptor, bool _isSet) external onlyRole(ROLE_MANAGER) {
        require(Address.isContract(_aggregatorAdaptor), "ERR_AGGREGATOR_ADAPTOR_NOT_CONTRACT");
        require(isWhitelistedAggregatorAdaptor[_aggregatorAdaptor] != _isSet, "ERR_ALREADY_SET");
        isWhitelistedAggregatorAdaptor[_aggregatorAdaptor] = _isSet;
        emit AggregatorAdaptorSet(_aggregatorAdaptor, _isSet);
    }

    /// @notice Pause the major functions
    function pause() external onlyRole(ROLE_MANAGER) {
        _pause();
    }

    /// @notice Unpause the major functions
    function unpause() external onlyRole(ROLE_MANAGER) {
        _unpause();
    }

    /// @notice Set to accept swap request or not
    function setAcceptSwapRequest(bool _isSet) external onlyRole(ROLE_MANAGER) {
        require(acceptSwapRequest != _isSet, "ERR_ALREADY_SET");
        acceptSwapRequest = _isSet;
        emit AcceptSwapRequestSet(_isSet);
    }

    /* ========== RESTRICTED FUNCTIONS (STAFF) ========== */

    /// @notice Set the XY protocol fee setting of `_token` on chain `_toChainId`
    /// @param _toChainId Chain Id of the periphery chain
    /// @param _supportedToken YPool token
    /// @param _gas Estimated gas fee of closeSwap/refund in form of YPool Token
    /// @param _min Minimum amount of the XY protocol fee of `_supportedToken`
    /// @param _max Maximum amount of the XY protocol fee of `_supportedToken`
    /// @param rate Fee rate of the XY protocol fee of `_supportedToken`
    /// @param decimals Decimals of `_rate`
    function setFeeStructure(uint32 _toChainId, address _supportedToken, uint256 _gas, uint256 _min, uint256 _max, uint256 rate, uint256 decimals) external onlyRole(ROLE_STAFF) {
        if (_supportedToken != ETHER_ADDRESS) {
            require(Address.isContract(_supportedToken), "ERR_YPOOL_TOKEN_NOT_CONTRACT");
        }
        require(_max > _min, "ERR_INVALID_MAX_MIN");
        require(_min >= _gas, "ERR_INVALID_MIN_GAS");
        bytes32 universalTokenId = keccak256(abi.encodePacked(_toChainId, _supportedToken));
        FeeStructure memory feeStructure = FeeStructure(true, _gas, _min, _max, rate, decimals);
        feeStructures[universalTokenId] = feeStructure;
        emit FeeStructureSet(_toChainId, _supportedToken, _gas, _min, _max, rate, decimals);
    }

    /// @notice Set the SwapValidator
    /// @param _swapValidatorXYChain Address of the SwapValidator on XY chain
    function setSwapValidatorXYChain(address _swapValidatorXYChain) external onlyRole(ROLE_STAFF) {
        swapValidatorXYChain = _swapValidatorXYChain;
        emit SwapValidatorXYChainSet(_swapValidatorXYChain);
    }

    /* ========== RESTRICTED FUNCTIONS (YPOOL_WORKER) ========== */

    /// @notice Fulfill a swap request for a user by YPool worker
    /// Closing a swap MUST be performed on target chain and only by YPool worker
    /// @dev swapDesc is the swap info for swapping on DEX on target chain, not the info of the swap request user initiated on source chain
    /// @param aggregatorAdaptor The address of the adaptor of the specific dex aggregator
    /// @param swapDesc Description of the swap on DEX, see IDexAggregatorAdaptor.SwapDescription
    /// @param aggregatorData Raw data consists of instructions to swap user's token for YPool token
    /// @param fromChainId Source chain id of the swap request
    /// @param fromSwapId Swap id of the swap request
    function closeSwap(
        address aggregatorAdaptor,
        IDexAggregatorAdaptor.SwapDescription calldata swapDesc,
        bytes memory aggregatorData,
        uint32 fromChainId,
        uint256 fromSwapId
    ) external payable whenNotPaused nonReentrant onlyRole(ROLE_YPOOL_WORKER) {
        require(YPoolSupportedToken[address(swapDesc.fromToken)], "ERR_INVALID_YPOOL_TOKEN");

        {
            bytes32 universalSwapId = keccak256(abi.encodePacked(fromChainId, fromSwapId));
            require(!everClosed[universalSwapId], "ERR_ALREADY_CLOSED");
            everClosed[universalSwapId] = true;
        }

        require(swapDesc.amount <= maxYPoolTokenSwapAmount[address(swapDesc.fromToken)], "ERR_EXCEED_MAX_SWAP_AMOUNT");
        IYPoolVault(YPoolVaults[address(swapDesc.fromToken)]).transferToSwapper(swapDesc.fromToken, swapDesc.amount);

        uint256 toTokenAmountOut;
        CloseSwapResult swapResult;
        if (swapDesc.toToken == swapDesc.fromToken) {
            toTokenAmountOut = swapDesc.amount;
            swapResult = CloseSwapResult.NonSwapped;
        } else {
            require(isWhitelistedAggregatorAdaptor[aggregatorAdaptor], "ERR_INVALID_AGGREGATOR_ADAPTOR");
            uint256 value = (address(swapDesc.fromToken) == ETHER_ADDRESS) ? swapDesc.amount : 0;
            // If the swapDesc.toToken doest not consist of balanceOf, considered as swap failed
            try this.getTokenBalance(swapDesc.toToken, swapDesc.receiver) returns (uint256 balance) {
                toTokenAmountOut = balance;
                if (address(swapDesc.fromToken) != ETHER_ADDRESS) swapDesc.fromToken.safeApprove(aggregatorAdaptor, swapDesc.amount);
                try IDexAggregatorAdaptor(aggregatorAdaptor).swap{value: value}(swapDesc, aggregatorData) {
                    if (address(swapDesc.fromToken) != ETHER_ADDRESS) swapDesc.fromToken.safeApprove(aggregatorAdaptor, 0);
                    toTokenAmountOut = getTokenBalance(swapDesc.toToken, swapDesc.receiver) - toTokenAmountOut;
                    swapResult = CloseSwapResult.Success;
                } catch {
                    swapResult = CloseSwapResult.Failed;
                }
                if (address(swapDesc.fromToken) != ETHER_ADDRESS) swapDesc.fromToken.safeApprove(aggregatorAdaptor, 0);
            } catch {
                swapResult = CloseSwapResult.Failed;
            }
        }
        if (swapResult != CloseSwapResult.Success) {
            _safeTransferAsset(swapDesc.receiver, swapDesc.fromToken, swapDesc.amount);
        }
        emit CloseSwapCompleted(swapResult, fromChainId, fromSwapId);
        emit SwappedForUser(aggregatorAdaptor, swapDesc.fromToken, swapDesc.amount, swapDesc.toToken, toTokenAmountOut, swapDesc.receiver);
    }

    /* ========== RESTRICTED FUNCTIONS (SIGNATURE REQUIRED) ========== */

    /// @notice Claim the asset of a swap request on source chain after YPool worker `closeSwap` on target chain, by providing signatures of validators
    /// Claiming MUST be performed on source chain
    /// @dev Signatures from validators are first sent to SwapValidator contract on Settlement chain to validate a swap request. Then the signatures can be reused here to approve the claim
    /// @param _swapId Swap id of the swap request
    /// @param signatures Signatures of validators
    function claim(uint256 _swapId, bytes[] memory signatures) external whenNotPaused {
        require(startSwapId <= _swapId && _swapId < swapId, "ERR_INVALID_SWAPID");
        require(swapRequests[_swapId].status != RequestStatus.Closed, "ERR_ALREADY_CLOSED");
        swapRequests[_swapId].status = RequestStatus.Closed;

        bytes32 sigId = keccak256(abi.encodePacked(supervisor.VALIDATE_SWAP_IDENTIFIER(), address(this), address(swapValidatorXYChain), chainId, _swapId));
        bytes32 sigIdHash = sigId.toEthSignedMessageHash();
        supervisor.checkSignatures(sigIdHash, signatures);

        SwapRequest memory request = swapRequests[_swapId];
        IYPoolVault yPoolVault = IYPoolVault(YPoolVaults[address(request.YPoolToken)]);
        uint256 value = (address(request.YPoolToken) == ETHER_ADDRESS) ? request.YPoolTokenAmount : 0;
        if (address(request.YPoolToken) != ETHER_ADDRESS) {
            request.YPoolToken.safeApprove(address(yPoolVault), request.YPoolTokenAmount);
        }
        yPoolVault.receiveAssetFromSwapper{value: value}(request.YPoolToken, request.YPoolTokenAmount, request.xyFee, request.gasFee);

        emit SwapCompleted(CompleteSwapType.Claimed, request);
    }

    /// @notice Claim the asset of multiple swap requests on source chain after YPool worker `closeSwap` on eacg target chain, by providing signatures of validators
    /// Claiming MUST be performed on source chain
    /// @dev YPool token of the swap request MUST be the same
    /// @dev Validators sign to the array of swap ids, which is different from signing for `claim`
    /// @param _swapIds Swap ids of the swap requests
    /// @param _YPoolToken Y Pool token
    /// @param signatures Signatures of validators
    function batchClaim(uint256[] calldata _swapIds, address _YPoolToken, bytes[] memory signatures) external whenNotPaused {
        require(YPoolSupportedToken[_YPoolToken], "ERR_INVALID_YPOOL_TOKEN");
        bytes32 sigId = keccak256(abi.encodePacked(supervisor.BATCH_CLAIM_IDENTIFIER(), address(this), address(swapValidatorXYChain), chainId, _swapIds));
        bytes32 sigIdHash = sigId.toEthSignedMessageHash();
        supervisor.checkSignatures(sigIdHash, signatures);

        IERC20 YPoolToken = IERC20(_YPoolToken);
        uint256 totalClaimedAmount;
        uint256 totalXYFee;
        uint256 totalGasFee;
        uint256 _startSwapId = startSwapId;
        for (uint256 i; i < _swapIds.length; i++) {
            uint256 _swapId = _swapIds[i];
            require(_startSwapId <= _swapId && _swapId < swapId, "ERR_INVALID_SWAPID");
            SwapRequest memory request = swapRequests[_swapId];
            require(request.status != RequestStatus.Closed, "ERR_ALREADY_CLOSED");
            require(request.YPoolToken == YPoolToken, "ERR_WRONG_YPOOL_TOKEN");
            totalClaimedAmount += request.YPoolTokenAmount;
            totalXYFee += request.xyFee;
            totalGasFee += request.gasFee;
            swapRequests[_swapId].status = RequestStatus.Closed;
            emit SwapCompleted(CompleteSwapType.FreeClaimed, request);
        }

        IYPoolVault yPoolVault = IYPoolVault(YPoolVaults[_YPoolToken]);
        uint256 value = (_YPoolToken == ETHER_ADDRESS) ? totalClaimedAmount : 0;
        if (_YPoolToken != ETHER_ADDRESS) {
            YPoolToken.safeApprove(address(yPoolVault), totalClaimedAmount);
        }
        yPoolVault.receiveAssetFromSwapper{value: value}(YPoolToken, totalClaimedAmount, totalXYFee, totalGasFee);
    }

    /// @notice Lock an expired swap request by providing signatures of validators
    /// Locking a swap MUST be performed on target chain to prevent YPool worker from closing an expired swap request
    /// @dev Signature collector collects signature from different validators off-chain and call this function
    /// @param fromChainId Source chain id of the swap request
    /// @param fromSwapId Swap id of the swap request
    /// @param signatures Signatures of validators
    function lockCloseSwap(uint32 fromChainId, uint256 fromSwapId, bytes[] memory signatures) external whenNotPaused {
        bytes32 universalSwapId = keccak256(abi.encodePacked(fromChainId, fromSwapId));
        require(!everClosed[universalSwapId], "ERR_ALREADY_CLOSED");
        bytes32 sigId = keccak256(abi.encodePacked(supervisor.LOCK_CLOSE_SWAP_AND_REFUND_IDENTIFIER(), address(this), fromChainId, fromSwapId));
        bytes32 sigIdHash = sigId.toEthSignedMessageHash();
        supervisor.checkSignatures(sigIdHash, signatures);

        everClosed[universalSwapId] = true;
        emit CloseSwapCompleted(CloseSwapResult.Locked, fromChainId, fromSwapId);
    }

    /// @notice Refund user if a swap request is expired or invalidated by providing signatures of validators
    /// A portion of refund will be taken away as gas fee compensation to execute the refund
    /// Refund MUST be performed on source chain
    /// @param _swapId Swap id of the swap request
    /// @param gasFeeReceiver Address that receives gas fees
    /// @param signatures Signatures of validators
    function refund(uint256 _swapId, address gasFeeReceiver, bytes[] memory signatures) external whenNotPaused {
        require(_swapId < swapId, "ERR_INVALID_SWAPID");
        require(swapRequests[_swapId].status != RequestStatus.Closed, "ERR_ALREADY_CLOSED");
        swapRequests[_swapId].status = RequestStatus.Closed;

        bytes32 sigId = keccak256(abi.encodePacked(supervisor.LOCK_CLOSE_SWAP_AND_REFUND_IDENTIFIER(), address(this), chainId, _swapId, gasFeeReceiver));
        bytes32 sigIdHash = sigId.toEthSignedMessageHash();
        supervisor.checkSignatures(sigIdHash, signatures);

        SwapRequest memory request = swapRequests[_swapId];
        (, uint256 refundGasFee) = _calculateFee(chainId, request.YPoolToken, request.YPoolTokenAmount);
        _safeTransferAsset(request.sender, request.YPoolToken, request.YPoolTokenAmount - refundGasFee);
        _safeTransferAsset(gasFeeReceiver, request.YPoolToken, refundGasFee);

        emit SwapCompleted(CompleteSwapType.Refunded, request);
    }

    /* ========== WRITE FUNCTIONS ========== */

    /// @notice This functions is called by user to initiate a swap. User swaps his/her token for YPool token on this chain and provide info for the swap on target chain. A swap request will be created for each swap.
    /// @dev swapDesc is the swap info for swapping on DEX on this chain, not the swap request
    /// @param aggregatorAdaptor The address of the adaptor of the specific dex aggregator
    /// @param swapDesc Description of the swap on DEX, see IDexAggregatorAdaptor.SwapDescription
    /// @param aggregatorData Raw data consists of instructions to swap user's token for YPool token
    /// @param toChainDesc Description of the swap on target chain, see ToChainDescription
    function swap(
        address aggregatorAdaptor,
        IDexAggregatorAdaptor.SwapDescription memory swapDesc,
        bytes memory aggregatorData,
        ToChainDescription calldata toChainDesc
    ) external payable acceptSwap whenNotPaused nonReentrant {
        require(swapIdIsSet, "ERR_SWAP_ID_NOT_SET");
        address receiver = swapDesc.receiver;
        IERC20 fromToken = swapDesc.fromToken;
        IERC20 YPoolToken = swapDesc.toToken;
        require(YPoolSupportedToken[address(YPoolToken)], "ERR_INVALID_YPOOL_TOKEN");

        uint256 fromTokenAmount = swapDesc.amount;
        uint256 yBalance;
        _safeTransferFromAsset(fromToken, msg.sender, fromTokenAmount);
        if (fromToken == YPoolToken) {
            yBalance = fromTokenAmount;
        } else {
            require(isWhitelistedAggregatorAdaptor[aggregatorAdaptor], "ERR_INVALID_AGGREGATOR_ADAPTOR");
            yBalance = getTokenBalance(YPoolToken, address(this));
            swapDesc.receiver = address(this);
            if (address(fromToken) != ETHER_ADDRESS) fromToken.safeApprove(aggregatorAdaptor, fromTokenAmount);
            IDexAggregatorAdaptor(aggregatorAdaptor).swap{value: msg.value}(swapDesc, aggregatorData);
            if (address(fromToken) != ETHER_ADDRESS) fromToken.safeApprove(aggregatorAdaptor, 0);
            yBalance = getTokenBalance(YPoolToken, address(this)) - yBalance;
        }
        require(_checkMinimumSwapAmount(toChainDesc.toChainId, YPoolToken, yBalance), "ERR_NOT_ENOUGH_SWAP_AMOUNT");
        require(yBalance <= maxYPoolTokenSwapAmount[address(YPoolToken)], "ERR_EXCEED_MAX_SWAP_AMOUNT");

        // Calculate XY fee and gas fee for closeSwap on toChain
        // NOTE: XY fee already includes gas fee and gas fee is computed here only for bookkeeping purpose
        (uint256 xyFee, uint256 closeSwapGasFee) = _calculateFee(toChainDesc.toChainId, YPoolToken, yBalance);
        SwapRequest memory request = SwapRequest(toChainDesc.toChainId, swapId, receiver, msg.sender, yBalance, xyFee, closeSwapGasFee, YPoolToken, RequestStatus.Open);
        swapRequests[swapId] = request;
        emit SwapRequested(swapId++, aggregatorAdaptor, toChainDesc, fromToken, YPoolToken, yBalance, receiver, xyFee, closeSwapGasFee);
    }

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

    // Owner events
    event StartSwapIdSet(uint256 _swapId);
    event FeeStructureSet(uint32 _toChainId, address _YPoolToken, uint256 _gas, uint256 _min, uint256 _max, uint256 _rate, uint256 _decimals);
    event YPoolVaultSet(address _supportedToken, address _vault, bool _isSet);
    event AggregatorAdaptorSet(address _aggregator, bool _isSet);
    event SwapValidatorXYChainSet(address _swapValidatorXYChain);
    event AcceptSwapRequestSet(bool _isSet);
    // Swap events
    event SwapRequested(uint256 _swapId, address indexed _aggregatorAdaptor, ToChainDescription _toChainDesc, IERC20 _fromToken, IERC20 indexed _YPoolToken, uint256 _YPoolTokenAmount, address _receiver, uint256 _xyFee, uint256 _gasFee);
    event SwapCompleted(CompleteSwapType _closeType, SwapRequest _swapRequest);
    event CloseSwapCompleted(CloseSwapResult _swapResult, uint32 _fromChainId, uint256 _fromSwapId);
    event SwappedForUser(address indexed _aggregatorAdaptor, IERC20 indexed _fromToken, uint256 _fromTokenAmount, IERC20 _toToken, uint256 _toTokenAmountOut, address _receiver);
}
        

IERC20Metadata.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
          

IYPoolVault.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.2;

import { IERC20 } from "ERC20.sol";

interface IYPoolVault {
    function transferToSwapper(IERC20 token, uint256 amount) external;
    function receiveAssetFromSwapper(IERC20 token, uint256 amount, uint256 xyFeeAmount, uint256 gasFeeAmount) external payable;
}
          

Context.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

AccessControlUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IAccessControlUpgradeable.sol";
import "ContextUpgradeable.sol";
import "StringsUpgradeable.sol";
import "ERC165Upgradeable.sol";
import "Initializable.sol";

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

    function __AccessControl_init_unchained() internal initializer {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}
          

Address.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

AddressUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

ContextUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
import "Initializable.sol";

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}
          

ECDSA.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}
          

ERC165Upgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IERC165Upgradeable.sol";
import "Initializable.sol";

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

    function __ERC165_init_unchained() internal initializer {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}
          

ERC1967UpgradeUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.2;

import "IBeaconUpgradeable.sol";
import "AddressUpgradeable.sol";
import "StorageSlotUpgradeable.sol";
import "Initializable.sol";

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

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

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

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

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

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

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

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

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallSecure(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        address oldImplementation = _getImplementation();

        // Initial upgrade and setup call
        _setImplementation(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }

        // Perform rollback test if not already in progress
        StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT);
        if (!rollbackTesting.value) {
            // Trigger rollback using upgradeTo from the new implementation
            rollbackTesting.value = true;
            _functionDelegateCall(
                newImplementation,
                abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
            );
            rollbackTesting.value = false;
            // Check rollback was effective
            require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
            // Finally reset to the new implementation and log the upgrade
            _upgradeTo(newImplementation);
        }
    }

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

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

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

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

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

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

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

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

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

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

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

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

ERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IERC20.sol";
import "IERC20Metadata.sol";
import "Context.sol";

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

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

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

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

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

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

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

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

IAccessControlUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

IBeaconUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

IDexAggregatorAdaptor.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.2;
pragma experimental ABIEncoderV2;

import { IERC20 } from "ERC20.sol";

interface IDexAggregatorAdaptor {
    struct SwapDescription {
        IERC20 fromToken;
        IERC20 toToken;
        address receiver;
        uint256 amount;
        uint256 minReturnAmount;
    }
    // spec:
    //    (revert if any of the following steps fails)
    //    1. IDexAggregatorAdaptor receives `amountIn` `fromToken` where `amountIn >= amount`.
    //    2. IDexAggregatorAdaptor receives `amountOut` `toToken` where `amountOut >= minReturnAmount`.
    //    3. `receiver` receives `amountOut` `toToken`.
    function swap(SwapDescription calldata desc, bytes calldata data) external payable returns (uint256 returnAmount);
}
          

IERC165Upgradeable.sol

// SPDX-License-Identifier: MIT

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

IERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

Initializable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}
          

PausableUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "ContextUpgradeable.sol";
import "Initializable.sol";

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal initializer {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal initializer {
        _paused = false;
    }

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

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

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

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

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

ReentrancyGuard.sol

// SPDX-License-Identifier: MIT

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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

SafeERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IERC20.sol";
import "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");
        }
    }
}
          

StorageSlotUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

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

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

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

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

StringsUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

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

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

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

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

Supervisor.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.2;

import "ECDSA.sol";

/// @title Supervisor is the guardian of YPool. It requires multiple validators to valid
/// the requests from users and workers and sign on them if valid.
contract Supervisor {
    using ECDSA for bytes32;

    /* ========== STATE VARIABLES ========== */

    bytes32 public constant CLAIM_IDENTIFIER = 'SWAPPER_CLAIM';
    bytes32 public constant SET_THRESHOLD_IDENTIFIER = 'SET_THRESHOLD';
    bytes32 public constant SET_VALIDATOR_IDENTIFIER = 'SET_VALIDATOR';
    bytes32 public constant LOCK_CLOSE_SWAP_AND_REFUND_IDENTIFIER = 'LOCK_CLOSE_SWAP_AND_REFUND';
    bytes32 public constant BATCH_CLAIM_IDENTIFIER = 'BATCH_CLAIM';
    bytes32 public constant VALIDATE_SWAP_IDENTIFIER = 'VALIDATE_SWAP_IDENTIFIER';
    bytes32 public constant VALIDATE_XY_CROSS_CHAIN_IDENTIFIER = 'VALIDATE_XY_XCHAIN_IDENTIFIER';

    // the chain ID contract located at
    uint32 public chainId;
    // check if the address is one of the validators
    mapping (address => bool) public validators;
    // number of validators
    uint256 private validatorsNum;
    // threshold to pass the signature validation
    uint256 public threshold;
    // current nonce for write functions
    uint256 public nonce;

    /// @dev Constuctor with chainId / validators / threshold
    /// @param _chainId The chain ID located with
    /// @param _validators Initial validator addresses
    /// @param _threshold Initial threshold to pass the request validation
    constructor(uint32 _chainId, address [] memory _validators, uint256 _threshold) {
        chainId = _chainId;

        for (uint256 i; i < _validators.length; i++) {
            validators[_validators[i]] = true;
        }
        validatorsNum = _validators.length;
        require(_threshold <= validatorsNum, "ERR_INVALID_THRESHOLD");
        threshold = _threshold;
    }

    /* ========== VIEW FUNCTIONS ========== */

    /// @notice Check if there are enough signed signatures to the signature hash
    /// @param sigIdHash The signature hash to be signed
    /// @param signatures Signed signatures by different validators
    function checkSignatures(bytes32 sigIdHash, bytes[] memory signatures) public view {
        require(signatures.length >= threshold, "ERR_NOT_ENOUGH_SIGNATURES");
        address prevAddress = address(0);
        for (uint i; i < threshold; i++) {
            address recovered = sigIdHash.recover(signatures[i]);
            require(validators[recovered], "ERR_NOT_VALIDATOR");
            require(recovered > prevAddress, "ERR_WRONG_SIGNER_ORDER");
            prevAddress = recovered;
        }
    }

    /* ========== WRITE FUNCTIONS ========== */

    /// @notice Change `threshold` by providing a correct nonce and enough signatures from validators
    /// @param _threshold New `threshold`
    /// @param _nonce The nonce to be processed
    /// @param signatures Signed signatures by validators
    function setThreshold(uint256 _threshold, uint256 _nonce, bytes[] memory signatures) external {
        require(signatures.length >= threshold, "ERR_NOT_ENOUGH_SIGNATURES");
        require(_nonce == nonce, "ERR_INVALID_NONCE");
        require(_threshold > 0, "ERR_INVALID_THRESHOLD");
        require(_threshold <= validatorsNum, "ERR_INVALID_THRESHOLD");

        bytes32 sigId = keccak256(abi.encodePacked(SET_THRESHOLD_IDENTIFIER, address(this), chainId, _threshold, _nonce));
        bytes32 sigIdHash = sigId.toEthSignedMessageHash();
        checkSignatures(sigIdHash, signatures);

        threshold = _threshold;
        nonce++;
    }

    /// @notice Set / remove the validator address to be part of signatures committee
    /// @param _validator The address to add or remove
    /// @param flag `true` to add, `false` to remove
    /// @param _nonce The nonce to be processed
    /// @param signatures Signed signatures by validators
    function setValidator(address _validator, bool flag, uint256 _nonce, bytes[] memory signatures) external {
        require(_validator != address(0), "ERR_INVALID_VALIDATOR");
        require(signatures.length >= threshold, "ERR_NOT_ENOUGH_SIGNATURES");
        require(_nonce == nonce, "ERR_INVALID_NONCE");
        require(flag != validators[_validator], "ERR_OPERATION_TO_VALIDATOR");

        bytes32 sigId = keccak256(abi.encodePacked(SET_VALIDATOR_IDENTIFIER, address(this), chainId, _validator, flag, _nonce));
        bytes32 sigIdHash = sigId.toEthSignedMessageHash();
        checkSignatures(sigIdHash, signatures);

        if (validators[_validator]) {
            validatorsNum--;
            validators[_validator] = false;
            if (validatorsNum < threshold) threshold--;
        } else {
            validatorsNum++;
            validators[_validator] = true;
        }
        nonce++;
    }
}
          

UUPSUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "ERC1967UpgradeUpgradeable.sol";
import "Initializable.sol";

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

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

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

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

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

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

Contract ABI

[{"type":"event","name":"AcceptSwapRequestSet","inputs":[{"type":"bool","name":"_isSet","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"AggregatorAdaptorSet","inputs":[{"type":"address","name":"_aggregator","internalType":"address","indexed":false},{"type":"bool","name":"_isSet","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"CloseSwapCompleted","inputs":[{"type":"uint8","name":"_swapResult","internalType":"enum XSwapper.CloseSwapResult","indexed":false},{"type":"uint32","name":"_fromChainId","internalType":"uint32","indexed":false},{"type":"uint256","name":"_fromSwapId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FeeStructureSet","inputs":[{"type":"uint32","name":"_toChainId","internalType":"uint32","indexed":false},{"type":"address","name":"_YPoolToken","internalType":"address","indexed":false},{"type":"uint256","name":"_gas","internalType":"uint256","indexed":false},{"type":"uint256","name":"_min","internalType":"uint256","indexed":false},{"type":"uint256","name":"_max","internalType":"uint256","indexed":false},{"type":"uint256","name":"_rate","internalType":"uint256","indexed":false},{"type":"uint256","name":"_decimals","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"StartSwapIdSet","inputs":[{"type":"uint256","name":"_swapId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SwapCompleted","inputs":[{"type":"uint8","name":"_closeType","internalType":"enum XSwapper.CompleteSwapType","indexed":false},{"type":"tuple","name":"_swapRequest","internalType":"struct XSwapper.SwapRequest","indexed":false,"components":[{"type":"uint32","name":"toChainId","internalType":"uint32"},{"type":"uint256","name":"swapId","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"YPoolTokenAmount","internalType":"uint256"},{"type":"uint256","name":"xyFee","internalType":"uint256"},{"type":"uint256","name":"gasFee","internalType":"uint256"},{"type":"address","name":"YPoolToken","internalType":"contract IERC20"},{"type":"uint8","name":"status","internalType":"enum XSwapper.RequestStatus"}]}],"anonymous":false},{"type":"event","name":"SwapRequested","inputs":[{"type":"uint256","name":"_swapId","internalType":"uint256","indexed":false},{"type":"address","name":"_aggregatorAdaptor","internalType":"address","indexed":true},{"type":"tuple","name":"_toChainDesc","internalType":"struct XSwapper.ToChainDescription","indexed":false,"components":[{"type":"uint32","name":"toChainId","internalType":"uint32"},{"type":"address","name":"toChainToken","internalType":"contract IERC20"},{"type":"uint256","name":"expectedToChainTokenAmount","internalType":"uint256"},{"type":"uint32","name":"slippage","internalType":"uint32"}]},{"type":"address","name":"_fromToken","internalType":"contract IERC20","indexed":false},{"type":"address","name":"_YPoolToken","internalType":"contract IERC20","indexed":true},{"type":"uint256","name":"_YPoolTokenAmount","internalType":"uint256","indexed":false},{"type":"address","name":"_receiver","internalType":"address","indexed":false},{"type":"uint256","name":"_xyFee","internalType":"uint256","indexed":false},{"type":"uint256","name":"_gasFee","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SwapValidatorXYChainSet","inputs":[{"type":"address","name":"_swapValidatorXYChain","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"SwappedForUser","inputs":[{"type":"address","name":"_aggregatorAdaptor","internalType":"address","indexed":true},{"type":"address","name":"_fromToken","internalType":"contract IERC20","indexed":true},{"type":"uint256","name":"_fromTokenAmount","internalType":"uint256","indexed":false},{"type":"address","name":"_toToken","internalType":"contract IERC20","indexed":false},{"type":"uint256","name":"_toTokenAmountOut","internalType":"uint256","indexed":false},{"type":"address","name":"_receiver","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"YPoolVaultSet","inputs":[{"type":"address","name":"_supportedToken","internalType":"address","indexed":false},{"type":"address","name":"_vault","internalType":"address","indexed":false},{"type":"bool","name":"_isSet","internalType":"bool","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ETHER_ADDRESS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ROLE_MANAGER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ROLE_OWNER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ROLE_STAFF","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ROLE_YPOOL_WORKER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"YPoolSupportedToken","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"YPoolVaults","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"acceptSwapRequest","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchClaim","inputs":[{"type":"uint256[]","name":"_swapIds","internalType":"uint256[]"},{"type":"address","name":"_YPoolToken","internalType":"address"},{"type":"bytes[]","name":"signatures","internalType":"bytes[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"chainId","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[{"type":"uint256","name":"_swapId","internalType":"uint256"},{"type":"bytes[]","name":"signatures","internalType":"bytes[]"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"closeSwap","inputs":[{"type":"address","name":"aggregatorAdaptor","internalType":"address"},{"type":"tuple","name":"swapDesc","internalType":"struct IDexAggregatorAdaptor.SwapDescription","components":[{"type":"address","name":"fromToken","internalType":"contract IERC20"},{"type":"address","name":"toToken","internalType":"contract IERC20"},{"type":"address","name":"receiver","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"minReturnAmount","internalType":"uint256"}]},{"type":"bytes","name":"aggregatorData","internalType":"bytes"},{"type":"uint32","name":"fromChainId","internalType":"uint32"},{"type":"uint256","name":"fromSwapId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"isSet","internalType":"bool"},{"type":"uint256","name":"gas","internalType":"uint256"},{"type":"uint256","name":"min","internalType":"uint256"},{"type":"uint256","name":"max","internalType":"uint256"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"}],"name":"feeStructures","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"getEverClosed","inputs":[{"type":"uint32","name":"_chainId","internalType":"uint32"},{"type":"uint256","name":"_swapId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct XSwapper.FeeStructure","components":[{"type":"bool","name":"isSet","internalType":"bool"},{"type":"uint256","name":"gas","internalType":"uint256"},{"type":"uint256","name":"min","internalType":"uint256"},{"type":"uint256","name":"max","internalType":"uint256"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"}]}],"name":"getFeeStructure","inputs":[{"type":"uint32","name":"_chainId","internalType":"uint32"},{"type":"address","name":"_token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct XSwapper.SwapRequest","components":[{"type":"uint32","name":"toChainId","internalType":"uint32"},{"type":"uint256","name":"swapId","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"YPoolTokenAmount","internalType":"uint256"},{"type":"uint256","name":"xyFee","internalType":"uint256"},{"type":"uint256","name":"gasFee","internalType":"uint256"},{"type":"address","name":"YPoolToken","internalType":"contract IERC20"},{"type":"uint8","name":"status","internalType":"enum XSwapper.RequestStatus"}]}],"name":"getSwapRequest","inputs":[{"type":"uint256","name":"_swapId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"balance","internalType":"uint256"}],"name":"getTokenBalance","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20"},{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"manager","internalType":"address"},{"type":"address","name":"staff","internalType":"address"},{"type":"address","name":"worker","internalType":"address"},{"type":"address","name":"_supervisor","internalType":"address"},{"type":"uint32","name":"_chainId","internalType":"uint32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isWhitelistedAggregatorAdaptor","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lockCloseSwap","inputs":[{"type":"uint32","name":"fromChainId","internalType":"uint32"},{"type":"uint256","name":"fromSwapId","internalType":"uint256"},{"type":"bytes[]","name":"signatures","internalType":"bytes[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxYPoolTokenSwapAmount","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"refund","inputs":[{"type":"uint256","name":"_swapId","internalType":"uint256"},{"type":"address","name":"gasFeeReceiver","internalType":"address"},{"type":"bytes[]","name":"signatures","internalType":"bytes[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescue","inputs":[{"type":"address[]","name":"tokens","internalType":"contract IERC20[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAcceptSwapRequest","inputs":[{"type":"bool","name":"_isSet","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAggregatorAdaptor","inputs":[{"type":"address","name":"_aggregatorAdaptor","internalType":"address"},{"type":"bool","name":"_isSet","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeStructure","inputs":[{"type":"uint32","name":"_toChainId","internalType":"uint32"},{"type":"address","name":"_supportedToken","internalType":"address"},{"type":"uint256","name":"_gas","internalType":"uint256"},{"type":"uint256","name":"_min","internalType":"uint256"},{"type":"uint256","name":"_max","internalType":"uint256"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxYPoolTokenSwapAmount","inputs":[{"type":"address","name":"_supportedToken","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStartSwapId","inputs":[{"type":"uint256","name":"_swapId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSwapValidatorXYChain","inputs":[{"type":"address","name":"_swapValidatorXYChain","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setYPoolVault","inputs":[{"type":"address","name":"_supportedToken","internalType":"address"},{"type":"address","name":"_vault","internalType":"address"},{"type":"bool","name":"_isSet","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startSwapId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract Supervisor"}],"name":"supervisor","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"swap","inputs":[{"type":"address","name":"aggregatorAdaptor","internalType":"address"},{"type":"tuple","name":"swapDesc","internalType":"struct IDexAggregatorAdaptor.SwapDescription","components":[{"type":"address","name":"fromToken","internalType":"contract IERC20"},{"type":"address","name":"toToken","internalType":"contract IERC20"},{"type":"address","name":"receiver","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"minReturnAmount","internalType":"uint256"}]},{"type":"bytes","name":"aggregatorData","internalType":"bytes"},{"type":"tuple","name":"toChainDesc","internalType":"struct XSwapper.ToChainDescription","components":[{"type":"uint32","name":"toChainId","internalType":"uint32"},{"type":"address","name":"toChainToken","internalType":"contract IERC20"},{"type":"uint256","name":"expectedToChainTokenAmount","internalType":"uint256"},{"type":"uint32","name":"slippage","internalType":"uint32"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"swapId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"swapIdIsSet","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"toChainId","internalType":"uint32"},{"type":"uint256","name":"swapId","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"YPoolTokenAmount","internalType":"uint256"},{"type":"uint256","name":"xyFee","internalType":"uint256"},{"type":"uint256","name":"gasFee","internalType":"uint256"},{"type":"address","name":"YPoolToken","internalType":"contract IERC20"},{"type":"uint8","name":"status","internalType":"enum XSwapper.RequestStatus"}],"name":"swapRequests","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"swapValidatorXYChain","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

0x60a06040523060601b60805234801561001757600080fd5b50600161012d5560805160601c615772620000526000396000818161122c0152818161126c01528181611a0e0152611a4e01526157726000f3fe6080604052600436106102b15760003560e01c80638456cb5911610175578063b89bbce7116100dc578063e251975e11610095578063f281de9e1161006f578063f281de9e146109dc578063f54738ef146109fc578063f5b944eb14610a13578063fde3f7dc14610a35576102b8565b8063e251975e14610917578063e53e016e14610937578063f13de4b31461096e576102b8565b8063b89bbce714610859578063bf46f18914610879578063c489744b14610894578063cf1d21c0146108b4578063d547741f146108d6578063d8331e71146108f6576102b8565b80639a8a05921161012e5780639a8a0592146106bf5780639c61d7a4146106f9578063a11531121461078d578063a217fddf146107ad578063acb35532146107c2578063b074751614610846576102b8565b80638456cb59146106085780638ad682af1461061d5780638c5178cf1461063f5780638fc3ab8b1461065f57806391d148541461067f5780639968230b1461069f576102b8565b80634039c8d01161021957806356e4b68b116101d257806356e4b68b1461053e5780635c975abb1461057757806364024b421461058f5780636aa4d6b5146105b15780636c3f3917146105d15780636db4ff46146105f1576102b8565b80634039c8d01461047a57806345756a8c1461048d5780634a23656d146104be5780634f1ef286146104eb5780635136d5a2146104fe57806354192e371461051e576102b8565b806322bf2e241161026b57806322bf2e24146103a5578063248a9ca3146103d55780632f2ff15d1461040557806336568abe146104255780633659cfe6146104455780633f4ba83a14610465576102b8565b8062501e28146102bd57806301ffc9a7146102df578063067f6fec1461031457806312708c7b14610334578063213e4f08146103655780632256612214610385576102b8565b366102b857005b600080fd5b3480156102c957600080fd5b506102dd6102d8366004614ca5565b610a63565b005b3480156102eb57600080fd5b506102ff6102fa366004614bf9565b610ecf565b60405190151581526020015b60405180910390f35b34801561032057600080fd5b506102dd61032f36600461482e565b610f08565b34801561034057600080fd5b506102ff61034f36600461474b565b6101346020526000908152604090205460ff1681565b34801561037157600080fd5b506102dd610380366004614ba5565b611043565b34801561039157600080fd5b506102dd6103a0366004614a04565b611108565b3480156103b157600080fd5b506103c76000805160206156dd83398151915281565b60405190815260200161030b565b3480156103e157600080fd5b506103c76103f0366004614ba5565b60009081526065602052604090206001015490565b34801561041157600080fd5b506102dd610420366004614bd5565b611178565b34801561043157600080fd5b506102dd610440366004614bd5565b6111a3565b34801561045157600080fd5b506102dd61046036600461474b565b611221565b34801561047157600080fd5b506102dd6112ea565b6102dd610488366004614938565b61130b565b34801561049957600080fd5b506102ff6104a836600461474b565b6101366020526000908152604090205460ff1681565b3480156104ca57600080fd5b506104de6104d9366004614ba5565b6118dc565b60405161030b91906152e6565b6102dd6104f9366004614866565b611a03565b34801561050a57600080fd5b506102dd6105193660046147e4565b611ab9565b34801561052a57600080fd5b50610132546102ff90610100900460ff1681565b34801561054a57600080fd5b5061012f5461055f906001600160a01b031681565b6040516001600160a01b03909116815260200161030b565b34801561058357600080fd5b5060fb5460ff166102ff565b34801561059b57600080fd5b506103c76000805160206156fd83398151915281565b3480156105bd57600080fd5b506102dd6105cc366004614d8f565b611c18565b3480156105dd57600080fd5b506102dd6105ec366004614a2f565b611e39565b3480156105fd57600080fd5b506103c76101315481565b34801561061457600080fd5b506102dd611f9f565b34801561062957600080fd5b506103c760008051602061571d83398151915281565b34801561064b57600080fd5b506102dd61065a366004614767565b611fc0565b34801561066b57600080fd5b506102dd61067a366004614ac8565b612246565b34801561068b57600080fd5b506102ff61069a366004614bd5565b612764565b3480156106ab57600080fd5b506102dd6106ba36600461474b565b612791565b3480156106cb57600080fd5b5061012f546106e490600160a01b900463ffffffff1681565b60405163ffffffff909116815260200161030b565b34801561070557600080fd5b50610778610714366004614ba5565b610139602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015463ffffffff9096169694956001600160a01b03948516959385169492939192811690600160a01b900460ff1689565b60405161030b9998979695949392919061537b565b34801561079957600080fd5b506102dd6107a8366004614b6d565b6127f9565b3480156107b957600080fd5b506103c7600081565b3480156107ce57600080fd5b506108176107dd366004614ba5565b6101386020526000908152604090208054600182015460028301546003840154600485015460059095015460ff9094169492939192909186565b6040805196151587526020870195909552938501929092526060840152608083015260a082015260c00161030b565b6102dd6108543660046148b4565b6128ae565b34801561086557600080fd5b506102dd610874366004614d15565b612f86565b34801561088557600080fd5b50610132546102ff9060ff1681565b3480156108a057600080fd5b506103c76108af366004614c21565b6131c4565b3480156108c057600080fd5b5061055f60008051602061569683398151915281565b3480156108e257600080fd5b506102dd6108f1366004614bd5565b613275565b34801561090257600080fd5b506101375461055f906001600160a01b031681565b34801561092357600080fd5b506102dd610932366004614c4e565b61329b565b34801561094357600080fd5b5061055f61095236600461474b565b610135602052600090815260409020546001600160a01b031681565b34801561097a57600080fd5b5061098e610989366004614cfa565b61361b565b60405161030b9190600060c0820190508251151582526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b3480156109e857600080fd5b506102ff6109f7366004614d74565b613683565b348015610a0857600080fd5b506103c76101305481565b348015610a1f57600080fd5b506103c760008051602061567683398151915281565b348015610a4157600080fd5b506103c7610a5036600461474b565b61012e6020526000908152604090205481565b60fb5460ff1615610a8f5760405162461bcd60e51b8152600401610a869061516e565b60405180910390fd5b816101315411158015610aa457506101305482105b610ac05760405162461bcd60e51b8152600401610a86906151f8565b600160008381526101396020526040902060070154600160a01b900460ff166001811115610afe57634e487b7160e01b600052602160045260246000fd5b1415610b1c5760405162461bcd60e51b8152600401610a86906150aa565b600082815261013960209081526040808320600701805460ff60a01b1916600160a01b17905561012f548151633ebd56d760e21b815291516001600160a01b039091169263faf55b5c9260048082019391829003018186803b158015610b8157600080fd5b505afa158015610b95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb99190614bbd565b6101375461012f546040805160208101949094526001600160601b031930606090811b82169286019290925292901b90911660548301526001600160e01b0319600160a01b90910460e01b166068820152606c8101849052608c016040516020818303038152906040528051906020012090506000610c37826136ca565b61012f546040516305a0f88360e41b81529192506001600160a01b031690635a0f883090610c6b9084908790600401614fdc565b60006040518083038186803b158015610c8357600080fd5b505afa158015610c97573d6000803e3d6000fd5b505050600085815261013960209081526040808320815161012081018352815463ffffffff1681526001808301549482019490945260028201546001600160a01b039081169382019390935260038201548316606082015260048201546080820152600582015460a0820152600682015460c0820152600782015492831660e082015293945091610100840191600160a01b900460ff1690811115610d4c57634e487b7160e01b600052602160045260246000fd5b6001811115610d6b57634e487b7160e01b600052602160045260246000fd5b90525060e0810180516001600160a01b03908116600090815261013560205260408120549251939450918116921660008051602061569683398151915214610db4576000610dba565b82608001515b60e08401519091506001600160a01b031660008051602061569683398151915214610e0557610e058284608001518560e001516001600160a01b031661371d9092919063ffffffff16565b60e0830151608084015160a085015160c086015160405163496d674b60e11b81526001600160a01b039485166004820152602481019390935260448301919091526064820152908316906392dace969083906084016000604051808303818588803b158015610e7357600080fd5b505af1158015610e87573d6000803e3d6000fd5b50505050507f7cf616e580913e39d7ffeeb739823ba0799bc2948b9b6043f5127cad95b655c8600084604051610ebe929190615072565b60405180910390a150505050505050565b60006001600160e01b03198216637965db0b60e01b1480610f0057506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b600080516020615676833981519152610f2281335b613874565b823b610f7c5760405162461bcd60e51b815260206004820152602360248201527f4552525f41474752454741544f525f41444150544f525f4e4f545f434f4e54526044820152621050d560ea1b6064820152608401610a86565b6001600160a01b0383166000908152610136602052604090205460ff1615158215151415610fde5760405162461bcd60e51b815260206004820152600f60248201526e11549497d053149150511657d4d155608a1b6044820152606401610a86565b6001600160a01b03831660008181526101366020908152604091829020805460ff19168615159081179091558251938452908301527fddb2d5e2010e584b0d2ead420a90d3915d2bb30a13fb9b880b4844b8d941f0f7910160405180910390a1505050565b60008051602061571d83398151915261105c8133610f1d565b6101325460ff16156110b05760405162461bcd60e51b815260206004820152601760248201527f4552525f535741505f49445f414c52454144595f5345540000000000000000006044820152606401610a86565b610132805460ff191660011790556101318290556101308290556040517fb67f87224c93085f9ebe8dfb5a654d0b5e3b54fa279b250d1492c4fe64e2d60d906110fc9084815260200190565b60405180910390a15050565b6000805160206156768339815191526111218133610f1d565b6001600160a01b0383166000908152610134602052604090205460ff1661115a5760405162461bcd60e51b8152600401610a86906151c1565b506001600160a01b03909116600090815261012e6020526040902055565b6000828152606560205260409020600101546111948133610f1d565b61119e83836138d8565b505050565b6001600160a01b03811633146112135760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a86565b61121d828261395e565b5050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561126a5760405162461bcd60e51b8152600401610a86906150d6565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661129c6139c5565b6001600160a01b0316146112c25760405162461bcd60e51b8152600401610a8690615122565b6112cb816139f3565b604080516000808252602082019092526112e791839190613a0c565b50565b6000805160206156768339815191526113038133610f1d565b6112e7613b57565b61013254610100900460ff166113635760405162461bcd60e51b815260206004820152601f60248201527f4552525f4e4f545f414343455054494e475f535741505f5245515545535453006044820152606401610a86565b60fb5460ff16156113865760405162461bcd60e51b8152600401610a869061516e565b600261012d5414156113da5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a86565b600261012d556101325460ff166114295760405162461bcd60e51b815260206004820152601360248201527211549497d4d5d05417d25117d393d517d4d155606a1b6044820152606401610a86565b60408084015184516020808701516001600160a01b0381166000908152610134909252939020549192909160ff166114735760405162461bcd60e51b8152600401610a86906151c1565b60608601516000611485843384613bea565b826001600160a01b0316846001600160a01b031614156114a6575080611621565b6001600160a01b0389166000908152610136602052604090205460ff1661150f5760405162461bcd60e51b815260206004820152601e60248201527f4552525f494e56414c49445f41474752454741544f525f41444150544f5200006044820152606401610a86565b61151983306131c4565b3060408a015290506001600160a01b03841660008051602061569683398151915214611553576115536001600160a01b0385168a8461371d565b604051638218b58f60e01b81526001600160a01b038a1690638218b58f903490611583908c908c90600401615296565b6020604051808303818588803b15801561159c57600080fd5b505af11580156115b0573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115d59190614bbd565b506001600160a01b03841660008051602061569683398151915214611609576116096001600160a01b0385168a600061371d565b8061161484306131c4565b61161e919061559b565b90505b6116386116316020880188614ce0565b8483613cd3565b6116845760405162461bcd60e51b815260206004820152601a60248201527f4552525f4e4f545f454e4f5547485f535741505f414d4f554e540000000000006044820152606401610a86565b6001600160a01b038316600090815261012e60205260409020548111156116ed5760405162461bcd60e51b815260206004820152601a60248201527f4552525f4558434545445f4d41585f535741505f414d4f554e540000000000006044820152606401610a86565b60008061170761170060208a018a614ce0565b8685613d5f565b60408051610120810190915291935091506000908061172960208c018c614ce0565b63ffffffff1681526101305460208201526001600160a01b03808b1660408301523360608301526080820187905260a0820186905260c08201859052881660e0820152610100016000905261013054600090815261013960209081526040918290208351815463ffffffff191663ffffffff90911617815590830151600180830191909155918301516002820180546001600160a01b03199081166001600160a01b0393841617909155606085015160038401805483169184169190911790556080850151600484015560a0850151600584015560c0850151600684015560e08501516007840180549092169216919091178082556101008501519495508594929360ff60a01b1990911690600160a01b90849081111561185a57634e487b7160e01b600052602160045260246000fd5b02179055505061013080546001600160a01b03808a1693508f16917f7ab36fa3be61b88675b434febef4e25ce3b3f32d121b1c6d11bb0520910e1f45919060006118a3836155f5565b919050558c8b898e8a8a6040516118c097969594939291906152f5565b60405180910390a35050600161012d5550505050505050505050565b6119296040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290529061010082015290565b60008281526101396020908152604091829020825161012081018452815463ffffffff1681526001808301549382019390935260028201546001600160a01b039081169482019490945260038201548416606082015260048201546080820152600582015460a0820152600682015460c0820152600782015493841660e0820152929091610100840191600160a01b900460ff16908111156119db57634e487b7160e01b600052602160045260246000fd5b60018111156119fa57634e487b7160e01b600052602160045260246000fd5b90525092915050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415611a4c5760405162461bcd60e51b8152600401610a86906150d6565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611a7e6139c5565b6001600160a01b031614611aa45760405162461bcd60e51b8152600401610a8690615122565b611aad826139f3565b61121d82826001613a0c565b60008051602061571d833981519152611ad28133610f1d565b6001600160a01b03841660008051602061569683398151915214611b3e57833b611b3e5760405162461bcd60e51b815260206004820152601c60248201527f4552525f59504f4f4c5f544f4b454e5f4e4f545f434f4e5452414354000000006044820152606401610a86565b823b611b8c5760405162461bcd60e51b815260206004820152601c60248201527f4552525f59504f4f4c5f5641554c545f4e4f545f434f4e5452414354000000006044820152606401610a86565b6001600160a01b03848116600081815261013460209081526040808320805460ff191688151590811790915561013583529281902080546001600160a01b03191695891695861790558051938452908301939093528183015290517ff1e53a62d5935afca4762c943ac543a520fbf358eafaac6024bcb3f053f32071916060908290030190a150505050565b60fb5460ff1615611c3b5760405162461bcd60e51b8152600401610a869061516e565b60008383604051602001611c50929190614fbf565b60408051601f198184030181529181528151602092830120600081815261013390935291205490915060ff1615611c995760405162461bcd60e51b8152600401610a86906150aa565b61012f5460408051633a44953960e11b815290516000926001600160a01b0316916374892a72916004808301926020929190829003018186803b158015611cdf57600080fd5b505afa158015611cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d179190614bbd565b6040805160208101929092526001600160601b03193060601b16908201526001600160e01b031960e087901b166054820152605881018590526078016040516020818303038152906040528051906020012090506000611d76826136ca565b61012f546040516305a0f88360e41b81529192506001600160a01b031690635a0f883090611daa9084908890600401614fdc565b60006040518083038186803b158015611dc257600080fd5b505afa158015611dd6573d6000803e3d6000fd5b5050506000848152610133602052604090819020805460ff19166001179055517fee823aedb9f54993693aeaca62918fd9eeaf9d0416276706739088c10ceaf2b89150611e299060039089908990615044565b60405180910390a1505050505050565b60008051602061571d833981519152611e528133610f1d565b60005b825181101561119e576000838281518110611e8057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b038116600090815261013490925260409091205490915060ff1615611efa5760405162461bcd60e51b815260206004820152601e60248201527f4552525f43414e5f4e4f545f5245534355455f59504f4f4c5f544f4b454e00006044820152606401610a86565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b158015611f3c57600080fd5b505afa158015611f50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f749190614bbd565b9050611f8a6001600160a01b0383163383613de7565b50508080611f97906155f5565b915050611e55565b600080516020615676833981519152611fb88133610f1d565b6112e7613e17565b600054610100900460ff1680611fd9575060005460ff16155b61203c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a86565b600054610100900460ff16158015612067576000805460ff1961ff0019909116610100171660011790555b823b6120b55760405162461bcd60e51b815260206004820152601b60248201527f4552525f53555045525649534f525f4e4f545f434f4e545241435400000000006044820152606401610a86565b61012f80546001600160a01b0319166001600160a01b0385161763ffffffff60a01b1916600160a01b63ffffffff851690810291909117909155610132805461ff0019169055469081146121405760405162461bcd60e51b815260206004820152601260248201527111549497d5d493d391d7d0d210525397d25160721b6044820152606401610a86565b61215860008051602061571d83398151915280613e6f565b61217e60008051602061567683398151915260008051602061571d833981519152613e6f565b6121a46000805160206156dd83398151915260008051602061571d833981519152613e6f565b6121ca6000805160206156fd83398151915260008051602061571d833981519152613e6f565b6121e260008051602061571d83398151915289613eba565b6121fa60008051602061567683398151915288613eba565b6122126000805160206156dd83398151915287613eba565b61222a6000805160206156fd83398151915286613eba565b50801561223d576000805461ff00191690555b50505050505050565b60fb5460ff16156122695760405162461bcd60e51b8152600401610a869061516e565b6001600160a01b0382166000908152610134602052604090205460ff166122a25760405162461bcd60e51b8152600401610a86906151c1565b61012f546040805163f7ca802360e01b815290516000926001600160a01b03169163f7ca8023916004808301926020929190829003018186803b1580156122e857600080fd5b505afa1580156122fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123209190614bbd565b6101375461012f54604051612359939230926001600160a01b0390911691600160a01b90910463ffffffff16908a908a90602001614e9b565b604051602081830303815290604052805190602001209050600061237c826136ca565b61012f546040516305a0f88360e41b81529192506001600160a01b031690635a0f8830906123b09084908790600401614fdc565b60006040518083038186803b1580156123c857600080fd5b505afa1580156123dc573d6000803e3d6000fd5b5050610131548692506000915081908190815b8a8110156126715760008c8c8381811061241957634e487b7160e01b600052603260045260246000fd5b90506020020135905080831115801561243457506101305481105b6124505760405162461bcd60e51b8152600401610a86906151f8565b600081815261013960209081526040808320815161012081018352815463ffffffff1681526001808301549482019490945260028201546001600160a01b039081169382019390935260038201548316606082015260048201546080820152600582015460a0820152600682015460c0820152600782015492831660e0820152929091610100840191600160a01b90910460ff169081111561250257634e487b7160e01b600052602160045260246000fd5b600181111561252157634e487b7160e01b600052602160045260246000fd5b90525090506001816101000151600181111561254d57634e487b7160e01b600052602160045260246000fd5b141561256b5760405162461bcd60e51b8152600401610a86906150aa565b876001600160a01b03168160e001516001600160a01b0316146125c85760405162461bcd60e51b815260206004820152601560248201527422a9292faba927a723afaca827a7a62faa27a5a2a760591b6044820152606401610a86565b60808101516125d79088615435565b96508060a00151866125e99190615435565b95508060c00151856125fb9190615435565b6000838152610139602052604090819020600701805460ff60a01b1916600160a01b179055519095507f7cf616e580913e39d7ffeeb739823ba0799bc2948b9b6043f5127cad95b655c890612654906001908490615072565b60405180910390a150508080612669906155f5565b9150506123ef565b506001600160a01b03808a16600081815261013560205260408120549092169190600080516020615696833981519152146126ad5760006126af565b855b90506001600160a01b038b16600080516020615696833981519152146126e3576126e36001600160a01b038816838861371d565b60405163496d674b60e11b81526001600160a01b0388811660048301526024820188905260448201879052606482018690528316906392dace969083906084016000604051808303818588803b15801561273c57600080fd5b505af1158015612750573d6000803e3d6000fd5b505050505050505050505050505050505050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b6000805160206156dd8339815191526127aa8133610f1d565b61013780546001600160a01b0319166001600160a01b0384169081179091556040519081527f3623260a18beeff6af38bff0981baf3571a6f16d5b4c8942e8d26c0a166669db906020016110fc565b6000805160206156768339815191526128128133610f1d565b6101325460ff61010090910416151582151514156128645760405162461bcd60e51b815260206004820152600f60248201526e11549497d053149150511657d4d155608a1b6044820152606401610a86565b61013280548315156101000261ff00199091161790556040517fe9c79a92bfc6f0b53c87557fd9c5905d04c4bea7fb8852af1477e25590d330a5906110fc90841515815260200190565b60fb5460ff16156128d15760405162461bcd60e51b8152600401610a869061516e565b600261012d5414156129255760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a86565b600261012d556000805160206156fd8339815191526129448133610f1d565b6101346000612956602088018861474b565b6001600160a01b0316815260208101919091526040016000205460ff1661298f5760405162461bcd60e51b8152600401610a86906151c1565b600083836040516020016129a4929190614fbf565b60408051601f198184030181529181528151602092830120600081815261013390935291205490915060ff16156129ed5760405162461bcd60e51b8152600401610a86906150aa565b6000908152610133602090815260408220805460ff1916600117905561012e9190612a1a9088018861474b565b6001600160a01b03166001600160a01b031681526020019081526020016000205485606001351115612a8e5760405162461bcd60e51b815260206004820152601a60248201527f4552525f4558434545445f4d41585f535741505f414d4f554e540000000000006044820152606401610a86565b6101356000612aa0602088018861474b565b6001600160a01b039081168252602080830193909352604090910160002054169063c2fc211090612ad39088018861474b565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260608801356024820152604401600060405180830381600087803b158015612b1e57600080fd5b505af1158015612b32573d6000803e3d6000fd5b5060009250829150612b499050602088018861474b565b6001600160a01b0316612b626040890160208a0161474b565b6001600160a01b03161415612b7f57505060608501356000612e5a565b6001600160a01b0388166000908152610136602052604090205460ff16612be85760405162461bcd60e51b815260206004820152601e60248201527f4552525f494e56414c49445f41474752454741544f525f41444150544f5200006044820152606401610a86565b6000600080516020615696833981519152612c0660208a018a61474b565b6001600160a01b031614612c1b576000612c21565b87606001355b90503063c489744b612c3960408b0160208c0161474b565b612c4960608c0160408d0161474b565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b158015612c8f57600080fd5b505afa925050508015612cbf575060408051601f3d908101601f19168201909252612cbc91810190614bbd565b60015b612ccc5760029150612e58565b925082600080516020615696833981519152612ceb60208b018b61474b565b6001600160a01b031614612d1f57612d1f8a60608b0135612d0f60208d018d61474b565b6001600160a01b0316919061371d565b604051638218b58f60e01b81526001600160a01b038b1690638218b58f908490612d4f908d908d90600401615224565b6020604051808303818588803b158015612d6857600080fd5b505af193505050508015612d99575060408051601f3d908101601f19168201909252612d9691810190614bbd565b60015b612da65760029250612e19565b50600080516020615696833981519152612dc360208b018b61474b565b6001600160a01b031614612de457612de48a6000612d0f60208d018d61474b565b83612e08612df860408c0160208d0161474b565b6108af60608d0160408e0161474b565b612e12919061559b565b9350600192505b600080516020615696833981519152612e3560208b018b61474b565b6001600160a01b031614612e5657612e568a6000612d0f60208d018d61474b565b505b505b6001816003811115612e7c57634e487b7160e01b600052602160045260246000fd5b14612eab57612eab612e946060890160408a0161474b565b612ea160208a018a61474b565b8960600135613ec4565b7fee823aedb9f54993693aeaca62918fd9eeaf9d0416276706739088c10ceaf2b8818686604051612ede93929190615044565b60405180910390a1612ef3602088018861474b565b6001600160a01b039081169089167f99a830bc8dc28151ad5e29ed2c1b05d46849b76a341bf8e0947a46775ba6b4f960608a0135612f3760408c0160208d0161474b565b86612f4860608e0160408f0161474b565b604080519485526001600160a01b03938416602086015284019190915216606082015260800160405180910390a35050600161012d55505050505050565b6000805160206156dd833981519152612f9f8133610f1d565b6001600160a01b0387166000805160206156968339815191521461300b57863b61300b5760405162461bcd60e51b815260206004820152601c60248201527f4552525f59504f4f4c5f544f4b454e5f4e4f545f434f4e5452414354000000006044820152606401610a86565b8484116130505760405162461bcd60e51b815260206004820152601360248201527222a9292fa4a72b20a624a22fa6a0ac2fa6a4a760691b6044820152606401610a86565b858510156130965760405162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f4d494e5f47415360681b6044820152606401610a86565b600088886040516020016130ab929190614f95565b60408051601f19818403018152828252805160209182012060c08401835260018085528483018c81528585018c8152606087018c8152608088018c815260a089018c81526000878152610138909852968890208951815490151560ff199091161781559351948401949094559051600283015551600382015590516004820155915160059092019190915590519092507fcb4bb3001f7b245a106522f836b6aed77ba72ad177e278f9bb0b46d81d98356c906131b0908c908c908c908c908c908c908c9063ffffffff9790971687526001600160a01b0395909516602087015260408601939093526060850191909152608084015260a083015260c082015260e00190565b60405180910390a150505050505050505050565b60006001600160a01b03831660008051602061569683398151915214613262576040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b15801561322557600080fd5b505afa158015613239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061325d9190614bbd565b61326e565b816001600160a01b0316315b9392505050565b6000828152606560205260409020600101546132918133610f1d565b61119e838361395e565b60fb5460ff16156132be5760405162461bcd60e51b8152600401610a869061516e565b6101305483106132e05760405162461bcd60e51b8152600401610a86906151f8565b600160008481526101396020526040902060070154600160a01b900460ff16600181111561331e57634e487b7160e01b600052602160045260246000fd5b141561333c5760405162461bcd60e51b8152600401610a86906150aa565b600083815261013960209081526040808320600701805460ff60a01b1916600160a01b17905561012f548151633a44953960e11b815291516001600160a01b03909116926374892a729260048082019391829003018186803b1580156133a157600080fd5b505afa1580156133b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133d99190614bbd565b61012f5460408051602081019390935230606090811b6001600160601b031990811692850192909252600160a01b90920460e01b6001600160e01b0319166054840152605883018790529085901b166078820152608c016040516020818303038152906040528051906020012090506000613453826136ca565b61012f546040516305a0f88360e41b81529192506001600160a01b031690635a0f8830906134879084908790600401614fdc565b60006040518083038186803b15801561349f57600080fd5b505afa1580156134b3573d6000803e3d6000fd5b505050600086815261013960209081526040808320815161012081018352815463ffffffff1681526001808301549482019490945260028201546001600160a01b039081169382019390935260038201548316606082015260048201546080820152600582015460a0820152600682015460c0820152600782015492831660e082015293945091610100840191600160a01b900460ff169081111561356857634e487b7160e01b600052602160045260246000fd5b600181111561358757634e487b7160e01b600052602160045260246000fd5b81525050905060006135b561012f60149054906101000a900463ffffffff168360e001518460800151613d5f565b9150506135da82606001518360e001518385608001516135d5919061559b565b613ec4565b6135e9868360e0015183613ec4565b7f7cf616e580913e39d7ffeeb739823ba0799bc2948b9b6043f5127cad95b655c8600283604051610ebe929190615072565b6136566040518060c0016040528060001515815260200160008152602001600081526020016000815260200160008152602001600081525090565b60006136628484613f33565b805190915061326e5760405162461bcd60e51b8152600401610a8690615198565b6000808383604051602001613699929190614fbf565b60408051808303601f190181529181528151602092830120600090815261013390925290205460ff16949350505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b8015806137a65750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561376c57600080fd5b505afa158015613780573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a49190614bbd565b155b6138115760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a86565b6040516001600160a01b03831660248201526044810182905261119e90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613ff4565b61387e8282612764565b61121d57613896816001600160a01b031660146140c6565b6138a18360206140c6565b6040516020016138b2929190614f20565b60408051601f198184030181529082905262461bcd60e51b8252610a8691600401615097565b6138e28282612764565b61121d5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561391a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6139688282612764565b1561121d5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b60008051602061571d83398151915261121d8133610f1d565b6000613a166139c5565b9050613a21846142a8565b600083511180613a2e5750815b15613a3f57613a3d848461434d565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff16613b5057805460ff191660011781556040516001600160a01b0383166024820152613abe90869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b17905261434d565b50805460ff19168155613acf6139c5565b6001600160a01b0316826001600160a01b031614613b475760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610a86565b613b5085614438565b5050505050565b60fb5460ff16613ba05760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a86565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0383166000805160206156968339815191521415613c5257803414613c4d5760405162461bcd60e51b815260206004820152601260248201527111549497d253959053125117d05353d5539560721b6044820152606401610a86565b61119e565b6000613c5e84306131c4565b9050613c756001600160a01b038516843085614478565b8181613c8186306131c4565b613c8b919061559b565b14613ccd5760405162461bcd60e51b815260206004820152601260248201527111549497d253959053125117d05353d5539560721b6044820152606401610a86565b50505050565b600080613ce08585613f33565b8051909150613d015760405162461bcd60e51b8152600401610a8690615198565b604081015161012f54613d2190600160a01b900463ffffffff1686613f33565b8051909250613d425760405162461bcd60e51b8152600401610a8690615198565b6040820151613d5182826144b0565b909410159695505050505050565b6000806000613d6e8686613f33565b8051909150613d8f5760405162461bcd60e51b8152600401610a8690615198565b60a0810151613d9f90600a6154b3565b6080820151613dae908661557c565b613db8919061544d565b9250613dd5613dcb8483604001516144b0565b82606001516144c7565b92508060200151915050935093915050565b6040516001600160a01b03831660248201526044810182905261119e90849063a9059cbb60e01b9060640161383d565b60fb5460ff1615613e3a5760405162461bcd60e51b8152600401610a869061516e565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613bcd3390565b600082815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b61121d82826138d8565b6001600160a01b0382166000805160206156968339815191521415613f1f576040516001600160a01b0384169082156108fc029083906000818181858888f19350505050158015613f19573d6000803e3d6000fd5b5061119e565b61119e6001600160a01b0383168483613de7565b613f6e6040518060c0016040528060001515815260200160008152602001600081526020016000815260200160008152602001600081525090565b60008383604051602001613f83929190614f95565b60408051808303601f1901815282825280516020918201206000908152610138825282902060c084018352805460ff161515845260018101549184019190915260028101549183019190915260038101546060830152600481015460808301526005015460a0820152949350505050565b6000614049826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166144d69092919063ffffffff16565b80519091501561119e57808060200190518101906140679190614b89565b61119e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a86565b606060006140d583600261557c565b6140e0906002615435565b67ffffffffffffffff81111561410657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015614130576020820181803683370190505b509050600360fc1b8160008151811061415957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061419657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006141ba84600261557c565b6141c5906001615435565b90505b6001811115614259576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061420757634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061422b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93614252816155de565b90506141c8565b50831561326e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a86565b803b61430c5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610a86565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b6143ac5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610a86565b600080846001600160a01b0316846040516143c79190614f04565b600060405180830381855af49150503d8060008114614402576040519150601f19603f3d011682016040523d82523d6000602084013e614407565b606091505b509150915061442f82826040518060600160405280602781526020016156b6602791396144ed565b95945050505050565b614441816142a8565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6040516001600160a01b0380851660248301528316604482015260648101829052613ccd9085906323b872dd60e01b9060840161383d565b6000818310156144c0578161326e565b5090919050565b60008183106144c0578161326e565b60606144e58484600085614526565b949350505050565b606083156144fc57508161326e565b82511561450c5782518084602001fd5b8160405162461bcd60e51b8152600401610a869190615097565b6060824710156145875760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a86565b843b6145d55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a86565b600080866001600160a01b031685876040516145f19190614f04565b60006040518083038185875af1925050503d806000811461462e576040519150601f19603f3d011682016040523d82523d6000602084013e614633565b606091505b50915091506146438282866144ed565b979650505050505050565b600082601f83011261465e578081fd5b8135602061467361466e83615411565b6153e0565b82815281810190858301855b858110156146a857614696898684358b01016146b5565b8452928401929084019060010161467f565b5090979650505050505050565b600082601f8301126146c5578081fd5b813567ffffffffffffffff8111156146df576146df61563c565b6146f2601f8201601f19166020016153e0565b818152846020838601011115614706578283fd5b816020850160208301379081016020019190915292915050565b600060808284031215614731578081fd5b50919050565b803563ffffffff81168114610f0357600080fd5b60006020828403121561475c578081fd5b813561326e81615652565b60008060008060008060c0878903121561477f578182fd5b863561478a81615652565b9550602087013561479a81615652565b945060408701356147aa81615652565b935060608701356147ba81615652565b925060808701356147ca81615652565b91506147d860a08801614737565b90509295509295509295565b6000806000606084860312156147f8578283fd5b833561480381615652565b9250602084013561481381615652565b9150604084013561482381615667565b809150509250925092565b60008060408385031215614840578182fd5b823561484b81615652565b9150602083013561485b81615667565b809150509250929050565b60008060408385031215614878578182fd5b823561488381615652565b9150602083013567ffffffffffffffff81111561489e578182fd5b6148aa858286016146b5565b9150509250929050565b60008060008060008587036101208112156148cd578384fd5b86356148d881615652565b955060a0601f19820112156148eb578384fd5b5060208601935060c086013567ffffffffffffffff81111561490b578384fd5b614917888289016146b5565b93505061492660e08701614737565b94979396509194610100013592915050565b60008060008084860361016081121561494f578283fd5b853561495a81615652565b945060a0601f198201121561496d578283fd5b5061497860a06153e0565b602086013561498681615652565b8152604086013561499681615652565b602082015260608601356149a981615652565b6040820152608086810135606083015260a087013590820152925060c085013567ffffffffffffffff8111156149dd578283fd5b6149e9878288016146b5565b9250506149f98660e08701614720565b905092959194509250565b60008060408385031215614a16578182fd5b8235614a2181615652565b946020939093013593505050565b60006020808385031215614a41578182fd5b823567ffffffffffffffff811115614a57578283fd5b8301601f81018513614a67578283fd5b8035614a7561466e82615411565b8181528381019083850185840285018601891015614a91578687fd5b8694505b83851015614abc578035614aa881615652565b835260019490940193918501918501614a95565b50979650505050505050565b60008060008060608587031215614add578182fd5b843567ffffffffffffffff80821115614af4578384fd5b818701915087601f830112614b07578384fd5b813581811115614b15578485fd5b8860208083028501011115614b28578485fd5b6020928301965094509086013590614b3f82615652565b90925060408601359080821115614b54578283fd5b50614b618782880161464e565b91505092959194509250565b600060208284031215614b7e578081fd5b813561326e81615667565b600060208284031215614b9a578081fd5b815161326e81615667565b600060208284031215614bb6578081fd5b5035919050565b600060208284031215614bce578081fd5b5051919050565b60008060408385031215614be7578182fd5b82359150602083013561485b81615652565b600060208284031215614c0a578081fd5b81356001600160e01b03198116811461326e578182fd5b60008060408385031215614c33578182fd5b8235614c3e81615652565b9150602083013561485b81615652565b600080600060608486031215614c62578081fd5b833592506020840135614c7481615652565b9150604084013567ffffffffffffffff811115614c8f578182fd5b614c9b8682870161464e565b9150509250925092565b60008060408385031215614cb7578182fd5b82359150602083013567ffffffffffffffff811115614cd4578182fd5b6148aa8582860161464e565b600060208284031215614cf1578081fd5b61326e82614737565b60008060408385031215614d0c578182fd5b614c3e83614737565b600080600080600080600060e0888a031215614d2f578485fd5b614d3888614737565b96506020880135614d4881615652565b96999698505050506040850135946060810135946080820135945060a0820135935060c0909101359150565b60008060408385031215614d86578182fd5b614a2183614737565b600080600060608486031215614da3578081fd5b614dac84614737565b925060208401359150604084013567ffffffffffffffff811115614c8f578182fd5b60008151808452614de68160208601602086016155b2565b601f01601f19169290920160200192915050565b60028110614e0a57614e0a615626565b9052565b63ffffffff81511682526020810151602083015260018060a01b0360408201511660408301526060810151614e4e60608401826001600160a01b03169052565b506080810151608083015260a081015160a083015260c081015160c083015260e0810151614e8760e08401826001600160a01b03169052565b5061010080820151613ccd82850182614dfa565b8681526001600160601b0319606087811b8216602084015286901b1660348201526001600160e01b031960e085901b16604882015260006001600160fb1b03831115614ee5578081fd5b602083028085604c85013791909101604c019081529695505050505050565b60008251614f168184602087016155b2565b9190910192915050565b60007f416363657373436f6e74726f6c3a206163636f756e742000000000000000000082528351614f588160178501602088016155b2565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614f898160288401602088016155b2565b01602801949350505050565b60e09290921b6001600160e01b031916825260601b6001600160601b031916600482015260180190565b60e09290921b6001600160e01b0319168252600482015260240190565b600060408201848352602060408185015281855180845260608601915060608382028701019350828701855b8281101561503657605f19888703018452615024868351614dce565b95509284019290840190600101615008565b509398975050505050505050565b606081016004851061505857615058615626565b93815263ffffffff92909216602083015260409091015290565b61014081016003841061508757615087615626565b83825261326e6020830184614e0e565b60006020825261326e6020830184614dce565b60208082526012908201527111549497d053149150511657d0d313d4d15160721b604082015260600190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252600f908201526e11549497d1915157d393d517d4d155608a1b604082015260600190565b60208082526017908201527f4552525f494e56414c49445f59504f4f4c5f544f4b454e000000000000000000604082015260600190565b60208082526012908201527111549497d253959053125117d4d5d054125160721b604082015260600190565b6000833561523181615652565b6001600160a01b03908116835260208501359061524d82615652565b908116602084015260408501359061526482615652565b80821660408501525050606084013560608301526080840135608083015260c060a08301526144e560c0830184614dce565b600060018060a01b0380855116835280602086015116602084015280604086015116604084015250606084015160608301526080840151608083015260c060a08301526144e560c0830184614dce565b610120810161278b8284614e0e565b878152610140810163ffffffff8061530c8a614737565b166020840152602089013561532081615652565b60018060a01b03808216604086015260408b013560608601528261534660608d01614737565b16608086015298891660a0850152505060c08201959095529290941660e0830152610100820152610120019190915292915050565b63ffffffff8a168152602081018990526001600160a01b03888116604083015287811660608301526080820187905260a0820186905260c08201859052831660e082015261012081016153d2610100830184614dfa565b9a9950505050505050505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156154095761540961563c565b604052919050565b600067ffffffffffffffff82111561542b5761542b61563c565b5060209081020190565b6000821982111561544857615448615610565b500190565b60008261546857634e487b7160e01b81526012600452602481fd5b500490565b80825b600180861161547f57506154aa565b81870482111561549157615491615610565b8086161561549e57918102915b9490941c938002615470565b94509492505050565b600061326e60001984846000826154cc5750600161326e565b816154d95750600061326e565b81600181146154ef57600281146154f957615526565b600191505061326e565b60ff84111561550a5761550a615610565b6001841b91508482111561552057615520615610565b5061326e565b5060208310610133831016604e8410600b8410161715615554575081810a8381111561325d5761325d615610565b615561848484600161546d565b80860482111561557357615573615610565b02949350505050565b600081600019048311821515161561559657615596615610565b500290565b6000828210156155ad576155ad615610565b500390565b60005b838110156155cd5781810151838201526020016155b5565b83811115613ccd5750506000910152565b6000816155ed576155ed615610565b506000190190565b600060001982141561560957615609615610565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146112e757600080fd5b80151581146112e757600080fdfef206625bad3d9112d5609b8d356e6fbd514cd1f69980d4ce2b3e6e68e1789ace000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564358933fb1b4f9e62c7cd3651025ad8825acb20ebbb23b09160e3867d71501ddd43ccaf94e5a0ff213b32419bf56f27f93e4170af0c4867ff3412f6aa5a22daf09f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a89a264697066735822122096e44d8b608db7f5481c09a25aaeebb9861156b01044961d864e122290065fe164736f6c63430008020033

Deployed ByteCode

0x6080604052600436106102b15760003560e01c80638456cb5911610175578063b89bbce7116100dc578063e251975e11610095578063f281de9e1161006f578063f281de9e146109dc578063f54738ef146109fc578063f5b944eb14610a13578063fde3f7dc14610a35576102b8565b8063e251975e14610917578063e53e016e14610937578063f13de4b31461096e576102b8565b8063b89bbce714610859578063bf46f18914610879578063c489744b14610894578063cf1d21c0146108b4578063d547741f146108d6578063d8331e71146108f6576102b8565b80639a8a05921161012e5780639a8a0592146106bf5780639c61d7a4146106f9578063a11531121461078d578063a217fddf146107ad578063acb35532146107c2578063b074751614610846576102b8565b80638456cb59146106085780638ad682af1461061d5780638c5178cf1461063f5780638fc3ab8b1461065f57806391d148541461067f5780639968230b1461069f576102b8565b80634039c8d01161021957806356e4b68b116101d257806356e4b68b1461053e5780635c975abb1461057757806364024b421461058f5780636aa4d6b5146105b15780636c3f3917146105d15780636db4ff46146105f1576102b8565b80634039c8d01461047a57806345756a8c1461048d5780634a23656d146104be5780634f1ef286146104eb5780635136d5a2146104fe57806354192e371461051e576102b8565b806322bf2e241161026b57806322bf2e24146103a5578063248a9ca3146103d55780632f2ff15d1461040557806336568abe146104255780633659cfe6146104455780633f4ba83a14610465576102b8565b8062501e28146102bd57806301ffc9a7146102df578063067f6fec1461031457806312708c7b14610334578063213e4f08146103655780632256612214610385576102b8565b366102b857005b600080fd5b3480156102c957600080fd5b506102dd6102d8366004614ca5565b610a63565b005b3480156102eb57600080fd5b506102ff6102fa366004614bf9565b610ecf565b60405190151581526020015b60405180910390f35b34801561032057600080fd5b506102dd61032f36600461482e565b610f08565b34801561034057600080fd5b506102ff61034f36600461474b565b6101346020526000908152604090205460ff1681565b34801561037157600080fd5b506102dd610380366004614ba5565b611043565b34801561039157600080fd5b506102dd6103a0366004614a04565b611108565b3480156103b157600080fd5b506103c76000805160206156dd83398151915281565b60405190815260200161030b565b3480156103e157600080fd5b506103c76103f0366004614ba5565b60009081526065602052604090206001015490565b34801561041157600080fd5b506102dd610420366004614bd5565b611178565b34801561043157600080fd5b506102dd610440366004614bd5565b6111a3565b34801561045157600080fd5b506102dd61046036600461474b565b611221565b34801561047157600080fd5b506102dd6112ea565b6102dd610488366004614938565b61130b565b34801561049957600080fd5b506102ff6104a836600461474b565b6101366020526000908152604090205460ff1681565b3480156104ca57600080fd5b506104de6104d9366004614ba5565b6118dc565b60405161030b91906152e6565b6102dd6104f9366004614866565b611a03565b34801561050a57600080fd5b506102dd6105193660046147e4565b611ab9565b34801561052a57600080fd5b50610132546102ff90610100900460ff1681565b34801561054a57600080fd5b5061012f5461055f906001600160a01b031681565b6040516001600160a01b03909116815260200161030b565b34801561058357600080fd5b5060fb5460ff166102ff565b34801561059b57600080fd5b506103c76000805160206156fd83398151915281565b3480156105bd57600080fd5b506102dd6105cc366004614d8f565b611c18565b3480156105dd57600080fd5b506102dd6105ec366004614a2f565b611e39565b3480156105fd57600080fd5b506103c76101315481565b34801561061457600080fd5b506102dd611f9f565b34801561062957600080fd5b506103c760008051602061571d83398151915281565b34801561064b57600080fd5b506102dd61065a366004614767565b611fc0565b34801561066b57600080fd5b506102dd61067a366004614ac8565b612246565b34801561068b57600080fd5b506102ff61069a366004614bd5565b612764565b3480156106ab57600080fd5b506102dd6106ba36600461474b565b612791565b3480156106cb57600080fd5b5061012f546106e490600160a01b900463ffffffff1681565b60405163ffffffff909116815260200161030b565b34801561070557600080fd5b50610778610714366004614ba5565b610139602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015463ffffffff9096169694956001600160a01b03948516959385169492939192811690600160a01b900460ff1689565b60405161030b9998979695949392919061537b565b34801561079957600080fd5b506102dd6107a8366004614b6d565b6127f9565b3480156107b957600080fd5b506103c7600081565b3480156107ce57600080fd5b506108176107dd366004614ba5565b6101386020526000908152604090208054600182015460028301546003840154600485015460059095015460ff9094169492939192909186565b6040805196151587526020870195909552938501929092526060840152608083015260a082015260c00161030b565b6102dd6108543660046148b4565b6128ae565b34801561086557600080fd5b506102dd610874366004614d15565b612f86565b34801561088557600080fd5b50610132546102ff9060ff1681565b3480156108a057600080fd5b506103c76108af366004614c21565b6131c4565b3480156108c057600080fd5b5061055f60008051602061569683398151915281565b3480156108e257600080fd5b506102dd6108f1366004614bd5565b613275565b34801561090257600080fd5b506101375461055f906001600160a01b031681565b34801561092357600080fd5b506102dd610932366004614c4e565b61329b565b34801561094357600080fd5b5061055f61095236600461474b565b610135602052600090815260409020546001600160a01b031681565b34801561097a57600080fd5b5061098e610989366004614cfa565b61361b565b60405161030b9190600060c0820190508251151582526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b3480156109e857600080fd5b506102ff6109f7366004614d74565b613683565b348015610a0857600080fd5b506103c76101305481565b348015610a1f57600080fd5b506103c760008051602061567683398151915281565b348015610a4157600080fd5b506103c7610a5036600461474b565b61012e6020526000908152604090205481565b60fb5460ff1615610a8f5760405162461bcd60e51b8152600401610a869061516e565b60405180910390fd5b816101315411158015610aa457506101305482105b610ac05760405162461bcd60e51b8152600401610a86906151f8565b600160008381526101396020526040902060070154600160a01b900460ff166001811115610afe57634e487b7160e01b600052602160045260246000fd5b1415610b1c5760405162461bcd60e51b8152600401610a86906150aa565b600082815261013960209081526040808320600701805460ff60a01b1916600160a01b17905561012f548151633ebd56d760e21b815291516001600160a01b039091169263faf55b5c9260048082019391829003018186803b158015610b8157600080fd5b505afa158015610b95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb99190614bbd565b6101375461012f546040805160208101949094526001600160601b031930606090811b82169286019290925292901b90911660548301526001600160e01b0319600160a01b90910460e01b166068820152606c8101849052608c016040516020818303038152906040528051906020012090506000610c37826136ca565b61012f546040516305a0f88360e41b81529192506001600160a01b031690635a0f883090610c6b9084908790600401614fdc565b60006040518083038186803b158015610c8357600080fd5b505afa158015610c97573d6000803e3d6000fd5b505050600085815261013960209081526040808320815161012081018352815463ffffffff1681526001808301549482019490945260028201546001600160a01b039081169382019390935260038201548316606082015260048201546080820152600582015460a0820152600682015460c0820152600782015492831660e082015293945091610100840191600160a01b900460ff1690811115610d4c57634e487b7160e01b600052602160045260246000fd5b6001811115610d6b57634e487b7160e01b600052602160045260246000fd5b90525060e0810180516001600160a01b03908116600090815261013560205260408120549251939450918116921660008051602061569683398151915214610db4576000610dba565b82608001515b60e08401519091506001600160a01b031660008051602061569683398151915214610e0557610e058284608001518560e001516001600160a01b031661371d9092919063ffffffff16565b60e0830151608084015160a085015160c086015160405163496d674b60e11b81526001600160a01b039485166004820152602481019390935260448301919091526064820152908316906392dace969083906084016000604051808303818588803b158015610e7357600080fd5b505af1158015610e87573d6000803e3d6000fd5b50505050507f7cf616e580913e39d7ffeeb739823ba0799bc2948b9b6043f5127cad95b655c8600084604051610ebe929190615072565b60405180910390a150505050505050565b60006001600160e01b03198216637965db0b60e01b1480610f0057506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b600080516020615676833981519152610f2281335b613874565b823b610f7c5760405162461bcd60e51b815260206004820152602360248201527f4552525f41474752454741544f525f41444150544f525f4e4f545f434f4e54526044820152621050d560ea1b6064820152608401610a86565b6001600160a01b0383166000908152610136602052604090205460ff1615158215151415610fde5760405162461bcd60e51b815260206004820152600f60248201526e11549497d053149150511657d4d155608a1b6044820152606401610a86565b6001600160a01b03831660008181526101366020908152604091829020805460ff19168615159081179091558251938452908301527fddb2d5e2010e584b0d2ead420a90d3915d2bb30a13fb9b880b4844b8d941f0f7910160405180910390a1505050565b60008051602061571d83398151915261105c8133610f1d565b6101325460ff16156110b05760405162461bcd60e51b815260206004820152601760248201527f4552525f535741505f49445f414c52454144595f5345540000000000000000006044820152606401610a86565b610132805460ff191660011790556101318290556101308290556040517fb67f87224c93085f9ebe8dfb5a654d0b5e3b54fa279b250d1492c4fe64e2d60d906110fc9084815260200190565b60405180910390a15050565b6000805160206156768339815191526111218133610f1d565b6001600160a01b0383166000908152610134602052604090205460ff1661115a5760405162461bcd60e51b8152600401610a86906151c1565b506001600160a01b03909116600090815261012e6020526040902055565b6000828152606560205260409020600101546111948133610f1d565b61119e83836138d8565b505050565b6001600160a01b03811633146112135760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a86565b61121d828261395e565b5050565b306001600160a01b037f0000000000000000000000004f751398beb53d882ed99bd82f98911d45b9afbf16141561126a5760405162461bcd60e51b8152600401610a86906150d6565b7f0000000000000000000000004f751398beb53d882ed99bd82f98911d45b9afbf6001600160a01b031661129c6139c5565b6001600160a01b0316146112c25760405162461bcd60e51b8152600401610a8690615122565b6112cb816139f3565b604080516000808252602082019092526112e791839190613a0c565b50565b6000805160206156768339815191526113038133610f1d565b6112e7613b57565b61013254610100900460ff166113635760405162461bcd60e51b815260206004820152601f60248201527f4552525f4e4f545f414343455054494e475f535741505f5245515545535453006044820152606401610a86565b60fb5460ff16156113865760405162461bcd60e51b8152600401610a869061516e565b600261012d5414156113da5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a86565b600261012d556101325460ff166114295760405162461bcd60e51b815260206004820152601360248201527211549497d4d5d05417d25117d393d517d4d155606a1b6044820152606401610a86565b60408084015184516020808701516001600160a01b0381166000908152610134909252939020549192909160ff166114735760405162461bcd60e51b8152600401610a86906151c1565b60608601516000611485843384613bea565b826001600160a01b0316846001600160a01b031614156114a6575080611621565b6001600160a01b0389166000908152610136602052604090205460ff1661150f5760405162461bcd60e51b815260206004820152601e60248201527f4552525f494e56414c49445f41474752454741544f525f41444150544f5200006044820152606401610a86565b61151983306131c4565b3060408a015290506001600160a01b03841660008051602061569683398151915214611553576115536001600160a01b0385168a8461371d565b604051638218b58f60e01b81526001600160a01b038a1690638218b58f903490611583908c908c90600401615296565b6020604051808303818588803b15801561159c57600080fd5b505af11580156115b0573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115d59190614bbd565b506001600160a01b03841660008051602061569683398151915214611609576116096001600160a01b0385168a600061371d565b8061161484306131c4565b61161e919061559b565b90505b6116386116316020880188614ce0565b8483613cd3565b6116845760405162461bcd60e51b815260206004820152601a60248201527f4552525f4e4f545f454e4f5547485f535741505f414d4f554e540000000000006044820152606401610a86565b6001600160a01b038316600090815261012e60205260409020548111156116ed5760405162461bcd60e51b815260206004820152601a60248201527f4552525f4558434545445f4d41585f535741505f414d4f554e540000000000006044820152606401610a86565b60008061170761170060208a018a614ce0565b8685613d5f565b60408051610120810190915291935091506000908061172960208c018c614ce0565b63ffffffff1681526101305460208201526001600160a01b03808b1660408301523360608301526080820187905260a0820186905260c08201859052881660e0820152610100016000905261013054600090815261013960209081526040918290208351815463ffffffff191663ffffffff90911617815590830151600180830191909155918301516002820180546001600160a01b03199081166001600160a01b0393841617909155606085015160038401805483169184169190911790556080850151600484015560a0850151600584015560c0850151600684015560e08501516007840180549092169216919091178082556101008501519495508594929360ff60a01b1990911690600160a01b90849081111561185a57634e487b7160e01b600052602160045260246000fd5b02179055505061013080546001600160a01b03808a1693508f16917f7ab36fa3be61b88675b434febef4e25ce3b3f32d121b1c6d11bb0520910e1f45919060006118a3836155f5565b919050558c8b898e8a8a6040516118c097969594939291906152f5565b60405180910390a35050600161012d5550505050505050505050565b6119296040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290529061010082015290565b60008281526101396020908152604091829020825161012081018452815463ffffffff1681526001808301549382019390935260028201546001600160a01b039081169482019490945260038201548416606082015260048201546080820152600582015460a0820152600682015460c0820152600782015493841660e0820152929091610100840191600160a01b900460ff16908111156119db57634e487b7160e01b600052602160045260246000fd5b60018111156119fa57634e487b7160e01b600052602160045260246000fd5b90525092915050565b306001600160a01b037f0000000000000000000000004f751398beb53d882ed99bd82f98911d45b9afbf161415611a4c5760405162461bcd60e51b8152600401610a86906150d6565b7f0000000000000000000000004f751398beb53d882ed99bd82f98911d45b9afbf6001600160a01b0316611a7e6139c5565b6001600160a01b031614611aa45760405162461bcd60e51b8152600401610a8690615122565b611aad826139f3565b61121d82826001613a0c565b60008051602061571d833981519152611ad28133610f1d565b6001600160a01b03841660008051602061569683398151915214611b3e57833b611b3e5760405162461bcd60e51b815260206004820152601c60248201527f4552525f59504f4f4c5f544f4b454e5f4e4f545f434f4e5452414354000000006044820152606401610a86565b823b611b8c5760405162461bcd60e51b815260206004820152601c60248201527f4552525f59504f4f4c5f5641554c545f4e4f545f434f4e5452414354000000006044820152606401610a86565b6001600160a01b03848116600081815261013460209081526040808320805460ff191688151590811790915561013583529281902080546001600160a01b03191695891695861790558051938452908301939093528183015290517ff1e53a62d5935afca4762c943ac543a520fbf358eafaac6024bcb3f053f32071916060908290030190a150505050565b60fb5460ff1615611c3b5760405162461bcd60e51b8152600401610a869061516e565b60008383604051602001611c50929190614fbf565b60408051601f198184030181529181528151602092830120600081815261013390935291205490915060ff1615611c995760405162461bcd60e51b8152600401610a86906150aa565b61012f5460408051633a44953960e11b815290516000926001600160a01b0316916374892a72916004808301926020929190829003018186803b158015611cdf57600080fd5b505afa158015611cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d179190614bbd565b6040805160208101929092526001600160601b03193060601b16908201526001600160e01b031960e087901b166054820152605881018590526078016040516020818303038152906040528051906020012090506000611d76826136ca565b61012f546040516305a0f88360e41b81529192506001600160a01b031690635a0f883090611daa9084908890600401614fdc565b60006040518083038186803b158015611dc257600080fd5b505afa158015611dd6573d6000803e3d6000fd5b5050506000848152610133602052604090819020805460ff19166001179055517fee823aedb9f54993693aeaca62918fd9eeaf9d0416276706739088c10ceaf2b89150611e299060039089908990615044565b60405180910390a1505050505050565b60008051602061571d833981519152611e528133610f1d565b60005b825181101561119e576000838281518110611e8057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b038116600090815261013490925260409091205490915060ff1615611efa5760405162461bcd60e51b815260206004820152601e60248201527f4552525f43414e5f4e4f545f5245534355455f59504f4f4c5f544f4b454e00006044820152606401610a86565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b158015611f3c57600080fd5b505afa158015611f50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f749190614bbd565b9050611f8a6001600160a01b0383163383613de7565b50508080611f97906155f5565b915050611e55565b600080516020615676833981519152611fb88133610f1d565b6112e7613e17565b600054610100900460ff1680611fd9575060005460ff16155b61203c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a86565b600054610100900460ff16158015612067576000805460ff1961ff0019909116610100171660011790555b823b6120b55760405162461bcd60e51b815260206004820152601b60248201527f4552525f53555045525649534f525f4e4f545f434f4e545241435400000000006044820152606401610a86565b61012f80546001600160a01b0319166001600160a01b0385161763ffffffff60a01b1916600160a01b63ffffffff851690810291909117909155610132805461ff0019169055469081146121405760405162461bcd60e51b815260206004820152601260248201527111549497d5d493d391d7d0d210525397d25160721b6044820152606401610a86565b61215860008051602061571d83398151915280613e6f565b61217e60008051602061567683398151915260008051602061571d833981519152613e6f565b6121a46000805160206156dd83398151915260008051602061571d833981519152613e6f565b6121ca6000805160206156fd83398151915260008051602061571d833981519152613e6f565b6121e260008051602061571d83398151915289613eba565b6121fa60008051602061567683398151915288613eba565b6122126000805160206156dd83398151915287613eba565b61222a6000805160206156fd83398151915286613eba565b50801561223d576000805461ff00191690555b50505050505050565b60fb5460ff16156122695760405162461bcd60e51b8152600401610a869061516e565b6001600160a01b0382166000908152610134602052604090205460ff166122a25760405162461bcd60e51b8152600401610a86906151c1565b61012f546040805163f7ca802360e01b815290516000926001600160a01b03169163f7ca8023916004808301926020929190829003018186803b1580156122e857600080fd5b505afa1580156122fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123209190614bbd565b6101375461012f54604051612359939230926001600160a01b0390911691600160a01b90910463ffffffff16908a908a90602001614e9b565b604051602081830303815290604052805190602001209050600061237c826136ca565b61012f546040516305a0f88360e41b81529192506001600160a01b031690635a0f8830906123b09084908790600401614fdc565b60006040518083038186803b1580156123c857600080fd5b505afa1580156123dc573d6000803e3d6000fd5b5050610131548692506000915081908190815b8a8110156126715760008c8c8381811061241957634e487b7160e01b600052603260045260246000fd5b90506020020135905080831115801561243457506101305481105b6124505760405162461bcd60e51b8152600401610a86906151f8565b600081815261013960209081526040808320815161012081018352815463ffffffff1681526001808301549482019490945260028201546001600160a01b039081169382019390935260038201548316606082015260048201546080820152600582015460a0820152600682015460c0820152600782015492831660e0820152929091610100840191600160a01b90910460ff169081111561250257634e487b7160e01b600052602160045260246000fd5b600181111561252157634e487b7160e01b600052602160045260246000fd5b90525090506001816101000151600181111561254d57634e487b7160e01b600052602160045260246000fd5b141561256b5760405162461bcd60e51b8152600401610a86906150aa565b876001600160a01b03168160e001516001600160a01b0316146125c85760405162461bcd60e51b815260206004820152601560248201527422a9292faba927a723afaca827a7a62faa27a5a2a760591b6044820152606401610a86565b60808101516125d79088615435565b96508060a00151866125e99190615435565b95508060c00151856125fb9190615435565b6000838152610139602052604090819020600701805460ff60a01b1916600160a01b179055519095507f7cf616e580913e39d7ffeeb739823ba0799bc2948b9b6043f5127cad95b655c890612654906001908490615072565b60405180910390a150508080612669906155f5565b9150506123ef565b506001600160a01b03808a16600081815261013560205260408120549092169190600080516020615696833981519152146126ad5760006126af565b855b90506001600160a01b038b16600080516020615696833981519152146126e3576126e36001600160a01b038816838861371d565b60405163496d674b60e11b81526001600160a01b0388811660048301526024820188905260448201879052606482018690528316906392dace969083906084016000604051808303818588803b15801561273c57600080fd5b505af1158015612750573d6000803e3d6000fd5b505050505050505050505050505050505050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b6000805160206156dd8339815191526127aa8133610f1d565b61013780546001600160a01b0319166001600160a01b0384169081179091556040519081527f3623260a18beeff6af38bff0981baf3571a6f16d5b4c8942e8d26c0a166669db906020016110fc565b6000805160206156768339815191526128128133610f1d565b6101325460ff61010090910416151582151514156128645760405162461bcd60e51b815260206004820152600f60248201526e11549497d053149150511657d4d155608a1b6044820152606401610a86565b61013280548315156101000261ff00199091161790556040517fe9c79a92bfc6f0b53c87557fd9c5905d04c4bea7fb8852af1477e25590d330a5906110fc90841515815260200190565b60fb5460ff16156128d15760405162461bcd60e51b8152600401610a869061516e565b600261012d5414156129255760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a86565b600261012d556000805160206156fd8339815191526129448133610f1d565b6101346000612956602088018861474b565b6001600160a01b0316815260208101919091526040016000205460ff1661298f5760405162461bcd60e51b8152600401610a86906151c1565b600083836040516020016129a4929190614fbf565b60408051601f198184030181529181528151602092830120600081815261013390935291205490915060ff16156129ed5760405162461bcd60e51b8152600401610a86906150aa565b6000908152610133602090815260408220805460ff1916600117905561012e9190612a1a9088018861474b565b6001600160a01b03166001600160a01b031681526020019081526020016000205485606001351115612a8e5760405162461bcd60e51b815260206004820152601a60248201527f4552525f4558434545445f4d41585f535741505f414d4f554e540000000000006044820152606401610a86565b6101356000612aa0602088018861474b565b6001600160a01b039081168252602080830193909352604090910160002054169063c2fc211090612ad39088018861474b565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260608801356024820152604401600060405180830381600087803b158015612b1e57600080fd5b505af1158015612b32573d6000803e3d6000fd5b5060009250829150612b499050602088018861474b565b6001600160a01b0316612b626040890160208a0161474b565b6001600160a01b03161415612b7f57505060608501356000612e5a565b6001600160a01b0388166000908152610136602052604090205460ff16612be85760405162461bcd60e51b815260206004820152601e60248201527f4552525f494e56414c49445f41474752454741544f525f41444150544f5200006044820152606401610a86565b6000600080516020615696833981519152612c0660208a018a61474b565b6001600160a01b031614612c1b576000612c21565b87606001355b90503063c489744b612c3960408b0160208c0161474b565b612c4960608c0160408d0161474b565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b158015612c8f57600080fd5b505afa925050508015612cbf575060408051601f3d908101601f19168201909252612cbc91810190614bbd565b60015b612ccc5760029150612e58565b925082600080516020615696833981519152612ceb60208b018b61474b565b6001600160a01b031614612d1f57612d1f8a60608b0135612d0f60208d018d61474b565b6001600160a01b0316919061371d565b604051638218b58f60e01b81526001600160a01b038b1690638218b58f908490612d4f908d908d90600401615224565b6020604051808303818588803b158015612d6857600080fd5b505af193505050508015612d99575060408051601f3d908101601f19168201909252612d9691810190614bbd565b60015b612da65760029250612e19565b50600080516020615696833981519152612dc360208b018b61474b565b6001600160a01b031614612de457612de48a6000612d0f60208d018d61474b565b83612e08612df860408c0160208d0161474b565b6108af60608d0160408e0161474b565b612e12919061559b565b9350600192505b600080516020615696833981519152612e3560208b018b61474b565b6001600160a01b031614612e5657612e568a6000612d0f60208d018d61474b565b505b505b6001816003811115612e7c57634e487b7160e01b600052602160045260246000fd5b14612eab57612eab612e946060890160408a0161474b565b612ea160208a018a61474b565b8960600135613ec4565b7fee823aedb9f54993693aeaca62918fd9eeaf9d0416276706739088c10ceaf2b8818686604051612ede93929190615044565b60405180910390a1612ef3602088018861474b565b6001600160a01b039081169089167f99a830bc8dc28151ad5e29ed2c1b05d46849b76a341bf8e0947a46775ba6b4f960608a0135612f3760408c0160208d0161474b565b86612f4860608e0160408f0161474b565b604080519485526001600160a01b03938416602086015284019190915216606082015260800160405180910390a35050600161012d55505050505050565b6000805160206156dd833981519152612f9f8133610f1d565b6001600160a01b0387166000805160206156968339815191521461300b57863b61300b5760405162461bcd60e51b815260206004820152601c60248201527f4552525f59504f4f4c5f544f4b454e5f4e4f545f434f4e5452414354000000006044820152606401610a86565b8484116130505760405162461bcd60e51b815260206004820152601360248201527222a9292fa4a72b20a624a22fa6a0ac2fa6a4a760691b6044820152606401610a86565b858510156130965760405162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f4d494e5f47415360681b6044820152606401610a86565b600088886040516020016130ab929190614f95565b60408051601f19818403018152828252805160209182012060c08401835260018085528483018c81528585018c8152606087018c8152608088018c815260a089018c81526000878152610138909852968890208951815490151560ff199091161781559351948401949094559051600283015551600382015590516004820155915160059092019190915590519092507fcb4bb3001f7b245a106522f836b6aed77ba72ad177e278f9bb0b46d81d98356c906131b0908c908c908c908c908c908c908c9063ffffffff9790971687526001600160a01b0395909516602087015260408601939093526060850191909152608084015260a083015260c082015260e00190565b60405180910390a150505050505050505050565b60006001600160a01b03831660008051602061569683398151915214613262576040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b15801561322557600080fd5b505afa158015613239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061325d9190614bbd565b61326e565b816001600160a01b0316315b9392505050565b6000828152606560205260409020600101546132918133610f1d565b61119e838361395e565b60fb5460ff16156132be5760405162461bcd60e51b8152600401610a869061516e565b6101305483106132e05760405162461bcd60e51b8152600401610a86906151f8565b600160008481526101396020526040902060070154600160a01b900460ff16600181111561331e57634e487b7160e01b600052602160045260246000fd5b141561333c5760405162461bcd60e51b8152600401610a86906150aa565b600083815261013960209081526040808320600701805460ff60a01b1916600160a01b17905561012f548151633a44953960e11b815291516001600160a01b03909116926374892a729260048082019391829003018186803b1580156133a157600080fd5b505afa1580156133b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133d99190614bbd565b61012f5460408051602081019390935230606090811b6001600160601b031990811692850192909252600160a01b90920460e01b6001600160e01b0319166054840152605883018790529085901b166078820152608c016040516020818303038152906040528051906020012090506000613453826136ca565b61012f546040516305a0f88360e41b81529192506001600160a01b031690635a0f8830906134879084908790600401614fdc565b60006040518083038186803b15801561349f57600080fd5b505afa1580156134b3573d6000803e3d6000fd5b505050600086815261013960209081526040808320815161012081018352815463ffffffff1681526001808301549482019490945260028201546001600160a01b039081169382019390935260038201548316606082015260048201546080820152600582015460a0820152600682015460c0820152600782015492831660e082015293945091610100840191600160a01b900460ff169081111561356857634e487b7160e01b600052602160045260246000fd5b600181111561358757634e487b7160e01b600052602160045260246000fd5b81525050905060006135b561012f60149054906101000a900463ffffffff168360e001518460800151613d5f565b9150506135da82606001518360e001518385608001516135d5919061559b565b613ec4565b6135e9868360e0015183613ec4565b7f7cf616e580913e39d7ffeeb739823ba0799bc2948b9b6043f5127cad95b655c8600283604051610ebe929190615072565b6136566040518060c0016040528060001515815260200160008152602001600081526020016000815260200160008152602001600081525090565b60006136628484613f33565b805190915061326e5760405162461bcd60e51b8152600401610a8690615198565b6000808383604051602001613699929190614fbf565b60408051808303601f190181529181528151602092830120600090815261013390925290205460ff16949350505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b8015806137a65750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561376c57600080fd5b505afa158015613780573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a49190614bbd565b155b6138115760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a86565b6040516001600160a01b03831660248201526044810182905261119e90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613ff4565b61387e8282612764565b61121d57613896816001600160a01b031660146140c6565b6138a18360206140c6565b6040516020016138b2929190614f20565b60408051601f198184030181529082905262461bcd60e51b8252610a8691600401615097565b6138e28282612764565b61121d5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561391a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6139688282612764565b1561121d5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b60008051602061571d83398151915261121d8133610f1d565b6000613a166139c5565b9050613a21846142a8565b600083511180613a2e5750815b15613a3f57613a3d848461434d565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff16613b5057805460ff191660011781556040516001600160a01b0383166024820152613abe90869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b17905261434d565b50805460ff19168155613acf6139c5565b6001600160a01b0316826001600160a01b031614613b475760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610a86565b613b5085614438565b5050505050565b60fb5460ff16613ba05760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a86565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0383166000805160206156968339815191521415613c5257803414613c4d5760405162461bcd60e51b815260206004820152601260248201527111549497d253959053125117d05353d5539560721b6044820152606401610a86565b61119e565b6000613c5e84306131c4565b9050613c756001600160a01b038516843085614478565b8181613c8186306131c4565b613c8b919061559b565b14613ccd5760405162461bcd60e51b815260206004820152601260248201527111549497d253959053125117d05353d5539560721b6044820152606401610a86565b50505050565b600080613ce08585613f33565b8051909150613d015760405162461bcd60e51b8152600401610a8690615198565b604081015161012f54613d2190600160a01b900463ffffffff1686613f33565b8051909250613d425760405162461bcd60e51b8152600401610a8690615198565b6040820151613d5182826144b0565b909410159695505050505050565b6000806000613d6e8686613f33565b8051909150613d8f5760405162461bcd60e51b8152600401610a8690615198565b60a0810151613d9f90600a6154b3565b6080820151613dae908661557c565b613db8919061544d565b9250613dd5613dcb8483604001516144b0565b82606001516144c7565b92508060200151915050935093915050565b6040516001600160a01b03831660248201526044810182905261119e90849063a9059cbb60e01b9060640161383d565b60fb5460ff1615613e3a5760405162461bcd60e51b8152600401610a869061516e565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613bcd3390565b600082815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b61121d82826138d8565b6001600160a01b0382166000805160206156968339815191521415613f1f576040516001600160a01b0384169082156108fc029083906000818181858888f19350505050158015613f19573d6000803e3d6000fd5b5061119e565b61119e6001600160a01b0383168483613de7565b613f6e6040518060c0016040528060001515815260200160008152602001600081526020016000815260200160008152602001600081525090565b60008383604051602001613f83929190614f95565b60408051808303601f1901815282825280516020918201206000908152610138825282902060c084018352805460ff161515845260018101549184019190915260028101549183019190915260038101546060830152600481015460808301526005015460a0820152949350505050565b6000614049826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166144d69092919063ffffffff16565b80519091501561119e57808060200190518101906140679190614b89565b61119e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a86565b606060006140d583600261557c565b6140e0906002615435565b67ffffffffffffffff81111561410657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015614130576020820181803683370190505b509050600360fc1b8160008151811061415957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061419657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006141ba84600261557c565b6141c5906001615435565b90505b6001811115614259576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061420757634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061422b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93614252816155de565b90506141c8565b50831561326e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a86565b803b61430c5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610a86565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b6143ac5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610a86565b600080846001600160a01b0316846040516143c79190614f04565b600060405180830381855af49150503d8060008114614402576040519150601f19603f3d011682016040523d82523d6000602084013e614407565b606091505b509150915061442f82826040518060600160405280602781526020016156b6602791396144ed565b95945050505050565b614441816142a8565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6040516001600160a01b0380851660248301528316604482015260648101829052613ccd9085906323b872dd60e01b9060840161383d565b6000818310156144c0578161326e565b5090919050565b60008183106144c0578161326e565b60606144e58484600085614526565b949350505050565b606083156144fc57508161326e565b82511561450c5782518084602001fd5b8160405162461bcd60e51b8152600401610a869190615097565b6060824710156145875760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a86565b843b6145d55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a86565b600080866001600160a01b031685876040516145f19190614f04565b60006040518083038185875af1925050503d806000811461462e576040519150601f19603f3d011682016040523d82523d6000602084013e614633565b606091505b50915091506146438282866144ed565b979650505050505050565b600082601f83011261465e578081fd5b8135602061467361466e83615411565b6153e0565b82815281810190858301855b858110156146a857614696898684358b01016146b5565b8452928401929084019060010161467f565b5090979650505050505050565b600082601f8301126146c5578081fd5b813567ffffffffffffffff8111156146df576146df61563c565b6146f2601f8201601f19166020016153e0565b818152846020838601011115614706578283fd5b816020850160208301379081016020019190915292915050565b600060808284031215614731578081fd5b50919050565b803563ffffffff81168114610f0357600080fd5b60006020828403121561475c578081fd5b813561326e81615652565b60008060008060008060c0878903121561477f578182fd5b863561478a81615652565b9550602087013561479a81615652565b945060408701356147aa81615652565b935060608701356147ba81615652565b925060808701356147ca81615652565b91506147d860a08801614737565b90509295509295509295565b6000806000606084860312156147f8578283fd5b833561480381615652565b9250602084013561481381615652565b9150604084013561482381615667565b809150509250925092565b60008060408385031215614840578182fd5b823561484b81615652565b9150602083013561485b81615667565b809150509250929050565b60008060408385031215614878578182fd5b823561488381615652565b9150602083013567ffffffffffffffff81111561489e578182fd5b6148aa858286016146b5565b9150509250929050565b60008060008060008587036101208112156148cd578384fd5b86356148d881615652565b955060a0601f19820112156148eb578384fd5b5060208601935060c086013567ffffffffffffffff81111561490b578384fd5b614917888289016146b5565b93505061492660e08701614737565b94979396509194610100013592915050565b60008060008084860361016081121561494f578283fd5b853561495a81615652565b945060a0601f198201121561496d578283fd5b5061497860a06153e0565b602086013561498681615652565b8152604086013561499681615652565b602082015260608601356149a981615652565b6040820152608086810135606083015260a087013590820152925060c085013567ffffffffffffffff8111156149dd578283fd5b6149e9878288016146b5565b9250506149f98660e08701614720565b905092959194509250565b60008060408385031215614a16578182fd5b8235614a2181615652565b946020939093013593505050565b60006020808385031215614a41578182fd5b823567ffffffffffffffff811115614a57578283fd5b8301601f81018513614a67578283fd5b8035614a7561466e82615411565b8181528381019083850185840285018601891015614a91578687fd5b8694505b83851015614abc578035614aa881615652565b835260019490940193918501918501614a95565b50979650505050505050565b60008060008060608587031215614add578182fd5b843567ffffffffffffffff80821115614af4578384fd5b818701915087601f830112614b07578384fd5b813581811115614b15578485fd5b8860208083028501011115614b28578485fd5b6020928301965094509086013590614b3f82615652565b90925060408601359080821115614b54578283fd5b50614b618782880161464e565b91505092959194509250565b600060208284031215614b7e578081fd5b813561326e81615667565b600060208284031215614b9a578081fd5b815161326e81615667565b600060208284031215614bb6578081fd5b5035919050565b600060208284031215614bce578081fd5b5051919050565b60008060408385031215614be7578182fd5b82359150602083013561485b81615652565b600060208284031215614c0a578081fd5b81356001600160e01b03198116811461326e578182fd5b60008060408385031215614c33578182fd5b8235614c3e81615652565b9150602083013561485b81615652565b600080600060608486031215614c62578081fd5b833592506020840135614c7481615652565b9150604084013567ffffffffffffffff811115614c8f578182fd5b614c9b8682870161464e565b9150509250925092565b60008060408385031215614cb7578182fd5b82359150602083013567ffffffffffffffff811115614cd4578182fd5b6148aa8582860161464e565b600060208284031215614cf1578081fd5b61326e82614737565b60008060408385031215614d0c578182fd5b614c3e83614737565b600080600080600080600060e0888a031215614d2f578485fd5b614d3888614737565b96506020880135614d4881615652565b96999698505050506040850135946060810135946080820135945060a0820135935060c0909101359150565b60008060408385031215614d86578182fd5b614a2183614737565b600080600060608486031215614da3578081fd5b614dac84614737565b925060208401359150604084013567ffffffffffffffff811115614c8f578182fd5b60008151808452614de68160208601602086016155b2565b601f01601f19169290920160200192915050565b60028110614e0a57614e0a615626565b9052565b63ffffffff81511682526020810151602083015260018060a01b0360408201511660408301526060810151614e4e60608401826001600160a01b03169052565b506080810151608083015260a081015160a083015260c081015160c083015260e0810151614e8760e08401826001600160a01b03169052565b5061010080820151613ccd82850182614dfa565b8681526001600160601b0319606087811b8216602084015286901b1660348201526001600160e01b031960e085901b16604882015260006001600160fb1b03831115614ee5578081fd5b602083028085604c85013791909101604c019081529695505050505050565b60008251614f168184602087016155b2565b9190910192915050565b60007f416363657373436f6e74726f6c3a206163636f756e742000000000000000000082528351614f588160178501602088016155b2565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614f898160288401602088016155b2565b01602801949350505050565b60e09290921b6001600160e01b031916825260601b6001600160601b031916600482015260180190565b60e09290921b6001600160e01b0319168252600482015260240190565b600060408201848352602060408185015281855180845260608601915060608382028701019350828701855b8281101561503657605f19888703018452615024868351614dce565b95509284019290840190600101615008565b509398975050505050505050565b606081016004851061505857615058615626565b93815263ffffffff92909216602083015260409091015290565b61014081016003841061508757615087615626565b83825261326e6020830184614e0e565b60006020825261326e6020830184614dce565b60208082526012908201527111549497d053149150511657d0d313d4d15160721b604082015260600190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252600f908201526e11549497d1915157d393d517d4d155608a1b604082015260600190565b60208082526017908201527f4552525f494e56414c49445f59504f4f4c5f544f4b454e000000000000000000604082015260600190565b60208082526012908201527111549497d253959053125117d4d5d054125160721b604082015260600190565b6000833561523181615652565b6001600160a01b03908116835260208501359061524d82615652565b908116602084015260408501359061526482615652565b80821660408501525050606084013560608301526080840135608083015260c060a08301526144e560c0830184614dce565b600060018060a01b0380855116835280602086015116602084015280604086015116604084015250606084015160608301526080840151608083015260c060a08301526144e560c0830184614dce565b610120810161278b8284614e0e565b878152610140810163ffffffff8061530c8a614737565b166020840152602089013561532081615652565b60018060a01b03808216604086015260408b013560608601528261534660608d01614737565b16608086015298891660a0850152505060c08201959095529290941660e0830152610100820152610120019190915292915050565b63ffffffff8a168152602081018990526001600160a01b03888116604083015287811660608301526080820187905260a0820186905260c08201859052831660e082015261012081016153d2610100830184614dfa565b9a9950505050505050505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156154095761540961563c565b604052919050565b600067ffffffffffffffff82111561542b5761542b61563c565b5060209081020190565b6000821982111561544857615448615610565b500190565b60008261546857634e487b7160e01b81526012600452602481fd5b500490565b80825b600180861161547f57506154aa565b81870482111561549157615491615610565b8086161561549e57918102915b9490941c938002615470565b94509492505050565b600061326e60001984846000826154cc5750600161326e565b816154d95750600061326e565b81600181146154ef57600281146154f957615526565b600191505061326e565b60ff84111561550a5761550a615610565b6001841b91508482111561552057615520615610565b5061326e565b5060208310610133831016604e8410600b8410161715615554575081810a8381111561325d5761325d615610565b615561848484600161546d565b80860482111561557357615573615610565b02949350505050565b600081600019048311821515161561559657615596615610565b500290565b6000828210156155ad576155ad615610565b500390565b60005b838110156155cd5781810151838201526020016155b5565b83811115613ccd5750506000910152565b6000816155ed576155ed615610565b506000190190565b600060001982141561560957615609615610565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146112e757600080fd5b80151581146112e757600080fdfef206625bad3d9112d5609b8d356e6fbd514cd1f69980d4ce2b3e6e68e1789ace000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564358933fb1b4f9e62c7cd3651025ad8825acb20ebbb23b09160e3867d71501ddd43ccaf94e5a0ff213b32419bf56f27f93e4170af0c4867ff3412f6aa5a22daf09f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a89a264697066735822122096e44d8b608db7f5481c09a25aaeebb9861156b01044961d864e122290065fe164736f6c63430008020033