ETH Price: $2,523.58 (-0.03%)
Gas: 0.96 Gwei

Token

xsolace lock (xsLOCK)
 

Overview

Max Total Supply

84 xsLOCK

Holders

73

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 xsLOCK
0xef9f32bf7c6381d42bb942832fd0e56ab99008fb
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
xsLocker

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 31 : xsLocker.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "./../utils/ERC721Enhanced.sol";
import "./../utils/Governable.sol";
import "./../interfaces/staking/IxsListener.sol";
import "./../interfaces/staking/IxsLocker.sol";


/**
 * @title xsLocker
 * @author solace.fi
 * @notice Stake your [**SOLACE**](./../SOLACE) to receive voting rights, [**SOLACE**](./../SOLACE) rewards, and more.
 *
 * Locks are ERC721s and can be viewed with [`locks()`](#locks). Each lock has an `amount` of [**SOLACE**](./../SOLACE) and an `end` timestamp and cannot be transferred or withdrawn from before it unlocks. Locks have a maximum duration of four years.
 *
 * Users can create locks via [`createLock()`](#createlock) or [`createLockSigned()`](#createlocksigned), deposit more [**SOLACE**](./../SOLACE) into a lock via [`increaseAmount()`](#increaseamount) or [`increaseAmountSigned()`](#increaseamountsigned), extend a lock via [`extendLock()`](#extendlock), and withdraw via [`withdraw()`](#withdraw), [`withdrawInPart()`](#withdrawinpart), or [`withdrawMany()`](#withdrawmany).
 *
 * Users and contracts (eg BondTellers) may deposit on behalf of another user or contract.
 *
 * Any time a lock is updated it will notify the listener contracts (eg StakingRewards).
 *
 * Note that transferring [**SOLACE**](./../SOLACE) to this contract will not give you any rewards. You should deposit your [**SOLACE**](./../SOLACE) via [`createLock()`](#createlock) or [`createLockSigned()`](#createlocksigned).
 */
// solhint-disable-next-line contract-name-camelcase
contract xsLocker is IxsLocker, ERC721Enhanced, ReentrancyGuard, Governable {
    using EnumerableSet for EnumerableSet.AddressSet;

    /***************************************
    GLOBAL VARIABLES
    ***************************************/

    /// @notice [**SOLACE**](./../SOLACE) token.
    address public override solace;

    /// @notice The maximum time into the future that a lock can expire.
    uint256 public constant override MAX_LOCK_DURATION = 4 * (365 days);

    /// @notice The total number of locks that have been created.
    uint256 public override totalNumLocks;

    // Info on locks
    mapping(uint256 => Lock) private _locks;

    // Contracts that listen for lock changes
    EnumerableSet.AddressSet private _xsLockListeners;

    /**
     * @notice Construct the xsLocker contract.
     * @param governance_ The address of the [governor](/docs/protocol/governance).
     * @param solace_ Address of [**SOLACE**](./../SOLACE).
     */
    constructor(address governance_, address solace_)
        ERC721Enhanced("xsolace lock", "xsLOCK")
        Governable(governance_)
    {
        require(solace_ != address(0x0), "zero address solace");
        solace = solace_;
    }

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

    /**
     * @notice Information about a lock.
     * @param xsLockID The ID of the lock to query.
     * @return lock_ Information about the lock.
     */
    function locks(uint256 xsLockID) external view override tokenMustExist(xsLockID) returns (Lock memory lock_) {
        return _locks[xsLockID];
    }

    /**
     * @notice Determines if the lock is locked.
     * @param xsLockID The ID of the lock to query.
     * @return locked True if the lock is locked, false if unlocked.
     */
    function isLocked(uint256 xsLockID) external view override tokenMustExist(xsLockID) returns (bool locked) {
        // solhint-disable-next-line not-rely-on-time
        return _locks[xsLockID].end > block.timestamp;
    }

    /**
     * @notice Determines the time left until the lock unlocks.
     * @param xsLockID The ID of the lock to query.
     * @return time The time left in seconds, 0 if unlocked.
     */
    function timeLeft(uint256 xsLockID) external view override tokenMustExist(xsLockID) returns (uint256 time) {
        // solhint-disable-next-line not-rely-on-time
        return (_locks[xsLockID].end > block.timestamp)
            // solhint-disable-next-line not-rely-on-time
            ? _locks[xsLockID].end - block.timestamp // locked
            : 0; // unlocked
    }

    /**
     * @notice Returns the amount of [**SOLACE**](./../SOLACE) the user has staked.
     * @param account The account to query.
     * @return balance The user's balance.
     */
    function stakedBalance(address account) external view override returns (uint256 balance) {
        uint256 numOfLocks = balanceOf(account);
        balance = 0;
        for (uint256 i = 0; i < numOfLocks; i++) {
            uint256 xsLockID = tokenOfOwnerByIndex(account, i);
            balance += _locks[xsLockID].amount;
        }
        return balance;
    }

    /**
     * @notice The list of contracts that are listening to lock updates.
     * @return listeners_ The list as an array.
     */
    function getXsLockListeners() external view override returns (address[] memory listeners_) {
        uint256 len = _xsLockListeners.length();
        listeners_ = new address[](len);
        for(uint256 index = 0; index < len; index++) {
            listeners_[index] = _xsLockListeners.at(index);
        }
        return listeners_;
    }

    /***************************************
    MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Deposit [**SOLACE**](./../SOLACE) to create a new lock.
     * @dev [**SOLACE**](./../SOLACE) is transferred from msg.sender, assumes its already approved.
     * @dev use end=0 to initialize as unlocked.
     * @param recipient The account that will receive the lock.
     * @param amount The amount of [**SOLACE**](./../SOLACE) to deposit.
     * @param end The timestamp the lock will unlock.
     * @return xsLockID The ID of the newly created lock.
     */
    function createLock(address recipient, uint256 amount, uint256 end) external override nonReentrant returns (uint256 xsLockID) {
        // pull solace
        SafeERC20.safeTransferFrom(IERC20(solace), msg.sender, address(this), amount);
        // accounting
        return _createLock(recipient, amount, end);
    }

    /**
     * @notice Deposit [**SOLACE**](./../SOLACE) to create a new lock.
     * @dev [**SOLACE**](./../SOLACE) is transferred from msg.sender using ERC20Permit.
     * @dev use end=0 to initialize as unlocked.
     * @dev recipient = msg.sender
     * @param amount The amount of [**SOLACE**](./../SOLACE) to deposit.
     * @param end The timestamp the lock will unlock.
     * @param deadline Time the transaction must go through before.
     * @param v secp256k1 signature
     * @param r secp256k1 signature
     * @param s secp256k1 signature
     * @return xsLockID The ID of the newly created lock.
     */
    function createLockSigned(uint256 amount, uint256 end, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override nonReentrant returns (uint256 xsLockID) {
        // permit
        IERC20Permit(solace).permit(msg.sender, address(this), amount, deadline, v, r, s);
        // pull solace
        SafeERC20.safeTransferFrom(IERC20(solace), msg.sender, address(this), amount);
        // accounting
        return _createLock(msg.sender, amount, end);
    }

    /**
     * @notice Deposit [**SOLACE**](./../SOLACE) to increase the value of an existing lock.
     * @dev [**SOLACE**](./../SOLACE) is transferred from msg.sender, assumes its already approved.
     * @param xsLockID The ID of the lock to update.
     * @param amount The amount of [**SOLACE**](./../SOLACE) to deposit.
     */
    function increaseAmount(uint256 xsLockID, uint256 amount) external override nonReentrant tokenMustExist(xsLockID) {
        // pull solace
        SafeERC20.safeTransferFrom(IERC20(solace), msg.sender, address(this), amount);
        // accounting
        uint256 newAmount = _locks[xsLockID].amount + amount;
        _updateLock(xsLockID, newAmount, _locks[xsLockID].end);
    }

    /**
     * @notice Deposit [**SOLACE**](./../SOLACE) to increase the value of an existing lock.
     * @dev [**SOLACE**](./../SOLACE) is transferred from msg.sender using ERC20Permit.
     * @param xsLockID The ID of the lock to update.
     * @param amount The amount of [**SOLACE**](./../SOLACE) to deposit.
     * @param deadline Time the transaction must go through before.
     * @param v secp256k1 signature
     * @param r secp256k1 signature
     * @param s secp256k1 signature
     */
    function increaseAmountSigned(uint256 xsLockID, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override nonReentrant tokenMustExist(xsLockID) {
        // permit
        IERC20Permit(solace).permit(msg.sender, address(this), amount, deadline, v, r, s);
        // pull solace
        SafeERC20.safeTransferFrom(IERC20(solace), msg.sender, address(this), amount);
        // accounting
        uint256 newAmount = _locks[xsLockID].amount + amount;
        _updateLock(xsLockID, newAmount, _locks[xsLockID].end);
    }

    /**
     * @notice Extend a lock's duration.
     * @dev Can only be called by the lock owner or approved.
     * @param xsLockID The ID of the lock to update.
     * @param end The new time for the lock to unlock.
     */
    function extendLock(uint256 xsLockID, uint256 end) external override nonReentrant onlyOwnerOrApproved(xsLockID) {
        // solhint-disable-next-line not-rely-on-time
        require(end <= block.timestamp + MAX_LOCK_DURATION, "Max lock is 4 years");
        require(_locks[xsLockID].end <= end, "not extended");
        _updateLock(xsLockID, _locks[xsLockID].amount, end);
    }

    /**
     * @notice Withdraw from a lock in full.
     * @dev Can only be called by the lock owner or approved.
     * @dev Can only be called if unlocked.
     * @param xsLockID The ID of the lock to withdraw from.
     * @param recipient The user to receive the lock's [**SOLACE**](./../SOLACE).
     */
    function withdraw(uint256 xsLockID, address recipient) external override nonReentrant onlyOwnerOrApproved(xsLockID) {
        uint256 amount = _locks[xsLockID].amount;
        _withdraw(xsLockID, amount);
        // transfer solace
        SafeERC20.safeTransfer(IERC20(solace), recipient, amount);
    }

    /**
     * @notice Withdraw from a lock in part.
     * @dev Can only be called by the lock owner or approved.
     * @dev Can only be called if unlocked.
     * @param xsLockID The ID of the lock to withdraw from.
     * @param recipient The user to receive the lock's [**SOLACE**](./../SOLACE).
     * @param amount The amount of [**SOLACE**](./../SOLACE) to withdraw.
     */
    function withdrawInPart(uint256 xsLockID, address recipient, uint256 amount) external override nonReentrant onlyOwnerOrApproved(xsLockID) {
        require(amount <= _locks[xsLockID].amount, "excess withdraw");
        _withdraw(xsLockID, amount);
        // transfer solace
        SafeERC20.safeTransfer(IERC20(solace), recipient, amount);
    }

    /**
     * @notice Withdraw from multiple locks in full.
     * @dev Can only be called by the lock owner or approved.
     * @dev Can only be called if unlocked.
     * @param xsLockIDs The ID of the locks to withdraw from.
     * @param recipient The user to receive the lock's [**SOLACE**](./../SOLACE).
     */
    function withdrawMany(uint256[] calldata xsLockIDs, address recipient) external override nonReentrant {
        uint256 len = xsLockIDs.length;
        uint256 amount = 0;
        for(uint256 i = 0; i < len; i++) {
            uint256 xsLockID = xsLockIDs[i];
            require(_isApprovedOrOwner(msg.sender, xsLockID), "only owner or approved");
            uint256 amount_ = _locks[xsLockID].amount;
            amount += amount_;
            _withdraw(xsLockID, amount_);
        }
        // transfer solace
        SafeERC20.safeTransfer(IERC20(solace), recipient, amount);
    }

    /***************************************
    HELPER FUNCTIONS
    ***************************************/

    /**
     * @notice Creates a new lock.
     * @param recipient The user that the lock will be minted to.
     * @param amount The amount of [**SOLACE**](./../SOLACE) in the lock.
     * @param end The end of the lock.
     * @param xsLockID The ID of the new lock.
     */
    function _createLock(address recipient, uint256 amount, uint256 end) internal returns (uint256 xsLockID) {
        xsLockID = ++totalNumLocks;
        Lock memory newLock = Lock(amount, end);
        // solhint-disable-next-line not-rely-on-time
        require(newLock.end <= block.timestamp + MAX_LOCK_DURATION, "Max lock is 4 years");
        // accounting
        _locks[xsLockID] = newLock;
        _safeMint(recipient, xsLockID);
        emit LockCreated(xsLockID);
    }

    /**
     * @notice Updates an existing lock.
     * @param xsLockID The ID of the lock to update.
     * @param amount The amount of [**SOLACE**](./../SOLACE) now in the lock.
     * @param end The end of the lock.
     */
    function _updateLock(uint256 xsLockID, uint256 amount, uint256 end) internal {
        // checks
        Lock memory prevLock = _locks[xsLockID];
        Lock memory newLock = Lock(amount, end); // end was sanitized before passed in
        // accounting
        _locks[xsLockID] = newLock;
        address owner = ownerOf(xsLockID);
        _notify(xsLockID, owner, owner, prevLock, newLock);
        emit LockUpdated(xsLockID, amount, newLock.end);
    }

    /**
     * @notice Withdraws from a lock.
     * @param xsLockID The ID of the lock to withdraw from.
     * @param amount The amount of [**SOLACE**](./../SOLACE) to withdraw.
     */
    function _withdraw(uint256 xsLockID, uint256 amount) internal {
        // solhint-disable-next-line not-rely-on-time
        require(_locks[xsLockID].end <= block.timestamp, "locked"); // cannot withdraw while locked
        // accounting
        if(amount == _locks[xsLockID].amount) {
            _burn(xsLockID);
            delete _locks[xsLockID];
        }
        else {
            Lock memory oldLock = _locks[xsLockID];
            Lock memory newLock = Lock(oldLock.amount-amount, oldLock.end);
            _locks[xsLockID].amount -= amount;
            address owner = ownerOf(xsLockID);
            _notify(xsLockID, owner, owner, oldLock, newLock);
        }
        emit Withdrawl(xsLockID, amount);
    }

    /**
     * @notice Hook that is called after any token transfer. This includes minting and burning.
     * @param from The user that sends the token, or zero if minting.
     * @param to The zero that receives the token, or zero if burning.
     * @param xsLockID The ID of the token being transferred.
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 xsLockID
    ) internal override {
        super._afterTokenTransfer(from, to, xsLockID);
        Lock memory lock = _locks[xsLockID];
        // notify listeners
        if(from == address(0x0)) _notify(xsLockID, from, to, Lock(0, 0), lock); // mint
        else if(to == address(0x0)) _notify(xsLockID, from, to, lock, Lock(0, 0)); // burn
        else { // transfer
            // solhint-disable-next-line not-rely-on-time
            require(lock.end <= block.timestamp, "locked"); // cannot transfer while locked
            _notify(xsLockID, from, to, lock, lock);
        }
    }

    /**
     * @notice Notify the listeners of any updates.
     * @dev Called on transfer, mint, burn, and update.
     * Either the owner will change or the lock will change, not both.
     * @param xsLockID The ID of the lock that was altered.
     * @param oldOwner The old owner of the lock.
     * @param newOwner The new owner of the lock.
     * @param oldLock The old lock data.
     * @param newLock The new lock data.
     */
    function _notify(uint256 xsLockID, address oldOwner, address newOwner, Lock memory oldLock, Lock memory newLock) internal {
        // register action with listener
        uint256 len = _xsLockListeners.length();
        for(uint256 i = 0; i < len; i++) {
            IxsListener(_xsLockListeners.at(i)).registerLockEvent(xsLockID, oldOwner, newOwner, oldLock, newLock);
        }
    }

    /***************************************
    GOVERNANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Adds a listener.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param listener The listener to add.
     */
    function addXsLockListener(address listener) external override onlyGovernance {
        _xsLockListeners.add(listener);
        emit xsLockListenerAdded(listener);
    }

    /**
     * @notice Removes a listener.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param listener The listener to remove.
     */
    function removeXsLockListener(address listener) external override onlyGovernance {
        _xsLockListeners.remove(listener);
        emit xsLockListenerRemoved(listener);
    }

    /**
     * @notice Sets the base URI for computing `tokenURI`.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param baseURI_ The new base URI.
     */
    function setBaseURI(string memory baseURI_) external override onlyGovernance {
        _setBaseURI(baseURI_);
    }
}

File 2 of 31 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 3 of 31 : draft-ERC20Permit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private immutable _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

File 4 of 31 : 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);
}

File 5 of 31 : 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;
    }
}

File 6 of 31 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

File 7 of 31 : EnumerableMap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./EnumerableSet.sol";

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct Map {
        // Storage of keys
        EnumerableSet.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(
        Map storage map,
        bytes32 key,
        bytes32 value
    ) private returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function _remove(Map storage map, bytes32 key) private returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function _contains(Map storage map, bytes32 key) private view returns (bool) {
        return map._keys.contains(key);
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._keys.length();
    }

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

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
        bytes32 value = map._values[key];
        if (value == bytes32(0)) {
            return (_contains(map, key), bytes32(0));
        } else {
            return (true, value);
        }
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || _contains(map, key), "EnumerableMap: nonexistent key");
        return value;
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function _get(
        Map storage map,
        bytes32 key,
        string memory errorMessage
    ) private view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || _contains(map, key), errorMessage);
        return value;
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        UintToAddressMap storage map,
        uint256 key,
        address value
    ) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

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

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

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

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

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToAddressMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
    }
}

File 8 of 31 : draft-EIP712.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 9 of 31 : ERC721Enhanced.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// code borrowed from OpenZeppelin and @uniswap/v3-periphery
pragma solidity 0.8.6;

import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./../interfaces/utils/IERC1271.sol";
import "./../interfaces/utils/IERC721Enhanced.sol";

/**
 * @title ERC721Enhancedv1
 * @author solace.fi
 * @notice An extension of `ERC721`.
 *
 * The base is OpenZeppelin's `ERC721Enumerable` which also includes the `Metadata` extension. This extension includes simpler transfers, gasless approvals, and changeable URIs.
 */
abstract contract ERC721Enhanced is ERC721Enumerable, IERC721Enhanced, EIP712 {
    using Strings for uint256;

    /// @dev The nonces used in the permit signature verification.
    /// tokenID => nonce
    mapping(uint256 => uint256) private _nonces;

    /// @dev Value is equal to keccak256("Permit(address spender,uint256 tokenID,uint256 nonce,uint256 deadline)");
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private immutable _PERMIT_TYPEHASH = 0x137406564cdcf9b40b1700502a9241e87476728da7ae3d0edfcf0541e5b49b3e;

    string public baseURI;

    /**
     * @notice Constructs the `ERC721Enhancedv1` contract.
     * @param name_ The name of the token.
     * @param symbol_ The symbol of the token.
     */
    constructor(
        string memory name_,
        string memory symbol_
    ) ERC721(name_, symbol_) EIP712(name_, "1") {
        baseURI = "";
    }

    /***************************************
    SIMPLER TRANSFERS
    ***************************************/

    /**
     * @notice Transfers `tokenID` from `msg.sender` to `to`.
     * @dev This was excluded from the official `ERC721` standard in favor of `transferFrom(address from, address to, uint256 tokenID)`. We elect to include it.
     * @param to The receipient of the token.
     * @param tokenID The token to transfer.
     */
    function transfer(address to, uint256 tokenID) public override {
        super.transferFrom(msg.sender, to, tokenID);
    }

    /**
     * @notice Safely transfers `tokenID` from `msg.sender` to `to`.
     * @dev This was excluded from the official `ERC721` standard in favor of `safeTransferFrom(address from, address to, uint256 tokenID)`. We elect to include it.
     * @param to The receipient of the token.
     * @param tokenID The token to transfer.
     */
    function safeTransfer(address to, uint256 tokenID) public override {
        super.safeTransferFrom(msg.sender, to, tokenID, "");
    }

    /***************************************
    GASLESS APPROVALS
    ***************************************/

    /**
     * @notice Approve of a specific `tokenID` for spending by `spender` via signature.
     * @param spender The account that is being approved.
     * @param tokenID The ID of the token that is being approved for spending.
     * @param deadline The deadline timestamp by which the call must be mined for the approve to work.
     * @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`.
     * @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`.
     * @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`.
     */
    function permit(
        address spender,
        uint256 tokenID,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external override {
        require(_exists(tokenID), "query for nonexistent token");
        // solhint-disable-next-line not-rely-on-time
        require(block.timestamp <= deadline, "permit expired");

        uint256 nonce = _nonces[tokenID]++; // get then increment
        bytes32 digest =
            keccak256(
                abi.encodePacked(
                    "\x19\x01",
                    DOMAIN_SEPARATOR(),
                    keccak256(abi.encode(_PERMIT_TYPEHASH, spender, tokenID, nonce, deadline))
                )
            );
        address owner = ownerOf(tokenID);
        require(spender != owner, "cannot permit to self");

        if (Address.isContract(owner)) {
            require(IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) == 0x1626ba7e, "unauthorized");
        } else {
            address recoveredAddress = ecrecover(digest, v, r, s);
            require(recoveredAddress != address(0), "invalid signature");
            require(recoveredAddress == owner, "unauthorized");
        }

        _approve(spender, tokenID);
    }

    /**
     * @notice Returns the current nonce for `tokenID`. This value must be
     * included whenever a signature is generated for `permit`.
     * Every successful call to `permit` increases ``tokenID``'s nonce by one. This
     * prevents a signature from being used multiple times.
     * @param tokenID ID of the token to request nonce.
     * @return nonce Nonce of the token.
     */
    function nonces(uint256 tokenID) external view override returns (uint256 nonce) {
        return _nonces[tokenID];
    }

    /**
     * @notice The permit typehash used in the `permit` signature.
     * @return typehash The typehash for the `permit`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function PERMIT_TYPEHASH() external pure override returns (bytes32 typehash) {
        return _PERMIT_TYPEHASH;
    }

    /**
     * @notice The domain separator used in the encoding of the signature for `permit`, as defined by `EIP712`.
     * @return seperator The domain seperator for `permit`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() public view override returns (bytes32 seperator) {
        return _domainSeparatorV4();
    }

    /***************************************
    CHANGEABLE URIS
    ***************************************/

    /**
     * @notice Returns the Uniform Resource Identifier (URI) for `tokenID` token.
     */
    function tokenURI(uint256 tokenID) public view virtual override tokenMustExist(tokenID) returns (string memory) {
        string memory baseURI_ = baseURI;
        return string(abi.encodePacked(baseURI_, tokenID.toString()));
    }

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

    /**
     * @notice Sets the base URI for computing `tokenURI`.
     * @dev Remember to add access control to inheriting contracts.
     * @param baseURI_ The new base URI.
     */
    function _setBaseURI(string memory baseURI_) internal {
        baseURI = baseURI_;
        emit BaseURISet(baseURI_);
    }

    /***************************************
    MODIFIERS
    ***************************************/

    // Call will revert if the token does not exist.
    modifier tokenMustExist(uint256 tokenID) {
        require(_exists(tokenID), "query for nonexistent token");
        _;
    }

    // Call will revert if not made by owner.
    // Call will revert if the token does not exist.
    modifier onlyOwner(uint256 tokenID) {
        require(ownerOf(tokenID) == msg.sender, "only owner");
        _;
    }

    // Call will revert if not made by owner or approved.
    // Call will revert if the token does not exist.
    modifier onlyOwnerOrApproved(uint256 tokenID) {
        require(_isApprovedOrOwner(msg.sender, tokenID), "only owner or approved");
        _;
    }

    /***************************************
    MORE HOOKS
    ***************************************/

    /**
     * @notice Mints `tokenID` and transfers it to `to`.
     * @param to The receiver of the token.
     * @param tokenID The ID of the token to mint.
     */
    function _mint(address to, uint256 tokenID) internal virtual override {
        super._mint(to, tokenID);
        _afterTokenTransfer(address(0), to, tokenID);
    }

    /**
     * @notice Destroys `tokenID`.
     * @param tokenID The ID of the token to burn.
     */
    function _burn(uint256 tokenID) internal virtual override {
        address owner = ERC721.ownerOf(tokenID);
        super._burn(tokenID);
        _afterTokenTransfer(owner, address(0), tokenID);
    }

    /**
     * @notice Transfers `tokenID` from `from` to `to`.
     * @param from The account to transfer the token from.
     * @param to The account to transfer the token to.
     * @param tokenID The ID of the token to transfer.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenID
    ) internal virtual override {
        super._transfer(from, to, tokenID);
        _afterTokenTransfer(from, to, tokenID);
    }

    /**
     * @notice Hook that is called after any token transfer. This includes minting and burning.
     * @param from The user that sends the token, or zero if minting.
     * @param to The zero that receives the token, or zero if burning.
     * @param tokenID The ID of the token being transferred.
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenID
    // solhint-disable-next-line no-empty-blocks
    ) internal virtual {}

    /***************************************
    MISC
    ***************************************/

    /**
     * @notice Determines if a token exists or not.
     * @param tokenID The ID of the token to query.
     * @return status True if the token exists, false if it doesn't.
     */
    function exists(uint256 tokenID) external view override returns (bool status) {
        return _exists(tokenID);
    }
}

File 10 of 31 : Governable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

import "./../interfaces/utils/IGovernable.sol";

/**
 * @title Governable
 * @author solace.fi
 * @notice Enforces access control for important functions to [**governor**](/docs/protocol/governance).
 *
 * Many contracts contain functionality that should only be accessible to a privileged user. The most common access control pattern is [OpenZeppelin's `Ownable`](https://docs.openzeppelin.com/contracts/4.x/access-control#ownership-and-ownable). We instead use `Governable` with a few key differences:
   * - Transferring the governance role is a two step process. The current governance must [`setPendingGovernance(pendingGovernance_)`](#setpendinggovernance) then the new governance must [`acceptGovernance()`](#acceptgovernance). This is to safeguard against accidentally setting ownership to the wrong address and locking yourself out of your contract.
 * - `governance` is a constructor argument instead of `msg.sender`. This is especially useful when deploying contracts via a [`SingletonFactory`](./../interfaces/utils/ISingletonFactory).
 * - We use `lockGovernance()` instead of `renounceOwnership()`. `renounceOwnership()` is a prerequisite for the reinitialization bug because it sets `owner = address(0x0)`. We also use the `governanceIsLocked()` flag.
 */
contract Governable is IGovernable {

    /***************************************
    GLOBAL VARIABLES
    ***************************************/

    // Governor.
    address private _governance;

    // governance to take over.
    address private _pendingGovernance;

    bool private _locked;

    /**
     * @notice Constructs the governable contract.
     * @param governance_ The address of the [governor](/docs/protocol/governance).
     */
    constructor(address governance_) {
        require(governance_ != address(0x0), "zero address governance");
        _governance = governance_;
        _pendingGovernance = address(0x0);
        _locked = false;
    }

    /***************************************
    MODIFIERS
    ***************************************/

    // can only be called by governor
    // can only be called while unlocked
    modifier onlyGovernance() {
        require(!_locked, "governance locked");
        require(msg.sender == _governance, "!governance");
        _;
    }

    // can only be called by pending governor
    // can only be called while unlocked
    modifier onlyPendingGovernance() {
        require(!_locked, "governance locked");
        require(msg.sender == _pendingGovernance, "!pending governance");
        _;
    }

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

    /// @notice Address of the current governor.
    function governance() external view override returns (address) {
        return _governance;
    }

    /// @notice Address of the governor to take over.
    function pendingGovernance() external view override returns (address) {
        return _pendingGovernance;
    }

    /// @notice Returns true if governance is locked.
    function governanceIsLocked() external view override returns (bool) {
        return _locked;
    }

    /***************************************
    MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Initiates transfer of the governance role to a new governor.
     * Transfer is not complete until the new governor accepts the role.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param pendingGovernance_ The new governor.
     */
    function setPendingGovernance(address pendingGovernance_) external override onlyGovernance {
        _pendingGovernance = pendingGovernance_;
        emit GovernancePending(pendingGovernance_);
    }

    /**
     * @notice Accepts the governance role.
     * Can only be called by the pending governor.
     */
    function acceptGovernance() external override onlyPendingGovernance {
        // sanity check against transferring governance to the zero address
        // if someone figures out how to sign transactions from the zero address
        // consider the entirety of ethereum to be rekt
        require(_pendingGovernance != address(0x0), "zero governance");
        address oldGovernance = _governance;
        _governance = _pendingGovernance;
        _pendingGovernance = address(0x0);
        emit GovernanceTransferred(oldGovernance, _governance);
    }

    /**
     * @notice Permanently locks this contract's governance role and any of its functions that require the role.
     * This action cannot be reversed.
     * Before you call it, ask yourself:
     *   - Is the contract self-sustaining?
     *   - Is there a chance you will need governance privileges in the future?
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     */
    function lockGovernance() external override onlyGovernance {
        _locked = true;
        // intentionally not using address(0x0), see re-initialization exploit
        _governance = address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF);
        _pendingGovernance = address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF);
        emit GovernanceTransferred(msg.sender, address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF));
        emit GovernanceLocked();
    }
}

File 11 of 31 : IxsListener.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

import "./IxsLocker.sol";

/**
 * @title IxsListener
 * @author solace.fi
 * @notice A standard interface for notifying a contract about an action in another contract.
 */
interface IxsListener {
    /**
     * @notice Called when an action is performed on a lock.
     * @dev Called on transfer, mint, burn, and update.
     * Either the owner will change or the lock will change, not both.
     * @param xsLockID The ID of the lock that was altered.
     * @param oldOwner The old owner of the lock.
     * @param newOwner The new owner of the lock.
     * @param oldLock The old lock data.
     * @param newLock The new lock data.
     */
    function registerLockEvent(uint256 xsLockID, address oldOwner, address newOwner, Lock memory oldLock, Lock memory newLock) external;
}

File 12 of 31 : IxsLocker.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
import "./../utils/IERC721Enhanced.sol";

struct Lock {
    uint256 amount;
    uint256 end;
}


/**
 * @title IxsLocker
 * @author solace.fi
 * @notice Stake your [**SOLACE**](./../../SOLACE) to receive voting rights, [**SOLACE**](./../../SOLACE) rewards, and more.
 *
 * Locks are ERC721s and can be viewed with [`locks()`](#locks). Each lock has an `amount` of [**SOLACE**](./../../SOLACE) and an `end` timestamp and cannot be transferred or withdrawn from before it unlocks. Locks have a maximum duration of four years.
 *
 * Users can create locks via [`createLock()`](#createlock) or [`createLockSigned()`](#createlocksigned), deposit more [**SOLACE**](./../../SOLACE) into a lock via [`increaseAmount()`](#increaseamount) or [`increaseAmountSigned()`](#increaseamountsigned), extend a lock via [`extendLock()`](#extendlock), and withdraw via [`withdraw()`](#withdraw), [`withdrawInPart()`](#withdrawinpart), or [`withdrawMany()`](#withdrawmany).
 *
 * Users and contracts (eg BondTellers) may deposit on behalf of another user or contract.
 *
 * Any time a lock is updated it will notify the listener contracts (eg StakingRewards).
 *
 * Note that transferring [**SOLACE**](./../../SOLACE) to this contract will not give you any rewards. You should deposit your [**SOLACE**](./../../SOLACE) via [`createLock()`](#createlock) or [`createLockSigned()`](#createlocksigned).
 */
interface IxsLocker is IERC721Enhanced {

    /***************************************
    EVENTS
    ***************************************/

    /// @notice Emitted when a lock is created.
    event LockCreated(uint256 xsLockID);
    /// @notice Emitted when a lock is updated.
    event LockUpdated(uint256 xsLockID, uint256 amount, uint256 end);
    /// @notice Emitted when a lock is withdrawn from.
    event Withdrawl(uint256 xsLockID, uint256 amount);
    /// @notice Emitted when a listener is added.
    event xsLockListenerAdded(address listener);
    /// @notice Emitted when a listener is removed.
    event xsLockListenerRemoved(address listener);

    /***************************************
    GLOBAL VARIABLES
    ***************************************/

    /// @notice [**SOLACE**](./../../SOLACE) token.
    function solace() external view returns (address);

    /// @notice The maximum time into the future that a lock can expire.
    function MAX_LOCK_DURATION() external view returns (uint256);

    /// @notice The total number of locks that have been created.
    function totalNumLocks() external view returns (uint256);

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

    /**
     * @notice Information about a lock.
     * @param xsLockID The ID of the lock to query.
     * @return lock_ Information about the lock.
     */
    function locks(uint256 xsLockID) external view returns (Lock memory lock_);

    /**
     * @notice Determines if the lock is locked.
     * @param xsLockID The ID of the lock to query.
     * @return locked True if the lock is locked, false if unlocked.
     */
    function isLocked(uint256 xsLockID) external view returns (bool locked);

    /**
     * @notice Determines the time left until the lock unlocks.
     * @param xsLockID The ID of the lock to query.
     * @return time The time left in seconds, 0 if unlocked.
     */
    function timeLeft(uint256 xsLockID) external view returns (uint256 time);

    /**
     * @notice Returns the amount of [**SOLACE**](./../../SOLACE) the user has staked.
     * @param account The account to query.
     * @return balance The user's balance.
     */
    function stakedBalance(address account) external view returns (uint256 balance);

    /**
     * @notice The list of contracts that are listening to lock updates.
     * @return listeners_ The list as an array.
     */
    function getXsLockListeners() external view returns (address[] memory listeners_);

    /***************************************
    MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Deposit [**SOLACE**](./../../SOLACE) to create a new lock.
     * @dev [**SOLACE**](./../../SOLACE) is transferred from msg.sender, assumes its already approved.
     * @dev use end=0 to initialize as unlocked.
     * @param recipient The account that will receive the lock.
     * @param amount The amount of [**SOLACE**](./../../SOLACE) to deposit.
     * @param end The timestamp the lock will unlock.
     * @return xsLockID The ID of the newly created lock.
     */
    function createLock(address recipient, uint256 amount, uint256 end) external returns (uint256 xsLockID);

    /**
     * @notice Deposit [**SOLACE**](./../../SOLACE) to create a new lock.
     * @dev [**SOLACE**](./../../SOLACE) is transferred from msg.sender using ERC20Permit.
     * @dev use end=0 to initialize as unlocked.
     * @dev recipient = msg.sender
     * @param amount The amount of [**SOLACE**](./../../SOLACE) to deposit.
     * @param end The timestamp the lock will unlock.
     * @param deadline Time the transaction must go through before.
     * @param v secp256k1 signature
     * @param r secp256k1 signature
     * @param s secp256k1 signature
     * @return xsLockID The ID of the newly created lock.
     */
    function createLockSigned(uint256 amount, uint256 end, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external returns (uint256 xsLockID);

    /**
     * @notice Deposit [**SOLACE**](./../../SOLACE) to increase the value of an existing lock.
     * @dev [**SOLACE**](./../../SOLACE) is transferred from msg.sender, assumes its already approved.
     * @param xsLockID The ID of the lock to update.
     * @param amount The amount of [**SOLACE**](./../../SOLACE) to deposit.
     */
    function increaseAmount(uint256 xsLockID, uint256 amount) external;

    /**
     * @notice Deposit [**SOLACE**](./../../SOLACE) to increase the value of an existing lock.
     * @dev [**SOLACE**](./../../SOLACE) is transferred from msg.sender using ERC20Permit.
     * @param xsLockID The ID of the lock to update.
     * @param amount The amount of [**SOLACE**](./../../SOLACE) to deposit.
     * @param deadline Time the transaction must go through before.
     * @param v secp256k1 signature
     * @param r secp256k1 signature
     * @param s secp256k1 signature
     */
    function increaseAmountSigned(uint256 xsLockID, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;

    /**
     * @notice Extend a lock's duration.
     * @dev Can only be called by the lock owner or approved.
     * @param xsLockID The ID of the lock to update.
     * @param end The new time for the lock to unlock.
     */
    function extendLock(uint256 xsLockID, uint256 end) external;

    /**
     * @notice Withdraw from a lock in full.
     * @dev Can only be called by the lock owner or approved.
     * @dev Can only be called if unlocked.
     * @param xsLockID The ID of the lock to withdraw from.
     * @param recipient The user to receive the lock's [**SOLACE**](./../../SOLACE).
     */
    function withdraw(uint256 xsLockID, address recipient) external;

    /**
     * @notice Withdraw from a lock in part.
     * @dev Can only be called by the lock owner or approved.
     * @dev Can only be called if unlocked.
     * @param xsLockID The ID of the lock to withdraw from.
     * @param recipient The user to receive the lock's [**SOLACE**](./../../SOLACE).
     * @param amount The amount of [**SOLACE**](./../../SOLACE) to withdraw.
     */
    function withdrawInPart(uint256 xsLockID, address recipient, uint256 amount) external;

    /**
     * @notice Withdraw from multiple locks in full.
     * @dev Can only be called by the lock owner or approved.
     * @dev Can only be called if unlocked.
     * @param xsLockIDs The ID of the locks to withdraw from.
     * @param recipient The user to receive the lock's [**SOLACE**](./../../SOLACE).
     */
    function withdrawMany(uint256[] calldata xsLockIDs, address recipient) external;

    /***************************************
    GOVERNANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Adds a listener.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param listener The listener to add.
     */
    function addXsLockListener(address listener) external;

    /**
     * @notice Removes a listener.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param listener The listener to remove.
     */
    function removeXsLockListener(address listener) external;

    /**
     * @notice Sets the base URI for computing `tokenURI`.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param baseURI_ The new base URI.
     */
    function setBaseURI(string memory baseURI_) external;
}

File 13 of 31 : 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);
            }
        }
    }
}

File 14 of 31 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

File 15 of 31 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/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 {}
}

File 16 of 31 : 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));
    }
}

File 17 of 31 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 18 of 31 : 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);
}

File 19 of 31 : 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;
    }
}

File 20 of 31 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 21 of 31 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    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);
    }
}

File 22 of 31 : IERC1271.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// code borrowed from @uniswap/v3-periphery
pragma solidity 0.8.6;

/// @title Interface for verifying contract-based account signatures
/// @notice Interface that verifies provided signature for the data
/// @dev Interface defined by EIP-1271
interface IERC1271 {
    /// @notice Returns whether the provided signature is valid for the provided data
    /// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.
    /// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).
    /// MUST allow external calls.
    /// @param hash Hash of the data to be signed
    /// @param signature Signature byte array associated with _data
    /// @return magicValue The bytes4 magic value 0x1626ba7e
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

File 23 of 31 : IERC721Enhanced.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// code borrowed from OpenZeppelin and @uniswap/v3-periphery
pragma solidity 0.8.6;

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

/**
 * @title ERC721Enhancedv1
 * @author solace.fi
 * @notice An extension of `ERC721`.
 *
 * The base is OpenZeppelin's `ERC721Enumerable` which also includes the `Metadata` extension. This extension includes simpler transfers, gasless approvals, and changeable URIs.
 */
interface IERC721Enhanced is IERC721Enumerable {

    /***************************************
    SIMPLER TRANSFERS
    ***************************************/

    /**
     * @notice Transfers `tokenID` from `msg.sender` to `to`.
     * @dev This was excluded from the official `ERC721` standard in favor of `transferFrom(address from, address to, uint256 tokenID)`. We elect to include it.
     * @param to The receipient of the token.
     * @param tokenID The token to transfer.
     */
    function transfer(address to, uint256 tokenID) external;

    /**
     * @notice Safely transfers `tokenID` from `msg.sender` to `to`.
     * @dev This was excluded from the official `ERC721` standard in favor of `safeTransferFrom(address from, address to, uint256 tokenID)`. We elect to include it.
     * @param to The receipient of the token.
     * @param tokenID The token to transfer.
     */
    function safeTransfer(address to, uint256 tokenID) external;

    /***************************************
    GASLESS APPROVALS
    ***************************************/

    /**
     * @notice Approve of a specific `tokenID` for spending by `spender` via signature.
     * @param spender The account that is being approved.
     * @param tokenID The ID of the token that is being approved for spending.
     * @param deadline The deadline timestamp by which the call must be mined for the approve to work.
     * @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`.
     * @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`.
     * @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`.
     */
    function permit(
        address spender,
        uint256 tokenID,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @notice Returns the current nonce for `tokenID`. This value must be
     * included whenever a signature is generated for `permit`.
     * Every successful call to `permit` increases ``tokenID``'s nonce by one. This
     * prevents a signature from being used multiple times.
     * @param tokenID ID of the token to request nonce.
     * @return nonce Nonce of the token.
     */
    function nonces(uint256 tokenID) external view returns (uint256 nonce);

    /**
     * @notice The permit typehash used in the `permit` signature.
     * @return typehash The typehash for the `permit`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function PERMIT_TYPEHASH() external view returns (bytes32 typehash);

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

    /***************************************
    CHANGEABLE URIS
    ***************************************/

    /// @notice Emitted when the base URI is set.
    event BaseURISet(string baseURI);

    /***************************************
    MISC
    ***************************************/

    /**
     * @notice Determines if a token exists or not.
     * @param tokenID The ID of the token to query.
     * @return status True if the token exists, false if it doesn't.
     */
    function exists(uint256 tokenID) external view returns (bool status);
}

File 24 of 31 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

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

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

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

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

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

File 25 of 31 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 26 of 31 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 27 of 31 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 28 of 31 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 29 of 31 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 30 of 31 : IERC165.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 IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 31 of 31 : IGovernable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

/**
 * @title IGovernable
 * @author solace.fi
 * @notice Enforces access control for important functions to [**governor**](/docs/protocol/governance).
 *
 * Many contracts contain functionality that should only be accessible to a privileged user. The most common access control pattern is [OpenZeppelin's `Ownable`](https://docs.openzeppelin.com/contracts/4.x/access-control#ownership-and-ownable). We instead use `Governable` with a few key differences:
 * - Transferring the governance role is a two step process. The current governance must [`setPendingGovernance(pendingGovernance_)`](#setpendinggovernance) then the new governance must [`acceptGovernance()`](#acceptgovernance). This is to safeguard against accidentally setting ownership to the wrong address and locking yourself out of your contract.
 * - `governance` is a constructor argument instead of `msg.sender`. This is especially useful when deploying contracts via a [`SingletonFactory`](./ISingletonFactory).
 * - We use `lockGovernance()` instead of `renounceOwnership()`. `renounceOwnership()` is a prerequisite for the reinitialization bug because it sets `owner = address(0x0)`. We also use the `governanceIsLocked()` flag.
 */
interface IGovernable {

    /***************************************
    EVENTS
    ***************************************/

    /// @notice Emitted when pending Governance is set.
    event GovernancePending(address pendingGovernance);
    /// @notice Emitted when Governance is set.
    event GovernanceTransferred(address oldGovernance, address newGovernance);
    /// @notice Emitted when Governance is locked.
    event GovernanceLocked();

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

    /// @notice Address of the current governor.
    function governance() external view returns (address);

    /// @notice Address of the governor to take over.
    function pendingGovernance() external view returns (address);

    /// @notice Returns true if governance is locked.
    function governanceIsLocked() external view returns (bool);

    /***************************************
    MUTATORS
    ***************************************/

    /**
     * @notice Initiates transfer of the governance role to a new governor.
     * Transfer is not complete until the new governor accepts the role.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param pendingGovernance_ The new governor.
     */
    function setPendingGovernance(address pendingGovernance_) external;

    /**
     * @notice Accepts the governance role.
     * Can only be called by the new governor.
     */
    function acceptGovernance() external;

    /**
     * @notice Permanently locks this contract's governance role and any of its functions that require the role.
     * This action cannot be reversed.
     * Before you call it, ask yourself:
     *   - Is the contract self-sustaining?
     *   - Is there a chance you will need governance privileges in the future?
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     */
    function lockGovernance() external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"governance_","type":"address"},{"internalType":"address","name":"solace_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"BaseURISet","type":"event"},{"anonymous":false,"inputs":[],"name":"GovernanceLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pendingGovernance","type":"address"}],"name":"GovernancePending","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldGovernance","type":"address"},{"indexed":false,"internalType":"address","name":"newGovernance","type":"address"}],"name":"GovernanceTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"xsLockID","type":"uint256"}],"name":"LockCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"xsLockID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"}],"name":"LockUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"xsLockID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawl","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"listener","type":"address"}],"name":"xsLockListenerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"listener","type":"address"}],"name":"xsLockListenerRemoved","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"seperator","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_LOCK_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"typehash","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"acceptGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"listener","type":"address"}],"name":"addXsLockListener","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"createLock","outputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"createLockSigned","outputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"status","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"extendLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getXsLockListeners","outputs":[{"internalType":"address[]","name":"listeners_","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceIsLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"increaseAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"increaseAmountSigned","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"locked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"}],"name":"locks","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"internalType":"struct Lock","name":"lock_","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokenID","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"listener","type":"address"}],"name":"removeXsLockListener","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"safeTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingGovernance_","type":"address"}],"name":"setPendingGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"solace","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"stakedBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"}],"name":"timeLeft","outputs":[{"internalType":"uint256","name":"time","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalNumLocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"xsLockID","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawInPart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"xsLockIDs","type":"uint256[]"},{"internalType":"address","name":"recipient","type":"address"}],"name":"withdrawMany","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101406040527f137406564cdcf9b40b1700502a9241e87476728da7ae3d0edfcf0541e5b49b3e610120523480156200003757600080fd5b50604051620048c3380380620048c38339810160408190526200005a916200035b565b816040518060400160405280600c81526020016b78736f6c616365206c6f636b60a01b8152506040518060400160405280600681526020016578734c4f434b60d01b81525081604051806040016040528060018152602001603160f81b81525083838160009080519060200190620000d492919062000298565b508051620000ea90600190602084019062000298565b5050825160209384012082519284019290922060c083815260e08281524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818b0181905281830199909952606081019690965260808087019390935230868301528051808703909201825293850180855281519190980120905261010094909452920191829052506000918290526200019191600b919062000298565b50506001600c55506001600160a01b038116620001f55760405162461bcd60e51b815260206004820152601760248201527f7a65726f206164647265737320676f7665726e616e636500000000000000000060448201526064015b60405180910390fd5b600d80546001600160a01b0319166001600160a01b03928316179055600e80546001600160a81b03191690558116620002715760405162461bcd60e51b815260206004820152601360248201527f7a65726f206164647265737320736f6c616365000000000000000000000000006044820152606401620001ec565b600f80546001600160a01b0319166001600160a01b039290921691909117905550620003d0565b828054620002a69062000393565b90600052602060002090601f016020900481019282620002ca576000855562000315565b82601f10620002e557805160ff191683800117855562000315565b8280016001018555821562000315579182015b8281111562000315578251825591602001919060010190620002f8565b506200032392915062000327565b5090565b5b8082111562000323576000815560010162000328565b80516001600160a01b03811681146200035657600080fd5b919050565b600080604083850312156200036f57600080fd5b6200037a836200033e565b91506200038a602084016200033e565b90509250929050565b600181811c90821680620003a857607f821691505b60208210811415620003ca57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e051610100516101205161449c620004276000396000818161045d01526115f401526000612b0a01526000612b5901526000612b3401526000612ab801526000612ae1015261449c6000f3fe608060405234801561001057600080fd5b506004361061032a5760003560e01c806360217267116101b2578063abcde77f116100f9578063df19578f116100a2578063f39c38a01161007c578063f39c38a0146106b9578063f4dadc61146106ca578063f6aacfb1146106ea578063fcd3fe07146106fd57600080fd5b8063df19578f14610661578063e985e9c51461066a578063f0591053146106a657600080fd5b8063b88d4fde116100d3578063b88d4fde14610628578063c87b56dd1461063b578063d61866271461064e57600080fd5b8063abcde77f146105ef578063b0d4c9a414610602578063b2383e551461061557600080fd5b80637ac2ff7b1161015b578063a22cb46511610135578063a22cb465146105c1578063a9059cbb146105d4578063abbf4b17146105e757600080fd5b80637ac2ff7b146105935780638d50b33d146105a657806395d89b41146105b957600080fd5b80636c0360eb1161018c5780636c0360eb1461056357806370a082311461056b578063719a59751461057e57600080fd5b8063602172671461052a5780636352211e1461053d578063650e15051461055057600080fd5b80632f745c591161027657806347cb7a681161021f5780634f6ccce7116101f95780634f6ccce7146104f357806355f804b3146105065780635aa6e6751461051957600080fd5b806347cb7a68146104c25780634f1bfc9e146104d55780634f558e79146104e057600080fd5b80633ef8d97e116102505780633ef8d97e14610489578063423f6cef1461049c57806342842e0e146104af57600080fd5b80632f745c591461044857806330adf81f1461045b5780633644e5151461048157600080fd5b80630abb6035116102d85780631c930221116102b25780631c9302211461041b578063238efcbc1461042d57806323b872dd1461043557600080fd5b80630abb6035146103d2578063141a468c146103e557806318160ddd1461041357600080fd5b8063070d66bf11610309578063070d66bf14610381578063081812fc14610394578063095ea7b3146103bf57600080fd5b8062f714ce1461032f57806301ffc9a71461034457806306fdde031461036c575b600080fd5b61034261033d3660046140d2565b610710565b005b610357610352366004614036565b6107f8565b60405190151581526020015b60405180910390f35b610374610823565b604051610363919061428c565b61034261038f36600461411a565b6108b5565b6103a76103a23660046140b9565b610a40565b6040516001600160a01b039091168152602001610363565b6103426103cd366004613ee0565b610ad5565b6103426103e0366004613da3565b610beb565b6104056103f33660046140b9565b6000908152600a602052604090205490565b604051908152602001610363565b600854610405565b600e54600160a01b900460ff16610357565b610342610cd6565b610342610443366004613df1565b610e3c565b610405610456366004613ee0565b610ec3565b7f0000000000000000000000000000000000000000000000000000000000000000610405565b610405610f6b565b600f546103a7906001600160a01b031681565b6103426104aa366004613ee0565b610f7a565b6103426104bd366004613df1565b610f99565b6104056104d03660046140b9565b610fb4565b610405630784ce0081565b6103576104ee3660046140b9565b61105f565b6104056105013660046140b9565b61107e565b610342610514366004614070565b611122565b600d546001600160a01b03166103a7565b610405610538366004613da3565b6111c4565b6103a761054b3660046140b9565b611226565b61040561055e366004613f0a565b6112b1565b61037461133b565b610405610579366004613da3565b6113c9565b610586611463565b6040516103639190614226565b6103426105a1366004613f3d565b61150f565b6103426105b4366004613f95565b61195b565b610374611a8a565b6103426105cf366004613ea9565b611a99565b6103426105e2366004613ee0565b611b5e565b610342611b69565b6103426105fd36600461413c565b611cc3565b610342610610366004613da3565b611e76565b61034261062336600461411a565b611f51565b610342610636366004613e2d565b61206c565b6103746106493660046140b9565b6120fa565b61034261065c3660046140f5565b61222c565b61040560105481565b610357610678366004613dbe565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6104056106b436600461413c565b612353565b600e546001600160a01b03166103a7565b6106dd6106d83660046140b9565b612469565b604051610363919061429f565b6103576106f83660046140b9565b61250e565b61034261070b366004613da3565b61258d565b6002600c5414156107685760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600c55816107783382612668565b6107bd5760405162461bcd60e51b81526020600482015260166024820152751bdb9b1e481bdddb995c881bdc88185c1c1c9bdd995960521b604482015260640161075f565b6000838152601160205260409020546107d6848261275f565b600f546107ed906001600160a01b031684836128bb565b50506001600c555050565b60006001600160e01b0319821663780e9d6360e01b148061081d575061081d82612933565b92915050565b60606000805461083290614370565b80601f016020809104026020016040519081016040528092919081815260200182805461085e90614370565b80156108ab5780601f10610880576101008083540402835291602001916108ab565b820191906000526020600020905b81548152906001019060200180831161088e57829003601f168201915b5050505050905090565b6002600c5414156109085760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c55816109183382612668565b61095d5760405162461bcd60e51b81526020600482015260166024820152751bdb9b1e481bdddb995c881bdc88185c1c1c9bdd995960521b604482015260640161075f565b61096b630784ce0042614301565b8211156109ba5760405162461bcd60e51b815260206004820152601360248201527f4d6178206c6f636b206973203420796561727300000000000000000000000000604482015260640161075f565b600083815260116020526040902060010154821015610a1b5760405162461bcd60e51b815260206004820152600c60248201527f6e6f7420657874656e6465640000000000000000000000000000000000000000604482015260640161075f565b600083815260116020526040902054610a3690849084612983565b50506001600c5550565b6000818152600260205260408120546001600160a01b0316610ab95760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161075f565b506000908152600460205260409020546001600160a01b031690565b6000610ae082611226565b9050806001600160a01b0316836001600160a01b03161415610b4e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161075f565b336001600160a01b0382161480610b6a5750610b6a8133610678565b610bdc5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161075f565b610be68383612a30565b505050565b600e54600160a01b900460ff1615610c395760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b03163314610c815760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd61ed858909d3cb796547804c47dc1550d27455f8a0037b6b487e46212392396906020015b60405180910390a150565b600e54600160a01b900460ff1615610d245760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600e546001600160a01b03163314610d7e5760405162461bcd60e51b815260206004820152601360248201527f2170656e64696e6720676f7665726e616e636500000000000000000000000000604482015260640161075f565b600e546001600160a01b0316610dd65760405162461bcd60e51b815260206004820152600f60248201527f7a65726f20676f7665726e616e63650000000000000000000000000000000000604482015260640161075f565b600d8054600e80546001600160a01b038082166001600160a01b0319808616821790965594909116909155604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce809101610ccb565b610e463382612668565b610eb85760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606482015260840161075f565b610be6838383612a9e565b6000610ece836113c9565b8210610f425760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e6473000000000000000000000000000000000000000000606482015260840161075f565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6000610f75612ab4565b905090565b610f953383836040518060200160405280600081525061206c565b5050565b610be68383836040518060200160405280600081525061206c565b60008181526002602052604081205482906001600160a01b031661101a5760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b6000838152601160205260409020600101544210611039576000611056565b60008381526011602052604090206001015461105690429061432d565b91505b50919050565b6000818152600260205260408120546001600160a01b0316151561081d565b600061108960085490565b82106110fd5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e64730000000000000000000000000000000000000000606482015260840161075f565b6008828154811061111057611110614416565b90600052602060002001549050919050565b600e54600160a01b900460ff16156111705760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b031633146111b85760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b6111c181612ba7565b50565b6000806111d0836113c9565b90506000915060005b8181101561121f5760006111ed8583610ec3565b6000818152601160205260409020549091506112099085614301565b9350508080611217906143a5565b9150506111d9565b5050919050565b6000818152600260205260408120546001600160a01b03168061081d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e0000000000000000000000000000000000000000000000606482015260840161075f565b60006002600c5414156113065760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c55600f54611323906001600160a01b0316333086612bea565b61132e848484612c22565b6001600c55949350505050565b600b805461134890614370565b80601f016020809104026020016040519081016040528092919081815260200182805461137490614370565b80156113c15780601f10611396576101008083540402835291602001916113c1565b820191906000526020600020905b8154815290600101906020018083116113a457829003601f168201915b505050505081565b60006001600160a01b0382166114475760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f206164647265737300000000000000000000000000000000000000000000606482015260840161075f565b506001600160a01b031660009081526003602052604090205490565b606060006114716012612d14565b90508067ffffffffffffffff81111561148c5761148c61442c565b6040519080825280602002602001820160405280156114b5578160200160208202803683370190505b50915060005b8181101561150a576114ce601282612d1e565b8382815181106114e0576114e0614416565b6001600160a01b039092166020928302919091019091015280611502816143a5565b9150506114bb565b505090565b6000858152600260205260409020546001600160a01b03166115735760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b834211156115c35760405162461bcd60e51b815260206004820152600e60248201527f7065726d69742065787069726564000000000000000000000000000000000000604482015260640161075f565b6000858152600a60205260408120805490826115de836143a5565b91905055905060006115ee610f6b565b604080517f000000000000000000000000000000000000000000000000000000000000000060208201526001600160a01b038b1691810191909152606081018990526080810184905260a0810188905260c0016040516020818303038152906040528051906020012060405160200161167e92919061190160f01b81526002810192909252602282015260420190565b60405160208183030381529060405280519060200120905060006116a188611226565b9050806001600160a01b0316896001600160a01b031614156117055760405162461bcd60e51b815260206004820152601560248201527f63616e6e6f74207065726d697420746f2073656c660000000000000000000000604482015260640161075f565b803b1561183d57604080516020810187905280820186905260f888901b7fff00000000000000000000000000000000000000000000000000000000000000166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b03831691631626ba7e91611785918691606501614273565b60206040518083038186803b15801561179d57600080fd5b505afa1580156117b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d59190614053565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916631626ba7e60e01b146118385760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b604482015260640161075f565b611946565b6040805160008082526020820180845285905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015611891573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166118f45760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964207369676e6174757265000000000000000000000000000000604482015260640161075f565b816001600160a01b0316816001600160a01b0316146119445760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b604482015260640161075f565b505b6119508989612a30565b505050505050505050565b6002600c5414156119ae5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c55816000805b82811015611a665760008686838181106119d4576119d4614416565b9050602002013590506119e73382612668565b611a2c5760405162461bcd60e51b81526020600482015260166024820152751bdb9b1e481bdddb995c881bdc88185c1c1c9bdd995960521b604482015260640161075f565b600081815260116020526040902054611a458185614301565b9350611a51828261275f565b50508080611a5e906143a5565b9150506119b8565b50600f54611a7e906001600160a01b031684836128bb565b50506001600c55505050565b60606001805461083290614370565b6001600160a01b038216331415611af25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161075f565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610f95338383610e3c565b600e54600160a01b900460ff1615611bb75760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b03163314611bff5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b600e8054600d80546001600160a01b036001600160a01b031990911681179091557fffffffffffffffffffffff0000000000000000000000000000000000000000009091167401ffffffffffffffffffffffffffffffffffffffff179091556040805133815260208101929092527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a16040517fd572292b9e5d684b0719ae2d0e210513b477e303c975ed1c63b6fcac1607672790600090a1565b6002600c541415611d165760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c5585611d3d816000908152600260205260409020546001600160a01b0316151590565b611d895760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b600f5460405163d505accf60e01b8152336004820152306024820152604481018890526064810187905260ff8616608482015260a4810185905260c481018490526001600160a01b039091169063d505accf9060e401600060405180830381600087803b158015611df957600080fd5b505af1158015611e0d573d6000803e3d6000fd5b5050600f54611e2a92506001600160a01b03169050333089612bea565b600087815260116020526040812054611e44908890614301565b9050611e678882601160008c815260200190815260200160002060010154612983565b50506001600c55505050505050565b600e54600160a01b900460ff1615611ec45760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b03163314611f0c5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b611f17601282612d31565b506040516001600160a01b03821681527f7225315bb5c525892679876f6b48a3a4fd28294d637607a8cf23f62b372051e590602001610ccb565b6002600c541415611fa45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c5581611fcb816000908152600260205260409020546001600160a01b0316151590565b6120175760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b600f5461202f906001600160a01b0316333085612bea565b600083815260116020526040812054612049908490614301565b90506107ed84826011600088815260200190815260200160002060010154612983565b6120763383612668565b6120e85760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606482015260840161075f565b6120f484848484612d46565b50505050565b60608161211e816000908152600260205260409020546001600160a01b0316151590565b61216a5760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b6000600b805461217990614370565b80601f01602080910402602001604051908101604052809291908181526020018280546121a590614370565b80156121f25780601f106121c7576101008083540402835291602001916121f2565b820191906000526020600020905b8154815290600101906020018083116121d557829003601f168201915b505050505090508061220385612dc4565b6040516020016122149291906141bb565b60405160208183030381529060405292505050919050565b6002600c54141561227f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c558261228f3382612668565b6122d45760405162461bcd60e51b81526020600482015260166024820152751bdb9b1e481bdddb995c881bdc88185c1c1c9bdd995960521b604482015260640161075f565b6000848152601160205260409020548211156123325760405162461bcd60e51b815260206004820152600f60248201527f6578636573732077697468647261770000000000000000000000000000000000604482015260640161075f565b61233c848361275f565b600f546107ed906001600160a01b031684846128bb565b60006002600c5414156123a85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c55600f5460405163d505accf60e01b8152336004820152306024820152604481018990526064810187905260ff8616608482015260a4810185905260c481018490526001600160a01b039091169063d505accf9060e401600060405180830381600087803b15801561241d57600080fd5b505af1158015612431573d6000803e3d6000fd5b5050600f5461244e92506001600160a01b0316905033308a612bea565b612459338888612c22565b6001600c55979650505050505050565b604080518082019091526000808252602082015260008281526002602052604090205482906001600160a01b03166124e35760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b5050600090815260116020908152604091829020825180840190935280548352600101549082015290565b60008181526002602052604081205482906001600160a01b03166125745760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b5050600090815260116020526040902060010154421090565b600e54600160a01b900460ff16156125db5760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b031633146126235760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b61262e601282612eda565b506040516001600160a01b03821681527ffd724879dc1d8ebf9fb54b059c1745e8a5883d242f763594d2bba7b438ccbfe390602001610ccb565b6000818152600260205260408120546001600160a01b03166126e15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161075f565b60006126ec83611226565b9050806001600160a01b0316846001600160a01b031614806127275750836001600160a01b031661271c84610a40565b6001600160a01b0316145b8061275757506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b6000828152601160205260409020600101544210156127a95760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b604482015260640161075f565b6000828152601160205260409020548114156127e2576127c882612eef565b60008281526011602052604081208181556001015561287e565b600082815260116020908152604080832081518083018352815481526001909101549281019290925280518082019091528151919291819061282590869061432d565b8152602001836020015181525090508260116000868152602001908152602001600020600001600082825461285a919061432d565b909155506000905061286b85611226565b905061287a8582838686612f11565b5050505b60408051838152602081018390527f8c90f1854273170c1e829c713d0989ed4dcfedc62f89a508607eb1b002d3f64c910160405180910390a15050565b6040516001600160a01b038316602482015260448101829052610be690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612fb6565b60006001600160e01b031982166380ac58cd60e01b148061296457506001600160e01b03198216635b5e139f60e01b145b8061081d57506301ffc9a760e01b6001600160e01b031983161461081d565b600083815260116020818152604080842081518083018352815481526001820180548286015283518085019094528884528385018881528a8852959094528251909155925190915590916129d686611226565b90506129e58682838686612f11565b602080830151604080518981529283018890528201527f067e2f70e7e1385380aeba8b936c35350c777e1243ec52626e253060ead700c29060600160405180910390a1505050505050565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612a6582611226565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612aa983838361309b565b610be683838361325a565b60007f0000000000000000000000000000000000000000000000000000000000000000461415612b0357507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b8051612bba90600b906020840190613c67565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f681604051610ccb919061428c565b6040516001600160a01b03808516602483015283166044820152606481018290526120f49085906323b872dd60e01b906084016128e7565b6000601060008154612c33906143a5565b91829055506040805180820190915284815260208101849052909150612c5d630784ce0042614301565b81602001511115612cb05760405162461bcd60e51b815260206004820152601360248201527f4d6178206c6f636b206973203420796561727300000000000000000000000000604482015260640161075f565b60008281526011602090815260409091208251815590820151600190910155612cd98583613331565b6040518281527ff5c3a5bb1319c895b2a31add0dbddb093066a7a052f45fd86c020ee3658b69d09060200160405180910390a1509392505050565b600061081d825490565b6000612d2a838361334b565b9392505050565b6000612d2a836001600160a01b038416613375565b612d51848484612a9e565b612d5d848484846133c4565b6120f45760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161075f565b606081612de85750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612e125780612dfc816143a5565b9150612e0b9050600a83614319565b9150612dec565b60008167ffffffffffffffff811115612e2d57612e2d61442c565b6040519080825280601f01601f191660200182016040528015612e57576020820181803683370190505b5090505b841561275757612e6c60018361432d565b9150612e79600a866143c0565b612e84906030614301565b60f81b818381518110612e9957612e99614416565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612ed3600a86614319565b9450612e5b565b6000612d2a836001600160a01b03841661351c565b6000612efa82611226565b9050612f058261360f565b610f958160008461325a565b6000612f1d6012612d14565b905060005b81811015612fad57612f35601282612d1e565b6001600160a01b031663d517b34b88888888886040518663ffffffff1660e01b8152600401612f689594939291906142b6565b600060405180830381600087803b158015612f8257600080fd5b505af1158015612f96573d6000803e3d6000fd5b505050508080612fa5906143a5565b915050612f22565b50505050505050565b600061300b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136b69092919063ffffffff16565b805190915015610be657808060200190518101906130299190614019565b610be65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161075f565b826001600160a01b03166130ae82611226565b6001600160a01b03161461312a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e0000000000000000000000000000000000000000000000606482015260840161075f565b6001600160a01b03821661318c5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161075f565b6131978383836136c5565b6131a2600082612a30565b6001600160a01b03831660009081526003602052604081208054600192906131cb90849061432d565b90915550506001600160a01b03821660009081526003602052604081208054600192906131f9908490614301565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008181526011602090815260409182902082518084019093528054835260010154908201526001600160a01b0384166132b6576132b1828585604051806040016040528060008152602001600081525085612f11565b6120f4565b6001600160a01b0383166132e7576132b1828585846040518060400160405280600081526020016000815250612f11565b42816020015111156133245760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b604482015260640161075f565b6120f48285858485612f11565b610f9582826040518060200160405280600081525061377d565b600082600001828154811061336257613362614416565b9060005260206000200154905092915050565b60008181526001830160205260408120546133bc5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561081d565b50600061081d565b60006001600160a01b0384163b1561351157604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906134089033908990889088906004016141ea565b602060405180830381600087803b15801561342257600080fd5b505af1925050508015613452575060408051601f3d908101601f1916820190925261344f91810190614053565b60015b6134f7573d808015613480576040519150601f19603f3d011682016040523d82523d6000602084013e613485565b606091505b5080516134ef5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161075f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612757565b506001949350505050565b6000818152600183016020526040812054801561360557600061354060018361432d565b85549091506000906135549060019061432d565b90508181146135b957600086600001828154811061357457613574614416565b906000526020600020015490508087600001848154811061359757613597614416565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806135ca576135ca614400565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061081d565b600091505061081d565b600061361a82611226565b9050613628816000846136c5565b613633600083612a30565b6001600160a01b038116600090815260036020526040812080546001929061365c90849061432d565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b606061275784846000856137fb565b6001600160a01b0383166137205761371b81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b613743565b816001600160a01b0316836001600160a01b03161461374357613743838261393a565b6001600160a01b03821661375a57610be6816139d7565b826001600160a01b0316826001600160a01b031614610be657610be68282613a86565b6137878383613aca565b61379460008484846133c4565b610be65760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161075f565b6060824710156138735760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161075f565b843b6138c15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161075f565b600080866001600160a01b031685876040516138dd919061419f565b60006040518083038185875af1925050503d806000811461391a576040519150601f19603f3d011682016040523d82523d6000602084013e61391f565b606091505b509150915061392f828286613ae0565b979650505050505050565b60006001613947846113c9565b613951919061432d565b6000838152600760205260409020549091508082146139a4576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906139e99060019061432d565b60008381526009602052604081205460088054939450909284908110613a1157613a11614416565b906000526020600020015490508060088381548110613a3257613a32614416565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480613a6a57613a6a614400565b6001900381819060005260206000200160009055905550505050565b6000613a91836113c9565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b613ad48282613b19565b610f956000838361325a565b60608315613aef575081612d2a565b825115613aff5782518084602001fd5b8160405162461bcd60e51b815260040161075f919061428c565b6001600160a01b038216613b6f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161075f565b6000818152600260205260409020546001600160a01b031615613bd45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161075f565b613be0600083836136c5565b6001600160a01b0382166000908152600360205260408120805460019290613c09908490614301565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054613c7390614370565b90600052602060002090601f016020900481019282613c955760008555613cdb565b82601f10613cae57805160ff1916838001178555613cdb565b82800160010185558215613cdb579182015b82811115613cdb578251825591602001919060010190613cc0565b50613ce7929150613ceb565b5090565b5b80821115613ce75760008155600101613cec565b600067ffffffffffffffff80841115613d1b57613d1b61442c565b604051601f8501601f19908116603f01168101908282118183101715613d4357613d4361442c565b81604052809350858152868686011115613d5c57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114613d8d57600080fd5b919050565b803560ff81168114613d8d57600080fd5b600060208284031215613db557600080fd5b612d2a82613d76565b60008060408385031215613dd157600080fd5b613dda83613d76565b9150613de860208401613d76565b90509250929050565b600080600060608486031215613e0657600080fd5b613e0f84613d76565b9250613e1d60208501613d76565b9150604084013590509250925092565b60008060008060808587031215613e4357600080fd5b613e4c85613d76565b9350613e5a60208601613d76565b925060408501359150606085013567ffffffffffffffff811115613e7d57600080fd5b8501601f81018713613e8e57600080fd5b613e9d87823560208401613d00565b91505092959194509250565b60008060408385031215613ebc57600080fd5b613ec583613d76565b91506020830135613ed581614442565b809150509250929050565b60008060408385031215613ef357600080fd5b613efc83613d76565b946020939093013593505050565b600080600060608486031215613f1f57600080fd5b613f2884613d76565b95602085013595506040909401359392505050565b60008060008060008060c08789031215613f5657600080fd5b613f5f87613d76565b95506020870135945060408701359350613f7b60608801613d92565b92506080870135915060a087013590509295509295509295565b600080600060408486031215613faa57600080fd5b833567ffffffffffffffff80821115613fc257600080fd5b818601915086601f830112613fd657600080fd5b813581811115613fe557600080fd5b8760208260051b8501011115613ffa57600080fd5b6020928301955093506140109186019050613d76565b90509250925092565b60006020828403121561402b57600080fd5b8151612d2a81614442565b60006020828403121561404857600080fd5b8135612d2a81614450565b60006020828403121561406557600080fd5b8151612d2a81614450565b60006020828403121561408257600080fd5b813567ffffffffffffffff81111561409957600080fd5b8201601f810184136140aa57600080fd5b61275784823560208401613d00565b6000602082840312156140cb57600080fd5b5035919050565b600080604083850312156140e557600080fd5b82359150613de860208401613d76565b60008060006060848603121561410a57600080fd5b83359250613e1d60208501613d76565b6000806040838503121561412d57600080fd5b50508035926020909101359150565b60008060008060008060c0878903121561415557600080fd5b863595506020870135945060408701359350613f7b60608801613d92565b6000815180845261418b816020860160208601614344565b601f01601f19169290920160200192915050565b600082516141b1818460208701614344565b9190910192915050565b600083516141cd818460208801614344565b8351908301906141e1818360208801614344565b01949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261421c6080830184614173565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156142675783516001600160a01b031683529284019291840191600101614242565b50909695505050505050565b8281526040602082015260006127576040830184614173565b602081526000612d2a6020830184614173565b81518152602080830151908201526040810161081d565b8581526001600160a01b0385811660208301528416604082015260e081016142eb606083018580518252602090810151910152565b825160a0830152602083015160c083015261421c565b60008219821115614314576143146143d4565b500190565b600082614328576143286143ea565b500490565b60008282101561433f5761433f6143d4565b500390565b60005b8381101561435f578181015183820152602001614347565b838111156120f45750506000910152565b600181811c9082168061438457607f821691505b6020821081141561105957634e487b7160e01b600052602260045260246000fd5b60006000198214156143b9576143b96143d4565b5060010190565b6000826143cf576143cf6143ea565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b80151581146111c157600080fd5b6001600160e01b0319811681146111c157600080fdfea2646970667358221220f8717ab92af88a8a2b6040c2e2571358809521775b89e9332d00151c083c80cd64736f6c63430008060033000000000000000000000000501ace0e8d16b92236763e2ded7ae3bc2dffa276000000000000000000000000501ace9c35e60f03a2af4d484f49f9b1efde9f40

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061032a5760003560e01c806360217267116101b2578063abcde77f116100f9578063df19578f116100a2578063f39c38a01161007c578063f39c38a0146106b9578063f4dadc61146106ca578063f6aacfb1146106ea578063fcd3fe07146106fd57600080fd5b8063df19578f14610661578063e985e9c51461066a578063f0591053146106a657600080fd5b8063b88d4fde116100d3578063b88d4fde14610628578063c87b56dd1461063b578063d61866271461064e57600080fd5b8063abcde77f146105ef578063b0d4c9a414610602578063b2383e551461061557600080fd5b80637ac2ff7b1161015b578063a22cb46511610135578063a22cb465146105c1578063a9059cbb146105d4578063abbf4b17146105e757600080fd5b80637ac2ff7b146105935780638d50b33d146105a657806395d89b41146105b957600080fd5b80636c0360eb1161018c5780636c0360eb1461056357806370a082311461056b578063719a59751461057e57600080fd5b8063602172671461052a5780636352211e1461053d578063650e15051461055057600080fd5b80632f745c591161027657806347cb7a681161021f5780634f6ccce7116101f95780634f6ccce7146104f357806355f804b3146105065780635aa6e6751461051957600080fd5b806347cb7a68146104c25780634f1bfc9e146104d55780634f558e79146104e057600080fd5b80633ef8d97e116102505780633ef8d97e14610489578063423f6cef1461049c57806342842e0e146104af57600080fd5b80632f745c591461044857806330adf81f1461045b5780633644e5151461048157600080fd5b80630abb6035116102d85780631c930221116102b25780631c9302211461041b578063238efcbc1461042d57806323b872dd1461043557600080fd5b80630abb6035146103d2578063141a468c146103e557806318160ddd1461041357600080fd5b8063070d66bf11610309578063070d66bf14610381578063081812fc14610394578063095ea7b3146103bf57600080fd5b8062f714ce1461032f57806301ffc9a71461034457806306fdde031461036c575b600080fd5b61034261033d3660046140d2565b610710565b005b610357610352366004614036565b6107f8565b60405190151581526020015b60405180910390f35b610374610823565b604051610363919061428c565b61034261038f36600461411a565b6108b5565b6103a76103a23660046140b9565b610a40565b6040516001600160a01b039091168152602001610363565b6103426103cd366004613ee0565b610ad5565b6103426103e0366004613da3565b610beb565b6104056103f33660046140b9565b6000908152600a602052604090205490565b604051908152602001610363565b600854610405565b600e54600160a01b900460ff16610357565b610342610cd6565b610342610443366004613df1565b610e3c565b610405610456366004613ee0565b610ec3565b7f137406564cdcf9b40b1700502a9241e87476728da7ae3d0edfcf0541e5b49b3e610405565b610405610f6b565b600f546103a7906001600160a01b031681565b6103426104aa366004613ee0565b610f7a565b6103426104bd366004613df1565b610f99565b6104056104d03660046140b9565b610fb4565b610405630784ce0081565b6103576104ee3660046140b9565b61105f565b6104056105013660046140b9565b61107e565b610342610514366004614070565b611122565b600d546001600160a01b03166103a7565b610405610538366004613da3565b6111c4565b6103a761054b3660046140b9565b611226565b61040561055e366004613f0a565b6112b1565b61037461133b565b610405610579366004613da3565b6113c9565b610586611463565b6040516103639190614226565b6103426105a1366004613f3d565b61150f565b6103426105b4366004613f95565b61195b565b610374611a8a565b6103426105cf366004613ea9565b611a99565b6103426105e2366004613ee0565b611b5e565b610342611b69565b6103426105fd36600461413c565b611cc3565b610342610610366004613da3565b611e76565b61034261062336600461411a565b611f51565b610342610636366004613e2d565b61206c565b6103746106493660046140b9565b6120fa565b61034261065c3660046140f5565b61222c565b61040560105481565b610357610678366004613dbe565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6104056106b436600461413c565b612353565b600e546001600160a01b03166103a7565b6106dd6106d83660046140b9565b612469565b604051610363919061429f565b6103576106f83660046140b9565b61250e565b61034261070b366004613da3565b61258d565b6002600c5414156107685760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600c55816107783382612668565b6107bd5760405162461bcd60e51b81526020600482015260166024820152751bdb9b1e481bdddb995c881bdc88185c1c1c9bdd995960521b604482015260640161075f565b6000838152601160205260409020546107d6848261275f565b600f546107ed906001600160a01b031684836128bb565b50506001600c555050565b60006001600160e01b0319821663780e9d6360e01b148061081d575061081d82612933565b92915050565b60606000805461083290614370565b80601f016020809104026020016040519081016040528092919081815260200182805461085e90614370565b80156108ab5780601f10610880576101008083540402835291602001916108ab565b820191906000526020600020905b81548152906001019060200180831161088e57829003601f168201915b5050505050905090565b6002600c5414156109085760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c55816109183382612668565b61095d5760405162461bcd60e51b81526020600482015260166024820152751bdb9b1e481bdddb995c881bdc88185c1c1c9bdd995960521b604482015260640161075f565b61096b630784ce0042614301565b8211156109ba5760405162461bcd60e51b815260206004820152601360248201527f4d6178206c6f636b206973203420796561727300000000000000000000000000604482015260640161075f565b600083815260116020526040902060010154821015610a1b5760405162461bcd60e51b815260206004820152600c60248201527f6e6f7420657874656e6465640000000000000000000000000000000000000000604482015260640161075f565b600083815260116020526040902054610a3690849084612983565b50506001600c5550565b6000818152600260205260408120546001600160a01b0316610ab95760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161075f565b506000908152600460205260409020546001600160a01b031690565b6000610ae082611226565b9050806001600160a01b0316836001600160a01b03161415610b4e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161075f565b336001600160a01b0382161480610b6a5750610b6a8133610678565b610bdc5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161075f565b610be68383612a30565b505050565b600e54600160a01b900460ff1615610c395760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b03163314610c815760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd61ed858909d3cb796547804c47dc1550d27455f8a0037b6b487e46212392396906020015b60405180910390a150565b600e54600160a01b900460ff1615610d245760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600e546001600160a01b03163314610d7e5760405162461bcd60e51b815260206004820152601360248201527f2170656e64696e6720676f7665726e616e636500000000000000000000000000604482015260640161075f565b600e546001600160a01b0316610dd65760405162461bcd60e51b815260206004820152600f60248201527f7a65726f20676f7665726e616e63650000000000000000000000000000000000604482015260640161075f565b600d8054600e80546001600160a01b038082166001600160a01b0319808616821790965594909116909155604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce809101610ccb565b610e463382612668565b610eb85760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606482015260840161075f565b610be6838383612a9e565b6000610ece836113c9565b8210610f425760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e6473000000000000000000000000000000000000000000606482015260840161075f565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6000610f75612ab4565b905090565b610f953383836040518060200160405280600081525061206c565b5050565b610be68383836040518060200160405280600081525061206c565b60008181526002602052604081205482906001600160a01b031661101a5760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b6000838152601160205260409020600101544210611039576000611056565b60008381526011602052604090206001015461105690429061432d565b91505b50919050565b6000818152600260205260408120546001600160a01b0316151561081d565b600061108960085490565b82106110fd5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e64730000000000000000000000000000000000000000606482015260840161075f565b6008828154811061111057611110614416565b90600052602060002001549050919050565b600e54600160a01b900460ff16156111705760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b031633146111b85760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b6111c181612ba7565b50565b6000806111d0836113c9565b90506000915060005b8181101561121f5760006111ed8583610ec3565b6000818152601160205260409020549091506112099085614301565b9350508080611217906143a5565b9150506111d9565b5050919050565b6000818152600260205260408120546001600160a01b03168061081d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e0000000000000000000000000000000000000000000000606482015260840161075f565b60006002600c5414156113065760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c55600f54611323906001600160a01b0316333086612bea565b61132e848484612c22565b6001600c55949350505050565b600b805461134890614370565b80601f016020809104026020016040519081016040528092919081815260200182805461137490614370565b80156113c15780601f10611396576101008083540402835291602001916113c1565b820191906000526020600020905b8154815290600101906020018083116113a457829003601f168201915b505050505081565b60006001600160a01b0382166114475760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f206164647265737300000000000000000000000000000000000000000000606482015260840161075f565b506001600160a01b031660009081526003602052604090205490565b606060006114716012612d14565b90508067ffffffffffffffff81111561148c5761148c61442c565b6040519080825280602002602001820160405280156114b5578160200160208202803683370190505b50915060005b8181101561150a576114ce601282612d1e565b8382815181106114e0576114e0614416565b6001600160a01b039092166020928302919091019091015280611502816143a5565b9150506114bb565b505090565b6000858152600260205260409020546001600160a01b03166115735760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b834211156115c35760405162461bcd60e51b815260206004820152600e60248201527f7065726d69742065787069726564000000000000000000000000000000000000604482015260640161075f565b6000858152600a60205260408120805490826115de836143a5565b91905055905060006115ee610f6b565b604080517f137406564cdcf9b40b1700502a9241e87476728da7ae3d0edfcf0541e5b49b3e60208201526001600160a01b038b1691810191909152606081018990526080810184905260a0810188905260c0016040516020818303038152906040528051906020012060405160200161167e92919061190160f01b81526002810192909252602282015260420190565b60405160208183030381529060405280519060200120905060006116a188611226565b9050806001600160a01b0316896001600160a01b031614156117055760405162461bcd60e51b815260206004820152601560248201527f63616e6e6f74207065726d697420746f2073656c660000000000000000000000604482015260640161075f565b803b1561183d57604080516020810187905280820186905260f888901b7fff00000000000000000000000000000000000000000000000000000000000000166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b03831691631626ba7e91611785918691606501614273565b60206040518083038186803b15801561179d57600080fd5b505afa1580156117b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d59190614053565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916631626ba7e60e01b146118385760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b604482015260640161075f565b611946565b6040805160008082526020820180845285905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015611891573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166118f45760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964207369676e6174757265000000000000000000000000000000604482015260640161075f565b816001600160a01b0316816001600160a01b0316146119445760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b604482015260640161075f565b505b6119508989612a30565b505050505050505050565b6002600c5414156119ae5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c55816000805b82811015611a665760008686838181106119d4576119d4614416565b9050602002013590506119e73382612668565b611a2c5760405162461bcd60e51b81526020600482015260166024820152751bdb9b1e481bdddb995c881bdc88185c1c1c9bdd995960521b604482015260640161075f565b600081815260116020526040902054611a458185614301565b9350611a51828261275f565b50508080611a5e906143a5565b9150506119b8565b50600f54611a7e906001600160a01b031684836128bb565b50506001600c55505050565b60606001805461083290614370565b6001600160a01b038216331415611af25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161075f565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610f95338383610e3c565b600e54600160a01b900460ff1615611bb75760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b03163314611bff5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b600e8054600d80546001600160a01b036001600160a01b031990911681179091557fffffffffffffffffffffff0000000000000000000000000000000000000000009091167401ffffffffffffffffffffffffffffffffffffffff179091556040805133815260208101929092527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a16040517fd572292b9e5d684b0719ae2d0e210513b477e303c975ed1c63b6fcac1607672790600090a1565b6002600c541415611d165760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c5585611d3d816000908152600260205260409020546001600160a01b0316151590565b611d895760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b600f5460405163d505accf60e01b8152336004820152306024820152604481018890526064810187905260ff8616608482015260a4810185905260c481018490526001600160a01b039091169063d505accf9060e401600060405180830381600087803b158015611df957600080fd5b505af1158015611e0d573d6000803e3d6000fd5b5050600f54611e2a92506001600160a01b03169050333089612bea565b600087815260116020526040812054611e44908890614301565b9050611e678882601160008c815260200190815260200160002060010154612983565b50506001600c55505050505050565b600e54600160a01b900460ff1615611ec45760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b03163314611f0c5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b611f17601282612d31565b506040516001600160a01b03821681527f7225315bb5c525892679876f6b48a3a4fd28294d637607a8cf23f62b372051e590602001610ccb565b6002600c541415611fa45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c5581611fcb816000908152600260205260409020546001600160a01b0316151590565b6120175760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b600f5461202f906001600160a01b0316333085612bea565b600083815260116020526040812054612049908490614301565b90506107ed84826011600088815260200190815260200160002060010154612983565b6120763383612668565b6120e85760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606482015260840161075f565b6120f484848484612d46565b50505050565b60608161211e816000908152600260205260409020546001600160a01b0316151590565b61216a5760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b6000600b805461217990614370565b80601f01602080910402602001604051908101604052809291908181526020018280546121a590614370565b80156121f25780601f106121c7576101008083540402835291602001916121f2565b820191906000526020600020905b8154815290600101906020018083116121d557829003601f168201915b505050505090508061220385612dc4565b6040516020016122149291906141bb565b60405160208183030381529060405292505050919050565b6002600c54141561227f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c558261228f3382612668565b6122d45760405162461bcd60e51b81526020600482015260166024820152751bdb9b1e481bdddb995c881bdc88185c1c1c9bdd995960521b604482015260640161075f565b6000848152601160205260409020548211156123325760405162461bcd60e51b815260206004820152600f60248201527f6578636573732077697468647261770000000000000000000000000000000000604482015260640161075f565b61233c848361275f565b600f546107ed906001600160a01b031684846128bb565b60006002600c5414156123a85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600c55600f5460405163d505accf60e01b8152336004820152306024820152604481018990526064810187905260ff8616608482015260a4810185905260c481018490526001600160a01b039091169063d505accf9060e401600060405180830381600087803b15801561241d57600080fd5b505af1158015612431573d6000803e3d6000fd5b5050600f5461244e92506001600160a01b0316905033308a612bea565b612459338888612c22565b6001600c55979650505050505050565b604080518082019091526000808252602082015260008281526002602052604090205482906001600160a01b03166124e35760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b5050600090815260116020908152604091829020825180840190935280548352600101549082015290565b60008181526002602052604081205482906001600160a01b03166125745760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161075f565b5050600090815260116020526040902060010154421090565b600e54600160a01b900460ff16156125db5760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161075f565b600d546001600160a01b031633146126235760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161075f565b61262e601282612eda565b506040516001600160a01b03821681527ffd724879dc1d8ebf9fb54b059c1745e8a5883d242f763594d2bba7b438ccbfe390602001610ccb565b6000818152600260205260408120546001600160a01b03166126e15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161075f565b60006126ec83611226565b9050806001600160a01b0316846001600160a01b031614806127275750836001600160a01b031661271c84610a40565b6001600160a01b0316145b8061275757506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b6000828152601160205260409020600101544210156127a95760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b604482015260640161075f565b6000828152601160205260409020548114156127e2576127c882612eef565b60008281526011602052604081208181556001015561287e565b600082815260116020908152604080832081518083018352815481526001909101549281019290925280518082019091528151919291819061282590869061432d565b8152602001836020015181525090508260116000868152602001908152602001600020600001600082825461285a919061432d565b909155506000905061286b85611226565b905061287a8582838686612f11565b5050505b60408051838152602081018390527f8c90f1854273170c1e829c713d0989ed4dcfedc62f89a508607eb1b002d3f64c910160405180910390a15050565b6040516001600160a01b038316602482015260448101829052610be690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612fb6565b60006001600160e01b031982166380ac58cd60e01b148061296457506001600160e01b03198216635b5e139f60e01b145b8061081d57506301ffc9a760e01b6001600160e01b031983161461081d565b600083815260116020818152604080842081518083018352815481526001820180548286015283518085019094528884528385018881528a8852959094528251909155925190915590916129d686611226565b90506129e58682838686612f11565b602080830151604080518981529283018890528201527f067e2f70e7e1385380aeba8b936c35350c777e1243ec52626e253060ead700c29060600160405180910390a1505050505050565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612a6582611226565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612aa983838361309b565b610be683838361325a565b60007f0000000000000000000000000000000000000000000000000000000000000001461415612b0357507fb6ded7efd716e2a4277629d3443c48172212c572a32ae5e9fa5aa47469a36dd590565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f2b5a04fee0333211784bd3928bd7e4e864cb95ab032d555373e074034c3df14b828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b8051612bba90600b906020840190613c67565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f681604051610ccb919061428c565b6040516001600160a01b03808516602483015283166044820152606481018290526120f49085906323b872dd60e01b906084016128e7565b6000601060008154612c33906143a5565b91829055506040805180820190915284815260208101849052909150612c5d630784ce0042614301565b81602001511115612cb05760405162461bcd60e51b815260206004820152601360248201527f4d6178206c6f636b206973203420796561727300000000000000000000000000604482015260640161075f565b60008281526011602090815260409091208251815590820151600190910155612cd98583613331565b6040518281527ff5c3a5bb1319c895b2a31add0dbddb093066a7a052f45fd86c020ee3658b69d09060200160405180910390a1509392505050565b600061081d825490565b6000612d2a838361334b565b9392505050565b6000612d2a836001600160a01b038416613375565b612d51848484612a9e565b612d5d848484846133c4565b6120f45760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161075f565b606081612de85750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612e125780612dfc816143a5565b9150612e0b9050600a83614319565b9150612dec565b60008167ffffffffffffffff811115612e2d57612e2d61442c565b6040519080825280601f01601f191660200182016040528015612e57576020820181803683370190505b5090505b841561275757612e6c60018361432d565b9150612e79600a866143c0565b612e84906030614301565b60f81b818381518110612e9957612e99614416565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612ed3600a86614319565b9450612e5b565b6000612d2a836001600160a01b03841661351c565b6000612efa82611226565b9050612f058261360f565b610f958160008461325a565b6000612f1d6012612d14565b905060005b81811015612fad57612f35601282612d1e565b6001600160a01b031663d517b34b88888888886040518663ffffffff1660e01b8152600401612f689594939291906142b6565b600060405180830381600087803b158015612f8257600080fd5b505af1158015612f96573d6000803e3d6000fd5b505050508080612fa5906143a5565b915050612f22565b50505050505050565b600061300b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136b69092919063ffffffff16565b805190915015610be657808060200190518101906130299190614019565b610be65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161075f565b826001600160a01b03166130ae82611226565b6001600160a01b03161461312a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e0000000000000000000000000000000000000000000000606482015260840161075f565b6001600160a01b03821661318c5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161075f565b6131978383836136c5565b6131a2600082612a30565b6001600160a01b03831660009081526003602052604081208054600192906131cb90849061432d565b90915550506001600160a01b03821660009081526003602052604081208054600192906131f9908490614301565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008181526011602090815260409182902082518084019093528054835260010154908201526001600160a01b0384166132b6576132b1828585604051806040016040528060008152602001600081525085612f11565b6120f4565b6001600160a01b0383166132e7576132b1828585846040518060400160405280600081526020016000815250612f11565b42816020015111156133245760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b604482015260640161075f565b6120f48285858485612f11565b610f9582826040518060200160405280600081525061377d565b600082600001828154811061336257613362614416565b9060005260206000200154905092915050565b60008181526001830160205260408120546133bc5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561081d565b50600061081d565b60006001600160a01b0384163b1561351157604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906134089033908990889088906004016141ea565b602060405180830381600087803b15801561342257600080fd5b505af1925050508015613452575060408051601f3d908101601f1916820190925261344f91810190614053565b60015b6134f7573d808015613480576040519150601f19603f3d011682016040523d82523d6000602084013e613485565b606091505b5080516134ef5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161075f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612757565b506001949350505050565b6000818152600183016020526040812054801561360557600061354060018361432d565b85549091506000906135549060019061432d565b90508181146135b957600086600001828154811061357457613574614416565b906000526020600020015490508087600001848154811061359757613597614416565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806135ca576135ca614400565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061081d565b600091505061081d565b600061361a82611226565b9050613628816000846136c5565b613633600083612a30565b6001600160a01b038116600090815260036020526040812080546001929061365c90849061432d565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b606061275784846000856137fb565b6001600160a01b0383166137205761371b81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b613743565b816001600160a01b0316836001600160a01b03161461374357613743838261393a565b6001600160a01b03821661375a57610be6816139d7565b826001600160a01b0316826001600160a01b031614610be657610be68282613a86565b6137878383613aca565b61379460008484846133c4565b610be65760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161075f565b6060824710156138735760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161075f565b843b6138c15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161075f565b600080866001600160a01b031685876040516138dd919061419f565b60006040518083038185875af1925050503d806000811461391a576040519150601f19603f3d011682016040523d82523d6000602084013e61391f565b606091505b509150915061392f828286613ae0565b979650505050505050565b60006001613947846113c9565b613951919061432d565b6000838152600760205260409020549091508082146139a4576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906139e99060019061432d565b60008381526009602052604081205460088054939450909284908110613a1157613a11614416565b906000526020600020015490508060088381548110613a3257613a32614416565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480613a6a57613a6a614400565b6001900381819060005260206000200160009055905550505050565b6000613a91836113c9565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b613ad48282613b19565b610f956000838361325a565b60608315613aef575081612d2a565b825115613aff5782518084602001fd5b8160405162461bcd60e51b815260040161075f919061428c565b6001600160a01b038216613b6f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161075f565b6000818152600260205260409020546001600160a01b031615613bd45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161075f565b613be0600083836136c5565b6001600160a01b0382166000908152600360205260408120805460019290613c09908490614301565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054613c7390614370565b90600052602060002090601f016020900481019282613c955760008555613cdb565b82601f10613cae57805160ff1916838001178555613cdb565b82800160010185558215613cdb579182015b82811115613cdb578251825591602001919060010190613cc0565b50613ce7929150613ceb565b5090565b5b80821115613ce75760008155600101613cec565b600067ffffffffffffffff80841115613d1b57613d1b61442c565b604051601f8501601f19908116603f01168101908282118183101715613d4357613d4361442c565b81604052809350858152868686011115613d5c57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114613d8d57600080fd5b919050565b803560ff81168114613d8d57600080fd5b600060208284031215613db557600080fd5b612d2a82613d76565b60008060408385031215613dd157600080fd5b613dda83613d76565b9150613de860208401613d76565b90509250929050565b600080600060608486031215613e0657600080fd5b613e0f84613d76565b9250613e1d60208501613d76565b9150604084013590509250925092565b60008060008060808587031215613e4357600080fd5b613e4c85613d76565b9350613e5a60208601613d76565b925060408501359150606085013567ffffffffffffffff811115613e7d57600080fd5b8501601f81018713613e8e57600080fd5b613e9d87823560208401613d00565b91505092959194509250565b60008060408385031215613ebc57600080fd5b613ec583613d76565b91506020830135613ed581614442565b809150509250929050565b60008060408385031215613ef357600080fd5b613efc83613d76565b946020939093013593505050565b600080600060608486031215613f1f57600080fd5b613f2884613d76565b95602085013595506040909401359392505050565b60008060008060008060c08789031215613f5657600080fd5b613f5f87613d76565b95506020870135945060408701359350613f7b60608801613d92565b92506080870135915060a087013590509295509295509295565b600080600060408486031215613faa57600080fd5b833567ffffffffffffffff80821115613fc257600080fd5b818601915086601f830112613fd657600080fd5b813581811115613fe557600080fd5b8760208260051b8501011115613ffa57600080fd5b6020928301955093506140109186019050613d76565b90509250925092565b60006020828403121561402b57600080fd5b8151612d2a81614442565b60006020828403121561404857600080fd5b8135612d2a81614450565b60006020828403121561406557600080fd5b8151612d2a81614450565b60006020828403121561408257600080fd5b813567ffffffffffffffff81111561409957600080fd5b8201601f810184136140aa57600080fd5b61275784823560208401613d00565b6000602082840312156140cb57600080fd5b5035919050565b600080604083850312156140e557600080fd5b82359150613de860208401613d76565b60008060006060848603121561410a57600080fd5b83359250613e1d60208501613d76565b6000806040838503121561412d57600080fd5b50508035926020909101359150565b60008060008060008060c0878903121561415557600080fd5b863595506020870135945060408701359350613f7b60608801613d92565b6000815180845261418b816020860160208601614344565b601f01601f19169290920160200192915050565b600082516141b1818460208701614344565b9190910192915050565b600083516141cd818460208801614344565b8351908301906141e1818360208801614344565b01949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261421c6080830184614173565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156142675783516001600160a01b031683529284019291840191600101614242565b50909695505050505050565b8281526040602082015260006127576040830184614173565b602081526000612d2a6020830184614173565b81518152602080830151908201526040810161081d565b8581526001600160a01b0385811660208301528416604082015260e081016142eb606083018580518252602090810151910152565b825160a0830152602083015160c083015261421c565b60008219821115614314576143146143d4565b500190565b600082614328576143286143ea565b500490565b60008282101561433f5761433f6143d4565b500390565b60005b8381101561435f578181015183820152602001614347565b838111156120f45750506000910152565b600181811c9082168061438457607f821691505b6020821081141561105957634e487b7160e01b600052602260045260246000fd5b60006000198214156143b9576143b96143d4565b5060010190565b6000826143cf576143cf6143ea565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b80151581146111c157600080fd5b6001600160e01b0319811681146111c157600080fdfea2646970667358221220f8717ab92af88a8a2b6040c2e2571358809521775b89e9332d00151c083c80cd64736f6c63430008060033

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

000000000000000000000000501ace0e8d16b92236763e2ded7ae3bc2dffa276000000000000000000000000501ace9c35e60f03a2af4d484f49f9b1efde9f40

-----Decoded View---------------
Arg [0] : governance_ (address): 0x501AcE0e8D16B92236763E2dEd7aE3bc2DFfA276
Arg [1] : solace_ (address): 0x501acE9c35E60f03A2af4d484f49F9B1EFde9f40

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000501ace0e8d16b92236763e2ded7ae3bc2dffa276
Arg [1] : 000000000000000000000000501ace9c35e60f03a2af4d484f49f9b1efde9f40


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

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