Source Code
Latest 25 from a total of 173 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw Token | 237900105 | 471 days ago | IN | 0 ETH | 0.00000084 | ||||
| Set Tokens Per I... | 237898257 | 471 days ago | IN | 0 ETH | 0.00000102 | ||||
| Set Tokens Per I... | 235608900 | 477 days ago | IN | 0 ETH | 0.00000136 | ||||
| Update Last Dist... | 235608894 | 477 days ago | IN | 0 ETH | 0.00000065 | ||||
| Set Tokens Per I... | 233204047 | 484 days ago | IN | 0 ETH | 0.00000682 | ||||
| Update Last Dist... | 233204034 | 484 days ago | IN | 0 ETH | 0.00000293 | ||||
| Set Tokens Per I... | 230801373 | 491 days ago | IN | 0 ETH | 0.00000126 | ||||
| Update Last Dist... | 230801355 | 491 days ago | IN | 0 ETH | 0.00000057 | ||||
| Set Tokens Per I... | 228378301 | 498 days ago | IN | 0 ETH | 0.00000203 | ||||
| Update Last Dist... | 228378286 | 498 days ago | IN | 0 ETH | 0.00000114 | ||||
| Set Tokens Per I... | 225986336 | 505 days ago | IN | 0 ETH | 0.00000089 | ||||
| Update Last Dist... | 225986311 | 505 days ago | IN | 0 ETH | 0.00000028 | ||||
| Set Tokens Per I... | 223629863 | 512 days ago | IN | 0 ETH | 0.00000145 | ||||
| Update Last Dist... | 223629849 | 512 days ago | IN | 0 ETH | 0.00000072 | ||||
| Set Tokens Per I... | 223543395 | 512 days ago | IN | 0 ETH | 0.00000133 | ||||
| Update Last Dist... | 223543389 | 512 days ago | IN | 0 ETH | 0.00000062 | ||||
| Set Tokens Per I... | 221495734 | 518 days ago | IN | 0 ETH | 0.00000165 | ||||
| Update Last Dist... | 221495728 | 518 days ago | IN | 0 ETH | 0.00000088 | ||||
| Set Tokens Per I... | 218712980 | 526 days ago | IN | 0 ETH | 0.00000176 | ||||
| Update Last Dist... | 218712974 | 526 days ago | IN | 0 ETH | 0.00000097 | ||||
| Set Tokens Per I... | 216299561 | 533 days ago | IN | 0 ETH | 0.00000193 | ||||
| Update Last Dist... | 216299555 | 533 days ago | IN | 0 ETH | 0.00000101 | ||||
| Set Tokens Per I... | 213918417 | 540 days ago | IN | 0 ETH | 0.00000124 | ||||
| Update Last Dist... | 213918410 | 540 days ago | IN | 0 ETH | 0.00000056 | ||||
| Set Tokens Per I... | 213806577 | 541 days ago | IN | 0 ETH | 0.00000102 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 72083288 | 969 days ago | 0 ETH | ||||
| 72083288 | 969 days ago | 0 ETH | ||||
| 72083288 | 969 days ago | 0 ETH | ||||
| 72081232 | 969 days ago | 0 ETH | ||||
| 72081232 | 969 days ago | 0 ETH | ||||
| 72081232 | 969 days ago | 0 ETH | ||||
| 72079307 | 969 days ago | 0 ETH | ||||
| 72079307 | 969 days ago | 0 ETH | ||||
| 72079307 | 969 days ago | 0 ETH | ||||
| 72079307 | 969 days ago | 0 ETH | ||||
| 72077548 | 969 days ago | 0 ETH | ||||
| 72077548 | 969 days ago | 0 ETH | ||||
| 72077548 | 969 days ago | 0 ETH | ||||
| 72077006 | 969 days ago | 0 ETH | ||||
| 72077006 | 969 days ago | 0 ETH | ||||
| 72077006 | 969 days ago | 0 ETH | ||||
| 72071550 | 969 days ago | 0 ETH | ||||
| 72071550 | 969 days ago | 0 ETH | ||||
| 72071550 | 969 days ago | 0 ETH | ||||
| 72070904 | 969 days ago | 0 ETH | ||||
| 72070904 | 969 days ago | 0 ETH | ||||
| 72070904 | 969 days ago | 0 ETH | ||||
| 72069965 | 969 days ago | 0 ETH | ||||
| 72069965 | 969 days ago | 0 ETH | ||||
| 72069965 | 969 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
RewardDistributor
Compiler Version
v0.8.4+commit.c7e474f2
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
import "SafeMath.sol";
import "SafeERC20.sol";
import "ReentrancyGuard.sol";
import "IRewardDistributor.sol";
import "IRewardTracker.sol";
import "Governable.sol";
contract RewardDistributor is IRewardDistributor, ReentrancyGuard, Governable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address public override rewardToken;
uint256 public override tokensPerInterval;
uint256 public lastDistributionTime;
address public rewardTracker;
address public admin;
event Distribute(uint256 amount);
event TokensPerIntervalChange(uint256 amount);
modifier onlyAdmin() {
require(msg.sender == admin, "RewardDistributor: forbidden");
_;
}
constructor(address _rewardToken, address _rewardTracker) public {
rewardToken = _rewardToken;
rewardTracker = _rewardTracker;
admin = msg.sender;
}
function setAdmin(address _admin) external onlyGov {
admin = _admin;
}
// to help users who accidentally send their tokens to this contract
function withdrawToken(
address _token,
address _account,
uint256 _amount
) external onlyGov {
IERC20(_token).safeTransfer(_account, _amount);
}
function updateLastDistributionTime() external onlyAdmin {
lastDistributionTime = block.timestamp;
}
function setTokensPerInterval(uint256 _amount) external onlyAdmin {
require(
lastDistributionTime != 0,
"RewardDistributor: invalid lastDistributionTime"
);
IRewardTracker(rewardTracker).updateRewards();
tokensPerInterval = _amount;
emit TokensPerIntervalChange(_amount);
}
function pendingRewards() public view override returns (uint256) {
if (block.timestamp == lastDistributionTime) {
return 0;
}
uint256 timeDiff = block.timestamp.sub(lastDistributionTime);
return tokensPerInterval.mul(timeDiff);
}
function distribute() external override returns (uint256) {
require(
msg.sender == rewardTracker,
"RewardDistributor: invalid msg.sender"
);
uint256 amount = pendingRewards();
if (amount == 0) {
return 0;
}
lastDistributionTime = block.timestamp;
uint256 balance = IERC20(rewardToken).balanceOf(address(this));
if (amount > balance) {
amount = balance;
}
IERC20(rewardToken).safeTransfer(msg.sender, amount);
emit Distribute(amount);
return amount;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @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) {
return a + b;
}
/**
* @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 a - b;
}
/**
* @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) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting 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 a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting 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) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* 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) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "IERC20.sol";
import "draft-IERC20Permit.sol";
import "Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
interface IRewardDistributor {
function rewardToken() external view returns (address);
function tokensPerInterval() external view returns (uint256);
function pendingRewards() external view returns (uint256);
function distribute() external returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
interface IRewardTracker {
function depositBalances(address _account, address _depositToken)
external
view
returns (uint256);
function stakedAmounts(address _account) external view returns (uint256);
function updateRewards() external;
function stake(address _depositToken, uint256 _amount) external;
function stakeForAccount(
address _fundingAccount,
address _account,
address _depositToken,
uint256 _amount
) external;
function unstake(address _depositToken, uint256 _amount) external;
function unstakeForAccount(
address _account,
address _depositToken,
uint256 _amount,
address _receiver
) external;
function tokensPerInterval() external view returns (uint256);
function claim(address _receiver) external returns (uint256);
function claimForAccount(address _account, address _receiver)
external
returns (uint256);
function claimable(address _account) external view returns (uint256);
function averageStakedAmounts(address _account)
external
view
returns (uint256);
function cumulativeRewards(address _account)
external
view
returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
contract Governable {
address public gov;
constructor() {
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "Governable: forbidden");
_;
}
function setGov(address _gov) external onlyGov {
gov = _gov;
}
}{
"evmVersion": "istanbul",
"optimizer": {
"enabled": true,
"runs": 1
},
"libraries": {
"RewardDistributor.sol": {}
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_rewardTracker","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Distribute","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensPerIntervalChange","type":"event"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distribute","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastDistributionTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardTracker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gov","type":"address"}],"name":"setGov","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setTokensPerInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokensPerInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateLastDistributionTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b50604051610b68380380610b6883398101604081905261002f9161009c565b600160008190558054336001600160a01b031991821681179092556002805482166001600160a01b0395861617905560058054821693909416929092179092556006805490911690911790556100ce565b80516001600160a01b038116811461009757600080fd5b919050565b600080604083850312156100ae578182fd5b6100b783610080565b91506100c560208401610080565b90509250929050565b610a8b806100dd6000396000f3fe608060405234801561001057600080fd5b50600436106100af5760003560e01c806301e33667146100b457806312d43a51146100c957806318e20a03146100f25780633ae6d6eb146101055780636bcb411a1461010d578063704b6c021461012057806375b1735014610133578063a8d936271461014a578063cfad57a214610153578063e4fc6b6d14610166578063eded3fda1461016e578063f7c618c114610176578063f851a44014610189575b600080fd5b6100c76100c2366004610886565b61019c565b005b6001546100dc906001600160a01b031681565b6040516100e9919061092d565b60405180910390f35b6100c76101003660046108e1565b6101e8565b6100c761031c565b6005546100dc906001600160a01b031681565b6100c761012e36600461086c565b61034c565b61013c60045481565b6040519081526020016100e9565b61013c60035481565b6100c761016136600461086c565b610398565b61013c6103e4565b61013c61054d565b6002546100dc906001600160a01b031681565b6006546100dc906001600160a01b031681565b6001546001600160a01b031633146101cf5760405162461bcd60e51b81526004016101c6906109aa565b60405180910390fd5b6101e36001600160a01b038416838361058c565b505050565b6006546001600160a01b031633146102125760405162461bcd60e51b81526004016101c690610974565b6004546102795760405162461bcd60e51b815260206004820152602f60248201527f5265776172644469737472696275746f723a20696e76616c6964206c6173744460448201526e6973747269627574696f6e54696d6560881b60648201526084016101c6565b600560009054906101000a90046001600160a01b03166001600160a01b0316633e158b0c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b5050506003829055506040518181527f98dc76c39aa5a5dcb749f8750a65db3dfa1e14bcc1591a9c16a7420e5da748f89060200160405180910390a150565b6006546001600160a01b031633146103465760405162461bcd60e51b81526004016101c690610974565b42600455565b6001546001600160a01b031633146103765760405162461bcd60e51b81526004016101c6906109aa565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146103c25760405162461bcd60e51b81526004016101c6906109aa565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6005546000906001600160a01b0316331461044f5760405162461bcd60e51b815260206004820152602560248201527f5265776172644469737472696275746f723a20696e76616c6964206d73672e7360448201526432b73232b960d91b60648201526084016101c6565b600061045961054d565b90508061046857600091505090565b4260049081556002546040516370a0823160e01b81526000926001600160a01b03909216916370a082319161049f9130910161092d565b60206040518083038186803b1580156104b757600080fd5b505afa1580156104cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ef91906108f9565b9050808211156104fd578091505b600254610514906001600160a01b0316338461058c565b6040518281527f4def474aca53bf221d07d9ab0f675b3f6d8d2494b8427271bcf43c018ef1eead9060200160405180910390a150919050565b600060045442141561055f5750600090565b6000610576600454426105de90919063ffffffff16565b60035490915061058690826105f1565b91505090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526101e39084906105fd565b60006105ea82846109f8565b9392505050565b60006105ea82846109d9565b6000610652826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106cf9092919063ffffffff16565b8051909150156101e3578080602001905181019061067091906108c1565b6101e35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101c6565b60606106de84846000856106e6565b949350505050565b6060824710156107475760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101c6565b6001600160a01b0385163b61079e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101c6565b600080866001600160a01b031685876040516107ba9190610911565b60006040518083038185875af1925050503d80600081146107f7576040519150601f19603f3d011682016040523d82523d6000602084013e6107fc565b606091505b509150915061080c828286610817565b979650505050505050565b606083156108265750816105ea565b8251156108365782518084602001fd5b8160405162461bcd60e51b81526004016101c69190610941565b80356001600160a01b038116811461086757600080fd5b919050565b60006020828403121561087d578081fd5b6105ea82610850565b60008060006060848603121561089a578182fd5b6108a384610850565b92506108b160208501610850565b9150604084013590509250925092565b6000602082840312156108d2578081fd5b815180151581146105ea578182fd5b6000602082840312156108f2578081fd5b5035919050565b60006020828403121561090a578081fd5b5051919050565b60008251610923818460208701610a0f565b9190910192915050565b6001600160a01b0391909116815260200190565b6020815260008251806020840152610960816040850160208701610a0f565b601f01601f19169190910160400192915050565b6020808252601c908201527b2932bbb0b9322234b9ba3934b13aba37b91d103337b93134b23232b760211b604082015260600190565b60208082526015908201527423b7bb32b93730b136329d103337b93134b23232b760591b604082015260600190565b60008160001904831182151516156109f3576109f3610a3f565b500290565b600082821015610a0a57610a0a610a3f565b500390565b60005b83811015610a2a578181015183820152602001610a12565b83811115610a39576000848401525b50505050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212204f4c7b94678b2a2d7d6fa5257b96ad3ff508cc0b652092961e12b44da51bfa6164736f6c63430008040033000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8000000000000000000000000ccfd47ccabbf058fb5566cc31b552b21279bd89a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100af5760003560e01c806301e33667146100b457806312d43a51146100c957806318e20a03146100f25780633ae6d6eb146101055780636bcb411a1461010d578063704b6c021461012057806375b1735014610133578063a8d936271461014a578063cfad57a214610153578063e4fc6b6d14610166578063eded3fda1461016e578063f7c618c114610176578063f851a44014610189575b600080fd5b6100c76100c2366004610886565b61019c565b005b6001546100dc906001600160a01b031681565b6040516100e9919061092d565b60405180910390f35b6100c76101003660046108e1565b6101e8565b6100c761031c565b6005546100dc906001600160a01b031681565b6100c761012e36600461086c565b61034c565b61013c60045481565b6040519081526020016100e9565b61013c60035481565b6100c761016136600461086c565b610398565b61013c6103e4565b61013c61054d565b6002546100dc906001600160a01b031681565b6006546100dc906001600160a01b031681565b6001546001600160a01b031633146101cf5760405162461bcd60e51b81526004016101c6906109aa565b60405180910390fd5b6101e36001600160a01b038416838361058c565b505050565b6006546001600160a01b031633146102125760405162461bcd60e51b81526004016101c690610974565b6004546102795760405162461bcd60e51b815260206004820152602f60248201527f5265776172644469737472696275746f723a20696e76616c6964206c6173744460448201526e6973747269627574696f6e54696d6560881b60648201526084016101c6565b600560009054906101000a90046001600160a01b03166001600160a01b0316633e158b0c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b5050506003829055506040518181527f98dc76c39aa5a5dcb749f8750a65db3dfa1e14bcc1591a9c16a7420e5da748f89060200160405180910390a150565b6006546001600160a01b031633146103465760405162461bcd60e51b81526004016101c690610974565b42600455565b6001546001600160a01b031633146103765760405162461bcd60e51b81526004016101c6906109aa565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146103c25760405162461bcd60e51b81526004016101c6906109aa565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6005546000906001600160a01b0316331461044f5760405162461bcd60e51b815260206004820152602560248201527f5265776172644469737472696275746f723a20696e76616c6964206d73672e7360448201526432b73232b960d91b60648201526084016101c6565b600061045961054d565b90508061046857600091505090565b4260049081556002546040516370a0823160e01b81526000926001600160a01b03909216916370a082319161049f9130910161092d565b60206040518083038186803b1580156104b757600080fd5b505afa1580156104cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ef91906108f9565b9050808211156104fd578091505b600254610514906001600160a01b0316338461058c565b6040518281527f4def474aca53bf221d07d9ab0f675b3f6d8d2494b8427271bcf43c018ef1eead9060200160405180910390a150919050565b600060045442141561055f5750600090565b6000610576600454426105de90919063ffffffff16565b60035490915061058690826105f1565b91505090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526101e39084906105fd565b60006105ea82846109f8565b9392505050565b60006105ea82846109d9565b6000610652826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106cf9092919063ffffffff16565b8051909150156101e3578080602001905181019061067091906108c1565b6101e35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101c6565b60606106de84846000856106e6565b949350505050565b6060824710156107475760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101c6565b6001600160a01b0385163b61079e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101c6565b600080866001600160a01b031685876040516107ba9190610911565b60006040518083038185875af1925050503d80600081146107f7576040519150601f19603f3d011682016040523d82523d6000602084013e6107fc565b606091505b509150915061080c828286610817565b979650505050505050565b606083156108265750816105ea565b8251156108365782518084602001fd5b8160405162461bcd60e51b81526004016101c69190610941565b80356001600160a01b038116811461086757600080fd5b919050565b60006020828403121561087d578081fd5b6105ea82610850565b60008060006060848603121561089a578182fd5b6108a384610850565b92506108b160208501610850565b9150604084013590509250925092565b6000602082840312156108d2578081fd5b815180151581146105ea578182fd5b6000602082840312156108f2578081fd5b5035919050565b60006020828403121561090a578081fd5b5051919050565b60008251610923818460208701610a0f565b9190910192915050565b6001600160a01b0391909116815260200190565b6020815260008251806020840152610960816040850160208701610a0f565b601f01601f19169190910160400192915050565b6020808252601c908201527b2932bbb0b9322234b9ba3934b13aba37b91d103337b93134b23232b760211b604082015260600190565b60208082526015908201527423b7bb32b93730b136329d103337b93134b23232b760591b604082015260600190565b60008160001904831182151516156109f3576109f3610a3f565b500290565b600082821015610a0a57610a0a610a3f565b500390565b60005b83811015610a2a578181015183820152602001610a12565b83811115610a39576000848401525b50505050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212204f4c7b94678b2a2d7d6fa5257b96ad3ff508cc0b652092961e12b44da51bfa6164736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8000000000000000000000000ccfd47ccabbf058fb5566cc31b552b21279bd89a
-----Decoded View---------------
Arg [0] : _rewardToken (address): 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8
Arg [1] : _rewardTracker (address): 0xCCFd47cCabbF058Fb5566CC31b552b21279bd89a
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8
Arg [1] : 000000000000000000000000ccfd47ccabbf058fb5566cc31b552b21279bd89a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.