Contract 0x56908a201Eb6a4c4A35B833e5e9749650228FF5e

 

Contract Overview

Seamless Protocol: Reward Pool Factory
Balance:
0 ETH

EtherValue:
$0.00
Txn Hash Method
Block
From
To
Value
0x77bfee6e6e2732ca915107294a368cd088709a52c3511e11ececbf5b2f9c537f0x6080604036180602023-09-06 18:37:47222 days 8 hrs agoSeamless Protocol: Deployer IN  Create: RewardPoolFactory0 ETH0.0020857610781
[ Download CSV Export 
Latest 5 internal transactions
Parent Txn Hash Block From To Value
0x294f2d3450bc40ee47c257f3dbbdccabedba0829494f0e718b55536492f2f21782402842023-12-22 18:31:55115 days 8 hrs ago Seamless Protocol: Reward Pool Factory  Contract Creation0 ETH
0x122e13e62fa60f5f4bf9884758d2956c30d7a5c591ae9587c005f4593481940582401792023-12-22 18:28:25115 days 8 hrs ago Seamless Protocol: Reward Pool Factory  Contract Creation0 ETH
0xde5e9aa80b079bc1a17fdb407a93227b91ba9d82279923b94a891f0c832f51bb82395982023-12-22 18:09:03115 days 9 hrs ago Seamless Protocol: Reward Pool Factory  Contract Creation0 ETH
0x71a66b71def4d043c2ab3ded0dee05751d7b366239efcc8df08a4a9848fa45dd36185952023-09-06 18:55:37222 days 8 hrs ago Seamless Protocol: Reward Pool Factory  Contract Creation0 ETH
0x571f8f24cbd005ae69a9cc560ede541ba89fbd3dab2cf2070435aaa244e8b91436184092023-09-06 18:49:25222 days 8 hrs ago Seamless Protocol: Reward Pool Factory  Contract Creation0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RewardPoolFactory

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 11 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 2 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 3 of 11 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 4 of 11 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

    struct Set {
        // Storage of set values
        bytes32[] _values;

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

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

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

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

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

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

File 5 of 11 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.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 6 of 11 : IFactory.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;

interface IFactory {
    function create(bytes calldata args) external returns (address instance);

    function create2(bytes calldata args, bytes32 salt) external returns (address instance);
}

File 7 of 11 : InstanceRegistry.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;

import {EnumerableSet} from "@openzeppelin/contracts/utils/EnumerableSet.sol";

interface IInstanceRegistry {
    /* events */

    event InstanceAdded(address instance);
    event InstanceRemoved(address instance);

    /* view functions */

    function isInstance(address instance) external view returns (bool validity);

    function instanceCount() external view returns (uint256 count);

    function instanceAt(uint256 index) external view returns (address instance);
}

/// @title InstanceRegistry
/// @dev Security contact: [email protected]
contract InstanceRegistry is IInstanceRegistry {
    using EnumerableSet for EnumerableSet.AddressSet;

    /* storage */

    EnumerableSet.AddressSet private _instanceSet;

    /* view functions */

    function isInstance(address instance) external view override returns (bool validity) {
        return _instanceSet.contains(instance);
    }

    function instanceCount() external view override returns (uint256 count) {
        return _instanceSet.length();
    }

    function instanceAt(uint256 index) external view override returns (address instance) {
        return _instanceSet.at(index);
    }

    /* admin functions */

    function _register(address instance) internal {
        require(_instanceSet.add(instance), "InstanceRegistry: already registered");
        emit InstanceAdded(instance);
    }
}

File 8 of 11 : RewardPoolFactory.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;

import {EnumerableSet} from "@openzeppelin/contracts/utils/EnumerableSet.sol";

import {IFactory} from "./IFactory.sol";
import {InstanceRegistry} from "./InstanceRegistry.sol";
import {RewardPool} from "../RewardPool.sol";

/// @title Reward Pool Factory
/// @dev Security contact: [email protected]
contract RewardPoolFactory is IFactory, InstanceRegistry {
    function create(bytes calldata args) external override returns (address) {
        address powerSwitch = abi.decode(args, (address));
        RewardPool pool = new RewardPool(powerSwitch);
        InstanceRegistry._register(address(pool));
        pool.transferOwnership(msg.sender);
        return address(pool);
    }

    function create2(bytes calldata, bytes32) external pure override returns (address) {
        revert("RewardPoolFactory: unused function");
    }
}

File 9 of 11 : Powered.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;

import {IPowerSwitch} from "./PowerSwitch.sol";

interface IPowered {
    function isOnline() external view returns (bool status);

    function isOffline() external view returns (bool status);

    function isShutdown() external view returns (bool status);

    function getPowerSwitch() external view returns (address powerSwitch);

    function getPowerController() external view returns (address controller);
}

/// @title Powered
/// @notice Helper for calling external PowerSwitch
/// @dev Security contact: [email protected]
contract Powered is IPowered {
    /* storage */

    address private _powerSwitch;

    /* modifiers */

    modifier onlyOnline() {
        _onlyOnline();
        _;
    }

    modifier onlyOffline() {
        _onlyOffline();
        _;
    }

    modifier notShutdown() {
        _notShutdown();
        _;
    }

    modifier onlyShutdown() {
        _onlyShutdown();
        _;
    }

    /* initializer */

    function _setPowerSwitch(address powerSwitch) internal {
        _powerSwitch = powerSwitch;
    }

    /* getter functions */

    function isOnline() public view override returns (bool status) {
        return IPowerSwitch(_powerSwitch).isOnline();
    }

    function isOffline() public view override returns (bool status) {
        return IPowerSwitch(_powerSwitch).isOffline();
    }

    function isShutdown() public view override returns (bool status) {
        return IPowerSwitch(_powerSwitch).isShutdown();
    }

    function getPowerSwitch() public view override returns (address powerSwitch) {
        return _powerSwitch;
    }

    function getPowerController() public view override returns (address controller) {
        return IPowerSwitch(_powerSwitch).getPowerController();
    }

    /* convenience functions */

    function _onlyOnline() private view {
        require(isOnline(), "Powered: is not online");
    }

    function _onlyOffline() private view {
        require(isOffline(), "Powered: is not offline");
    }

    function _notShutdown() private view {
        require(!isShutdown(), "Powered: is shutdown");
    }

    function _onlyShutdown() private view {
        require(isShutdown(), "Powered: is not shutdown");
    }
}

File 10 of 11 : PowerSwitch.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;

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

interface IPowerSwitch {
    /* admin events */

    event PowerOn();
    event PowerOff();
    event EmergencyShutdown();

    /* data types */

    enum State {Online, Offline, Shutdown}

    /* admin functions */

    function powerOn() external;

    function powerOff() external;

    function emergencyShutdown() external;

    /* view functions */

    function isOnline() external view returns (bool status);

    function isOffline() external view returns (bool status);

    function isShutdown() external view returns (bool status);

    function getStatus() external view returns (State status);

    function getPowerController() external view returns (address controller);
}

/// @title PowerSwitch
/// @notice Standalone pausing and emergency stop functionality
/// @dev Security contact: [email protected]
contract PowerSwitch is IPowerSwitch, Ownable {
    /* storage */

    IPowerSwitch.State private _status;

    /* initializer */

    constructor(address owner) {
        // sanity check owner
        require(owner != address(0), "PowerSwitch: invalid owner");
        // transfer ownership
        Ownable.transferOwnership(owner);
    }

    /* admin functions */

    /// @notice Turn Power On
    /// access control: only admin
    /// state machine: only when offline
    /// state scope: only modify _status
    /// token transfer: none
    function powerOn() external override onlyOwner {
        require(_status == IPowerSwitch.State.Offline, "PowerSwitch: cannot power on");
        _status = IPowerSwitch.State.Online;
        emit PowerOn();
    }

    /// @notice Turn Power Off
    /// access control: only admin
    /// state machine: only when online
    /// state scope: only modify _status
    /// token transfer: none
    function powerOff() external override onlyOwner {
        require(_status == IPowerSwitch.State.Online, "PowerSwitch: cannot power off");
        _status = IPowerSwitch.State.Offline;
        emit PowerOff();
    }

    /// @notice Shutdown Permanently
    /// access control: only admin
    /// state machine:
    /// - when online or offline
    /// - can only be called once
    /// state scope: only modify _status
    /// token transfer: none
    function emergencyShutdown() external override onlyOwner {
        require(_status != IPowerSwitch.State.Shutdown, "PowerSwitch: cannot shutdown");
        _status = IPowerSwitch.State.Shutdown;
        emit EmergencyShutdown();
    }

    /* getter functions */

    function isOnline() external view override returns (bool status) {
        return _status == State.Online;
    }

    function isOffline() external view override returns (bool status) {
        return _status == State.Offline;
    }

    function isShutdown() external view override returns (bool status) {
        return _status == State.Shutdown;
    }

    function getStatus() external view override returns (IPowerSwitch.State status) {
        return _status;
    }

    function getPowerController() external view override returns (address controller) {
        return Ownable.owner();
    }
}

File 11 of 11 : RewardPool.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {TransferHelper} from "@uniswap/lib/contracts/libraries/TransferHelper.sol";

import {Powered} from "./PowerSwitch/Powered.sol";

interface IRewardPool {
    function sendERC20(
        address token,
        address to,
        uint256 value
    ) external;

    function rescueERC20(address[] calldata tokens, address recipient) external;
}

/// @title Reward Pool
/// @notice Vault for isolated storage of reward tokens
/// @dev Security contact: [email protected]
contract RewardPool is IRewardPool, Powered, Ownable {
    /* initializer */

    constructor(address powerSwitch) {
        Powered._setPowerSwitch(powerSwitch);
    }

    /* user functions */

    /// @notice Send an ERC20 token
    /// access control: only owner
    /// state machine:
    ///   - can be called multiple times
    ///   - only online
    /// state scope: none
    /// token transfer: transfer tokens from self to recipient
    /// @param token address The token to send
    /// @param to address The recipient to send to
    /// @param value uint256 Amount of tokens to send
    function sendERC20(
        address token,
        address to,
        uint256 value
    ) external override onlyOwner onlyOnline {
        TransferHelper.safeTransfer(token, to, value);
    }

    /* emergency functions */

    /// @notice Rescue multiple ERC20 tokens
    /// access control: only power controller
    /// state machine:
    ///   - can be called multiple times
    ///   - only shutdown
    /// state scope: none
    /// token transfer: transfer tokens from self to recipient
    /// @param tokens address[] The tokens to rescue
    /// @param recipient address The recipient to rescue to
    function rescueERC20(address[] calldata tokens, address recipient) external override onlyShutdown {
        // only callable by controller
        require(msg.sender == Powered.getPowerController(), "RewardPool: only controller can withdraw after shutdown");

        // assert recipient is defined
        require(recipient != address(0), "RewardPool: recipient not defined");

        // transfer tokens
        for (uint256 index = 0; index < tokens.length; index++) {
            // get token
            address token = tokens[index];
            // get balance
            uint256 balance = IERC20(token).balanceOf(address(this));
            // transfer token
            TransferHelper.safeTransfer(token, recipient, balance);
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"instance","type":"address"}],"name":"InstanceAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"instance","type":"address"}],"name":"InstanceRemoved","type":"event"},{"inputs":[{"internalType":"bytes","name":"args","type":"bytes"}],"name":"create","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"create2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"instanceAt","outputs":[{"internalType":"address","name":"instance","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instanceCount","outputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"instance","type":"address"}],"name":"isInstance","outputs":[{"internalType":"bool","name":"validity","type":"bool"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50611100806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80638c0b8db2116100505780638c0b8db2146100df578063cf5ba53f1461014f578063ec56c716146101bf57610067565b806311d8293e1461006c5780636b44e6be146100a5575b600080fd5b6100896004803603602081101561008257600080fd5b50356101d9565b604080516001600160a01b039092168252519081900360200190f35b6100cb600480360360208110156100bb57600080fd5b50356001600160a01b03166101eb565b604080519115158252519081900360200190f35b610089600480360360408110156100f557600080fd5b81019060208101813564010000000081111561011057600080fd5b82018360208201111561012257600080fd5b8035906020019184600183028401116401000000008311171561014457600080fd5b9193509150356101f7565b6100896004803603602081101561016557600080fd5b81019060208101813564010000000081111561018057600080fd5b82018360208201111561019257600080fd5b803590602001918460018302840111640100000000831117156101b457600080fd5b509092509050610230565b6101c761031c565b60408051918252519081900360200190f35b60006101e5818361032d565b92915050565b60006101e58183610340565b600060405162461bcd60e51b81526004018080602001828103825260228152602001806110856022913960400191505060405180910390fd5b6000808383602081101561024357600080fd5b5060405190356001600160a01b031691506000908290610262906104c4565b6001600160a01b03909116815260405190819003602001906000f08015801561028f573d6000803e3d6000fd5b50905061029b81610355565b604080517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290516001600160a01b0383169163f2fde38b91602480830192600092919082900301818387803b1580156102fb57600080fd5b505af115801561030f573d6000803e3d6000fd5b5092979650505050505050565b600061032860006103da565b905090565b600061033983836103e5565b9392505050565b6000610339836001600160a01b038416610449565b610360600082610461565b61039b5760405162461bcd60e51b81526004018080602001828103825260248152602001806110a76024913960400191505060405180910390fd5b604080516001600160a01b038316815290517fee3a98e49d5a27452a99d57c90a7f73d4b2e44de88c6ded02e69c4ed964edd5a9181900360200190a150565b60006101e582610476565b815460009082106104275760405162461bcd60e51b81526004018080602001828103825260228152602001806110636022913960400191505060405180910390fd5b82600001828154811061043657fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b6000610339836001600160a01b03841661047a565b5490565b60006104868383610449565b6104bc575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556101e5565b5060006101e5565b610b91806104d28339019056fe608060405234801561001057600080fd5b50604051610b91380380610b918339818101604052602081101561003357600080fd5b5051600061003f6100a6565b600180546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506100a0816100aa60201b61076d1760201c565b506100cc565b3390565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b610ab6806100db6000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063b27704fa1161005b578063b27704fa1461015b578063bf86d690146101d4578063f2fde38b146101dc576100be565b80638da5cb5b1461011d5780638f975a6414610125576100be565b8063715018a6116100a7578063715018a6146100e7578063766f13bc146100f15780638531a63614610115576100be565b8063438cae7e146100c3578063664ab18e146100df575b600080fd5b6100cb610202565b604080519115158252519081900360200190f35b6100cb610282565b6100ef6102d1565b005b6100f961039c565b604080516001600160a01b039092168252519081900360200190f35b6100f96103eb565b6100f96103fa565b6100ef6004803603606081101561013b57600080fd5b506001600160a01b03813581169160208101359091169060400135610409565b6100ef6004803603604081101561017157600080fd5b81019060208101813564010000000081111561018c57600080fd5b82018360208201111561019e57600080fd5b803590602001918460208302840111640100000000831117156101c057600080fd5b9193509150356001600160a01b0316610495565b6100cb6105fc565b6100ef600480360360208110156101f257600080fd5b50356001600160a01b031661064b565b60008060009054906101000a90046001600160a01b03166001600160a01b031663438cae7e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561025157600080fd5b505afa158015610265573d6000803e3d6000fd5b505050506040513d602081101561027b57600080fd5b5051905090565b60008060009054906101000a90046001600160a01b03166001600160a01b031663664ab18e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561025157600080fd5b6102d961079c565b6001600160a01b03166102ea6103fa565b6001600160a01b031614610345576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36001805473ffffffffffffffffffffffffffffffffffffffff19169055565b60008060009054906101000a90046001600160a01b03166001600160a01b031663766f13bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561025157600080fd5b6000546001600160a01b031690565b6001546001600160a01b031690565b61041161079c565b6001600160a01b03166104226103fa565b6001600160a01b03161461047d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6104856107a0565b6104908383836107fb565b505050565b61049d61097c565b6104a561039c565b6001600160a01b0316336001600160a01b0316146104f45760405162461bcd60e51b81526004018080602001828103825260378152602001806109fc6037913960400191505060405180910390fd5b6001600160a01b0381166105395760405162461bcd60e51b8152600401808060200182810382526021815260200180610a336021913960400191505060405180910390fd5b60005b828110156105f657600084848381811061055257fe5b905060200201356001600160a01b031690506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156105b357600080fd5b505afa1580156105c7573d6000803e3d6000fd5b505050506040513d60208110156105dd57600080fd5b505190506105ec8285836107fb565b505060010161053c565b50505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663bf86d6906040518163ffffffff1660e01b815260040160206040518083038186803b15801561025157600080fd5b61065361079c565b6001600160a01b03166106646103fa565b6001600160a01b0316146106bf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107045760405162461bcd60e51b81526004018080602001828103825260268152602001806109d66026913960400191505060405180910390fd5b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b3390565b6107a8610282565b6107f9576040805162461bcd60e51b815260206004820152601660248201527f506f77657265643a206973206e6f74206f6e6c696e6500000000000000000000604482015290519081900360640190fd5b565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b602083106108a55780518252601f199092019160209182019101610886565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610907576040519150601f19603f3d011682016040523d82523d6000602084013e61090c565b606091505b509150915081801561093a57508051158061093a575080806020019051602081101561093757600080fd5b50515b6109755760405162461bcd60e51b815260040180806020018281038252602d815260200180610a54602d913960400191505060405180910390fd5b5050505050565b6109846105fc565b6107f9576040805162461bcd60e51b815260206004820152601860248201527f506f77657265643a206973206e6f742073687574646f776e0000000000000000604482015290519081900360640190fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373526577617264506f6f6c3a206f6e6c7920636f6e74726f6c6c65722063616e2077697468647261772061667465722073687574646f776e526577617264506f6f6c3a20726563697069656e74206e6f7420646566696e65645472616e7366657248656c7065723a3a736166655472616e736665723a207472616e73666572206661696c6564a2646970667358221220e29081a8e5d9016ef6d675f549490171cd24c1d0a9be0846d42e1f5abf5b0ed964736f6c63430007060033456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473526577617264506f6f6c466163746f72793a20756e757365642066756e6374696f6e496e7374616e636552656769737472793a20616c72656164792072656769737465726564a2646970667358221220d5181cd3b8df3ea95dd854f676ae36522ce0b0d5800ce991ece9ae70c918c72264736f6c63430007060033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100675760003560e01c80638c0b8db2116100505780638c0b8db2146100df578063cf5ba53f1461014f578063ec56c716146101bf57610067565b806311d8293e1461006c5780636b44e6be146100a5575b600080fd5b6100896004803603602081101561008257600080fd5b50356101d9565b604080516001600160a01b039092168252519081900360200190f35b6100cb600480360360208110156100bb57600080fd5b50356001600160a01b03166101eb565b604080519115158252519081900360200190f35b610089600480360360408110156100f557600080fd5b81019060208101813564010000000081111561011057600080fd5b82018360208201111561012257600080fd5b8035906020019184600183028401116401000000008311171561014457600080fd5b9193509150356101f7565b6100896004803603602081101561016557600080fd5b81019060208101813564010000000081111561018057600080fd5b82018360208201111561019257600080fd5b803590602001918460018302840111640100000000831117156101b457600080fd5b509092509050610230565b6101c761031c565b60408051918252519081900360200190f35b60006101e5818361032d565b92915050565b60006101e58183610340565b600060405162461bcd60e51b81526004018080602001828103825260228152602001806110856022913960400191505060405180910390fd5b6000808383602081101561024357600080fd5b5060405190356001600160a01b031691506000908290610262906104c4565b6001600160a01b03909116815260405190819003602001906000f08015801561028f573d6000803e3d6000fd5b50905061029b81610355565b604080517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290516001600160a01b0383169163f2fde38b91602480830192600092919082900301818387803b1580156102fb57600080fd5b505af115801561030f573d6000803e3d6000fd5b5092979650505050505050565b600061032860006103da565b905090565b600061033983836103e5565b9392505050565b6000610339836001600160a01b038416610449565b610360600082610461565b61039b5760405162461bcd60e51b81526004018080602001828103825260248152602001806110a76024913960400191505060405180910390fd5b604080516001600160a01b038316815290517fee3a98e49d5a27452a99d57c90a7f73d4b2e44de88c6ded02e69c4ed964edd5a9181900360200190a150565b60006101e582610476565b815460009082106104275760405162461bcd60e51b81526004018080602001828103825260228152602001806110636022913960400191505060405180910390fd5b82600001828154811061043657fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b6000610339836001600160a01b03841661047a565b5490565b60006104868383610449565b6104bc575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556101e5565b5060006101e5565b610b91806104d28339019056fe608060405234801561001057600080fd5b50604051610b91380380610b918339818101604052602081101561003357600080fd5b5051600061003f6100a6565b600180546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506100a0816100aa60201b61076d1760201c565b506100cc565b3390565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b610ab6806100db6000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063b27704fa1161005b578063b27704fa1461015b578063bf86d690146101d4578063f2fde38b146101dc576100be565b80638da5cb5b1461011d5780638f975a6414610125576100be565b8063715018a6116100a7578063715018a6146100e7578063766f13bc146100f15780638531a63614610115576100be565b8063438cae7e146100c3578063664ab18e146100df575b600080fd5b6100cb610202565b604080519115158252519081900360200190f35b6100cb610282565b6100ef6102d1565b005b6100f961039c565b604080516001600160a01b039092168252519081900360200190f35b6100f96103eb565b6100f96103fa565b6100ef6004803603606081101561013b57600080fd5b506001600160a01b03813581169160208101359091169060400135610409565b6100ef6004803603604081101561017157600080fd5b81019060208101813564010000000081111561018c57600080fd5b82018360208201111561019e57600080fd5b803590602001918460208302840111640100000000831117156101c057600080fd5b9193509150356001600160a01b0316610495565b6100cb6105fc565b6100ef600480360360208110156101f257600080fd5b50356001600160a01b031661064b565b60008060009054906101000a90046001600160a01b03166001600160a01b031663438cae7e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561025157600080fd5b505afa158015610265573d6000803e3d6000fd5b505050506040513d602081101561027b57600080fd5b5051905090565b60008060009054906101000a90046001600160a01b03166001600160a01b031663664ab18e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561025157600080fd5b6102d961079c565b6001600160a01b03166102ea6103fa565b6001600160a01b031614610345576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36001805473ffffffffffffffffffffffffffffffffffffffff19169055565b60008060009054906101000a90046001600160a01b03166001600160a01b031663766f13bc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561025157600080fd5b6000546001600160a01b031690565b6001546001600160a01b031690565b61041161079c565b6001600160a01b03166104226103fa565b6001600160a01b03161461047d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6104856107a0565b6104908383836107fb565b505050565b61049d61097c565b6104a561039c565b6001600160a01b0316336001600160a01b0316146104f45760405162461bcd60e51b81526004018080602001828103825260378152602001806109fc6037913960400191505060405180910390fd5b6001600160a01b0381166105395760405162461bcd60e51b8152600401808060200182810382526021815260200180610a336021913960400191505060405180910390fd5b60005b828110156105f657600084848381811061055257fe5b905060200201356001600160a01b031690506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156105b357600080fd5b505afa1580156105c7573d6000803e3d6000fd5b505050506040513d60208110156105dd57600080fd5b505190506105ec8285836107fb565b505060010161053c565b50505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663bf86d6906040518163ffffffff1660e01b815260040160206040518083038186803b15801561025157600080fd5b61065361079c565b6001600160a01b03166106646103fa565b6001600160a01b0316146106bf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107045760405162461bcd60e51b81526004018080602001828103825260268152602001806109d66026913960400191505060405180910390fd5b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b3390565b6107a8610282565b6107f9576040805162461bcd60e51b815260206004820152601660248201527f506f77657265643a206973206e6f74206f6e6c696e6500000000000000000000604482015290519081900360640190fd5b565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b602083106108a55780518252601f199092019160209182019101610886565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610907576040519150601f19603f3d011682016040523d82523d6000602084013e61090c565b606091505b509150915081801561093a57508051158061093a575080806020019051602081101561093757600080fd5b50515b6109755760405162461bcd60e51b815260040180806020018281038252602d815260200180610a54602d913960400191505060405180910390fd5b5050505050565b6109846105fc565b6107f9576040805162461bcd60e51b815260206004820152601860248201527f506f77657265643a206973206e6f742073687574646f776e0000000000000000604482015290519081900360640190fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373526577617264506f6f6c3a206f6e6c7920636f6e74726f6c6c65722063616e2077697468647261772061667465722073687574646f776e526577617264506f6f6c3a20726563697069656e74206e6f7420646566696e65645472616e7366657248656c7065723a3a736166655472616e736665723a207472616e73666572206661696c6564a2646970667358221220e29081a8e5d9016ef6d675f549490171cd24c1d0a9be0846d42e1f5abf5b0ed964736f6c63430007060033456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473526577617264506f6f6c466163746f72793a20756e757365642066756e6374696f6e496e7374616e636552656769737472793a20616c72656164792072656769737465726564a2646970667358221220d5181cd3b8df3ea95dd854f676ae36522ce0b0d5800ce991ece9ae70c918c72264736f6c63430007060033

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.