Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 454 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Add Reward | 21769425 | 8 days ago | IN | 0 ETH | 0.00041984 | ||||
Stake | 21692938 | 19 days ago | IN | 0 ETH | 0.00046649 | ||||
Stake | 21648650 | 25 days ago | IN | 0 ETH | 0.00130998 | ||||
Receive Reward | 21648630 | 25 days ago | IN | 0 ETH | 0.00403841 | ||||
Withdraw | 21619767 | 29 days ago | IN | 0 ETH | 0.00079532 | ||||
Stake | 21587873 | 33 days ago | IN | 0 ETH | 0.00133646 | ||||
Add Reward | 21568869 | 36 days ago | IN | 0 ETH | 0.00089051 | ||||
Receive Reward | 21448881 | 53 days ago | IN | 0 ETH | 0.00248411 | ||||
Stake | 21434329 | 55 days ago | IN | 0 ETH | 0.00117944 | ||||
Receive Reward | 21412220 | 58 days ago | IN | 0 ETH | 0.00476983 | ||||
Withdraw | 21378311 | 63 days ago | IN | 0 ETH | 0.00414406 | ||||
Receive Reward | 21378284 | 63 days ago | IN | 0 ETH | 0.00323132 | ||||
Add Reward | 21368402 | 64 days ago | IN | 0 ETH | 0.0027557 | ||||
Receive Reward | 21299602 | 74 days ago | IN | 0 ETH | 0.00217288 | ||||
Stake | 21234537 | 83 days ago | IN | 0 ETH | 0.00121091 | ||||
Receive Reward | 21198827 | 88 days ago | IN | 0 ETH | 0.00460756 | ||||
Receive Reward | 21155518 | 94 days ago | IN | 0 ETH | 0.00343157 | ||||
Stake | 21134647 | 97 days ago | IN | 0 ETH | 0.00104179 | ||||
Receive Reward | 21134596 | 97 days ago | IN | 0 ETH | 0.00366954 | ||||
Add Reward | 20967247 | 120 days ago | IN | 0 ETH | 0.00144979 | ||||
Receive Reward | 20811772 | 142 days ago | IN | 0 ETH | 0.00818078 | ||||
Add Reward | 20766620 | 148 days ago | IN | 0 ETH | 0.00023087 | ||||
Withdraw | 20759564 | 149 days ago | IN | 0 ETH | 0.00024991 | ||||
Add Reward | 20566119 | 176 days ago | IN | 0 ETH | 0.00008816 | ||||
Stake | 20401136 | 199 days ago | IN | 0 ETH | 0.00044891 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
||||
---|---|---|---|---|---|---|---|
21769425 | 8 days ago | 0 ETH | |||||
21769425 | 8 days ago | 0 ETH | |||||
21692938 | 19 days ago | 0 ETH | |||||
21692938 | 19 days ago | 0 ETH | |||||
21648650 | 25 days ago | 0 ETH | |||||
21648650 | 25 days ago | 0 ETH | |||||
21648630 | 25 days ago | 0 ETH | |||||
21648630 | 25 days ago | 0 ETH | |||||
21648630 | 25 days ago | 0 ETH | |||||
21648630 | 25 days ago | 0 ETH | |||||
21648630 | 25 days ago | 0 ETH | |||||
21648630 | 25 days ago | 0 ETH | |||||
21648630 | 25 days ago | 0 ETH | |||||
21619767 | 29 days ago | 0 ETH | |||||
21619767 | 29 days ago | 0 ETH | |||||
21619767 | 29 days ago | 0 ETH | |||||
21619767 | 29 days ago | 0 ETH | |||||
21587873 | 33 days ago | 0 ETH | |||||
21587873 | 33 days ago | 0 ETH | |||||
21568869 | 36 days ago | 0 ETH | |||||
21568869 | 36 days ago | 0 ETH | |||||
21448881 | 53 days ago | 0 ETH | |||||
21448881 | 53 days ago | 0 ETH | |||||
21448881 | 53 days ago | 0 ETH | |||||
21448881 | 53 days ago | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
StakingAggregator
Compiler Version
v0.7.1+commit.f4a555be
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2021-05-07 */ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.1; // File: @openzeppelin/contracts/math/SafeMath.sol /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol /** * @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: @openzeppelin/contracts/utils/Address.sol /** * @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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @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"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.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 SafeMath for uint256; 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' // solhint-disable-next-line max-line-length 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).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _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 // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: @openzeppelin/contracts/utils/ReentrancyGuard.sol /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: @openzeppelin/contracts/GSN/Context.sol /* * @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: @openzeppelin/contracts/access/Ownable.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 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: @openzeppelin/contracts/math/SignedSafeMath.sol /** * @title SignedSafeMath * @dev Signed math operations with safety checks that revert on error. */ library SignedSafeMath { int256 constant private _INT256_MIN = -2**255; /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow"); int256 c = a * b; require(c / a == b, "SignedSafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two signed integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow"); return c; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; } } // File: @openzeppelin/contracts/utils/SafeCast.sol /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } } // File: contracts/Interfaces/StakingInterface.sol interface StakingInterface { function getStakingTokenAddress() external view returns (address); function getTokenInfo() external view returns ( uint256 currentTerm, uint256 latestTerm, uint256 totalRemainingRewards, uint256 currentTermRewards, uint256 nextTermRewards, uint128 currentStaking, uint128 nextTermStaking ); function getConfigs() external view returns (uint256 startTimestamp, uint256 termInterval); function getTermInfo(uint256 term) external view returns ( int128 stakeAdd, uint128 stakeSum, uint256 rewardSum ); function getAccountInfo(address account) external view returns ( uint256 userTerm, uint256 stakeAmount, int128 nextAddedStakeAmount, uint256 remaining, uint256 currentTermUserRewards, uint256 nextTermUserRewards, uint128 depositAmount, uint128 withdrawableStakingAmount ); } // File: contracts/Staking/Staking.sol contract Staking is ReentrancyGuard, StakingInterface { using SafeMath for uint256; using SafeMath for uint128; using SignedSafeMath for int256; using SignedSafeMath for int128; using SafeCast for uint256; using SafeCast for uint128; using SafeCast for int256; using SafeCast for int128; using SafeERC20 for IERC20; /* ========== CONSTANT VARIABLES ========== */ uint256 internal constant MAX_TERM = 100; IERC20 internal immutable _stakingToken; uint256 internal immutable _startTimestamp; // timestamp of the term 0 uint256 internal immutable _termInterval; // time interval between terms in second /* ========== STATE VARIABLES ========== */ uint256 internal _currentTerm; // the current term (all the info prior to this term is fixed) uint256 internal _totalRemaining; // total unsettled amount of rewards and withdrawal uint256 internal _totalRewardAdded; // total unsettled amount of rewards struct AccountInfo { int128 added; // the added amount of stake which will be merged to stakeAmount at the term+1. uint128 stakeAmount; // active stake amount of the user at userTerm uint256 remaining; // the total amount of rewards and withdrawal until userTerm uint256 userTerm; // the term when the user executed any function last time (all the terms before the term has been already settled) } /** * @dev account => data */ mapping(address => AccountInfo) internal _accountInfoList; struct TermInfo { uint128 stakeAdd; // the total added amount of stake which will be merged to stakeSum at the term+1 uint128 stakeRemove; uint128 stakeSum; // the total staking amount at the term uint256 rewardSum; // the total amount of rewards at the term } /** * @dev term => data */ mapping(uint256 => TermInfo) internal _termInfoList; /* ========== EVENTS ========== */ event Staked(address indexed account, uint128 amount); event Withdrawn(address indexed account, uint128 amount); event RewardPaid(address indexed account, uint256 amount); event TermUpdated(uint256 currentTerm); event RewardUpdated(address indexed account, uint256 currentTerm); event RewardAdded(address indexed account, uint256 indexed term, uint256 amount); /* ========== CONSTRUCTOR ========== */ constructor( IERC20 stakingToken, uint256 startTimestamp, uint256 termInterval ) { require(startTimestamp <= block.timestamp, "startTimestamp should be past time"); _startTimestamp = startTimestamp; _stakingToken = stakingToken; _termInterval = termInterval; } /* ========== MODIFIERS ========== */ /** * @dev Update the info up to the current term. */ modifier updateTerm() { uint256 latestTerm = _getLatestTerm(); if (_currentTerm < latestTerm) { uint128 sendBackLater = _termInfoList[_currentTerm].stakeRemove; uint128 nextStakeSum = _getNextStakeSum(); uint256 nextTerm = nextStakeSum == 0 ? latestTerm : _currentTerm + 1; // if next stakeSum is 0, skip to latest term uint256 nextTermReward = _getNextTermReward(); _termInfoList[nextTerm] = TermInfo({ stakeAdd: 0, stakeRemove: 0, stakeSum: nextStakeSum, rewardSum: nextTermReward }); // write total stake amount since (nextTerm + 1) until latestTerm if (nextTerm < latestTerm) { // assert(_termInfoList[nextTerm].stakeSum != 0 && _termInfoList[nextTerm].stakeAdd == 0); _termInfoList[latestTerm] = TermInfo({ stakeAdd: 0, stakeRemove: 0, stakeSum: nextStakeSum, rewardSum: 0 }); } _totalRemaining = _totalRemaining.add(_totalRewardAdded).add(sendBackLater); _totalRewardAdded = 0; _currentTerm = latestTerm; } emit TermUpdated(_currentTerm); _; } /** * @dev Calculate total rewards of the account until the current term. */ modifier updateReward(address account) { AccountInfo memory accountInfo = _accountInfoList[account]; uint256 startTerm = accountInfo.userTerm; for (uint256 term = startTerm; term < _currentTerm && term < startTerm + MAX_TERM; term++) { TermInfo memory termInfo = _termInfoList[term]; if (termInfo.stakeSum != 0) { require( accountInfo.stakeAmount <= termInfo.stakeSum, "system error: stakeAmount is not more than stakeSum" ); // `(total rewards) * (your stake amount) / (total stake amount)` in each term uint256 rewardsAdded = termInfo.rewardSum.mul(accountInfo.stakeAmount) / termInfo.stakeSum; accountInfo.remaining = accountInfo.remaining.add(rewardsAdded); emit RewardAdded(account, term, rewardsAdded); } accountInfo.stakeAmount = addDiff(accountInfo.stakeAmount, accountInfo.added).toUint128(); if (accountInfo.added < 0) { accountInfo.remaining = addDiff(accountInfo.remaining, -accountInfo.added); } accountInfo.added = 0; if (accountInfo.stakeAmount == 0) { accountInfo.userTerm = _currentTerm; break; // skip unnecessary term } accountInfo.userTerm = term + 1; // calculated until this term } _accountInfoList[account] = accountInfo; // do not execute main function if `userTerm` is not the same with `_currentTerm`. if (accountInfo.userTerm < _currentTerm) { return; } emit RewardUpdated(account, _currentTerm); _; } /* ========== MUTATIVE FUNCTIONS ========== */ /** * @notice Stake the staking token for the token to be paid as reward. */ // function stake(uint128 amount) // external // override // nonReentrant // updateTerm() // updateReward(msg.sender) // { // require(amount != 0, "staking amount should be positive number"); // _stake(msg.sender, amount); // _stakingToken.safeTransferFrom(msg.sender, address(this), amount); // } /** * @notice Withdraw the staking token for the token to be paid as reward. */ // function withdraw(uint128 amount) // external // override // nonReentrant // updateTerm() // updateReward(msg.sender) // { // require(amount != 0, "withdrawing amount should be positive number"); // _withdraw(msg.sender, amount); // // _stakingToken.safeTransfer(msg.sender, amount); // } /** * @notice Receive the reward and withdrawal from this contract. */ // function receiveReward() // external // override // nonReentrant // updateTerm() // updateReward(msg.sender) // returns (uint256 remaining) // { // remaining = _receiveReward(msg.sender); // if (remaining != 0) { // _stakingToken.safeTransfer(msg.sender, remaining); // } // return remaining; // } /** * @notice Add the reward to this contract. */ function addReward(uint128 amount) external nonReentrant updateTerm() { _stakingToken.safeTransferFrom(msg.sender, address(this), amount); return _addReward(msg.sender, amount); } /* ========== INTERNAL FUNCTIONS ========== */ /** * @dev The stake amount of `account` increaases by `amount`. * This function is staking if `amount` is positive, otherwise unstaking. */ // function _stakeOrUnstake(address account, int128 amount) internal { // uint256 term = _currentTerm; // AccountInfo memory accountInfo = _accountInfoList[account]; // require( // addDiff(accountInfo.stakeAmount, accountInfo.added) < type(uint128).max, // "stake amount is out of range" // ); // _accountInfoList[account].added = _accountInfoList[account].added.add(amount).toInt128(); // added when the term is shifted (the user) // if (amount >= 0) { // _termInfoList[term].stakeAdd = _termInfoList[term].stakeAdd.add(amount.toUint256()).toUint128(); // added when the term is shifted (global) // } else { // _termInfoList[term].stakeRemove = _termInfoList[term].stakeRemove.sub(-amount.toUint256()).toUint128(); // added when the term is shifted (global) // } // } function _stake(address account, uint128 amount) internal returns (uint128 sendBack) { sendBack = 0; if (_accountInfoList[account].added < 0) { uint128 added = uint128(-_accountInfoList[account].added); sendBack = added < amount ? added : amount; // min(added, amount) } uint256 term = _currentTerm; AccountInfo memory accountInfo = _accountInfoList[account]; require( addDiff(accountInfo.stakeAmount, accountInfo.added) < type(uint128).max, "stake amount is out of range" ); _accountInfoList[account].added = _accountInfoList[account] .added .add(int256(amount)) .toInt128(); // added when the term is shifted (the user) // assert(sendBack <= amount); TermInfo memory termInfo = _termInfoList[term]; termInfo.stakeAdd = termInfo.stakeAdd.add(amount - sendBack).toUint128(); // added when the term is shifted (global) termInfo.stakeRemove = termInfo.stakeRemove.sub(sendBack).toUint128(); // added when the term is shifted (global) _termInfoList[term] = termInfo; emit Staked(account, amount); } /** * @dev Callee must send back staking token to sender instantly until `added` becomes zero. * One can use the return value `sendBack` for it. */ function _withdraw(address account, uint128 amount) internal returns (uint128 sendBack) { sendBack = 0; if (_accountInfoList[account].added > 0) { uint128 added = uint128(_accountInfoList[account].added); sendBack = added < amount ? added : amount; // min(added, amount) } uint256 term = _currentTerm; AccountInfo memory accountInfo = _accountInfoList[account]; require( addDiff(accountInfo.stakeAmount, accountInfo.added) < type(uint128).max, "stake amount is out of range" ); _accountInfoList[account].added = _accountInfoList[account].added.sub(amount).toInt128(); // added when the term is shifted (the user) // assert(sendBack <= amount); TermInfo memory termInfo = _termInfoList[term]; termInfo.stakeAdd = termInfo.stakeAdd.sub(sendBack).toUint128(); // added when the term is shifted (global) termInfo.stakeRemove = termInfo.stakeRemove.add(amount - sendBack).toUint128(); // added when the term is shifted (global) _termInfoList[term] = termInfo; emit Withdrawn(account, amount); } function _receiveReward(address account) internal returns (uint256 remaining) { remaining = _accountInfoList[account].remaining; if (remaining != 0) { _totalRemaining = _totalRemaining.sub(remaining, "system error: _totalRemaining is invalid"); _accountInfoList[account].remaining = 0; emit RewardPaid(account, remaining); } } function _addReward(address, uint128 amount) internal { _totalRewardAdded = _totalRewardAdded.add(amount); } function _getNextStakeSum() internal view returns (uint128 nextStakeSum) { TermInfo memory currentTermInfo = _termInfoList[_currentTerm]; return currentTermInfo .stakeSum .add(currentTermInfo.stakeAdd) .sub(currentTermInfo.stakeRemove) .toUint128(); } function _getCarriedReward() internal view returns (uint256 carriedReward) { TermInfo memory currentTermInfo = _termInfoList[_currentTerm]; return currentTermInfo.stakeSum == 0 ? currentTermInfo.rewardSum : 0; // if stakeSum is 0, carried forward until someone stakes } function _getNextTermReward() internal view returns (uint256 rewards) { uint256 carriedReward = _getCarriedReward(); return _totalRewardAdded.add(carriedReward); } function _getLatestTerm() internal view returns (uint256) { return (block.timestamp - _startTimestamp) / _termInterval; } /* ========== CALL FUNCTIONS ========== */ /** * @return stakingTokenAddress is the token locked for staking */ function getStakingTokenAddress() external view override returns (address stakingTokenAddress) { return address(_stakingToken); } /** * @return startTimestamp is the time when this contract was deployed * @return termInterval is the duration of a term */ function getConfigs() external view override returns (uint256 startTimestamp, uint256 termInterval) { startTimestamp = _startTimestamp; termInterval = _termInterval; } function getTotalRewardAdded() external view returns (uint256 totalRewardAdded) { return _totalRewardAdded; } /** * @return currentTerm is the current latest term * @return latestTerm is the potential latest term * @return totalRemainingRewards is the as-of remaining rewards and withdrawal * @return currentTermRewards is the total rewards at the current term * @return nextTermRewards is the as-of total rewards to be paid at the next term * @return currentStaking is the total active staking amount * @return nextTermStaking is the total staking amount */ function getTokenInfo() external view override returns ( uint256 currentTerm, uint256 latestTerm, uint256 totalRemainingRewards, uint256 currentTermRewards, uint256 nextTermRewards, uint128 currentStaking, uint128 nextTermStaking ) { currentTerm = _currentTerm; latestTerm = _getLatestTerm(); totalRemainingRewards = _totalRemaining; TermInfo memory termInfo = _termInfoList[_currentTerm]; currentTermRewards = termInfo.rewardSum; nextTermRewards = _getNextTermReward(); currentStaking = termInfo.stakeSum; nextTermStaking = termInfo .stakeSum .add(termInfo.stakeAdd) .sub(termInfo.stakeRemove) .toUint128(); } /** * @notice Returns _termInfoList[term]. */ function getTermInfo(uint256 term) external view override returns ( int128 stakeAdd, uint128 stakeSum, uint256 rewardSum ) { TermInfo memory termInfo = _termInfoList[term]; stakeAdd = int256(termInfo.stakeAdd).sub(termInfo.stakeRemove).toInt128(); stakeSum = termInfo.stakeSum; if (term == _currentTerm.add(1)) { rewardSum = _getNextTermReward(); } else { rewardSum = termInfo.rewardSum; } } /** * @return userTerm is the latest term the user has updated to * @return stakeAmount is the latest amount of staking from the user has updated to * @return nextAddedStakeAmount is the next amount of adding to stake from the user has updated to * @return remaining is the reward and withdrawal getting by the user has updated to * @return currentTermUserRewards is the as-of user rewards to be paid at `_currentTerm` * @return nextTermUserRewards is the as-of user rewards to be paid at the next term of `_currentTerm` * @return depositAmount is the staking amount * @return withdrawableStakingAmount is the withdrawable staking amount */ function getAccountInfo(address account) external view override returns ( uint256 userTerm, uint256 stakeAmount, int128 nextAddedStakeAmount, uint256 remaining, uint256 currentTermUserRewards, uint256 nextTermUserRewards, uint128 depositAmount, uint128 withdrawableStakingAmount ) { AccountInfo memory accountInfo = _accountInfoList[account]; userTerm = accountInfo.userTerm; stakeAmount = accountInfo.stakeAmount; nextAddedStakeAmount = accountInfo.added; depositAmount = addDiff(stakeAmount, nextAddedStakeAmount).toUint128(); withdrawableStakingAmount = depositAmount; remaining = accountInfo.remaining; TermInfo memory termInfo = _termInfoList[_currentTerm]; uint256 currentTermRewards = termInfo.rewardSum; uint256 currentStakeSum = termInfo.stakeSum; currentTermUserRewards = currentStakeSum == 0 ? 0 : currentTermRewards.mul(userTerm < _currentTerm ? depositAmount : stakeAmount) / currentStakeSum; uint256 nextTermRewards = _getNextTermReward(); uint256 nextStakeSum = currentStakeSum.add(termInfo.stakeAdd).sub(termInfo.stakeRemove); nextTermUserRewards = nextStakeSum == 0 ? 0 : nextTermRewards.mul(depositAmount) / nextStakeSum; // uint256 latestTermUserRewards = _getLatestTerm() > _currentTerm // ? nextTermUserRewards // : currentTermUserRewards; } /** * @dev Returns `base` added to `diff` which may be nagative number. */ function addDiff(uint256 base, int256 diff) internal pure returns (uint256) { if (diff >= 0) { return base.add(uint256(diff)); } else { return base.sub(uint256(-diff)); } } } // File: contracts/Staking/StakingWithAggregator.sol contract StakingWithAggregator is Ownable, Staking { using SafeERC20 for IERC20; event Recovered(address tokenAddress, uint256 tokenAmount); constructor( IERC20 stakingToken, uint256 startTimestamp, uint256 termInterval ) Staking(stakingToken, startTimestamp, termInterval) {} /* ========== MUTATIVE FUNCTIONS ========== */ /** * @notice Stake the staking token for the token to be paid as reward. */ function stakeViaAggregator(address account, uint128 amount) external onlyOwner nonReentrant updateTerm() updateReward(account) returns (uint128 sendBack) { require(amount != 0, "staking amount should be positive number"); sendBack = _stake(account, amount); // _stakingToken.safeTransferFrom(msg.sender, address(this), amount - sendBack); } /** * @notice Withdraw the staking token for the token to be paid as reward. */ function withdrawViaAggregator(address account, uint128 amount) external onlyOwner nonReentrant updateTerm() updateReward(account) returns (uint128 sendBack) { require(amount != 0, "withdrawing amount should be positive number"); return _withdraw(account, amount); } /** * @notice Receive the reward for your staking in the token. */ function receiveRewardViaAggregator(address account) external onlyOwner nonReentrant updateTerm() updateReward(account) returns (uint256 remaining) { return _receiveReward(account); } function addRewardViaAggregator(address account, uint128 amount) external onlyOwner nonReentrant updateTerm() { // _stakingToken.safeTransferFrom(msg.sender, address(this), amount); return _addReward(account, amount); } /** * @notice If you have accidentally transferred token which is not `_stakingToken`, * you can use this function to get it back. */ function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner { require(tokenAddress != address(_stakingToken), "Cannot recover the staking token"); IERC20(tokenAddress).safeTransfer(msg.sender, tokenAmount); emit Recovered(tokenAddress, tokenAmount); } } // File: contracts/Interfaces/StakingAggregatorInterface.sol interface StakingAggregatorInterface { function stake(uint128 amount) external returns (uint128 totalSendBack); function withdraw(uint128 amount) external returns (uint256 totalSendBack); function receiveReward() external returns (uint256 remaining); function addReward(uint256 stakingContractIndex, uint128 amount) external; function getStakingTokenAddress() external view returns (address); function getStakingContracts() external view returns (StakingWithAggregator[] memory); function getConfigs() external view returns (uint256[] memory startTimestampList, uint256 termInterval); function getTokenInfo() external view returns ( uint256[] memory latestTermList, uint256[] memory totalRemainingRewardsList, uint256[] memory currentTermRewardsList, uint256[] memory nextTermRewardsList, uint128[] memory currentStakingList, uint128[] memory nextTermStakingList ); function getTermInfo(uint256 term) external view returns ( int128[] memory stakeAddList, uint128[] memory stakeSumList, uint256[] memory rewardSumList ); function getAccountInfo(address account) external view returns ( uint256[] memory userTermList, uint256[] memory stakeAmountList, int128[] memory nextAddedStakeAmountList, uint256[] memory currentTermUserRewardsList, uint256[] memory nextTermUserRewardsList, uint128[] memory withdrawableStakingAmountList ); } // File: contracts/Staking/StakingAggregator.sol contract StakingAggregator is StakingAggregatorInterface { using SafeMath for uint256; using SafeERC20 for IERC20; /* ========== CONSTANT VARIABLES ========== */ uint256 internal immutable _termInterval; IERC20 internal immutable _stakingToken; StakingWithAggregator[] internal _stakingContracts; // immutable uint256[] internal _startTimestampList; // immutable /* ========== STATE VARIABLES ========== */ /** * @dev if this contract is initialized */ bool internal _enabled = false; /* ========== CONSTRUCTOR ========== */ constructor( IERC20 stakingToken, uint256 termInterval, StakingWithAggregator[] memory stakingContracts ) { require(stakingContracts.length != 0, "staking contracts should not be empty"); _stakingToken = stakingToken; _termInterval = termInterval; uint256 oldStartTimestamp = 0; for (uint256 i = 0; i < stakingContracts.length; i++) { require( stakingContracts[i].getStakingTokenAddress() == address(stakingToken), "staking token address differ from expected" ); (uint256 ithStartTimestamp, uint256 ithTermInterval) = stakingContracts[i].getConfigs(); require(ithTermInterval == termInterval, "term interval differ from expected"); require(ithStartTimestamp > oldStartTimestamp, "startTimestamp should be sorted"); oldStartTimestamp = ithStartTimestamp; _startTimestampList.push(ithStartTimestamp); _stakingContracts.push(stakingContracts[i]); // stakingToken.safeApprove(address(stakingContracts[i]), type(uint256).max); } } modifier isEnabled() { require(_enabled, "aggregator is not initialized"); _; } /* ========== MUTATIVE FUNCTIONS ========== */ function init() external { require(!_enabled, "already initialized"); for (uint256 i = 0; i < _stakingContracts.length; i++) { require(_stakingContracts[i].owner() == address(this), "not owner"); } _enabled = true; } /** * @notice Stake the staking token for the token to be paid as reward. */ function stake(uint128 amount) external override isEnabled returns (uint128 totalSendBack) { uint256 maxUntilNextTerm; uint256 nextStakingContractIndex; for (uint256 i = 0; i < _startTimestampList.length; i++) { // assert(_startTimestampList[i] <= block.timestamp); uint256 untilNextTerm = (block.timestamp - _startTimestampList[i]) % _termInterval; if (untilNextTerm > maxUntilNextTerm) { maxUntilNextTerm = untilNextTerm; nextStakingContractIndex = i; } } totalSendBack = _stakingContracts[nextStakingContractIndex].stakeViaAggregator( msg.sender, amount ); if (amount - totalSendBack != 0) { _stakingToken.safeTransferFrom(msg.sender, address(this), amount - totalSendBack); } } /** * @notice Withdraw the staking token for the token to be paid as reward. * @return totalSendBack is the amount returned instantly. */ function withdraw(uint128 amount) external override isEnabled returns (uint256 totalSendBack) { require(amount != 0, "withdrawing amount should be positive number"); uint256 maxUntilNextTerm; uint256 nextStakingContractIndex; for (uint256 i = 0; i < _startTimestampList.length; i++) { // assert(_startTimestampList[i] <= block.timestamp); uint256 untilNextTerm = (block.timestamp - _startTimestampList[i]) % _termInterval; if (untilNextTerm > maxUntilNextTerm) { maxUntilNextTerm = untilNextTerm; nextStakingContractIndex = i; } } for ( uint256 i = nextStakingContractIndex; i < nextStakingContractIndex + _startTimestampList.length && amount != 0; i++ ) { StakingWithAggregator ithStakingContract = _stakingContracts[i % _startTimestampList.length]; (, , , , , , uint128 withdrawableAmount, ) = ithStakingContract.getAccountInfo(msg.sender); uint128 ithAmount = (amount < withdrawableAmount) ? amount : withdrawableAmount; // assert(amount >= ithAmount); amount -= ithAmount; if (ithAmount != 0) { uint128 sendBack = ithStakingContract.withdrawViaAggregator(msg.sender, ithAmount); totalSendBack = totalSendBack.add(sendBack); } } require(amount == 0, "exceed withdrawable amount"); if (totalSendBack != 0) { _stakingToken.safeTransfer(msg.sender, totalSendBack); } } /** * @notice Receive the reward for your staking in the token. */ function receiveReward() external override isEnabled returns (uint256 remaining) { for (uint256 i = 0; i < _stakingContracts.length; i++) { remaining = remaining.add(_stakingContracts[i].receiveRewardViaAggregator(msg.sender)); } if (remaining != 0) { _stakingToken.safeTransfer(msg.sender, remaining); } } /** * @notice Add the reward to this contract. */ function addReward(uint256 stakingContractIndex, uint128 amount) external override isEnabled { require( stakingContractIndex < _stakingContracts.length, "stakingContractIndex is out of index" ); _stakingToken.safeTransferFrom(msg.sender, address(this), amount); return _stakingContracts[stakingContractIndex].addRewardViaAggregator(msg.sender, amount); } function getStakingTokenAddress() external view override returns (address) { return address(_stakingToken); } function getStakingContracts() external view override returns (StakingWithAggregator[] memory stakingContracts) { return _stakingContracts; } function getConfigs() external view override returns (uint256[] memory startTimestampList, uint256 termInterval) { startTimestampList = _startTimestampList; termInterval = _termInterval; } function getTokenInfo() external view override returns ( uint256[] memory latestTermList, uint256[] memory totalRemainingRewardsList, uint256[] memory currentTermRewardsList, uint256[] memory nextTermRewardsList, uint128[] memory currentStakingList, uint128[] memory nextTermStakingList ) { uint256 numOfStakingContracts = _stakingContracts.length; latestTermList = new uint256[](numOfStakingContracts); totalRemainingRewardsList = new uint256[](numOfStakingContracts); currentTermRewardsList = new uint256[](numOfStakingContracts); nextTermRewardsList = new uint256[](numOfStakingContracts); currentStakingList = new uint128[](numOfStakingContracts); nextTermStakingList = new uint128[](numOfStakingContracts); for (uint256 i = 0; i < numOfStakingContracts; i++) { ( , uint256 latestTerm, uint256 totalRemainingRewards, uint256 currentTermRewards, uint256 nextTermRewards, uint128 currentStaking, uint128 nextTermStaking ) = _stakingContracts[i].getTokenInfo(); latestTermList[i] = latestTerm; totalRemainingRewardsList[i] = totalRemainingRewards; currentTermRewardsList[i] = currentTermRewards; nextTermRewardsList[i] = nextTermRewards; currentStakingList[i] = currentStaking; nextTermStakingList[i] = nextTermStaking; } } function getTermInfo(uint256 term) external view override returns ( int128[] memory stakeAddList, uint128[] memory stakeSumList, uint256[] memory rewardSumList ) { uint256 numOfStakingContracts = _stakingContracts.length; stakeAddList = new int128[](numOfStakingContracts); stakeSumList = new uint128[](numOfStakingContracts); rewardSumList = new uint256[](numOfStakingContracts); for (uint256 i = 0; i < numOfStakingContracts; i++) { (int128 stakeAdd, uint128 stakeSum, uint256 rewardSum) = _stakingContracts[i].getTermInfo( term ); stakeAddList[i] = stakeAdd; stakeSumList[i] = stakeSum; rewardSumList[i] = rewardSum; } } function getAccountInfo(address account) external view override returns ( uint256[] memory userTermList, uint256[] memory stakeAmountList, int128[] memory nextAddedStakeAmountList, uint256[] memory currentTermUserRewardsList, uint256[] memory nextTermUserRewardsList, uint128[] memory withdrawableStakingAmountList ) { uint256 numOfStakingContracts = _stakingContracts.length; userTermList = new uint256[](numOfStakingContracts); stakeAmountList = new uint256[](numOfStakingContracts); nextAddedStakeAmountList = new int128[](numOfStakingContracts); currentTermUserRewardsList = new uint256[](numOfStakingContracts); nextTermUserRewardsList = new uint256[](numOfStakingContracts); withdrawableStakingAmountList = new uint128[](numOfStakingContracts); for (uint256 i = 0; i < numOfStakingContracts; i++) { address accountTmp = account; ( uint256 userTerm, uint256 stakeAmount, int128 nextAddedStakeAmount, , uint256 currentTermUserRewards, uint256 nextTermUserRewards, , uint128 withdrawableStakingAmount ) = _stakingContracts[i].getAccountInfo(accountTmp); userTermList[i] = userTerm; stakeAmountList[i] = stakeAmount; nextAddedStakeAmountList[i] = nextAddedStakeAmount; currentTermUserRewardsList[i] = currentTermUserRewards; nextTermUserRewardsList[i] = nextTermUserRewards; withdrawableStakingAmountList[i] = withdrawableStakingAmount; } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20","name":"stakingToken","type":"address"},{"internalType":"uint256","name":"termInterval","type":"uint256"},{"internalType":"contract StakingWithAggregator[]","name":"stakingContracts","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"stakingContractIndex","type":"uint256"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountInfo","outputs":[{"internalType":"uint256[]","name":"userTermList","type":"uint256[]"},{"internalType":"uint256[]","name":"stakeAmountList","type":"uint256[]"},{"internalType":"int128[]","name":"nextAddedStakeAmountList","type":"int128[]"},{"internalType":"uint256[]","name":"currentTermUserRewardsList","type":"uint256[]"},{"internalType":"uint256[]","name":"nextTermUserRewardsList","type":"uint256[]"},{"internalType":"uint128[]","name":"withdrawableStakingAmountList","type":"uint128[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConfigs","outputs":[{"internalType":"uint256[]","name":"startTimestampList","type":"uint256[]"},{"internalType":"uint256","name":"termInterval","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakingContracts","outputs":[{"internalType":"contract StakingWithAggregator[]","name":"stakingContracts","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakingTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"term","type":"uint256"}],"name":"getTermInfo","outputs":[{"internalType":"int128[]","name":"stakeAddList","type":"int128[]"},{"internalType":"uint128[]","name":"stakeSumList","type":"uint128[]"},{"internalType":"uint256[]","name":"rewardSumList","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenInfo","outputs":[{"internalType":"uint256[]","name":"latestTermList","type":"uint256[]"},{"internalType":"uint256[]","name":"totalRemainingRewardsList","type":"uint256[]"},{"internalType":"uint256[]","name":"currentTermRewardsList","type":"uint256[]"},{"internalType":"uint256[]","name":"nextTermRewardsList","type":"uint256[]"},{"internalType":"uint128[]","name":"currentStakingList","type":"uint128[]"},{"internalType":"uint128[]","name":"nextTermStakingList","type":"uint128[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"receiveReward","outputs":[{"internalType":"uint256","name":"remaining","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"stake","outputs":[{"internalType":"uint128","name":"totalSendBack","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"totalSendBack","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c06040526002805460ff191690553480156200001b57600080fd5b506040516200264b3803806200264b833981810160405260608110156200004157600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200006d57600080fd5b9083019060208201858111156200008357600080fd5b8251866020820283011164010000000082111715620000a157600080fd5b82525081516020918201928201910280838360005b83811015620000d0578181015183820152602001620000b6565b505050509050016040525050508051600014156200013a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180620025da6025913960400191505060405180910390fd5b6001600160601b0319606084901b1660a05260808290526000805b82518110156200042d57846001600160a01b03168382815181106200017657fe5b60200260200101516001600160a01b0316635e1e09a16040518163ffffffff1660e01b815260040160206040518083038186803b158015620001b757600080fd5b505afa158015620001cc573d6000803e3d6000fd5b505050506040513d6020811015620001e357600080fd5b50516001600160a01b03161462000246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018062002621602a913960400191505060405180910390fd5b6000808483815181106200025657fe5b60200260200101516001600160a01b031663abdc30336040518163ffffffff1660e01b8152600401604080518083038186803b1580156200029657600080fd5b505afa158015620002ab573d6000803e3d6000fd5b505050506040513d6040811015620002c257600080fd5b50805160209091015190925090508581146200032a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180620025ff6022913960400191505060405180910390fd5b8382116200039957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f737461727454696d657374616d702073686f756c6420626520736f7274656400604482015290519081900360640190fd5b60018054808201825560009182527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60183905585519294508492869085908110620003e057fe5b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b0390931692909217909155929092019150620001559050565b505050505060805160a05160601c612163620004776000398061098152806109b15280610f6a52806112c85280611bb25250806106695280610e0a52806117bc52506121636000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c8063a94785d811610081578063dad8a0321161005b578063dad8a03214610511578063e1c7392a14610569578063ff3d9e4f14610571576100c9565b8063a94785d81461046f578063abb1dc44146104a6578063abdc3033146104ae576100c9565b80637b510fe8116100b25780637b510fe81461014057806388fe2be814610320578063979c6fe614610374576100c9565b806302387a7b146100ce5780635e1e09a11461010f575b600080fd5b6100fd600480360360208110156100e457600080fd5b50356fffffffffffffffffffffffffffffffff16610579565b60408051918252519081900360200190f35b6101176109af565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101736004803603602081101561015657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166109d4565b6040518080602001806020018060200180602001806020018060200187810387528d818151815260200191508051906020019060200280838360005b838110156101c75781810151838201526020016101af565b5050505090500187810386528c818151815260200191508051906020019060200280838360005b838110156102065781810151838201526020016101ee565b5050505090500187810385528b818151815260200191508051906020019060200280838360005b8381101561024557818101518382015260200161022d565b5050505090500187810384528a818151815260200191508051906020019060200280838360005b8381101561028457818101518382015260200161026c565b50505050905001878103835289818151815260200191508051906020019060200280838360005b838110156102c35781810151838201526020016102ab565b50505050905001878103825288818151815260200191508051906020019060200280838360005b838110156103025781810151838201526020016102ea565b505050509050019c5050505050505050505050505060405180910390f35b61034f6004803603602081101561033657600080fd5b50356fffffffffffffffffffffffffffffffff16610d82565b604080516fffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6103916004803603602081101561038a57600080fd5b5035610fa6565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156103d95781810151838201526020016103c1565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015610418578181015183820152602001610400565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561045757818101518382015260200161043f565b50505050905001965050505050505060405180910390f35b6104a46004803603604081101561048557600080fd5b50803590602001356fffffffffffffffffffffffffffffffff166111e3565b005b6101736113b7565b6104b6611763565b6040518080602001838152602001828103825284818151815260200191508051906020019060200280838360005b838110156104fc5781810151838201526020016104e4565b50505050905001935050505060405180910390f35b6105196117e1565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561055557818101518382015260200161053d565b505050509050019250505060405180910390f35b6104a4611850565b6100fd611a46565b60025460009060ff166105ed57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f61676772656761746f72206973206e6f7420696e697469616c697a6564000000604482015290519081900360640190fd5b6fffffffffffffffffffffffffffffffff8216610655576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806120d8602c913960400191505060405180910390fd5b60008060005b6001548110156106c45760007f00000000000000000000000000000000000000000000000000000000000000006001838154811061069557fe5b90600052602060002001544203816106a957fe5b069050838111156106bb578093508192505b5060010161065b565b50805b6001548201811080156106eb57506fffffffffffffffffffffffffffffffff851615155b156108e1576001546000908190838161070057fe5b068154811061070b57fe5b6000918252602082200154604080517f7b510fe8000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff90921693508391637b510fe89160248082019261010092909190829003018186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d6101008110156107b357600080fd5b5060c00151905060006fffffffffffffffffffffffffffffffff808316908916106107de57816107e0565b875b978890039790506fffffffffffffffffffffffffffffffff8116156108d657604080517f0ef22d1b0000000000000000000000000000000000000000000000000000000081523360048201526fffffffffffffffffffffffffffffffff83166024820152905160009173ffffffffffffffffffffffffffffffffffffffff861691630ef22d1b9160448082019260209290919082900301818787803b15801561088857600080fd5b505af115801561089c573d6000803e3d6000fd5b505050506040513d60208110156108b257600080fd5b505190506108d2886fffffffffffffffffffffffffffffffff8316611bd9565b9750505b5050506001016106c7565b506fffffffffffffffffffffffffffffffff84161561096157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f65786365656420776974686472617761626c6520616d6f756e74000000000000604482015290519081900360640190fd5b82156109a8576109a873ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163385611c54565b5050919050565b7f00000000000000000000000000000000000000000000000000000000000000005b90565b6060806060806060806000808054905090508067ffffffffffffffff811180156109fd57600080fd5b50604051908082528060200260200182016040528015610a27578160200160208202803683370190505b5096508067ffffffffffffffff81118015610a4157600080fd5b50604051908082528060200260200182016040528015610a6b578160200160208202803683370190505b5095508067ffffffffffffffff81118015610a8557600080fd5b50604051908082528060200260200182016040528015610aaf578160200160208202803683370190505b5094508067ffffffffffffffff81118015610ac957600080fd5b50604051908082528060200260200182016040528015610af3578160200160208202803683370190505b5093508067ffffffffffffffff81118015610b0d57600080fd5b50604051908082528060200260200182016040528015610b37578160200160208202803683370190505b5092508067ffffffffffffffff81118015610b5157600080fd5b50604051908082528060200260200182016040528015610b7b578160200160208202803683370190505b50915060005b81811015610d7757600089905060008060008060008060008881548110610ba457fe5b600091825260209091200154604080517f7b510fe800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116600483015291519190921691637b510fe891602480830192610100929190829003018186803b158015610c2157600080fd5b505afa158015610c35573d6000803e3d6000fd5b505050506040513d610100811015610c4c57600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291905050509750509650965050955095509550858f8981518110610cbe57fe5b602002602001018181525050848e8981518110610cd757fe5b602002602001018181525050838d8981518110610cf057fe5b6020026020010190600f0b9081600f0b81525050828c8981518110610d1157fe5b602002602001018181525050818b8981518110610d2a57fe5b602002602001018181525050808a8981518110610d4357fe5b6fffffffffffffffffffffffffffffffff90921660209283029190910190910152505060019095019450610b819350505050565b505091939550919395565b60025460009060ff16610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f61676772656761746f72206973206e6f7420696e697469616c697a6564000000604482015290519081900360640190fd5b60008060005b600154811015610e655760007f000000000000000000000000000000000000000000000000000000000000000060018381548110610e3657fe5b9060005260206000200154420381610e4a57fe5b06905083811115610e5c578093508192505b50600101610dfc565b5060008181548110610e7357fe5b6000918252602080832090910154604080517f99d620390000000000000000000000000000000000000000000000000000000081523360048201526fffffffffffffffffffffffffffffffff89166024820152905173ffffffffffffffffffffffffffffffffffffffff909216936399d620399360448084019491939192918390030190829087803b158015610f0857600080fd5b505af1158015610f1c573d6000803e3d6000fd5b505050506040513d6020811015610f3257600080fd5b505192506fffffffffffffffffffffffffffffffff83850316156109a8576109a873ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633306fffffffffffffffffffffffffffffffff87890316611ce6565b600054606090819081908067ffffffffffffffff81118015610fc757600080fd5b50604051908082528060200260200182016040528015610ff1578160200160208202803683370190505b5093508067ffffffffffffffff8111801561100b57600080fd5b50604051908082528060200260200182016040528015611035578160200160208202803683370190505b5092508067ffffffffffffffff8111801561104f57600080fd5b50604051908082528060200260200182016040528015611079578160200160208202803683370190505b50915060005b818110156111da57600080600080848154811061109857fe5b600091825260209091200154604080517f979c6fe6000000000000000000000000000000000000000000000000000000008152600481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163979c6fe691602480820192606092909190829003018186803b15801561111357600080fd5b505afa158015611127573d6000803e3d6000fd5b505050506040513d606081101561113d57600080fd5b50805160208201516040909201518a51919550919350909150839089908690811061116457fe5b6020026020010190600f0b9081600f0b815250508187858151811061118557fe5b60200260200101906fffffffffffffffffffffffffffffffff1690816fffffffffffffffffffffffffffffffff1681525050808685815181106111c457fe5b602090810291909101015250505060010161107f565b50509193909250565b60025460ff1661125457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f61676772656761746f72206973206e6f7420696e697469616c697a6564000000604482015290519081900360640190fd5b60005482106112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806120b46024913960400191505060405180910390fd5b61130273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633306fffffffffffffffffffffffffffffffff8516611ce6565b6000828154811061130f57fe5b6000918252602082200154604080517f3382ca880000000000000000000000000000000000000000000000000000000081523360048201526fffffffffffffffffffffffffffffffff85166024820152905173ffffffffffffffffffffffffffffffffffffffff90921692633382ca889260448084019382900301818387803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b505050505050565b6060806060806060806000808054905090508067ffffffffffffffff811180156113e057600080fd5b5060405190808252806020026020018201604052801561140a578160200160208202803683370190505b5096508067ffffffffffffffff8111801561142457600080fd5b5060405190808252806020026020018201604052801561144e578160200160208202803683370190505b5095508067ffffffffffffffff8111801561146857600080fd5b50604051908082528060200260200182016040528015611492578160200160208202803683370190505b5094508067ffffffffffffffff811180156114ac57600080fd5b506040519080825280602002602001820160405280156114d6578160200160208202803683370190505b5093508067ffffffffffffffff811180156114f057600080fd5b5060405190808252806020026020018201604052801561151a578160200160208202803683370190505b5092508067ffffffffffffffff8111801561153457600080fd5b5060405190808252806020026020018201604052801561155e578160200160208202803683370190505b50915060005b81811015611759576000806000806000806000878154811061158257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663abb1dc446040518163ffffffff1660e01b815260040160e06040518083038186803b1580156115f257600080fd5b505afa158015611606573d6000803e3d6000fd5b505050506040513d60e081101561161c57600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505096509650965096509650965050858e888151811061168357fe5b602002602001018181525050848d888151811061169c57fe5b602002602001018181525050838c88815181106116b557fe5b602002602001018181525050828b88815181106116ce57fe5b602002602001018181525050818a88815181106116e757fe5b60200260200101906fffffffffffffffffffffffffffffffff1690816fffffffffffffffffffffffffffffffff16815250508089888151811061172657fe5b6fffffffffffffffffffffffffffffffff9092166020928302919091019091015250506001909401935061156492505050565b5050909192939495565b6060600060018054806020026020016040519081016040528092919081815260200182805480156117b357602002820191906000526020600020905b81548152602001906001019080831161179f575b505050505091507f000000000000000000000000000000000000000000000000000000000000000090509091565b6060600080548060200260200160405190810160405280929190818152602001828054801561184657602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161181b575b5050505050905090565b60025460ff16156118c257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f616c726561647920696e697469616c697a656400000000000000000000000000604482015290519081900360640190fd5b60005b600054811015611a18573073ffffffffffffffffffffffffffffffffffffffff16600082815481106118f357fe5b60009182526020918290200154604080517f8da5cb5b000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff90921692638da5cb5b92600480840193829003018186803b15801561196257600080fd5b505afa158015611976573d6000803e3d6000fd5b505050506040513d602081101561198c57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1614611a1057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6001016118c5565b50600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60025460009060ff16611aba57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f61676772656761746f72206973206e6f7420696e697469616c697a6564000000604482015290519081900360640190fd5b60005b600054811015611b9157611b8760008281548110611ad757fe5b6000918252602080832090910154604080517f94bd791b000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff909216936394bd791b9360248084019491939192918390030190829087803b158015611b5457600080fd5b505af1158015611b68573d6000803e3d6000fd5b505050506040513d6020811015611b7e57600080fd5b50518390611bd9565b9150600101611abd565b5080156109d1576109d173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163383611c54565b600082820183811015611c4d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611ce1908490611d81565b505050565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611d7b908590611d81565b50505050565b6060611de3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611e599092919063ffffffff16565b805190915015611ce157808060200190516020811015611e0257600080fd5b5051611ce1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612104602a913960400191505060405180910390fd5b6060611e688484600085611e70565b949350505050565b6060611e7b8561207a565b611ee657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310611f5057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611f13565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611fb2576040519150601f19603f3d011682016040523d82523d6000602084013e611fb7565b606091505b50915091508115611fcb579150611e689050565b805115611fdb5780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561203f578181015183820152602001612027565b50505050905090810190601f16801561206c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611e6857505015159291505056fe7374616b696e67436f6e7472616374496e646578206973206f7574206f6620696e6465787769746864726177696e6720616d6f756e742073686f756c6420626520706f736974697665206e756d6265725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220d5d53887da739289cfd6e78c2701a56db1f7e189075fecb84f093994f102a42164736f6c634300070100337374616b696e6720636f6e7472616374732073686f756c64206e6f7420626520656d7074797465726d20696e74657276616c206469666665722066726f6d2065787065637465647374616b696e6720746f6b656e2061646472657373206469666665722066726f6d2065787065637465640000000000000000000000000789dbae94fb18e5789b8e4489bcb7a1adb586220000000000000000000000000000000000000000000000000000000000dd7c00000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000060000000000000000000000007ccc06f6c6bb6add910aac9580901592d1cfd17c000000000000000000000000337c6e538b07247bc55feb66a79abe10af828fd900000000000000000000000087c4f0d0a1399b7fe55f518b73b4ef4f7fd1e4fb00000000000000000000000049c3343b95e4e06bb50dddfbb5c3cf3e9aefff29000000000000000000000000f7769d68a98e713d1b5c4c52030fb365877acc04000000000000000000000000e88fc3eb2985627c711ecd81635c3ba7049b40c6
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063a94785d811610081578063dad8a0321161005b578063dad8a03214610511578063e1c7392a14610569578063ff3d9e4f14610571576100c9565b8063a94785d81461046f578063abb1dc44146104a6578063abdc3033146104ae576100c9565b80637b510fe8116100b25780637b510fe81461014057806388fe2be814610320578063979c6fe614610374576100c9565b806302387a7b146100ce5780635e1e09a11461010f575b600080fd5b6100fd600480360360208110156100e457600080fd5b50356fffffffffffffffffffffffffffffffff16610579565b60408051918252519081900360200190f35b6101176109af565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101736004803603602081101561015657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166109d4565b6040518080602001806020018060200180602001806020018060200187810387528d818151815260200191508051906020019060200280838360005b838110156101c75781810151838201526020016101af565b5050505090500187810386528c818151815260200191508051906020019060200280838360005b838110156102065781810151838201526020016101ee565b5050505090500187810385528b818151815260200191508051906020019060200280838360005b8381101561024557818101518382015260200161022d565b5050505090500187810384528a818151815260200191508051906020019060200280838360005b8381101561028457818101518382015260200161026c565b50505050905001878103835289818151815260200191508051906020019060200280838360005b838110156102c35781810151838201526020016102ab565b50505050905001878103825288818151815260200191508051906020019060200280838360005b838110156103025781810151838201526020016102ea565b505050509050019c5050505050505050505050505060405180910390f35b61034f6004803603602081101561033657600080fd5b50356fffffffffffffffffffffffffffffffff16610d82565b604080516fffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6103916004803603602081101561038a57600080fd5b5035610fa6565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156103d95781810151838201526020016103c1565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015610418578181015183820152602001610400565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561045757818101518382015260200161043f565b50505050905001965050505050505060405180910390f35b6104a46004803603604081101561048557600080fd5b50803590602001356fffffffffffffffffffffffffffffffff166111e3565b005b6101736113b7565b6104b6611763565b6040518080602001838152602001828103825284818151815260200191508051906020019060200280838360005b838110156104fc5781810151838201526020016104e4565b50505050905001935050505060405180910390f35b6105196117e1565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561055557818101518382015260200161053d565b505050509050019250505060405180910390f35b6104a4611850565b6100fd611a46565b60025460009060ff166105ed57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f61676772656761746f72206973206e6f7420696e697469616c697a6564000000604482015290519081900360640190fd5b6fffffffffffffffffffffffffffffffff8216610655576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806120d8602c913960400191505060405180910390fd5b60008060005b6001548110156106c45760007f0000000000000000000000000000000000000000000000000000000000dd7c006001838154811061069557fe5b90600052602060002001544203816106a957fe5b069050838111156106bb578093508192505b5060010161065b565b50805b6001548201811080156106eb57506fffffffffffffffffffffffffffffffff851615155b156108e1576001546000908190838161070057fe5b068154811061070b57fe5b6000918252602082200154604080517f7b510fe8000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff90921693508391637b510fe89160248082019261010092909190829003018186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d6101008110156107b357600080fd5b5060c00151905060006fffffffffffffffffffffffffffffffff808316908916106107de57816107e0565b875b978890039790506fffffffffffffffffffffffffffffffff8116156108d657604080517f0ef22d1b0000000000000000000000000000000000000000000000000000000081523360048201526fffffffffffffffffffffffffffffffff83166024820152905160009173ffffffffffffffffffffffffffffffffffffffff861691630ef22d1b9160448082019260209290919082900301818787803b15801561088857600080fd5b505af115801561089c573d6000803e3d6000fd5b505050506040513d60208110156108b257600080fd5b505190506108d2886fffffffffffffffffffffffffffffffff8316611bd9565b9750505b5050506001016106c7565b506fffffffffffffffffffffffffffffffff84161561096157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f65786365656420776974686472617761626c6520616d6f756e74000000000000604482015290519081900360640190fd5b82156109a8576109a873ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000789dbae94fb18e5789b8e4489bcb7a1adb58622163385611c54565b5050919050565b7f0000000000000000000000000789dbae94fb18e5789b8e4489bcb7a1adb586225b90565b6060806060806060806000808054905090508067ffffffffffffffff811180156109fd57600080fd5b50604051908082528060200260200182016040528015610a27578160200160208202803683370190505b5096508067ffffffffffffffff81118015610a4157600080fd5b50604051908082528060200260200182016040528015610a6b578160200160208202803683370190505b5095508067ffffffffffffffff81118015610a8557600080fd5b50604051908082528060200260200182016040528015610aaf578160200160208202803683370190505b5094508067ffffffffffffffff81118015610ac957600080fd5b50604051908082528060200260200182016040528015610af3578160200160208202803683370190505b5093508067ffffffffffffffff81118015610b0d57600080fd5b50604051908082528060200260200182016040528015610b37578160200160208202803683370190505b5092508067ffffffffffffffff81118015610b5157600080fd5b50604051908082528060200260200182016040528015610b7b578160200160208202803683370190505b50915060005b81811015610d7757600089905060008060008060008060008881548110610ba457fe5b600091825260209091200154604080517f7b510fe800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116600483015291519190921691637b510fe891602480830192610100929190829003018186803b158015610c2157600080fd5b505afa158015610c35573d6000803e3d6000fd5b505050506040513d610100811015610c4c57600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291905050509750509650965050955095509550858f8981518110610cbe57fe5b602002602001018181525050848e8981518110610cd757fe5b602002602001018181525050838d8981518110610cf057fe5b6020026020010190600f0b9081600f0b81525050828c8981518110610d1157fe5b602002602001018181525050818b8981518110610d2a57fe5b602002602001018181525050808a8981518110610d4357fe5b6fffffffffffffffffffffffffffffffff90921660209283029190910190910152505060019095019450610b819350505050565b505091939550919395565b60025460009060ff16610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f61676772656761746f72206973206e6f7420696e697469616c697a6564000000604482015290519081900360640190fd5b60008060005b600154811015610e655760007f0000000000000000000000000000000000000000000000000000000000dd7c0060018381548110610e3657fe5b9060005260206000200154420381610e4a57fe5b06905083811115610e5c578093508192505b50600101610dfc565b5060008181548110610e7357fe5b6000918252602080832090910154604080517f99d620390000000000000000000000000000000000000000000000000000000081523360048201526fffffffffffffffffffffffffffffffff89166024820152905173ffffffffffffffffffffffffffffffffffffffff909216936399d620399360448084019491939192918390030190829087803b158015610f0857600080fd5b505af1158015610f1c573d6000803e3d6000fd5b505050506040513d6020811015610f3257600080fd5b505192506fffffffffffffffffffffffffffffffff83850316156109a8576109a873ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000789dbae94fb18e5789b8e4489bcb7a1adb586221633306fffffffffffffffffffffffffffffffff87890316611ce6565b600054606090819081908067ffffffffffffffff81118015610fc757600080fd5b50604051908082528060200260200182016040528015610ff1578160200160208202803683370190505b5093508067ffffffffffffffff8111801561100b57600080fd5b50604051908082528060200260200182016040528015611035578160200160208202803683370190505b5092508067ffffffffffffffff8111801561104f57600080fd5b50604051908082528060200260200182016040528015611079578160200160208202803683370190505b50915060005b818110156111da57600080600080848154811061109857fe5b600091825260209091200154604080517f979c6fe6000000000000000000000000000000000000000000000000000000008152600481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163979c6fe691602480820192606092909190829003018186803b15801561111357600080fd5b505afa158015611127573d6000803e3d6000fd5b505050506040513d606081101561113d57600080fd5b50805160208201516040909201518a51919550919350909150839089908690811061116457fe5b6020026020010190600f0b9081600f0b815250508187858151811061118557fe5b60200260200101906fffffffffffffffffffffffffffffffff1690816fffffffffffffffffffffffffffffffff1681525050808685815181106111c457fe5b602090810291909101015250505060010161107f565b50509193909250565b60025460ff1661125457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f61676772656761746f72206973206e6f7420696e697469616c697a6564000000604482015290519081900360640190fd5b60005482106112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806120b46024913960400191505060405180910390fd5b61130273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000789dbae94fb18e5789b8e4489bcb7a1adb586221633306fffffffffffffffffffffffffffffffff8516611ce6565b6000828154811061130f57fe5b6000918252602082200154604080517f3382ca880000000000000000000000000000000000000000000000000000000081523360048201526fffffffffffffffffffffffffffffffff85166024820152905173ffffffffffffffffffffffffffffffffffffffff90921692633382ca889260448084019382900301818387803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b505050505050565b6060806060806060806000808054905090508067ffffffffffffffff811180156113e057600080fd5b5060405190808252806020026020018201604052801561140a578160200160208202803683370190505b5096508067ffffffffffffffff8111801561142457600080fd5b5060405190808252806020026020018201604052801561144e578160200160208202803683370190505b5095508067ffffffffffffffff8111801561146857600080fd5b50604051908082528060200260200182016040528015611492578160200160208202803683370190505b5094508067ffffffffffffffff811180156114ac57600080fd5b506040519080825280602002602001820160405280156114d6578160200160208202803683370190505b5093508067ffffffffffffffff811180156114f057600080fd5b5060405190808252806020026020018201604052801561151a578160200160208202803683370190505b5092508067ffffffffffffffff8111801561153457600080fd5b5060405190808252806020026020018201604052801561155e578160200160208202803683370190505b50915060005b81811015611759576000806000806000806000878154811061158257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663abb1dc446040518163ffffffff1660e01b815260040160e06040518083038186803b1580156115f257600080fd5b505afa158015611606573d6000803e3d6000fd5b505050506040513d60e081101561161c57600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505096509650965096509650965050858e888151811061168357fe5b602002602001018181525050848d888151811061169c57fe5b602002602001018181525050838c88815181106116b557fe5b602002602001018181525050828b88815181106116ce57fe5b602002602001018181525050818a88815181106116e757fe5b60200260200101906fffffffffffffffffffffffffffffffff1690816fffffffffffffffffffffffffffffffff16815250508089888151811061172657fe5b6fffffffffffffffffffffffffffffffff9092166020928302919091019091015250506001909401935061156492505050565b5050909192939495565b6060600060018054806020026020016040519081016040528092919081815260200182805480156117b357602002820191906000526020600020905b81548152602001906001019080831161179f575b505050505091507f0000000000000000000000000000000000000000000000000000000000dd7c0090509091565b6060600080548060200260200160405190810160405280929190818152602001828054801561184657602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161181b575b5050505050905090565b60025460ff16156118c257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f616c726561647920696e697469616c697a656400000000000000000000000000604482015290519081900360640190fd5b60005b600054811015611a18573073ffffffffffffffffffffffffffffffffffffffff16600082815481106118f357fe5b60009182526020918290200154604080517f8da5cb5b000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff90921692638da5cb5b92600480840193829003018186803b15801561196257600080fd5b505afa158015611976573d6000803e3d6000fd5b505050506040513d602081101561198c57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1614611a1057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6001016118c5565b50600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60025460009060ff16611aba57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f61676772656761746f72206973206e6f7420696e697469616c697a6564000000604482015290519081900360640190fd5b60005b600054811015611b9157611b8760008281548110611ad757fe5b6000918252602080832090910154604080517f94bd791b000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff909216936394bd791b9360248084019491939192918390030190829087803b158015611b5457600080fd5b505af1158015611b68573d6000803e3d6000fd5b505050506040513d6020811015611b7e57600080fd5b50518390611bd9565b9150600101611abd565b5080156109d1576109d173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000789dbae94fb18e5789b8e4489bcb7a1adb58622163383611c54565b600082820183811015611c4d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611ce1908490611d81565b505050565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611d7b908590611d81565b50505050565b6060611de3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611e599092919063ffffffff16565b805190915015611ce157808060200190516020811015611e0257600080fd5b5051611ce1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612104602a913960400191505060405180910390fd5b6060611e688484600085611e70565b949350505050565b6060611e7b8561207a565b611ee657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310611f5057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611f13565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611fb2576040519150601f19603f3d011682016040523d82523d6000602084013e611fb7565b606091505b50915091508115611fcb579150611e689050565b805115611fdb5780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561203f578181015183820152602001612027565b50505050905090810190601f16801561206c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611e6857505015159291505056fe7374616b696e67436f6e7472616374496e646578206973206f7574206f6620696e6465787769746864726177696e6720616d6f756e742073686f756c6420626520706f736974697665206e756d6265725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220d5d53887da739289cfd6e78c2701a56db1f7e189075fecb84f093994f102a42164736f6c63430007010033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000789dbae94fb18e5789b8e4489bcb7a1adb586220000000000000000000000000000000000000000000000000000000000dd7c00000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000060000000000000000000000007ccc06f6c6bb6add910aac9580901592d1cfd17c000000000000000000000000337c6e538b07247bc55feb66a79abe10af828fd900000000000000000000000087c4f0d0a1399b7fe55f518b73b4ef4f7fd1e4fb00000000000000000000000049c3343b95e4e06bb50dddfbb5c3cf3e9aefff29000000000000000000000000f7769d68a98e713d1b5c4c52030fb365877acc04000000000000000000000000e88fc3eb2985627c711ecd81635c3ba7049b40c6
-----Decoded View---------------
Arg [0] : stakingToken (address): 0x0789dbAE94fb18e5789B8e4489BCB7A1ADB58622
Arg [1] : termInterval (uint256): 14515200
Arg [2] : stakingContracts (address[]): 0x7cCc06F6c6Bb6aDD910aaC9580901592D1CFD17C,0x337c6e538b07247bC55fEB66A79ABe10AF828fd9,0x87C4f0d0A1399b7fE55f518B73b4EF4f7Fd1e4FB,0x49c3343b95e4e06bb50dDdFBB5c3Cf3e9aeFfF29,0xF7769D68a98E713D1B5c4C52030fB365877AcC04,0xE88fc3EB2985627C711ECD81635c3ba7049B40C6
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000000789dbae94fb18e5789b8e4489bcb7a1adb58622
Arg [1] : 0000000000000000000000000000000000000000000000000000000000dd7c00
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [4] : 0000000000000000000000007ccc06f6c6bb6add910aac9580901592d1cfd17c
Arg [5] : 000000000000000000000000337c6e538b07247bc55feb66a79abe10af828fd9
Arg [6] : 00000000000000000000000087c4f0d0a1399b7fe55f518b73b4ef4f7fd1e4fb
Arg [7] : 00000000000000000000000049c3343b95e4e06bb50dddfbb5c3cf3e9aefff29
Arg [8] : 000000000000000000000000f7769d68a98e713d1b5c4c52030fb365877acc04
Arg [9] : 000000000000000000000000e88fc3eb2985627c711ecd81635c3ba7049b40c6
Deployed Bytecode Sourcemap
55821:9813:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;58913:1477;;;;;;;;;;;;;;;;-1:-1:-1;58913:1477:0;;;;:::i;:::-;;;;;;;;;;;;;;;;61283:117;;;:::i;:::-;;;;;;;;;;;;;;;;;;;64036:1595;;;;;;;;;;;;;;;;-1:-1:-1;64036:1595:0;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;57959:795;;;;;;;;;;;;;;;;-1:-1:-1;57959:795:0;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;63281:749;;;;;;;;;;;;;;;;-1:-1:-1;63281:749:0;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60886:391;;;;;;;;;;;;;;;;-1:-1:-1;60886:391:0;;;;;;;;;:::i;:::-;;61814:1461;;;:::i;61584:224::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;61406:172;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;57615:250;;;:::i;60474:345::-;;;:::i;58913:1477::-;57501:8;;58984:21;;57501:8;;57493:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;59022:11:::1;::::0;::::1;59014:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;59091:24;59122:32:::0;59166:9:::1;59161:355;59185:19;:26:::0;59181:30;::::1;59161:355;;;59288:21;59357:13;59331:19;59351:1;59331:22;;;;;;;;;;;;;;;;59313:15;:40;59312:58;;;;;;59288:82;;59399:16;59383:13;:32;59379:130;;;59447:13;59428:32;;59498:1;59471:28;;59379:130;-1:-1:-1::0;59213:3:0::1;;59161:355;;;-1:-1:-1::0;59549:24:0;59524:700:::1;59613:19;:26:::0;59586:53;::::1;59582:57:::0;::::1;:72:::0;::::1;;;-1:-1:-1::0;59643:11:0::1;::::0;::::1;::::0;::::1;59582:72;59524:700;;;59748:19;:26:::0;59683:40:::1;::::0;;;59744:1;59748:26;59744:30:::1;;;;;59726:49;;;;;;;;;::::0;;;::::1;::::0;;::::1;::::0;59829:45:::1;::::0;;;;;59863:10:::1;59829:45;::::0;::::1;::::0;;;59726:49:::1;::::0;;::::1;::::0;-1:-1:-1;59726:49:0;;59829:33:::1;::::0;:45;;;;;59726:49:::1;::::0;59829:45;;;;;;;;59726:49;59829:45;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;59829:45:0;;;;-1:-1:-1;59883:17:0::1;59904:27;::::0;;::::1;::::0;;::::1;;59903:59;;59944:18;59903:59;;;59935:6;59903:59;60010:19:::0;;;::::1;::::0;59883:79;-1:-1:-1;60044:14:0::1;::::0;::::1;::::0;60040:177:::1;;60090:63;::::0;;;;;60131:10:::1;60090:63;::::0;::::1;::::0;::::1;::::0;::::1;::::0;;;;;;60071:16:::1;::::0;60090:40:::1;::::0;::::1;::::0;::::1;::::0;:63;;;;;::::1;::::0;;;;;;;;;60071:16;60090:40;:63;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;60090:63:0;;-1:-1:-1;60180:27:0::1;:13:::0;:27:::1;::::0;::::1;:17;:27::i;:::-;60164:43;;60040:177;;-1:-1:-1::0;;;59663:3:0::1;;59524:700;;;-1:-1:-1::0;60240:11:0::1;::::0;::::1;::::0;60232:50:::1;;;::::0;;::::1;::::0;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;::::1;::::0;;;;;;;;;;;;;::::1;;60295:18:::0;;60291:94:::1;;60324:53;:26;:13;:26;60351:10;60363:13:::0;60324:26:::1;:53::i;:::-;57550:1;;58913:1477:::0;;;:::o;61283:117::-;61380:13;61283:117;;:::o;64036:1595::-;64137:29;64175:32;64216:40;64265:43;64317:40;64366:46;64430:29;64462:17;:24;;;;64430:56;;64522:21;64508:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;64508:36:0;;64493:51;;64583:21;64569:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;64569:36:0;;64551:54;;64652:21;64639:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;64639:35:0;;64612:62;;64724:21;64710:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;64710:36:0;;64681:65;;64793:21;64779:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;64779:36:0;;64753:62;;64868:21;64854:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;64854:36:0;;64822:68;;64902:9;64897:729;64921:21;64917:1;:25;64897:729;;;64958:18;64979:7;64958:28;;65006:16;65033:19;65063:27;65112:30;65153:27;65202:33;65247:17;65265:1;65247:20;;;;;;;;;;;;;;;;;;:47;;;;;;:20;:47;;;;;;;;;:20;;;;;:35;;:47;;;;;:20;;:47;;;;;;;:20;:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;64995:299;;;;;;;;;;;;;;65321:8;65303:12;65316:1;65303:15;;;;;;;;;;;;;:26;;;;;65359:11;65338:15;65354:1;65338:18;;;;;;;;;;;;;:32;;;;;65409:20;65379:24;65404:1;65379:27;;;;;;;;;;;;;:50;;;;;;;;;;;65470:22;65438:26;65465:1;65438:29;;;;;;;;;;;;;:54;;;;;65530:19;65501:23;65525:1;65501:26;;;;;;;;;;;;;:48;;;;;65593:25;65558:29;65588:1;65558:32;;;;;;;;:60;;;;:32;;;;;;;;;;;:60;-1:-1:-1;;64944:3:0;;;;;-1:-1:-1;64897:729:0;;-1:-1:-1;;;;64897:729:0;;;64036:1595;;;;;;;;:::o;57959:795::-;57501:8;;58027:21;;57501:8;;57493:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;58057:24:::1;58088:32:::0;58132:9:::1;58127:355;58151:19;:26:::0;58147:30;::::1;58127:355;;;58254:21;58323:13;58297:19;58317:1;58297:22;;;;;;;;;;;;;;;;58279:15;:40;58278:58;;;;;;58254:82;;58365:16;58349:13;:32;58345:130;;;58413:13;58394:32;;58464:1;58437:28;;58345:130;-1:-1:-1::0;58179:3:0::1;;58127:355;;;;58506:17;58524:24;58506:43;;;;;;;;;::::0;;;::::1;::::0;;;;;::::1;::::0;:103:::1;::::0;;;;;58577:10:::1;58506:103;::::0;::::1;::::0;::::1;::::0;::::1;::::0;;;;;;:43:::1;::::0;;::::1;::::0;:62:::1;::::0;:103;;;;;:43;;:103;;;;;;;;;;:43;:103;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;58506:103:0;;-1:-1:-1;58622:27:0::1;:22:::0;;::::1;:27;::::0;58618:131:::1;;58660:81;:30;:13;:30;58691:10;58711:4;58660:81;58718:22:::0;;::::1;58660:81;:30;:81::i;63281:749::-:0;63499:29;63531:24;63376:28;;;;;;63531:24;63577:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;63577:35:0;;63562:50;;63648:21;63634:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;63634:36:0;;63619:51;;63707:21;63693:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;63693:36:0;;63677:52;;63741:9;63736:289;63760:21;63756:1;:25;63736:289;;;63798:15;63815:16;63833:17;63854;63872:1;63854:20;;;;;;;;;;;;;;;;;;:56;;;;;;;;;;;;;;:20;;;;;:32;;:56;;;;;;;;;;;;;;;:20;:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;63854:56:0;;;;;;;;;;;63919:15;;63854:56;;-1:-1:-1;63854:56:0;;-1:-1:-1;63854:56:0;;-1:-1:-1;63854:56:0;;63919:12;;63932:1;;63919:15;;;;;;;;;;;:26;;;;;;;;;;;63972:8;63954:12;63967:1;63954:15;;;;;;;;;;;;;:26;;;;;;;;;;;64008:9;63989:13;64003:1;63989:16;;;;;;;;;;;;;;;;;:28;-1:-1:-1;;;63783:3:0;;63736:289;;;;63281:749;;;;;;:::o;60886:391::-;57501:8;;;;57493:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;61025:17:::1;:24:::0;61002:47;::::1;60986:117;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;61110:65;:30;:13;:30;61141:10;61161:4;61110:65;::::0;::::1;:30;:65::i;:::-;61189:17;61207:20;61189:39;;;;;;;;;::::0;;;::::1;::::0;;::::1;::::0;:82:::1;::::0;;;;;61252:10:::1;61189:82;::::0;::::1;::::0;::::1;::::0;::::1;::::0;;;;;;:39:::1;::::0;;::::1;::::0;:62:::1;::::0;:82;;;;;;;;;;:39;;:82;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;60886:391:::0;;:::o;61814:1461::-;61898:31;61938:42;61989:39;62037:36;62082:35;62126:36;62180:29;62212:17;:24;;;;62180:56;;62274:21;62260:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;62260:36:0;;62243:53;;62345:21;62331:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;62331:36:0;;62303:64;;62413:21;62399:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;62399:36:0;;62374:61;;62478:21;62464:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;62464:36:0;;62442:58;;62542:21;62528:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;62528:36:0;;62507:57;;62607:21;62593:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;62593:36:0;;62571:58;;62641:9;62636:634;62660:21;62656:1;:25;62636:634;;;62719:18;62748:29;62788:26;62825:23;62859:22;62892:23;62927:17;62945:1;62927:20;;;;;;;;;;;;;;;;;;;;;;;;;:33;;;:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;62697:265;;;;;;;;;;;;;62991:10;62971:14;62986:1;62971:17;;;;;;;;;;;;;:30;;;;;63041:21;63010:25;63036:1;63010:28;;;;;;;;;;;;;:52;;;;;63099:18;63071:22;63094:1;63071:25;;;;;;;;;;;;;:46;;;;;63151:15;63126:19;63146:1;63126:22;;;;;;;;;;;;;:40;;;;;63199:14;63175:18;63194:1;63175:21;;;;;;;;;;;;;:38;;;;;;;;;;;63247:15;63222:19;63242:1;63222:22;;;;;;;;:40;;;;:22;;;;;;;;;;;:40;-1:-1:-1;;62683:3:0;;;;;-1:-1:-1;62636:634:0;;-1:-1:-1;;;62636:634:0;;;61814:1461;;;;;;;:::o;61584:224::-;61658:35;61695:20;61748:19;61727:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;61789:13;61774:28;;61584:224;;:::o;61406:172::-;61489:47;61555:17;61548:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;61406:172;:::o;57615:250::-;57656:8;;;;57655:9;57647:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;57702:9;57697:139;57721:17;:24;57717:28;;57697:139;;;57809:4;57769:45;;:17;57787:1;57769:20;;;;;;;;;;;;;;;;;;;:28;;;;;;;;:20;;;;;:26;;:28;;;;;;;;;;:20;:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;57769:28:0;:45;;;57761:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;57747:3;;57697:139;;;-1:-1:-1;57844:8:0;:15;;;;57855:4;57844:15;;;57615:250::o;60474:345::-;57501:8;;60536:17;;57501:8;;57493:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60567:9:::1;60562:158;60586:17;:24:::0;60582:28;::::1;60562:158;;;60638:74;60652:17;60670:1;60652:20;;;;;;;;;::::0;;;::::1;::::0;;;;;::::1;::::0;:59:::1;::::0;;;;;60700:10:::1;60652:59;::::0;::::1;::::0;;;:20:::1;::::0;;::::1;::::0;:47:::1;::::0;:59;;;;;:20;;:59;;;;;;;;;;:20;:59;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;60652:59:0;60638:9;;:13:::1;:74::i;:::-;60626:86:::0;-1:-1:-1;60612:3:0::1;;60562:158;;;-1:-1:-1::0;60732:14:0;;60728:86:::1;;60757:49;:26;:13;:26;60784:10;60796:9:::0;60757:26:::1;:49::i;968:181::-:0;1026:7;1058:5;;;1082:6;;;;1074:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1140:1;968:181;-1:-1:-1;;;968:181:0:o;15064:177::-;15174:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15197:23;15174:58;;;15147:86;;15167:5;;15147:19;:86::i;:::-;15064:177;;;:::o;15249:205::-;15377:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15400:27;15377:68;;;15350:96;;15370:5;;15350:19;:96::i;:::-;15249:205;;;;:::o;17369:761::-;17793:23;17819:69;17847:4;17819:69;;;;;;;;;;;;;;;;;17827:5;17819:27;;;;:69;;;;;:::i;:::-;17903:17;;17793:95;;-1:-1:-1;17903:21:0;17899:224;;18045:10;18034:30;;;;;;;;;;;;;;;-1:-1:-1;18034:30:0;18026:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12066:196;12169:12;12201:53;12224:6;12232:4;12238:1;12241:12;12201:22;:53::i;:::-;12194:60;12066:196;-1:-1:-1;;;;12066:196:0:o;13443:979::-;13573:12;13606:18;13617:6;13606:10;:18::i;:::-;13598:60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13732:12;13746:23;13773:6;:11;;13793:8;13804:4;13773:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13731:78;;;;13824:7;13820:595;;;13855:10;-1:-1:-1;13848:17:0;;-1:-1:-1;13848:17:0;13820:595;13969:17;;:21;13965:439;;14232:10;14226:17;14293:15;14280:10;14276:2;14272:19;14265:44;14180:148;14375:12;14368:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8951:619;9011:4;9479:20;;9322:66;9519:23;;;;;;:42;;-1:-1:-1;;9546:15:0;;;9511:51;-1:-1:-1;;8951:619:0:o
Swarm Source
ipfs://d5d53887da739289cfd6e78c2701a56db1f7e189075fecb84f093994f102a421
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.225823 | 341,025.7942 | $77,011.3 |
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.