ETH Price: $3,741.46 (+3.15%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Most

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion, MIT license
File 1 of 43 : Most.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {AbstractMost} from "./AbstractMost.sol";
import {ITransferLimit} from "./ITransferLimit.sol";

/// @title Most
/// @author Cardinal Cryptography
contract Most is AbstractMost {
    ITransferLimit public transferLimit;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function setTransferLimitContract(
        ITransferLimit _transferLimit
    ) external onlyOwner {
        transferLimit = _transferLimit;
    }

    function initialize(
        address[] calldata _committee,
        uint256 _signatureThreshold,
        address owner,
        address payable _wethAddress
    ) public initializer {
        __AbstractMost_init(_committee, _signatureThreshold, _wethAddress);
        __Ownable_init(owner);
        __Pausable_init();

        _pause();
    }

    function checkTransferAllowed(
        address token,
        uint256 amount
    ) internal view override {
        if (transferLimit != ITransferLimit(address(0))) {
            try transferLimit.isRequestAllowed(token, amount) returns (
                bool result
            ) {
                if (!result) {
                    revert LimitExceeded();
                }
            } catch {
                // Ignore - behave as if the transferLimit is not set if it doesn't work for any reason
            }
        }
    }
}

File 2 of 43 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// solhint-disable-next-line interface-starts-with-i
interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  function getRoundData(
    uint80 _roundId
  ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

  function latestRoundData()
    external
    view
    returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}

File 3 of 43 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 5 of 43 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)

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:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, 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}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, 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}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, 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) {
        address owner = _msgSender();
        _approve(owner, spender, _allowances[owner][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) {
        address owner = _msgSender();
        uint256 currentAllowance = _allowances[owner][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, 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:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, 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 Spend `amount` form the allowance of `owner` toward `spender`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - 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 6 of 43 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

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 7 of 43 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

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

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

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

    /**
     * @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 8 of 43 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 43 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 11 of 43 : Ownable2StepUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {OwnableUpgradeable} from "./OwnableUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step
    struct Ownable2StepStorage {
        address _pendingOwner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable2Step")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00;

    function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) {
        assembly {
            $.slot := Ownable2StepStorageLocation
        }
    }

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

    function __Ownable2Step_init() internal onlyInitializing {
    }

    function __Ownable2Step_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        return $._pendingOwner;
    }

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

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

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

File 12 of 43 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

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

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

File 13 of 43 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

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

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

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

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

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 14 of 43 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.20;

import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable __self = address(this);

    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev The call is from an unauthorized context.
     */
    error UUPSUnauthorizedCallContext();

    /**
     * @dev The storage `slot` is unsupported as a UUID.
     */
    error UUPSUnsupportedProxiableUUID(bytes32 slot);

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

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        _checkNotDelegated();
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

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

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data);
    }

    /**
     * @dev Reverts if the execution is not performed via delegatecall or the execution
     * context is not of a proxy with an ERC1967-compliant implementation pointing to self.
     * See {_onlyProxy}.
     */
    function _checkProxy() internal view virtual {
        if (
            address(this) == __self || // Must be called through delegatecall
            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
        ) {
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Reverts if the execution is performed via delegatecall.
     * See {notDelegated}.
     */
    function _checkNotDelegated() internal view virtual {
        if (address(this) != __self) {
            // Must not be called through delegatecall
            revert UUPSUnauthorizedCallContext();
        }
    }

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

    /**
     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
     *
     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
     * is expected to be the implementation slot in ERC1967.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
                revert UUPSUnsupportedProxiableUUID(slot);
            }
            ERC1967Utils.upgradeToAndCall(newImplementation, data);
        } catch {
            // The implementation is not UUPS
            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
        }
    }
}

File 15 of 43 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

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

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

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 16 of 43 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
    struct PausableStorage {
        bool _paused;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

    function _getPausableStorage() private pure returns (PausableStorage storage $) {
        assembly {
            $.slot := PausableStorageLocation
        }
    }

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

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

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

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

    function __Pausable_init_unchained() internal onlyInitializing {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

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

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
        emit Unpaused(_msgSender());
    }
}

File 17 of 43 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

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

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

File 18 of 43 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

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

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

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

File 19 of 43 : draft-IERC1822.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.20;

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

File 20 of 43 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 21 of 43 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

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

File 22 of 43 : ERC1967Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.20;

import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 */
library ERC1967Utils {
    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

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

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

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

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

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

File 23 of 43 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.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}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * 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.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * 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 returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual 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 default value returned by this function, unless
     * it's 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 returns (uint8) {
        return 18;
    }

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        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}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * 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.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` 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.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

File 24 of 43 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
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 25 of 43 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    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 26 of 43 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

File 27 of 43 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 28 of 43 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

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

File 29 of 43 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 30 of 43 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 31 of 43 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

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

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

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

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

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

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

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

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

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

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

File 32 of 43 : AbstractMost.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import {IWETH9} from "./IWETH9.sol";
import {IWrappedToken} from "./IWrappedToken.sol";

/// @title Most
/// @author Cardinal Cryptography
abstract contract AbstractMost is
    Initializable,
    UUPSUpgradeable,
    Ownable2StepUpgradeable,
    PausableUpgradeable
{
    using SafeERC20 for IERC20;

    /// @dev This amount of gas should be sufficient for ether transfers
    /// and simple fallback function execution, yet still protecting against reentrancy attack.
    uint256 public constant GAS_LIMIT = 3500;

    uint256 public requestNonce;
    uint256 public committeeId;
    address payable public wethAddress;

    mapping(bytes32 from => bytes32 to) public supportedPairs;
    mapping(bytes32 requestHash => Request) public pendingRequests;
    mapping(bytes32 requestHash => bool) public processedRequests;
    /// @dev committeeMemberId = keccak256(abi.encodePacked(committeeId, comitteeMemberAddress))
    mapping(bytes32 committeeMemberId => bool) private committee;
    mapping(uint256 committeeId => uint256) public committeeSize;
    mapping(uint256 committeeId => uint256) public signatureThreshold;
    mapping(address => bool) public isLocalToken;

    address public wrappedAzeroAddress;

    struct Request {
        uint256 signatureCount;
        mapping(address => bool) signatures;
    }

    event CrosschainTransferRequest(
        uint256 indexed committeeId,
        bytes32 indexed destTokenAddress,
        uint256 amount,
        bytes32 indexed destReceiverAddress,
        uint256 requestNonce
    );

    event RequestSigned(bytes32 requestHash, address signer);

    event RequestProcessed(bytes32 requestHash);

    /// @notice Emitted when guardian signs a request that has already been processed
    event ProcessedRequestSigned(bytes32 requestHash, address signer);

    event RequestAlreadySigned(bytes32 requestHash, address signer);

    event EthTransferFailed(bytes32 requestHash);

    event TokenTransferFailed(bytes32 requestHash);

    event CommitteeUpdated(uint256 newCommitteeId);

    modifier _onlyCommitteeMember(uint256 _committeeId) {
        if (!isInCommittee(_committeeId, msg.sender)) revert NotInCommittee();
        _;
    }

    error NotInCommittee();
    error ZeroSignatureTreshold();
    error DuplicateCommitteeMember();
    error NotEnoughGuardians();
    error UnsupportedPair();
    error DataHashMismatch();
    error ZeroAmount();
    error WrappingEth();
    error UnwrappingEth();
    error EthTransfer();
    error ZeroAddress();
    error AzeroAddressNotSet();
    error LimitExceeded();

    function __AbstractMost_init(
        address[] calldata _committee,
        uint256 _signatureThreshold,
        address payable _wethAddress
    ) internal onlyInitializing {
        __AbstractMost_init_unchained(
            _committee,
            _signatureThreshold,
            _wethAddress
        );
    }

    function __AbstractMost_init_unchained(
        address[] calldata _committee,
        uint256 _signatureThreshold,
        address payable _wethAddress
    ) internal onlyInitializing {
        requestNonce = 0;
        committeeId = 0;
        wethAddress = _wethAddress;

        _setCommittee(_committee, _signatureThreshold);
    }

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

    /// @dev disable possibility to renounce ownership
    function renounceOwnership() public virtual override onlyOwner {}

    function _setCommittee(
        address[] calldata _committee,
        uint256 _signatureThreshold
    ) internal {
        if (_signatureThreshold == 0) revert ZeroSignatureTreshold();
        if (_committee.length < _signatureThreshold)
            revert NotEnoughGuardians();

        for (uint256 i; i < _committee.length; ++i) {
            if (_committee[i] == address(0)) revert ZeroAddress();
            bytes32 committeeMemberId = keccak256(
                abi.encodePacked(committeeId, _committee[i])
            );
            // avoid duplicates
            if (committee[committeeMemberId]) {
                revert DuplicateCommitteeMember();
            }
            committee[committeeMemberId] = true;
        }

        committeeSize[committeeId] = _committee.length;
        signatureThreshold[committeeId] = _signatureThreshold;
    }

    /// @notice Invoke this tx to transfer funds to the destination chain.
    /// Account needs to approve the Most contract to spend the `srcTokenAmount`
    /// of `srcTokenAddress` tokens on their behalf before executing the tx.
    ///
    /// @dev Tx emits a CrosschainTransferRequest event that the relayers listen to
    /// & forward to the destination chain.
    function sendRequest(
        bytes32 srcTokenAddress,
        uint256 amount,
        bytes32 destReceiverAddress
    ) external virtual whenNotPaused {
        if (amount == 0) revert ZeroAmount();
        if (destReceiverAddress == bytes32(0)) revert ZeroAddress();

        bytes32 destTokenAddress = supportedPairs[srcTokenAddress];
        if (destTokenAddress == 0x0) revert UnsupportedPair();

        address token = bytes32ToAddress(srcTokenAddress);
        checkTransferAllowed(token, amount);

        // burn or lock tokens in this contract
        // message sender needs to give approval else this tx will revert
        IERC20 tokenERC20 = IERC20(token);
        tokenERC20.safeTransferFrom(msg.sender, address(this), amount);

        if (!isLocalToken[token]) {
            IWrappedToken burnableToken = IWrappedToken(token);
            burnableToken.burn(amount);
        }

        emit CrosschainTransferRequest(
            committeeId,
            destTokenAddress,
            amount,
            destReceiverAddress,
            requestNonce
        );

        ++requestNonce;
    }

    /// @notice Invoke this tx to transfer funds to the destination chain.
    /// Account needs to send native ETH which are wrapped to wETH
    /// tokens.
    ///
    /// @dev Tx emits a CrosschainTransferRequest event that the relayers listen to
    /// & forward to the destination chain.
    function sendRequestNative(
        bytes32 destReceiverAddress
    ) external payable virtual whenNotPaused {
        uint256 amount = msg.value;
        if (amount == 0) revert ZeroAmount();
        if (destReceiverAddress == bytes32(0)) revert ZeroAddress();

        bytes32 destTokenAddress = supportedPairs[
            addressToBytes32(wethAddress)
        ];

        if (destTokenAddress == 0x0) revert UnsupportedPair();
        checkTransferAllowed(wethAddress, amount);

        (bool success, ) = wethAddress.call{value: amount}(
            abi.encodeCall(IWETH9.deposit, ())
        );

        if (!success) revert WrappingEth();

        emit CrosschainTransferRequest(
            committeeId,
            destTokenAddress,
            amount,
            destReceiverAddress,
            requestNonce
        );

        ++requestNonce;
    }

    function sendRequestAzeroToNative(
        uint256 amount,
        bytes32 destReceiverAddress
    ) external virtual whenNotPaused {
        if (amount == 0) revert ZeroAmount();
        if (destReceiverAddress == bytes32(0)) revert ZeroAddress();
        if (wrappedAzeroAddress == address(0)) revert AzeroAddressNotSet();

        checkTransferAllowed(wrappedAzeroAddress, amount);

        IERC20 azeroToken = IERC20(wrappedAzeroAddress);
        azeroToken.safeTransferFrom(msg.sender, address(this), amount);
        IWrappedToken burnableToken = IWrappedToken(wrappedAzeroAddress);
        burnableToken.burn(amount);

        emit CrosschainTransferRequest(
            committeeId,
            0x0,
            amount,
            destReceiverAddress,
            requestNonce
        );

        ++requestNonce;
    }

    function onReceiveRequestThresholdMet(
        bytes32 requestHash,
        bytes32 destTokenAddress,
        uint256 amount,
        bytes32 destReceiverAddress
    ) internal virtual {
        processedRequests[requestHash] = true;
        delete pendingRequests[requestHash];

        address _destTokenAddress = bytes32ToAddress(destTokenAddress);
        address _destReceiverAddress = bytes32ToAddress(destReceiverAddress);

        // return the locked tokens
        // address(0) indicates bridging native ether
        if (_destTokenAddress == address(0)) {
            (bool unwrapSuccess, ) = wethAddress.call(
                abi.encodeCall(IWETH9.withdraw, (amount))
            );
            if (!unwrapSuccess) revert UnwrappingEth();
            (bool sendNativeEthSuccess, ) = _destReceiverAddress.call{
                value: amount,
                gas: GAS_LIMIT
            }("");
            if (!sendNativeEthSuccess) {
                emit EthTransferFailed(requestHash);
            }
        } else if (!isLocalToken[_destTokenAddress]) {
            // Mint representation of the remote token
            IWrappedToken mintableToken = IWrappedToken(_destTokenAddress);
            mintableToken.mint(_destReceiverAddress, amount);
        } else {
            IERC20 token = IERC20(_destTokenAddress);
            if (
                !tokenTransferReturnSuccess(token, _destReceiverAddress, amount)
            ) {
                emit TokenTransferFailed(requestHash);
            }
        }

        emit RequestProcessed(requestHash);
    }

    /// @notice Aggregates relayer signatures and returns the locked tokens.
    /// @dev When the ether is being bridged and the receiver is a contractRequestSigned
    /// that does not accept ether or fallback function consumes more than `GAS_LIMIT` gas units,
    /// the request is processed without revert and the ether is locked
    /// in this contract. Governance action must be taken to retrieve the tokens.
    function receiveRequest(
        bytes32 _requestHash,
        uint256 _committeeId,
        bytes32 destTokenAddress,
        uint256 amount,
        bytes32 destReceiverAddress,
        uint256 _requestNonce
    ) external whenNotPaused _onlyCommitteeMember(_committeeId) {
        // Don't revert if the request has already been processed as
        // such a call can be made during regular guardian operation.
        if (processedRequests[_requestHash]) {
            emit ProcessedRequestSigned(_requestHash, msg.sender);
            return;
        }

        bytes32 requestHash = keccak256(
            abi.encodePacked(
                _committeeId,
                destTokenAddress,
                amount,
                destReceiverAddress,
                _requestNonce
            )
        );

        Request storage request = pendingRequests[requestHash];
        if (request.signatures[msg.sender]) {
            emit RequestAlreadySigned(requestHash, msg.sender);
            return;
        }

        if (_requestHash != requestHash) revert DataHashMismatch();

        request.signatures[msg.sender] = true;
        ++request.signatureCount;

        emit RequestSigned(requestHash, msg.sender);

        if (request.signatureCount >= signatureThreshold[_committeeId]) {
            onReceiveRequestThresholdMet(
                requestHash,
                destTokenAddress,
                amount,
                destReceiverAddress
            );
        }
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function recoverERC20(
        address token,
        address to,
        uint256 amount
    ) external onlyOwner {
        IERC20(token).safeTransfer(to, amount);
    }

    function recoverNative(
        address payable to,
        uint256 amount
    ) external onlyOwner {
        (bool success, ) = to.call{value: amount, gas: GAS_LIMIT}("");
        if (!success) revert EthTransfer();
    }

    function setCommittee(
        address[] calldata _committee,
        uint256 _signatureThreshold
    ) external onlyOwner whenPaused {
        ++committeeId;
        _setCommittee(_committee, _signatureThreshold);
        emit CommitteeUpdated(committeeId);
    }

    function setWrappedAzeroAddress(
        address _wrappedAzeroAddress
    ) external onlyOwner whenPaused {
        wrappedAzeroAddress = _wrappedAzeroAddress;
    }

    function addPair(
        bytes32 from,
        bytes32 to,
        bool isLocal
    ) external virtual onlyOwner whenPaused {
        supportedPairs[from] = to;
        isLocalToken[bytes32ToAddress(from)] = isLocal;
    }

    function setLocalToken(
        bytes32 token,
        bool isLocal
    ) external onlyOwner whenPaused {
        isLocalToken[bytes32ToAddress(token)] = isLocal;
    }

    function removePair(bytes32 from) external onlyOwner whenPaused {
        delete supportedPairs[from];
    }

    function hasSignedRequest(
        address guardian,
        bytes32 hash
    ) public view returns (bool) {
        return pendingRequests[hash].signatures[guardian];
    }

    function needsSignature(
        bytes32 requestHash,
        address account,
        uint256 _committeeId
    ) external view returns (bool) {
        if (!isInCommittee(_committeeId, account)) {
            return false;
        }
        if (processedRequests[requestHash]) {
            return false;
        }
        if (hasSignedRequest(account, requestHash)) {
            return false;
        }
        return true;
    }

    function isInCommittee(
        uint256 _committeeId,
        address account
    ) public view returns (bool) {
        return committee[keccak256(abi.encodePacked(_committeeId, account))];
    }

    function bytes32ToAddress(bytes32 data) internal pure returns (address) {
        return address(uint160(uint256(data)));
    }

    function addressToBytes32(address addr) internal pure returns (bytes32) {
        return bytes32(uint256(uint160(addr)));
    }

    /// @dev Adapted from Openzeppelin SafeERC20 - check if the ERC20 token transfer succeeded
    function tokenTransferReturnSuccess(
        IERC20 token,
        address receiver,
        uint256 amount
    ) internal returns (bool) {
        (bool success, bytes memory returndata) = address(token).call(
            abi.encodeCall(token.transfer, (receiver, amount))
        );
        return
            success &&
            (returndata.length == 0 || abi.decode(returndata, (bool))) &&
            address(token).code.length > 0;
    }

    /// @dev Accept ether only from weth contract or through payable methods
    receive() external payable virtual {
        require(msg.sender == wethAddress);
    }

    function checkTransferAllowed(
        address token,
        uint256 amount
    ) internal view virtual {}
}

File 33 of 43 : ITransferLimit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface ITransferLimit {
    function isRequestAllowed(
        address _token,
        uint256 _amount
    ) external view returns (bool);
}

File 34 of 43 : IWETH9.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.2;

/// @title Interface for WETH9
interface IWETH9 {
    /// @notice Deposit ether to get wrapped ether
    function deposit() external payable;

    /// @notice Withdraw wrapped ether to get ether
    function withdraw(uint256) external;
}

File 35 of 43 : IWrappedToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

/// @title Interface for WrappedToken
interface IWrappedToken {
    /// @notice Mint a given amount of remote PSP22 token representation to a given address
    function mint(address, uint256) external;

    /// @notice Burn a given amount of remote PSP22 token representation
    function burn(uint256) external;

    /// @notice Approve spending a given amount of token to the spender
    function approve(address spender, uint256 value) external returns (bool);
}

File 36 of 43 : MockOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

/// @title MockOracle
/// @author Cardinal Cryptography
/// @notice Mock Chainlink oracle for testing purposes
contract MockOracle {
    int public price;

    function setPrice(int _price) public {
        price = _price;
    }

    function latestRoundData()
        public
        view
        returns (uint80, int, uint, uint, uint80)
    {
        return (0, price, 0, 0, 0);
    }

    function decimals() public pure returns (uint8) {
        return 8;
    }
}

File 37 of 43 : MostL2.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {AbstractMost} from "./AbstractMost.sol";
import {StableSwapTwoPool} from "./StableSwap/StableSwapTwoPool.sol";
import {IWrappedToken} from "./IWrappedToken.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @title MostL2.sol
/// @author Cardinal Cryptography
contract MostL2 is AbstractMost {
    using SafeERC20 for IERC20;

    /// Ratio between bridged azero (12 decimals) and native token on L2 (18 decimals)
    uint256 public constant BAZERO_TO_NATIVE_RATIO = 1e6;

    address payable public stableSwapAddress;
    address public bAzeroAddress;

    /// Rate of swap in stable swap we are content with
    uint256 public constant MIN_SWAP_RATE = 99;

    event NativeTransferFailed(bytes32 requestHash);
    event NativeTransferSwap(bytes32 requestHash, uint256 amount_out);
    event SwapFailed(bytes32 requestHash, uint256 amount_in);

    error SwapError();

    bytes32 internal constant EMPTY_STORAGE = 0x0;
    bytes32 internal constant NATIVE_MARKER_BYTES = 0x0;
    address internal constant NATIVE_MARKER_ADDRESS = address(0);

    /// flat fee paid upon requesting transfer
    uint256 public flat_fee;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize(
        address[] calldata _committee,
        uint256 _signatureThreshold,
        address owner,
        address payable _stableSwapAddress,
        address _bAzeroAddress
    ) public initializer {
        stableSwapAddress = _stableSwapAddress;
        bAzeroAddress = _bAzeroAddress;
        // Initial fee set to 0.5 Azero
        flat_fee = 1e18 / 2;

        // Set the weth address to zero address. We dont use this in L2 most
        __AbstractMost_init(
            _committee,
            _signatureThreshold,
            payable(address(0))
        );
        __Ownable_init(owner);
        __Pausable_init();

        _pause();
    }

    /// Calculates min value of the swap we are happy with.
    /// Takes into account the difference in number of decimals between bazero and native token.
    function calc_min_amount_out_swap(
        uint256 amount,
        bool to_bazero
    ) internal pure returns (uint256) {
        if (to_bazero) {
            return ((amount / 100) * MIN_SWAP_RATE) / BAZERO_TO_NATIVE_RATIO;
        } else {
            return (amount / 100) * MIN_SWAP_RATE * BAZERO_TO_NATIVE_RATIO;
        }
    }

    function swap_from_bazero(uint256 amount) internal returns (bool, uint256) {
        IWrappedToken bazero = IWrappedToken(bAzeroAddress);
        StableSwapTwoPool stablePool = StableSwapTwoPool(stableSwapAddress);

        // Allow swap to spend that many tokens
        bazero.approve(address(stableSwapAddress), amount);
        // at least 99% of what we gave to the swap
        uint256 min_amount_out = calc_min_amount_out_swap(amount, false);

        (bool swapSuccess, bytes memory returndata) = address(stablePool).call(
            abi.encodeCall(
                stablePool.exchange_to_native,
                (amount, min_amount_out)
            )
        );
        if (swapSuccess) {
            uint256 amount_out = abi.decode(returndata, (uint256));
            return (swapSuccess, amount_out);
        }
        return (false, 0);
    }

    function swap_for_bazero(uint256 amount) internal returns (uint256) {
        // at least 99% of what we gave to the swap
        uint256 min_amount_out = calc_min_amount_out_swap(amount, true);

        StableSwapTwoPool stablePool = StableSwapTwoPool(stableSwapAddress);
        return stablePool.exchange_from_native{value: amount}(min_amount_out);
    }

    function native_transfer(
        bytes32 requestHash,
        uint256 amount,
        address _destReceiverAddress
    ) internal {
        // What we do here is:
        // 1. Mint `amount` Bazero
        // 2. Allow spending that many Bazero for swap contract
        // 3. exchange bazero for native tokens, here the swap spends its allowance and sends native to this contract
        // 4. transfer exchanged native to the receiver.
        IWrappedToken bazero = IWrappedToken(bAzeroAddress);
        bazero.mint(address(this), amount);

        (bool swapSuccess, uint256 amount_out) = swap_from_bazero(amount);

        if (!swapSuccess) {
            IERC20(bAzeroAddress).safeTransfer(_destReceiverAddress, amount);
            emit SwapFailed(requestHash, amount);
            return;
        }

        // payout to receiver
        (bool sendNativeEthSuccess, ) = _destReceiverAddress.call{
            value: amount_out,
            gas: GAS_LIMIT
        }("");

        if (!sendNativeEthSuccess) {
            emit NativeTransferFailed(requestHash);
        } else {
            emit NativeTransferSwap(requestHash, amount_out);
        }
    }

    function remote_token_transfer(
        address _destTokenAddress,
        uint256 amount,
        address _destReceiverAddress
    ) internal {
        // Mint representation of the remote token
        IWrappedToken mintableToken = IWrappedToken(_destTokenAddress);
        mintableToken.mint(_destReceiverAddress, amount);
    }

    function onReceiveRequestThresholdMet(
        bytes32 requestHash,
        bytes32 destTokenAddress,
        uint256 amount,
        bytes32 destReceiverAddress
    ) internal override {
        processedRequests[requestHash] = true;
        delete pendingRequests[requestHash];

        address _destTokenAddress = bytes32ToAddress(destTokenAddress);
        address _destReceiverAddress = bytes32ToAddress(destReceiverAddress);

        require(
            !isLocalToken[_destTokenAddress],
            "We dont bridge non local token"
        );

        // transfer native
        if (_destTokenAddress == NATIVE_MARKER_ADDRESS) {
            native_transfer(requestHash, amount, _destReceiverAddress);
        } else {
            remote_token_transfer(
                _destTokenAddress,
                amount,
                _destReceiverAddress
            );
        }

        emit RequestProcessed(requestHash);
    }

    function burn_bazero(uint256 amount) internal {
        IWrappedToken bazero = IWrappedToken(bAzeroAddress);
        bazero.burn(amount);
    }

    /// This function, if it is possible, transfer flat fee to owner
    /// and returns the surplus to the caller.
    function handle_flat_fee(uint256 native_amount) internal {
        uint256 transferred = msg.value;

        require(
            transferred >= native_amount,
            "Not enough value send for transfer"
        );

        transferred -= native_amount;
        require(transferred >= flat_fee, "Not enough value send for fees");

        uint256 surplus = transferred - flat_fee;

        (bool sent, ) = owner().call{value: flat_fee}("");
        require(sent, "Failed to send fee to owner");

        if (surplus > 0) {
            (bool sent, ) = msg.sender.call{value: surplus}("");
            require(sent, "Failed to return surplus");
        }
    }

    function sendRequestNative(
        bytes32
    ) external payable override whenNotPaused {
        revert(
            "Not supported on L2 bridge, use `sendRequestNative` with additional arg"
        );
    }

    /// @notice Invoke this tx to transfer funds to the destination chain.
    /// Account needs to send native Azero which are swapped for bazero
    /// tokens. Since the Bazero have 12 decimals and Azero have 18,
    /// user need to send at leas 10e6 tokens with this call.
    ///
    /// @dev Tx emits a CrosschainTransferRequest event that the relayers listen to
    /// & forward to the destination chain.
    function sendRequestNative(
        bytes32 destReceiverAddress,
        uint256 amount_to_bridge
    ) external payable whenNotPaused {
        require(
            amount_to_bridge >= BAZERO_TO_NATIVE_RATIO,
            "Value must be at least 10e6"
        );
        if (destReceiverAddress == bytes32(0)) {
            revert ZeroAddress();
        }
        handle_flat_fee(amount_to_bridge);

        uint256 amount_out = swap_for_bazero(amount_to_bridge);
        burn_bazero(amount_out);

        emit CrosschainTransferRequest(
            committeeId,
            NATIVE_MARKER_BYTES,
            amount_out,
            destReceiverAddress,
            requestNonce
        );

        ++requestNonce;
    }

    function sendRequest(
        bytes32,
        uint256,
        bytes32
    ) external override whenNotPaused {
        revert("Not supported on L2 bridge, use `SendTokenRequest` instead");
    }

    /// @notice Invoke this tx to transfer funds to the destination chain.
    /// Account needs to approve the Most contract to spend the `srcTokenAmount`
    /// of `srcTokenAddress` tokens on their behalf before executing the tx.
    ///
    /// @dev Tx emits a CrosschainTransferRequest event that the relayers listen to
    /// & forward to the destination chain.
    function sendTokenRequest(
        bytes32 srcTokenAddress,
        uint256 amount,
        bytes32 destReceiverAddress
    ) external payable whenNotPaused {
        if (amount == 0) revert ZeroAmount();
        if (destReceiverAddress == bytes32(0)) revert ZeroAddress();
        handle_flat_fee(0);

        address token = bytes32ToAddress(srcTokenAddress);

        bytes32 destTokenAddress = supportedPairs[srcTokenAddress];

        if (destTokenAddress == EMPTY_STORAGE) revert UnsupportedPair();
        // Should not happen, see `addPair` function where we allow only nonLocal tokens.
        require(
            !isLocalToken[token],
            "We dont bridge local tokens on L2 bridge"
        );

        // Burn tokens in this contract
        // message sender needs to give approval else this tx will revert
        IERC20 tokenERC20 = IERC20(token);
        tokenERC20.safeTransferFrom(msg.sender, address(this), amount);
        IWrappedToken burnableToken = IWrappedToken(token);
        burnableToken.burn(amount);

        emit CrosschainTransferRequest(
            committeeId,
            destTokenAddress,
            amount,
            destReceiverAddress,
            requestNonce
        );

        ++requestNonce;
    }

    function setBridgedAzeroAddress(
        address _bAzeroAddress
    ) external onlyOwner whenPaused {
        bAzeroAddress = _bAzeroAddress;
    }

    function sendRequestAzeroToNative(uint256, bytes32) external pure override {
        revert("Not supported on L2 bridge");
    }

    function addPair(
        bytes32 from,
        bytes32 to,
        bool isLocal
    ) external override onlyOwner whenPaused {
        require(!isLocal, "L2 Most dont bridge local tokens");
        supportedPairs[from] = to;
        isLocalToken[bytes32ToAddress(from)] = false;
    }

    function setFlatFee(uint256 new_flat_fee) external onlyOwner {
        flat_fee = new_flat_fee;
    }

    /// @dev Accept ether only from pool contract or through payable methods
    receive() external payable override {
        require(msg.sender == stableSwapAddress);
    }
}

File 38 of 43 : IStableSwapLP.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

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

    function mint(address _to, uint256 _amount) external;

    function burnFrom(address _to, uint256 _amount) external;

    function setMinter(address _newMinter) external;
}

File 39 of 43 : StableSwapLP.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "@openzeppelin-4.5.0/contracts/token/ERC20/ERC20.sol";

contract StableSwapLP is ERC20 {
    address public minter;

    constructor() ERC20("StableSwap LPs", "Stable-LP") {
        minter = msg.sender;
    }

    /**
     * @notice Checks if the msg.sender is the minter address.
     */
    modifier onlyMinter() {
        require(msg.sender == minter, "Not minter");
        _;
    }

    function setMinter(address _newMinter) external onlyMinter {
        minter = _newMinter;
    }

    function mint(address _to, uint256 _amount) external onlyMinter {
        _mint(_to, _amount);
    }

    function burnFrom(address _to, uint256 _amount) external onlyMinter {
        _burn(_to, _amount);
    }
}

File 40 of 43 : StableSwapTwoPool.sol
// MIT License
//
// Copyright (c) 2024 PancakeSwap
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
pragma solidity ^0.8.10;

import "@openzeppelin-4.5.0/contracts/access/Ownable.sol";
import "@openzeppelin-4.5.0/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin-4.5.0/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin-4.5.0/contracts/security/ReentrancyGuard.sol";
import "./IStableSwapLP.sol";

contract StableSwapTwoPool is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    uint256 public constant N_COINS = 2;

    uint256 public constant MAX_DECIMAL = 18;
    uint256 public constant FEE_DENOMINATOR = 1e10;
    uint256 public constant PRECISION = 1e18;
    uint256[N_COINS] public PRECISION_MUL;
    uint256[N_COINS] public RATES;

    uint256 public constant MAX_ADMIN_FEE = 1e10;
    uint256 public constant MAX_FEE = 5e9;
    uint256 public constant MAX_AMPLIFICATION_COEFFICIENT = 1e6;
    uint256 public constant MAX_AMPLIFICATION_COEFFICIENT_CHANGE = 10;
    uint256 public constant MIN_NATIVE_GAS = 2300;
    uint256 public constant MAX_NATIVE_GAS = 23000;

    uint256 public constant ADMIN_ACTIONS_DELAY = 3 days;
    uint256 public constant MIN_RAMP_TIME = 1 days;

    address[N_COINS] public coins;
    uint256[N_COINS] public balances;
    uint256 public fee; // fee * 1e10.
    uint256 public admin_fee; // admin_fee * 1e10.
    uint256 public native_gas = 4029; // transfer native gas.

    IStableSwapLP public token;

    address constant NATIVE_ADDRESS =
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    bool support_native;

    uint256 public initial_amplification_coefficient;
    uint256 public future_amplification_coefficient;
    uint256 public initial_amplification_coefficient_time;
    uint256 public future_amplification_coefficient_time;

    uint256 public admin_actions_deadline;
    uint256 public future_fee;
    uint256 public future_admin_fee;

    uint256 public kill_deadline;
    uint256 public constant KILL_DEADLINE_DT = 2 * 30 days;
    bool public is_killed;

    address public immutable STABLESWAP_FACTORY;
    bool public isInitialized;

    event TokenExchange(
        address indexed buyer,
        uint256 sold_id,
        uint256 tokens_sold,
        uint256 bought_id,
        uint256 tokens_bought
    );
    event AddLiquidity(
        address indexed provider,
        uint256[N_COINS] token_amounts,
        uint256[N_COINS] fees,
        uint256 invariant,
        uint256 token_supply
    );
    event RemoveLiquidity(
        address indexed provider,
        uint256[N_COINS] token_amounts,
        uint256[N_COINS] fees,
        uint256 token_supply
    );
    event RemoveLiquidityOne(
        address indexed provider,
        uint256 index,
        uint256 token_amount,
        uint256 coin_amount
    );
    event RemoveLiquidityImbalance(
        address indexed provider,
        uint256[N_COINS] token_amounts,
        uint256[N_COINS] fees,
        uint256 invariant,
        uint256 token_supply
    );
    event CommitNewFee(
        uint256 indexed deadline,
        uint256 fee,
        uint256 admin_fee
    );
    event NewFee(uint256 fee, uint256 admin_fee);
    event RampA(
        uint256 old_A,
        uint256 new_A,
        uint256 initial_time,
        uint256 future_time
    );
    event StopRampA(uint256 A, uint256 t);
    event SetNativeGas(uint256 native_gas);
    event RevertParameters();
    event DonateAdminFees();
    event Kill();
    event Unkill();

    /**
     * @notice constructor
     */
    constructor() {
        STABLESWAP_FACTORY = msg.sender;
    }

    /**
     * @notice initialize
     * @param _coins: Addresses of ERC20 conracts of coins (c-tokens) involved
     * @param _amplification_coefficient: Amplification coefficient multiplied by n * (n - 1)
     * @param _fee: Fee to charge for exchanges
     * @param _admin_fee: Admin fee
     * @param _owner: Owner
     * @param _liquidity_pool: LP address
     */
    function initialize(
        address[N_COINS] memory _coins,
        uint256 _amplification_coefficient,
        uint256 _fee,
        uint256 _admin_fee,
        address _owner,
        address _liquidity_pool
    ) external {
        require(!isInitialized, "Operations: Already initialized");
        require(msg.sender == STABLESWAP_FACTORY, "Operations: Not factory");
        require(
            _amplification_coefficient <= MAX_AMPLIFICATION_COEFFICIENT,
            "_amplification_coefficient exceeds maximum"
        );
        require(_fee <= MAX_FEE, "_fee exceeds maximum");
        require(_admin_fee <= MAX_ADMIN_FEE, "_admin_fee exceeds maximum");
        isInitialized = true;
        for (uint256 i = 0; i < N_COINS; i++) {
            require(_coins[i] != address(0), "ZERO Address");
            uint256 coinDecimal;
            if (_coins[i] == NATIVE_ADDRESS) {
                coinDecimal = 18;
                support_native = true;
            } else {
                coinDecimal = IERC20Metadata(_coins[i]).decimals();
            }
            require(
                coinDecimal <= MAX_DECIMAL,
                "The maximum decimal cannot exceed 18"
            );
            //set PRECISION_MUL and  RATES
            PRECISION_MUL[i] = 10 ** (MAX_DECIMAL - coinDecimal);
            RATES[i] = PRECISION * PRECISION_MUL[i];
        }
        coins = _coins;
        initial_amplification_coefficient = _amplification_coefficient;
        future_amplification_coefficient = _amplification_coefficient;
        fee = _fee;
        admin_fee = _admin_fee;
        kill_deadline = block.timestamp + KILL_DEADLINE_DT;
        token = IStableSwapLP(_liquidity_pool);

        transferOwnership(_owner);
    }

    function get_amplification_coefficient() internal view returns (uint256) {
        //Handle ramping A up or down
        uint256 t1 = future_amplification_coefficient_time;
        uint256 A1 = future_amplification_coefficient;
        if (block.timestamp < t1) {
            uint256 A0 = initial_amplification_coefficient;
            uint256 t0 = initial_amplification_coefficient_time;
            // Expressions in uint256 cannot have negative numbers, thus "if"
            if (A1 > A0) {
                return A0 + ((A1 - A0) * (block.timestamp - t0)) / (t1 - t0);
            } else {
                return A0 - ((A0 - A1) * (block.timestamp - t0)) / (t1 - t0);
            }
        } else {
            // when t1 == 0 or block.timestamp >= t1
            return A1;
        }
    }

    function amplification_coefficient() external view returns (uint256) {
        return get_amplification_coefficient();
    }

    function _xp() internal view returns (uint256[N_COINS] memory result) {
        result = RATES;
        for (uint256 i = 0; i < N_COINS; i++) {
            result[i] = (result[i] * balances[i]) / PRECISION;
        }
    }

    function _xp_mem(
        uint256[N_COINS] memory _balances
    ) internal view returns (uint256[N_COINS] memory result) {
        result = RATES;
        for (uint256 i = 0; i < N_COINS; i++) {
            result[i] = (result[i] * _balances[i]) / PRECISION;
        }
    }

    function get_D(
        uint256[N_COINS] memory xp,
        uint256 amp
    ) internal pure returns (uint256) {
        uint256 S;
        for (uint256 i = 0; i < N_COINS; i++) {
            S += xp[i];
        }
        if (S == 0) {
            return 0;
        }

        uint256 Dprev;
        uint256 D = S;
        uint256 Ann = amp * N_COINS;
        for (uint256 j = 0; j < 255; j++) {
            uint256 D_P = D;
            for (uint256 k = 0; k < N_COINS; k++) {
                D_P = (D_P * D) / (xp[k] * N_COINS); // If division by 0, this will be borked: only withdrawal will work. And that is good
            }
            Dprev = D;
            D =
                ((Ann * S + D_P * N_COINS) * D) /
                ((Ann - 1) * D + (N_COINS + 1) * D_P);
            // Equality with the precision of 1
            if (D > Dprev) {
                if (D - Dprev <= 1) {
                    break;
                }
            } else {
                if (Dprev - D <= 1) {
                    break;
                }
            }
        }
        return D;
    }

    function get_D_mem(
        uint256[N_COINS] memory _balances,
        uint256 amp
    ) internal view returns (uint256) {
        return get_D(_xp_mem(_balances), amp);
    }

    function get_virtual_price() external view returns (uint256) {
        /**
        Returns portfolio virtual price (for calculating profit)
        scaled up by 1e18
        */
        uint256 D = get_D(_xp(), get_amplification_coefficient());
        /**
        D is in the units similar to DAI (e.g. converted to precision 1e18)
        When balanced, D = n * x_u - total virtual value of the portfolio
        */
        uint256 token_supply = token.totalSupply();
        return (D * PRECISION) / token_supply;
    }

    function calc_token_amount(
        uint256[N_COINS] memory amounts,
        bool deposit
    ) external view returns (uint256) {
        /**
        Simplified method to calculate addition or reduction in token supply at
        deposit or withdrawal without taking fees into account (but looking at
        slippage).
        Needed to prevent front-running, not for precise calculations!
        */
        uint256[N_COINS] memory _balances = balances;
        uint256 amp = get_amplification_coefficient();
        uint256 D0 = get_D_mem(_balances, amp);
        for (uint256 i = 0; i < N_COINS; i++) {
            if (deposit) {
                _balances[i] += amounts[i];
            } else {
                _balances[i] -= amounts[i];
            }
        }
        uint256 D1 = get_D_mem(_balances, amp);
        uint256 token_amount = token.totalSupply();
        uint256 difference;
        if (deposit) {
            difference = D1 - D0;
        } else {
            difference = D0 - D1;
        }
        return (difference * token_amount) / D0;
    }

    function add_liquidity(
        uint256[N_COINS] memory amounts,
        uint256 min_mint_amount
    ) external payable nonReentrant {
        //Amounts is amounts of c-tokens
        require(!is_killed, "Killed");
        if (!support_native) {
            require(msg.value == 0, "Inconsistent quantity"); // Avoid sending native by mistake.
        }
        uint256[N_COINS] memory fees;
        uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
        uint256 _admin_fee = admin_fee;
        uint256 amp = get_amplification_coefficient();

        uint256 token_supply = token.totalSupply();
        //Initial invariant
        uint256 D0;
        uint256[N_COINS] memory old_balances = balances;
        if (token_supply > 0) {
            D0 = get_D_mem(old_balances, amp);
        }
        uint256[N_COINS] memory new_balances = [
            old_balances[0],
            old_balances[1]
        ];

        for (uint256 i = 0; i < N_COINS; i++) {
            if (token_supply == 0) {
                require(amounts[i] > 0, "Initial deposit requires all coins");
            }
            // balances store amounts of c-tokens
            new_balances[i] = old_balances[i] + amounts[i];
        }

        // Invariant after change
        uint256 D1 = get_D_mem(new_balances, amp);
        require(D1 > D0, "D1 must be greater than D0");

        // We need to recalculate the invariant accounting for fees
        // to calculate fair user's share
        uint256 D2 = D1;
        if (token_supply > 0) {
            // Only account for fees if we are not the first to deposit
            for (uint256 i = 0; i < N_COINS; i++) {
                uint256 ideal_balance = (D1 * old_balances[i]) / D0;
                uint256 difference;
                if (ideal_balance > new_balances[i]) {
                    difference = ideal_balance - new_balances[i];
                } else {
                    difference = new_balances[i] - ideal_balance;
                }

                fees[i] = (_fee * difference) / FEE_DENOMINATOR;
                balances[i] =
                    new_balances[i] -
                    ((fees[i] * _admin_fee) / FEE_DENOMINATOR);
                new_balances[i] -= fees[i];
            }
            D2 = get_D_mem(new_balances, amp);
        } else {
            balances = new_balances;
        }

        // Calculate, how much pool tokens to mint
        uint256 mint_amount;
        if (token_supply == 0) {
            mint_amount = D1; // Take the dust if there was any
        } else {
            mint_amount = (token_supply * (D2 - D0)) / D0;
        }
        require(mint_amount >= min_mint_amount, "Slippage screwed you");

        // Take coins from the sender
        for (uint256 i = 0; i < N_COINS; i++) {
            uint256 amount = amounts[i];
            address coin = coins[i];
            transfer_in(coin, amount);
        }

        // Mint pool tokens
        token.mint(msg.sender, mint_amount);

        emit AddLiquidity(
            msg.sender,
            amounts,
            fees,
            D1,
            token_supply + mint_amount
        );
    }

    function get_y(
        uint256 i,
        uint256 j,
        uint256 x,
        uint256[N_COINS] memory xp_
    ) internal view returns (uint256) {
        // x in the input is converted to the same price/precision
        require(
            (i != j) && (i < N_COINS) && (j < N_COINS),
            "Illegal parameter"
        );
        uint256 amp = get_amplification_coefficient();
        uint256 D = get_D(xp_, amp);
        uint256 c = D;
        uint256 S_;
        uint256 Ann = amp * N_COINS;

        uint256 _x;
        for (uint256 k = 0; k < N_COINS; k++) {
            if (k == i) {
                _x = x;
            } else if (k != j) {
                _x = xp_[k];
            } else {
                continue;
            }
            S_ += _x;
            c = (c * D) / (_x * N_COINS);
        }
        c = (c * D) / (Ann * N_COINS);
        uint256 b = S_ + D / Ann; // - D
        uint256 y_prev;
        uint256 y = D;

        for (uint256 m = 0; m < 255; m++) {
            y_prev = y;
            y = (y * y + c) / (2 * y + b - D);
            // Equality with the precision of 1
            if (y > y_prev) {
                if (y - y_prev <= 1) {
                    break;
                }
            } else {
                if (y_prev - y <= 1) {
                    break;
                }
            }
        }
        return y;
    }

    function get_amount_out(
        uint256 source_token,
        uint256 dest_token,
        uint256 amount_in
    ) external view returns (uint256) {
        // dx and dy in c-units
        uint256[N_COINS] memory rates = RATES;
        uint256[N_COINS] memory xp = _xp();

        uint256 x = xp[source_token] +
            ((amount_in * rates[source_token]) / PRECISION);
        uint256 y = get_y(source_token, dest_token, x, xp);
        uint256 dy = ((xp[dest_token] - y - 1) * PRECISION) / rates[dest_token];
        uint256 _fee = (fee * dy) / FEE_DENOMINATOR;
        return dy - _fee;
    }

    function get_dy_underlying(
        uint256 i,
        uint256 j,
        uint256 dx
    ) external view returns (uint256) {
        // dx and dy in underlying units
        uint256[N_COINS] memory xp = _xp();
        uint256[N_COINS] memory precisions = PRECISION_MUL;

        uint256 x = xp[i] + dx * precisions[i];
        uint256 y = get_y(i, j, x, xp);
        uint256 dy = (xp[j] - y - 1) / precisions[j];
        uint256 _fee = (fee * dy) / FEE_DENOMINATOR;
        return dy - _fee;
    }

    function exchange_to_native(
        uint256 amount_in,
        uint256 native_min_amount_out
    ) external payable nonReentrant returns (uint256) {
        require(support_native, "Cant exchange native without native support");

        if (coins[0] == NATIVE_ADDRESS) {
            return exchange(1, 0, amount_in, native_min_amount_out);
        } else {
            return exchange(0, 1, amount_in, native_min_amount_out);
        }
    }

    function exchange_from_native(
        uint256 min_amount_out
    ) external payable nonReentrant returns (uint256) {
        require(support_native, "Cant exchange native without native support");

        if (coins[0] == NATIVE_ADDRESS) {
            return exchange(0, 1, msg.value, min_amount_out);
        } else {
            return exchange(1, 0, msg.value, min_amount_out);
        }
    }

    function exchange(
        uint256 source_token,
        uint256 dest_token,
        uint256 amount_in,
        uint256 amount_out
    ) internal returns (uint256) {
        require(!is_killed, "Killed");
        if (!support_native) {
            require(msg.value == 0, "Inconsistent quantity"); // Avoid sending native by mistake.
        }

        uint256[N_COINS] memory old_balances = balances;
        uint256[N_COINS] memory xp = _xp_mem(old_balances);

        uint256 x = xp[source_token] +
            (amount_in * RATES[source_token]) /
            PRECISION;
        uint256 y = get_y(source_token, dest_token, x, xp);

        uint256 dy = xp[dest_token] - y - 1; //  -1 just in case there were some rounding errors
        uint256 dy_fee = (dy * fee) / FEE_DENOMINATOR;

        // Convert all to real units
        dy = ((dy - dy_fee) * PRECISION) / RATES[dest_token];
        require(
            dy >= amount_out,
            "Exchange resulted in fewer coins than expected"
        );

        uint256 dy_admin_fee = (dy_fee * admin_fee) / FEE_DENOMINATOR;
        dy_admin_fee = (dy_admin_fee * PRECISION) / RATES[dest_token];

        // Change balances exactly in same way as we change actual ERC20 coin amounts
        balances[source_token] = old_balances[source_token] + amount_in;
        // When rounding errors happen, we undercharge admin fee in favor of LP
        balances[dest_token] = old_balances[dest_token] - dy - dy_admin_fee;

        address iAddress = coins[source_token];
        if (iAddress == NATIVE_ADDRESS) {
            require(amount_in == msg.value, "Inconsistent quantity");
        } else {
            IERC20(iAddress).safeTransferFrom(
                msg.sender,
                address(this),
                amount_in
            );
        }
        address jAddress = coins[dest_token];
        transfer_out(jAddress, dy);
        return dy;
    }

    function remove_liquidity(
        uint256 _amount,
        uint256[N_COINS] memory min_amounts
    ) external nonReentrant {
        uint256 total_supply = token.totalSupply();
        uint256[N_COINS] memory amounts;
        uint256[N_COINS] memory fees; //Fees are unused but we've got them historically in event

        for (uint256 i = 0; i < N_COINS; i++) {
            uint256 value = (balances[i] * _amount) / total_supply;
            require(
                value >= min_amounts[i],
                "Withdrawal resulted in fewer coins than expected"
            );
            balances[i] -= value;
            amounts[i] = value;
            transfer_out(coins[i], value);
        }

        token.burnFrom(msg.sender, _amount); // dev: insufficient funds

        emit RemoveLiquidity(msg.sender, amounts, fees, total_supply - _amount);
    }

    function remove_liquidity_imbalance(
        uint256[N_COINS] memory amounts,
        uint256 max_burn_amount
    ) external nonReentrant {
        require(!is_killed, "Killed");

        uint256 token_supply = token.totalSupply();
        require(token_supply > 0, "dev: zero total supply");
        uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
        uint256 _admin_fee = admin_fee;
        uint256 amp = get_amplification_coefficient();

        uint256[N_COINS] memory old_balances = balances;
        uint256[N_COINS] memory new_balances = [
            old_balances[0],
            old_balances[1]
        ];
        uint256 D0 = get_D_mem(old_balances, amp);
        for (uint256 i = 0; i < N_COINS; i++) {
            new_balances[i] -= amounts[i];
        }
        uint256 D1 = get_D_mem(new_balances, amp);
        uint256[N_COINS] memory fees;
        for (uint256 i = 0; i < N_COINS; i++) {
            uint256 ideal_balance = (D1 * old_balances[i]) / D0;
            uint256 difference;
            if (ideal_balance > new_balances[i]) {
                difference = ideal_balance - new_balances[i];
            } else {
                difference = new_balances[i] - ideal_balance;
            }
            fees[i] = (_fee * difference) / FEE_DENOMINATOR;
            balances[i] =
                new_balances[i] -
                ((fees[i] * _admin_fee) / FEE_DENOMINATOR);
            new_balances[i] -= fees[i];
        }
        uint256 D2 = get_D_mem(new_balances, amp);

        uint256 token_amount = ((D0 - D2) * token_supply) / D0;
        require(token_amount > 0, "token_amount must be greater than 0");
        token_amount += 1; // In case of rounding errors - make it unfavorable for the "attacker"
        require(token_amount <= max_burn_amount, "Slippage screwed you");

        token.burnFrom(msg.sender, token_amount); // dev: insufficient funds

        for (uint256 i = 0; i < N_COINS; i++) {
            if (amounts[i] > 0) {
                transfer_out(coins[i], amounts[i]);
            }
        }
        token_supply -= token_amount;
        emit RemoveLiquidityImbalance(
            msg.sender,
            amounts,
            fees,
            D1,
            token_supply
        );
    }

    function get_y_D(
        uint256 A_,
        uint256 i,
        uint256[N_COINS] memory xp,
        uint256 D
    ) internal pure returns (uint256) {
        /**
        Calculate x[i] if one reduces D from being calculated for xp to D

        Done by solving quadratic equation iteratively.
        x_1**2 + x1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
        x_1**2 + b*x_1 = c

        x_1 = (x_1**2 + c) / (2*x_1 + b)
        */
        // x in the input is converted to the same price/precision
        require(i < N_COINS, "dev: i above N_COINS");
        uint256 c = D;
        uint256 S_;
        uint256 Ann = A_ * N_COINS;

        uint256 _x;
        for (uint256 k = 0; k < N_COINS; k++) {
            if (k != i) {
                _x = xp[k];
            } else {
                continue;
            }
            S_ += _x;
            c = (c * D) / (_x * N_COINS);
        }
        c = (c * D) / (Ann * N_COINS);
        uint256 b = S_ + D / Ann;
        uint256 y_prev;
        uint256 y = D;

        for (uint256 k = 0; k < 255; k++) {
            y_prev = y;
            y = (y * y + c) / (2 * y + b - D);
            // Equality with the precision of 1
            if (y > y_prev) {
                if (y - y_prev <= 1) {
                    break;
                }
            } else {
                if (y_prev - y <= 1) {
                    break;
                }
            }
        }
        return y;
    }

    function _calc_withdraw_one_coin(
        uint256 _token_amount,
        uint256 i
    ) internal view returns (uint256, uint256) {
        // First, need to calculate
        // * Get current D
        // * Solve Eqn against y_i for D - _token_amount
        uint256 amp = get_amplification_coefficient();
        uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
        uint256[N_COINS] memory precisions = PRECISION_MUL;
        uint256 total_supply = token.totalSupply();

        uint256[N_COINS] memory xp = _xp();

        uint256 D0 = get_D(xp, amp);
        uint256 D1 = D0 - (_token_amount * D0) / total_supply;
        uint256[N_COINS] memory xp_reduced = xp;

        uint256 new_y = get_y_D(amp, i, xp, D1);
        uint256 dy_0 = (xp[i] - new_y) / precisions[i]; // w/o fees

        for (uint256 k = 0; k < N_COINS; k++) {
            uint256 dx_expected;
            if (k == i) {
                dx_expected = (xp[k] * D1) / D0 - new_y;
            } else {
                dx_expected = xp[k] - (xp[k] * D1) / D0;
            }
            xp_reduced[k] -= (_fee * dx_expected) / FEE_DENOMINATOR;
        }
        uint256 dy = xp_reduced[i] - get_y_D(amp, i, xp_reduced, D1);
        dy = (dy - 1) / precisions[i]; // Withdraw less to account for rounding errors

        return (dy, dy_0 - dy);
    }

    function calc_withdraw_one_coin(
        uint256 _token_amount,
        uint256 i
    ) external view returns (uint256) {
        (uint256 dy, ) = _calc_withdraw_one_coin(_token_amount, i);
        return dy;
    }

    function remove_liquidity_one_coin(
        uint256 _token_amount,
        uint256 i,
        uint256 min_amount
    ) external nonReentrant {
        // Remove _amount of liquidity all in a form of coin i
        require(!is_killed, "Killed");
        (uint256 dy, uint256 dy_fee) = _calc_withdraw_one_coin(
            _token_amount,
            i
        );
        require(dy >= min_amount, "Not enough coins removed");

        balances[i] -= (dy + (dy_fee * admin_fee) / FEE_DENOMINATOR);
        token.burnFrom(msg.sender, _token_amount); // dev: insufficient funds
        transfer_out(coins[i], dy);

        emit RemoveLiquidityOne(msg.sender, i, _token_amount, dy);
    }

    function transfer_out(address coin_address, uint256 value) internal {
        if (coin_address == NATIVE_ADDRESS) {
            _safeTransferNative(msg.sender, value);
        } else {
            IERC20(coin_address).safeTransfer(msg.sender, value);
        }
    }

    function transfer_in(address coin_address, uint256 value) internal {
        if (coin_address == NATIVE_ADDRESS) {
            require(value == msg.value, "Inconsistent quantity");
        } else {
            IERC20(coin_address).safeTransferFrom(
                msg.sender,
                address(this),
                value
            );
        }
    }

    function _safeTransferNative(address to, uint256 value) internal {
        (bool success, ) = to.call{gas: native_gas, value: value}("");
        require(success, "native transfer failed");
    }

    // Admin functions

    function set_native_gas(uint256 _native_gas) external onlyOwner {
        require(
            _native_gas >= MIN_NATIVE_GAS && _native_gas <= MAX_NATIVE_GAS,
            "Illegal gas"
        );
        native_gas = _native_gas;
        emit SetNativeGas(_native_gas);
    }

    function ramp_amplification_coefficient(
        uint256 _future_amplification_coefficient,
        uint256 _future_time
    ) external onlyOwner {
        require(
            block.timestamp >=
                initial_amplification_coefficient_time + MIN_RAMP_TIME,
            "dev : too early"
        );
        require(
            _future_time >= block.timestamp + MIN_RAMP_TIME,
            "dev: insufficient time"
        );

        uint256 _initial_amplification_coefficient = get_amplification_coefficient();
        require(
            _future_amplification_coefficient > 0 &&
                _future_amplification_coefficient <
                MAX_AMPLIFICATION_COEFFICIENT,
            "_future_amplification_coefficient must be between 0 and MAX_AMPLIFICATION_COEFFICIENT"
        );
        require(
            (_future_amplification_coefficient >=
                _initial_amplification_coefficient &&
                _future_amplification_coefficient <=
                _initial_amplification_coefficient *
                    MAX_AMPLIFICATION_COEFFICIENT_CHANGE) ||
                (_future_amplification_coefficient <
                    _initial_amplification_coefficient &&
                    _future_amplification_coefficient *
                        MAX_AMPLIFICATION_COEFFICIENT_CHANGE >=
                    _initial_amplification_coefficient),
            "Illegal parameter _future_amplification_coefficient"
        );
        initial_amplification_coefficient = _initial_amplification_coefficient;
        future_amplification_coefficient = _future_amplification_coefficient;
        initial_amplification_coefficient_time = block.timestamp;
        future_amplification_coefficient_time = _future_time;

        emit RampA(
            _initial_amplification_coefficient,
            _future_amplification_coefficient,
            block.timestamp,
            _future_time
        );
    }

    function stop_rampget_amplification_coefficient() external onlyOwner {
        uint256 current_amplification_coefficient = get_amplification_coefficient();
        initial_amplification_coefficient = current_amplification_coefficient;
        future_amplification_coefficient = current_amplification_coefficient;
        initial_amplification_coefficient_time = block.timestamp;
        future_amplification_coefficient_time = block.timestamp;
        // now (block.timestamp < t1) is always False, so we return saved A

        emit StopRampA(current_amplification_coefficient, block.timestamp);
    }

    function commit_new_fee(
        uint256 new_fee,
        uint256 new_admin_fee
    ) external onlyOwner {
        require(
            admin_actions_deadline == 0,
            "admin_actions_deadline must be 0"
        ); // dev: active action
        require(new_fee <= MAX_FEE, "dev: fee exceeds maximum");
        require(
            new_admin_fee <= MAX_ADMIN_FEE,
            "dev: admin fee exceeds maximum"
        );

        admin_actions_deadline = block.timestamp + ADMIN_ACTIONS_DELAY;
        future_fee = new_fee;
        future_admin_fee = new_admin_fee;

        emit CommitNewFee(admin_actions_deadline, new_fee, new_admin_fee);
    }

    function apply_new_fee() external onlyOwner {
        require(
            block.timestamp >= admin_actions_deadline,
            "dev: insufficient time"
        );
        require(
            admin_actions_deadline != 0,
            "admin_actions_deadline should not be 0"
        );

        admin_actions_deadline = 0;
        fee = future_fee;
        admin_fee = future_admin_fee;

        emit NewFee(fee, admin_fee);
    }

    function revert_new_parameters() external onlyOwner {
        admin_actions_deadline = 0;
        emit RevertParameters();
    }

    function admin_balances(uint256 i) external view returns (uint256) {
        if (coins[i] == NATIVE_ADDRESS) {
            return address(this).balance - balances[i];
        } else {
            return IERC20(coins[i]).balanceOf(address(this)) - balances[i];
        }
    }

    function withdraw_admin_fees() external onlyOwner {
        for (uint256 i = 0; i < N_COINS; i++) {
            uint256 value;
            if (coins[i] == NATIVE_ADDRESS) {
                value = address(this).balance - balances[i];
            } else {
                value = IERC20(coins[i]).balanceOf(address(this)) - balances[i];
            }
            if (value > 0) {
                transfer_out(coins[i], value);
            }
        }
    }

    function donate_admin_fees() external onlyOwner {
        for (uint256 i = 0; i < N_COINS; i++) {
            if (coins[i] == NATIVE_ADDRESS) {
                balances[i] = address(this).balance;
            } else {
                balances[i] = IERC20(coins[i]).balanceOf(address(this));
            }
        }
        emit DonateAdminFees();
    }

    function kill_me() external onlyOwner {
        require(kill_deadline > block.timestamp, "Exceeded deadline");
        is_killed = true;
        emit Kill();
    }

    function unkill_me() external onlyOwner {
        is_killed = false;
        emit Unkill();
    }
}

File 41 of 43 : Token.sol
// Basic ERC20 token

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Token is ERC20 {
    uint8 private _decimals;

    constructor(
        uint256 _totalSupply,
        uint8 __decimals,
        string memory _name,
        string memory _symbol
    ) ERC20(_name, _symbol) {
        _decimals = __decimals;
        _mint(msg.sender, _totalSupply);
    }

    function decimals() public view virtual override returns (uint8) {
        return _decimals;
    }
}

File 42 of 43 : TransferLimit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {ITransferLimit} from "./ITransferLimit.sol";

/// @title TransferLimit
/// @author Cardinal Cryptography
/// @notice Implements a transfer limit based on pricing data from Chainlink oracles
contract TransferLimit is
    ITransferLimit,
    UUPSUpgradeable,
    Ownable2StepUpgradeable
{
    mapping(address => uint256) public defaultMinima;

    struct USDMinimum {
        AggregatorV3Interface oracle;
        uint256 limit;
    }

    mapping(address => USDMinimum) public usdMinima;

    function initialize(address owner) public initializer {
        __Ownable_init(owner);
    }

    function _authorizeUpgrade(
        address newImplementation
    ) internal override onlyOwner {}

    /// @notice Set the default minimum transfer amount for a token - this is used if no USD oracle is set
    /// @param _token The token address
    /// @param _limit The minimum transfer amount
    function setDefaultLimit(address _token, uint256 _limit) public onlyOwner {
        defaultMinima[_token] = _limit;
    }

    /// @notice Set the USD oracle params for a token
    /// @param _token The token address
    /// @param _tokenDecimals The number of decimals the token has
    /// @param _oracle The Chainlink oracle address
    /// @param _limit The minimum transfer amount in USD with no decimals
    function setUSDOracle(
        address _token,
        uint256 _tokenDecimals,
        AggregatorV3Interface _oracle,
        uint256 _limit
    ) public onlyOwner {
        usdMinima[_token] = USDMinimum({
            oracle: _oracle,
            limit: _limit * 10 ** (_tokenDecimals + _oracle.decimals())
        });
    }

    /// @notice Get the minimum transfer amount for a given token based on the current configuration
    /// @param _token The token address
    function minimumTransferAmount(
        address _token
    ) public view returns (uint256) {
        uint256 minimum = defaultMinima[_token];

        USDMinimum memory config = usdMinima[_token];
        if (config.limit > 0) {
            (, int usdPrice, , , ) = config.oracle.latestRoundData();
            uint256 usdBasedMinimum = config.limit / uint256(usdPrice);

            minimum = Math.min(minimum, usdBasedMinimum);
        }

        return minimum;
    }

    /// @notice Check if a transfer of a given amount of a token is allowed - currently only checks if the minimum is met
    /// @param _token The token address
    /// @param _amount The amount of the token
    function isRequestAllowed(
        address _token,
        uint256 _amount
    ) public view returns (bool) {
        return _amount >= minimumTransferAmount(_token);
    }
}

File 43 of 43 : WrappedToken.sol
// Wrapped representation of a remote PSP22 token that can be minted and burned

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

contract WrappedToken is ERC20, Ownable2Step {
    uint8 private _decimals;
    address public minterBurner;

    error NotMinter();
    error NotBurner();

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 __decimals,
        address _minter_burner
    ) ERC20(_name, _symbol) Ownable(msg.sender) {
        minterBurner = _minter_burner;
        _decimals = __decimals;
    }

    modifier onlyMinter() {
        if (msg.sender != minterBurner) {
            revert NotMinter();
        }
        _;
    }

    modifier onlyBurner() {
        if (msg.sender != minterBurner) {
            revert NotBurner();
        }
        _;
    }

    function mint(address _to, uint256 _amount) external onlyMinter {
        _mint(_to, _amount);
    }

    function burn(uint256 _amount) external onlyBurner {
        _burn(msg.sender, _amount);
    }

    function setMinterBurner(address _minter_burner) external onlyOwner {
        minterBurner = _minter_burner;
    }

    function decimals() public view virtual override returns (uint8) {
        return _decimals;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AzeroAddressNotSet","type":"error"},{"inputs":[],"name":"DataHashMismatch","type":"error"},{"inputs":[],"name":"DuplicateCommitteeMember","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"EthTransfer","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"LimitExceeded","type":"error"},{"inputs":[],"name":"NotEnoughGuardians","type":"error"},{"inputs":[],"name":"NotInCommittee","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"inputs":[],"name":"UnsupportedPair","type":"error"},{"inputs":[],"name":"UnwrappingEth","type":"error"},{"inputs":[],"name":"WrappingEth","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"ZeroSignatureTreshold","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newCommitteeId","type":"uint256"}],"name":"CommitteeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"committeeId","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"destTokenAddress","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"destReceiverAddress","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"requestNonce","type":"uint256"}],"name":"CrosschainTransferRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestHash","type":"bytes32"}],"name":"EthTransferFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"signer","type":"address"}],"name":"ProcessedRequestSigned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"signer","type":"address"}],"name":"RequestAlreadySigned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestHash","type":"bytes32"}],"name":"RequestProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"signer","type":"address"}],"name":"RequestSigned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestHash","type":"bytes32"}],"name":"TokenTransferFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"GAS_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"from","type":"bytes32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"bool","name":"isLocal","type":"bool"}],"name":"addPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"committeeId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"committeeId","type":"uint256"}],"name":"committeeSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"guardian","type":"address"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"hasSignedRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_committee","type":"address[]"},{"internalType":"uint256","name":"_signatureThreshold","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address payable","name":"_wethAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_committeeId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"isInCommittee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isLocalToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestHash","type":"bytes32"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"_committeeId","type":"uint256"}],"name":"needsSignature","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestHash","type":"bytes32"}],"name":"pendingRequests","outputs":[{"internalType":"uint256","name":"signatureCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestHash","type":"bytes32"}],"name":"processedRequests","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_requestHash","type":"bytes32"},{"internalType":"uint256","name":"_committeeId","type":"uint256"},{"internalType":"bytes32","name":"destTokenAddress","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"destReceiverAddress","type":"bytes32"},{"internalType":"uint256","name":"_requestNonce","type":"uint256"}],"name":"receiveRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"from","type":"bytes32"}],"name":"removePair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"srcTokenAddress","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"destReceiverAddress","type":"bytes32"}],"name":"sendRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"destReceiverAddress","type":"bytes32"}],"name":"sendRequestAzeroToNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"destReceiverAddress","type":"bytes32"}],"name":"sendRequestNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_committee","type":"address[]"},{"internalType":"uint256","name":"_signatureThreshold","type":"uint256"}],"name":"setCommittee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"token","type":"bytes32"},{"internalType":"bool","name":"isLocal","type":"bool"}],"name":"setLocalToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITransferLimit","name":"_transferLimit","type":"address"}],"name":"setTransferLimitContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wrappedAzeroAddress","type":"address"}],"name":"setWrappedAzeroAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"committeeId","type":"uint256"}],"name":"signatureThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"from","type":"bytes32"}],"name":"supportedPairs","outputs":[{"internalType":"bytes32","name":"to","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferLimit","outputs":[{"internalType":"contract ITransferLimit","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"wethAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wrappedAzeroAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a0604052306080523480156200001557600080fd5b506200002062000026565b620000da565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000775760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d75780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b60805161269b62000104600039600081816117130152818161173c015261187d015261269b6000f3fe6080604052600436106102335760003560e01c8063790f3a471161012e578063be4865ec116100ab578063e30c39781161006f578063e30c3978146106f7578063f20f51081461070c578063f2cda82e1461072c578063f2fde38b1461074c578063f94325171461076c57600080fd5b8063be4865ec14610647578063be8f909a14610667578063c1b4a1e314610687578063ce0fa5a9146106a7578063dfda7570146106d757600080fd5b80638da5cb5b116100f25780638da5cb5b1461055e578063905b502d14610573578063a6bec03f14610593578063a91e5554146105c0578063ad3cb1cc1461060957600080fd5b8063790f3a47146104d157806379ba5097146104f15780637a6c5fc4146105065780637c1a0302146105335780638456cb591461054957600080fd5b80632795ad20116101bc5780634f1ef286116101805780634f1ef2861461044f57806352d1902d146104625780635adcaa7c146104775780635c975abb14610497578063715018a6146104bc57600080fd5b80632795ad20146103b75780632ceb1b06146103e45780633f4ba83a146103fa57806341fbbb4b1461040f5780634f0e0ef31461042f57600080fd5b80630904bccd116102035780630904bccd14610313578063091d2788146103265780630a6fc2d21461034a5780631171bda91461036a57806316975d161461038a57600080fd5b8062dd78d3146102565780630252028a146102765780630439ad411461029657806307f61473146102d357600080fd5b36610251576002546001600160a01b0316331461024f57600080fd5b005b600080fd5b34801561026257600080fd5b5061024f61027136600461215b565b61078c565b34801561028257600080fd5b5061024f6102913660046121e0565b6107d6565b3480156102a257600080fd5b50600a546102b6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102df57600080fd5b506103036102ee366004612241565b60096020526000908152604090205460ff1681565b60405190151581526020016102ca565b61024f61032136600461225e565b610844565b34801561033257600080fd5b5061033c610dac81565b6040519081526020016102ca565b34801561035657600080fd5b50610303610365366004612277565b6109ea565b34801561037657600080fd5b5061024f6103853660046122a7565b610a4e565b34801561039657600080fd5b5061033c6103a536600461225e565b60086020526000908152604090205481565b3480156103c357600080fd5b5061033c6103d236600461225e565b60046020526000908152604090205481565b3480156103f057600080fd5b5061033c60015481565b34801561040657600080fd5b5061024f610a6f565b34801561041b57600080fd5b5061024f61042a36600461225e565b610a81565b34801561043b57600080fd5b506002546102b6906001600160a01b031681565b61024f61045d3660046122fe565b610aa2565b34801561046e57600080fd5b5061033c610ac1565b34801561048357600080fd5b5061024f6104923660046123c2565b610ade565b3480156104a357600080fd5b506000805160206126468339815191525460ff16610303565b3480156104c857600080fd5b5061024f610c20565b3480156104dd57600080fd5b5061024f6104ec3660046123e4565b610c28565b3480156104fd57600080fd5b5061024f610c63565b34801561051257600080fd5b5061033c61052136600461225e565b60036020526000908152604090205481565b34801561053f57600080fd5b5061033c60005481565b34801561055557600080fd5b5061024f610cb0565b34801561056a57600080fd5b506102b6610cc0565b34801561057f57600080fd5b5061024f61058e366004612241565b610cf5565b34801561059f57600080fd5b5061033c6105ae36600461225e565b60076020526000908152604090205481565b3480156105cc57600080fd5b506103036105db366004612409565b60009081526004602090815260408083206001600160a01b0394909416835260019093019052205460ff1690565b34801561061557600080fd5b5061063a604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516102ca9190612459565b34801561065357600080fd5b5061024f610662366004612241565b610d27565b34801561067357600080fd5b5061024f61068236600461248c565b610d51565b34801561069357600080fd5b5061024f6106a23660046124b8565b610eca565b3480156106b357600080fd5b506103036106c236600461225e565b60056020526000908152604090205460ff1681565b3480156106e357600080fd5b5061024f6106f236600461252c565b610ffa565b34801561070357600080fd5b506102b66111dc565b34801561071857600080fd5b5061030361072736600461256f565b611205565b34801561073857600080fd5b5061024f610747366004612409565b61127d565b34801561075857600080fd5b5061024f610767366004612241565b6112fe565b34801561077857600080fd5b50600b546102b6906001600160a01b031681565b610794611383565b61079c6113b5565b6000838152600360209081526040808320949094556001600160a01b03909416815260099093529120805460ff1916911515919091179055565b6107de611383565b6107e66113b5565b6001600081546107f590612596565b909155506108048383836113e5565b7fc87531a8794b7668ea5cd9c048cc263ca871d574d59447d962356dd34d5f8de760015460405161083791815260200190565b60405180910390a1505050565b61084c611577565b34600081900361086f57604051631f2a200560e01b815260040160405180910390fd5b8161088d5760405163d92e233d60e01b815260040160405180910390fd5b6002546001600160a01b0316600090815260036020526040812054908190036108c957604051634617192b60e01b815260040160405180910390fd5b6002546108df906001600160a01b0316836115a8565b60025460408051600481526024810182526020810180516001600160e01b0316630d0e30db60e41b17905290516000926001600160a01b031691859161092591906125bd565b60006040518083038185875af1925050503d8060008114610962576040519150601f19603f3d011682016040523d82523d6000602084013e610967565b606091505b505090508061098957604051631327200b60e11b815260040160405180910390fd5b83826001547ffdf694002d1fd250bd203ab8546c215351d1ca210decb2b29d4e4496dab885f3866000546040516109ca929190918252602082015260400190565b60405180910390a460008081546109e090612596565b9091555050505050565b6000600660008484604051602001610a1e92919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60408051808303601f190181529181528151602092830120835290820192909252016000205460ff169392505050565b610a56611383565b610a6a6001600160a01b0384168383611649565b505050565b610a77611383565b610a7f6116a8565b565b610a89611383565b610a916113b5565b600090815260036020526040812055565b610aaa611708565b610ab3826117ad565b610abd82826117b5565b5050565b6000610acb611872565b5060008051602061262683398151915290565b610ae6611577565b81600003610b0757604051631f2a200560e01b815260040160405180910390fd5b80610b255760405163d92e233d60e01b815260040160405180910390fd5b600a546001600160a01b0316610b4e5760405163076b6cfd60e21b815260040160405180910390fd5b600a54610b64906001600160a01b0316836115a8565b600a546001600160a01b0316610b7c813330866118bb565b600a54604051630852cd8d60e31b8152600481018590526001600160a01b039091169081906342966c6890602401600060405180830381600087803b158015610bc457600080fd5b505af1158015610bd8573d6000803e3d6000fd5b50505050826000801b6001547ffdf694002d1fd250bd203ab8546c215351d1ca210decb2b29d4e4496dab885f3876000546040516109ca929190918252602082015260400190565b610a7f611383565b610c30611383565b610c386113b5565b6001600160a01b03919091166000908152600960205260409020805460ff1916911515919091179055565b3380610c6d6111dc565b6001600160a01b031614610ca45760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610cad816118fa565b50565b610cb8611383565b610a7f611932565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b610cfd611383565b610d056113b5565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b610d2f611383565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b610d59611577565b81600003610d7a57604051631f2a200560e01b815260040160405180910390fd5b80610d985760405163d92e233d60e01b815260040160405180910390fd5b60008381526003602052604081205490819003610dc857604051634617192b60e01b815260040160405180910390fd5b83610dd381856115a8565b80610de96001600160a01b0382163330886118bb565b6001600160a01b03821660009081526009602052604090205460ff16610e6757604051630852cd8d60e31b81526004810186905282906001600160a01b038216906342966c6890602401600060405180830381600087803b158015610e4d57600080fd5b505af1158015610e61573d6000803e3d6000fd5b50505050505b83836001547ffdf694002d1fd250bd203ab8546c215351d1ca210decb2b29d4e4496dab885f388600054604051610ea8929190918252602082015260400190565b60405180910390a46000808154610ebe90612596565b90915550505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610f105750825b905060008267ffffffffffffffff166001148015610f2d5750303b155b905081158015610f3b575080155b15610f595760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610f8357845460ff60401b1916600160401b1785555b610f8f8a8a8a8961197b565b610f988761198f565b610fa06119a0565b610fa8611932565b8315610fee57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b611002611577565b8461100d81336109ea565b61102a576040516301cf71d360e71b815260040160405180910390fd5b60008781526005602052604090205460ff161561107e57604080518881523360208201527f663e7547ee89b163c8f15ccc1780c1097bb68e118283993865e5c86ceb23a312910160405180910390a16111d3565b6040805160208101889052908101869052606081018590526080810184905260a0810183905260009060c00160408051601f19818403018152918152815160209283012060008181526004845282812033825260018101909452919091205490925060ff161561112757604080518381523360208201527f3f37b0b66f16a593807ce9ff98d50f7ba28c565bc6c79dcebe230748a771b768910160405180910390a150506111d3565b8189146111475760405163c357a9e760e01b815260040160405180910390fd5b336000908152600182810160205260408220805460ff19169091179055815482919061117290612596565b90915550604080518381523360208201527f7356c99533fbaaf15c51aad6bd54bb9b2d540f55cc2b88ebbf4c5671e48c4f63910160405180910390a16000888152600860205260409020548154106111d0576111d0828888886119b0565b50505b50505050505050565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00610ce5565b600061121182846109ea565b61121d57506000611276565b60008481526005602052604090205460ff161561123c57506000611276565b60008481526004602090815260408083206001600160a01b038716845260010190915290205460ff161561127257506000611276565b5060015b9392505050565b611285611383565b6000826001600160a01b031682610dac90604051600060405180830381858888f193505050503d80600081146112d7576040519150601f19603f3d011682016040523d82523d6000602084013e6112dc565b606091505b5050905080610a6a576040516302a06efb60e11b815260040160405180910390fd5b611306611383565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b038316908117825561134a610cc0565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b3361138c610cc0565b6001600160a01b031614610a7f5760405163118cdaa760e01b8152336004820152602401610c9b565b6000805160206126468339815191525460ff16610a7f57604051638dfc202b60e01b815260040160405180910390fd5b8060000361140657604051633cc3e58160e21b815260040160405180910390fd5b8082101561142757604051636bb07db960e11b815260040160405180910390fd5b60005b8281101561154c576000848483818110611446576114466125d9565b905060200201602081019061145b9190612241565b6001600160a01b0316036114825760405163d92e233d60e01b815260040160405180910390fd5b6000600154858584818110611499576114996125d9565b90506020020160208101906114ae9190612241565b6040516020016114da92919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60408051601f1981840301815291815281516020928301206000818152600690935291205490915060ff16156115235760405163120e00c960e01b815260040160405180910390fd5b6000908152600660205260409020805460ff1916600117905561154581612596565b905061142a565b5060018054600090815260076020908152604080832095909555915481526008909152919091205550565b6000805160206126468339815191525460ff1615610a7f5760405163d93c066560e01b815260040160405180910390fd5b600b546001600160a01b031615610abd57600b5460405163dc7f974360e01b81526001600160a01b038481166004830152602482018490529091169063dc7f974390604401602060405180830381865afa925050508015611626575060408051601f3d908101601f19168201909252611623918101906125ef565b60015b15610abd5780610a6a57604051631930e3c960e11b815260040160405180910390fd5b6040516001600160a01b03838116602483015260448201839052610a6a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611c4b565b6116b06113b5565b600080516020612646833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061178f57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611783600080516020612626833981519152546001600160a01b031690565b6001600160a01b031614155b15610a7f5760405163703e46dd60e11b815260040160405180910390fd5b610cad611383565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561180f575060408051601f3d908101601f1916820190925261180c9181019061260c565b60015b61183757604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610c9b565b600080516020612626833981519152811461186857604051632a87526960e21b815260048101829052602401610c9b565b610a6a8383611cae565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a7f5760405163703e46dd60e11b815260040160405180910390fd5b6040516001600160a01b0384811660248301528381166044830152606482018390526118f49186918216906323b872dd90608401611676565b50505050565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319168155610abd82611d04565b61193a611577565b600080516020612646833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336116ea565b611983611d75565b6118f484848484611dbe565b611997611d75565b610cad81611df4565b6119a8611d75565b610a7f611e26565b6000848152600560209081526040808320805460ff19166001179055600490915281208190556119dd8490565b9050816001600160a01b038216611b3f57600254604051602481018690526000916001600160a01b03169060440160408051601f198184030181529181526020820180516001600160e01b0316632e1a7d4d60e01b17905251611a4091906125bd565b6000604051808303816000865af19150503d8060008114611a7d576040519150601f19603f3d011682016040523d82523d6000602084013e611a82565b606091505b5050905080611aa457604051635140f6bf60e11b815260040160405180910390fd5b6000826001600160a01b031686610dac90604051600060405180830381858888f193505050503d8060008114611af6576040519150601f19603f3d011682016040523d82523d6000602084013e611afb565b606091505b5050905080611b38576040518881527fc8474031e7695217dfb277d2c9b53316979ff23d2b0a1d002e277510971be3c09060200160405180910390a15b5050611c10565b6001600160a01b03821660009081526009602052604090205460ff16611bca576040516340c10f1960e01b81526001600160a01b038281166004830152602482018690528391908216906340c10f1990604401600060405180830381600087803b158015611bac57600080fd5b505af1158015611bc0573d6000803e3d6000fd5b5050505050611c10565b81611bd6818387611e47565b611c0e576040518781527fe8c367fc923e93a5b6174b9e709e10ae2113089a40621f67c5da23e001ff50e09060200160405180910390a15b505b6040518681527fed6b6ea75ec116db755ad82449230664750da9104c4450d6cd078879a65aed8e9060200160405180910390a1505050505050565b6000611c606001600160a01b03841683611f31565b90508051600014158015611c85575080806020019051810190611c8391906125ef565b155b15610a6a57604051635274afe760e01b81526001600160a01b0384166004820152602401610c9b565b611cb782611f3f565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115611cfc57610a6a8282611fa4565b610abd61201a565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610a7f57604051631afcd79f60e31b815260040160405180910390fd5b611dc6611d75565b6000808055600155600280546001600160a01b0319166001600160a01b0383161790556118f48484846113e5565b611dfc611d75565b6001600160a01b038116610ca457604051631e4fbdf760e01b815260006004820152602401610c9b565b611e2e611d75565b600080516020612646833981519152805460ff19169055565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392839291881691611ea591906125bd565b6000604051808303816000865af19150503d8060008114611ee2576040519150601f19603f3d011682016040523d82523d6000602084013e611ee7565b606091505b5091509150818015611f11575080511580611f11575080806020019051810190611f1191906125ef565b8015611f2757506000866001600160a01b03163b115b9695505050505050565b606061127683836000612039565b806001600160a01b03163b600003611f7557604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610c9b565b60008051602061262683398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051611fc191906125bd565b600060405180830381855af49150503d8060008114611ffc576040519150601f19603f3d011682016040523d82523d6000602084013e612001565b606091505b50915091506120118583836120c8565b95945050505050565b3415610a7f5760405163b398979f60e01b815260040160405180910390fd5b60608147101561205e5760405163cd78605960e01b8152306004820152602401610c9b565b600080856001600160a01b0316848660405161207a91906125bd565b60006040518083038185875af1925050503d80600081146120b7576040519150601f19603f3d011682016040523d82523d6000602084013e6120bc565b606091505b5091509150611f278683835b6060826120dd576120d882612124565b611276565b81511580156120f457506001600160a01b0384163b155b1561211d57604051639996b31560e01b81526001600160a01b0385166004820152602401610c9b565b5080611276565b8051156121345780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b8015158114610cad57600080fd5b60008060006060848603121561217057600080fd5b833592506020840135915060408401356121898161214d565b809150509250925092565b60008083601f8401126121a657600080fd5b50813567ffffffffffffffff8111156121be57600080fd5b6020830191508360208260051b85010111156121d957600080fd5b9250929050565b6000806000604084860312156121f557600080fd5b833567ffffffffffffffff81111561220c57600080fd5b61221886828701612194565b909790965060209590950135949350505050565b6001600160a01b0381168114610cad57600080fd5b60006020828403121561225357600080fd5b81356112768161222c565b60006020828403121561227057600080fd5b5035919050565b6000806040838503121561228a57600080fd5b82359150602083013561229c8161222c565b809150509250929050565b6000806000606084860312156122bc57600080fd5b83356122c78161222c565b925060208401356122d78161222c565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561231157600080fd5b823561231c8161222c565b9150602083013567ffffffffffffffff8082111561233957600080fd5b818501915085601f83011261234d57600080fd5b81358181111561235f5761235f6122e8565b604051601f8201601f19908116603f01168101908382118183101715612387576123876122e8565b816040528281528860208487010111156123a057600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080604083850312156123d557600080fd5b50508035926020909101359150565b600080604083850312156123f757600080fd5b82359150602083013561229c8161214d565b6000806040838503121561241c57600080fd5b82356124278161222c565b946020939093013593505050565b60005b83811015612450578181015183820152602001612438565b50506000910152565b6020815260008251806020840152612478816040850160208701612435565b601f01601f19169190910160400192915050565b6000806000606084860312156124a157600080fd5b505081359360208301359350604090920135919050565b6000806000806000608086880312156124d057600080fd5b853567ffffffffffffffff8111156124e757600080fd5b6124f388828901612194565b90965094505060208601359250604086013561250e8161222c565b9150606086013561251e8161222c565b809150509295509295909350565b60008060008060008060c0878903121561254557600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b60008060006060848603121561258457600080fd5b8335925060208401356122d78161222c565b6000600182016125b657634e487b7160e01b600052601160045260246000fd5b5060010190565b600082516125cf818460208701612435565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561260157600080fd5b81516112768161214d565b60006020828403121561261e57600080fd5b505191905056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbccd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a26469706673582212209838e950c870b1d66c3069978a87d1502fecedec9f5f5a6628fcbac1a01af41b64736f6c63430008140033

Deployed Bytecode

0x6080604052600436106102335760003560e01c8063790f3a471161012e578063be4865ec116100ab578063e30c39781161006f578063e30c3978146106f7578063f20f51081461070c578063f2cda82e1461072c578063f2fde38b1461074c578063f94325171461076c57600080fd5b8063be4865ec14610647578063be8f909a14610667578063c1b4a1e314610687578063ce0fa5a9146106a7578063dfda7570146106d757600080fd5b80638da5cb5b116100f25780638da5cb5b1461055e578063905b502d14610573578063a6bec03f14610593578063a91e5554146105c0578063ad3cb1cc1461060957600080fd5b8063790f3a47146104d157806379ba5097146104f15780637a6c5fc4146105065780637c1a0302146105335780638456cb591461054957600080fd5b80632795ad20116101bc5780634f1ef286116101805780634f1ef2861461044f57806352d1902d146104625780635adcaa7c146104775780635c975abb14610497578063715018a6146104bc57600080fd5b80632795ad20146103b75780632ceb1b06146103e45780633f4ba83a146103fa57806341fbbb4b1461040f5780634f0e0ef31461042f57600080fd5b80630904bccd116102035780630904bccd14610313578063091d2788146103265780630a6fc2d21461034a5780631171bda91461036a57806316975d161461038a57600080fd5b8062dd78d3146102565780630252028a146102765780630439ad411461029657806307f61473146102d357600080fd5b36610251576002546001600160a01b0316331461024f57600080fd5b005b600080fd5b34801561026257600080fd5b5061024f61027136600461215b565b61078c565b34801561028257600080fd5b5061024f6102913660046121e0565b6107d6565b3480156102a257600080fd5b50600a546102b6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102df57600080fd5b506103036102ee366004612241565b60096020526000908152604090205460ff1681565b60405190151581526020016102ca565b61024f61032136600461225e565b610844565b34801561033257600080fd5b5061033c610dac81565b6040519081526020016102ca565b34801561035657600080fd5b50610303610365366004612277565b6109ea565b34801561037657600080fd5b5061024f6103853660046122a7565b610a4e565b34801561039657600080fd5b5061033c6103a536600461225e565b60086020526000908152604090205481565b3480156103c357600080fd5b5061033c6103d236600461225e565b60046020526000908152604090205481565b3480156103f057600080fd5b5061033c60015481565b34801561040657600080fd5b5061024f610a6f565b34801561041b57600080fd5b5061024f61042a36600461225e565b610a81565b34801561043b57600080fd5b506002546102b6906001600160a01b031681565b61024f61045d3660046122fe565b610aa2565b34801561046e57600080fd5b5061033c610ac1565b34801561048357600080fd5b5061024f6104923660046123c2565b610ade565b3480156104a357600080fd5b506000805160206126468339815191525460ff16610303565b3480156104c857600080fd5b5061024f610c20565b3480156104dd57600080fd5b5061024f6104ec3660046123e4565b610c28565b3480156104fd57600080fd5b5061024f610c63565b34801561051257600080fd5b5061033c61052136600461225e565b60036020526000908152604090205481565b34801561053f57600080fd5b5061033c60005481565b34801561055557600080fd5b5061024f610cb0565b34801561056a57600080fd5b506102b6610cc0565b34801561057f57600080fd5b5061024f61058e366004612241565b610cf5565b34801561059f57600080fd5b5061033c6105ae36600461225e565b60076020526000908152604090205481565b3480156105cc57600080fd5b506103036105db366004612409565b60009081526004602090815260408083206001600160a01b0394909416835260019093019052205460ff1690565b34801561061557600080fd5b5061063a604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516102ca9190612459565b34801561065357600080fd5b5061024f610662366004612241565b610d27565b34801561067357600080fd5b5061024f61068236600461248c565b610d51565b34801561069357600080fd5b5061024f6106a23660046124b8565b610eca565b3480156106b357600080fd5b506103036106c236600461225e565b60056020526000908152604090205460ff1681565b3480156106e357600080fd5b5061024f6106f236600461252c565b610ffa565b34801561070357600080fd5b506102b66111dc565b34801561071857600080fd5b5061030361072736600461256f565b611205565b34801561073857600080fd5b5061024f610747366004612409565b61127d565b34801561075857600080fd5b5061024f610767366004612241565b6112fe565b34801561077857600080fd5b50600b546102b6906001600160a01b031681565b610794611383565b61079c6113b5565b6000838152600360209081526040808320949094556001600160a01b03909416815260099093529120805460ff1916911515919091179055565b6107de611383565b6107e66113b5565b6001600081546107f590612596565b909155506108048383836113e5565b7fc87531a8794b7668ea5cd9c048cc263ca871d574d59447d962356dd34d5f8de760015460405161083791815260200190565b60405180910390a1505050565b61084c611577565b34600081900361086f57604051631f2a200560e01b815260040160405180910390fd5b8161088d5760405163d92e233d60e01b815260040160405180910390fd5b6002546001600160a01b0316600090815260036020526040812054908190036108c957604051634617192b60e01b815260040160405180910390fd5b6002546108df906001600160a01b0316836115a8565b60025460408051600481526024810182526020810180516001600160e01b0316630d0e30db60e41b17905290516000926001600160a01b031691859161092591906125bd565b60006040518083038185875af1925050503d8060008114610962576040519150601f19603f3d011682016040523d82523d6000602084013e610967565b606091505b505090508061098957604051631327200b60e11b815260040160405180910390fd5b83826001547ffdf694002d1fd250bd203ab8546c215351d1ca210decb2b29d4e4496dab885f3866000546040516109ca929190918252602082015260400190565b60405180910390a460008081546109e090612596565b9091555050505050565b6000600660008484604051602001610a1e92919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60408051808303601f190181529181528151602092830120835290820192909252016000205460ff169392505050565b610a56611383565b610a6a6001600160a01b0384168383611649565b505050565b610a77611383565b610a7f6116a8565b565b610a89611383565b610a916113b5565b600090815260036020526040812055565b610aaa611708565b610ab3826117ad565b610abd82826117b5565b5050565b6000610acb611872565b5060008051602061262683398151915290565b610ae6611577565b81600003610b0757604051631f2a200560e01b815260040160405180910390fd5b80610b255760405163d92e233d60e01b815260040160405180910390fd5b600a546001600160a01b0316610b4e5760405163076b6cfd60e21b815260040160405180910390fd5b600a54610b64906001600160a01b0316836115a8565b600a546001600160a01b0316610b7c813330866118bb565b600a54604051630852cd8d60e31b8152600481018590526001600160a01b039091169081906342966c6890602401600060405180830381600087803b158015610bc457600080fd5b505af1158015610bd8573d6000803e3d6000fd5b50505050826000801b6001547ffdf694002d1fd250bd203ab8546c215351d1ca210decb2b29d4e4496dab885f3876000546040516109ca929190918252602082015260400190565b610a7f611383565b610c30611383565b610c386113b5565b6001600160a01b03919091166000908152600960205260409020805460ff1916911515919091179055565b3380610c6d6111dc565b6001600160a01b031614610ca45760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610cad816118fa565b50565b610cb8611383565b610a7f611932565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b610cfd611383565b610d056113b5565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b610d2f611383565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b610d59611577565b81600003610d7a57604051631f2a200560e01b815260040160405180910390fd5b80610d985760405163d92e233d60e01b815260040160405180910390fd5b60008381526003602052604081205490819003610dc857604051634617192b60e01b815260040160405180910390fd5b83610dd381856115a8565b80610de96001600160a01b0382163330886118bb565b6001600160a01b03821660009081526009602052604090205460ff16610e6757604051630852cd8d60e31b81526004810186905282906001600160a01b038216906342966c6890602401600060405180830381600087803b158015610e4d57600080fd5b505af1158015610e61573d6000803e3d6000fd5b50505050505b83836001547ffdf694002d1fd250bd203ab8546c215351d1ca210decb2b29d4e4496dab885f388600054604051610ea8929190918252602082015260400190565b60405180910390a46000808154610ebe90612596565b90915550505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610f105750825b905060008267ffffffffffffffff166001148015610f2d5750303b155b905081158015610f3b575080155b15610f595760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610f8357845460ff60401b1916600160401b1785555b610f8f8a8a8a8961197b565b610f988761198f565b610fa06119a0565b610fa8611932565b8315610fee57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b611002611577565b8461100d81336109ea565b61102a576040516301cf71d360e71b815260040160405180910390fd5b60008781526005602052604090205460ff161561107e57604080518881523360208201527f663e7547ee89b163c8f15ccc1780c1097bb68e118283993865e5c86ceb23a312910160405180910390a16111d3565b6040805160208101889052908101869052606081018590526080810184905260a0810183905260009060c00160408051601f19818403018152918152815160209283012060008181526004845282812033825260018101909452919091205490925060ff161561112757604080518381523360208201527f3f37b0b66f16a593807ce9ff98d50f7ba28c565bc6c79dcebe230748a771b768910160405180910390a150506111d3565b8189146111475760405163c357a9e760e01b815260040160405180910390fd5b336000908152600182810160205260408220805460ff19169091179055815482919061117290612596565b90915550604080518381523360208201527f7356c99533fbaaf15c51aad6bd54bb9b2d540f55cc2b88ebbf4c5671e48c4f63910160405180910390a16000888152600860205260409020548154106111d0576111d0828888886119b0565b50505b50505050505050565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00610ce5565b600061121182846109ea565b61121d57506000611276565b60008481526005602052604090205460ff161561123c57506000611276565b60008481526004602090815260408083206001600160a01b038716845260010190915290205460ff161561127257506000611276565b5060015b9392505050565b611285611383565b6000826001600160a01b031682610dac90604051600060405180830381858888f193505050503d80600081146112d7576040519150601f19603f3d011682016040523d82523d6000602084013e6112dc565b606091505b5050905080610a6a576040516302a06efb60e11b815260040160405180910390fd5b611306611383565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b038316908117825561134a610cc0565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b3361138c610cc0565b6001600160a01b031614610a7f5760405163118cdaa760e01b8152336004820152602401610c9b565b6000805160206126468339815191525460ff16610a7f57604051638dfc202b60e01b815260040160405180910390fd5b8060000361140657604051633cc3e58160e21b815260040160405180910390fd5b8082101561142757604051636bb07db960e11b815260040160405180910390fd5b60005b8281101561154c576000848483818110611446576114466125d9565b905060200201602081019061145b9190612241565b6001600160a01b0316036114825760405163d92e233d60e01b815260040160405180910390fd5b6000600154858584818110611499576114996125d9565b90506020020160208101906114ae9190612241565b6040516020016114da92919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60408051601f1981840301815291815281516020928301206000818152600690935291205490915060ff16156115235760405163120e00c960e01b815260040160405180910390fd5b6000908152600660205260409020805460ff1916600117905561154581612596565b905061142a565b5060018054600090815260076020908152604080832095909555915481526008909152919091205550565b6000805160206126468339815191525460ff1615610a7f5760405163d93c066560e01b815260040160405180910390fd5b600b546001600160a01b031615610abd57600b5460405163dc7f974360e01b81526001600160a01b038481166004830152602482018490529091169063dc7f974390604401602060405180830381865afa925050508015611626575060408051601f3d908101601f19168201909252611623918101906125ef565b60015b15610abd5780610a6a57604051631930e3c960e11b815260040160405180910390fd5b6040516001600160a01b03838116602483015260448201839052610a6a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611c4b565b6116b06113b5565b600080516020612646833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b306001600160a01b037f00000000000000000000000049643fc85fb1f25b6775ebbbdc69295d45105abc16148061178f57507f00000000000000000000000049643fc85fb1f25b6775ebbbdc69295d45105abc6001600160a01b0316611783600080516020612626833981519152546001600160a01b031690565b6001600160a01b031614155b15610a7f5760405163703e46dd60e11b815260040160405180910390fd5b610cad611383565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561180f575060408051601f3d908101601f1916820190925261180c9181019061260c565b60015b61183757604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610c9b565b600080516020612626833981519152811461186857604051632a87526960e21b815260048101829052602401610c9b565b610a6a8383611cae565b306001600160a01b037f00000000000000000000000049643fc85fb1f25b6775ebbbdc69295d45105abc1614610a7f5760405163703e46dd60e11b815260040160405180910390fd5b6040516001600160a01b0384811660248301528381166044830152606482018390526118f49186918216906323b872dd90608401611676565b50505050565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319168155610abd82611d04565b61193a611577565b600080516020612646833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336116ea565b611983611d75565b6118f484848484611dbe565b611997611d75565b610cad81611df4565b6119a8611d75565b610a7f611e26565b6000848152600560209081526040808320805460ff19166001179055600490915281208190556119dd8490565b9050816001600160a01b038216611b3f57600254604051602481018690526000916001600160a01b03169060440160408051601f198184030181529181526020820180516001600160e01b0316632e1a7d4d60e01b17905251611a4091906125bd565b6000604051808303816000865af19150503d8060008114611a7d576040519150601f19603f3d011682016040523d82523d6000602084013e611a82565b606091505b5050905080611aa457604051635140f6bf60e11b815260040160405180910390fd5b6000826001600160a01b031686610dac90604051600060405180830381858888f193505050503d8060008114611af6576040519150601f19603f3d011682016040523d82523d6000602084013e611afb565b606091505b5050905080611b38576040518881527fc8474031e7695217dfb277d2c9b53316979ff23d2b0a1d002e277510971be3c09060200160405180910390a15b5050611c10565b6001600160a01b03821660009081526009602052604090205460ff16611bca576040516340c10f1960e01b81526001600160a01b038281166004830152602482018690528391908216906340c10f1990604401600060405180830381600087803b158015611bac57600080fd5b505af1158015611bc0573d6000803e3d6000fd5b5050505050611c10565b81611bd6818387611e47565b611c0e576040518781527fe8c367fc923e93a5b6174b9e709e10ae2113089a40621f67c5da23e001ff50e09060200160405180910390a15b505b6040518681527fed6b6ea75ec116db755ad82449230664750da9104c4450d6cd078879a65aed8e9060200160405180910390a1505050505050565b6000611c606001600160a01b03841683611f31565b90508051600014158015611c85575080806020019051810190611c8391906125ef565b155b15610a6a57604051635274afe760e01b81526001600160a01b0384166004820152602401610c9b565b611cb782611f3f565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115611cfc57610a6a8282611fa4565b610abd61201a565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610a7f57604051631afcd79f60e31b815260040160405180910390fd5b611dc6611d75565b6000808055600155600280546001600160a01b0319166001600160a01b0383161790556118f48484846113e5565b611dfc611d75565b6001600160a01b038116610ca457604051631e4fbdf760e01b815260006004820152602401610c9b565b611e2e611d75565b600080516020612646833981519152805460ff19169055565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392839291881691611ea591906125bd565b6000604051808303816000865af19150503d8060008114611ee2576040519150601f19603f3d011682016040523d82523d6000602084013e611ee7565b606091505b5091509150818015611f11575080511580611f11575080806020019051810190611f1191906125ef565b8015611f2757506000866001600160a01b03163b115b9695505050505050565b606061127683836000612039565b806001600160a01b03163b600003611f7557604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610c9b565b60008051602061262683398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051611fc191906125bd565b600060405180830381855af49150503d8060008114611ffc576040519150601f19603f3d011682016040523d82523d6000602084013e612001565b606091505b50915091506120118583836120c8565b95945050505050565b3415610a7f5760405163b398979f60e01b815260040160405180910390fd5b60608147101561205e5760405163cd78605960e01b8152306004820152602401610c9b565b600080856001600160a01b0316848660405161207a91906125bd565b60006040518083038185875af1925050503d80600081146120b7576040519150601f19603f3d011682016040523d82523d6000602084013e6120bc565b606091505b5091509150611f278683835b6060826120dd576120d882612124565b611276565b81511580156120f457506001600160a01b0384163b155b1561211d57604051639996b31560e01b81526001600160a01b0385166004820152602401610c9b565b5080611276565b8051156121345780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b8015158114610cad57600080fd5b60008060006060848603121561217057600080fd5b833592506020840135915060408401356121898161214d565b809150509250925092565b60008083601f8401126121a657600080fd5b50813567ffffffffffffffff8111156121be57600080fd5b6020830191508360208260051b85010111156121d957600080fd5b9250929050565b6000806000604084860312156121f557600080fd5b833567ffffffffffffffff81111561220c57600080fd5b61221886828701612194565b909790965060209590950135949350505050565b6001600160a01b0381168114610cad57600080fd5b60006020828403121561225357600080fd5b81356112768161222c565b60006020828403121561227057600080fd5b5035919050565b6000806040838503121561228a57600080fd5b82359150602083013561229c8161222c565b809150509250929050565b6000806000606084860312156122bc57600080fd5b83356122c78161222c565b925060208401356122d78161222c565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561231157600080fd5b823561231c8161222c565b9150602083013567ffffffffffffffff8082111561233957600080fd5b818501915085601f83011261234d57600080fd5b81358181111561235f5761235f6122e8565b604051601f8201601f19908116603f01168101908382118183101715612387576123876122e8565b816040528281528860208487010111156123a057600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080604083850312156123d557600080fd5b50508035926020909101359150565b600080604083850312156123f757600080fd5b82359150602083013561229c8161214d565b6000806040838503121561241c57600080fd5b82356124278161222c565b946020939093013593505050565b60005b83811015612450578181015183820152602001612438565b50506000910152565b6020815260008251806020840152612478816040850160208701612435565b601f01601f19169190910160400192915050565b6000806000606084860312156124a157600080fd5b505081359360208301359350604090920135919050565b6000806000806000608086880312156124d057600080fd5b853567ffffffffffffffff8111156124e757600080fd5b6124f388828901612194565b90965094505060208601359250604086013561250e8161222c565b9150606086013561251e8161222c565b809150509295509295909350565b60008060008060008060c0878903121561254557600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b60008060006060848603121561258457600080fd5b8335925060208401356122d78161222c565b6000600182016125b657634e487b7160e01b600052601160045260246000fd5b5060010190565b600082516125cf818460208701612435565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561260157600080fd5b81516112768161214d565b60006020828403121561261e57600080fd5b505191905056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbccd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a26469706673582212209838e950c870b1d66c3069978a87d1502fecedec9f5f5a6628fcbac1a01af41b64736f6c63430008140033

Deployed Bytecode Sourcemap

212:1222:35:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15218:11:30;;-1:-1:-1;;;;;15218:11:30;15204:10;:25;15196:34;;;;;;212:1222:35;;;;;12925:223:30;;;;;;;;;;-1:-1:-1;12925:223:30;;;;;:::i;:::-;;:::i;12484:264::-;;;;;;;;;;-1:-1:-1;12484:264:30;;;;;:::i;:::-;;:::i;1802:34::-;;;;;;;;;;-1:-1:-1;1802:34:30;;;;-1:-1:-1;;;;;1802:34:30;;;;;;-1:-1:-1;;;;;1565:32:43;;;1547:51;;1535:2;1520:18;1802:34:30;;;;;;;;1751:44;;;;;;;;;;-1:-1:-1;1751:44:30;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2162:14:43;;2155:22;2137:41;;2125:2;2110:18;1751:44:30;1997:187:43;6748:861:30;;;;;;:::i;:::-;;:::i;1100:40::-;;;;;;;;;;;;1136:4;1100:40;;;;;2520:25:43;;;2508:2;2493:18;1100:40:30;2374:177:43;14059:196:30;;;;;;;;;;-1:-1:-1;14059:196:30;;;;;:::i;:::-;;:::i;12081:169::-;;;;;;;;;;-1:-1:-1;12081:169:30;;;;;:::i;:::-;;:::i;1680:65::-;;;;;;;;;;-1:-1:-1;1680:65:30;;;;;:::i;:::-;;;;;;;;;;;;;;1316:62;;;;;;;;;;-1:-1:-1;1316:62:30;;;;;:::i;:::-;;;;;;;;;;;;;;1180:26;;;;;;;;;;;;;;;;12010:65;;;;;;;;;;;;;:::i;13328:108::-;;;;;;;;;;-1:-1:-1;13328:108:30;;;;;:::i;:::-;;:::i;1212:34::-;;;;;;;;;;-1:-1:-1;1212:34:30;;;;-1:-1:-1;;;;;1212:34:30;;;4158:214:12;;;;;;:::i;:::-;;:::i;3705:134::-;;;;;;;;;;;;;:::i;7615:827:30:-;;;;;;;;;;-1:-1:-1;7615:827:30;;;;;:::i;:::-;;:::i;2692:145:14:-;;;;;;;;;;-1:-1:-1;;;;;;;;;;;;2821:9:14;;;2692:145;;4034:65:30;;;;;;;;;;;;;:::i;13154:168::-;;;;;;;;;;-1:-1:-1;13154:168:30;;;;;:::i;:::-;;:::i;2774:229:9:-;;;;;;;;;;;;;:::i;1253:57:30:-;;;;;;;;;;-1:-1:-1;1253:57:30;;;;;:::i;:::-;;;;;;;;;;;;;;1147:27;;;;;;;;;;;;;;;;11943:61;;;;;;;;;;;;;:::i;2441:144:10:-;;;;;;;;;;;;;:::i;12754:165:30:-;;;;;;;;;;-1:-1:-1;12754:165:30;;;;;:::i;:::-;;:::i;1614:60::-;;;;;;;;;;-1:-1:-1;1614:60:30;;;;;:::i;:::-;;;;;;;;;;;;;;13442:173;;;;;;;;;;-1:-1:-1;13442:173:30;;;;;:::i;:::-;13543:4;13566:21;;;:15;:21;;;;;;;;-1:-1:-1;;;;;13566:42:30;;;;;;:32;;;;:42;;;;;;;13442:173;1819:58:12;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;1819:58:12;;;;;;;;;;;;:::i;402:145:35:-;;;;;;;;;;-1:-1:-1;402:145:35;;;;;:::i;:::-;;:::i;5338:1110:30:-;;;;;;;;;;-1:-1:-1;5338:1110:30;;;;;:::i;:::-;;:::i;553:342:35:-;;;;;;;;;;-1:-1:-1;553:342:35;;;;;:::i;:::-;;:::i;1384:61:30:-;;;;;;;;;;-1:-1:-1;1384:61:30;;;;;:::i;:::-;;;;;;;;;;;;;;;;10446:1491;;;;;;;;;;-1:-1:-1;10446:1491:30;;;;;:::i;:::-;;:::i;1680:168:9:-;;;;;;;;;;;;;:::i;13621:432:30:-;;;;;;;;;;-1:-1:-1;13621:432:30;;;;;:::i;:::-;;:::i;12256:222::-;;;;;;;;;;-1:-1:-1;12256:222:30;;;;;:::i;:::-;;:::i;2041:247:9:-;;;;;;;;;;-1:-1:-1;2041:247:9;;;;;:::i;:::-;;:::i;248:35:35:-;;;;;;;;;;-1:-1:-1;248:35:35;;;;-1:-1:-1;;;;;248:35:35;;;12925:223:30;2334:13:10;:11;:13::i;:::-;2563:16:14::1;:14;:16::i;:::-;13060:20:30::2;::::0;;;:14:::2;:20;::::0;;;;;;;:25;;;;-1:-1:-1;;;;;13095:36:30;;::::2;::::0;;:12:::2;:36:::0;;;;;:46;;-1:-1:-1;;13095:46:30::2;::::0;::::2;;::::0;;;::::2;::::0;;12925:223::o;12484:264::-;2334:13:10;:11;:13::i;:::-;2563:16:14::1;:14;:16::i;:::-;12630:11:30::2;;12628:13;;;;;:::i;:::-;::::0;;;-1:-1:-1;12651:46:30::2;12665:10:::0;;12677:19;12651:13:::2;:46::i;:::-;12712:29;12729:11;;12712:29;;;;2520:25:43::0;;2508:2;2493:18;;2374:177;12712:29:30::2;;;;;;;;12484:264:::0;;;:::o;6748:861::-;2316:19:14;:17;:19::i;:::-;6884:9:30::1;6867:14;6907:11:::0;;;6903:36:::1;;6927:12;;-1:-1:-1::0;;;6927:12:30::1;;;;;;;;;;;6903:36;6953:19:::0;6949:59:::1;;6995:13;;-1:-1:-1::0;;;6995:13:30::1;;;;;;;;;;;6949:59;7091:11;::::0;-1:-1:-1;;;;;7091:11:30::1;7019:24;7046:67:::0;;;:14:::1;:67;::::0;;;;;;7128:23;;;7124:53:::1;;7160:17;;-1:-1:-1::0;;;7160:17:30::1;;;;;;;;;;;7124:53;7208:11;::::0;7187:41:::1;::::0;-1:-1:-1;;;;;7208:11:30::1;7221:6:::0;7187:20:::1;:41::i;:::-;7258:11;::::0;7303:34:::1;::::0;;;;;::::1;::::0;::::1;::::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;;;;;7303:34:30::1;-1:-1:-1::0;;;7303:34:30::1;::::0;;7258:89;;7240:12:::1;::::0;-1:-1:-1;;;;;7258:11:30::1;::::0;7282:6;;7258:89:::1;::::0;7303:34;7258:89:::1;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7239:108;;;7363:7;7358:34;;7379:13;;-1:-1:-1::0;;;7379:13:30::1;;;;;;;;;;;7358:34;7522:19;7472:16;7447:11;;7408:169;7502:6;7555:12;;7408:169;;;;;;10233:25:43::0;;;10289:2;10274:18;;10267:34;10221:2;10206:18;;10059:248;7408:169:30::1;;;;;;;;7590:12;::::0;7588:14:::1;;;;;:::i;:::-;::::0;;;-1:-1:-1;;;;;6748:861:30:o;14059:196::-;14164:4;14187:9;:61;14224:12;14238:7;14207:39;;;;;;;;10469:19:43;;;10526:2;10522:15;-1:-1:-1;;10518:53:43;10513:2;10504:12;;10497:75;10597:2;10588:12;;10312:294;14207:39:30;;;;;;;-1:-1:-1;;14207:39:30;;;;;;14197:50;;14207:39;14197:50;;;;14187:61;;;;;;;;;;-1:-1:-1;14187:61:30;;;;;14059:196;-1:-1:-1;;;14059:196:30:o;12081:169::-;2334:13:10;:11;:13::i;:::-;12205:38:30::1;-1:-1:-1::0;;;;;12205:26:30;::::1;12232:2:::0;12236:6;12205:26:::1;:38::i;:::-;12081:169:::0;;;:::o;12010:65::-;2334:13:10;:11;:13::i;:::-;12058:10:30::1;:8;:10::i;:::-;12010:65::o:0;13328:108::-;2334:13:10;:11;:13::i;:::-;2563:16:14::1;:14;:16::i;:::-;13409:20:30::2;::::0;;;:14:::2;:20;::::0;;;;13402:27;13328:108::o;4158:214:12:-;2653:13;:11;:13::i;:::-;4273:36:::1;4291:17;4273;:36::i;:::-;4319:46;4341:17;4360:4;4319:21;:46::i;:::-;4158:214:::0;;:::o;3705:134::-;3774:7;2924:20;:18;:20::i;:::-;-1:-1:-1;;;;;;;;;;;;3705:134:12;:::o;7615:827:30:-;2316:19:14;:17;:19::i;:::-;7761:6:30::1;7771:1;7761:11:::0;7757:36:::1;;7781:12;;-1:-1:-1::0;;;7781:12:30::1;;;;;;;;;;;7757:36;7807:19:::0;7803:59:::1;;7849:13;;-1:-1:-1::0;;;7849:13:30::1;;;;;;;;;;;7803:59;7876:19;::::0;-1:-1:-1;;;;;7876:19:30::1;7872:66;;7918:20;;-1:-1:-1::0;;;7918:20:30::1;;;;;;;;;;;7872:66;7970:19;::::0;7949:49:::1;::::0;-1:-1:-1;;;;;7970:19:30::1;7991:6:::0;7949:20:::1;:49::i;:::-;8036:19;::::0;-1:-1:-1;;;;;8036:19:30::1;8066:62;8036:19:::0;8094:10:::1;8114:4;8121:6:::0;8066:27:::1;:62::i;:::-;8182:19;::::0;8212:26:::1;::::0;-1:-1:-1;;;8212:26:30;;::::1;::::0;::::1;2520:25:43::0;;;-1:-1:-1;;;;;8182:19:30;;::::1;::::0;;;8212:18:::1;::::0;2493::43;;8212:26:30::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;8355:19;8318:3;8254:156:::0;::::1;8293:11;;8254:156;8335:6;8388:12;;8254:156;;;;;;10233:25:43::0;;;10289:2;10274:18;;10267:34;10221:2;10206:18;;10059:248;4034:65:30;2334:13:10;:11;:13::i;13154:168:30:-;2334:13:10;:11;:13::i;:::-;2563:16:14::1;:14;:16::i;:::-;-1:-1:-1::0;;;;;13268:37:30;;;::::2;;::::0;;;:12:::2;:37;::::0;;;;:47;;-1:-1:-1;;13268:47:30::2;::::0;::::2;;::::0;;;::::2;::::0;;13154:168::o;2774:229:9:-;966:10:13;;2869:14:9;:12;:14::i;:::-;-1:-1:-1;;;;;2869:24:9;;2865:96;;2916:34;;-1:-1:-1;;;2916:34:9;;-1:-1:-1;;;;;1565:32:43;;2916:34:9;;;1547:51:43;1520:18;;2916:34:9;;;;;;;;2865:96;2970:26;2989:6;2970:18;:26::i;:::-;2816:187;2774:229::o;11943:61:30:-;2334:13:10;:11;:13::i;:::-;11989:8:30::1;:6;:8::i;2441:144:10:-:0;2487:7;;1313:22;2533:20;2570:8;-1:-1:-1;;;;;2570:8:10;;2441:144;-1:-1:-1;;2441:144:10:o;12754:165:30:-;2334:13:10;:11;:13::i;:::-;2563:16:14::1;:14;:16::i;:::-;12870:19:30::2;:42:::0;;-1:-1:-1;;;;;;12870:42:30::2;-1:-1:-1::0;;;;;12870:42:30;;;::::2;::::0;;;::::2;::::0;;12754:165::o;402:145:35:-;2334:13:10;:11;:13::i;:::-;510::35::1;:30:::0;;-1:-1:-1;;;;;;510:30:35::1;-1:-1:-1::0;;;;;510:30:35;;;::::1;::::0;;;::::1;::::0;;402:145::o;5338:1110:30:-;2316:19:14;:17;:19::i;:::-;5504:6:30::1;5514:1;5504:11:::0;5500:36:::1;;5524:12;;-1:-1:-1::0;;;5524:12:30::1;;;;;;;;;;;5500:36;5550:19:::0;5546:59:::1;;5592:13;;-1:-1:-1::0;;;5592:13:30::1;;;;;;;;;;;5546:59;5616:24;5643:31:::0;;;:14:::1;:31;::::0;;;;;;5688:23;;;5684:53:::1;;5720:17;;-1:-1:-1::0;;;5720:17:30::1;;;;;;;;;;;5684:53;5781:15:::0;5807:35:::1;5781:15:::0;5835:6;5807:20:::1;:35::i;:::-;6002:5:::0;6018:62:::1;-1:-1:-1::0;;;;;6018:27:30;::::1;6046:10;6066:4;6073:6:::0;6018:27:::1;:62::i;:::-;-1:-1:-1::0;;;;;6096:19:30;::::1;;::::0;;;:12:::1;:19;::::0;;;;;::::1;;6091:141;;6195:26;::::0;-1:-1:-1;;;6195:26:30;;::::1;::::0;::::1;2520:25:43::0;;;6175:5:30;;-1:-1:-1;;;;;6195:18:30;::::1;::::0;::::1;::::0;2493::43;;6195:26:30::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;6117:115;6091:141;6361:19;6311:16;6286:11;;6247:169;6341:6;6394:12;;6247:169;;;;;;10233:25:43::0;;;10289:2;10274:18;;10267:34;10221:2;10206:18;;10059:248;6247:169:30::1;;;;;;;;6429:12;::::0;6427:14:::1;;;;;:::i;:::-;::::0;;;-1:-1:-1;;;;;;;5338:1110:30:o;553:342:35:-;8870:21:11;4302:15;;-1:-1:-1;;;4302:15:11;;;;4301:16;;4348:14;;4158:30;4726:16;;:34;;;;;4746:14;4726:34;4706:54;;4770:17;4790:11;:16;;4805:1;4790:16;:50;;;;-1:-1:-1;4818:4:11;4810:25;:30;4790:50;4770:70;;4856:12;4855:13;:30;;;;;4873:12;4872:13;4855:30;4851:91;;;4908:23;;-1:-1:-1;;;4908:23:11;;;;;;;;;;;4851:91;4951:18;;-1:-1:-1;;4951:18:11;4968:1;4951:18;;;4979:67;;;;5013:22;;-1:-1:-1;;;;5013:22:11;-1:-1:-1;;;5013:22:11;;;4979:67;745:66:35::1;765:10;;777:19;798:12;745:19;:66::i;:::-;821:21;836:5;821:14;:21::i;:::-;852:17;:15;:17::i;:::-;880:8;:6;:8::i;:::-;5070:14:11::0;5066:101;;;5100:23;;-1:-1:-1;;;;5100:23:11;;;5142:14;;-1:-1:-1;10764:50:43;;5142:14:11;;10752:2:43;10737:18;5142:14:11;;;;;;;5066:101;4092:1081;;;;;553:342:35;;;;;:::o;10446:1491:30:-;2316:19:14;:17;:19::i;:::-;10706:12:30::1;2735:39;2749:12;2763:10;2735:13;:39::i;:::-;2730:69;;2783:16;;-1:-1:-1::0;;;2783:16:30::1;;;;;;;;;;;2730:69;10873:31:::2;::::0;;;:17:::2;:31;::::0;;;;;::::2;;10869:135;;;10925:48;::::0;;10999:25:43;;;10962:10:30::2;11055:2:43::0;11040:18;;11033:60;10925:48:30::2;::::0;10972:18:43;10925:48:30::2;;;;;;;10987:7;;10869:135;11059:186;::::0;;::::2;::::0;::::2;11345:19:43::0;;;11380:12;;;11373:28;;;11417:12;;;11410:28;;;11454:12;;;11447:28;;;11491:13;;;11484:29;;;11014:19:30::2;::::0;11529:13:43;;11059:186:30::2;::::0;;-1:-1:-1;;11059:186:30;;::::2;::::0;;;;;;11036:219;;11059:186:::2;11036:219:::0;;::::2;::::0;11266:23:::2;11292:28:::0;;;:15:::2;:28:::0;;;;;11353:10:::2;11334:30:::0;;:18:::2;::::0;::::2;:30:::0;;;;;;;;11036:219;;-1:-1:-1;11334:30:30::2;;11330:131;;;11385:45;::::0;;10999:25:43;;;11419:10:30::2;11055:2:43::0;11040:18;;11033:60;11385:45:30::2;::::0;10972:18:43;11385:45:30::2;;;;;;;11444:7;;;;11330:131;11491:11;11475:12;:27;11471:58;;11511:18;;-1:-1:-1::0;;;11511:18:30::2;;;;;;;;;;;11471:58;11559:10;11540:30;::::0;;;11573:4:::2;11540:18:::0;;::::2;:30;::::0;;;;:37;;-1:-1:-1;;11540:37:30::2;::::0;;::::2;::::0;;11587:24;;11540:7;;:30;11587:24:::2;::::0;::::2;:::i;:::-;::::0;;;-1:-1:-1;11627:38:30::2;::::0;;10999:25:43;;;11654:10:30::2;11055:2:43::0;11040:18;;11033:60;11627:38:30::2;::::0;10972:18:43;11627:38:30::2;;;;;;;11706:32;::::0;;;:18:::2;:32;::::0;;;;;11680:22;;:58:::2;11676:255;;11754:166;11800:11;11829:16;11863:6;11887:19;11754:28;:166::i;:::-;10720:1217;;2809:1;2345::14::1;10446:1491:30::0;;;;;;:::o;1680:168:9:-;1733:7;;1318:27;1784:25;1187:174;13621:432:30;13758:4;13779:36;13793:12;13807:7;13779:13;:36::i;:::-;13774:80;;-1:-1:-1;13838:5:30;13831:12;;13774:80;13867:30;;;;:17;:30;;;;;;;;13863:73;;;-1:-1:-1;13920:5:30;13913:12;;13863:73;13543:4;13566:21;;;:15;:21;;;;;;;;-1:-1:-1;;;;;13566:42:30;;;;:32;;:42;;;;;;;;13945:81;;;-1:-1:-1;14010:5:30;14003:12;;13945:81;-1:-1:-1;14042:4:30;13621:432;;;;;;:::o;12256:222::-;2334:13:10;:11;:13::i;:::-;12367:12:30::1;12385:2;-1:-1:-1::0;;;;;12385:7:30::1;12400:6;1136:4;12385:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12366:61;;;12442:7;12437:34;;12458:13;;-1:-1:-1::0;;;12458:13:30::1;;;;;;;;;;;2041:247:9::0;2334:13:10;:11;:13::i;:::-;1318:27:9;2197:26;;-1:-1:-1;;;;;;2197:26:9::1;-1:-1:-1::0;;;;;2197:26:9;::::1;::::0;;::::1;::::0;;2263:7:::1;:5;:7::i;:::-;-1:-1:-1::0;;;;;2238:43:9::1;;;;;;;;;;;2120:168;2041:247:::0;:::o;2658:162:10:-;966:10:13;2717:7:10;:5;:7::i;:::-;-1:-1:-1;;;;;2717:23:10;;2713:101;;2763:40;;-1:-1:-1;;;2763:40:10;;966:10:13;2763:40:10;;;1547:51:43;1520:18;;2763:40:10;1401:203:43;3105:126:14;-1:-1:-1;;;;;;;;;;;2821:9:14;;;3163:62;;3199:15;;-1:-1:-1;;;3199:15:14;;;;;;;;;;;4105:858:30;4233:19;4256:1;4233:24;4229:60;;4266:23;;-1:-1:-1;;;4266:23:30;;;;;;;;;;;4229:60;4303:39;;;4299:84;;;4363:20;;-1:-1:-1;;;4363:20:30;;;;;;;;;;;4299:84;4399:9;4394:443;4410:21;;;4394:443;;;4481:1;4456:10;;4467:1;4456:13;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;4456:27:30;;4452:53;;4492:13;;-1:-1:-1;;;4492:13:30;;;;;;;;;;;4452:53;4519:25;4591:11;;4604:10;;4615:1;4604:13;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;4574:44;;;;;;;;10469:19:43;;;10526:2;10522:15;-1:-1:-1;;10518:53:43;10513:2;10504:12;;10497:75;10597:2;10588:12;;10312:294;4574:44:30;;;;-1:-1:-1;;4574:44:30;;;;;;;;;4547:85;;4574:44;4547:85;;;;4682:28;;;;:9;:28;;;;;;4547:85;;-1:-1:-1;4682:28:30;;4678:100;;;4737:26;;-1:-1:-1;;;4737:26:30;;;;;;;;;;;4678:100;4791:28;;;;:9;:28;;;;;:35;;-1:-1:-1;;4791:35:30;4822:4;4791:35;;;4433:3;;;:::i;:::-;;;4394:443;;;-1:-1:-1;4861:11:30;;;4847:26;;;;:13;:26;;;;;;;;:46;;;;4922:11;;4903:31;;:18;:31;;;;;;;:53;-1:-1:-1;4105:858:30:o;2905:128:14:-;-1:-1:-1;;;;;;;;;;;2821:9:14;;;2966:61;;;3001:15;;-1:-1:-1;;;3001:15:14;;;;;;;;;;;901:531:35;1021:13;;-1:-1:-1;;;;;1021:13:35;:43;1017:409;;1084:13;;:45;;-1:-1:-1;;;1084:45:35;;-1:-1:-1;;;;;12087:32:43;;;1084:45:35;;;12069:51:43;12136:18;;;12129:34;;;1084:13:35;;;;:30;;12042:18:43;;1084:45:35;;;;;;;;;;;;;;;;;;-1:-1:-1;1084:45:35;;;;;;;;-1:-1:-1;;1084:45:35;;;;;;;;;;;;:::i;:::-;;;1080:336;;;1205:6;1200:76;;1242:15;;-1:-1:-1;;;1242:15:35;;;;;;;;;;;1303:160:25;1412:43;;-1:-1:-1;;;;;12087:32:43;;;1412:43:25;;;12069:51:43;12136:18;;;12129:34;;;1385:71:25;;1405:5;;1427:14;;;;;12042:18:43;;1412:43:25;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1412:43:25;;;;;;;;;;;1385:19;:71::i;3674:178:14:-;2563:16;:14;:16::i;:::-;-1:-1:-1;;;;;;;;;;;3791:17:14;;-1:-1:-1;;3791:17:14::1;::::0;;3823:22:::1;966:10:13::0;3832:12:14::1;3823:22;::::0;-1:-1:-1;;;;;1565:32:43;;;1547:51;;1535:2;1520:18;3823:22:14::1;;;;;;;3722:130;3674:178::o:0;4599:312:12:-;4679:4;-1:-1:-1;;;;;4688:6:12;4671:23;;;:120;;;4785:6;-1:-1:-1;;;;;4749:42:12;:32;-1:-1:-1;;;;;;;;;;;2035:53:19;-1:-1:-1;;;;;2035:53:19;;1957:138;4749:32:12;-1:-1:-1;;;;;4749:42:12;;;4671:120;4654:251;;;4865:29;;-1:-1:-1;;;4865:29:12;;;;;;;;;;;3907:66:30;2334:13:10;:11;:13::i;6052:538:12:-;6169:17;-1:-1:-1;;;;;6151:50:12;;:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6151:52:12;;;;;;;;-1:-1:-1;;6151:52:12;;;;;;;;;;;;:::i;:::-;;;6147:437;;6513:60;;-1:-1:-1;;;6513:60:12;;-1:-1:-1;;;;;1565:32:43;;6513:60:12;;;1547:51:43;1520:18;;6513:60:12;1401:203:43;6147:437:12;-1:-1:-1;;;;;;;;;;;6245:40:12;;6241:120;;6312:34;;-1:-1:-1;;;6312:34:12;;;;;2520:25:43;;;2493:18;;6312:34:12;2374:177:43;6241:120:12;6374:54;6404:17;6423:4;6374:29;:54::i;5028:213::-;5102:4;-1:-1:-1;;;;;5111:6:12;5094:23;;5090:145;;5195:29;;-1:-1:-1;;;5195:29:12;;;;;;;;;;;1702:188:25;1829:53;;-1:-1:-1;;;;;12871:15:43;;;1829:53:25;;;12853:34:43;12923:15;;;12903:18;;;12896:43;12955:18;;;12948:34;;;1802:81:25;;1822:5;;1844:18;;;;;12788::43;;1829:53:25;12613:375:43;1802:81:25;1702:188;;;;:::o;2472:222:9:-;1318:27;2621:22;;-1:-1:-1;;;;;;2621:22:9;;;2653:34;2678:8;2653:24;:34::i;3366:176:14:-;2316:19;:17;:19::i;:::-;-1:-1:-1;;;;;;;;;;;3484:16:14;;-1:-1:-1;;3484:16:14::1;3496:4;3484:16;::::0;;3515:20:::1;966:10:13::0;3522:12:14::1;887:96:13::0;3201:314:30;6931:20:11;:18;:20::i;:::-;3386:122:30::1;3429:10;;3453:19;3486:12;3386:29;:122::i;1847:127:10:-:0;6931:20:11;:18;:20::i;:::-;1929:38:10::1;1954:12;1929:24;:38::i;1836:97:14:-:0;6931:20:11;:18;:20::i;:::-;1899:27:14::1;:25;:27::i;8448:1574:30:-:0;8643:30;;;;:17;:30;;;;;;;;:37;;-1:-1:-1;;8643:37:30;8676:4;8643:37;;;8697:15;:28;;;;;8690:35;;;8764:34;8781:16;14374:4;14261:127;8764:34;8736:62;-1:-1:-1;8856:19:30;-1:-1:-1;;;;;8981:31:30;;8977:994;;9053:11;;9087:41;;;;;2520:25:43;;;9029:18:30;;-1:-1:-1;;;;;9053:11:30;;2493:18:43;;9087:41:30;;;-1:-1:-1;;9087:41:30;;;;;;;;;;;;;;-1:-1:-1;;;;;9087:41:30;-1:-1:-1;;;9087:41:30;;;9053:89;;;9087:41;9053:89;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9028:114;;;9161:13;9156:42;;9183:15;;-1:-1:-1;;;9183:15:30;;;;;;;;;;;9156:42;9213:25;9244:20;-1:-1:-1;;;;;9244:25:30;9294:6;1136:4;9244:106;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9212:138;;;9369:20;9364:95;;9414:30;;2520:25:43;;;9414:30:30;;2508:2:43;2493:18;9414:30:30;;;;;;;9364:95;9014:455;;8977:994;;;-1:-1:-1;;;;;9480:31:30;;;;;;:12;:31;;;;;;;;9475:496;;9658:48;;-1:-1:-1;;;9658:48:30;;-1:-1:-1;;;;;12087:32:43;;;9658:48:30;;;12069:51:43;12136:18;;;12129:34;;;9626:17:30;;9658:18;;;;;;12042::43;;9658:48:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9513:204;9475:496;;;9759:17;9813:63;9759:17;9847:20;9869:6;9813:26;:63::i;:::-;9791:170;;9914:32;;2520:25:43;;;9914:32:30;;2508:2:43;2493:18;9914:32:30;;;;;;;9791:170;9723:248;9475:496;9986:29;;2520:25:43;;;9986:29:30;;2508:2:43;2493:18;9986:29:30;;;;;;;8633:1389;;8448:1574;;;;:::o;4059:629:25:-;4478:23;4504:33;-1:-1:-1;;;;;4504:27:25;;4532:4;4504:27;:33::i;:::-;4478:59;;4551:10;:17;4572:1;4551:22;;:57;;;;;4589:10;4578:30;;;;;;;;;;;;:::i;:::-;4577:31;4551:57;4547:135;;;4631:40;;-1:-1:-1;;;4631:40:25;;-1:-1:-1;;;;;1565:32:43;;4631:40:25;;;1547:51:43;1520:18;;4631:40:25;1401:203:43;2779:335:19;2870:37;2889:17;2870:18;:37::i;:::-;2922:27;;-1:-1:-1;;;;;2922:27:19;;;;;;;;2964:11;;:15;2960:148;;2995:53;3024:17;3043:4;2995:28;:53::i;2960:148::-;3079:18;:16;:18::i;3774:248:10:-;1313:22;3923:8;;-1:-1:-1;;;;;;3941:19:10;;-1:-1:-1;;;;;3941:19:10;;;;;;;;3975:40;;3923:8;;;;;3975:40;;3847:24;;3975:40;3837:185;;3774:248;:::o;7084:141:11:-;8870:21;8560:40;-1:-1:-1;;;8560:40:11;;;;7146:73;;7191:17;;-1:-1:-1;;;7191:17:11;;;;;;;;;;;3521:336:30;6931:20:11;:18;:20::i;:::-;3731:1:30::1;3716:16:::0;;;3742:11:::1;:15:::0;3767:11:::1;:26:::0;;-1:-1:-1;;;;;;3767:26:30::1;-1:-1:-1::0;;;;;3767:26:30;::::1;;::::0;;3804:46:::1;3818:10:::0;;3830:19;3804:13:::1;:46::i;1980:235:10:-:0;6931:20:11;:18;:20::i;:::-;-1:-1:-1;;;;;2076:26:10;::::1;2072:95;;2125:31;::::0;-1:-1:-1;;;2125:31:10;;2153:1:::1;2125:31;::::0;::::1;1547:51:43::0;1520:18;;2125:31:10::1;1401:203:43::0;1939:156:14;6931:20:11;:18;:20::i;:::-;-1:-1:-1;;;;;;;;;;;2071:17:14;;-1:-1:-1;;2071:17:14::1;::::0;;1939:156::o;14622:446:30:-;14845:50;;;-1:-1:-1;;;;;12087:32:43;;;14845:50:30;;;12069:51:43;12136:18;;;;12129:34;;;14845:50:30;;;;;;;;;;12042:18:43;;;;14845:50:30;;;;;;;-1:-1:-1;;;;;14845:50:30;-1:-1:-1;;;14845:50:30;;;14812:93;;-1:-1:-1;;;;;;14812:19:30;;;;:93;;14845:50;14812:93;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14770:135;;;;14934:7;:81;;;;-1:-1:-1;14958:17:30;;:22;;:56;;;14995:10;14984:30;;;;;;;;;;;;:::i;:::-;14934:127;;;;;15060:1;15039:5;-1:-1:-1;;;;;15031:26:30;;:30;14934:127;14915:146;14622:446;-1:-1:-1;;;;;;14622:446:30:o;2705:151:26:-;2780:12;2811:38;2833:6;2841:4;2847:1;2811:21;:38::i;2186:281:19:-;2263:17;-1:-1:-1;;;;;2263:29:19;;2296:1;2263:34;2259:119;;2320:47;;-1:-1:-1;;;2320:47:19;;-1:-1:-1;;;;;1565:32:43;;2320:47:19;;;1547:51:43;1520:18;;2320:47:19;1401:203:43;2259:119:19;-1:-1:-1;;;;;;;;;;;2387:73:19;;-1:-1:-1;;;;;;2387:73:19;-1:-1:-1;;;;;2387:73:19;;;;;;;;;;2186:281::o;4106:253:26:-;4189:12;4214;4228:23;4255:6;-1:-1:-1;;;;;4255:19:26;4275:4;4255:25;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4213:67;;;;4297:55;4324:6;4332:7;4341:10;4297:26;:55::i;:::-;4290:62;4106:253;-1:-1:-1;;;;;4106:253:26:o;6598:122:19:-;6648:9;:13;6644:70;;6684:19;;-1:-1:-1;;;6684:19:19;;;;;;;;;;;3180:392:26;3279:12;3331:5;3307:21;:29;3303:108;;;3359:41;;-1:-1:-1;;;3359:41:26;;3394:4;3359:41;;;1547:51:43;1520:18;;3359:41:26;1401:203:43;3303:108:26;3421:12;3435:23;3462:6;-1:-1:-1;;;;;3462:11:26;3481:5;3488:4;3462:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3420:73;;;;3510:55;3537:6;3545:7;3554:10;4625:582;4769:12;4798:7;4793:408;;4821:19;4829:10;4821:7;:19::i;:::-;4793:408;;;5045:17;;:22;:49;;;;-1:-1:-1;;;;;;5071:18:26;;;:23;5045:49;5041:119;;;5121:24;;-1:-1:-1;;;5121:24:26;;-1:-1:-1;;;;;1565:32:43;;5121:24:26;;;1547:51:43;1520:18;;5121:24:26;1401:203:43;5041:119:26;-1:-1:-1;5180:10:26;5173:17;;5743:516;5874:17;;:21;5870:383;;6102:10;6096:17;6158:15;6145:10;6141:2;6137:19;6130:44;5870:383;6225:17;;-1:-1:-1;;;6225:17:26;;;;;;;;;;;14:118:43;100:5;93:13;86:21;79:5;76:32;66:60;;122:1;119;112:12;137:377;211:6;219;227;280:2;268:9;259:7;255:23;251:32;248:52;;;296:1;293;286:12;248:52;332:9;319:23;309:33;;389:2;378:9;374:18;361:32;351:42;;443:2;432:9;428:18;415:32;456:28;478:5;456:28;:::i;:::-;503:5;493:15;;;137:377;;;;;:::o;519:367::-;582:8;592:6;646:3;639:4;631:6;627:17;623:27;613:55;;664:1;661;654:12;613:55;-1:-1:-1;687:20:43;;730:18;719:30;;716:50;;;762:1;759;752:12;716:50;799:4;791:6;787:17;775:29;;859:3;852:4;842:6;839:1;835:14;827:6;823:27;819:38;816:47;813:67;;;876:1;873;866:12;813:67;519:367;;;;;:::o;891:505::-;986:6;994;1002;1055:2;1043:9;1034:7;1030:23;1026:32;1023:52;;;1071:1;1068;1061:12;1023:52;1111:9;1098:23;1144:18;1136:6;1133:30;1130:50;;;1176:1;1173;1166:12;1130:50;1215:70;1277:7;1268:6;1257:9;1253:22;1215:70;:::i;:::-;1304:8;;1189:96;;-1:-1:-1;1386:2:43;1371:18;;;;1358:32;;891:505;-1:-1:-1;;;;891:505:43:o;1609:131::-;-1:-1:-1;;;;;1684:31:43;;1674:42;;1664:70;;1730:1;1727;1720:12;1745:247;1804:6;1857:2;1845:9;1836:7;1832:23;1828:32;1825:52;;;1873:1;1870;1863:12;1825:52;1912:9;1899:23;1931:31;1956:5;1931:31;:::i;2189:180::-;2248:6;2301:2;2289:9;2280:7;2276:23;2272:32;2269:52;;;2317:1;2314;2307:12;2269:52;-1:-1:-1;2340:23:43;;2189:180;-1:-1:-1;2189:180:43:o;2556:315::-;2624:6;2632;2685:2;2673:9;2664:7;2660:23;2656:32;2653:52;;;2701:1;2698;2691:12;2653:52;2737:9;2724:23;2714:33;;2797:2;2786:9;2782:18;2769:32;2810:31;2835:5;2810:31;:::i;:::-;2860:5;2850:15;;;2556:315;;;;;:::o;2876:456::-;2953:6;2961;2969;3022:2;3010:9;3001:7;2997:23;2993:32;2990:52;;;3038:1;3035;3028:12;2990:52;3077:9;3064:23;3096:31;3121:5;3096:31;:::i;:::-;3146:5;-1:-1:-1;3203:2:43;3188:18;;3175:32;3216:33;3175:32;3216:33;:::i;:::-;2876:456;;3268:7;;-1:-1:-1;;;3322:2:43;3307:18;;;;3294:32;;2876:456::o;3746:127::-;3807:10;3802:3;3798:20;3795:1;3788:31;3838:4;3835:1;3828:15;3862:4;3859:1;3852:15;3878:1056;3955:6;3963;4016:2;4004:9;3995:7;3991:23;3987:32;3984:52;;;4032:1;4029;4022:12;3984:52;4071:9;4058:23;4090:31;4115:5;4090:31;:::i;:::-;4140:5;-1:-1:-1;4196:2:43;4181:18;;4168:32;4219:18;4249:14;;;4246:34;;;4276:1;4273;4266:12;4246:34;4314:6;4303:9;4299:22;4289:32;;4359:7;4352:4;4348:2;4344:13;4340:27;4330:55;;4381:1;4378;4371:12;4330:55;4417:2;4404:16;4439:2;4435;4432:10;4429:36;;;4445:18;;:::i;:::-;4520:2;4514:9;4488:2;4574:13;;-1:-1:-1;;4570:22:43;;;4594:2;4566:31;4562:40;4550:53;;;4618:18;;;4638:22;;;4615:46;4612:72;;;4664:18;;:::i;:::-;4704:10;4700:2;4693:22;4739:2;4731:6;4724:18;4779:7;4774:2;4769;4765;4761:11;4757:20;4754:33;4751:53;;;4800:1;4797;4790:12;4751:53;4856:2;4851;4847;4843:11;4838:2;4830:6;4826:15;4813:46;4901:1;4896:2;4891;4883:6;4879:15;4875:24;4868:35;4922:6;4912:16;;;;;;;3878:1056;;;;;:::o;5121:248::-;5189:6;5197;5250:2;5238:9;5229:7;5225:23;5221:32;5218:52;;;5266:1;5263;5256:12;5218:52;-1:-1:-1;;5289:23:43;;;5359:2;5344:18;;;5331:32;;-1:-1:-1;5121:248:43:o;5374:309::-;5439:6;5447;5500:2;5488:9;5479:7;5475:23;5471:32;5468:52;;;5516:1;5513;5506:12;5468:52;5552:9;5539:23;5529:33;;5612:2;5601:9;5597:18;5584:32;5625:28;5647:5;5625:28;:::i;5688:315::-;5756:6;5764;5817:2;5805:9;5796:7;5792:23;5788:32;5785:52;;;5833:1;5830;5823:12;5785:52;5872:9;5859:23;5891:31;5916:5;5891:31;:::i;:::-;5941:5;5993:2;5978:18;;;;5965:32;;-1:-1:-1;;;5688:315:43:o;6008:250::-;6093:1;6103:113;6117:6;6114:1;6111:13;6103:113;;;6193:11;;;6187:18;6174:11;;;6167:39;6139:2;6132:10;6103:113;;;-1:-1:-1;;6250:1:43;6232:16;;6225:27;6008:250::o;6263:396::-;6412:2;6401:9;6394:21;6375:4;6444:6;6438:13;6487:6;6482:2;6471:9;6467:18;6460:34;6503:79;6575:6;6570:2;6559:9;6555:18;6550:2;6542:6;6538:15;6503:79;:::i;:::-;6643:2;6622:15;-1:-1:-1;;6618:29:43;6603:45;;;;6650:2;6599:54;;6263:396;-1:-1:-1;;6263:396:43:o;6939:316::-;7016:6;7024;7032;7085:2;7073:9;7064:7;7060:23;7056:32;7053:52;;;7101:1;7098;7091:12;7053:52;-1:-1:-1;;7124:23:43;;;7194:2;7179:18;;7166:32;;-1:-1:-1;7245:2:43;7230:18;;;7217:32;;6939:316;-1:-1:-1;6939:316:43:o;7260:790::-;7381:6;7389;7397;7405;7413;7466:3;7454:9;7445:7;7441:23;7437:33;7434:53;;;7483:1;7480;7473:12;7434:53;7523:9;7510:23;7556:18;7548:6;7545:30;7542:50;;;7588:1;7585;7578:12;7542:50;7627:70;7689:7;7680:6;7669:9;7665:22;7627:70;:::i;:::-;7716:8;;-1:-1:-1;7601:96:43;-1:-1:-1;;7798:2:43;7783:18;;7770:32;;-1:-1:-1;7852:2:43;7837:18;;7824:32;7865:31;7824:32;7865:31;:::i;:::-;7915:5;-1:-1:-1;7972:2:43;7957:18;;7944:32;7985:33;7944:32;7985:33;:::i;:::-;8037:7;8027:17;;;7260:790;;;;;;;;:::o;8055:523::-;8159:6;8167;8175;8183;8191;8199;8252:3;8240:9;8231:7;8227:23;8223:33;8220:53;;;8269:1;8266;8259:12;8220:53;-1:-1:-1;;8292:23:43;;;8362:2;8347:18;;8334:32;;-1:-1:-1;8413:2:43;8398:18;;8385:32;;8464:2;8449:18;;8436:32;;-1:-1:-1;8515:3:43;8500:19;;8487:33;;-1:-1:-1;8567:3:43;8552:19;8539:33;;-1:-1:-1;8055:523:43;-1:-1:-1;8055:523:43:o;8583:383::-;8660:6;8668;8676;8729:2;8717:9;8708:7;8704:23;8700:32;8697:52;;;8745:1;8742;8735:12;8697:52;8781:9;8768:23;8758:33;;8841:2;8830:9;8826:18;8813:32;8854:31;8879:5;8854:31;:::i;9530:232::-;9569:3;9590:17;;;9587:140;;9649:10;9644:3;9640:20;9637:1;9630:31;9684:4;9681:1;9674:15;9712:4;9709:1;9702:15;9587:140;-1:-1:-1;9754:1:43;9743:13;;9530:232::o;9767:287::-;9896:3;9934:6;9928:13;9950:66;10009:6;10004:3;9997:4;9989:6;9985:17;9950:66;:::i;:::-;10032:16;;;;;9767:287;-1:-1:-1;;9767:287:43:o;11763:127::-;11824:10;11819:3;11815:20;11812:1;11805:31;11855:4;11852:1;11845:15;11879:4;11876:1;11869:15;12174:245;12241:6;12294:2;12282:9;12273:7;12269:23;12265:32;12262:52;;;12310:1;12307;12300:12;12262:52;12342:9;12336:16;12361:28;12383:5;12361:28;:::i;12424:184::-;12494:6;12547:2;12535:9;12526:7;12522:23;12518:32;12515:52;;;12563:1;12560;12553:12;12515:52;-1:-1:-1;12586:16:43;;12424:184;-1:-1:-1;12424:184:43:o

Swarm Source

ipfs://9838e950c870b1d66c3069978a87d1502fecedec9f5f5a6628fcbac1a01af41b

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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