ETH Price: $3,561.32 (-0.16%)
Gas: 5 Gwei

Contract

0xcF463713521Af5cE31AD18F6914f3706493F10e5
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60c06040139041572021-12-30 2:54:59899 days ago1640832899IN
 Create: RewardPool
0 ETH0.0611579105.43993034

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RewardPool

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 5 : RewardPool.sol
// SPDX-License-Identifier: BUSL-1.1
// SPDX-FileCopyrightText: Copyright 2021-22 Panther Ventures Limited Gibraltar
// solhint-disable var-name-mixedcase
// solhint-disable-next-line compiler-fixed, compiler-gt-0_8
pragma solidity ^0.8.0;

import "./interfaces/IVestingPools.sol";
import "./interfaces/IRewardPool.sol";
import "./utils/ImmutableOwnable.sol";
import "./utils/Utils.sol";

/**
 * @title RewardPool
 * @notice It vests $ZKP token from the Panther Protocol "Reward Pool".
 * @dev One of the vesting pools (maybe, the major one) which the VestingPools
 * contract vests $ZKP tokens to is the "Reward Pool" (aka "Protocol Pool").
 * This contract assumed to have a "pool wallet" role with the VestingPools,
 * and therefore has a privilege to request vesting $ZKPs from the Reward Pool
 * to the "recipient".
 * The "RewardMaster" contract, that distributes tokens to users as rewards,
 * is assumed to be the "recipient".
 *
 * This contract is expected to be replaced. Therefore it allows the owner
 * to transfer the "pool wallet" role to another account.
 */
contract RewardPool is ImmutableOwnable, Utils, IRewardPool {
    /// @notice Address of the VestingPools instance
    address public immutable VESTING_POOLS;

    /// @notice ID of the pool (in the VestingPools) to vest from
    uint8 public poolId;

    /// @dev (UNIX) Time when vesting gets disabled
    uint32 public endTime;

    /// @notice Address to vest tokens to
    address public recipient;

    constructor(address _vestingPools, address _owner)
        ImmutableOwnable(_owner)
        nonZeroAddress(_vestingPools)
    {
        VESTING_POOLS = _vestingPools;
    }

    /// @inheritdoc IRewardPool
    function releasableAmount() external view override returns (uint256) {
        if (recipient == address(0)) return 0;
        if (timeNow() >= endTime) return 0;

        return _releasableAmount();
    }

    /// @inheritdoc IRewardPool
    function vestRewards() external override returns (uint256 amount) {
        // revert if unauthorized or recipient not yet set
        require(msg.sender == recipient, "RP: unauthorized");
        require(timeNow() < endTime, "RP: expired");

        amount = _releasableAmount();

        if (amount != 0) {
            IVestingPools(VESTING_POOLS).releaseTo(poolId, recipient, amount);
            emit Vested(amount);
        }
    }

    /// @notice Sets the {poolId} and the {recipient} to given values
    /// @dev Owner only may call, once only
    /// This contract address must be set in the VestingPools as the wallet for the pool
    function initialize(
        uint8 _poolId,
        address _recipient,
        uint32 _endTime
    ) external onlyOwner nonZeroAddress(_recipient) {
        // once only
        require(recipient == address(0), "RP: initialized");
        // _endTime can't be in the past
        require(_endTime > timeNow(), "RP: expired");
        // this contract must be registered with the VestingPools
        require(IVestingPools(VESTING_POOLS).getWallet(_poolId) == address(this), "RP:E7");

        poolId = _poolId;
        recipient = _recipient;
        endTime = _endTime;

        emit Initialized(_poolId, _recipient, _endTime);
    }

    /// @notice Calls VestingPools to transfer 'pool wallet' role to given address
    /// @dev Owner only may call, once only
    function transferPoolWalletRole(address newWallet)
        external
        onlyOwner
        nonZeroAddress(newWallet)
    {
        IVestingPools(VESTING_POOLS).updatePoolWallet(poolId, newWallet);
    }

    function _releasableAmount() internal view returns (uint256) {
        return IVestingPools(VESTING_POOLS).releasableAmount(poolId);
    }

    modifier nonZeroAddress(address account) {
        require(account != address(0), "RP: zero address");
        _;
    }
}

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

interface IVestingPools {
    /**
     * @notice Returns Token address.
     */
    function token() external view returns (address);

    /**
     * @notice Returns the wallet address of the specified pool.
     */
    function getWallet(uint256 poolId) external view returns (address);

    /**
     * @notice Returns the amount that may be vested now from the given pool.
     */
    function releasableAmount(uint256 poolId) external view returns (uint256);

    /**
     * @notice Returns the amount that has been vested from the given pool
     */
    function vestedAmount(uint256 poolId) external view returns (uint256);

    /**
     * @notice Vests the specified amount from the given pool to the pool wallet.
     * If the amount is zero, it vests the entire "releasable" amount.
     * @dev Pool wallet may call only.
     * @return released - Amount released.
     */
    function release(uint256 poolId, uint256 amount)
        external
        returns (uint256 released);

    /**
     * @notice Vests the specified amount from the given pool to the given address.
     * If the amount is zero, it vests the entire "releasable" amount.
     * @dev Pool wallet may call only.
     * @return released - Amount released.
     */
    function releaseTo(
        uint256 poolId,
        address account,
        uint256 amount
    ) external returns (uint256 released);

    /**
     * @notice Updates the wallet for the given pool.
     * @dev Only address with the 'wallet' role may call.
     */
    function updatePoolWallet(uint256 poolId, address newWallet) external;

    /// @notice Emitted on an amount vesting.
    event Released(uint256 indexed poolId, address to, uint256 amount);
}

File 3 of 5 : IRewardPool.sol
// SPDX-License-Identifier: BUSL-1.1
// SPDX-FileCopyrightText: Copyright 2021-22 Panther Ventures Limited Gibraltar
pragma solidity ^0.8.0;

interface IRewardPool {
    /// @notice Returns token amount that may be released (vested) now
    function releasableAmount() external view returns (uint256);

    /// @notice Vests releasable token amount to the {recipient}
    /// @dev {recipient} only may call
    function vestRewards() external returns (uint256 amount);

    /// @notice Emitted on vesting to the {recipient}
    event Vested(uint256 amount);

    /// @notice Emitted on parameters initialized.
    event Initialized(uint256 _poolId, address _recipient, uint256 _endTime);
}

File 4 of 5 : ImmutableOwnable.sol
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-fixed, compiler-gt-0_8
pragma solidity ^0.8.0;

/// @title Staking
abstract contract ImmutableOwnable {
    /// @notice The owner who has privileged rights
    address public immutable OWNER;

    /// @dev Throws if called by any account other than the {OWNER}.
    modifier onlyOwner() {
        require(OWNER == msg.sender, "ImmOwn: unauthorized");
        _;
    }

    constructor(address _owner) {
        require(_owner != address(0), "ImmOwn: zero owner address");
        OWNER = _owner;
    }
}

File 5 of 5 : Utils.sol
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-fixed, compiler-gt-0_8
pragma solidity ^0.8.0;

abstract contract Utils {
    function safe32(uint256 n) internal pure returns (uint32) {
        require(n < 2**32, "UNSAFE32");
        return uint32(n);
    }

    function safe96(uint256 n) internal pure returns (uint96) {
        require(n < 2**96, "UNSAFE96");
        return uint96(n);
    }

    function safe128(uint256 n) internal pure returns (uint128) {
        require(n < 2**128, "UNSAFE128");
        return uint128(n);
    }

    function safe160(uint256 n) internal pure returns (uint160) {
        require(n < 2**160, "UNSAFE160");
        return uint160(n);
    }

    function safe32TimeNow() internal view returns (uint32) {
        return safe32(timeNow());
    }

    function safe32BlockNow() internal view returns (uint32) {
        return safe32(blockNow());
    }

    /// @dev Returns the current block timestamp (added to ease testing)
    function timeNow() internal view virtual returns (uint256) {
        return block.timestamp;
    }

    /// @dev Returns the current block number (added to ease testing)
    function blockNow() internal view virtual returns (uint256) {
        return block.number;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vestingPools","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_poolId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_endTime","type":"uint256"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Vested","type":"event"},{"inputs":[],"name":"OWNER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VESTING_POOLS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTime","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_poolId","type":"uint8"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint32","name":"_endTime","type":"uint32"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"poolId","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"releasableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newWallet","type":"address"}],"name":"transferPoolWalletRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vestRewards","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

60c060405234801561001057600080fd5b50604051610b19380380610b1983398101604081905261002f91610118565b806001600160a01b03811661008b5760405162461bcd60e51b815260206004820152601a60248201527f496d6d4f776e3a207a65726f206f776e6572206164647265737300000000000060448201526064015b60405180910390fd5b60601b6001600160601b031916608052816001600160a01b0381166100e55760405162461bcd60e51b815260206004820152601060248201526f52503a207a65726f206164647265737360801b6044820152606401610082565b505060601b6001600160601b03191660a05261014a565b80516001600160a01b038116811461011357600080fd5b919050565b6000806040838503121561012a578182fd5b610133836100fc565b9150610141602084016100fc565b90509250929050565b60805160601c60a05160601c61097b61019e60003960008181610189015281816102bd01528181610541015281816107a9015261082601526000818160ad015281816103ba01526106bd015261097b6000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c80635b9400811161007657806366d003ac1161005b57806366d003ac146101685780637054ac2514610184578063f65505f6146101ab57600080fd5b80635b9400811461014b5780635e02af2a1461015357600080fd5b8063117803e3146100a85780633197cbb6146100ec5780633c43059d146101165780633e0dc34e1461012c575b600080fd5b6100cf7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b60005461010190610100900463ffffffff1681565b60405163ffffffff90911681526020016100e3565b61011e6101be565b6040519081526020016100e3565b6000546101399060ff1681565b60405160ff90911681526020016100e3565b61011e610371565b6101666101613660046108ff565b6103b8565b005b6000546100cf906501000000000090046001600160a01b031681565b6100cf7f000000000000000000000000000000000000000000000000000000000000000081565b6101666101b93660046108a8565b6106bb565b600080546501000000000090046001600160a01b031633146102275760405162461bcd60e51b815260206004820152601060248201527f52503a20756e617574686f72697a65640000000000000000000000000000000060448201526064015b60405180910390fd5b600054610100900463ffffffff1642106102715760405162461bcd60e51b815260206004820152600b60248201526a14940e88195e1c1a5c995960aa1b604482015260640161021e565b610279610809565b9050801561036e57600054604051632a7d7bc560e01b815260ff82166004820152650100000000009091046001600160a01b039081166024830152604482018390527f00000000000000000000000000000000000000000000000000000000000000001690632a7d7bc590606401602060405180830381600087803b15801561030157600080fd5b505af1158015610315573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033991906108e7565b506040518181527f612773fe32ce5ff928e8196b31fe6ebfdbc51c93547d7e8a28cff137bfd317919060200160405180910390a15b90565b600080546501000000000090046001600160a01b03166103915750600090565b600054610100900463ffffffff1642106103ab5750600090565b6103b3610809565b905090565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146104305760405162461bcd60e51b815260206004820152601460248201527f496d6d4f776e3a20756e617574686f72697a6564000000000000000000000000604482015260640161021e565b816001600160a01b03811661047a5760405162461bcd60e51b815260206004820152601060248201526f52503a207a65726f206164647265737360801b604482015260640161021e565b6000546501000000000090046001600160a01b0316156104dc5760405162461bcd60e51b815260206004820152600f60248201527f52503a20696e697469616c697a65640000000000000000000000000000000000604482015260640161021e565b428263ffffffff161161051f5760405162461bcd60e51b815260206004820152600b60248201526a14940e88195e1c1a5c995960aa1b604482015260640161021e565b604051635470b13b60e01b815260ff8516600482015230906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635470b13b9060240160206040518083038186803b15801561058357600080fd5b505afa158015610597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bb91906108cb565b6001600160a01b0316146106115760405162461bcd60e51b815260206004820152600560248201527f52503a4537000000000000000000000000000000000000000000000000000000604482015260640161021e565b6000805460ff86167fffffffffffffff0000000000000000000000000000000000000000ffffffff009091168117650100000000006001600160a01b0387169081029190911764ffffffff00191661010063ffffffff8716908102919091179093556040805192835260208301919091528101919091527f0a704da44b3f5e15006ba5f8755eff30ba4f855f7a647776ed3584627af820529060600160405180910390a150505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146107335760405162461bcd60e51b815260206004820152601460248201527f496d6d4f776e3a20756e617574686f72697a6564000000000000000000000000604482015260640161021e565b806001600160a01b03811661077d5760405162461bcd60e51b815260206004820152601060248201526f52503a207a65726f206164647265737360801b604482015260640161021e565b60005460405163085cb13f60e01b815260ff90911660048201526001600160a01b0383811660248301527f0000000000000000000000000000000000000000000000000000000000000000169063085cb13f90604401600060405180830381600087803b1580156107ed57600080fd5b505af1158015610801573d6000803e3d6000fd5b505050505050565b60008054604051632c93fe5160e11b815260ff90911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635927fca29060240160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b391906108e7565b6000602082840312156108b9578081fd5b81356108c481610956565b9392505050565b6000602082840312156108dc578081fd5b81516108c481610956565b6000602082840312156108f8578081fd5b5051919050565b600080600060608486031215610913578182fd5b833560ff81168114610923578283fd5b9250602084013561093381610956565b9150604084013563ffffffff8116811461094b578182fd5b809150509250925092565b6001600160a01b038116811461096b57600080fd5b5056fea164736f6c6343000804000a000000000000000000000000b476104aa9d1f30180a01987fb09b1e96ddcf14b000000000000000000000000505796f5bc290269d2522cf19135ad7aa60dfd77

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100a35760003560e01c80635b9400811161007657806366d003ac1161005b57806366d003ac146101685780637054ac2514610184578063f65505f6146101ab57600080fd5b80635b9400811461014b5780635e02af2a1461015357600080fd5b8063117803e3146100a85780633197cbb6146100ec5780633c43059d146101165780633e0dc34e1461012c575b600080fd5b6100cf7f000000000000000000000000505796f5bc290269d2522cf19135ad7aa60dfd7781565b6040516001600160a01b0390911681526020015b60405180910390f35b60005461010190610100900463ffffffff1681565b60405163ffffffff90911681526020016100e3565b61011e6101be565b6040519081526020016100e3565b6000546101399060ff1681565b60405160ff90911681526020016100e3565b61011e610371565b6101666101613660046108ff565b6103b8565b005b6000546100cf906501000000000090046001600160a01b031681565b6100cf7f000000000000000000000000b476104aa9d1f30180a01987fb09b1e96ddcf14b81565b6101666101b93660046108a8565b6106bb565b600080546501000000000090046001600160a01b031633146102275760405162461bcd60e51b815260206004820152601060248201527f52503a20756e617574686f72697a65640000000000000000000000000000000060448201526064015b60405180910390fd5b600054610100900463ffffffff1642106102715760405162461bcd60e51b815260206004820152600b60248201526a14940e88195e1c1a5c995960aa1b604482015260640161021e565b610279610809565b9050801561036e57600054604051632a7d7bc560e01b815260ff82166004820152650100000000009091046001600160a01b039081166024830152604482018390527f000000000000000000000000b476104aa9d1f30180a01987fb09b1e96ddcf14b1690632a7d7bc590606401602060405180830381600087803b15801561030157600080fd5b505af1158015610315573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033991906108e7565b506040518181527f612773fe32ce5ff928e8196b31fe6ebfdbc51c93547d7e8a28cff137bfd317919060200160405180910390a15b90565b600080546501000000000090046001600160a01b03166103915750600090565b600054610100900463ffffffff1642106103ab5750600090565b6103b3610809565b905090565b7f000000000000000000000000505796f5bc290269d2522cf19135ad7aa60dfd776001600160a01b031633146104305760405162461bcd60e51b815260206004820152601460248201527f496d6d4f776e3a20756e617574686f72697a6564000000000000000000000000604482015260640161021e565b816001600160a01b03811661047a5760405162461bcd60e51b815260206004820152601060248201526f52503a207a65726f206164647265737360801b604482015260640161021e565b6000546501000000000090046001600160a01b0316156104dc5760405162461bcd60e51b815260206004820152600f60248201527f52503a20696e697469616c697a65640000000000000000000000000000000000604482015260640161021e565b428263ffffffff161161051f5760405162461bcd60e51b815260206004820152600b60248201526a14940e88195e1c1a5c995960aa1b604482015260640161021e565b604051635470b13b60e01b815260ff8516600482015230906001600160a01b037f000000000000000000000000b476104aa9d1f30180a01987fb09b1e96ddcf14b1690635470b13b9060240160206040518083038186803b15801561058357600080fd5b505afa158015610597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bb91906108cb565b6001600160a01b0316146106115760405162461bcd60e51b815260206004820152600560248201527f52503a4537000000000000000000000000000000000000000000000000000000604482015260640161021e565b6000805460ff86167fffffffffffffff0000000000000000000000000000000000000000ffffffff009091168117650100000000006001600160a01b0387169081029190911764ffffffff00191661010063ffffffff8716908102919091179093556040805192835260208301919091528101919091527f0a704da44b3f5e15006ba5f8755eff30ba4f855f7a647776ed3584627af820529060600160405180910390a150505050565b7f000000000000000000000000505796f5bc290269d2522cf19135ad7aa60dfd776001600160a01b031633146107335760405162461bcd60e51b815260206004820152601460248201527f496d6d4f776e3a20756e617574686f72697a6564000000000000000000000000604482015260640161021e565b806001600160a01b03811661077d5760405162461bcd60e51b815260206004820152601060248201526f52503a207a65726f206164647265737360801b604482015260640161021e565b60005460405163085cb13f60e01b815260ff90911660048201526001600160a01b0383811660248301527f000000000000000000000000b476104aa9d1f30180a01987fb09b1e96ddcf14b169063085cb13f90604401600060405180830381600087803b1580156107ed57600080fd5b505af1158015610801573d6000803e3d6000fd5b505050505050565b60008054604051632c93fe5160e11b815260ff90911660048201527f000000000000000000000000b476104aa9d1f30180a01987fb09b1e96ddcf14b6001600160a01b031690635927fca29060240160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b391906108e7565b6000602082840312156108b9578081fd5b81356108c481610956565b9392505050565b6000602082840312156108dc578081fd5b81516108c481610956565b6000602082840312156108f8578081fd5b5051919050565b600080600060608486031215610913578182fd5b833560ff81168114610923578283fd5b9250602084013561093381610956565b9150604084013563ffffffff8116811461094b578182fd5b809150509250925092565b6001600160a01b038116811461096b57600080fd5b5056fea164736f6c6343000804000a

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

000000000000000000000000b476104aa9d1f30180a01987fb09b1e96ddcf14b000000000000000000000000505796f5bc290269d2522cf19135ad7aa60dfd77

-----Decoded View---------------
Arg [0] : _vestingPools (address): 0xb476104aa9D1f30180a01987FB09b1e96dDCF14B
Arg [1] : _owner (address): 0x505796f5Bc290269D2522cf19135aD7Aa60dfd77

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000b476104aa9d1f30180a01987fb09b1e96ddcf14b
Arg [1] : 000000000000000000000000505796f5bc290269d2522cf19135ad7aa60dfd77


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.