More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
19594491 | 318 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
StakingDelegateRewards
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Errors } from "src/libraries/Errors.sol"; import { IStakingDelegateRewards } from "src/interfaces/IStakingDelegateRewards.sol"; import { IYearnStakingDelegate } from "src/interfaces/IYearnStakingDelegate.sol"; /** * @title Staking Delegate Rewards * @notice Contract for managing staking rewards with functionality to update balances, notify new rewards, and recover * tokens. * @dev Inherits from IStakingDelegateRewards and AccessControlEnumerable. */ contract StakingDelegateRewards is IStakingDelegateRewards, AccessControlEnumerable { // Libraries using SafeERC20 for IERC20; // Constants /// @dev Default duration of rewards period in seconds (7 days). uint256 private constant _DEFAULT_DURATION = 7 days; /// @dev Role identifier used for protecting functions with timelock access. bytes32 public constant TIMELOCK_ROLE = keccak256("TIMELOCK_ROLE"); // slither-disable-start naming-convention /// @dev Address of the token used for rewards, immutable. address private immutable _REWARDS_TOKEN; /// @dev Address of the staking delegate, immutable. address private immutable _STAKING_DELEGATE; // slither-disable-end naming-convention // State variables /// @dev Mapping of staking tokens to the period end timestamp. mapping(address => uint256) public periodFinish; /// @dev Mapping of staking tokens to their respective reward rate. mapping(address => uint256) public rewardRate; /// @dev Mapping of staking tokens to their rewards duration. mapping(address => uint256) public rewardsDuration; /// @dev Mapping of staking tokens to the last update time for rewards. mapping(address => uint256) public lastUpdateTime; /// @dev Mapping of staking tokens to the accumulated reward per token. mapping(address => uint256) public rewardPerTokenStored; /// @dev Mapping of staking tokens to the leftover rewards. mapping(address => uint256) public leftOver; /// @dev Mapping of staking tokens and users to the paid-out reward per token. mapping(address => mapping(address => uint256)) public userRewardPerTokenPaid; /// @dev Mapping of staking tokens and users to their respective rewards. mapping(address => mapping(address => uint256)) public rewards; /// @dev Mapping of staking tokens to their reward distributors. mapping(address => address) public rewardDistributors; /// @dev Mapping of users to their designated reward receivers. mapping(address => address) public rewardReceiver; // Events /** * @notice Emitted when rewards are added for a staking token. * @param stakingToken The staking token for which rewards are added. * @param rewardAmount The amount of rewards added. * @param rewardRate The rate at which rewards will be distributed. * @param start The start time of the reward period. * @param end The end time of the reward period. */ event RewardAdded( address indexed stakingToken, uint256 rewardAmount, uint256 rewardRate, uint256 start, uint256 end ); /** * @notice Emitted when a staking token is added to the rewards program. * @param stakingToken The staking token that was added. * @param rewardDistributioner The address authorized to distribute rewards for the staking token. */ event StakingTokenAdded(address indexed stakingToken, address rewardDistributioner); /** * @notice Emitted when a user's balance is updated for a staking token. * @param user The user whose balance was updated. * @param stakingToken The staking token for which the balance was updated. */ event UserBalanceUpdated(address indexed user, address indexed stakingToken); /** * @notice Emitted when rewards are paid out to a user for a staking token. * @param user The user who received the rewards. * @param stakingToken The staking token for which the rewards were paid. * @param reward The amount of rewards paid. * @param receiver The address that received the rewards. */ event RewardPaid(address indexed user, address indexed stakingToken, uint256 reward, address receiver); /** * @notice Emitted when the rewards duration is updated for a staking token. * @param stakingToken The staking token for which the duration was updated. * @param newDuration The new duration for rewards. */ event RewardsDurationUpdated(address indexed stakingToken, uint256 newDuration); /** * @notice Emitted when tokens are recovered from the contract. * @param token The address of the token that was recovered. * @param amount The amount of the token that was recovered. */ event Recovered(address token, uint256 amount); /** * @notice Emitted when a user sets a reward receiver address. * @param user The user who set the reward receiver. * @param receiver The address set as the reward receiver. */ event RewardReceiverSet(address indexed user, address receiver); /** * @notice Constructor that sets the rewards token and staking delegate addresses. * @param rewardsToken_ The ERC20 token to be used as the rewards token. * @param stakingDelegate_ The address of the staking delegate contract. */ // slither-disable-next-line locked-ether constructor(address rewardsToken_, address stakingDelegate_, address admin, address timeLock) payable { // Checks // Check for zero addresses if (rewardsToken_ == address(0) || stakingDelegate_ == address(0)) { revert Errors.ZeroAddress(); } _grantRole(DEFAULT_ADMIN_ROLE, admin); _grantRole(TIMELOCK_ROLE, timeLock); // This role must be revoked after granting it to the timelock _setRoleAdmin(TIMELOCK_ROLE, TIMELOCK_ROLE); // Only those with the timelock role can grant the timelock role _REWARDS_TOKEN = rewardsToken_; _STAKING_DELEGATE = stakingDelegate_; } /** * @notice Claims reward for a given staking token. * @param stakingToken The address of the staking token. */ function getReward(address stakingToken) external { _getReward(msg.sender, stakingToken); } /** * @notice Claims reward for a given user and staking token. * @param user The address of the user to claim rewards for. * @param stakingToken The address of the staking token. */ function getReward(address user, address stakingToken) external { _getReward(user, stakingToken); } /** * @notice Sets the reward receiver who will receive your rewards instead. * @dev This can be set to the zero address to receive rewards directly. * @param receiver The address of the reward receiver. */ function setRewardReceiver(address receiver) external { rewardReceiver[msg.sender] = receiver; emit RewardReceiverSet(msg.sender, receiver); } /** * @notice Notifies a new reward amount for a given staking token. * @param stakingToken The address of the staking token to notify the reward for. * @param reward The amount of the new reward. */ function notifyRewardAmount(address stakingToken, uint256 reward) external { if (msg.sender != rewardDistributors[stakingToken]) { revert Errors.OnlyRewardDistributorCanNotifyRewardAmount(); } _updateReward(address(0), stakingToken); uint256 periodFinish_ = periodFinish[stakingToken]; // slither-disable-next-line similar-names uint256 rewardDuration_ = rewardsDuration[stakingToken]; uint256 leftOverRewards = leftOver[stakingToken]; // slither-disable-next-line timestamp if (block.timestamp < periodFinish_) { uint256 remainingTime = periodFinish_ - block.timestamp; leftOverRewards = leftOverRewards + (remainingTime * rewardRate[stakingToken]); } uint256 newRewardAmount = reward + leftOverRewards; uint256 newRewardRate = newRewardAmount / rewardDuration_; // slither-disable-next-line incorrect-equality if (newRewardRate == 0) { revert Errors.RewardRateTooLow(); } uint256 newPeriodFinish = block.timestamp + rewardDuration_; emit RewardAdded(stakingToken, reward, newRewardRate, block.timestamp, newPeriodFinish); rewardRate[stakingToken] = newRewardRate; lastUpdateTime[stakingToken] = block.timestamp; periodFinish[stakingToken] = newPeriodFinish; // slither-disable-next-line weak-prng leftOver[stakingToken] = newRewardAmount % rewardDuration_; IERC20(_REWARDS_TOKEN).safeTransferFrom(msg.sender, address(this), reward); } /** * @notice Updates the balance of a user for a given staking token. * @param user The address of the user to update the balance for. * @param stakingToken The address of the staking token. * @param currentUserBalance The current balance of staking token of the user. * @param currentTotalDeposited The current total deposited amount of the staking token. */ function updateUserBalance( address user, address stakingToken, uint256 currentUserBalance, uint256 currentTotalDeposited ) external { if (msg.sender != _STAKING_DELEGATE) { revert Errors.OnlyStakingDelegateCanUpdateUserBalance(); } _updateReward(user, stakingToken, currentUserBalance, currentTotalDeposited); emit UserBalanceUpdated(user, stakingToken); } /** * @notice Adds a new staking token to the contract. * @param stakingToken The address of the staking token to add. * @param rewardDistributioner The address allowed to notify new rewards for the staking token. */ function addStakingToken(address stakingToken, address rewardDistributioner) external { if (msg.sender != _STAKING_DELEGATE) { revert Errors.OnlyStakingDelegateCanAddStakingToken(); } if (rewardDistributors[stakingToken] != address(0)) { revert Errors.StakingTokenAlreadyAdded(); } rewardDistributors[stakingToken] = rewardDistributioner; rewardsDuration[stakingToken] = _DEFAULT_DURATION; emit StakingTokenAdded(stakingToken, rewardDistributioner); emit RewardsDurationUpdated(stakingToken, _DEFAULT_DURATION); } /** * @notice Sets the duration of the rewards period for a given staking token. * @param stakingToken The address of the staking token to set the rewards duration for. * @param rewardsDuration_ The new duration of the rewards period. */ function setRewardsDuration(address stakingToken, uint256 rewardsDuration_) external onlyRole(TIMELOCK_ROLE) { if (rewardsDuration_ == 0) { revert Errors.RewardDurationCannotBeZero(); } if (rewardsDuration[stakingToken] == 0) { revert Errors.StakingTokenNotAdded(); } // slither-disable-next-line timestamp if (block.timestamp <= periodFinish[stakingToken]) { revert Errors.PreviousRewardsPeriodNotCompleted(); } rewardsDuration[stakingToken] = rewardsDuration_; emit RewardsDurationUpdated(stakingToken, rewardsDuration_); } /** * @notice Allows recovery of ERC20 tokens other than the staking and rewards tokens. * @dev Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders * @param tokenAddress The address of the token to recover. * @param to The address to send the recovered tokens to. * @param tokenAmount The amount of tokens to recover. */ function recoverERC20( address tokenAddress, address to, uint256 tokenAmount ) external onlyRole(DEFAULT_ADMIN_ROLE) { if (tokenAddress == _REWARDS_TOKEN || rewardDistributors[tokenAddress] != address(0)) { revert Errors.RescueNotAllowed(); } emit Recovered(tokenAddress, tokenAmount); IERC20(tokenAddress).safeTransfer(to, tokenAmount); } /** * @notice Calculates the total reward for a given duration for a staking token. * @param stakingToken The address of the staking token. * @return The total reward for the given duration. */ function getRewardForDuration(address stakingToken) external view returns (uint256) { return rewardRate[stakingToken] * rewardsDuration[stakingToken]; } /** * @notice Returns the address of the rewards token. * @return The address of the rewards token. */ function rewardToken() external view returns (address) { return _REWARDS_TOKEN; } /** * @notice Returns the address of the staking delegate. * @return The address of the staking delegate. */ function stakingDelegate() external view returns (address) { return _STAKING_DELEGATE; } /** * @notice Calculates the last time a reward was applicable for the given staking token. * @param stakingToken The address of the staking token. * @return The last applicable timestamp for rewards. */ function lastTimeRewardApplicable(address stakingToken) public view returns (uint256) { uint256 finish = periodFinish[stakingToken]; // slither-disable-next-line timestamp return block.timestamp < finish ? block.timestamp : finish; } /** * @notice Calculates the accumulated reward per token stored. * @param stakingToken The address of the staking token. * @return The accumulated reward per token. */ function rewardPerToken(address stakingToken) external view returns (uint256) { return _rewardPerToken(stakingToken, IYearnStakingDelegate(_STAKING_DELEGATE).totalDeposited(stakingToken)); } function _rewardPerToken(address stakingToken, uint256 currentTotalDeposited) internal view returns (uint256) { if (currentTotalDeposited == 0) { return rewardPerTokenStored[stakingToken]; } return rewardPerTokenStored[stakingToken] + (lastTimeRewardApplicable(stakingToken) - lastUpdateTime[stakingToken]) * rewardRate[stakingToken] * 1e18 / currentTotalDeposited; } /** * @notice Calculates the amount of reward earned by an account for a given staking token. * @param account The address of the user's account. * @param stakingToken The address of the staking token. * @return The amount of reward earned. */ function earned(address account, address stakingToken) external view returns (uint256) { return _earned( account, stakingToken, IYearnStakingDelegate(_STAKING_DELEGATE).balanceOf(account, stakingToken), _rewardPerToken(stakingToken, IYearnStakingDelegate(_STAKING_DELEGATE).totalDeposited(stakingToken)) ); } function _earned( address account, address stakingToken, uint256 userBalance, uint256 rewardPerToken_ ) internal view returns (uint256) { return rewards[account][stakingToken] + (userBalance * (rewardPerToken_ - userRewardPerTokenPaid[account][stakingToken]) / 1e18); } /** * @notice Updates the reward state for a given user and staking token. If there are any rewards to be paid out, * they are sent to the receiver that was set by the user. (Defaults to the user's address if not set) * @param user The address of the user to update rewards for. * @param stakingToken The address of the staking token. */ function _getReward(address user, address stakingToken) internal { _updateReward(user, stakingToken); uint256 reward = rewards[user][stakingToken]; if (reward > 0) { rewards[user][stakingToken] = 0; address receiver = rewardReceiver[user]; if (receiver == address(0)) { receiver = user; } emit RewardPaid(user, stakingToken, reward, receiver); IERC20(_REWARDS_TOKEN).safeTransfer(receiver, reward); } } function _updateReward(address account, address stakingToken) internal { _updateReward( account, stakingToken, IYearnStakingDelegate(_STAKING_DELEGATE).balanceOf(account, stakingToken), IYearnStakingDelegate(_STAKING_DELEGATE).totalDeposited(stakingToken) ); } /** * @dev Updates reward state for a given user and staking token. * @param account The address of the user to update rewards for. * @param stakingToken The address of the staking token. */ function _updateReward( address account, address stakingToken, uint256 currentUserBalance, uint256 currentTotalDeposited ) internal { uint256 rewardPerToken_ = _rewardPerToken(stakingToken, currentTotalDeposited); rewardPerTokenStored[stakingToken] = rewardPerToken_; lastUpdateTime[stakingToken] = lastTimeRewardApplicable(stakingToken); if (account != address(0)) { rewards[account][stakingToken] = _earned(account, stakingToken, currentUserBalance, rewardPerToken_); userRewardPerTokenPaid[account][stakingToken] = rewardPerToken_; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (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. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ 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: BUSL-1.1 pragma solidity >=0.8.18; /// @title Errors /// @notice Library containing all custom errors the protocol may revert with. library Errors { //// MASTER REGISTRY //// /// @notice Thrown when the registry name given is empty. error NameEmpty(); /// @notice Thrown when the registry address given is empty. error AddressEmpty(); /// @notice Thrown when the registry name is found when calling addRegistry(). error RegistryNameFound(bytes32 name); /// @notice Thrown when the registry name is not found but is expected to be. error RegistryNameNotFound(bytes32 name); /// @notice Thrown when the registry address is not found but is expected to be. error RegistryAddressNotFound(address registryAddress); /// @notice Thrown when the registry name and version is not found but is expected to be. error RegistryNameVersionNotFound(bytes32 name, uint256 version); /// @notice Thrown when a duplicate registry address is found. error DuplicateRegistryAddress(address registryAddress); //// YEARN STAKING DELEGATE //// /// @notice Error for when an address is zero which is not allowed. error ZeroAddress(); /// @notice Error for when an amount is zero which is not allowed. error ZeroAmount(); /// @notice Error for when a reward split is invalid. error InvalidRewardSplit(); /// @notice Error for when the treasury percentage is too high. error TreasuryPctTooHigh(); /// @notice Error for when perpetual lock is enabled and an action cannot be taken. error PerpetualLockEnabled(); /// @notice Error for when perpetual lock is disabled and an action cannot be taken. error PerpetualLockDisabled(); /// @notice Error for when swap and lock settings are not set. error SwapAndLockNotSet(); /// @notice Error for when gauge rewards have already been added. error GaugeRewardsAlreadyAdded(); /// @notice Error for when gauge rewards have not yet been added. error GaugeRewardsNotYetAdded(); /// @notice Error for when execution of an action is not allowed. error ExecutionNotAllowed(); /// @notice Error for when execution of an action has failed. error ExecutionFailed(); /// @notice Error for when Cove YFI reward forwarder is not set. error CoveYfiRewardForwarderNotSet(); //// STAKING DELEGATE REWARDS //// /// @notice Error for when a rescue operation is not allowed. error RescueNotAllowed(); /// @notice Error for when the previous rewards period has not been completed. error PreviousRewardsPeriodNotCompleted(); /// @notice Error for when only the staking delegate can update a user's balance. error OnlyStakingDelegateCanUpdateUserBalance(); /// @notice Error for when only the staking delegate can add a staking token. error OnlyStakingDelegateCanAddStakingToken(); /// @notice Error for when only the reward distributor can notify the reward amount. error OnlyRewardDistributorCanNotifyRewardAmount(); /// @notice Error for when a staking token has already been added. error StakingTokenAlreadyAdded(); /// @notice Error for when a staking token has not been added. error StakingTokenNotAdded(); /// @notice Error for when the reward rate is too low. error RewardRateTooLow(); /// @notice Error for when the reward duration cannot be zero. error RewardDurationCannotBeZero(); //// WRAPPED STRATEGY CURVE SWAPPER //// /// @notice Error for when slippage is too high. error SlippageTooHigh(); /// @notice Error for when invalid tokens are received. error InvalidTokensReceived(); /// CURVE ROUTER SWAPPER /// /* * @notice Error for when the from token is invalid. * @param intendedFromToken The intended from token address. * @param actualFromToken The actual from token address received. */ error InvalidFromToken(address intendedFromToken, address actualFromToken); /* * @notice Error for when the to token is invalid. * @param intendedToToken The intended to token address. * @param actualToToken The actual to token address received. */ error InvalidToToken(address intendedToToken, address actualToToken); /// @notice Error for when the expected amount is zero. error ExpectedAmountZero(); /// @notice Error for when swap parameters are invalid. error InvalidSwapParams(); /// SWAP AND LOCK /// /// @notice Error for when the same address is used in a context where it is not allowed. error SameAddress(); //// COVEYFI //// /// @notice Error for when only minting is enabled. error OnlyMintingEnabled(); /// RESCUABLE /// /// @notice Error for when an ETH transfer of zero is attempted. error ZeroEthTransfer(); /// @notice Error for when an ETH transfer fails. error EthTransferFailed(); /// @notice Error for when a token transfer of zero is attempted. error ZeroTokenTransfer(); /// GAUGE REWARD RECEIVER /// /// @notice Error for when an action is not authorized. error NotAuthorized(); /// @notice Error for when rescuing a reward token is not allowed. error CannotRescueRewardToken(); /// DYFI REDEEMER /// /// @notice Error for when an array length is invalid. error InvalidArrayLength(); /// @notice Error for when a price feed is outdated. error PriceFeedOutdated(); /// @notice Error for when a price feed round is incorrect. error PriceFeedIncorrectRound(); /// @notice Error for when a price feed returns a zero price. error PriceFeedReturnedZeroPrice(); /// @notice Error for when there is no DYFI to redeem. error NoDYfiToRedeem(); /// @notice Error for when an ETH transfer for caller reward fails. error CallerRewardEthTransferFailed(); /// COVE YEARN GAUGE FACTORY /// /// @notice Error for when a gauge has already been deployed. error GaugeAlreadyDeployed(); /// @notice Error for when a gauge has not been deployed. error GaugeNotDeployed(); /// MINICHEF V3 //// /// @notice Error for when an LP token is invalid. error InvalidLPToken(); /// @notice Error for when an LP token has not been added. error LPTokenNotAdded(); /// @notice Error for when an LP token does not match the pool ID. error LPTokenDoesNotMatchPoolId(); /// @notice Error for when there is an insufficient balance. error InsufficientBalance(); /// @notice Error for when an LP token has already been added. error LPTokenAlreadyAdded(); /// @notice Error for when the reward rate is too high. error RewardRateTooHigh(); /// Yearn4626RouterExt /// /// @notice Error for when there are insufficient shares. error InsufficientShares(); /// @notice Error for when the 'to' address is invalid. error InvalidTo(); /// @notice Error esure the has enough remaining gas. error InsufficientGas(); /// TESTING /// /// @notice Error for when there is not enough balance to take away. error TakeAwayNotEnoughBalance(); /// @notice Error for when a strategy has not been added to a vault. error StrategyNotAddedToVault(); /// COVE TOKEN /// /// @notice Error for when a transfer is attempted before it is allowed. error TransferNotAllowedYet(); /// @notice Error for when an address is being added as both a sender and a receiver. error CannotBeBothSenderAndReceiver(); /// @notice Error for when an unpause is attempted too early. error UnpauseTooEarly(); /// @notice Error for when the pause period is too long. error PausePeriodTooLong(); /// @notice Error for when minting is attempted too early. error MintingAllowedTooEarly(); /// @notice Error for when the mint amount exceeds the cap. error InflationTooLarge(); /* * @notice Error for when an unauthorized account attempts an action requiring a specific role. * @param account The account attempting the unauthorized action. * @param neededRole The role required for the action. */ error AccessControlEnumerableUnauthorizedAccount(address account, bytes32 neededRole); /// @notice Error for when an action is unauthorized. error Unauthorized(); /// @notice Error for when a pause is expected but not enacted. error ExpectedPause(); /// COVE YEARN GAUGE FACTORY /// /// @notice Error for when an address is not a contract. error AddressNotContract(); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.18; import { IAccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; interface IStakingDelegateRewards is IAccessControlEnumerable { function getReward(address stakingToken) external; function setRewardReceiver(address receiver) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.18; import { IVotingYFI } from "./deps/yearn/veYFI/IVotingYFI.sol"; interface IYearnStakingDelegate { // Struct definitions struct RewardSplit { uint64 treasury; uint64 coveYfi; uint64 user; uint64 lock; } struct ExitRewardSplit { uint128 treasury; uint128 coveYfi; } struct BoostRewardSplit { uint128 treasury; uint128 coveYfi; } function deposit(address gauge, uint256 amount) external; function withdraw(address gauge, uint256 amount) external; function withdraw(address gauge, uint256 amount, address receiver) external; function lockYfi(uint256 amount) external returns (IVotingYFI.LockedBalance memory); function harvest(address vault) external returns (uint256); function setCoveYfiRewardForwarder(address forwarder) external; function setGaugeRewardSplit( address gauge, uint64 treasuryPct, uint64 coveYfiPct, uint64 userPct, uint64 veYfiPct ) external; function setBoostRewardSplit(uint128 treasuryPct, uint128 coveYfiPct) external; function setExitRewardSplit(uint128 treasuryPct, uint128 coveYfiPct) external; function setSwapAndLock(address swapAndLock) external; function balanceOf(address user, address gauge) external view returns (uint256); function totalDeposited(address gauge) external view returns (uint256); function depositLimit(address gauge) external view returns (uint256); function availableDepositLimit(address gauge) external view returns (uint256); function gaugeStakingRewards(address gauge) external view returns (address); function gaugeRewardReceivers(address gauge) external view returns (address); function getGaugeRewardSplit(address gauge) external view returns (RewardSplit memory); function getBoostRewardSplit() external view returns (BoostRewardSplit memory); function getExitRewardSplit() external view returns (ExitRewardSplit memory); function treasury() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// 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.4) (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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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) (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 pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IVotingYFI is IERC20 { event ModifyLock(address indexed sender, address indexed user, uint256 amount, uint256 locktime, uint256 ts); event Withdraw(address indexed user, uint256 amount, uint256 ts); event Penalty(address indexed user, uint256 amount, uint256 ts); event Supply(uint256 oldSupply, uint256 newSupply, uint256 ts); struct LockedBalance { uint256 amount; uint256 end; } struct Withdrawn { uint256 amount; uint256 penalty; } struct Point { int128 bias; int128 slope; uint256 ts; uint256 blk; } function totalSupply() external view returns (uint256); function locked(address _user) external view returns (LockedBalance memory); function modify_lock( uint256 _amount, uint256 _unlock_time, address _user ) external returns (LockedBalance memory); function withdraw() external returns (Withdrawn memory); function point_history(address user, uint256 epoch) external view returns (Point memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "tokenized-strategy/=lib/tokenized-strategy/src/", "yearn-vaults-v3/=lib/yearn-vaults-v3/contracts/", "Yearn-ERC4626-Router/=lib/Yearn-ERC4626-Router/src/", "solmate/=lib/permit2/lib/solmate/src/", "permit2/=lib/permit2/src/", "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "@crytic/properties/=lib/properties/", "forge-deploy/=lib/forge-deploy/contracts/", "script/=script/", "src/=src/", "test/=test/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"rewardsToken_","type":"address"},{"internalType":"address","name":"stakingDelegate_","type":"address"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"timeLock","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"OnlyRewardDistributorCanNotifyRewardAmount","type":"error"},{"inputs":[],"name":"OnlyStakingDelegateCanAddStakingToken","type":"error"},{"inputs":[],"name":"OnlyStakingDelegateCanUpdateUserBalance","type":"error"},{"inputs":[],"name":"PreviousRewardsPeriodNotCompleted","type":"error"},{"inputs":[],"name":"RescueNotAllowed","type":"error"},{"inputs":[],"name":"RewardDurationCannotBeZero","type":"error"},{"inputs":[],"name":"RewardRateTooLow","type":"error"},{"inputs":[],"name":"StakingTokenAlreadyAdded","type":"error"},{"inputs":[],"name":"StakingTokenNotAdded","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"RewardReceiverSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"RewardsDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":false,"internalType":"address","name":"rewardDistributioner","type":"address"}],"name":"StakingTokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"}],"name":"UserBalanceUpdated","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TIMELOCK_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"address","name":"rewardDistributioner","type":"address"}],"name":"addStakingToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"stakingToken","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"stakingToken","type":"address"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"}],"name":"getRewardForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"}],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"leftOver","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardDistributors","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"}],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardsDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"setRewardReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"uint256","name":"rewardsDuration_","type":"uint256"}],"name":"setRewardsDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingDelegate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"uint256","name":"currentUserBalance","type":"uint256"},{"internalType":"uint256","name":"currentTotalDeposited","type":"uint256"}],"name":"updateUserBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c0604052604051620022813803806200228183398101604081905262000026916200027e565b6001600160a01b03841615806200004457506001600160a01b038316155b15620000635760405163d92e233d60e01b815260040160405180910390fd5b62000070600083620000c0565b6200008b6000805160206200226183398151915282620000c0565b620000a6600080516020620022618339815191528062000103565b50506001600160a01b039182166080521660a052620002db565b620000d782826200014e60201b62000f2a1760201c565b6000828152600160209081526040909120620000fe91839062000fae620001ef821b17901c565b505050565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001eb576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001aa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000206836001600160a01b0384166200020f565b90505b92915050565b6000818152600183016020526040812054620002585750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000209565b50600062000209565b80516001600160a01b03811681146200027957600080fd5b919050565b600080600080608085870312156200029557600080fd5b620002a08562000261565b9350620002b06020860162000261565b9250620002c06040860162000261565b9150620002d06060860162000261565b905092959194509250565b60805160a051611f1a62000347600039600081816103ff015281816106f20152818161078201528181610c2c01528181610da001528181610ef90152818161130b0152611397015260008181610593015281816105ef01528181610bef01526112a90152611f1a6000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c8063949428a11161011a578063ca15c873116100ad578063e12f2d3b1161007c578063e12f2d3b14610519578063e70b9e271461052c578063f122977714610557578063f288a2e21461056a578063f7c618c11461059157600080fd5b8063ca15c873146104c0578063d547741f146104d3578063da09d19d146104e6578063dae254dd1461050657600080fd5b8063b66503cf116100e9578063b66503cf14610474578063b9f276fa14610487578063bcd110141461049a578063c00007b0146104ad57600080fd5b8063949428a1146103fd5780639ce43f9014610423578063a217fddf14610443578063a9c12f0c1461044b57600080fd5b806336568abe1161019d5780636720a1201161016c5780636720a120146103585780636b091695146103995780637035ab98146103ac5780639010d07c146103d757806391d14854146103ea57600080fd5b806336568abe146102f257806348de7361146103055780635d91035114610325578063638634ee1461034557600080fd5b80632378bea6116101d95780632378bea614610289578063248a9ca31461029c5780632ce9aead146102bf5780632f2ff15d146102df57600080fd5b806301ffc9a71461020b5780631171bda914610233578063211dc32d14610248578063221ca18c14610269575b600080fd5b61021e610219366004611b3d565b6105b7565b60405190151581526020015b60405180910390f35b610246610241366004611b83565b6105e2565b005b61025b610256366004611bbf565b6106c0565b60405190815260200161022a565b61025b610277366004611bf2565b60036020526000908152604090205481565b610246610297366004611c0d565b6107ff565b61025b6102aa366004611c37565b60009081526020819052604090206001015490565b61025b6102cd366004611bf2565b60056020526000908152604090205481565b6102466102ed366004611c50565b610914565b610246610300366004611c50565b61093e565b61025b610313366004611bf2565b60076020526000908152604090205481565b61025b610333366004611bf2565b60046020526000908152604090205481565b61025b610353366004611bf2565b6109c1565b610381610366366004611bf2565b600b602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161022a565b6102466103a7366004611bbf565b6109ef565b61025b6103ba366004611bbf565b600860209081526000928352604080842090915290825290205481565b6103816103e5366004611c73565b6109f9565b61021e6103f8366004611c50565b610a11565b7f0000000000000000000000000000000000000000000000000000000000000000610381565b61025b610431366004611bf2565b60066020526000908152604090205481565b61025b600081565b610381610459366004611bf2565b600a602052600090815260409020546001600160a01b031681565b610246610482366004611c0d565b610a3a565b610246610495366004611c95565b610c21565b61025b6104a8366004611bf2565b610cbc565b6102466104bb366004611bf2565b610cea565b61025b6104ce366004611c37565b610cf7565b6102466104e1366004611c50565b610d0e565b61025b6104f4366004611bf2565b60026020526000908152604090205481565b610246610514366004611bf2565b610d33565b610246610527366004611bbf565b610d95565b61025b61053a366004611bbf565b600960209081526000928352604080842090915290825290205481565b61025b610565366004611bf2565b610ed1565b61025b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0581565b7f0000000000000000000000000000000000000000000000000000000000000000610381565b60006001600160e01b03198216635a05180f60e01b14806105dc57506105dc82610fc3565b92915050565b60006105ed81610ff8565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316148061064657506001600160a01b038481166000908152600a60205260409020541615155b1561066457604051631776b5cd60e21b815260040160405180910390fd5b604080516001600160a01b0386168152602081018490527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a16106ba6001600160a01b0385168484611002565b50505050565b604051633de222bb60e21b81526001600160a01b03808416600483015280831660248301526000916107f891859185917f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa158015610739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075d9190611cd7565b604051635305548160e01b81526001600160a01b0380881660048301526107f39188917f000000000000000000000000000000000000000000000000000000000000000016906353055481906024015b602060405180830381865afa1580156107ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ee9190611cd7565b611065565b611112565b9392505050565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0561082981610ff8565b8160000361084a57604051638cf7ba4f60e01b815260040160405180910390fd5b6001600160a01b038316600090815260046020526040812054900361088257604051631fb8bafb60e31b815260040160405180910390fd5b6001600160a01b03831660009081526002602052604090205442116108ba57604051638fd1d4d760e01b815260040160405180910390fd5b6001600160a01b03831660008181526004602052604090819020849055517fad2f86b01ed93b4b3a150d448c61a4f5d8d38075d3c0c64cc0a26fd6e1f49545906109079085815260200190565b60405180910390a2505050565b60008281526020819052604090206001015461092f81610ff8565b610939838361119d565b505050565b6001600160a01b03811633146109b35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6109bd82826111bf565b5050565b6001600160a01b0381166000908152600260205260408120544281116109e757806107f8565b429392505050565b6109bd82826111e1565b60008281526001602052604081206107f890836112d0565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6001600160a01b038281166000908152600a6020526040902054163314610a745760405163437ca6cf60e11b815260040160405180910390fd5b610a7f6000836112dc565b6001600160a01b0382166000908152600260209081526040808320546004835281842054600790935292205442831115610af3576000610abf4285611d06565b6001600160a01b038716600090815260036020526040902054909150610ae59082611d19565b610aef9083611d30565b9150505b6000610aff8286611d30565b90506000610b0d8483611d59565b905080600003610b3057604051630639c74d60e41b815260040160405180910390fd5b6000610b3c8542611d30565b604080518981526020810185905242818301526060810183905290519192506001600160a01b038a16917f27c87675510fe43d389c54bf8b9276579c58f76ee37830eaa44024f26714039e9181900360800190a26001600160a01b03881660009081526003602090815260408083208590556005825280832042905560029091529020819055610bcc8584611d6d565b6001600160a01b03808a16600090815260076020526040902091909155610c17907f00000000000000000000000000000000000000000000000000000000000000001633308a611407565b5050505050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6a576040516358825a2960e01b815260040160405180910390fd5b610c768484848461143f565b826001600160a01b0316846001600160a01b03167f88f2b86ac62356711c096194cb8bcc4996fecfc20017ecedc832fa22522ffd6460405160405180910390a350505050565b6001600160a01b03811660009081526004602090815260408083205460039092528220546105dc9190611d19565b610cf433826111e1565b50565b60008181526001602052604081206105dc906114e9565b600082815260208190526040902060010154610d2981610ff8565b61093983836111bf565b336000818152600b602090815260409182902080546001600160a01b0319166001600160a01b03861690811790915591519182527f544fb4d1dd5512696562d1958798242e3927c26c6551e1cb0e400a7b98b2877b910160405180910390a250565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610dde576040516390978d9160e01b815260040160405180910390fd5b6001600160a01b038281166000908152600a60205260409020541615610e1757604051634c55dc7d60e01b815260040160405180910390fd5b6001600160a01b038281166000818152600a6020908152604080832080546001600160a01b0319169587169586179055600482529182902062093a809055905192835290917f2ff7dd9798a312e08e07b783e71b4c29955046589e17c4fe968b2b759b8b80bb910160405180910390a2816001600160a01b03167fad2f86b01ed93b4b3a150d448c61a4f5d8d38075d3c0c64cc0a26fd6e1f4954562093a80604051610ec591815260200190565b60405180910390a25050565b604051635305548160e01b81526001600160a01b0382811660048301526000916105dc9184917f0000000000000000000000000000000000000000000000000000000000000000909116906353055481906024016107ad565b610f348282610a11565b6109bd576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610f6a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006107f8836001600160a01b0384166114f3565b60006001600160e01b03198216637965db0b60e01b14806105dc57506301ffc9a760e01b6001600160e01b03198316146105dc565b610cf48133611542565b6040516001600160a01b03831660248201526044810182905261093990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261159b565b60008160000361108e57506001600160a01b0382166000908152600660205260409020546105dc565b6001600160a01b0383166000908152600360209081526040808320546005909252909120548391906110bf866109c1565b6110c99190611d06565b6110d39190611d19565b6110e590670de0b6b3a7640000611d19565b6110ef9190611d59565b6001600160a01b0384166000908152600660205260409020546107f89190611d30565b6001600160a01b038085166000908152600860209081526040808320938716835292905290812054670de0b6b3a76400009061114e9084611d06565b6111589085611d19565b6111629190611d59565b6001600160a01b038087166000908152600960209081526040808320938916835292905220546111929190611d30565b90505b949350505050565b6111a78282610f2a565b60008281526001602052604090206109399082610fae565b6111c98282611670565b600082815260016020526040902061093990826116d5565b6111eb82826112dc565b6001600160a01b038083166000908152600960209081526040808320938516835292905220548015610939576001600160a01b03808416600081815260096020908152604080832087861684528252808320839055928252600b9052205416806112525750825b604080518381526001600160a01b03838116602083015280861692908716917f7fe1dfb5fd2a01640e1b559e082ce63e369d4d61e01dc0caec9521e55a8d1e4f910160405180910390a36106ba6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284611002565b60006107f883836116ea565b604051633de222bb60e21b81526001600160a01b03838116600483015282811660248301526109bd91849184917f00000000000000000000000000000000000000000000000000000000000000009091169063f7888aec90604401602060405180830381865afa158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611cd7565b604051635305548160e01b81526001600160a01b0386811660048301527f00000000000000000000000000000000000000000000000000000000000000001690635305548190602401602060405180830381865afa1580156113de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114029190611cd7565b61143f565b6040516001600160a01b03808516602483015283166044820152606481018290526106ba9085906323b872dd60e01b9060840161102e565b600061144b8483611065565b6001600160a01b03851660009081526006602052604090208190559050611471846109c1565b6001600160a01b038086166000908152600560205260409020919091558516156114e2576114a185858584611112565b6001600160a01b038087166000818152600960209081526040808320948a168084529482528083209590955591815260088252838120928152919052208190555b5050505050565b60006105dc825490565b600081815260018301602052604081205461153a575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105dc565b5060006105dc565b61154c8282610a11565b6109bd5761155981611714565b611564836020611726565b604051602001611575929190611da5565b60408051601f198184030181529082905262461bcd60e51b82526109aa91600401611e1a565b60006115f0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166118c29092919063ffffffff16565b90508051600014806116115750808060200190518101906116119190611e4d565b6109395760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109aa565b61167a8282610a11565b156109bd576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006107f8836001600160a01b0384166118d1565b600082600001828154811061170157611701611e6f565b9060005260206000200154905092915050565b60606105dc6001600160a01b03831660145b60606000611735836002611d19565b611740906002611d30565b67ffffffffffffffff81111561175857611758611e85565b6040519080825280601f01601f191660200182016040528015611782576020820181803683370190505b509050600360fc1b8160008151811061179d5761179d611e6f565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106117cc576117cc611e6f565b60200101906001600160f81b031916908160001a90535060006117f0846002611d19565b6117fb906001611d30565b90505b6001811115611873576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061182f5761182f611e6f565b1a60f81b82828151811061184557611845611e6f565b60200101906001600160f81b031916908160001a90535060049490941c9361186c81611e9b565b90506117fe565b5083156107f85760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109aa565b606061119584846000856119c4565b600081815260018301602052604081205480156119ba5760006118f5600183611d06565b855490915060009061190990600190611d06565b905081811461196e57600086600001828154811061192957611929611e6f565b906000526020600020015490508087600001848154811061194c5761194c611e6f565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061197f5761197f611eb2565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105dc565b60009150506105dc565b606082471015611a255760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109aa565b600080866001600160a01b03168587604051611a419190611ec8565b60006040518083038185875af1925050503d8060008114611a7e576040519150601f19603f3d011682016040523d82523d6000602084013e611a83565b606091505b5091509150611a9487838387611a9f565b979650505050505050565b60608315611b0e578251600003611b07576001600160a01b0385163b611b075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109aa565b5081611195565b6111958383815115611b235781518083602001fd5b8060405162461bcd60e51b81526004016109aa9190611e1a565b600060208284031215611b4f57600080fd5b81356001600160e01b0319811681146107f857600080fd5b80356001600160a01b0381168114611b7e57600080fd5b919050565b600080600060608486031215611b9857600080fd5b611ba184611b67565b9250611baf60208501611b67565b9150604084013590509250925092565b60008060408385031215611bd257600080fd5b611bdb83611b67565b9150611be960208401611b67565b90509250929050565b600060208284031215611c0457600080fd5b6107f882611b67565b60008060408385031215611c2057600080fd5b611c2983611b67565b946020939093013593505050565b600060208284031215611c4957600080fd5b5035919050565b60008060408385031215611c6357600080fd5b82359150611be960208401611b67565b60008060408385031215611c8657600080fd5b50508035926020909101359150565b60008060008060808587031215611cab57600080fd5b611cb485611b67565b9350611cc260208601611b67565b93969395505050506040820135916060013590565b600060208284031215611ce957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105dc576105dc611cf0565b80820281158282048414176105dc576105dc611cf0565b808201808211156105dc576105dc611cf0565b634e487b7160e01b600052601260045260246000fd5b600082611d6857611d68611d43565b500490565b600082611d7c57611d7c611d43565b500690565b60005b83811015611d9c578181015183820152602001611d84565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611ddd816017850160208801611d81565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611e0e816028840160208801611d81565b01602801949350505050565b6020815260008251806020840152611e39816040850160208701611d81565b601f01601f19169190910160400192915050565b600060208284031215611e5f57600080fd5b815180151581146107f857600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600081611eaa57611eaa611cf0565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251611eda818460208701611d81565b919091019291505056fea2646970667358221220c592791591fba8c7de8deea9ea31f302646e855e76b63b90b639935322a7a9e664736f6c63430008120033f66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0500000000000000000000000041252e8691e964f7de35156b68493bab6797a27500000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f0000000000000000000000007bd578354b0b2f02e656f1bdc0e41a80f860534b000000000000000000000000705f82bb431fada1a0f11d7b77b3f0586c545cbc
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102065760003560e01c8063949428a11161011a578063ca15c873116100ad578063e12f2d3b1161007c578063e12f2d3b14610519578063e70b9e271461052c578063f122977714610557578063f288a2e21461056a578063f7c618c11461059157600080fd5b8063ca15c873146104c0578063d547741f146104d3578063da09d19d146104e6578063dae254dd1461050657600080fd5b8063b66503cf116100e9578063b66503cf14610474578063b9f276fa14610487578063bcd110141461049a578063c00007b0146104ad57600080fd5b8063949428a1146103fd5780639ce43f9014610423578063a217fddf14610443578063a9c12f0c1461044b57600080fd5b806336568abe1161019d5780636720a1201161016c5780636720a120146103585780636b091695146103995780637035ab98146103ac5780639010d07c146103d757806391d14854146103ea57600080fd5b806336568abe146102f257806348de7361146103055780635d91035114610325578063638634ee1461034557600080fd5b80632378bea6116101d95780632378bea614610289578063248a9ca31461029c5780632ce9aead146102bf5780632f2ff15d146102df57600080fd5b806301ffc9a71461020b5780631171bda914610233578063211dc32d14610248578063221ca18c14610269575b600080fd5b61021e610219366004611b3d565b6105b7565b60405190151581526020015b60405180910390f35b610246610241366004611b83565b6105e2565b005b61025b610256366004611bbf565b6106c0565b60405190815260200161022a565b61025b610277366004611bf2565b60036020526000908152604090205481565b610246610297366004611c0d565b6107ff565b61025b6102aa366004611c37565b60009081526020819052604090206001015490565b61025b6102cd366004611bf2565b60056020526000908152604090205481565b6102466102ed366004611c50565b610914565b610246610300366004611c50565b61093e565b61025b610313366004611bf2565b60076020526000908152604090205481565b61025b610333366004611bf2565b60046020526000908152604090205481565b61025b610353366004611bf2565b6109c1565b610381610366366004611bf2565b600b602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161022a565b6102466103a7366004611bbf565b6109ef565b61025b6103ba366004611bbf565b600860209081526000928352604080842090915290825290205481565b6103816103e5366004611c73565b6109f9565b61021e6103f8366004611c50565b610a11565b7f00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f610381565b61025b610431366004611bf2565b60066020526000908152604090205481565b61025b600081565b610381610459366004611bf2565b600a602052600090815260409020546001600160a01b031681565b610246610482366004611c0d565b610a3a565b610246610495366004611c95565b610c21565b61025b6104a8366004611bf2565b610cbc565b6102466104bb366004611bf2565b610cea565b61025b6104ce366004611c37565b610cf7565b6102466104e1366004611c50565b610d0e565b61025b6104f4366004611bf2565b60026020526000908152604090205481565b610246610514366004611bf2565b610d33565b610246610527366004611bbf565b610d95565b61025b61053a366004611bbf565b600960209081526000928352604080842090915290825290205481565b61025b610565366004611bf2565b610ed1565b61025b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0581565b7f00000000000000000000000041252e8691e964f7de35156b68493bab6797a275610381565b60006001600160e01b03198216635a05180f60e01b14806105dc57506105dc82610fc3565b92915050565b60006105ed81610ff8565b7f00000000000000000000000041252e8691e964f7de35156b68493bab6797a2756001600160a01b0316846001600160a01b0316148061064657506001600160a01b038481166000908152600a60205260409020541615155b1561066457604051631776b5cd60e21b815260040160405180910390fd5b604080516001600160a01b0386168152602081018490527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a16106ba6001600160a01b0385168484611002565b50505050565b604051633de222bb60e21b81526001600160a01b03808416600483015280831660248301526000916107f891859185917f00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f169063f7888aec90604401602060405180830381865afa158015610739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075d9190611cd7565b604051635305548160e01b81526001600160a01b0380881660048301526107f39188917f00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f16906353055481906024015b602060405180830381865afa1580156107ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ee9190611cd7565b611065565b611112565b9392505050565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0561082981610ff8565b8160000361084a57604051638cf7ba4f60e01b815260040160405180910390fd5b6001600160a01b038316600090815260046020526040812054900361088257604051631fb8bafb60e31b815260040160405180910390fd5b6001600160a01b03831660009081526002602052604090205442116108ba57604051638fd1d4d760e01b815260040160405180910390fd5b6001600160a01b03831660008181526004602052604090819020849055517fad2f86b01ed93b4b3a150d448c61a4f5d8d38075d3c0c64cc0a26fd6e1f49545906109079085815260200190565b60405180910390a2505050565b60008281526020819052604090206001015461092f81610ff8565b610939838361119d565b505050565b6001600160a01b03811633146109b35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6109bd82826111bf565b5050565b6001600160a01b0381166000908152600260205260408120544281116109e757806107f8565b429392505050565b6109bd82826111e1565b60008281526001602052604081206107f890836112d0565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6001600160a01b038281166000908152600a6020526040902054163314610a745760405163437ca6cf60e11b815260040160405180910390fd5b610a7f6000836112dc565b6001600160a01b0382166000908152600260209081526040808320546004835281842054600790935292205442831115610af3576000610abf4285611d06565b6001600160a01b038716600090815260036020526040902054909150610ae59082611d19565b610aef9083611d30565b9150505b6000610aff8286611d30565b90506000610b0d8483611d59565b905080600003610b3057604051630639c74d60e41b815260040160405180910390fd5b6000610b3c8542611d30565b604080518981526020810185905242818301526060810183905290519192506001600160a01b038a16917f27c87675510fe43d389c54bf8b9276579c58f76ee37830eaa44024f26714039e9181900360800190a26001600160a01b03881660009081526003602090815260408083208590556005825280832042905560029091529020819055610bcc8584611d6d565b6001600160a01b03808a16600090815260076020526040902091909155610c17907f00000000000000000000000041252e8691e964f7de35156b68493bab6797a2751633308a611407565b5050505050505050565b336001600160a01b037f00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f1614610c6a576040516358825a2960e01b815260040160405180910390fd5b610c768484848461143f565b826001600160a01b0316846001600160a01b03167f88f2b86ac62356711c096194cb8bcc4996fecfc20017ecedc832fa22522ffd6460405160405180910390a350505050565b6001600160a01b03811660009081526004602090815260408083205460039092528220546105dc9190611d19565b610cf433826111e1565b50565b60008181526001602052604081206105dc906114e9565b600082815260208190526040902060010154610d2981610ff8565b61093983836111bf565b336000818152600b602090815260409182902080546001600160a01b0319166001600160a01b03861690811790915591519182527f544fb4d1dd5512696562d1958798242e3927c26c6551e1cb0e400a7b98b2877b910160405180910390a250565b336001600160a01b037f00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f1614610dde576040516390978d9160e01b815260040160405180910390fd5b6001600160a01b038281166000908152600a60205260409020541615610e1757604051634c55dc7d60e01b815260040160405180910390fd5b6001600160a01b038281166000818152600a6020908152604080832080546001600160a01b0319169587169586179055600482529182902062093a809055905192835290917f2ff7dd9798a312e08e07b783e71b4c29955046589e17c4fe968b2b759b8b80bb910160405180910390a2816001600160a01b03167fad2f86b01ed93b4b3a150d448c61a4f5d8d38075d3c0c64cc0a26fd6e1f4954562093a80604051610ec591815260200190565b60405180910390a25050565b604051635305548160e01b81526001600160a01b0382811660048301526000916105dc9184917f00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f909116906353055481906024016107ad565b610f348282610a11565b6109bd576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610f6a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006107f8836001600160a01b0384166114f3565b60006001600160e01b03198216637965db0b60e01b14806105dc57506301ffc9a760e01b6001600160e01b03198316146105dc565b610cf48133611542565b6040516001600160a01b03831660248201526044810182905261093990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261159b565b60008160000361108e57506001600160a01b0382166000908152600660205260409020546105dc565b6001600160a01b0383166000908152600360209081526040808320546005909252909120548391906110bf866109c1565b6110c99190611d06565b6110d39190611d19565b6110e590670de0b6b3a7640000611d19565b6110ef9190611d59565b6001600160a01b0384166000908152600660205260409020546107f89190611d30565b6001600160a01b038085166000908152600860209081526040808320938716835292905290812054670de0b6b3a76400009061114e9084611d06565b6111589085611d19565b6111629190611d59565b6001600160a01b038087166000908152600960209081526040808320938916835292905220546111929190611d30565b90505b949350505050565b6111a78282610f2a565b60008281526001602052604090206109399082610fae565b6111c98282611670565b600082815260016020526040902061093990826116d5565b6111eb82826112dc565b6001600160a01b038083166000908152600960209081526040808320938516835292905220548015610939576001600160a01b03808416600081815260096020908152604080832087861684528252808320839055928252600b9052205416806112525750825b604080518381526001600160a01b03838116602083015280861692908716917f7fe1dfb5fd2a01640e1b559e082ce63e369d4d61e01dc0caec9521e55a8d1e4f910160405180910390a36106ba6001600160a01b037f00000000000000000000000041252e8691e964f7de35156b68493bab6797a275168284611002565b60006107f883836116ea565b604051633de222bb60e21b81526001600160a01b03838116600483015282811660248301526109bd91849184917f00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f9091169063f7888aec90604401602060405180830381865afa158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611cd7565b604051635305548160e01b81526001600160a01b0386811660048301527f00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f1690635305548190602401602060405180830381865afa1580156113de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114029190611cd7565b61143f565b6040516001600160a01b03808516602483015283166044820152606481018290526106ba9085906323b872dd60e01b9060840161102e565b600061144b8483611065565b6001600160a01b03851660009081526006602052604090208190559050611471846109c1565b6001600160a01b038086166000908152600560205260409020919091558516156114e2576114a185858584611112565b6001600160a01b038087166000818152600960209081526040808320948a168084529482528083209590955591815260088252838120928152919052208190555b5050505050565b60006105dc825490565b600081815260018301602052604081205461153a575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105dc565b5060006105dc565b61154c8282610a11565b6109bd5761155981611714565b611564836020611726565b604051602001611575929190611da5565b60408051601f198184030181529082905262461bcd60e51b82526109aa91600401611e1a565b60006115f0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166118c29092919063ffffffff16565b90508051600014806116115750808060200190518101906116119190611e4d565b6109395760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109aa565b61167a8282610a11565b156109bd576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006107f8836001600160a01b0384166118d1565b600082600001828154811061170157611701611e6f565b9060005260206000200154905092915050565b60606105dc6001600160a01b03831660145b60606000611735836002611d19565b611740906002611d30565b67ffffffffffffffff81111561175857611758611e85565b6040519080825280601f01601f191660200182016040528015611782576020820181803683370190505b509050600360fc1b8160008151811061179d5761179d611e6f565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106117cc576117cc611e6f565b60200101906001600160f81b031916908160001a90535060006117f0846002611d19565b6117fb906001611d30565b90505b6001811115611873576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061182f5761182f611e6f565b1a60f81b82828151811061184557611845611e6f565b60200101906001600160f81b031916908160001a90535060049490941c9361186c81611e9b565b90506117fe565b5083156107f85760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109aa565b606061119584846000856119c4565b600081815260018301602052604081205480156119ba5760006118f5600183611d06565b855490915060009061190990600190611d06565b905081811461196e57600086600001828154811061192957611929611e6f565b906000526020600020015490508087600001848154811061194c5761194c611e6f565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061197f5761197f611eb2565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105dc565b60009150506105dc565b606082471015611a255760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109aa565b600080866001600160a01b03168587604051611a419190611ec8565b60006040518083038185875af1925050503d8060008114611a7e576040519150601f19603f3d011682016040523d82523d6000602084013e611a83565b606091505b5091509150611a9487838387611a9f565b979650505050505050565b60608315611b0e578251600003611b07576001600160a01b0385163b611b075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109aa565b5081611195565b6111958383815115611b235781518083602001fd5b8060405162461bcd60e51b81526004016109aa9190611e1a565b600060208284031215611b4f57600080fd5b81356001600160e01b0319811681146107f857600080fd5b80356001600160a01b0381168114611b7e57600080fd5b919050565b600080600060608486031215611b9857600080fd5b611ba184611b67565b9250611baf60208501611b67565b9150604084013590509250925092565b60008060408385031215611bd257600080fd5b611bdb83611b67565b9150611be960208401611b67565b90509250929050565b600060208284031215611c0457600080fd5b6107f882611b67565b60008060408385031215611c2057600080fd5b611c2983611b67565b946020939093013593505050565b600060208284031215611c4957600080fd5b5035919050565b60008060408385031215611c6357600080fd5b82359150611be960208401611b67565b60008060408385031215611c8657600080fd5b50508035926020909101359150565b60008060008060808587031215611cab57600080fd5b611cb485611b67565b9350611cc260208601611b67565b93969395505050506040820135916060013590565b600060208284031215611ce957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105dc576105dc611cf0565b80820281158282048414176105dc576105dc611cf0565b808201808211156105dc576105dc611cf0565b634e487b7160e01b600052601260045260246000fd5b600082611d6857611d68611d43565b500490565b600082611d7c57611d7c611d43565b500690565b60005b83811015611d9c578181015183820152602001611d84565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611ddd816017850160208801611d81565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611e0e816028840160208801611d81565b01602801949350505050565b6020815260008251806020840152611e39816040850160208701611d81565b601f01601f19169190910160400192915050565b600060208284031215611e5f57600080fd5b815180151581146107f857600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600081611eaa57611eaa611cf0565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251611eda818460208701611d81565b919091019291505056fea2646970667358221220c592791591fba8c7de8deea9ea31f302646e855e76b63b90b639935322a7a9e664736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000041252e8691e964f7de35156b68493bab6797a27500000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f0000000000000000000000007bd578354b0b2f02e656f1bdc0e41a80f860534b000000000000000000000000705f82bb431fada1a0f11d7b77b3f0586c545cbc
-----Decoded View---------------
Arg [0] : rewardsToken_ (address): 0x41252E8691e964f7DE35156B68493bAb6797a275
Arg [1] : stakingDelegate_ (address): 0x05dcdBF02F29239D1f8d9797E22589A2DE1C152F
Arg [2] : admin (address): 0x7Bd578354b0B2f02E656f1bDC0e41a80f860534b
Arg [3] : timeLock (address): 0x705F82BB431fAdA1a0F11D7b77B3f0586c545CBc
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000041252e8691e964f7de35156b68493bab6797a275
Arg [1] : 00000000000000000000000005dcdbf02f29239d1f8d9797e22589a2de1c152f
Arg [2] : 0000000000000000000000007bd578354b0b2f02e656f1bdc0e41a80f860534b
Arg [3] : 000000000000000000000000705f82bb431fada1a0f11d7b77b3f0586c545cbc
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.