Feature Tip: Add private address tag to any address under My Name Tag !
More Info
[ Download CSV Export ]
OVERVIEW
Allows anyone to distribute rewards to the AuraLocker at a given epoch.
View more zero value Internal Transactions in Advanced View mode
Contract Name:
ExtraRewardsDistributor
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import { IExtraRewardsDistributor, IAuraLocker } from "./Interfaces.sol"; import { IERC20 } from "@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol"; import { Ownable } from "@openzeppelin/contracts-0.8/access/Ownable.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol"; /** * @title ExtraRewardsDistributor * @author adapted from ConvexFinance * @notice Allows anyone to distribute rewards to the AuraLocker at a given epoch. */ contract ExtraRewardsDistributor is ReentrancyGuard, IExtraRewardsDistributor, Ownable { using SafeERC20 for IERC20; IAuraLocker public immutable auraLocker; // user -> canAdd mapping(address => bool) public canAddReward; // token -> epoch -> amount mapping(address => mapping(uint256 => uint256)) public rewardData; // token -> epochList mapping(address => uint256[]) public rewardEpochs; // token -> account -> last claimed epoch index mapping(address => mapping(address => uint256)) public userClaims; /* ========== EVENTS ========== */ event WhitelistModified(address user, bool canAdd); event RewardAdded(address indexed token, uint256 indexed epoch, uint256 reward); event RewardPaid(address indexed user, address indexed token, uint256 reward, uint256 index); event RewardForfeited(address indexed user, address indexed token, uint256 index); /** * @dev Simple constructoor * @param _auraLocker Aura Locker address */ constructor(address _auraLocker) Ownable() { auraLocker = IAuraLocker(_auraLocker); } /* ========== ADD WHITELIST ========== */ function modifyWhitelist(address _depositor, bool _canAdd) external onlyOwner { canAddReward[_depositor] = _canAdd; emit WhitelistModified(_depositor, _canAdd); } /* ========== ADD REWARDS ========== */ /** * @notice Add a reward to the current epoch. can be called multiple times for the same reward token * @param _token Reward token address * @param _amount Amount of reward tokenπ */ function addReward(address _token, uint256 _amount) external { auraLocker.checkpointEpoch(); uint256 latestEpoch = auraLocker.epochCount() - 1; _addReward(_token, _amount, latestEpoch); } /** * @notice Add reward token to a specific epoch * @param _token Reward token address * @param _amount Amount of reward tokens to add * @param _epoch Which epoch to add to (must be less than the previous epoch) */ function addRewardToEpoch( address _token, uint256 _amount, uint256 _epoch ) external { auraLocker.checkpointEpoch(); uint256 latestEpoch = auraLocker.epochCount() - 1; require(_epoch <= latestEpoch, "Cannot assign to the future"); if (_epoch == latestEpoch) { _addReward(_token, _amount, latestEpoch); } else { uint256 len = rewardEpochs[_token].length; require(len == 0 || rewardEpochs[_token][len - 1] < _epoch, "Cannot backdate to this epoch"); _addReward(_token, _amount, _epoch); } } /** * @notice Transfer reward tokens from sender to contract for vlCVX holders * @dev Add reward token for specific epoch * @param _token Reward token address * @param _amount Amount of reward tokens * @param _epoch Epoch to add tokens to */ function _addReward( address _token, uint256 _amount, uint256 _epoch ) internal nonReentrant { require(canAddReward[msg.sender], "!auth"); require(_amount > 0, "!amount"); // Pull before reward accrual IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); //convert to reward per token uint256 supply = auraLocker.totalSupplyAtEpoch(_epoch); uint256 rPerT = (_amount * 1e20) / supply; rewardData[_token][_epoch] += rPerT; //add epoch to list uint256 len = rewardEpochs[_token].length; if (len == 0 || rewardEpochs[_token][len - 1] < _epoch) { rewardEpochs[_token].push(_epoch); } //event emit RewardAdded(_token, _epoch, _amount); } /* ========== GET REWARDS ========== */ /** * @notice Claim rewards for a specific token since the first epoch. * @param _account Address of vlCVX holder * @param _token Reward token address */ function getReward(address _account, address _token) public { _getReward(_account, _token, 0); } /** * @notice Claim rewards for a specific token at a specific epoch * @param _token Reward token address * @param _startIndex Index of rewardEpochs[_token] to start checking for rewards from */ function getReward(address _token, uint256 _startIndex) public { _getReward(msg.sender, _token, _startIndex); } /** * @notice Claim rewards for a specific token at a specific epoch * @param _account Address of vlCVX holder * @param _token Reward token address * @param _startIndex Index of rewardEpochs[_token] to start checking for rewards from */ function _getReward( address _account, address _token, uint256 _startIndex ) internal nonReentrant { //get claimable tokens (uint256 claimableTokens, uint256 index) = _allClaimableRewards(_account, _token, _startIndex); if (claimableTokens > 0) { //set claim checkpoint userClaims[_token][_account] = index; //send IERC20(_token).safeTransfer(_account, claimableTokens); //event emit RewardPaid(_account, _token, claimableTokens, index); } } /** * @notice Allow a user to set their claimed index forward without claiming rewards * Because claims cycle through all periods that a specific reward was given * there becomes a situation where, for example, a new user could lock * 2 years from now and try to claim a token that was given out every week prior. * This would result in a 2mil gas checkpoint.(about 20k gas * 52 weeks * 2 years) * @param _token Reward token to forfeit * @param _index Epoch index to forfeit from */ function forfeitRewards(address _token, uint256 _index) external { require(_index > 0 && _index < rewardEpochs[_token].length - 1, "!past"); require(_index >= userClaims[_token][msg.sender], "already claimed"); //set claim checkpoint. next claim starts from index+1 userClaims[_token][msg.sender] = _index + 1; emit RewardForfeited(msg.sender, _token, _index); } /* ========== VIEW REWARDS ========== */ /** * @notice Get claimable rewards (rewardToken) for vlCVX holder * @param _account Address of vlCVX holder * @param _token Reward token address */ function claimableRewards(address _account, address _token) external view returns (uint256) { (uint256 rewards, ) = _allClaimableRewards(_account, _token, 0); return rewards; } /** * @notice Get claimable rewards for a token at a specific epoch * @param _account Address of vlCVX holder * @param _token Reward token address * @param _epoch The epoch to check for rewards */ function claimableRewardsAtEpoch( address _account, address _token, uint256 _epoch ) external view returns (uint256) { return _claimableRewards(_account, _token, _epoch); } /** * @notice Get all claimable rewards by looping through each epoch starting with the latest * saved epoch the user last claimed from * @param _account Address of vlCVX holder * @param _token Reward token * @param _startIndex Index of rewardEpochs[_token] to start checking for rewards from */ function _allClaimableRewards( address _account, address _token, uint256 _startIndex ) internal view returns (uint256, uint256) { uint256 latestEpoch = auraLocker.epochCount() - 1; // e.g. tokenEpochs = 31, 21 uint256 tokenEpochs = rewardEpochs[_token].length; // e.g. epochIndex = 0 uint256 epochIndex = userClaims[_token][_account]; // e.g. epochIndex = 27 > 0 ? 27 : 0 = 27 epochIndex = _startIndex > epochIndex ? _startIndex : epochIndex; if (epochIndex >= tokenEpochs) { return (0, tokenEpochs); } uint256 claimableTokens = 0; for (uint256 i = epochIndex; i < tokenEpochs; i++) { //only claimable after rewards are "locked in" if (rewardEpochs[_token][i] < latestEpoch) { claimableTokens += _claimableRewards(_account, _token, rewardEpochs[_token][i]); //return index user claims should be set to epochIndex = i + 1; } } return (claimableTokens, epochIndex); } /** * @notice Get claimable rewards for a token at a specific epoch * @param _account Address of vlCVX holder * @param _token Reward token address * @param _epoch The epoch to check for rewards */ function _claimableRewards( address _account, address _token, uint256 _epoch ) internal view returns (uint256) { //get balance and calc share uint256 balance = auraLocker.balanceAtEpochOf(_epoch, _account); return (balance * rewardData[_token][_epoch]) / 1e20; } /** * @notice Simply gets the current epoch count for a given reward token * @param _token Reward token address * @return _epochs Number of epochs */ function rewardEpochsCount(address _token) external view returns (uint256) { return rewardEpochs[_token].length; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; interface IPriceOracle { struct OracleAverageQuery { Variable variable; uint256 secs; uint256 ago; } enum Variable { PAIR_PRICE, BPT_PRICE, INVARIANT } function getTimeWeightedAverage(OracleAverageQuery[] memory queries) external view returns (uint256[] memory results); } interface IVault { enum PoolSpecialization { GENERAL, MINIMAL_SWAP_INFO, TWO_TOKEN } enum JoinKind { INIT, EXACT_TOKENS_IN_FOR_BPT_OUT, TOKEN_IN_FOR_EXACT_BPT_OUT, ALL_TOKENS_IN_FOR_EXACT_BPT_OUT } enum SwapKind { GIVEN_IN, GIVEN_OUT } struct SingleSwap { bytes32 poolId; SwapKind kind; IAsset assetIn; IAsset assetOut; uint256 amount; bytes userData; } struct FundManagement { address sender; bool fromInternalBalance; address payable recipient; bool toInternalBalance; } struct JoinPoolRequest { IAsset[] assets; uint256[] maxAmountsIn; bytes userData; bool fromInternalBalance; } function getPool(bytes32 poolId) external view returns (address, PoolSpecialization); function getPoolTokens(bytes32 poolId) external view returns ( address[] memory tokens, uint256[] memory balances, uint256 lastChangeBlock ); function joinPool( bytes32 poolId, address sender, address recipient, JoinPoolRequest memory request ) external payable; function swap( SingleSwap memory singleSwap, FundManagement memory funds, uint256 limit, uint256 deadline ) external returns (uint256 amountCalculated); function exitPool( bytes32 poolId, address sender, address payable recipient, ExitPoolRequest memory request ) external; struct ExitPoolRequest { IAsset[] assets; uint256[] minAmountsOut; bytes userData; bool toInternalBalance; } enum ExitKind { EXACT_BPT_IN_FOR_ONE_TOKEN_OUT, EXACT_BPT_IN_FOR_TOKENS_OUT, BPT_IN_FOR_EXACT_TOKENS_OUT, MANAGEMENT_FEE_TOKENS_OUT // for ManagedPool } } interface IAsset { // solhint-disable-previous-line no-empty-blocks } interface IAuraLocker { function lock(address _account, uint256 _amount) external; function checkpointEpoch() external; function epochCount() external view returns (uint256); function balanceAtEpochOf(uint256 _epoch, address _user) external view returns (uint256 amount); function totalSupplyAtEpoch(uint256 _epoch) external view returns (uint256 supply); function queueNewRewards(address _rewardsToken, uint256 reward) external; function getReward(address _account, bool _stake) external; function getReward(address _account) external; } interface IExtraRewardsDistributor { function addReward(address _token, uint256 _amount) external; } interface ICrvDepositorWrapper { function getMinOut(uint256, uint256) external view returns (uint256); function deposit( uint256, uint256, bool, address _stakeAddress ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.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; 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)); } } /** * @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 v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// 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: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 800 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_auraLocker","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"RewardForfeited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bool","name":"canAdd","type":"bool"}],"name":"WhitelistModified","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_epoch","type":"uint256"}],"name":"addRewardToEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"auraLocker","outputs":[{"internalType":"contract IAuraLocker","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"canAddReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"claimableRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_epoch","type":"uint256"}],"name":"claimableRewardsAtEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"forfeitRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_startIndex","type":"uint256"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_depositor","type":"address"},{"internalType":"bool","name":"_canAdd","type":"bool"}],"name":"modifyWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardData","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardEpochs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"rewardEpochsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userClaims","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a060405234801561001057600080fd5b506040516117bb3803806117bb83398101604081905261002f916100a0565b600160005561003d3361004e565b6001600160a01b03166080526100d0565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156100b257600080fd5b81516001600160a01b03811681146100c957600080fd5b9392505050565b60805161169f61011c600039600081816102b10152818161052201528181610599015281816108270152818161089e01528181610b5c01528181610d3e0152610f0b015261169f6000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c80636be9dcce116100b25780639feb8f5011610081578063d661448711610066578063d6614487146102ac578063f2fde38b146102d3578063f474c8ce146102e657600080fd5b80639feb8f5014610270578063d527f4b91461028357600080fd5b80636be9dcce146101fd578063715018a6146102105780638da5cb5b146102185780639da65d951461023d57600080fd5b806338174862116100ee5780633817486214610181578063408ad08b146101ac57806361544f60146101d75780636b091695146101ea57600080fd5b8063060d206e14610120578063221edb3b1461013557806329919002146101485780632fae1e141461015b575b600080fd5b61013361012e36600461140c565b6102f9565b005b610133610143366004611443565b6103bb565b61013361015636600461146d565b610520565b61016e6101693660046114a0565b61074f565b6040519081526020015b60405180910390f35b61016e61018f366004611443565b600360209081526000928352604080842090915290825290205481565b61016e6101ba3660046114dc565b600560209081526000928352604080842090915290825290205481565b61016e6101e5366004611443565b610766565b6101336101f83660046114dc565b610797565b61016e61020b3660046114dc565b6107a7565b6101336107bf565b6001546001600160a01b03165b6040516001600160a01b039091168152602001610178565b61026061024b36600461150f565b60026020526000908152604090205460ff1681565b6040519015158152602001610178565b61013361027e366004611443565b610825565b61016e61029136600461150f565b6001600160a01b031660009081526004602052604090205490565b6102257f000000000000000000000000000000000000000000000000000000000000000081565b6101336102e136600461150f565b61093a565b6101336102f4366004611443565b610a1c565b6001546001600160a01b031633146103585760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038216600081815260026020908152604091829020805460ff19168515159081179091558251938452908301527fa46f360b362e665dc5d2b454217a9667d2284fdb46344fb73e6cb880fffeb91c910160405180910390a15050565b6000811180156103ee57506001600160a01b0382166000908152600460205260409020546103eb90600190611540565b81105b61043a5760405162461bcd60e51b815260206004820152600560248201527f2170617374000000000000000000000000000000000000000000000000000000604482015260640161034f565b6001600160a01b03821660009081526005602090815260408083203384529091529020548110156104ad5760405162461bcd60e51b815260206004820152600f60248201527f616c726561647920636c61696d65640000000000000000000000000000000000604482015260640161034f565b6104b8816001611557565b6001600160a01b03831660008181526005602090815260408083203380855292529182902093909355519091907fdeef6364f7ce8c2fc21e3df048b8f1b79714f67289c433ad888cd76cc1267f9f906105149085815260200190565b60405180910390a35050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c1009f4b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561057b57600080fd5b505af115801561058f573d6000803e3d6000fd5b50505050600060017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663829965cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610619919061156f565b6106239190611540565b9050808211156106755760405162461bcd60e51b815260206004820152601b60248201527f43616e6e6f742061737369676e20746f20746865206675747572650000000000604482015260640161034f565b8082141561068d57610688848483610a27565b610749565b6001600160a01b0384166000908152600460205260409020548015806106f057506001600160a01b038516600090815260046020526040902083906106d3600184611540565b815481106106e3576106e3611588565b9060005260206000200154105b61073c5760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f74206261636b6461746520746f20746869732065706f6368000000604482015260640161034f565b610747858585610a27565b505b50505050565b600061075c848484610d13565b90505b9392505050565b6004602052816000526040600020818154811061078257600080fd5b90600052602060002001600091509150505481565b6107a382826000610df8565b5050565b6000806107b684846000610f02565b50949350505050565b6001546001600160a01b031633146108195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034f565b61082360006110c0565b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c1009f4b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b50505050600060017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663829965cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091e919061156f565b6109289190611540565b9050610935838383610a27565b505050565b6001546001600160a01b031633146109945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034f565b6001600160a01b038116610a105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161034f565b610a19816110c0565b50565b6107a3338383610df8565b60026000541415610a7a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161034f565b60026000818155338152602091909152604090205460ff16610ade5760405162461bcd60e51b815260206004820152600560248201527f2161757468000000000000000000000000000000000000000000000000000000604482015260640161034f565b60008211610b2e5760405162461bcd60e51b815260206004820152600760248201527f21616d6f756e7400000000000000000000000000000000000000000000000000604482015260640161034f565b610b436001600160a01b03841633308561112a565b6040516370b36d7960e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370b36d7990602401602060405180830381865afa158015610bab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcf919061156f565b9050600081610be78568056bc75e2d6310000061159e565b610bf191906115bd565b6001600160a01b0386166000908152600360209081526040808320878452909152812080549293508392909190610c29908490611557565b90915550506001600160a01b038516600090815260046020526040902054801580610c9157506001600160a01b03861660009081526004602052604090208490610c74600184611540565b81548110610c8457610c84611588565b9060005260206000200154105b15610cc2576001600160a01b0386166000908152600460209081526040822080546001810182559083529120018490555b83866001600160a01b03167f6a6f77044107a33658235d41bedbbaf2fe9ccdceb313143c947a5e76e1ec847487604051610cfe91815260200190565b60405180910390a35050600160005550505050565b604051631c60739560e01b8152600481018290526001600160a01b03848116602483015260009182917f00000000000000000000000000000000000000000000000000000000000000001690631c60739590604401602060405180830381865afa158015610d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da9919061156f565b6001600160a01b038516600090815260036020908152604080832087845290915290205490915068056bc75e2d6310000090610de5908361159e565b610def91906115bd565b95945050505050565b60026000541415610e4b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161034f565b6002600090815580610e5e858585610f02565b90925090508115610ef6576001600160a01b038085166000818152600560209081526040808320948a16835293905291909120829055610e9f9086846111c2565b836001600160a01b0316856001600160a01b03167ff3d804b61a64faf0efebbb149ce09c7269a116f5d28dd046d4a848bcf36049c38484604051610eed929190918252602082015260400190565b60405180910390a35b50506001600055505050565b600080600060017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663829965cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8b919061156f565b610f959190611540565b6001600160a01b0380871660009081526004602090815260408083205460058352818420948c1684529390915290205491925090808611610fd65780610fd8565b855b9050818110610fef57506000935091506110b89050565b6000815b838110156110b0576001600160a01b038916600090815260046020526040902080548691908390811061102857611028611588565b9060005260206000200154101561109e576110848a8a600460008d6001600160a01b03166001600160a01b03168152602001908152602001600020848154811061107457611074611588565b9060005260206000200154610d13565b61108e9083611557565b915061109b816001611557565b92505b806110a8816115df565b915050610ff3565b509450925050505b935093915050565b600180546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526107499085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111f2565b6040516001600160a01b03831660248201526044810182905261093590849063a9059cbb60e01b9060640161115e565b6000611247826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166112d79092919063ffffffff16565b805190915015610935578080602001905181019061126591906115fa565b6109355760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161034f565b606061075c848460008585843b6113305760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161034f565b600080866001600160a01b0316858760405161134c9190611643565b60006040518083038185875af1925050503d8060008114611389576040519150601f19603f3d011682016040523d82523d6000602084013e61138e565b606091505b509150915061139e8282866113a9565b979650505050505050565b606083156113b857508161075f565b8251156113c85782518084602001fd5b8160405162461bcd60e51b815260040161034f919061165f565b80356001600160a01b03811681146113f957600080fd5b919050565b8015158114610a1957600080fd5b6000806040838503121561141f57600080fd5b611428836113e2565b91506020830135611438816113fe565b809150509250929050565b6000806040838503121561145657600080fd5b61145f836113e2565b946020939093013593505050565b60008060006060848603121561148257600080fd5b61148b846113e2565b95602085013595506040909401359392505050565b6000806000606084860312156114b557600080fd5b6114be846113e2565b92506114cc602085016113e2565b9150604084013590509250925092565b600080604083850312156114ef57600080fd5b6114f8836113e2565b9150611506602084016113e2565b90509250929050565b60006020828403121561152157600080fd5b61075f826113e2565b634e487b7160e01b600052601160045260246000fd5b6000828210156115525761155261152a565b500390565b6000821982111561156a5761156a61152a565b500190565b60006020828403121561158157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60008160001904831182151516156115b8576115b861152a565b500290565b6000826115da57634e487b7160e01b600052601260045260246000fd5b500490565b60006000198214156115f3576115f361152a565b5060010190565b60006020828403121561160c57600080fd5b815161075f816113fe565b60005b8381101561163257818101518382015260200161161a565b838111156107495750506000910152565b60008251611655818460208701611617565b9190910192915050565b602081526000825180602084015261167e816040850160208701611617565b601f01601f1916919091016040019291505056fea164736f6c634300080b000a0000000000000000000000003fa73f1e5d8a792c80f426fc8f84fbf7ce9bbcac
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003fa73f1e5d8a792c80f426fc8f84fbf7ce9bbcac
-----Decoded View---------------
Arg [0] : _auraLocker (address): 0x3Fa73f1E5d8A792C80F426fc8F84FBF7Ce9bBCAC
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000003fa73f1e5d8a792c80f426fc8f84fbf7ce9bbcac
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
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.