Contract 0xa2101FD320D06e0A744e4FE90ef8A20ECd027001 13

 

Contract Overview

Balance:
0 ETH

EtherValue:
$0.00

Token:
Txn Hash Method
Block
From
To
Value
0xcfe658698dc69abf3e87d28d22abe4a3f0e87326b839c5a69fb14d77560cbd5cAdd Rebates114903222024-03-07 0:06:3146 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0001337544680.001500444
0x6bbd7a2e5e51fd2194eb4a4023aa25f654792c25cf6e31f73e094f7cb8b66842Distribute Fees114471922024-03-06 0:08:5147 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000857959410.00150127
0x76bc3e93d28d2a54ad64fc03ea8dd2e7349f77a3dfb5ef95c44f753fdac3ca0aAdd Rebates114471822024-03-06 0:08:3147 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0002576297660.001501296
0x385d653089f9e61662a3b86dcc397ceb05df011086a06ccde0769ff850320d1bDistribute Fees114040272024-03-05 0:10:0148 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0001019852060.001500388
0x5d51744dbd238aeb44d5558ed1b15c34f823edd403defe899b6acdadab10d0cbAdd Rebates114040162024-03-05 0:09:3948 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0002754312670.00150039
0x0a9a3069c56fd1474ad1eff3f03b62a03c003242c3ab19295265eeed86aeba0cDistribute Fees113608422024-03-04 0:10:3149 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000698968020.001500412
0x2ebf1ca759132fa865f94be2936dfa58cd67f50889323e2faa93acbfd77339afAdd Rebates113608322024-03-04 0:10:1149 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0001888293620.001500414
0xb0b75ad861a32849ee5b103fb68e433cc49627cffadd9f84c52a4b73ce4b2bc9Distribute Fees113176332024-03-03 0:10:1350 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.000057940670.001500412
0x5193442491617323b72674fab5672ffd27d77a548ea2bcbf7d23cd5052404b43Add Rebates113176232024-03-03 0:09:5350 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0001762573130.001500414
0x59d25060f3926be26785d825a22226d62e05576f828c43ba9aee25542faff899Distribute Fees112744262024-03-02 0:09:5951 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000645426450.001500396
0x5e611941de8bfef1f9216c14ba139167c00be9d1d533ad3718ef2fd29698febbAdd Rebates112744152024-03-02 0:09:3751 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.000203530980.001500396
0x4a990e8deba58ffdb70135417898dbe0159ecfcf062081504117e0608eb121ccDistribute Fees112312182024-03-01 0:09:4352 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000783444250.001500396
0x6c475ba9b83e864faabd1c7a8bd452084158c9e540f21655b5f434b5ef721d37Add Rebates112312072024-03-01 0:09:2152 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0002231261910.001500397
0x99b49f9dd8f346590f96e6968304b76833febcadb3284ed71f8ebeccfadfe223Distribute Fees111880482024-02-29 0:10:4353 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000742794540.001500532
0x7186c5469d7701734cd757a393ea119763e73348db58dca8b3a7e26afeb11a07Add Rebates111880372024-02-29 0:10:2153 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0002224727650.001500528
0x7c64816464a239417927e1b0f1910a00e1de6fd98abe0344cbf6c15a0acfd8a9Distribute Fees111448392024-02-28 0:10:2554 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000720684660.001500406
0x7caf1eda9601e246ea68f62e6c6472c9c58465784a47d772bc852d9a849c0724Add Rebates111448292024-02-28 0:10:0554 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0002223219440.001500406
0xe62c567806748839c463727fee2c772164129ce980784270d1839c1f28981c3eDistribute Fees111016302024-02-27 0:10:0755 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000577158290.001500409
0xb7ce09aa44316fcd5590c2c061feff22419ba88867e380810554489dbab91b4eAdd Rebates111016202024-02-27 0:09:4755 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0002007046640.001500412
0x47fd431c5fa700cf9df2f570c900f99cbb1ae43b1ef847a546a6494ede21c89aDistribute Fees110584772024-02-26 0:11:4156 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000354020730.001500418
0x1770bc9e72e9b5050cc9a0d43d71cda083a1f6edd2b3b6510a0217452ae6eb38Add Rebates110584662024-02-26 0:11:1956 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0001007127370.00150042
0xc977621af01236fa6cf08784cd69d539fd94f6a52cdb9d1817b88e6461a9188aDistribute Fees110152232024-02-25 0:09:5357 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.000032613790.001500472
0xac9f4c6b4eec9243646e75f01278e4f11ecdada948354a9fbe7b628d2e74573aAdd Rebates110152132024-02-25 0:09:3357 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0001067444550.001500468
0x378111ae185a658bd4838a650299e23af49d988846b20183bf07df1ffd3bd1d8Distribute Fees109720522024-02-24 0:10:5158 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.0000329601730.001500435
0xaad99e280efeb5615b6c7551da965c6b12751b4d59c424e18489faabeb0464b6Add Rebates109720412024-02-24 0:10:2958 days 19 hrs ago0xb08dc5670682658a77841db446b226dd355527f2 IN  0xa2101fd320d06e0a744e4fe90ef8a20ecd0270010 ETH0.000100024390.001500436
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WooFeeManager

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 20000 runs

Other Settings:
default evmVersion
File 1 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 3 of 13 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 4 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 5 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    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");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 13 : 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 8 of 13 : IWooAccessManager.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

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

/// @title Reward manager interface for WooFi Swap.
/// @notice this is for swap rebate or potential incentive program
interface IWooAccessManager {
    /* ----- Events ----- */

    event FeeAdminUpdated(address indexed feeAdmin, bool flag);

    event VaultAdminUpdated(address indexed vaultAdmin, bool flag);

    event RebateAdminUpdated(address indexed rebateAdmin, bool flag);

    event ZeroFeeVaultUpdated(address indexed vault, bool flag);

    /* ----- External Functions ----- */

    function isFeeAdmin(address feeAdmin) external returns (bool);

    function isVaultAdmin(address vaultAdmin) external returns (bool);

    function isRebateAdmin(address rebateAdmin) external returns (bool);

    function isZeroFeeVault(address vault) external returns (bool);

    /* ----- Admin Functions ----- */

    /// @notice Sets feeAdmin
    function setFeeAdmin(address feeAdmin, bool flag) external;

    /// @notice Sets vaultAdmin
    function setVaultAdmin(address vaultAdmin, bool flag) external;

    /// @notice Sets rebateAdmin
    function setRebateAdmin(address rebateAdmin, bool flag) external;

    /// @notice Sets zeroFeeVault
    function setZeroFeeVault(address vault, bool flag) external;
}

File 9 of 13 : IWooFeeManager.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

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

/// @title Contract to collect transaction fee of Woo private pool.
interface IWooFeeManager {
    /* ----- Events ----- */

    event FeeRateUpdated(address indexed token, uint256 newFeeRate);
    event Withdraw(address indexed token, address indexed to, uint256 amount);

    /* ----- External Functions ----- */

    /// @dev fee rate for the given base token:
    /// NOTE: fee rate decimal 18: 1e16 = 1%, 1e15 = 0.1%, 1e14 = 0.01%
    /// @param token the base token
    /// @return the fee rate
    function feeRate(address token) external view returns (uint256);

    /// @dev Sets the fee rate for the given token
    /// @param token the base token
    /// @param newFeeRate the new fee rate
    function setFeeRate(address token, uint256 newFeeRate) external;

    /// @dev Collects the swap fee to the given brokder address.
    /// @param amount the swap fee amount
    /// @param brokerAddr the broker address to rebate to
    function collectFee(uint256 amount, address brokerAddr) external;

    /// @dev get the quote token address
    /// @return address of quote token
    function quoteToken() external view returns (address);

    /// @dev Collects the fee and distribute to rebate and vault managers.
    function distributeFees() external;

    /// @dev Add the rebate amounts for the specified broker addresses.
    /// @param brokerAddrs the broker address for rebate
    /// @param amounts the rebate amount for each broker address
    function addRebates(address[] memory brokerAddrs, uint256[] memory amounts) external;
}

File 10 of 13 : IWooRebateManager.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

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

/// @title Rebate manager interface for WooFi Swap.
/// @notice this is for swap rebate or potential incentive program

interface IWooRebateManager {
    event Withdraw(address indexed token, address indexed to, uint256 amount);
    event RebateRateUpdated(address indexed brokerAddr, uint256 rate);
    event ClaimReward(address indexed brokerAddr, uint256 amount);

    /// @dev Gets the rebate rate for the given broker.
    /// Note: decimal: 18;  1e16 = 1%, 1e15 = 0.1%, 1e14 = 0.01%
    /// @param brokerAddr the address for rebate
    /// @return The rebate rate (decimal: 18; 1e16 = 1%, 1e15 = 0.1%, 1e14 = 0.01%)
    function rebateRate(address brokerAddr) external view returns (uint256);

    /// @dev set the rebate rate
    /// @param brokerAddr the rebate address
    /// @param rate the rebate rate
    function setRebateRate(address brokerAddr, uint256 rate) external;

    /// @dev adds the pending reward for the given user.
    /// @param brokerAddr the address for rebate
    /// @param amountInUSD the pending reward amount
    function addRebate(address brokerAddr, uint256 amountInUSD) external;

    /// @dev Pending amount in reward token (e.g. $woo).
    /// @param brokerAddr the address for rebate
    function pendingRebateInReward(address brokerAddr) external view returns (uint256);

    /// @dev Pending amount in quote token (e.g. usdc).
    /// @param brokerAddr the address for rebate
    function pendingRebateInQuote(address brokerAddr) external view returns (uint256);

    /// @dev Claims the reward ($woo token will be distributed)
    function claimRebate() external;

    /// @dev get the quote token address
    /// @return address of quote token
    function quoteToken() external view returns (address);
}

File 11 of 13 : IWooVaultManager.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

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

/// @title Vault reward manager interface for WooFi Swap.
interface IWooVaultManager {
    event VaultWeightUpdated(address indexed vaultAddr, uint256 weight);
    event RewardDistributed(address indexed vaultAddr, uint256 amount);

    /// @dev Gets the reward weight for the given vault.
    /// @param vaultAddr the vault address
    /// @return The weight of the given vault.
    function vaultWeight(address vaultAddr) external view returns (uint256);

    /// @dev Sets the reward weight for the given vault.
    /// @param vaultAddr the vault address
    /// @param weight the vault weight
    function setVaultWeight(address vaultAddr, uint256 weight) external;

    /// @dev Adds the reward quote amount.
    /// Note: The reward will be stored in this manager contract for
    ///       further weight adjusted distribution.
    /// @param quoteAmount the reward amount in quote token.
    function addReward(uint256 quoteAmount) external;

    /// @dev Pending amount in quote token for the given vault.
    /// @param vaultAddr the vault address
    function pendingReward(address vaultAddr) external view returns (uint256);

    /// @dev All pending amount in quote token.
    /// @return the total pending reward
    function pendingAllReward() external view returns (uint256);

    /// @dev Distributes the reward to all the vaults based on the weights.
    function distributeAllReward() external;

    /// @dev All the vaults
    /// @return the vault address array
    function allVaults() external view returns (address[] memory);

    /// @dev get the quote token address
    /// @return address of quote token
    function quoteToken() external view returns (address);
}

File 12 of 13 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::safeApprove: approve failed"
        );
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::safeTransfer: transfer failed"
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::transferFrom: transferFrom failed"
        );
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, "TransferHelper::safeTransferETH: ETH transfer failed");
    }
}

File 13 of 13 : WooFeeManager.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

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

import "./interfaces/IWooRebateManager.sol";
import "./interfaces/IWooFeeManager.sol";
import "./interfaces/IWooVaultManager.sol";
import "./interfaces/IWooAccessManager.sol";

import "./libraries/TransferHelper.sol";

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @title Contract to collect transaction fee of WooPPV2.
contract WooFeeManager is Ownable, ReentrancyGuard, IWooFeeManager {
    /* ----- State variables ----- */

    mapping(address => uint256) public override feeRate; // decimal: 18; 1e16 = 1%, 1e15 = 0.1%, 1e14 = 0.01%
    uint256 public vaultRewardRate; // decimal: 18; 1e16 = 1%, 1e15 = 0.1%, 1e14 = 0.01%

    uint256 public rebateAmount;

    address public immutable override quoteToken;
    IWooRebateManager public rebateManager;
    IWooVaultManager public vaultManager;
    IWooAccessManager public accessManager;

    address public treasury;

    /* ----- Modifiers ----- */

    modifier onlyAdmin() {
        require(msg.sender == owner() || accessManager.isFeeAdmin(msg.sender), "WooFeeManager: !admin");
        _;
    }

    constructor(
        address _quoteToken,
        address _rebateManager,
        address _vaultManager,
        address _accessManager,
        address _treasury
    ) {
        quoteToken = _quoteToken;
        rebateManager = IWooRebateManager(_rebateManager);
        vaultManager = IWooVaultManager(_vaultManager);
        vaultRewardRate = 1e18;
        accessManager = IWooAccessManager(_accessManager);
        treasury = _treasury;
    }

    /* ----- Public Functions ----- */

    function collectFee(uint256 amount, address brokerAddr) external override nonReentrant {
        TransferHelper.safeTransferFrom(quoteToken, msg.sender, address(this), amount);
        uint256 rebateRate = rebateManager.rebateRate(brokerAddr);
        if (rebateRate > 0) {
            uint256 curRebateAmount = (amount * rebateRate) / 1e18;
            rebateManager.addRebate(brokerAddr, curRebateAmount);
            rebateAmount = rebateAmount + curRebateAmount;
        }
    }

    /* ----- Admin Functions ----- */

    function addRebates(address[] memory brokerAddrs, uint256[] memory amounts)
        external
        override
        nonReentrant
        onlyAdmin
    {
        require(amounts.length == brokerAddrs.length, "WooFeeManager: !length");

        uint256 totalAmount = 0;
        for (uint256 i = 0; i < brokerAddrs.length; ++i) {
            rebateManager.addRebate(brokerAddrs[i], amounts[i]);
            totalAmount = totalAmount + amounts[i];
        }

        rebateAmount = rebateAmount + totalAmount;
    }

    function distributeFees() external override nonReentrant onlyAdmin {
        uint256 balance = IERC20(quoteToken).balanceOf(address(this));
        require(balance > 0, "WooFeeManager: balance_ZERO");

        // Step 1: distribute the vault balance. Currently, 80% of fee (2 bps) goes to vault manager.
        uint256 vaultAmount = (balance * vaultRewardRate) / 1e18;
        if (vaultAmount > 0) {
            TransferHelper.safeTransfer(quoteToken, address(vaultManager), vaultAmount);
            balance = balance - vaultAmount;
        }

        // Step 2: distribute the rebate balance.
        if (rebateAmount > 0) {
            TransferHelper.safeTransfer(quoteToken, address(rebateManager), rebateAmount);

            // NOTE: if balance not enought: certain rebate rates are set incorrectly.
            balance = balance - rebateAmount;
            rebateAmount = 0;
        }

        // Step 3: balance left for treasury
        TransferHelper.safeTransfer(quoteToken, treasury, balance);
    }

    function setFeeRate(address token, uint256 newFeeRate) external override onlyAdmin {
        require(newFeeRate <= 1e16, "WooFeeManager: FEE_RATE>1%");
        feeRate[token] = newFeeRate;
        emit FeeRateUpdated(token, newFeeRate);
    }

    function setRebateManager(address newRebateManager) external onlyAdmin {
        require(newRebateManager != address(0), "WooFeeManager: rebateManager_ZERO_ADDR");
        rebateManager = IWooRebateManager(newRebateManager);
    }

    function setVaultManager(address newVaultManager) external onlyAdmin {
        require(newVaultManager != address(0), "WooFeeManager: newVaultManager_ZERO_ADDR");
        vaultManager = IWooVaultManager(newVaultManager);
    }

    function setVaultRewardRate(uint256 newVaultRewardRate) external onlyAdmin {
        require(newVaultRewardRate <= 1e18, "WooFeeManager: vaultRewardRate_INVALID");
        vaultRewardRate = newVaultRewardRate;
    }

    function setAccessManager(address newAccessManager) external onlyOwner {
        require(newAccessManager != address(0), "WooFeeManager: newAccessManager_ZERO_ADDR");
        accessManager = IWooAccessManager(newAccessManager);
    }

    function setTreasury(address newTreasury) external onlyOwner {
        require(newTreasury != address(0), "WooFeeManager: newTreasury_ZERO_ADDR");
        treasury = newTreasury;
    }

    function inCaseTokenGotStuck(address stuckToken) external onlyOwner {
        if (stuckToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
            TransferHelper.safeTransferETH(msg.sender, address(this).balance);
        } else {
            uint256 amount = IERC20(stuckToken).balanceOf(address(this));
            TransferHelper.safeTransfer(stuckToken, msg.sender, amount);
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_quoteToken","type":"address"},{"internalType":"address","name":"_rebateManager","type":"address"},{"internalType":"address","name":"_vaultManager","type":"address"},{"internalType":"address","name":"_accessManager","type":"address"},{"internalType":"address","name":"_treasury","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"FeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"accessManager","outputs":[{"internalType":"contract IWooAccessManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"brokerAddrs","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"addRebates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"brokerAddr","type":"address"}],"name":"collectFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stuckToken","type":"address"}],"name":"inCaseTokenGotStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoteToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebateAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebateManager","outputs":[{"internalType":"contract IWooRebateManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAccessManager","type":"address"}],"name":"setAccessManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"setFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRebateManager","type":"address"}],"name":"setRebateManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newVaultManager","type":"address"}],"name":"setVaultManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newVaultRewardRate","type":"uint256"}],"name":"setVaultRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultManager","outputs":[{"internalType":"contract IWooVaultManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultRewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a06040523480156200001157600080fd5b506040516200232f3803806200232f833981016040819052620000349162000114565b6200003f33620000a7565b600180556001600160a01b03948516608052600580549486166001600160a01b03199586161790556006805493861693851693909317909255670de0b6b3a7640000600355600780549185169184169190911790556008805491909316911617905562000184565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200010f57600080fd5b919050565b600080600080600060a086880312156200012d57600080fd5b6200013886620000f7565b94506200014860208701620000f7565b93506200015860408701620000f7565b92506200016860608701620000f7565b91506200017860808701620000f7565b90509295509295909350565b60805161216c620001c36000396000818161018101528181610ae50152818161122601528181611346015281816113a301526113ff015261216c6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c8063942dc573116100d8578063d0254a2c1161008c578063f2fde38b11610066578063f2fde38b14610328578063fdcb60681461033b578063fea8dea31461035b57600080fd5b8063d0254a2c146102e2578063e1a4e72a14610302578063f0f442601461031557600080fd5b8063b543503e116100bd578063b543503e146102b4578063bb57ad20146102c7578063c9580804146102cf57600080fd5b8063942dc573146102985780639779c895146102ab57600080fd5b8063715018a61161012f578063850da5f611610114578063850da5f6146102435780638a4adf241461025a5780638da5cb5b1461027a57600080fd5b8063715018a6146102285780637ff7b0d21461023057600080fd5b8063395107ba11610160578063395107ba146101e25780635011e9ee146101f557806361d027b31461020857600080fd5b8063217a4b701461017c57806334fb4bab146101cd575b600080fd5b6101a37f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101e06101db366004611d25565b61037b565b005b6101e06101f0366004611d47565b610585565b6101e0610203366004611e6d565b61073d565b6008546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b6101e0610a5b565b6101e061023e366004611f2d565b610a6f565b61024c60045481565b6040519081526020016101c4565b6006546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff166101a3565b6101e06102a6366004611f59565b610c72565b61024c60035481565b6101e06102c2366004611d25565b610e64565b6101e0611069565b6101e06102dd366004611d25565b611443565b61024c6102f0366004611d25565b60026020526000908152604090205481565b6101e0610310366004611d25565b611535565b6101e0610323366004611d25565b61161d565b6101e0610336366004611d25565b61170e565b6007546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b6005546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061043057506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af115801561040c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104309190611f83565b61049b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811661053e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f576f6f4665654d616e616765723a207265626174654d616e616765725f5a455260448201527f4f5f4144445200000000000000000000000000000000000000000000000000006064820152608401610492565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061063a57506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af1158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a9190611f83565b6106a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b670de0b6b3a7640000811115610738576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f576f6f4665654d616e616765723a207661756c74526577617264526174655f4960448201527f4e56414c494400000000000000000000000000000000000000000000000000006064820152608401610492565b600355565b6002600154036107a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610492565b600260015560005473ffffffffffffffffffffffffffffffffffffffff1633148061086357506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af115801561083f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108639190611f83565b6108c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b8151815114610934576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f576f6f4665654d616e616765723a20216c656e677468000000000000000000006044820152606401610492565b6000805b8351811015610a4057600554845173ffffffffffffffffffffffffffffffffffffffff9091169063231bbff69086908490811061097757610977611fa5565b602002602001015185848151811061099157610991611fa5565b60200260200101516040518363ffffffff1660e01b81526004016109d792919073ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060405180830381600087803b1580156109f157600080fd5b505af1158015610a05573d6000803e3d6000fd5b50505050828181518110610a1b57610a1b611fa5565b602002602001015182610a2e9190612003565b9150610a398161201b565b9050610938565b5080600454610a4f9190612003565b60045550506001805550565b610a636117c2565b610a6d6000611843565b565b600260015403610adb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610492565b6002600155610b0c7f00000000000000000000000000000000000000000000000000000000000000003330856118b8565b6005546040517f77ea464d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015260009216906377ea464d90602401602060405180830381865afa158015610b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba19190612053565b90508015610c69576000670de0b6b3a7640000610bbe838661206c565b610bc891906120a9565b6005546040517f231bbff600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526024820184905292935091169063231bbff690604401600060405180830381600087803b158015610c3e57600080fd5b505af1158015610c52573d6000803e3d6000fd5b5050505080600454610c649190612003565b600455505b50506001805550565b60005473ffffffffffffffffffffffffffffffffffffffff16331480610d2757506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af1158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d279190611f83565b610d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b662386f26fc10000811115610dfe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f576f6f4665654d616e616765723a204645455f524154453e31250000000000006044820152606401610492565b73ffffffffffffffffffffffffffffffffffffffff821660008181526002602052604090819020839055517f98259702e6263eb2c9423b892e36fcaaaac8885fbeab7826218791df24d8498790610e589084815260200190565b60405180910390a25050565b60005473ffffffffffffffffffffffffffffffffffffffff16331480610f1957506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af1158015610ef5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f199190611f83565b610f7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b73ffffffffffffffffffffffffffffffffffffffff8116611022576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f576f6f4665654d616e616765723a206e65775661756c744d616e616765725f5a60448201527f45524f5f414444520000000000000000000000000000000000000000000000006064820152608401610492565b600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6002600154036110d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610492565b600260015560005473ffffffffffffffffffffffffffffffffffffffff1633148061118f57506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af115801561116b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118f9190611f83565b6111f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015611282573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a69190612053565b905060008111611312576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f576f6f4665654d616e616765723a2062616c616e63655f5a45524f00000000006044820152606401610492565b6000670de0b6b3a76400006003548361132b919061206c565b61133591906120a9565b9050801561138f57600654611382907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff1683611a57565b61138c81836120e4565b91505b600454156113f6576005546004546113e1917f00000000000000000000000000000000000000000000000000000000000000009173ffffffffffffffffffffffffffffffffffffffff90911690611a57565b6004546113ee90836120e4565b600060045591505b60085461143b907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff1684611a57565b505060018055565b61144b6117c2565b73ffffffffffffffffffffffffffffffffffffffff81166114ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f576f6f4665654d616e616765723a206e65774163636573734d616e616765725f60448201527f5a45524f5f4144445200000000000000000000000000000000000000000000006064820152608401610492565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61153d6117c2565b73ffffffffffffffffffffffffffffffffffffffff811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0361157b576115783347611bed565b50565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156115e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160c9190612053565b9050611619823383611a57565b5050565b6116256117c2565b73ffffffffffffffffffffffffffffffffffffffff81166116c7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f576f6f4665654d616e616765723a206e657754726561737572795f5a45524f5f60448201527f41444452000000000000000000000000000000000000000000000000000000006064820152608401610492565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6117166117c2565b73ffffffffffffffffffffffffffffffffffffffff81166117b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610492565b61157881611843565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a6d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610492565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052915160009283929088169161195791906120fb565b6000604051808303816000865af19150503d8060008114611994576040519150601f19603f3d011682016040523d82523d6000602084013e611999565b606091505b50915091508180156119c35750805115806119c35750808060200190518101906119c39190611f83565b611a4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c65640000000000000000000000000000006064820152608401610492565b505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691611aee91906120fb565b6000604051808303816000865af19150503d8060008114611b2b576040519150601f19603f3d011682016040523d82523d6000602084013e611b30565b606091505b5091509150818015611b5a575080511580611b5a575080806020019051810190611b5a9190611f83565b611be6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c6564000000000000000000000000000000000000006064820152608401610492565b5050505050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051611c2491906120fb565b60006040518083038185875af1925050503d8060008114611c61576040519150601f19603f3d011682016040523d82523d6000602084013e611c66565b606091505b5050905080611cf7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c65640000000000000000000000006064820152608401610492565b505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611d2057600080fd5b919050565b600060208284031215611d3757600080fd5b611d4082611cfc565b9392505050565b600060208284031215611d5957600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611dd657611dd6611d60565b604052919050565b600067ffffffffffffffff821115611df857611df8611d60565b5060051b60200190565b600082601f830112611e1357600080fd5b81356020611e28611e2383611dde565b611d8f565b82815260059290921b84018101918181019086841115611e4757600080fd5b8286015b84811015611e625780358352918301918301611e4b565b509695505050505050565b60008060408385031215611e8057600080fd5b823567ffffffffffffffff80821115611e9857600080fd5b818501915085601f830112611eac57600080fd5b81356020611ebc611e2383611dde565b82815260059290921b84018101918181019089841115611edb57600080fd5b948201945b83861015611f0057611ef186611cfc565b82529482019490820190611ee0565b96505086013592505080821115611f1657600080fd5b50611f2385828601611e02565b9150509250929050565b60008060408385031215611f4057600080fd5b82359150611f5060208401611cfc565b90509250929050565b60008060408385031215611f6c57600080fd5b611f7583611cfc565b946020939093013593505050565b600060208284031215611f9557600080fd5b81518015158114611d4057600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561201657612016611fd4565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361204c5761204c611fd4565b5060010190565b60006020828403121561206557600080fd5b5051919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156120a4576120a4611fd4565b500290565b6000826120df577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000828210156120f6576120f6611fd4565b500390565b6000825160005b8181101561211c5760208186018101518583015201612102565b8181111561212b576000828501525b50919091019291505056fea26469706673582212202e48e30732833616d67018ab4e46115953b8153f847e7fb57c9b11bad537aded64736f6c634300080e0033000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca0000000000000000000000007214833be05ce39f6dcd97668e521162e6c1893700000000000000000000000032a1d9b2a85f2ef0516daabaa9c34325bc774cac00000000000000000000000015ba47e540e1b197e30d16a93b0c568b251629c2000000000000000000000000c06e2968afd4a029d4623f9a5f534c45e5bf0bdf

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101775760003560e01c8063942dc573116100d8578063d0254a2c1161008c578063f2fde38b11610066578063f2fde38b14610328578063fdcb60681461033b578063fea8dea31461035b57600080fd5b8063d0254a2c146102e2578063e1a4e72a14610302578063f0f442601461031557600080fd5b8063b543503e116100bd578063b543503e146102b4578063bb57ad20146102c7578063c9580804146102cf57600080fd5b8063942dc573146102985780639779c895146102ab57600080fd5b8063715018a61161012f578063850da5f611610114578063850da5f6146102435780638a4adf241461025a5780638da5cb5b1461027a57600080fd5b8063715018a6146102285780637ff7b0d21461023057600080fd5b8063395107ba11610160578063395107ba146101e25780635011e9ee146101f557806361d027b31461020857600080fd5b8063217a4b701461017c57806334fb4bab146101cd575b600080fd5b6101a37f000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101e06101db366004611d25565b61037b565b005b6101e06101f0366004611d47565b610585565b6101e0610203366004611e6d565b61073d565b6008546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b6101e0610a5b565b6101e061023e366004611f2d565b610a6f565b61024c60045481565b6040519081526020016101c4565b6006546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff166101a3565b6101e06102a6366004611f59565b610c72565b61024c60035481565b6101e06102c2366004611d25565b610e64565b6101e0611069565b6101e06102dd366004611d25565b611443565b61024c6102f0366004611d25565b60026020526000908152604090205481565b6101e0610310366004611d25565b611535565b6101e0610323366004611d25565b61161d565b6101e0610336366004611d25565b61170e565b6007546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b6005546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061043057506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af115801561040c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104309190611f83565b61049b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811661053e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f576f6f4665654d616e616765723a207265626174654d616e616765725f5a455260448201527f4f5f4144445200000000000000000000000000000000000000000000000000006064820152608401610492565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061063a57506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af1158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a9190611f83565b6106a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b670de0b6b3a7640000811115610738576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f576f6f4665654d616e616765723a207661756c74526577617264526174655f4960448201527f4e56414c494400000000000000000000000000000000000000000000000000006064820152608401610492565b600355565b6002600154036107a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610492565b600260015560005473ffffffffffffffffffffffffffffffffffffffff1633148061086357506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af115801561083f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108639190611f83565b6108c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b8151815114610934576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f576f6f4665654d616e616765723a20216c656e677468000000000000000000006044820152606401610492565b6000805b8351811015610a4057600554845173ffffffffffffffffffffffffffffffffffffffff9091169063231bbff69086908490811061097757610977611fa5565b602002602001015185848151811061099157610991611fa5565b60200260200101516040518363ffffffff1660e01b81526004016109d792919073ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060405180830381600087803b1580156109f157600080fd5b505af1158015610a05573d6000803e3d6000fd5b50505050828181518110610a1b57610a1b611fa5565b602002602001015182610a2e9190612003565b9150610a398161201b565b9050610938565b5080600454610a4f9190612003565b60045550506001805550565b610a636117c2565b610a6d6000611843565b565b600260015403610adb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610492565b6002600155610b0c7f000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca3330856118b8565b6005546040517f77ea464d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015260009216906377ea464d90602401602060405180830381865afa158015610b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba19190612053565b90508015610c69576000670de0b6b3a7640000610bbe838661206c565b610bc891906120a9565b6005546040517f231bbff600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526024820184905292935091169063231bbff690604401600060405180830381600087803b158015610c3e57600080fd5b505af1158015610c52573d6000803e3d6000fd5b5050505080600454610c649190612003565b600455505b50506001805550565b60005473ffffffffffffffffffffffffffffffffffffffff16331480610d2757506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af1158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d279190611f83565b610d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b662386f26fc10000811115610dfe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f576f6f4665654d616e616765723a204645455f524154453e31250000000000006044820152606401610492565b73ffffffffffffffffffffffffffffffffffffffff821660008181526002602052604090819020839055517f98259702e6263eb2c9423b892e36fcaaaac8885fbeab7826218791df24d8498790610e589084815260200190565b60405180910390a25050565b60005473ffffffffffffffffffffffffffffffffffffffff16331480610f1957506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af1158015610ef5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f199190611f83565b610f7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b73ffffffffffffffffffffffffffffffffffffffff8116611022576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f576f6f4665654d616e616765723a206e65775661756c744d616e616765725f5a60448201527f45524f5f414444520000000000000000000000000000000000000000000000006064820152608401610492565b600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6002600154036110d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610492565b600260015560005473ffffffffffffffffffffffffffffffffffffffff1633148061118f57506007546040517fd624776500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063d6247765906024016020604051808303816000875af115801561116b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118f9190611f83565b6111f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576f6f4665654d616e616765723a202161646d696e00000000000000000000006044820152606401610492565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca73ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015611282573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a69190612053565b905060008111611312576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f576f6f4665654d616e616765723a2062616c616e63655f5a45524f00000000006044820152606401610492565b6000670de0b6b3a76400006003548361132b919061206c565b61133591906120a9565b9050801561138f57600654611382907f000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca9073ffffffffffffffffffffffffffffffffffffffff1683611a57565b61138c81836120e4565b91505b600454156113f6576005546004546113e1917f000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca9173ffffffffffffffffffffffffffffffffffffffff90911690611a57565b6004546113ee90836120e4565b600060045591505b60085461143b907f000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca9073ffffffffffffffffffffffffffffffffffffffff1684611a57565b505060018055565b61144b6117c2565b73ffffffffffffffffffffffffffffffffffffffff81166114ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f576f6f4665654d616e616765723a206e65774163636573734d616e616765725f60448201527f5a45524f5f4144445200000000000000000000000000000000000000000000006064820152608401610492565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61153d6117c2565b73ffffffffffffffffffffffffffffffffffffffff811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0361157b576115783347611bed565b50565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156115e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160c9190612053565b9050611619823383611a57565b5050565b6116256117c2565b73ffffffffffffffffffffffffffffffffffffffff81166116c7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f576f6f4665654d616e616765723a206e657754726561737572795f5a45524f5f60448201527f41444452000000000000000000000000000000000000000000000000000000006064820152608401610492565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6117166117c2565b73ffffffffffffffffffffffffffffffffffffffff81166117b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610492565b61157881611843565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a6d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610492565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052915160009283929088169161195791906120fb565b6000604051808303816000865af19150503d8060008114611994576040519150601f19603f3d011682016040523d82523d6000602084013e611999565b606091505b50915091508180156119c35750805115806119c35750808060200190518101906119c39190611f83565b611a4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c65640000000000000000000000000000006064820152608401610492565b505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691611aee91906120fb565b6000604051808303816000865af19150503d8060008114611b2b576040519150601f19603f3d011682016040523d82523d6000602084013e611b30565b606091505b5091509150818015611b5a575080511580611b5a575080806020019051810190611b5a9190611f83565b611be6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c6564000000000000000000000000000000000000006064820152608401610492565b5050505050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051611c2491906120fb565b60006040518083038185875af1925050503d8060008114611c61576040519150601f19603f3d011682016040523d82523d6000602084013e611c66565b606091505b5050905080611cf7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c65640000000000000000000000006064820152608401610492565b505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611d2057600080fd5b919050565b600060208284031215611d3757600080fd5b611d4082611cfc565b9392505050565b600060208284031215611d5957600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611dd657611dd6611d60565b604052919050565b600067ffffffffffffffff821115611df857611df8611d60565b5060051b60200190565b600082601f830112611e1357600080fd5b81356020611e28611e2383611dde565b611d8f565b82815260059290921b84018101918181019086841115611e4757600080fd5b8286015b84811015611e625780358352918301918301611e4b565b509695505050505050565b60008060408385031215611e8057600080fd5b823567ffffffffffffffff80821115611e9857600080fd5b818501915085601f830112611eac57600080fd5b81356020611ebc611e2383611dde565b82815260059290921b84018101918181019089841115611edb57600080fd5b948201945b83861015611f0057611ef186611cfc565b82529482019490820190611ee0565b96505086013592505080821115611f1657600080fd5b50611f2385828601611e02565b9150509250929050565b60008060408385031215611f4057600080fd5b82359150611f5060208401611cfc565b90509250929050565b60008060408385031215611f6c57600080fd5b611f7583611cfc565b946020939093013593505050565b600060208284031215611f9557600080fd5b81518015158114611d4057600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561201657612016611fd4565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361204c5761204c611fd4565b5060010190565b60006020828403121561206557600080fd5b5051919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156120a4576120a4611fd4565b500290565b6000826120df577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000828210156120f6576120f6611fd4565b500390565b6000825160005b8181101561211c5760208186018101518583015201612102565b8181111561212b576000828501525b50919091019291505056fea26469706673582212202e48e30732833616d67018ab4e46115953b8153f847e7fb57c9b11bad537aded64736f6c634300080e0033

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

000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca0000000000000000000000007214833be05ce39f6dcd97668e521162e6c1893700000000000000000000000032a1d9b2a85f2ef0516daabaa9c34325bc774cac00000000000000000000000015ba47e540e1b197e30d16a93b0c568b251629c2000000000000000000000000c06e2968afd4a029d4623f9a5f534c45e5bf0bdf

-----Decoded View---------------
Arg [0] : _quoteToken (address): 0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA
Arg [1] : _rebateManager (address): 0x7214833BE05Ce39f6dCd97668e521162e6C18937
Arg [2] : _vaultManager (address): 0x32a1d9B2a85F2eF0516dAAbAa9C34325BC774CAc
Arg [3] : _accessManager (address): 0x15bA47E540E1B197E30D16A93B0c568B251629c2
Arg [4] : _treasury (address): 0xc06E2968afD4a029d4623F9A5F534c45e5bf0bdf

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000d9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca
Arg [1] : 0000000000000000000000007214833be05ce39f6dcd97668e521162e6c18937
Arg [2] : 00000000000000000000000032a1d9b2a85f2ef0516daabaa9c34325bc774cac
Arg [3] : 00000000000000000000000015ba47e540e1b197e30d16a93b0c568b251629c2
Arg [4] : 000000000000000000000000c06e2968afd4a029d4623f9a5f534c45e5bf0bdf


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.