Source Code
Multichain Info
Latest 24 from a total of 24 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Set Tokens Per I... | 55897202 | 18 days ago | IN | 0 CELO | 0.00210314 | ||||
| Set Tokens Per I... | 55897023 | 18 days ago | IN | 0 CELO | 0.00210314 | ||||
| Set Tokens Per I... | 32679340 | 287 days ago | IN | 0 CELO | 0.00223677 | ||||
| Set Tokens Per I... | 32679158 | 287 days ago | IN | 0 CELO | 0.00210344 | ||||
| Set Tokens Per I... | 30135863 | 359 days ago | IN | 0 CELO | 0.00084134 | ||||
| Set Tokens Per I... | 30065235 | 363 days ago | IN | 0 CELO | 0.00084134 | ||||
| Set Tokens Per I... | 29732290 | 382 days ago | IN | 0 CELO | 0.00081334 | ||||
| Set Tokens Per I... | 29094887 | 419 days ago | IN | 0 CELO | 0.00084134 | ||||
| Set Tokens Per I... | 28162288 | 473 days ago | IN | 0 CELO | 0.00084122 | ||||
| Set Tokens Per I... | 25931750 | 602 days ago | IN | 0 CELO | 0.0008411 | ||||
| Set Tokens Per I... | 24839424 | 665 days ago | IN | 0 CELO | 0.00084122 | ||||
| Set Tokens Per I... | 22087524 | 825 days ago | IN | 0 CELO | 0.00114623 | ||||
| Set Tokens Per I... | 21941706 | 833 days ago | IN | 0 CELO | 0.00114623 | ||||
| Set Tokens Per I... | 21806214 | 841 days ago | IN | 0 CELO | 0.00117423 | ||||
| Set Tokens Per I... | 21682447 | 848 days ago | IN | 0 CELO | 0.00117423 | ||||
| Set Tokens Per I... | 21560447 | 855 days ago | IN | 0 CELO | 0.00080211 | ||||
| Set Tokens Per I... | 21428318 | 863 days ago | IN | 0 CELO | 0.00200527 | ||||
| Set Tokens Per I... | 21300774 | 870 days ago | IN | 0 CELO | 0.00210777 | ||||
| Set Tokens Per I... | 21184827 | 877 days ago | IN | 0 CELO | 0.00200557 | ||||
| Set Tokens Per I... | 21061731 | 884 days ago | IN | 0 CELO | 0.00210807 | ||||
| Set Tokens Per I... | 20939197 | 891 days ago | IN | 0 CELO | 0.00200557 | ||||
| Set Tokens Per I... | 20816818 | 898 days ago | IN | 0 CELO | 0.00210807 | ||||
| Set Tokens Per I... | 20572370 | 912 days ago | IN | 0 CELO | 0.00063251 | ||||
| Set Tokens Per I... | 19937892 | 949 days ago | IN | 0 CELO | 0.00134475 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
FeeRewardDistributor
Compiler Version
v0.8.18+commit.87f61d96
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IAccessControl} from "../interfaces/IAccessControl.sol";
import {IRewardTracker} from "../interfaces/IRewardTracker.sol";
import {IRewardDistributor} from "../interfaces/IRewardDistributor.sol";
contract FeeRewardDistributor is IRewardDistributor {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IAccessControl public immutable accessControl;
address public override rewardToken;
address public rewardTracker;
uint256 public override tokensPerInterval;
uint256 public lastDistributionTime;
event Distribute(uint256 amount);
event TokensPerIntervalChange(uint256 amount);
modifier onlyGovernor() {
accessControl.validateGovernor(msg.sender);
_;
}
constructor(address _accessControl, address _rewardToken, address _rewardTracker) {
accessControl = IAccessControl(_accessControl);
rewardToken = _rewardToken;
rewardTracker = _rewardTracker;
lastDistributionTime = block.timestamp;
}
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, "FRDistributor: !rewardTracker");
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;
}
function updateLastDistributionTime() external onlyGovernor {
lastDistributionTime = block.timestamp;
}
function setTokensPerInterval(uint256 _amount) external onlyGovernor {
require(lastDistributionTime != 0, "FRDistributor: invalid lastDistributionTime");
IRewardTracker(rewardTracker).updateRewards();
tokensPerInterval = _amount;
emit TokensPerIntervalChange(_amount);
}
// to help users who accidentally send their tokens to this contract
function withdrawToken(address _token, address _account, uint256 _amount) external onlyGovernor {
IERC20(_token).safeTransfer(_account, _amount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 (last updated v4.9.0) (token/ERC20/extensions/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.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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 (last updated v4.9.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
pragma solidity ^0.8.0;
interface IAccessControl {
function validateGovernor(address addr) external view;
function validateMarketOrderKeeper(address addr) external view;
function validateTriggerOrderKeeper(address addr) external view;
function validateLiquidationKeeper(address addr) external view;
function validateReferralAdmin(address addr) external view;
function validateGuardian(address addr) external view;
function validateAdmin(address addr) external view;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
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: MIT
pragma solidity ^0.8.0;
interface IRewardTracker {
function depositBalances(address _account, address _depositToken) external view returns (uint256);
function stakedAmounts(address _account) external view returns (uint256);
function updateRewards() external;
function stakeForAccount(
address _fundingAccount,
address _account,
address _depositToken,
uint256 _amount
) external;
function unstakeForAccount(address _account, address _depositToken, uint256 _amount, address _receiver) external;
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);
}{
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 800
},
"remappings": [
":ds-test/=lib/forge-std/lib/ds-test/src/",
":forge-std/=lib/forge-std/src/"
],
"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":"_accessControl","type":"address"},{"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":"accessControl","outputs":[{"internalType":"contract IAccessControl","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distribute","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","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":"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
60a060405234801561001057600080fd5b50604051610b62380380610b6283398101604081905261002f91610085565b6001600160a01b03928316608052600080549284166001600160a01b031993841617905560018054919093169116179055426003556100c8565b80516001600160a01b038116811461008057600080fd5b919050565b60008060006060848603121561009a57600080fd5b6100a384610069565b92506100b160208501610069565b91506100bf60408501610069565b90509250925092565b608051610a6b6100f76000396000818160dd015281816101a20152818161023301526103ca0152610a6b6000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c806375b1735011610076578063e4fc6b6d1161005b578063e4fc6b6d1461016a578063eded3fda14610172578063f7c618c11461017a57600080fd5b806375b173501461014a578063a8d936271461016157600080fd5b806318e20a03116100a757806318e20a031461011c5780633ae6d6eb1461012f5780636bcb411a1461013757600080fd5b806301e33667146100c357806313007d55146100d8575b600080fd5b6100d66100d13660046108eb565b61018d565b005b6100ff7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d661012a366004610927565b61021e565b6100d66103b5565b6001546100ff906001600160a01b031681565b61015360035481565b604051908152602001610113565b61015360025481565b610153610432565b61015361057a565b6000546100ff906001600160a01b031681565b6040516304a0476560e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906312811d949060240160006040518083038186803b1580156101ec57600080fd5b505afa158015610200573d6000803e3d6000fd5b50610219925050506001600160a01b03841683836105b8565b505050565b6040516304a0476560e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906312811d949060240160006040518083038186803b15801561027d57600080fd5b505afa158015610291573d6000803e3d6000fd5b505050506003546000036103125760405162461bcd60e51b815260206004820152602b60248201527f46524469737472696275746f723a20696e76616c6964206c617374446973747260448201527f69627574696f6e54696d6500000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600160009054906101000a90046001600160a01b03166001600160a01b0316633e158b0c6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561036257600080fd5b505af1158015610376573d6000803e3d6000fd5b5050506002829055506040518181527f98dc76c39aa5a5dcb749f8750a65db3dfa1e14bcc1591a9c16a7420e5da748f89060200160405180910390a150565b6040516304a0476560e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906312811d949060240160006040518083038186803b15801561041457600080fd5b505afa158015610428573d6000803e3d6000fd5b5050426003555050565b6001546000906001600160a01b0316331461048f5760405162461bcd60e51b815260206004820152601d60248201527f46524469737472696275746f723a2021726577617264547261636b65720000006044820152606401610309565b600061049961057a565b9050806000036104ab57600091505090565b42600355600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156104f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190610940565b90508082111561052a578091505b600054610541906001600160a01b031633846105b8565b6040518281527f4def474aca53bf221d07d9ab0f675b3f6d8d2494b8427271bcf43c018ef1eead9060200160405180910390a150919050565b6000600354420361058b5750600090565b60006105a26003544261061f90919063ffffffff16565b6002549091506105b29082610634565b91505090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052610219908490610640565b600061062b828461096f565b90505b92915050565b600061062b8284610982565b6000610695826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107289092919063ffffffff16565b90508051600014806106b65750808060200190518101906106b69190610999565b6102195760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610309565b6060610737848460008561073f565b949350505050565b6060824710156107b75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610309565b600080866001600160a01b031685876040516107d391906109e6565b60006040518083038185875af1925050503d8060008114610810576040519150601f19603f3d011682016040523d82523d6000602084013e610815565b606091505b509150915061082687838387610831565b979650505050505050565b606083156108a0578251600003610899576001600160a01b0385163b6108995760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610309565b5081610737565b61073783838151156108b55781518083602001fd5b8060405162461bcd60e51b81526004016103099190610a02565b80356001600160a01b03811681146108e657600080fd5b919050565b60008060006060848603121561090057600080fd5b610909846108cf565b9250610917602085016108cf565b9150604084013590509250925092565b60006020828403121561093957600080fd5b5035919050565b60006020828403121561095257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561062e5761062e610959565b808202811582820484141761062e5761062e610959565b6000602082840312156109ab57600080fd5b815180151581146109bb57600080fd5b9392505050565b60005b838110156109dd5781810151838201526020016109c5565b50506000910152565b600082516109f88184602087016109c2565b9190910192915050565b6020815260008251806020840152610a218160408501602087016109c2565b601f01601f1916919091016040019291505056fea2646970667358221220dd44c7f8928a38b4a2c45f92427c6a2e6bf0b99f6afd98a1c4c807e4f6e3312964736f6c63430008120033000000000000000000000000188b06710417757dc6b49a70bc0b23d65604a922000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a000000000000000000000000981cada0d62254c5244402eb39bd5e1a50a22468
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100be5760003560e01c806375b1735011610076578063e4fc6b6d1161005b578063e4fc6b6d1461016a578063eded3fda14610172578063f7c618c11461017a57600080fd5b806375b173501461014a578063a8d936271461016157600080fd5b806318e20a03116100a757806318e20a031461011c5780633ae6d6eb1461012f5780636bcb411a1461013757600080fd5b806301e33667146100c357806313007d55146100d8575b600080fd5b6100d66100d13660046108eb565b61018d565b005b6100ff7f000000000000000000000000188b06710417757dc6b49a70bc0b23d65604a92281565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d661012a366004610927565b61021e565b6100d66103b5565b6001546100ff906001600160a01b031681565b61015360035481565b604051908152602001610113565b61015360025481565b610153610432565b61015361057a565b6000546100ff906001600160a01b031681565b6040516304a0476560e21b81523360048201527f000000000000000000000000188b06710417757dc6b49a70bc0b23d65604a9226001600160a01b0316906312811d949060240160006040518083038186803b1580156101ec57600080fd5b505afa158015610200573d6000803e3d6000fd5b50610219925050506001600160a01b03841683836105b8565b505050565b6040516304a0476560e21b81523360048201527f000000000000000000000000188b06710417757dc6b49a70bc0b23d65604a9226001600160a01b0316906312811d949060240160006040518083038186803b15801561027d57600080fd5b505afa158015610291573d6000803e3d6000fd5b505050506003546000036103125760405162461bcd60e51b815260206004820152602b60248201527f46524469737472696275746f723a20696e76616c6964206c617374446973747260448201527f69627574696f6e54696d6500000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600160009054906101000a90046001600160a01b03166001600160a01b0316633e158b0c6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561036257600080fd5b505af1158015610376573d6000803e3d6000fd5b5050506002829055506040518181527f98dc76c39aa5a5dcb749f8750a65db3dfa1e14bcc1591a9c16a7420e5da748f89060200160405180910390a150565b6040516304a0476560e21b81523360048201527f000000000000000000000000188b06710417757dc6b49a70bc0b23d65604a9226001600160a01b0316906312811d949060240160006040518083038186803b15801561041457600080fd5b505afa158015610428573d6000803e3d6000fd5b5050426003555050565b6001546000906001600160a01b0316331461048f5760405162461bcd60e51b815260206004820152601d60248201527f46524469737472696275746f723a2021726577617264547261636b65720000006044820152606401610309565b600061049961057a565b9050806000036104ab57600091505090565b42600355600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156104f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190610940565b90508082111561052a578091505b600054610541906001600160a01b031633846105b8565b6040518281527f4def474aca53bf221d07d9ab0f675b3f6d8d2494b8427271bcf43c018ef1eead9060200160405180910390a150919050565b6000600354420361058b5750600090565b60006105a26003544261061f90919063ffffffff16565b6002549091506105b29082610634565b91505090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052610219908490610640565b600061062b828461096f565b90505b92915050565b600061062b8284610982565b6000610695826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107289092919063ffffffff16565b90508051600014806106b65750808060200190518101906106b69190610999565b6102195760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610309565b6060610737848460008561073f565b949350505050565b6060824710156107b75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610309565b600080866001600160a01b031685876040516107d391906109e6565b60006040518083038185875af1925050503d8060008114610810576040519150601f19603f3d011682016040523d82523d6000602084013e610815565b606091505b509150915061082687838387610831565b979650505050505050565b606083156108a0578251600003610899576001600160a01b0385163b6108995760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610309565b5081610737565b61073783838151156108b55781518083602001fd5b8060405162461bcd60e51b81526004016103099190610a02565b80356001600160a01b03811681146108e657600080fd5b919050565b60008060006060848603121561090057600080fd5b610909846108cf565b9250610917602085016108cf565b9150604084013590509250925092565b60006020828403121561093957600080fd5b5035919050565b60006020828403121561095257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561062e5761062e610959565b808202811582820484141761062e5761062e610959565b6000602082840312156109ab57600080fd5b815180151581146109bb57600080fd5b9392505050565b60005b838110156109dd5781810151838201526020016109c5565b50506000910152565b600082516109f88184602087016109c2565b9190910192915050565b6020815260008251806020840152610a218160408501602087016109c2565b601f01601f1916919091016040019291505056fea2646970667358221220dd44c7f8928a38b4a2c45f92427c6a2e6bf0b99f6afd98a1c4c807e4f6e3312964736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000188b06710417757dc6b49a70bc0b23d65604a922000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a000000000000000000000000981cada0d62254c5244402eb39bd5e1a50a22468
-----Decoded View---------------
Arg [0] : _accessControl (address): 0x188B06710417757Dc6B49a70bC0B23d65604A922
Arg [1] : _rewardToken (address): 0x765DE816845861e75A25fCA122bb6898B8B1282a
Arg [2] : _rewardTracker (address): 0x981caDA0d62254c5244402Eb39bd5E1A50a22468
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000188b06710417757dc6b49a70bc0b23d65604a922
Arg [1] : 000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a
Arg [2] : 000000000000000000000000981cada0d62254c5244402eb39bd5e1a50a22468
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.