GLMR Price: $0.51 (-3.85%)
Gas: 151 GWei

Contract

0xCC5159506E3ab58F555E8B6A88637d7A5921e6d1

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo0 GLMR

GLMR Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Distribute3736632022-02-09 9:19:00778 days ago1644398340IN
0xCC515950...A5921e6d1
0 GLMR0.0075142100
Collect3736522022-02-09 9:16:48778 days ago1644398208IN
0xCC515950...A5921e6d1
0 GLMR0.0066212100
Add New Pool3736502022-02-09 9:16:24778 days ago1644398184IN
0xCC515950...A5921e6d1
0 GLMR0.0038273100
Initialize3736482022-02-09 9:16:00778 days ago1644398160IN
0xCC515950...A5921e6d1
0 GLMR0.009119100
0x608060403736402022-02-09 9:14:24778 days ago1644398064IN
 Contract Creation
0 GLMR0.1329565100

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x98cFAde3...Cf271d28c
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
FeeConverter

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 10 : FeeConverter.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IStableSwap.sol";
import "../interfaces/IMultiFeeDistribution.sol";
import "../interfaces/ILPToken.sol";

contract FeeConverter is Ownable, Initializable {
    using SafeERC20 for IERC20;
    using SafeERC20 for ILPToken;

    /// @notice target token which all fees will be converted to
    IERC20 public target;

    /// @notice basePoolLp token address
    address public basePoolLP;

    /// @notice feeDistributor to which fee is distribute
    address public feeDistributor;

    /// @notice pools to which fee is collected
    address[] public pools;

    uint256 public constant SWAP_TIMEOUT = 1000;

    function initialize(
        IERC20 _target,
        address _basePoolLP,
        address _distributor
    ) external initializer {
        require(address(_target) != address(0));
        require(_basePoolLP != address(0));
        require(_distributor != address(0));
        target = _target;
        basePoolLP = _basePoolLP;
        feeDistributor = _distributor;
    }

    // =================================================
    //      VIEWS
    // =================================================

    function balance() public view returns (uint256) {
        return IERC20(target).balanceOf(address(this));
    }

    // =================================================
    //      MUTATIVE
    // =================================================

    function collect() external onlyOwner {
        for (uint256 i = 0; i < pools.length; i++) {
            IStableSwap(pools[i]).withdrawAdminFee();
            _convertFees(pools[i]);
        }
        _convertBasePoolLp();
    }

    function distribute(uint256 _amount) external onlyOwner {
        require(_amount <= balance(), "Not enough fund");
        target.safeIncreaseAllowance(feeDistributor, _amount);
        IMultiFeeDistribution(feeDistributor).notifyRewardAmount(target, _amount);
    }

    function addNewPool(address _pool) external onlyOwner {
        for (uint256 i = 0; i < pools.length; i++) {
            if (pools[i] == _pool) {
                return;
            }
        }
        pools.push(_pool);
    }

    function removePool(address _pool) external onlyOwner {
        for (uint256 i = 0; i < pools.length; i++) {
            if (pools[i] == _pool) {
                pools[i] = pools[pools.length - 1];
                pools.pop();
                return;
            }
        }
    }

    // =================================================
    //      INTERNALS
    // =================================================

    function _convertFees(address _poolAddress) internal {
        IStableSwap pool = IStableSwap(_poolAddress);

        // check if pool is basepool
        if (address(pool.getLpToken()) == basePoolLP) {
            return _convertFeesForBasePool(pool);
        }

        // other pools is meta pool
        IERC20[] memory tokens = pool.getTokens();
        uint8 basePoolLPIndex = pool.getTokenIndex(basePoolLP);

        for (uint8 i = 0; i < tokens.length; i++) {
            IERC20 token = tokens[i];
            if (i != basePoolLPIndex) {
                uint256 amount = token.balanceOf(address(this));
                if (amount > 0) {
                    token.safeIncreaseAllowance(_poolAddress, amount);
                    pool.swap(i, basePoolLPIndex, amount, 0, block.timestamp + SWAP_TIMEOUT);
                }
            }
        }
    }

    function _convertFeesForBasePool(IStableSwap _pool) internal {
        IERC20[] memory tokens = _pool.getTokens();
        uint8 targetIndex = _pool.getTokenIndex(address(target));

        for (uint8 i = 0; i < tokens.length; i++) {
            IERC20 token = tokens[i];
            if (i != targetIndex) {
                uint256 amount = token.balanceOf(address(this));

                if (amount > 0) {
                    token.safeIncreaseAllowance(address(_pool), amount);
                    _pool.swap(i, targetIndex, amount, 0, block.timestamp + SWAP_TIMEOUT);
                }
            }
        }
    }

    function _convertBasePoolLp() internal {
        // remove all BasePool LP Token to `target`
        ILPToken baseLP = ILPToken(basePoolLP);
        address basePoolAddress = baseLP.swap();
        IStableSwap basePool = IStableSwap(basePoolAddress);

        uint256 amount = baseLP.balanceOf(address(this));
        if (amount > 0) {
            baseLP.safeIncreaseAllowance(basePoolAddress, amount);
            uint8 targetIndex = basePool.getTokenIndex(address(target));
            basePool.removeLiquidityOneToken(amount, targetIndex, 0, block.timestamp + SWAP_TIMEOUT);
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 3 of 10 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

        _;

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

File 4 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT

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

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 10 : IStableSwap.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;

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

interface IStableSwap {
    /// EVENTS
    event AddLiquidity(
        address indexed provider,
        uint256[] tokenAmounts,
        uint256[] fees,
        uint256 invariant,
        uint256 tokenSupply
    );

    event TokenExchange(
        address indexed buyer,
        uint256 soldId,
        uint256 tokensSold,
        uint256 boughtId,
        uint256 tokensBought
    );

    event RemoveLiquidity(address indexed provider, uint256[] tokenAmounts, uint256[] fees, uint256 tokenSupply);

    event RemoveLiquidityOne(address indexed provider, uint256 tokenIndex, uint256 tokenAmount, uint256 coinAmount);

    event RemoveLiquidityImbalance(
        address indexed provider,
        uint256[] tokenAmounts,
        uint256[] fees,
        uint256 invariant,
        uint256 tokenSupply
    );

    event RampA(uint256 oldA, uint256 newA, uint256 initialTime, uint256 futureTime);

    event StopRampA(uint256 A, uint256 timestamp);

    event NewFee(uint256 fee, uint256 adminFee);

    event CollectProtocolFee(address token, uint256 amount);

    event FeeControllerChanged(address newController);

    event FeeDistributorChanged(address newController);

    // pool data view functions
    function getLpToken() external view returns (IERC20 lpToken);

    function getA() external view returns (uint256);

    function getAPrecise() external view returns (uint256);

    function getToken(uint8 index) external view returns (IERC20);

    function getTokens() external view returns (IERC20[] memory);

    function getTokenIndex(address tokenAddress) external view returns (uint8);

    function getTokenBalance(uint8 index) external view returns (uint256);

    function getTokenBalances() external view returns (uint256[] memory);

    function getNumberOfTokens() external view returns (uint256);

    function getVirtualPrice() external view returns (uint256);

    function calculateTokenAmount(uint256[] calldata amounts, bool deposit) external view returns (uint256);

    function calculateSwap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx
    ) external view returns (uint256);

    function calculateRemoveLiquidity(uint256 amount) external view returns (uint256[] memory);

    function calculateRemoveLiquidityOneToken(uint256 tokenAmount, uint8 tokenIndex)
        external
        view
        returns (uint256 availableTokenAmount);

    function getAdminBalances() external view returns (uint256[] memory adminBalances);

    function getAdminBalance(uint8 index) external view returns (uint256);

    // state modifying functions
    function swap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx,
        uint256 minDy,
        uint256 deadline
    ) external returns (uint256);

    function addLiquidity(
        uint256[] calldata amounts,
        uint256 minToMint,
        uint256 deadline
    ) external returns (uint256);

    function removeLiquidity(
        uint256 amount,
        uint256[] calldata minAmounts,
        uint256 deadline
    ) external returns (uint256[] memory);

    function removeLiquidityOneToken(
        uint256 tokenAmount,
        uint8 tokenIndex,
        uint256 minAmount,
        uint256 deadline
    ) external returns (uint256);

    function removeLiquidityImbalance(
        uint256[] calldata amounts,
        uint256 maxBurnAmount,
        uint256 deadline
    ) external returns (uint256);

    function withdrawAdminFee() external;
}

File 6 of 10 : IMultiFeeDistribution.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IMultiFeeDistribution {
    function addReward(address rewardsToken, address distributor) external;
    function mint(address user, uint256 amount) external;
    function notifyRewardAmount(IERC20 rewardsToken, uint256 reward) external;
}

File 7 of 10 : ILPToken.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;

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

interface ILPToken is IERC20 {
    function swap() external returns (address);
}

File 8 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 9 of 10 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 10 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"SWAP_TIMEOUT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"addNewPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"basePoolLP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeDistributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_target","type":"address"},{"internalType":"address","name":"_basePoolLP","type":"address"},{"internalType":"address","name":"_distributor","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"removePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"target","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063ac4afa381161008c578063d4b8399211610066578063d4b83992146101b8578063e4f13504146101cb578063e5225381146101de578063f2fde38b146101e657600080fd5b8063ac4afa381461018a578063b69ef8a81461019d578063c0c53b8b146101a557600080fd5b806353732cad116100c857806353732cad14610147578063715018a61461015e5780638da5cb5b1461016657806391c05b0b1461017757600080fd5b80630a3a809c146100ef5780630d43e8ad1461011f5780633b7d094614610132575b600080fd5b600254610102906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b600354610102906001600160a01b031681565b6101456101403660046114d3565b6101f9565b005b6101506103e881565b604051908152602001610116565b610145610371565b6000546001600160a01b0316610102565b61014561018536600461163c565b6103a7565b61010261019836600461163c565b6104a2565b6101506104cc565b6101456101b33660046115f2565b61054d565b600154610102906001600160a01b031681565b6101456101d93660046114d3565b61068c565b610145610770565b6101456101f43660046114d3565b610881565b6000546001600160a01b0316331461022c5760405162461bcd60e51b8152600401610223906116dc565b60405180910390fd5b60005b60045481101561036c57816001600160a01b03166004828154811061026457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316141561035a576004805461028f90600190611729565b815481106102ad57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600480546001600160a01b0390921691839081106102e757634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600480548061033457634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806103648161176c565b91505061022f565b505b50565b6000546001600160a01b0316331461039b5760405162461bcd60e51b8152600401610223906116dc565b6103a56000610915565b565b6000546001600160a01b031633146103d15760405162461bcd60e51b8152600401610223906116dc565b6103d96104cc565b81111561041a5760405162461bcd60e51b815260206004820152600f60248201526e139bdd08195b9bdd59da08199d5b99608a1b6044820152606401610223565b600354600154610437916001600160a01b03918216911683610965565b60035460015460405163b66503cf60e01b81526001600160a01b0391821660048201526024810184905291169063b66503cf90604401600060405180830381600087803b15801561048757600080fd5b505af115801561049b573d6000803e3d6000fd5b5050505050565b600481815481106104b257600080fd5b6000918252602090912001546001600160a01b0316905081565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561051057600080fd5b505afa158015610524573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105489190611654565b905090565b600054600160a81b900460ff168061056f5750600054600160a01b900460ff16155b6105d25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610223565b600054600160a81b900460ff161580156105fc576000805461ffff60a01b191661010160a01b1790555b6001600160a01b03841661060f57600080fd5b6001600160a01b03831661062257600080fd5b6001600160a01b03821661063557600080fd5b600180546001600160a01b038087166001600160a01b0319928316179092556002805486841690831617905560038054928516929091169190911790558015610686576000805460ff60a81b191690555b50505050565b6000546001600160a01b031633146106b65760405162461bcd60e51b8152600401610223906116dc565b60005b60045481101561071f57816001600160a01b0316600482815481106106ee57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316141561070d575050565b806107178161176c565b9150506106b9565b50600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0383166001600160a01b031990911617905550565b6000546001600160a01b0316331461079a5760405162461bcd60e51b8152600401610223906116dc565b60005b60045481101561087857600481815481106107c857634e487b7160e01b600052603260045260246000fd5b60009182526020822001546040805163fe49abe360e01b815290516001600160a01b039092169263fe49abe39260048084019382900301818387803b15801561081057600080fd5b505af1158015610824573d6000803e3d6000fd5b505050506108666004828154811061084c57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316610a48565b806108708161176c565b91505061079d565b506103a5610d85565b6000546001600160a01b031633146108ab5760405162461bcd60e51b8152600401610223906116dc565b6001600160a01b0381166109105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610223565b61036e815b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b1580156109b157600080fd5b505afa1580156109c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e99190611654565b6109f39190611711565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610686908590610fd0565b600254604080516320853d6960e21b8152905183926001600160a01b039081169290841691638214f5a491600480820192602092909190829003018186803b158015610a9357600080fd5b505afa158015610aa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acb91906114ef565b6001600160a01b03161415610ae35761036c816110a7565b6000816001600160a01b031663aa6ca8086040518163ffffffff1660e01b815260040160006040518083038186803b158015610b1e57600080fd5b505afa158015610b32573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b5a919081019061150b565b6002546040516319b02f4960e21b81526001600160a01b039182166004820152919250600091908416906366c0bd249060240160206040518083038186803b158015610ba557600080fd5b505afa158015610bb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdd919061166c565b905060005b82518160ff16101561049b576000838260ff1681518110610c1357634e487b7160e01b600052603260045260246000fd5b602002602001015190508260ff168260ff1614610d72576040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b158015610c6c57600080fd5b505afa158015610c80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca49190611654565b90508015610d7057610cc06001600160a01b0383168883610965565b6001600160a01b03861663916955868486846000610ce06103e842611711565b6040516001600160e01b031960e088901b16815260ff958616600482015294909316602485015260448401919091526064830152608482015260a401602060405180830381600087803b158015610d3657600080fd5b505af1158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e9190611654565b505b505b5080610d7d81611787565b915050610be2565b60025460408051638119c06560e01b815290516001600160a01b03909216916000918391638119c0659160048082019260209290919082900301818787803b158015610dd057600080fd5b505af1158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0891906114ef565b6040516370a0823160e01b815230600482015290915081906000906001600160a01b038516906370a082319060240160206040518083038186803b158015610e4f57600080fd5b505afa158015610e63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e879190611654565b9050801561068657610ea36001600160a01b0385168483610965565b6001546040516319b02f4960e21b81526001600160a01b0391821660048201526000918416906366c0bd249060240160206040518083038186803b158015610eea57600080fd5b505afa158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f22919061166c565b90506001600160a01b038316633e3a156083836000610f436103e842611711565b6040516001600160e01b031960e087901b168152600481019490945260ff909216602484015260448301526064820152608401602060405180830381600087803b158015610f9057600080fd5b505af1158015610fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc89190611654565b505050505050565b6000611025826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113499092919063ffffffff16565b8051909150156110a2578080602001905181019061104391906115d2565b6110a25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610223565b505050565b6000816001600160a01b031663aa6ca8086040518163ffffffff1660e01b815260040160006040518083038186803b1580156110e257600080fd5b505afa1580156110f6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261111e919081019061150b565b6001546040516319b02f4960e21b81526001600160a01b039182166004820152919250600091908416906366c0bd249060240160206040518083038186803b15801561116957600080fd5b505afa15801561117d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a1919061166c565b905060005b82518160ff161015610686576000838260ff16815181106111d757634e487b7160e01b600052603260045260246000fd5b602002602001015190508260ff168260ff1614611336576040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b15801561123057600080fd5b505afa158015611244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112689190611654565b90508015611334576112846001600160a01b0383168783610965565b6001600160a01b038616639169558684868460006112a46103e842611711565b6040516001600160e01b031960e088901b16815260ff958616600482015294909316602485015260448401919091526064830152608482015260a401602060405180830381600087803b1580156112fa57600080fd5b505af115801561130e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113329190611654565b505b505b508061134181611787565b9150506111a6565b60606113588484600085611362565b90505b9392505050565b6060824710156113c35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610223565b843b6114115760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610223565b600080866001600160a01b0316858760405161142d919061168d565b60006040518083038185875af1925050503d806000811461146a576040519150601f19603f3d011682016040523d82523d6000602084013e61146f565b606091505b509150915061147f82828661148a565b979650505050505050565b6060831561149957508161135b565b8251156114a95782518084602001fd5b8160405162461bcd60e51b815260040161022391906116a9565b80516114ce816117d3565b919050565b6000602082840312156114e4578081fd5b813561135b816117d3565b600060208284031215611500578081fd5b815161135b816117d3565b6000602080838503121561151d578182fd5b825167ffffffffffffffff80821115611534578384fd5b818501915085601f830112611547578384fd5b815181811115611559576115596117bd565b8060051b604051601f19603f8301168101818110858211171561157e5761157e6117bd565b604052828152858101935084860182860187018a101561159c578788fd5b8795505b838610156115c5576115b1816114c3565b8552600195909501949386019386016115a0565b5098975050505050505050565b6000602082840312156115e3578081fd5b8151801515811461135b578182fd5b600080600060608486031215611606578182fd5b8335611611816117d3565b92506020840135611621816117d3565b91506040840135611631816117d3565b809150509250925092565b60006020828403121561164d578081fd5b5035919050565b600060208284031215611665578081fd5b5051919050565b60006020828403121561167d578081fd5b815160ff8116811461135b578182fd5b6000825161169f818460208701611740565b9190910192915050565b60208152600082518060208401526116c8816040850160208701611740565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115611724576117246117a7565b500190565b60008282101561173b5761173b6117a7565b500390565b60005b8381101561175b578181015183820152602001611743565b838111156106865750506000910152565b6000600019821415611780576117806117a7565b5060010190565b600060ff821660ff81141561179e5761179e6117a7565b60010192915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461036e57600080fdfea26469706673582212208ac96770907113378c44627ddc2a62b0493742710dedf34c16ad10356f6cfca864736f6c63430008040033

Block Transaction Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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