MATIC Price: $0.718962 (-1.79%)
Gas: 30 GWei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Token Holdings

Sponsored

Transaction Hash
Method
Block
From
To
Value
Fill575383422024-05-29 18:43:229 hrs ago1717008202IN
0x987644e0...5b58bE595
0 MATIC0.0643992948
Bid575383022024-05-29 18:41:569 hrs ago1717008116IN
0x987644e0...5b58bE595
0 MATIC0.007216942.00000004
Bid575383002024-05-29 18:41:529 hrs ago1717008112IN
0x987644e0...5b58bE595
0 MATIC0.0462122347.99999999
Fill575382192024-05-29 18:38:539 hrs ago1717007933IN
0x987644e0...5b58bE595
0 MATIC0.0568056740.80000006
Bid575381772024-05-29 18:37:259 hrs ago1717007845IN
0x987644e0...5b58bE595
0 MATIC0.0346583136.00000007
Bid575309872024-05-29 14:09:1714 hrs ago1716991757IN
0x987644e0...5b58bE595
0 MATIC0.14698818151.66226745
Fill575294672024-05-29 13:13:1915 hrs ago1716988399IN
0x987644e0...5b58bE595
0 MATIC0.0784364482.49763936
Bid575294242024-05-29 13:11:4915 hrs ago1716988309IN
0x987644e0...5b58bE595
0 MATIC0.0731699977.6136849
Fill575280412024-05-29 12:20:3315 hrs ago1716985233IN
0x987644e0...5b58bE595
0 MATIC0.071385795.72542987
Bid575280062024-05-29 12:19:1915 hrs ago1716985159IN
0x987644e0...5b58bE595
0 MATIC0.0141597658.42473586
Fill575276302024-05-29 12:05:2716 hrs ago1716984327IN
0x987644e0...5b58bE595
0 MATIC0.0589797663.04934446
Bid575275972024-05-29 12:04:1716 hrs ago1716984257IN
0x987644e0...5b58bE595
0 MATIC0.1143672578.20084865
Bid575273612024-05-29 11:55:2516 hrs ago1716983725IN
0x987644e0...5b58bE595
0 MATIC0.0197025882.43792889
Bid575269922024-05-29 11:42:2116 hrs ago1716982941IN
0x987644e0...5b58bE595
0 MATIC0.015802766.12036212
Bid575264172024-05-29 11:20:5516 hrs ago1716981655IN
0x987644e0...5b58bE595
0 MATIC0.0122594551.29501061
Fill575263332024-05-29 11:17:5516 hrs ago1716981475IN
0x987644e0...5b58bE595
0 MATIC0.0402212256.71447069
Bid575263012024-05-29 11:16:4717 hrs ago1716981407IN
0x987644e0...5b58bE595
0 MATIC0.0614627164.66356383
Bid575262302024-05-29 11:14:1717 hrs ago1716981257IN
0x987644e0...5b58bE595
0 MATIC0.072521774.8287535
Bid575262032024-05-29 11:13:1917 hrs ago1716981199IN
0x987644e0...5b58bE595
0 MATIC0.0093031188.61629021
Fill575262032024-05-29 11:13:1917 hrs ago1716981199IN
0x987644e0...5b58bE595
0 MATIC0.0638953588.66264099
Bid575261632024-05-29 11:11:5517 hrs ago1716981115IN
0x987644e0...5b58bE595
0 MATIC0.0679257871.46592008
Fill575261232024-05-29 11:10:2117 hrs ago1716981021IN
0x987644e0...5b58bE595
0 MATIC0.0523376460.58467149
Bid575260942024-05-29 11:08:5517 hrs ago1716980935IN
0x987644e0...5b58bE595
0 MATIC0.0555143258.89701975
Bid575260902024-05-29 11:08:4717 hrs ago1716980927IN
0x987644e0...5b58bE595
0 MATIC0.0537574157.03305303
Bid575260342024-05-29 11:06:4917 hrs ago1716980809IN
0x987644e0...5b58bE595
0 MATIC0.0166350268.00937227
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To Value
575383422024-05-29 18:43:229 hrs ago1717008202
0x987644e0...5b58bE595
0.13720179 MATIC
575383422024-05-29 18:43:229 hrs ago1717008202
0x987644e0...5b58bE595
0.13720179 MATIC
575382192024-05-29 18:38:539 hrs ago1717007933
0x987644e0...5b58bE595
0.10268581 MATIC
575382192024-05-29 18:38:539 hrs ago1717007933
0x987644e0...5b58bE595
0.10268581 MATIC
575294672024-05-29 13:13:1915 hrs ago1716988399
0x987644e0...5b58bE595
0.23882708 MATIC
575294672024-05-29 13:13:1915 hrs ago1716988399
0x987644e0...5b58bE595
0.23882708 MATIC
575276302024-05-29 12:05:2716 hrs ago1716984327
0x987644e0...5b58bE595
0.37054486 MATIC
575276302024-05-29 12:05:2716 hrs ago1716984327
0x987644e0...5b58bE595
0.37054486 MATIC
575263332024-05-29 11:17:5516 hrs ago1716981475
0x987644e0...5b58bE595
0.1925383 MATIC
575263332024-05-29 11:17:5516 hrs ago1716981475
0x987644e0...5b58bE595
0.1925383 MATIC
575262032024-05-29 11:13:1917 hrs ago1716981199
0x987644e0...5b58bE595
0.21186186 MATIC
575262032024-05-29 11:13:1917 hrs ago1716981199
0x987644e0...5b58bE595
0.21186186 MATIC
575261232024-05-29 11:10:2117 hrs ago1716981021
0x987644e0...5b58bE595
0.17231253 MATIC
575261232024-05-29 11:10:2117 hrs ago1716981021
0x987644e0...5b58bE595
0.17231253 MATIC
575227662024-05-29 9:08:2019 hrs ago1716973700
0x987644e0...5b58bE595
0.12907275 MATIC
575227662024-05-29 9:08:2019 hrs ago1716973700
0x987644e0...5b58bE595
0.12907275 MATIC
575212472024-05-29 8:14:2620 hrs ago1716970466
0x987644e0...5b58bE595
0.22022696 MATIC
575212472024-05-29 8:14:2620 hrs ago1716970466
0x987644e0...5b58bE595
0.22022696 MATIC
575203532024-05-29 7:42:4820 hrs ago1716968568
0x987644e0...5b58bE595
0.19185901 MATIC
575203532024-05-29 7:42:4820 hrs ago1716968568
0x987644e0...5b58bE595
0.19185901 MATIC
575194512024-05-29 7:10:5021 hrs ago1716966650
0x987644e0...5b58bE595
0.1977132 MATIC
575194512024-05-29 7:10:5021 hrs ago1716966650
0x987644e0...5b58bE595
0.1977132 MATIC
575185502024-05-29 6:38:5621 hrs ago1716964736
0x987644e0...5b58bE595
0.2166113 MATIC
575185502024-05-29 6:38:5621 hrs ago1716964736
0x987644e0...5b58bE595
0.2166113 MATIC
574964302024-05-28 17:10:0035 hrs ago1716916200
0x987644e0...5b58bE595
0.12587759 MATIC
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Taker

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 26 : Taker.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

import "../IExchange.sol";
import "../OrderLib.sol";
import "../TWAP.sol";

/**
 * Helper contract for TWAP takers
 * optionally swaps fee to native token at fill
 */
contract Taker is Ownable {
    using SafeERC20 for ERC20;

    TWAP public immutable twap;
    mapping(address => bool) public owners;

    constructor(TWAP _twap, address[] memory _owners) {
        twap = _twap;
        for (uint i = 0; i < _owners.length; i++) owners[_owners[i]] = true;
    }

    function addOwners(address[] memory _owners) external onlyOwner {
        for (uint i = 0; i < _owners.length; i++) owners[_owners[i]] = true;
    }

    function removeOwners(address[] memory _owners) external onlyOwner {
        for (uint i = 0; i < _owners.length; i++) owners[_owners[i]] = false;
    }

    /**
     * Perform bid
     */
    function bid(
        uint64 id,
        address exchange,
        uint256 dstFee,
        uint32 slippagePercent,
        bytes calldata data
    ) external onlyOwners {
        twap.bid(id, exchange, dstFee, slippagePercent, data);
    }

    /**
     * Execute the winning bid, optionally swap to native
     *
     * @param id OrderId
     * @param feeExchange optional IExchange address to swap for native token, can be 0
     * @param feeMinAmountOut optional native token minimum out, can be 0
     * @param feeData optional data to pass to feeExchange, can be empty
     */
    function fill(uint64 id, address feeExchange, uint256 feeMinAmountOut, bytes calldata feeData) external onlyOwners {
        twap.fill(id);
        OrderLib.Order memory o = twap.order(id);

        if (o.ask.dstToken != twap.iweth() && o.ask.dstToken != address(0) && feeExchange != address(0)) {
            uint256 dstAmount = ERC20(o.ask.dstToken).balanceOf(address(this));
            ERC20(o.ask.dstToken).safeIncreaseAllowance(feeExchange, dstAmount);
            IExchange(feeExchange).swap(o.ask.dstToken, twap.iweth(), dstAmount, feeMinAmountOut, o.ask.data, feeData);
        }

        rescue(o.ask.dstToken);
    }

    /**
     * Send all balance of token, wrapped native and native to sender
     */
    function rescue(address token) public onlyOwners {
        if (ERC20(twap.iweth()).balanceOf(address(this)) > 0) {
            IWETH(twap.iweth()).withdraw(ERC20(twap.iweth()).balanceOf(address(this)));
        }

        if (address(this).balance > 0) {
            Address.sendValue(payable(msg.sender), address(this).balance);
        }

        if (token != address(0) && ERC20(token).balanceOf(address(this)) > 0) {
            ERC20(token).safeTransfer(msg.sender, ERC20(token).balanceOf(address(this)));
        }
    }

    receive() external payable {} // solhint-disable-line no-empty-blocks

    modifier onlyOwners() {
        require(owners[msg.sender], "Taker:onlyOwners");
        _;
    }
}

File 1 of 26 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. 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 {
        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 1 of 26 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 1 of 26 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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.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.
 *
 * 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}.
     *
     * 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 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 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, allowance(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 = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `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.
     *
     * 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;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _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;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _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;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _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 Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * 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 1 of 26 : 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 1 of 26 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 1 of 26 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 1 of 26 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

    /**
     * @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.encodeWithSelector(token.transfer.selector, 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.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));
    }

    /**
     * @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);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

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

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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.isContract(address(token));
    }
}

File 1 of 26 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

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

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

File 1 of 26 : 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 1 of 26 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 1 of 26 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 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; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                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.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 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.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            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 (rounding == Rounding.Up && 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 down.
     *
     * 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 1 of 26 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 1 of 26 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 1 of 26 : OdosExchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";

import "../IExchange.sol";

/**
 * Adapter between Odos and TWAP's IExchange interface
 */
contract OdosExchange is IExchange {
    using SafeERC20 for ERC20;

    address public immutable odos;

    constructor(address _odos) {
        odos = _odos;
    }

    /**
     * data = amountOut, swap data from odos api
     */
    function getAmountOut(
        address,
        address,
        uint256,
        bytes calldata,
        bytes calldata bidData
    ) public pure returns (uint256 dstAmountOut) {
        (dstAmountOut, ) = decode(bidData);
    }

    /**
     * data = amountOut, swap data from odos api
     */
    function swap(
        address _srcToken,
        address _dstToken,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes calldata,
        bytes calldata bidData
    ) public {
        (, bytes memory swapdata) = decode(bidData);
        ERC20 srcToken = ERC20(_srcToken);
        ERC20 dstToken = ERC20(_dstToken);

        srcToken.safeTransferFrom(msg.sender, address(this), amountIn);
        amountIn = srcToken.balanceOf(address(this)); // support FoT tokens

        srcToken.safeIncreaseAllowance(odos, amountIn);
        Address.functionCall(odos, swapdata);

        uint256 balance = dstToken.balanceOf(address(this));
        require(balance >= amountOutMin, "OdosExchange:swap:amountOutMin");
        dstToken.safeTransfer(msg.sender, balance);
    }

    function decode(bytes calldata data) private pure returns (uint256 amountOut, bytes memory swapdata) {
        return abi.decode(data, (uint256, bytes));
    }
}

File 1 of 26 : OpenOceanExchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";

import "../IExchange.sol";

/**
 * Adapter between OpenOcean and TWAP's IExchange interface
 */
contract OpenOceanExchange is IExchange {
    using SafeERC20 for ERC20;

    address public immutable openocean;

    constructor(address _openocean) {
        openocean = _openocean;
    }

    /**
     * data = amountOut, swap data from OpenOcean api
     */
    function getAmountOut(
        address,
        address,
        uint256,
        bytes calldata,
        bytes calldata bidData
    ) public pure returns (uint256 dstAmountOut) {
        (dstAmountOut, ) = decode(bidData);
    }

    /**
     * data = amountOut, swap data from OpenOcean api
     */
    function swap(
        address _srcToken,
        address _dstToken,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes calldata,
        bytes calldata bidData
    ) public {
        (, bytes memory swapdata) = decode(bidData);
        ERC20 srcToken = ERC20(_srcToken);
        ERC20 dstToken = ERC20(_dstToken);

        srcToken.safeTransferFrom(msg.sender, address(this), amountIn);
        amountIn = srcToken.balanceOf(address(this)); // support FoT tokens

        srcToken.safeIncreaseAllowance(openocean, amountIn);
        Address.functionCall(openocean, swapdata);

        uint256 balance = dstToken.balanceOf(address(this));
        require(balance >= amountOutMin, "OOE:swap:amountOutMin");
        dstToken.safeTransfer(msg.sender, balance);
    }

    function decode(bytes calldata data) private pure returns (uint256 amountOut, bytes memory swapdata) {
        return abi.decode(data, (uint256, bytes));
    }
}

File 1 of 26 : PangolinDaasExchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "../IExchange.sol";

/**
 * Adapter between PangolinDAAS and TWAP's IExchange interface
 */
contract PangolinDaasExchange is IExchange {
    using SafeERC20 for ERC20;

    IPangolinDaas public immutable pangolin;

    constructor(address _pangolin) {
        pangolin = IPangolinDaas(_pangolin);
    }

    /**
     * askData = abi encoded: partnerDaas(address)
     * bidData = abi encoded: feeOnTransfer(bool), path(address[])
     */
    function getAmountOut(
        address srcToken,
        address dstToken,
        uint256 amountIn,
        bytes calldata askData,
        bytes calldata bidData
    ) public view returns (uint256 amountOut) {
        (address partnerDaas, , address[] memory path) = decode(askData, bidData);
        require(path[0] == srcToken && path[path.length - 1] == dstToken, "UE1");
        uint256 result = (pangolin.getAmountsOut(amountIn, path)[path.length - 1]);

        (, , uint24 feeTotal, , ) = pangolin.getFeeInfo(partnerDaas); // getAmountOut doesn't take the partner affiliate fee into account, which will be deducted when swapping
        return (result * (100_00 - feeTotal)) / 100_00;
    }

    /**
     * askData = abi encoded: partnerDaas(address)
     * bidData = abi encoded: feeOnTransfer(bool), path(address[])
     */
    function swap(
        address _srcToken,
        address,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes calldata askData,
        bytes calldata bidData
    ) public {
        (address partnerDaas, bool fotTokens, address[] memory path) = decode(askData, bidData);
        ERC20 srcToken = ERC20(_srcToken);

        srcToken.safeTransferFrom(msg.sender, address(this), amountIn);
        amountIn = srcToken.balanceOf(address(this)); // support FoT tokens

        srcToken.safeIncreaseAllowance(address(pangolin), amountIn);

        if (fotTokens) {
            pangolin.swapExactTokensForTokensSupportingFeeOnTransferTokens(
                amountIn,
                amountOutMin,
                path,
                msg.sender,
                block.timestamp,
                partnerDaas
            );
        } else {
            pangolin.swapExactTokensForTokens(amountIn, amountOutMin, path, msg.sender, block.timestamp, partnerDaas);
        }
    }

    function decode(
        bytes calldata askData,
        bytes calldata bidData
    ) private pure returns (address partnerDaas, bool fotTokens, address[] memory path) {
        (partnerDaas) = abi.decode(askData, (address));
        (fotTokens, path) = abi.decode(bidData, (bool, address[]));
    }
}

interface IPangolinDaas {
    function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);

    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline,
        address feeTo
    ) external returns (uint256[] memory amounts);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline,
        address feeTo
    ) external;

    function getFeeInfo(
        address feeTo
    ) external view returns (uint24 feePartner, uint24 feeProtocol, uint24 feeTotal, uint24 feeCut, bool initialized);
}

File 1 of 26 : ParaswapExchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";

import "../IExchange.sol";

/**
 * Adapter between IParaswap and TWAP's IExchange interface
 */
contract ParaswapExchange is IExchange {
    using SafeERC20 for ERC20;

    IParaswap public immutable paraswap;

    constructor(address _paraswap) {
        paraswap = IParaswap(_paraswap);
    }

    /**
     * data = amountOut, swap data from paraswap api
     */
    function getAmountOut(
        address,
        address,
        uint256,
        bytes calldata,
        bytes calldata bidData
    ) public pure returns (uint256 dstAmountOut) {
        (dstAmountOut, ) = decode(bidData);
    }

    /**
     * data = amountOut, swap data from paraswap api
     */
    function swap(
        address _srcToken,
        address _dstToken,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes calldata,
        bytes calldata bidData
    ) public {
        (, bytes memory swapdata) = decode(bidData);
        ERC20 srcToken = ERC20(_srcToken);
        ERC20 dstToken = ERC20(_dstToken);

        srcToken.safeTransferFrom(msg.sender, address(this), amountIn);
        amountIn = srcToken.balanceOf(address(this)); // support FoT tokens

        srcToken.safeIncreaseAllowance(paraswap.getTokenTransferProxy(), amountIn);
        Address.functionCall(address(paraswap), swapdata);

        uint256 balance = dstToken.balanceOf(address(this));
        require(balance >= amountOutMin, "PE1");
        dstToken.safeTransfer(msg.sender, balance);
    }

    function decode(bytes calldata data) private pure returns (uint256 amountOut, bytes memory swapdata) {
        return abi.decode(data, (uint256, bytes));
    }
}

/**
 * Augustus Swapper
 * Paraswap main exchange interface
 */
interface IParaswap {
    function getTokenTransferProxy() external view returns (address);
}

File 1 of 26 : UniswapV2Exchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "../IExchange.sol";

/**
 * Adapter between IUniswapV2 and TWAP's IExchange interface
 */
contract UniswapV2Exchange is IExchange {
    using SafeERC20 for ERC20;

    IUniswapV2 public immutable uniswap;

    constructor(address _uniswap) {
        uniswap = IUniswapV2(_uniswap);
    }

    /**
     * data = abi encoded: feeOnTransfer(bool), path(address[])
     */
    function getAmountOut(
        address srcToken,
        address dstToken,
        uint256 amountIn,
        bytes calldata,
        bytes calldata bidData
    ) public view returns (uint256 amountOut) {
        (, address[] memory path) = decode(bidData);
        require(path[0] == srcToken && path[path.length - 1] == dstToken, "UE1");
        return uniswap.getAmountsOut(amountIn, path)[path.length - 1];
    }

    /**
     * data = abi encoded: feeOnTransfer(bool), path(address[])
     */
    function swap(
        address _srcToken,
        address,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes calldata,
        bytes calldata bidData
    ) public {
        (bool fotTokens, address[] memory path) = decode(bidData);
        ERC20 srcToken = ERC20(_srcToken);

        srcToken.safeTransferFrom(msg.sender, address(this), amountIn);
        amountIn = srcToken.balanceOf(address(this)); // support FoT tokens

        srcToken.safeIncreaseAllowance(address(uniswap), amountIn);

        if (fotTokens) {
            uniswap.swapExactTokensForTokensSupportingFeeOnTransferTokens(
                amountIn,
                amountOutMin,
                path,
                msg.sender,
                block.timestamp
            );
        } else {
            uniswap.swapExactTokensForTokens(amountIn, amountOutMin, path, msg.sender, block.timestamp);
        }
    }

    function decode(bytes calldata data) private pure returns (bool fotTokens, address[] memory path) {
        (fotTokens, path) = abi.decode(data, (bool, address[]));
    }
}

interface IUniswapV2 {
    function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);

    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;
}

File 1 of 26 : IExchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "./OrderLib.sol";

/**
 * Adapter between TWAP and exchange implementations
 */
interface IExchange {
    /**
     * Returns actual output amount after fees and price impact
     */
    function getAmountOut(
        address srcToken,
        address dstToken,
        uint256 amountIn,
        bytes calldata askData,
        bytes calldata bidData
    ) external view returns (uint256 amountOut);

    /**
     * Swaps amountIn to amount out using abi encoded data (can either be path or more complex data)
     */
    function swap(
        address srcToken,
        address dstToken,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes calldata askData,
        bytes calldata bidData
    ) external;
}

File 1 of 26 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface IWETH {
    function withdraw(uint256 wad) external;
}

File 1 of 26 : OrderLib.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/utils/math/Math.sol";

library OrderLib {
    struct Order {
        uint64 id; // order id
        uint32 status; // status: deadline, canceled or completed
        uint32 time; // order creation timestamp
        uint32 filledTime; // last fill timestamp
        uint256 srcFilledAmount; // srcToken total filled amount
        address maker; // order creator
        Ask ask; // order ask parameters
        Bid bid; // current winning bid
    }

    struct Ask {
        address exchange; // restirct swap to this exchange, or zero address for any exchange
        address srcToken; // input token
        address dstToken; // output token
        uint256 srcAmount; // input total order amount
        uint256 srcBidAmount; // input chunk size
        uint256 dstMinAmount; // minimum output chunk size
        uint32 deadline; // order duration timestamp
        uint32 bidDelay; // minimum delay in seconds before a bid can be filled
        uint32 fillDelay; // minimum delay in seconds between chunks
        bytes data; // optional swap data for exchange
    }

    struct Bid {
        uint32 time; // bid creation timestamp
        address taker; // bidder
        address exchange; // execute bid on this exchange, never zero
        uint256 dstAmount; // dstToken actual output amount for this bid after exchange fees, taker fee and slippage
        uint256 dstFee; // dstToken requested by taker for performing the bid and fill
        bytes data; // optional additional swap data for exchange
    }

    /**
     * new Order for msg.sender
     */
    function newOrder(uint64 id, Ask calldata ask) internal view returns (Order memory) {
        require(
            block.timestamp < type(uint32).max &&
                ask.deadline < type(uint32).max &&
                ask.bidDelay < type(uint32).max &&
                ask.fillDelay < type(uint32).max,
            "uint32"
        );
        return
            Order(
                id,
                ask.deadline, // status
                uint32(block.timestamp), // time
                0, // filledTime
                0, // srcFilledAmount
                msg.sender, // maker
                ask,
                Bid(
                    0, // time
                    address(0), // taker
                    address(0), // exchange
                    0, // dstAmount
                    0, // dstFee
                    new bytes(0) // data
                )
            );
    }

    /**
     * new Bid
     */
    function newBid(
        Order memory self,
        address exchange,
        uint256 dstAmountOut,
        uint256 dstFee,
        bytes memory data
    ) internal view {
        require(block.timestamp < type(uint32).max, "uint32");
        self.bid = OrderLib.Bid(uint32(block.timestamp), msg.sender, exchange, dstAmountOut, dstFee, data);
    }

    /**
     * chunk filled
     */
    function filled(Order memory self, uint256 srcAmountIn) internal view {
        require(block.timestamp < type(uint32).max, "uint32");
        delete self.bid;
        self.filledTime = uint32(block.timestamp);
        self.srcFilledAmount += srcAmountIn;
    }

    /**
     * next chunk srcToken: either ask.srcBidAmount or leftover
     */
    function srcBidAmountNext(Order memory self) internal pure returns (uint256) {
        return Math.min(self.ask.srcBidAmount, self.ask.srcAmount - self.srcFilledAmount);
    }

    /**
     * next chunk dstToken minimum amount out
     */
    function dstMinAmountNext(Order memory self) internal pure returns (uint256) {
        return (self.ask.dstMinAmount * srcBidAmountNext(self)) / self.ask.srcBidAmount;
    }

    /**
     * next chunk expected output in dstToken, or winning bid, to be sent to maker (after fees)
     */
    function dstExpectedOutNext(Order memory self) internal pure returns (uint256) {
        return Math.max(self.bid.dstAmount, dstMinAmountNext(self));
    }
}

File 1 of 26 : Lens.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/Address.sol";

import "../OrderLib.sol";
import "../TWAP.sol";

/**
 * Helper contract to allow for efficient paginated filtered reads of Orders, instead of relying on events
 */
contract Lens {
    using OrderLib for OrderLib.Order;

    TWAP public immutable twap;

    constructor(TWAP _twap) {
        twap = _twap;
    }

    function length() public view returns (uint64) {
        return twap.length();
    }

    function makerOrders(address maker) external view returns (OrderLib.Order[] memory result) {
        uint64[] memory orderIds = twap.orderIdsByMaker(maker);

        result = new OrderLib.Order[](orderIds.length);
        for (uint64 i = 0; i < result.length; i++) {
            uint64 id = orderIds[i];
            result[i] = twap.order(id);
        }
    }

    /**
     * returns all orders waiting to be bid on now by the taker, paginated
     * taker: desired taker
     * lastIndex: last order id, start with length-1
     * pageSize: size of iteration restricted by block gas limit. 2500 is measured to be < 15m gas
     */
    function takerBiddableOrders(
        address taker,
        uint64 lastIndex,
        uint64 pageSize
    ) external view returns (OrderLib.Order[] memory result) {
        OrderLib.Order[] memory orders = paginated(lastIndex, pageSize);
        uint64 count = 0;

        for (uint64 i = 0; i < orders.length; i++) {
            uint64 id = lastIndex - i;
            if (block.timestamp < twap.status(id)) {
                OrderLib.Order memory o = twap.order(id);
                if (
                    block.timestamp > o.filledTime + o.ask.fillDelay && // after fill delay
                    (o.bid.taker != taker || block.timestamp > o.bid.time + twap.STALE_BID_SECONDS()) && // other taker or stale bid
                    ERC20(o.ask.srcToken).allowance(o.maker, address(twap)) >= o.srcBidAmountNext() && // maker allowance
                    ERC20(o.ask.srcToken).balanceOf(o.maker) >= o.srcBidAmountNext() // maker balance
                ) {
                    orders[count] = o;
                    count++;
                }
            }
        }

        result = new OrderLib.Order[](count);
        for (uint64 i = 0; i < count; i++) {
            result[i] = orders[i];
        }
    }

    /**
     * returns all orders waiting to be filled now by the taker, paginated
     * taker: desired taker
     * lastIndex: last order id, start with length-1
     * pageSize: size of iteration restricted by block gas limit. 2500 is measured to be < 15m gas
     */
    function takerFillableOrders(
        address taker,
        uint64 lastIndex,
        uint64 pageSize
    ) external view returns (OrderLib.Order[] memory result) {
        OrderLib.Order[] memory orders = paginated(lastIndex, pageSize);
        uint64 count = 0;

        for (uint64 i = 0; i < orders.length; i++) {
            uint64 id = lastIndex - i;
            if (block.timestamp < twap.status(id)) {
                OrderLib.Order memory o = twap.order(id);
                if (
                    o.bid.taker == taker && // winning taker
                    block.timestamp > o.bid.time + o.ask.bidDelay && // after bid delay
                    ERC20(o.ask.srcToken).allowance(o.maker, address(twap)) >= o.srcBidAmountNext() && // maker allowance
                    ERC20(o.ask.srcToken).balanceOf(o.maker) >= o.srcBidAmountNext() // maker balance
                ) {
                    orders[count] = o;
                    count++;
                }
            }
        }

        result = new OrderLib.Order[](count);
        for (uint64 i = 0; i < count; i++) {
            result[i] = orders[i];
        }
    }

    function paginated(uint64 lastIndex, uint64 pageSize) private view returns (OrderLib.Order[] memory) {
        require(lastIndex < length(), "lastIndex");
        return new OrderLib.Order[](Math.min(lastIndex + 1, pageSize));
    }
}

File 2 of 26 : MockDeflationaryToken.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

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

/**
 * Burns 10% of every transfer
 */
contract MockDeflationaryToken is ERC20("MockDeflationaryToken", "MDT") {
    constructor() {
        _mint(msg.sender, 100e18);
    }

    function _afterTokenTransfer(address from, address to, uint256 amount) internal override {
        if (from != address(0) && to != address(0)) {
            _burn(to, amount / 10);
        }
    }
}

File 2 of 26 : MockExchange.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "../IExchange.sol";

contract MockExchange is IExchange {
    using SafeERC20 for ERC20;

    uint256[] public amounts;

    function setMockAmounts(uint256[] memory _amounts) public {
        amounts = _amounts;
    }

    function getAmountOut(address, address, uint256, bytes calldata, bytes calldata) public view returns (uint256) {
        return amounts[amounts.length - 1];
    }

    /**
     * assumes holds balance of dstToken
     */
    function swap(
        address _srcToken,
        address _dstToken,
        uint256 amountIn,
        uint256,
        bytes calldata,
        bytes calldata
    ) public {
        ERC20 srcToken = ERC20(_srcToken);
        ERC20 dstToken = ERC20(_dstToken);
        srcToken.safeTransferFrom(msg.sender, address(this), amountIn);

        uint256 amountOut = amounts[amounts.length - 1];
        dstToken.safeTransfer(msg.sender, amountOut);
    }
}

File 2 of 26 : TWAP.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./OrderLib.sol";
import "./IExchange.sol";
import "./IWETH.sol";

/**
 * ---------------------------
 * Time-Weighted Average Price
 * ---------------------------
 *
 * https://github.com/orbs-network/twap
 *
 * This smart contract allows the incentivized execution of a TWAP order (either a Limit Order or a Market Order) on any DEX, with the possibility of partial fills.
 *
 * A TWAP order breaks a larger order down into smaller trades or "chunks", which are executed over a set period of time.
 * This is a common strategy in traditional finance but it was not previously possible to execute such trades in a decentralized manner in DeFi systems.
 *
 * In this smart contract, users (makers) create orders that wait in the contract to be filled. Once made, these orders enable an English Auction bidding war on each chunk at its time interval.
 * Anyone willing to participate can serve as a “taker” by finding the best path to fill the order for the next chunk on any DEX,
 * within the parameters set by the maker. Takers submit these paths as a bid to the contract, which selects the winner based on criteria described in detail below.
 *
 * The winning taker receives a portion of the output tokens as a reward for their effort.
 *
 * One honest taker (i.e., a taker who is willing to set the fee at the minimum amount needed to cover gas costs)
 * is enough to ensure the entire system functions effectively at spot prices.
 *
 * The contract is set to operate only up to the year 2106 (32bit timestamps), at which point it will no longer be usable.
 *
 * The TWAP Smart Contract does not hold any funds, has no owners, administrators, or other roles and is entirely immutable once deployed on an EVM blockchain.
 *
 */
contract TWAP is ReentrancyGuard {
    using SafeERC20 for ERC20;
    using Address for address;
    using OrderLib for OrderLib.Order;

    uint8 public constant VERSION = 4;

    event OrderCreated(uint64 indexed id, address indexed maker, address indexed exchange, OrderLib.Ask ask);
    event OrderBid(
        uint64 indexed id,
        address indexed maker,
        address indexed exchange,
        uint32 slippagePercent,
        OrderLib.Bid bid
    );
    event OrderFilled(
        uint64 indexed id,
        address indexed maker,
        address indexed exchange,
        address taker,
        uint256 srcAmountIn,
        uint256 dstAmountOut,
        uint256 dstFee,
        uint256 srcFilledAmount
    );
    event OrderCompleted(uint64 indexed id, address indexed maker, address indexed exchange, address taker);
    event OrderCanceled(uint64 indexed id, address indexed maker, address sender);

    uint32 public constant PERCENT_BASE = 100_000;
    uint32 public constant MIN_OUTBID_PERCENT = 101_000;
    uint32 public constant STALE_BID_SECONDS = 60 * 10;
    uint32 public constant MIN_BID_DELAY_SECONDS = 30;

    uint32 public constant STATUS_CANCELED = 1;
    uint32 public constant STATUS_COMPLETED = 2;

    OrderLib.Order[] public book;
    uint32[] public status; // STATUS or deadline timestamp by order id, used for gas efficient order filtering
    mapping(address => uint64[]) public makerOrders;

    address public immutable iweth;

    constructor(address _iweth) {
        iweth = _iweth;
    }

    // -------- views --------

    /**
     * returns Order by order id
     */
    function order(uint64 id) public view returns (OrderLib.Order memory) {
        require(id < length(), "invalid id");
        return book[id];
    }

    /**
     * returns order book length
     */
    function length() public view returns (uint64) {
        return uint64(book.length);
    }

    function orderIdsByMaker(address maker) external view returns (uint64[] memory) {
        return makerOrders[maker];
    }

    // -------- actions --------

    /**
     * Create Order by msg.sender (maker)
     *
     * returns order id, emits OrderCreated
     */
    function ask(OrderLib.Ask calldata _ask) external nonReentrant returns (uint64 id) {
        require(
            _ask.srcToken != address(0) &&
                _ask.srcToken != _ask.dstToken &&
                (_ask.srcToken != iweth || _ask.dstToken != address(0)) &&
                _ask.srcAmount > 0 &&
                _ask.srcBidAmount > 0 &&
                _ask.srcBidAmount <= _ask.srcAmount &&
                _ask.dstMinAmount > 0 &&
                _ask.deadline > block.timestamp &&
                _ask.bidDelay >= MIN_BID_DELAY_SECONDS,
            "params"
        );

        OrderLib.Order memory o = OrderLib.newOrder(length(), _ask);
        verifyMakerBalance(o);

        book.push(o);
        status.push(o.status);
        makerOrders[msg.sender].push(o.id);
        emit OrderCreated(o.id, o.maker, o.ask.exchange, o.ask);
        return o.id;
    }

    /**
     * Bid for a specific order by id (msg.sender is taker)
     * A valid bid is higher than current bid, with sufficient price after fees and after last fill delay. Invalid bids are reverted.
     * id: order id
     * exchange: bid to swap on exchange
     * dstFee: fee to traker in dstToken, taken from the swapped amount
     * slippagePercent: price output difference tolerance percent / 100,000. 0 means no slippage
     * data: swap data to pass to the exchange, for example the route path
     * emits OrderBid event
     */
    function bid(
        uint64 id,
        address exchange,
        uint256 dstFee,
        uint32 slippagePercent,
        bytes calldata data
    ) external nonReentrant {
        require(exchange != address(0) && slippagePercent < PERCENT_BASE, "params");
        OrderLib.Order memory o = order(id);
        uint256 dstAmountOut = verifyBid(o, exchange, dstFee, slippagePercent, data);
        o.newBid(exchange, dstAmountOut, dstFee, data);
        book[id] = o;
        emit OrderBid(o.id, o.maker, exchange, slippagePercent, o.bid);
    }

    /**
     * Fill the current winning bid by the winning taker, if after the bidding window. Invalid fills are reverted.
     * id: order id
     * emits OrderFilled
     * if order is fully filled emits OrderCompleted and status is updated
     */
    function fill(uint64 id) external nonReentrant {
        OrderLib.Order memory o = order(id);

        (address exchange, uint256 srcAmountIn, uint256 dstAmountOut, uint256 dstFee) = performFill(o);
        o.filled(srcAmountIn);

        emit OrderFilled(id, o.maker, exchange, msg.sender, srcAmountIn, dstAmountOut, dstFee, o.srcFilledAmount);

        if (o.srcBidAmountNext() == 0) {
            status[id] = STATUS_COMPLETED;
            o.status = STATUS_COMPLETED;
            emit OrderCompleted(o.id, o.maker, exchange, msg.sender);
        }
        book[id] = o;
    }

    /**
     * Cancel order by id, only callable by maker
     * id: order id
     * emits OrderCanceled
     */
    function cancel(uint64 id) external nonReentrant {
        OrderLib.Order memory o = order(id);
        require(msg.sender == o.maker, "maker");
        status[id] = STATUS_CANCELED;
        o.status = STATUS_CANCELED;
        book[id] = o;
        emit OrderCanceled(o.id, o.maker, msg.sender);
    }

    /**
     * Called by anyone to mark a stale invalid order as canceled
     * id: order id
     * emits OrderCanceled
     */
    function prune(uint64 id) external nonReentrant {
        OrderLib.Order memory o = order(id);
        require(block.timestamp < o.status, "status");
        require(block.timestamp > o.filledTime + o.ask.fillDelay, "fill delay");
        require(
            ERC20(o.ask.srcToken).allowance(o.maker, address(this)) < o.srcBidAmountNext() ||
                ERC20(o.ask.srcToken).balanceOf(o.maker) < o.srcBidAmountNext(),
            "valid"
        );
        status[id] = STATUS_CANCELED;
        o.status = STATUS_CANCELED;
        book[id] = o;
        emit OrderCanceled(o.id, o.maker, msg.sender);
    }

    /**
     * ---- internals ----
     */

    /**
     * verifies the bid against the ask params, reverts on invalid bid.
     * returns dstAmountOut after taker dstFee, which must be higher than any previous bid, unless previous bid is stale
     */
    function verifyBid(
        OrderLib.Order memory o,
        address exchange,
        uint256 dstFee,
        uint32 slippagePercent,
        bytes calldata data
    ) private view returns (uint256 dstAmountOut) {
        require(block.timestamp < o.status, "status"); // deadline, canceled or completed
        require(block.timestamp > o.filledTime + o.ask.fillDelay, "fill delay");
        require(o.ask.exchange == address(0) || o.ask.exchange == exchange, "exchange");

        dstAmountOut = IExchange(exchange).getAmountOut(
            o.ask.srcToken,
            _dstToken(o),
            o.srcBidAmountNext(),
            o.ask.data,
            data
        );
        dstAmountOut -= (dstAmountOut * slippagePercent) / PERCENT_BASE;
        dstAmountOut -= dstFee;

        require(
            dstAmountOut > (o.bid.dstAmount * MIN_OUTBID_PERCENT) / PERCENT_BASE || // outbid by more than MIN_OUTBID_PERCENT
                block.timestamp > o.bid.time + STALE_BID_SECONDS, // or stale bid
            "low bid"
        );
        require(dstAmountOut >= o.dstMinAmountNext(), "min out");
        verifyMakerBalance(o);
    }

    /**
     * executes the winning bid. reverts if bid no longer valid.
     * transfers next chunk srcToken amount from maker, swaps via bid exchange with bid data, transfers dstFee to taker (msg.sender) and
     * transfers all other dstToken amount to maker
     */
    function performFill(
        OrderLib.Order memory o
    ) private returns (address exchange, uint256 srcAmountIn, uint256 dstAmountOut, uint256 dstFee) {
        require(msg.sender == o.bid.taker, "taker");
        require(block.timestamp < o.status, "status"); // deadline, canceled or completed
        require(block.timestamp > o.bid.time + o.ask.bidDelay, "bid delay");

        exchange = o.bid.exchange;
        dstFee = o.bid.dstFee;
        srcAmountIn = o.srcBidAmountNext();
        uint256 minOut = o.dstExpectedOutNext();

        ERC20(o.ask.srcToken).safeTransferFrom(o.maker, address(this), srcAmountIn);
        srcAmountIn = ERC20(o.ask.srcToken).balanceOf(address(this)); // support FoT tokens
        ERC20(o.ask.srcToken).safeIncreaseAllowance(exchange, srcAmountIn);

        IExchange(exchange).swap(o.ask.srcToken, _dstToken(o), srcAmountIn, minOut + dstFee, o.ask.data, o.bid.data);

        dstAmountOut = ERC20(_dstToken(o)).balanceOf(address(this)); // support FoT tokens
        dstAmountOut -= dstFee;
        require(dstAmountOut >= minOut, "min out");

        if (o.ask.dstToken == address(0)) {
            IWETH(iweth).withdraw(ERC20(iweth).balanceOf(address(this)));
            Address.sendValue(payable(o.bid.taker), dstFee);
            Address.sendValue(payable(o.maker), dstAmountOut);
        } else {
            ERC20(_dstToken(o)).safeTransfer(o.bid.taker, dstFee);
            ERC20(_dstToken(o)).safeTransfer(o.maker, dstAmountOut);
        }
    }

    /**
     * reverts if maker does not hold enough balance srcToken or allowance to be spent here for the next chunk
     */
    function verifyMakerBalance(OrderLib.Order memory o) private view {
        require(ERC20(o.ask.srcToken).allowance(o.maker, address(this)) >= o.srcBidAmountNext(), "maker allowance");
        require(ERC20(o.ask.srcToken).balanceOf(o.maker) >= o.srcBidAmountNext(), "maker balance");
    }

    function _dstToken(OrderLib.Order memory o) private view returns (address) {
        return o.ask.dstToken == address(0) ? iweth : o.ask.dstToken;
    }

    receive() external payable {} // solhint-disable-line no-empty-blocks
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract TWAP","name":"_twap","type":"address"},{"internalType":"address[]","name":"_owners","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address[]","name":"_owners","type":"address[]"}],"name":"addOwners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"bid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"address","name":"feeExchange","type":"address"},{"internalType":"uint256","name":"feeMinAmountOut","type":"uint256"},{"internalType":"bytes","name":"feeData","type":"bytes"}],"name":"fill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"owners","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_owners","type":"address[]"}],"name":"removeOwners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"twap","outputs":[{"internalType":"contract TWAP","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b5060405162001c7e38038062001c7e833981016040819052620000349162000154565b6200003f33620000c3565b6001600160a01b03821660805260005b8151811015620000ba5760018060008484815181106200007357620000736200023f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580620000b18162000255565b9150506200004f565b5050506200027d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200012957600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b80516200014f8162000113565b919050565b600080604083850312156200016857600080fd5b8251620001758162000113565b602084810151919350906001600160401b03808211156200019557600080fd5b818601915086601f830112620001aa57600080fd5b815181811115620001bf57620001bf6200012c565b8060051b604051601f19603f83011681018181108582111715620001e757620001e76200012c565b6040529182528482019250838101850191898311156200020657600080fd5b938501935b828510156200022f576200021f8562000142565b845293850193928501926200020b565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6000600182016200027657634e487b7160e01b600052601160045260246000fd5b5060010190565b6080516119ae620002d06000396000818160f80152818161027d015281816103010152818161037d015281816104fd015281816106b4015281816107a6015281816108360152610bb401526119ae6000f3fe6080604052600436106100955760003560e01c8063839006f211610059578063839006f2146101895780638da5cb5b146101a9578063a9a5e3af146101c7578063f2fde38b146101e7578063f58e65b81461020757600080fd5b8063022914a7146100a15780631208aa18146100e65780631a07dd1c146101325780636c46a2c514610154578063715018a61461017457600080fd5b3661009c57005b600080fd5b3480156100ad57600080fd5b506100d16100bc366004611185565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156100f257600080fd5b5061011a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100dd565b34801561013e57600080fd5b5061015261014d366004611206565b610227565b005b34801561016057600080fd5b5061015261016f36600461130a565b6105fa565b34801561018057600080fd5b5061015261066d565b34801561019557600080fd5b506101526101a4366004611185565b610681565b3480156101b557600080fd5b506000546001600160a01b031661011a565b3480156101d357600080fd5b506101526101e236600461130a565b610a88565b3480156101f357600080fd5b50610152610202366004611185565b610af8565b34801561021357600080fd5b506101526102223660046113cd565b610b6e565b3360009081526001602052604090205460ff1661025f5760405162461bcd60e51b815260040161025690611451565b60405180910390fd5b604051630a5d165160e31b81526001600160401b03861660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906352e8b28890602401600060405180830381600087803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b505060405163a0b94e0b60e01b81526001600160401b0388166004820152600092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063a0b94e0b90602401600060405180830381865afa158015610351573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261037991908101906116b0565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fd91906117a0565b6001600160a01b03168160c00151604001516001600160a01b031614158015610436575060c0810151604001516001600160a01b031615155b801561044a57506001600160a01b03851615155b156105e15760c081015160409081015190516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561049f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c391906117bd565b60c0830151604001519091506104e3906001600160a01b03168783610c2d565b856001600160a01b031663b1c972ad8360c00151604001517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610559573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057d91906117a0565b84898760c0015161012001518a8a6040518863ffffffff1660e01b81526004016105ad979695949392919061182b565b600060405180830381600087803b1580156105c757600080fd5b505af11580156105db573d6000803e3d6000fd5b50505050505b6105f28160c0015160400151610681565b505050505050565b610602610d13565b60005b815181101561066957600180600084848151811061062557610625611886565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610661816118b2565b915050610605565b5050565b610675610d13565b61067f6000610d6d565b565b3360009081526001602052604090205460ff166106b05760405162461bcd60e51b815260040161025690611451565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610710573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073491906117a0565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa15801561077a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079e91906117bd565b1115610971577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610802573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082691906117a0565b6001600160a01b0316632e1a7d4d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610892573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b691906117a0565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156108fc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092091906117bd565b6040518263ffffffff1660e01b815260040161093e91815260200190565b600060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b505050505b4715610981576109813347610dbd565b6001600160a01b03811615801590610a0157506040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff91906117bd565b115b15610a85576040516370a0823160e01b8152306004820152610a859033906001600160a01b038416906370a0823190602401602060405180830381865afa158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7491906117bd565b6001600160a01b0384169190610edb565b50565b610a90610d13565b60005b815181101561066957600060016000848481518110610ab457610ab4611886565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610af0816118b2565b915050610a93565b610b00610d13565b6001600160a01b038116610b655760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610256565b610a8581610d6d565b3360009081526001602052604090205460ff16610b9d5760405162461bcd60e51b815260040161025690611451565b604051631eb1ccb760e31b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f58e65b890610bf3908990899089908990899089906004016118cb565b600060405180830381600087803b158015610c0d57600080fd5b505af1158015610c21573d6000803e3d6000fd5b50505050505050505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015610c7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca191906117bd565b9050610d0d8463095ea7b360e01b85610cba868661190e565b6040516001600160a01b03909216602483015260448201526064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610f0b565b50505050565b6000546001600160a01b0316331461067f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610256565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80471015610e0d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610256565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e5a576040519150601f19603f3d011682016040523d82523d6000602084013e610e5f565b606091505b5050905080610ed65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610256565b505050565b6040516001600160a01b038316602482015260448101829052610ed690849063a9059cbb60e01b90606401610cd6565b6000610f60826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610fe09092919063ffffffff16565b9050805160001480610f81575080806020019051810190610f819190611927565b610ed65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610256565b6060610fef8484600085610ff7565b949350505050565b6060824710156110585760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610256565b600080866001600160a01b031685876040516110749190611949565b60006040518083038185875af1925050503d80600081146110b1576040519150601f19603f3d011682016040523d82523d6000602084013e6110b6565b606091505b50915091506110c7878383876110d2565b979650505050505050565b6060831561114157825160000361113a576001600160a01b0385163b61113a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610256565b5081610fef565b610fef83838151156111565781518083602001fd5b8060405162461bcd60e51b81526004016102569190611965565b6001600160a01b0381168114610a8557600080fd5b60006020828403121561119757600080fd5b81356111a281611170565b9392505050565b6001600160401b0381168114610a8557600080fd5b60008083601f8401126111d057600080fd5b5081356001600160401b038111156111e757600080fd5b6020830191508360208285010111156111ff57600080fd5b9250929050565b60008060008060006080868803121561121e57600080fd5b8535611229816111a9565b9450602086013561123981611170565b93506040860135925060608601356001600160401b0381111561125b57600080fd5b611267888289016111be565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b03811182821017156112b1576112b1611278565b60405290565b60405161010081016001600160401b03811182821017156112b1576112b1611278565b604051601f8201601f191681016001600160401b038111828210171561130257611302611278565b604052919050565b6000602080838503121561131d57600080fd5b82356001600160401b038082111561133457600080fd5b818501915085601f83011261134857600080fd5b81358181111561135a5761135a611278565b8060051b915061136b8483016112da565b818152918301840191848101908884111561138557600080fd5b938501935b838510156113af578435925061139f83611170565b828252938501939085019061138a565b98975050505050505050565b63ffffffff81168114610a8557600080fd5b60008060008060008060a087890312156113e657600080fd5b86356113f1816111a9565b9550602087013561140181611170565b9450604087013593506060870135611418816113bb565b925060808701356001600160401b0381111561143357600080fd5b61143f89828a016111be565b979a9699509497509295939492505050565b60208082526010908201526f54616b65723a6f6e6c794f776e65727360801b604082015260600190565b8051611486816111a9565b919050565b8051611486816113bb565b805161148681611170565b60005b838110156114bc5781810151838201526020016114a4565b50506000910152565b600082601f8301126114d657600080fd5b81516001600160401b038111156114ef576114ef611278565b611502601f8201601f19166020016112da565b81815284602083860101111561151757600080fd5b610fef8260208301602087016114a1565b6000610140828403121561153b57600080fd5b61154361128e565b905061154e82611496565b815261155c60208301611496565b602082015261156d60408301611496565b6040820152606082015160608201526080820151608082015260a082015160a082015261159c60c0830161148b565b60c08201526115ad60e0830161148b565b60e08201526101006115c081840161148b565b90820152610120828101516001600160401b038111156115df57600080fd5b6115eb858286016114c5565b82840152505092915050565b600060c0828403121561160957600080fd5b60405160c081016001600160401b03828210818311171561162c5761162c611278565b8160405282935084519150611640826113bb565b90825260208401519061165282611170565b8160208401526040850151915061166882611170565b816040840152606085015160608401526080850151608084015260a085015191508082111561169657600080fd5b506116a3858286016114c5565b60a0830152505092915050565b6000602082840312156116c257600080fd5b81516001600160401b03808211156116d957600080fd5b9083019061010082860312156116ee57600080fd5b6116f66112b7565b6116ff8361147b565b815261170d6020840161148b565b602082015261171e6040840161148b565b604082015261172f6060840161148b565b60608201526080830151608082015261174a60a08401611496565b60a082015260c08301518281111561176157600080fd5b61176d87828601611528565b60c08301525060e08301518281111561178557600080fd5b611791878286016115f7565b60e08301525095945050505050565b6000602082840312156117b257600080fd5b81516111a281611170565b6000602082840312156117cf57600080fd5b5051919050565b600081518084526117ee8160208601602086016114a1565b601f01601f19169290920160200192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03888116825287166020820152604081018690526060810185905260c060808201819052600090611865908301866117d6565b82810360a0840152611878818587611802565b9a9950505050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016118c4576118c461189c565b5060010190565b6001600160401b038716815260018060a01b038616602082015284604082015263ffffffff8416606082015260a0608082015260006113af60a083018486611802565b808201808211156119215761192161189c565b92915050565b60006020828403121561193957600080fd5b815180151581146111a257600080fd5b6000825161195b8184602087016114a1565b9190910192915050565b6020815260006111a260208301846117d656fea264697066735822122028a131167b694f11a2957825d90753306f0ba2969cee7f6fcdacf4461a28082564736f6c63430008100033000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000c225419d61899b6409265f6d50220b9437b5916e00000000000000000000000054447b419e5957c25d2cd54ec5252c83ea6d9d300000000000000000000000006f41ca53293e46b84c9531bd9036156dd5422aae000000000000000000000000154c7d38b10d8ec1bf9b4e8e671b557da6f9e52b00000000000000000000000061012d81ef857a10698bf003e3769d1c22b2b12f000000000000000000000000cec082e944102e234469b2f72c3c303df2a1c12a00000000000000000000000035b78535f6d5da0d250b08dd540fee5137faad3700000000000000000000000025942b1a17615d91a7ccd2e8e3f9ae9810fcd6d2000000000000000000000000d76910c423fa54467f88814ae50b7ba190c7f25f00000000000000000000000001584cec3546e73116f75b6ca0075e38696a5710

Deployed Bytecode

0x6080604052600436106100955760003560e01c8063839006f211610059578063839006f2146101895780638da5cb5b146101a9578063a9a5e3af146101c7578063f2fde38b146101e7578063f58e65b81461020757600080fd5b8063022914a7146100a15780631208aa18146100e65780631a07dd1c146101325780636c46a2c514610154578063715018a61461017457600080fd5b3661009c57005b600080fd5b3480156100ad57600080fd5b506100d16100bc366004611185565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156100f257600080fd5b5061011a7f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc081565b6040516001600160a01b0390911681526020016100dd565b34801561013e57600080fd5b5061015261014d366004611206565b610227565b005b34801561016057600080fd5b5061015261016f36600461130a565b6105fa565b34801561018057600080fd5b5061015261066d565b34801561019557600080fd5b506101526101a4366004611185565b610681565b3480156101b557600080fd5b506000546001600160a01b031661011a565b3480156101d357600080fd5b506101526101e236600461130a565b610a88565b3480156101f357600080fd5b50610152610202366004611185565b610af8565b34801561021357600080fd5b506101526102223660046113cd565b610b6e565b3360009081526001602052604090205460ff1661025f5760405162461bcd60e51b815260040161025690611451565b60405180910390fd5b604051630a5d165160e31b81526001600160401b03861660048201527f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc06001600160a01b0316906352e8b28890602401600060405180830381600087803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b505060405163a0b94e0b60e01b81526001600160401b0388166004820152600092507f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc06001600160a01b0316915063a0b94e0b90602401600060405180830381865afa158015610351573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261037991908101906116b0565b90507f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc06001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fd91906117a0565b6001600160a01b03168160c00151604001516001600160a01b031614158015610436575060c0810151604001516001600160a01b031615155b801561044a57506001600160a01b03851615155b156105e15760c081015160409081015190516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561049f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c391906117bd565b60c0830151604001519091506104e3906001600160a01b03168783610c2d565b856001600160a01b031663b1c972ad8360c00151604001517f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc06001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610559573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057d91906117a0565b84898760c0015161012001518a8a6040518863ffffffff1660e01b81526004016105ad979695949392919061182b565b600060405180830381600087803b1580156105c757600080fd5b505af11580156105db573d6000803e3d6000fd5b50505050505b6105f28160c0015160400151610681565b505050505050565b610602610d13565b60005b815181101561066957600180600084848151811061062557610625611886565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610661816118b2565b915050610605565b5050565b610675610d13565b61067f6000610d6d565b565b3360009081526001602052604090205460ff166106b05760405162461bcd60e51b815260040161025690611451565b60007f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc06001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610710573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073491906117a0565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa15801561077a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079e91906117bd565b1115610971577f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc06001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610802573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082691906117a0565b6001600160a01b0316632e1a7d4d7f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc06001600160a01b031663c11a463d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610892573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b691906117a0565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156108fc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092091906117bd565b6040518263ffffffff1660e01b815260040161093e91815260200190565b600060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b505050505b4715610981576109813347610dbd565b6001600160a01b03811615801590610a0157506040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff91906117bd565b115b15610a85576040516370a0823160e01b8152306004820152610a859033906001600160a01b038416906370a0823190602401602060405180830381865afa158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7491906117bd565b6001600160a01b0384169190610edb565b50565b610a90610d13565b60005b815181101561066957600060016000848481518110610ab457610ab4611886565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610af0816118b2565b915050610a93565b610b00610d13565b6001600160a01b038116610b655760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610256565b610a8581610d6d565b3360009081526001602052604090205460ff16610b9d5760405162461bcd60e51b815260040161025690611451565b604051631eb1ccb760e31b81526001600160a01b037f000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc0169063f58e65b890610bf3908990899089908990899089906004016118cb565b600060405180830381600087803b158015610c0d57600080fd5b505af1158015610c21573d6000803e3d6000fd5b50505050505050505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015610c7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca191906117bd565b9050610d0d8463095ea7b360e01b85610cba868661190e565b6040516001600160a01b03909216602483015260448201526064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610f0b565b50505050565b6000546001600160a01b0316331461067f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610256565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80471015610e0d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610256565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e5a576040519150601f19603f3d011682016040523d82523d6000602084013e610e5f565b606091505b5050905080610ed65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610256565b505050565b6040516001600160a01b038316602482015260448101829052610ed690849063a9059cbb60e01b90606401610cd6565b6000610f60826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610fe09092919063ffffffff16565b9050805160001480610f81575080806020019051810190610f819190611927565b610ed65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610256565b6060610fef8484600085610ff7565b949350505050565b6060824710156110585760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610256565b600080866001600160a01b031685876040516110749190611949565b60006040518083038185875af1925050503d80600081146110b1576040519150601f19603f3d011682016040523d82523d6000602084013e6110b6565b606091505b50915091506110c7878383876110d2565b979650505050505050565b6060831561114157825160000361113a576001600160a01b0385163b61113a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610256565b5081610fef565b610fef83838151156111565781518083602001fd5b8060405162461bcd60e51b81526004016102569190611965565b6001600160a01b0381168114610a8557600080fd5b60006020828403121561119757600080fd5b81356111a281611170565b9392505050565b6001600160401b0381168114610a8557600080fd5b60008083601f8401126111d057600080fd5b5081356001600160401b038111156111e757600080fd5b6020830191508360208285010111156111ff57600080fd5b9250929050565b60008060008060006080868803121561121e57600080fd5b8535611229816111a9565b9450602086013561123981611170565b93506040860135925060608601356001600160401b0381111561125b57600080fd5b611267888289016111be565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b03811182821017156112b1576112b1611278565b60405290565b60405161010081016001600160401b03811182821017156112b1576112b1611278565b604051601f8201601f191681016001600160401b038111828210171561130257611302611278565b604052919050565b6000602080838503121561131d57600080fd5b82356001600160401b038082111561133457600080fd5b818501915085601f83011261134857600080fd5b81358181111561135a5761135a611278565b8060051b915061136b8483016112da565b818152918301840191848101908884111561138557600080fd5b938501935b838510156113af578435925061139f83611170565b828252938501939085019061138a565b98975050505050505050565b63ffffffff81168114610a8557600080fd5b60008060008060008060a087890312156113e657600080fd5b86356113f1816111a9565b9550602087013561140181611170565b9450604087013593506060870135611418816113bb565b925060808701356001600160401b0381111561143357600080fd5b61143f89828a016111be565b979a9699509497509295939492505050565b60208082526010908201526f54616b65723a6f6e6c794f776e65727360801b604082015260600190565b8051611486816111a9565b919050565b8051611486816113bb565b805161148681611170565b60005b838110156114bc5781810151838201526020016114a4565b50506000910152565b600082601f8301126114d657600080fd5b81516001600160401b038111156114ef576114ef611278565b611502601f8201601f19166020016112da565b81815284602083860101111561151757600080fd5b610fef8260208301602087016114a1565b6000610140828403121561153b57600080fd5b61154361128e565b905061154e82611496565b815261155c60208301611496565b602082015261156d60408301611496565b6040820152606082015160608201526080820151608082015260a082015160a082015261159c60c0830161148b565b60c08201526115ad60e0830161148b565b60e08201526101006115c081840161148b565b90820152610120828101516001600160401b038111156115df57600080fd5b6115eb858286016114c5565b82840152505092915050565b600060c0828403121561160957600080fd5b60405160c081016001600160401b03828210818311171561162c5761162c611278565b8160405282935084519150611640826113bb565b90825260208401519061165282611170565b8160208401526040850151915061166882611170565b816040840152606085015160608401526080850151608084015260a085015191508082111561169657600080fd5b506116a3858286016114c5565b60a0830152505092915050565b6000602082840312156116c257600080fd5b81516001600160401b03808211156116d957600080fd5b9083019061010082860312156116ee57600080fd5b6116f66112b7565b6116ff8361147b565b815261170d6020840161148b565b602082015261171e6040840161148b565b604082015261172f6060840161148b565b60608201526080830151608082015261174a60a08401611496565b60a082015260c08301518281111561176157600080fd5b61176d87828601611528565b60c08301525060e08301518281111561178557600080fd5b611791878286016115f7565b60e08301525095945050505050565b6000602082840312156117b257600080fd5b81516111a281611170565b6000602082840312156117cf57600080fd5b5051919050565b600081518084526117ee8160208601602086016114a1565b601f01601f19169290920160200192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03888116825287166020820152604081018690526060810185905260c060808201819052600090611865908301866117d6565b82810360a0840152611878818587611802565b9a9950505050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016118c4576118c461189c565b5060010190565b6001600160401b038716815260018060a01b038616602082015284604082015263ffffffff8416606082015260a0608082015260006113af60a083018486611802565b808201808211156119215761192161189c565b92915050565b60006020828403121561193957600080fd5b815180151581146111a257600080fd5b6000825161195b8184602087016114a1565b9190910192915050565b6020815260006111a260208301846117d656fea264697066735822122028a131167b694f11a2957825d90753306f0ba2969cee7f6fcdacf4461a28082564736f6c63430008100033

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

000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000c225419d61899b6409265f6d50220b9437b5916e00000000000000000000000054447b419e5957c25d2cd54ec5252c83ea6d9d300000000000000000000000006f41ca53293e46b84c9531bd9036156dd5422aae000000000000000000000000154c7d38b10d8ec1bf9b4e8e671b557da6f9e52b00000000000000000000000061012d81ef857a10698bf003e3769d1c22b2b12f000000000000000000000000cec082e944102e234469b2f72c3c303df2a1c12a00000000000000000000000035b78535f6d5da0d250b08dd540fee5137faad3700000000000000000000000025942b1a17615d91a7ccd2e8e3f9ae9810fcd6d2000000000000000000000000d76910c423fa54467f88814ae50b7ba190c7f25f00000000000000000000000001584cec3546e73116f75b6ca0075e38696a5710

-----Decoded View---------------
Arg [0] : _twap (address): 0xceFf098C9199c5d9cf24078dc14Eb8F787631cC0
Arg [1] : _owners (address[]): 0xc225419D61899b6409265f6d50220B9437b5916E,0x54447B419e5957C25d2cd54eC5252C83EA6D9d30,0x6F41cA53293e46b84C9531bd9036156dd5422aAe,0x154C7D38B10d8Ec1Bf9b4e8E671b557dA6F9E52B,0x61012d81EF857A10698bF003e3769d1c22b2b12F,0xCec082E944102e234469b2F72C3c303DF2A1c12A,0x35b78535f6d5Da0D250B08dd540fEE5137faaD37,0x25942b1a17615D91a7ccd2E8e3f9aE9810Fcd6d2,0xd76910C423Fa54467F88814aE50b7BA190c7F25f,0x01584cEC3546e73116F75B6Ca0075E38696a5710

-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 000000000000000000000000ceff098c9199c5d9cf24078dc14eb8f787631cc0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [3] : 000000000000000000000000c225419d61899b6409265f6d50220b9437b5916e
Arg [4] : 00000000000000000000000054447b419e5957c25d2cd54ec5252c83ea6d9d30
Arg [5] : 0000000000000000000000006f41ca53293e46b84c9531bd9036156dd5422aae
Arg [6] : 000000000000000000000000154c7d38b10d8ec1bf9b4e8e671b557da6f9e52b
Arg [7] : 00000000000000000000000061012d81ef857a10698bf003e3769d1c22b2b12f
Arg [8] : 000000000000000000000000cec082e944102e234469b2f72c3c303df2a1c12a
Arg [9] : 00000000000000000000000035b78535f6d5da0d250b08dd540fee5137faad37
Arg [10] : 00000000000000000000000025942b1a17615d91a7ccd2e8e3f9ae9810fcd6d2
Arg [11] : 000000000000000000000000d76910c423fa54467f88814ae50b7ba190c7f25f
Arg [12] : 00000000000000000000000001584cec3546e73116f75b6ca0075e38696a5710


Deployed Bytecode Sourcemap

527:2661:23:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;623:38;;;;;;;;;;-1:-1:-1;623:38:23;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;567:14:26;;560:22;542:41;;530:2;515:18;623:38:23;;;;;;;;591:26;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;779:32:26;;;761:51;;749:2;734:18;591:26:23;594:224:26;1763:627:23;;;;;;;;;;-1:-1:-1;1763:627:23;;;;;:::i;:::-;;:::i;:::-;;830:148;;;;;;;;;;-1:-1:-1;830:148:23;;;;;:::i;:::-;;:::i;1824:101:0:-;;;;;;;;;;;;;:::i;2482:526:23:-;;;;;;;;;;-1:-1:-1;2482:526:23;;;;;:::i;:::-;;:::i;1201:85:0:-;;;;;;;;;;-1:-1:-1;1247:7:0;1273:6;-1:-1:-1;;;;;1273:6:0;1201:85;;984:152:23;;;;;;;;;;-1:-1:-1;984:152:23;;;;;:::i;:::-;;:::i;2074:198:0:-;;;;;;;;;;-1:-1:-1;2074:198:0;;;;;:::i;:::-;;:::i;1177:239:23:-;;;;;;;;;;-1:-1:-1;1177:239:23;;;;;:::i;:::-;;:::i;1763:627::-;3136:10;3129:18;;;;:6;:18;;;;;;;;3121:47;;;;-1:-1:-1;;;3121:47:23;;;;;;;:::i;:::-;;;;;;;;;1888:13:::1;::::0;-1:-1:-1;;;1888:13:23;;-1:-1:-1;;;;;5762:31:26;;1888:13:23::1;::::0;::::1;5744:50:26::0;1888:4:23::1;-1:-1:-1::0;;;;;1888:9:23::1;::::0;::::1;::::0;5717:18:26;;1888:13:23::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;1937:14:23::1;::::0;-1:-1:-1;;;1937:14:23;;-1:-1:-1;;;;;5762:31:26;;1937:14:23::1;::::0;::::1;5744:50:26::0;1911:23:23::1;::::0;-1:-1:-1;1937:4:23::1;-1:-1:-1::0;;;;;1937:10:23::1;::::0;-1:-1:-1;1937:10:23::1;::::0;5717:18:26;;1937:14:23::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;::::0;;::::1;-1:-1:-1::0;;1937:14:23::1;::::0;::::1;;::::0;::::1;::::0;;;::::1;::::0;::::1;:::i;:::-;1911:40;;1984:4;-1:-1:-1::0;;;;;1984:10:23::1;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;1966:30:23::1;:1;:5;;;:14;;;-1:-1:-1::0;;;;;1966:30:23::1;;;:62;;;;-1:-1:-1::0;2000:5:23::1;::::0;::::1;::::0;:14:::1;;::::0;-1:-1:-1;;;;;2000:28:23::1;::::0;::::1;1966:62;:91;;;;-1:-1:-1::0;;;;;;2032:25:23;::::1;::::0;::::1;1966:91;1962:389;;;2099:5;::::0;::::1;::::0;:14:::1;::::0;;::::1;::::0;2093:46;;-1:-1:-1;;;2093:46:23;;2133:4:::1;2093:46;::::0;::::1;761:51:26::0;2073:17:23::1;::::0;-1:-1:-1;;;;;2093:31:23::1;::::0;::::1;::::0;734:18:26;;2093:46:23::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2159:5;::::0;::::1;::::0;:14:::1;;::::0;2073:66;;-1:-1:-1;2153:67:23::1;::::0;-1:-1:-1;;;;;2153:43:23::1;2197:11:::0;2073:66;2153:43:::1;:67::i;:::-;2244:11;-1:-1:-1::0;;;;;2234:27:23::1;;2262:1;:5;;;:14;;;2278:4;-1:-1:-1::0;;;;;2278:10:23::1;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2292:9;2303:15;2320:1;:5;;;:10;;;2332:7;;2234:106;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;2059:292;1962:389;2361:22;2368:1;:5;;;:14;;;2361:6;:22::i;:::-;1878:512;1763:627:::0;;;;;:::o;830:148::-;1094:13:0;:11;:13::i;:::-;909:6:23::1;904:67;925:7;:14;921:1;:18;904:67;;;967:4;946:6:::0;:18:::1;953:7;961:1;953:10;;;;;;;;:::i;:::-;;::::0;;::::1;::::0;;;;;;;-1:-1:-1;;;;;946:18:23::1;::::0;;;::::1;::::0;;;;;;-1:-1:-1;946:18:23;:25;;-1:-1:-1;;946:25:23::1;::::0;::::1;;::::0;;;::::1;::::0;;941:3;::::1;::::0;::::1;:::i;:::-;;;;904:67;;;;830:148:::0;:::o;1824:101:0:-;1094:13;:11;:13::i;:::-;1888:30:::1;1915:1;1888:18;:30::i;:::-;1824:101::o:0;2482:526:23:-;3136:10;3129:18;;;;:6;:18;;;;;;;;3121:47;;;;-1:-1:-1;;;3121:47:23;;;;;;;:::i;:::-;2592:1:::1;2551:4;-1:-1:-1::0;;;;;2551:10:23::1;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2545:44;::::0;-1:-1:-1;;;2545:44:23;;2583:4:::1;2545:44;::::0;::::1;761:51:26::0;-1:-1:-1;;;;;2545:29:23;;;::::1;::::0;::::1;::::0;734:18:26;;2545:44:23::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:48;2541:153;;;2615:4;-1:-1:-1::0;;;;;2615:10:23::1;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;2609:28:23::1;;2644:4;-1:-1:-1::0;;;;;2644:10:23::1;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2638:44;::::0;-1:-1:-1;;;2638:44:23;;2676:4:::1;2638:44;::::0;::::1;761:51:26::0;-1:-1:-1;;;;;2638:29:23;;;::::1;::::0;::::1;::::0;734:18:26;;2638:44:23::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2609:74;;;;;;;;;;;;;12678:25:26::0;;12666:2;12651:18;;12532:177;2609:74:23::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;2541:153;2708:21;:25:::0;2704:117:::1;;2749:61;2775:10;2788:21;2749:17;:61::i;:::-;-1:-1:-1::0;;;;;2835:19:23;::::1;::::0;;::::1;::::0;:64:::1;;-1:-1:-1::0;2858:37:23::1;::::0;-1:-1:-1;;;2858:37:23;;2889:4:::1;2858:37;::::0;::::1;761:51:26::0;2898:1:23::1;::::0;-1:-1:-1;;;;;2858:22:23;::::1;::::0;::::1;::::0;734:18:26;;2858:37:23::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:41;2835:64;2831:171;;;2953:37;::::0;-1:-1:-1;;;2953:37:23;;2984:4:::1;2953:37;::::0;::::1;761:51:26::0;2915:76:23::1;::::0;2941:10:::1;::::0;-1:-1:-1;;;;;2953:22:23;::::1;::::0;::::1;::::0;734:18:26;;2953:37:23::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;2915:25:23;::::1;::::0;:76;:25:::1;:76::i;:::-;2482:526:::0;:::o;984:152::-;1094:13:0;:11;:13::i;:::-;1066:6:23::1;1061:68;1082:7;:14;1078:1;:18;1061:68;;;1124:5;1103:6;:18;1110:7;1118:1;1110:10;;;;;;;;:::i;:::-;;::::0;;::::1;::::0;;;;;;;-1:-1:-1;;;;;1103:18:23::1;::::0;;;::::1;::::0;;;;;;-1:-1:-1;1103:18:23;:26;;-1:-1:-1;;1103:26:23::1;::::0;::::1;;::::0;;;::::1;::::0;;1098:3;::::1;::::0;::::1;:::i;:::-;;;;1061:68;;2074:198:0::0;1094:13;:11;:13::i;:::-;-1:-1:-1;;;;;2162:22:0;::::1;2154:73;;;::::0;-1:-1:-1;;;2154:73:0;;12916:2:26;2154:73:0::1;::::0;::::1;12898:21:26::0;12955:2;12935:18;;;12928:30;12994:34;12974:18;;;12967:62;-1:-1:-1;;;13045:18:26;;;13038:36;13091:19;;2154:73:0::1;12714:402:26::0;2154:73:0::1;2237:28;2256:8;2237:18;:28::i;1177:239:23:-:0;3136:10;3129:18;;;;:6;:18;;;;;;;;3121:47;;;;-1:-1:-1;;;3121:47:23;;;;;;;:::i;:::-;1356:53:::1;::::0;-1:-1:-1;;;1356:53:23;;-1:-1:-1;;;;;1356:4:23::1;:8;::::0;::::1;::::0;:53:::1;::::0;1365:2;;1369:8;;1379:6;;1387:15;;1404:4;;;;1356:53:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;1177:239:::0;;;;;;:::o;2582:280:6:-;2701:39;;-1:-1:-1;;;2701:39:6;;2725:4;2701:39;;;13933:34:26;-1:-1:-1;;;;;14003:15:26;;;13983:18;;;13976:43;2678:20:6;;2701:15;;;;;;13868:18:26;;2701:39:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2678:62;-1:-1:-1;2750:105:6;2770:5;-1:-1:-1;;;2824:7:6;2833:20;2848:5;2678:62;2833:20;:::i;:::-;2777:77;;-1:-1:-1;;;;;14352:32:26;;;2777:77:6;;;14334:51:26;14401:18;;;14394:34;14307:18;;2777:77:6;;;;-1:-1:-1;;2777:77:6;;;;;;;;;;;;;;-1:-1:-1;;;;;2777:77:6;-1:-1:-1;;;;;;2777:77:6;;;;;;;;;;2750:19;:105::i;:::-;2668:194;2582:280;;;:::o;1359:130:0:-;1247:7;1273:6;-1:-1:-1;;;;;1273:6:0;719:10:8;1422:23:0;1414:68;;;;-1:-1:-1;;;1414:68:0;;14641:2:26;1414:68:0;;;14623:21:26;;;14660:18;;;14653:30;14719:34;14699:18;;;14692:62;14771:18;;1414:68:0;14439:356:26;2426:187:0;2499:16;2518:6;;-1:-1:-1;;;;;2534:17:0;;;-1:-1:-1;;;;;;2534:17:0;;;;;;2566:40;;2518:6;;;;;;;2566:40;;2499:16;2566:40;2489:124;2426:187;:::o;2647:312:7:-;2761:6;2736:21;:31;;2728:73;;;;-1:-1:-1;;;2728:73:7;;15002:2:26;2728:73:7;;;14984:21:26;15041:2;15021:18;;;15014:30;15080:31;15060:18;;;15053:59;15129:18;;2728:73:7;14800:353:26;2728:73:7;2813:12;2831:9;-1:-1:-1;;;;;2831:14:7;2853:6;2831:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2812:52;;;2882:7;2874:78;;;;-1:-1:-1;;;2874:78:7;;15570:2:26;2874:78:7;;;15552:21:26;15609:2;15589:18;;;15582:30;15648:34;15628:18;;;15621:62;15719:28;15699:18;;;15692:56;15765:19;;2874:78:7;15368:422:26;2874:78:7;2718:241;2647:312;;:::o;941:175:6:-;1050:58;;-1:-1:-1;;;;;14352:32:26;;1050:58:6;;;14334:51:26;14401:18;;;14394:34;;;1023:86:6;;1043:5;;-1:-1:-1;;;1073:23:6;14307:18:26;;1050:58:6;14160:274:26;5173:642:6;5592:23;5618:69;5646:4;5618:69;;;;;;;;;;;;;;;;;5626:5;-1:-1:-1;;;;;5618:27:6;;;:69;;;;;:::i;:::-;5592:95;;5705:10;:17;5726:1;5705:22;:56;;;;5742:10;5731:30;;;;;;;;;;;;:::i;:::-;5697:111;;;;-1:-1:-1;;;5697:111:6;;16279:2:26;5697:111:6;;;16261:21:26;16318:2;16298:18;;;16291:30;16357:34;16337:18;;;16330:62;-1:-1:-1;;;16408:18:26;;;16401:40;16458:19;;5697:111:6;16077:406:26;4108:223:7;4241:12;4272:52;4294:6;4302:4;4308:1;4311:12;4272:21;:52::i;:::-;4265:59;4108:223;-1:-1:-1;;;;4108:223:7:o;5165:446::-;5330:12;5387:5;5362:21;:30;;5354:81;;;;-1:-1:-1;;;5354:81:7;;16690:2:26;5354:81:7;;;16672:21:26;16729:2;16709:18;;;16702:30;16768:34;16748:18;;;16741:62;-1:-1:-1;;;16819:18:26;;;16812:36;16865:19;;5354:81:7;16488:402:26;5354:81:7;5446:12;5460:23;5487:6;-1:-1:-1;;;;;5487:11:7;5506:5;5513:4;5487:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5445:73;;;;5535:69;5562:6;5570:7;5579:10;5591:12;5535:26;:69::i;:::-;5528:76;5165:446;-1:-1:-1;;;;;;;5165:446:7:o;7671:628::-;7851:12;7879:7;7875:418;;;7906:10;:17;7927:1;7906:22;7902:286;;-1:-1:-1;;;;;1702:19:7;;;8113:60;;;;-1:-1:-1;;;8113:60:7;;17389:2:26;8113:60:7;;;17371:21:26;17428:2;17408:18;;;17401:30;17467:31;17447:18;;;17440:59;17516:18;;8113:60:7;17187:353:26;8113:60:7;-1:-1:-1;8208:10:7;8201:17;;7875:418;8249:33;8257:10;8269:12;8980:17;;:21;8976:379;;9208:10;9202:17;9264:15;9251:10;9247:2;9243:19;9236:44;8976:379;9331:12;9324:20;;-1:-1:-1;;;9324:20:7;;;;;;;;:::i;14:131:26:-;-1:-1:-1;;;;;89:31:26;;79:42;;69:70;;135:1;132;125:12;150:247;209:6;262:2;250:9;241:7;237:23;233:32;230:52;;;278:1;275;268:12;230:52;317:9;304:23;336:31;361:5;336:31;:::i;:::-;386:5;150:247;-1:-1:-1;;;150:247:26:o;823:129::-;-1:-1:-1;;;;;901:5:26;897:30;890:5;887:41;877:69;;942:1;939;932:12;957:347;1008:8;1018:6;1072:3;1065:4;1057:6;1053:17;1049:27;1039:55;;1090:1;1087;1080:12;1039:55;-1:-1:-1;1113:20:26;;-1:-1:-1;;;;;1145:30:26;;1142:50;;;1188:1;1185;1178:12;1142:50;1225:4;1217:6;1213:17;1201:29;;1277:3;1270:4;1261:6;1253;1249:19;1245:30;1242:39;1239:59;;;1294:1;1291;1284:12;1239:59;957:347;;;;;:::o;1309:752::-;1405:6;1413;1421;1429;1437;1490:3;1478:9;1469:7;1465:23;1461:33;1458:53;;;1507:1;1504;1497:12;1458:53;1546:9;1533:23;1565:30;1589:5;1565:30;:::i;:::-;1614:5;-1:-1:-1;1671:2:26;1656:18;;1643:32;1684:33;1643:32;1684:33;:::i;:::-;1736:7;-1:-1:-1;1790:2:26;1775:18;;1762:32;;-1:-1:-1;1845:2:26;1830:18;;1817:32;-1:-1:-1;;;;;1861:30:26;;1858:50;;;1904:1;1901;1894:12;1858:50;1943:58;1993:7;1984:6;1973:9;1969:22;1943:58;:::i;:::-;1309:752;;;;-1:-1:-1;1309:752:26;;-1:-1:-1;2020:8:26;;1917:84;1309:752;-1:-1:-1;;;1309:752:26:o;2066:127::-;2127:10;2122:3;2118:20;2115:1;2108:31;2158:4;2155:1;2148:15;2182:4;2179:1;2172:15;2198:255;2270:2;2264:9;2312:6;2300:19;;-1:-1:-1;;;;;2334:34:26;;2370:22;;;2331:62;2328:88;;;2396:18;;:::i;:::-;2432:2;2425:22;2198:255;:::o;2458:::-;2530:2;2524:9;2572:6;2560:19;;-1:-1:-1;;;;;2594:34:26;;2630:22;;;2591:62;2588:88;;;2656:18;;:::i;2718:275::-;2789:2;2783:9;2854:2;2835:13;;-1:-1:-1;;2831:27:26;2819:40;;-1:-1:-1;;;;;2874:34:26;;2910:22;;;2871:62;2868:88;;;2936:18;;:::i;:::-;2972:2;2965:22;2718:275;;-1:-1:-1;2718:275:26:o;2998:1021::-;3082:6;3113:2;3156;3144:9;3135:7;3131:23;3127:32;3124:52;;;3172:1;3169;3162:12;3124:52;3212:9;3199:23;-1:-1:-1;;;;;3282:2:26;3274:6;3271:14;3268:34;;;3298:1;3295;3288:12;3268:34;3336:6;3325:9;3321:22;3311:32;;3381:7;3374:4;3370:2;3366:13;3362:27;3352:55;;3403:1;3400;3393:12;3352:55;3439:2;3426:16;3461:2;3457;3454:10;3451:36;;;3467:18;;:::i;:::-;3513:2;3510:1;3506:10;3496:20;;3536:28;3560:2;3556;3552:11;3536:28;:::i;:::-;3598:15;;;3668:11;;;3664:20;;;3629:12;;;;3696:19;;;3693:39;;;3728:1;3725;3718:12;3693:39;3752:11;;;;3772:217;3788:6;3783:3;3780:15;3772:217;;;3868:3;3855:17;3842:30;;3885:31;3910:5;3885:31;:::i;:::-;3929:18;;;3805:12;;;;3967;;;;3772:217;;;4008:5;2998:1021;-1:-1:-1;;;;;;;;2998:1021:26:o;4232:121::-;4317:10;4310:5;4306:22;4299:5;4296:33;4286:61;;4343:1;4340;4333:12;4358:892;4462:6;4470;4478;4486;4494;4502;4555:3;4543:9;4534:7;4530:23;4526:33;4523:53;;;4572:1;4569;4562:12;4523:53;4611:9;4598:23;4630:30;4654:5;4630:30;:::i;:::-;4679:5;-1:-1:-1;4736:2:26;4721:18;;4708:32;4749:33;4708:32;4749:33;:::i;:::-;4801:7;-1:-1:-1;4855:2:26;4840:18;;4827:32;;-1:-1:-1;4911:2:26;4896:18;;4883:32;4924;4883;4924;:::i;:::-;4975:7;-1:-1:-1;5033:3:26;5018:19;;5005:33;-1:-1:-1;;;;;5050:30:26;;5047:50;;;5093:1;5090;5083:12;5047:50;5132:58;5182:7;5173:6;5162:9;5158:22;5132:58;:::i;:::-;4358:892;;;;-1:-1:-1;4358:892:26;;-1:-1:-1;4358:892:26;;5209:8;;4358:892;-1:-1:-1;;;4358:892:26:o;5255:340::-;5457:2;5439:21;;;5496:2;5476:18;;;5469:30;-1:-1:-1;;;5530:2:26;5515:18;;5508:46;5586:2;5571:18;;5255:340::o;5805:136::-;5883:13;;5905:30;5883:13;5905:30;:::i;:::-;5805:136;;;:::o;5946:::-;6024:13;;6046:30;6024:13;6046:30;:::i;6087:138::-;6166:13;;6188:31;6166:13;6188:31;:::i;6230:250::-;6315:1;6325:113;6339:6;6336:1;6333:13;6325:113;;;6415:11;;;6409:18;6396:11;;;6389:39;6361:2;6354:10;6325:113;;;-1:-1:-1;;6472:1:26;6454:16;;6447:27;6230:250::o;6485:509::-;6538:5;6591:3;6584:4;6576:6;6572:17;6568:27;6558:55;;6609:1;6606;6599:12;6558:55;6638:6;6632:13;-1:-1:-1;;;;;6660:2:26;6657:26;6654:52;;;6686:18;;:::i;:::-;6730:55;6773:2;6754:13;;-1:-1:-1;;6750:27:26;6779:4;6746:38;6730:55;:::i;:::-;6810:2;6801:7;6794:19;6856:3;6849:4;6844:2;6836:6;6832:15;6828:26;6825:35;6822:55;;;6873:1;6870;6863:12;6822:55;6886:77;6960:2;6953:4;6944:7;6940:18;6933:4;6925:6;6921:17;6886:77;:::i;6999:1072::-;7060:5;7108:6;7096:9;7091:3;7087:19;7083:32;7080:52;;;7128:1;7125;7118:12;7080:52;7150:22;;:::i;:::-;7141:31;;7195:40;7225:9;7195:40;:::i;:::-;7188:5;7181:55;7268:49;7313:2;7302:9;7298:18;7268:49;:::i;:::-;7263:2;7256:5;7252:14;7245:73;7350:49;7395:2;7384:9;7380:18;7350:49;:::i;:::-;7345:2;7338:5;7334:14;7327:73;7453:2;7442:9;7438:18;7432:25;7427:2;7420:5;7416:14;7409:49;7512:3;7501:9;7497:19;7491:26;7485:3;7478:5;7474:15;7467:51;7572:3;7561:9;7557:19;7551:26;7545:3;7538:5;7534:15;7527:51;7611:49;7655:3;7644:9;7640:19;7611:49;:::i;:::-;7605:3;7598:5;7594:15;7587:74;7694:49;7738:3;7727:9;7723:19;7694:49;:::i;:::-;7688:3;7681:5;7677:15;7670:74;7763:3;7798:48;7842:2;7831:9;7827:18;7798:48;:::i;:::-;7782:14;;;7775:72;7866:3;7898:18;;;7892:25;-1:-1:-1;;;;;7929:30:26;;7926:50;;;7972:1;7969;7962:12;7926:50;8008:56;8060:3;8051:6;8040:9;8036:22;8008:56;:::i;:::-;8003:2;7996:5;7992:14;7985:80;;;6999:1072;;;;:::o;8076:1066::-;8137:5;8185:4;8173:9;8168:3;8164:19;8160:30;8157:50;;;8203:1;8200;8193:12;8157:50;8236:2;8230:9;8278:4;8270:6;8266:17;-1:-1:-1;;;;;8370:6:26;8358:10;8355:22;8350:2;8338:10;8335:18;8332:46;8329:72;;;8381:18;;:::i;:::-;8421:10;8417:2;8410:22;8450:6;8441:15;;8486:9;8480:16;8465:31;;8505:32;8529:7;8505:32;:::i;:::-;8546:23;;;8614:2;8599:18;;8593:25;;8627:33;8593:25;8627:33;:::i;:::-;8693:7;8688:2;8680:6;8676:15;8669:32;8746:2;8735:9;8731:18;8725:25;8710:40;;8759:33;8784:7;8759:33;:::i;:::-;8825:7;8820:2;8812:6;8808:15;8801:32;8887:2;8876:9;8872:18;8866:25;8861:2;8853:6;8849:15;8842:50;8947:3;8936:9;8932:19;8926:26;8920:3;8912:6;8908:16;8901:52;8997:3;8986:9;8982:19;8976:26;8962:40;;9025:2;9017:6;9014:14;9011:34;;;9041:1;9038;9031:12;9011:34;;9079:56;9131:3;9122:6;9111:9;9107:22;9079:56;:::i;:::-;9073:3;9065:6;9061:16;9054:82;;;8076:1066;;;;:::o;9147:1232::-;9240:6;9293:2;9281:9;9272:7;9268:23;9264:32;9261:52;;;9309:1;9306;9299:12;9261:52;9342:9;9336:16;-1:-1:-1;;;;;9412:2:26;9404:6;9401:14;9398:34;;;9428:1;9425;9418:12;9398:34;9451:22;;;;9507:6;9489:16;;;9485:29;9482:49;;;9527:1;9524;9517:12;9482:49;9553:22;;:::i;:::-;9598:32;9627:2;9598:32;:::i;:::-;9591:5;9584:47;9663:41;9700:2;9696;9692:11;9663:41;:::i;:::-;9658:2;9651:5;9647:14;9640:65;9737:41;9774:2;9770;9766:11;9737:41;:::i;:::-;9732:2;9725:5;9721:14;9714:65;9811:41;9848:2;9844;9840:11;9811:41;:::i;:::-;9806:2;9799:5;9795:14;9788:65;9900:3;9896:2;9892:12;9886:19;9880:3;9873:5;9869:15;9862:44;9939:43;9977:3;9973:2;9969:12;9939:43;:::i;:::-;9933:3;9926:5;9922:15;9915:68;10022:3;10018:2;10014:12;10008:19;10052:2;10042:8;10039:16;10036:36;;;10068:1;10065;10058:12;10036:36;10105:60;10157:7;10146:8;10142:2;10138:17;10105:60;:::i;:::-;10099:3;10092:5;10088:15;10081:85;;10205:3;10201:2;10197:12;10191:19;10235:2;10225:8;10222:16;10219:36;;;10251:1;10248;10241:12;10219:36;10288:60;10340:7;10329:8;10325:2;10321:17;10288:60;:::i;:::-;10282:3;10271:15;;10264:85;-1:-1:-1;10275:5:26;9147:1232;-1:-1:-1;;;;;9147:1232:26:o;10384:251::-;10454:6;10507:2;10495:9;10486:7;10482:23;10478:32;10475:52;;;10523:1;10520;10513:12;10475:52;10555:9;10549:16;10574:31;10599:5;10574:31;:::i;10640:184::-;10710:6;10763:2;10751:9;10742:7;10738:23;10734:32;10731:52;;;10779:1;10776;10769:12;10731:52;-1:-1:-1;10802:16:26;;10640:184;-1:-1:-1;10640:184:26:o;10829:270::-;10870:3;10908:5;10902:12;10935:6;10930:3;10923:19;10951:76;11020:6;11013:4;11008:3;11004:14;10997:4;10990:5;10986:16;10951:76;:::i;:::-;11081:2;11060:15;-1:-1:-1;;11056:29:26;11047:39;;;;11088:4;11043:50;;10829:270;-1:-1:-1;;10829:270:26:o;11104:266::-;11192:6;11187:3;11180:19;11244:6;11237:5;11230:4;11225:3;11221:14;11208:43;-1:-1:-1;11296:1:26;11271:16;;;11289:4;11267:27;;;11260:38;;;;11352:2;11331:15;;;-1:-1:-1;;11327:29:26;11318:39;;;11314:50;;11104:266::o;11375:748::-;-1:-1:-1;;;;;11728:15:26;;;11710:34;;11780:15;;11775:2;11760:18;;11753:43;11827:2;11812:18;;11805:34;;;11870:2;11855:18;;11848:34;;;11919:3;11913;11898:19;;11891:32;;;11653:4;;11946:45;;11971:19;;11963:6;11946:45;:::i;:::-;12040:9;12032:6;12028:22;12022:3;12011:9;12007:19;12000:51;12068:49;12110:6;12102;12094;12068:49;:::i;:::-;12060:57;11375:748;-1:-1:-1;;;;;;;;;;11375:748:26:o;12128:127::-;12189:10;12184:3;12180:20;12177:1;12170:31;12220:4;12217:1;12210:15;12244:4;12241:1;12234:15;12260:127;12321:10;12316:3;12312:20;12309:1;12302:31;12352:4;12349:1;12342:15;12376:4;12373:1;12366:15;12392:135;12431:3;12452:17;;;12449:43;;12472:18;;:::i;:::-;-1:-1:-1;12519:1:26;12508:13;;12392:135::o;13121:595::-;-1:-1:-1;;;;;13390:6:26;13386:31;13375:9;13368:50;13483:1;13479;13474:3;13470:11;13466:19;13458:6;13454:32;13449:2;13438:9;13434:18;13427:60;13523:6;13518:2;13507:9;13503:18;13496:34;13578:10;13570:6;13566:23;13561:2;13550:9;13546:18;13539:51;13627:3;13621;13610:9;13606:19;13599:32;13349:4;13648:62;13705:3;13694:9;13690:19;13682:6;13674;13648:62;:::i;14030:125::-;14095:9;;;14116:10;;;14113:36;;;14129:18;;:::i;:::-;14030:125;;;;:::o;15795:277::-;15862:6;15915:2;15903:9;15894:7;15890:23;15886:32;15883:52;;;15931:1;15928;15921:12;15883:52;15963:9;15957:16;16016:5;16009:13;16002:21;15995:5;15992:32;15982:60;;16038:1;16035;16028:12;16895:287;17024:3;17062:6;17056:13;17078:66;17137:6;17132:3;17125:4;17117:6;17113:17;17078:66;:::i;:::-;17160:16;;;;;16895:287;-1:-1:-1;;16895:287:26:o;17545:219::-;17694:2;17683:9;17676:21;17657:4;17714:44;17754:2;17743:9;17739:18;17731:6;17714:44;:::i

Swarm Source

ipfs://28a131167b694f11a2957825d90753306f0ba2969cee7f6fcdacf4461a280825

Block Transaction Gas Used Reward
view all blocks ##produced##

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

Validator Index Block Amount
View All Withdrawals

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

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