Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Multicall | 19594525 | 319 days ago | IN | 0 ETH | 0.00280224 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
19594524 | 319 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
MiniChefV3
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 { Multicall } from "@openzeppelin/contracts/utils/Multicall.sol"; import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol"; import { IMiniChefV3Rewarder } from "src/interfaces/rewards/IMiniChefV3Rewarder.sol"; import { SelfPermit } from "src/deps/uniswap/v3-periphery/base/SelfPermit.sol"; import { Rescuable } from "src/Rescuable.sol"; import { Errors } from "src/libraries/Errors.sol"; import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; /** * @title MiniChefV3 * @notice A contract for managing staking, rewards, and pool information for liquidity providers. * @dev This contract handles the logic for staking LP tokens, distributing rewards, and managing pool information. * It supports multiple reward tokens through external rewarder contracts and includes emergency withdrawal * functionality. It does not support rebasing or fee on transfer tokens. */ contract MiniChefV3 is Multicall, AccessControlEnumerable, Rescuable, SelfPermit, Pausable { using SafeERC20 for IERC20; struct UserInfo { /// @dev The amount of LP tokens the user has deposited into the pool. uint256 amount; /// @dev The reward debt indicates how much REWARD_TOKEN the user has already been accounted for. uint256 rewardDebt; /// @dev The amount of REWARD_TOKEN rewards that the user has earned but not yet claimed. uint256 unpaidRewards; } struct PoolInfo { /// @dev Accumulated REWARD_TOKENs per share, scaled to precision. uint160 accRewardPerShare; /// @dev The last timestamp when the pool's rewards were calculated. uint64 lastRewardTime; /// @dev The number of allocation points assigned to the pool, which determines the share of reward /// distribution. uint32 allocPoint; } /// @notice Address of REWARD_TOKEN contract. // slither-disable-next-line naming-convention,similar-names IERC20 public immutable REWARD_TOKEN; /// @notice Info of each MCV3 pool. PoolInfo[] private _poolInfo; /// @notice Address of the LP token for each MCV3 pool. IERC20[] public lpToken; /// @notice Total amount of LP token staked in each MCV3 pool. uint256[] public lpSupply; /// @notice Address of each `IRewarder` contract in MCV3. IMiniChefV3Rewarder[] public rewarder; /// @notice Info of each user that stakes LP tokens. mapping(uint256 => mapping(address => UserInfo)) private _userInfo; /// @dev PID of the LP token plus one. mapping(address => uint256) private _pidPlusOne; /// @dev Total allocation points. Must be the sum of all allocation points in all pools. uint256 public totalAllocPoint; /// @notice The amount of REWARD_TOKEN distributed per second. uint256 public rewardPerSecond; /// @notice The amount of REWARD_TOKEN available in this contract for distribution. uint256 public availableReward; /// @notice The maximum amount of REWARD_TOKEN that can be distributed per second. uint256 public constant MAX_REWARD_TOKEN_PER_SECOND = 100_000_000 ether / uint256(1 weeks); /// @dev Precision factor to calculate accumulated reward tokens per share. uint256 private constant _ACC_REWARD_TOKEN_PRECISION = 1e12; /// @dev The timelock role for the contract. bytes32 public constant TIMELOCK_ROLE = keccak256("TIMELOCK_ROLE"); /// @dev The pauser role for the contract. bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @notice Emitted when a user deposits LP tokens into a pool. * @param user The address of the user making the deposit. * @param pid The pool ID into which the deposit is made. * @param amount The amount of LP tokens deposited. * @param to The address receiving the deposit. */ event Deposit(address indexed user, uint256 indexed pid, uint256 amount, address indexed to); /** * @notice Emitted when a user withdraws LP tokens from a pool. * @param user The address of the user making the withdrawal. * @param pid The pool ID from which the withdrawal is made. * @param amount The amount of LP tokens withdrawn. * @param to The address receiving the withdrawn LP tokens. */ event Withdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed to); /** * @notice Emitted when a user performs an emergency withdrawal of LP tokens from a pool. * @param user The address of the user making the emergency withdrawal. * @param pid The pool ID from which the emergency withdrawal is made. * @param amount The amount of LP tokens emergency withdrawn. * @param to The address receiving the emergency withdrawn LP tokens. */ event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed to); /** * @notice Emitted when a user harvests reward tokens from a pool. * @param user The address of the user performing the harvest. * @param pid The pool ID from which the harvest is performed. * @param amount The amount of reward tokens harvested. */ event Harvest(address indexed user, uint256 indexed pid, uint256 amount); /** * @notice Emitted when a new pool is added to the MiniChef contract. * @param pid The pool ID of the newly added pool. * @param allocPoint The number of allocation points assigned to the new pool. * @param lpToken The address of the LP token for the new pool. * @param rewarder The address of the rewarder contract for the new pool. */ event LogPoolAddition( uint256 indexed pid, uint256 allocPoint, IERC20 indexed lpToken, IMiniChefV3Rewarder indexed rewarder ); /** * @notice Emitted when a pool's configuration is updated. * @param pid The pool ID of the updated pool. * @param allocPoint The new number of allocation points assigned to the pool. * @param rewarder The address of the rewarder contract for the pool. * @param overwrite Indicates whether the update overwrites the existing rewarder contract. */ event LogSetPool(uint256 indexed pid, uint256 allocPoint, IMiniChefV3Rewarder indexed rewarder, bool overwrite); /** * @notice Emitted when a pool's rewards are updated. * @param pid The pool ID of the updated pool. * @param lastRewardTime The last timestamp when the pool's rewards were calculated. * @param lpSupply The total amount of LP tokens staked in the pool. * @param accRewardPerShare The accumulated reward tokens per share, scaled to precision. */ event LogUpdatePool(uint256 indexed pid, uint64 lastRewardTime, uint256 lpSupply, uint256 accRewardPerShare); /** * @notice Emitted when the reward per second is updated. * @param rewardPerSecond The new amount of reward tokens distributed per second. */ event LogRewardPerSecond(uint256 rewardPerSecond); /** * @notice Emitted when a reward amount is committed for distribution. * @param amount The amount of reward tokens committed. */ event LogRewardCommitted(uint256 amount); /** * @notice Emitted when an emergency withdrawal from a rewarder contract is faulty. * @param user The address of the user performing the emergency withdrawal. * @param pid The pool ID from which the emergency withdrawal is made. * @param amount The amount of tokens emergency withdrawn. * @param to The address receiving the emergency withdrawn tokens. */ event LogRewarderEmergencyWithdrawFaulty( address indexed user, uint256 indexed pid, uint256 amount, address indexed to ); /** * @dev Constructs the MiniChefV3 contract with a specified reward token and admin address. * @param rewardToken_ The ERC20 token to be used as the reward token. * @param admin The address that will be granted the default admin role. */ constructor(IERC20 rewardToken_, address admin, address pauser) payable { if (address(rewardToken_) == address(0) || admin == address(0)) { revert Errors.ZeroAddress(); } REWARD_TOKEN = rewardToken_; _grantRole(DEFAULT_ADMIN_ROLE, admin); _grantRole(PAUSER_ROLE, pauser); _grantRole(TIMELOCK_ROLE, admin); // 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 } /// @notice Returns the number of MCV3 pools. function poolLength() public view returns (uint256 pools) { pools = _poolInfo.length; } /** * @notice Retrieves the pool ID of a given LP token. * @dev Returns the pool ID by looking up the LP token address in the `_pidPlusOne` mapping. * @param lpToken_ The LP token to query the pool ID for. * @return pid The pool ID of the given LP token. */ function pidOfLPToken(IERC20 lpToken_) external view returns (uint256 pid) { uint256 pidPlusOne = _pidPlusOne[address(lpToken_)]; // slither-disable-next-line timestamp if (pidPlusOne <= 0) { revert Errors.InvalidLPToken(); } /// @dev The unchecked block is used here because the subtraction is safe from underflow. /// The condition above ensures that `pidPlusOne` is greater than zero, so subtracting one will not underflow. unchecked { pid = pidPlusOne - 1; } } /** * @notice Checks if an LP token has been added to any pool. * @dev Returns true if the LP token exists in the `_pidPlusOne` mapping. * @param lpToken_ The LP token to check. * @return added True if the LP token has been added to a pool. */ function isLPTokenAdded(IERC20 lpToken_) external view returns (bool added) { // slither-disable-next-line timestamp added = _pidPlusOne[address(lpToken_)] != 0; } /** * @notice Retrieves user information for a specific pool. * @dev Returns the user's staked amount, reward debt, and unpaid rewards for a given pool. * @param pid The pool ID to retrieve user information for. * @param user The user address to retrieve information for. * @return info The user's information for the specified pool. */ function getUserInfo(uint256 pid, address user) external view returns (UserInfo memory info) { info = _userInfo[pid][user]; } /** * @notice Retrieves pool information for a specific pool ID. * @dev Returns the pool's accumulated reward per share, last reward time, and allocation points. * @param pid The pool ID to retrieve information for. * @return info The pool's information. */ function getPoolInfo(uint256 pid) external view returns (PoolInfo memory info) { info = _poolInfo[pid]; } /** * @notice Add a new LP to the pool. Can only be called by the owner. * DO NOT add the same LP token more than once. Rewards will be messed up if you do. * @param allocPoint AP of the new pool. * @param lpToken_ Address of the LP ERC-20 token. * @param rewarder_ Address of the rewarder delegate. */ function add(uint32 allocPoint, IERC20 lpToken_, IMiniChefV3Rewarder rewarder_) public onlyRole(TIMELOCK_ROLE) { if (address(lpToken_) == (address(0))) { revert Errors.ZeroAddress(); } if (_pidPlusOne[address(lpToken_)] != 0) { revert Errors.LPTokenAlreadyAdded(); } totalAllocPoint = totalAllocPoint + allocPoint; lpToken.push(lpToken_); lpSupply.push(0); rewarder.push(rewarder_); _poolInfo.push( PoolInfo({ allocPoint: allocPoint, lastRewardTime: uint64(block.timestamp), accRewardPerShare: 0 }) ); uint256 pid = _poolInfo.length - 1; _pidPlusOne[address(lpToken_)] = pid + 1; emit LogPoolAddition(pid, allocPoint, lpToken_, rewarder_); } /** * @notice Update the given pool's REWARD_TOKEN allocation point and `IRewarder` contract. Can only be called by * the owner. * @param pid The index of the pool. See `_poolInfo`. * @param allocPoint New AP of the pool. * @param lpToken_ Address of the LP ERC-20 token. * @param rewarder_ Address of the rewarder delegate. * @param overwrite True if rewarder_ should be `set`. Otherwise `rewarder_` is ignored. */ function set( uint256 pid, uint32 allocPoint, IERC20 lpToken_, IMiniChefV3Rewarder rewarder_, bool overwrite ) public onlyRole(TIMELOCK_ROLE) { uint256 pidPlusOne = _pidPlusOne[address(lpToken_)]; if (pidPlusOne < 1) { revert Errors.LPTokenNotAdded(); } if (pidPlusOne != pid + 1) { revert Errors.LPTokenDoesNotMatchPoolId(); } totalAllocPoint = totalAllocPoint - _poolInfo[pid].allocPoint + allocPoint; _poolInfo[pid].allocPoint = allocPoint; if (overwrite) { rewarder[pid] = rewarder_; } emit LogSetPool(pid, allocPoint, overwrite ? rewarder_ : rewarder[pid], overwrite); } /* * @notice Rescue ERC20 tokens from the contract. * @param token The address of the ERC20 token to rescue. * @param to The address to send the rescued tokens to. * @param amount The amount of tokens to rescue. * @dev Rescue is only allowed when there is a discrepancy between balanceOf this and lpSupply. */ function rescue(IERC20 token, address to, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) { uint256 pidPlusOne = _pidPlusOne[address(token)]; uint256 availableForRescue = token.balanceOf(address(this)); if (pidPlusOne != 0) { availableForRescue -= lpSupply[pidPlusOne - 1]; } // Consider the special case where token is the reward token. if (token == REWARD_TOKEN) { availableForRescue -= availableReward; } if (amount > availableForRescue) { revert Errors.InsufficientBalance(); } if (amount != 0) { _rescue(token, to, amount); } } /** * @notice Sets the reward per second to be distributed. Can only be called by the owner. * @param rewardPerSecond_ The amount of reward token to be distributed per second. */ function setRewardPerSecond(uint256 rewardPerSecond_) public onlyRole(TIMELOCK_ROLE) { if (rewardPerSecond_ > MAX_REWARD_TOKEN_PER_SECOND) { revert Errors.RewardRateTooHigh(); } rewardPerSecond = rewardPerSecond_; emit LogRewardPerSecond(rewardPerSecond_); } /** * @notice Commits REWARD_TOKEN to the contract for distribution. * @param amount The amount of REWARD_TOKEN to commit. */ function commitReward(uint256 amount) external { availableReward = availableReward + amount; emit LogRewardCommitted(amount); REWARD_TOKEN.safeTransferFrom(msg.sender, address(this), amount); } /** * @notice View function to see pending REWARD_TOKEN on frontend. * @param pid The index of the pool. See `_poolInfo`. * @param user_ Address of user. * @return pending REWARD_TOKEN reward for a given user. */ function pendingReward(uint256 pid, address user_) external view returns (uint256 pending) { PoolInfo memory pool = _poolInfo[pid]; UserInfo storage user = _userInfo[pid][user_]; uint256 accRewardPerShare = pool.accRewardPerShare; uint256 lpSupply_ = lpSupply[pid]; uint256 totalAllocPoint_ = totalAllocPoint; // slither-disable-next-line timestamp if (block.timestamp > pool.lastRewardTime) { if (lpSupply_ != 0) { if (totalAllocPoint_ != 0) { // @dev unchecked is used as the subtraction is guaranteed to not underflow because // `block.timestamp` is always greater than `pool.lastRewardTime`. uint256 time; unchecked { time = block.timestamp - pool.lastRewardTime; } // Explicitly round down when calculating the reward // slither-disable-start divide-before-multiply uint256 rewardAmount = time * rewardPerSecond * pool.allocPoint / totalAllocPoint_; accRewardPerShare += rewardAmount * _ACC_REWARD_TOKEN_PRECISION / lpSupply_; // slither-disable-end divide-before-multiply } } } pending = (user.amount * accRewardPerShare / _ACC_REWARD_TOKEN_PRECISION) - user.rewardDebt + user.unpaidRewards; } /** * @notice Update reward variables of the given pool. * @param pid The index of the pool. See `_poolInfo`. * @return pool Returns the pool that was updated. */ function updatePool(uint256 pid) public returns (PoolInfo memory pool) { pool = _poolInfo[pid]; // slither-disable-next-line timestamp if (block.timestamp > pool.lastRewardTime) { uint256 lpSupply_ = lpSupply[pid]; uint256 totalAllocPoint_ = totalAllocPoint; if (lpSupply_ != 0) { if (totalAllocPoint_ != 0) { // @dev unchecked is used as the subtraction is guaranteed to not underflow because // `block.timestamp` is always greater than `pool.lastRewardTime`. uint256 time; unchecked { time = block.timestamp - pool.lastRewardTime; } // Explicitly round down when calculating the reward // slither-disable-start divide-before-multiply uint256 rewardAmount = time * rewardPerSecond * pool.allocPoint / totalAllocPoint_; pool.accRewardPerShare += SafeCast.toUint160(rewardAmount * _ACC_REWARD_TOKEN_PRECISION / lpSupply_); // slither-disable-end divide-before-multiply } } pool.lastRewardTime = uint64(block.timestamp); _poolInfo[pid] = pool; emit LogUpdatePool(pid, pool.lastRewardTime, lpSupply_, pool.accRewardPerShare); } } /** * @notice Deposit LP tokens to MCV3 for REWARD_TOKEN allocation. * @dev Deposits can be paused in case of emergencies by the admin or pauser roles. * @param pid The index of the pool. See `_poolInfo`. * @param amount LP token amount to deposit. * @param to The receiver of `amount` deposit benefit. */ function deposit(uint256 pid, uint256 amount, address to) public whenNotPaused { if (amount == 0) { revert Errors.ZeroAmount(); } PoolInfo memory pool = updatePool(pid); UserInfo storage user = _userInfo[pid][to]; // Effects user.amount += amount; user.rewardDebt += amount * pool.accRewardPerShare / _ACC_REWARD_TOKEN_PRECISION; /// @dev += is slightly more gas efficient (5300) than the alternative (5365) using solidity 0.8.18. /// The rule only applies to non-mapping storage variables. // nosemgrep: inefficient-state-variable-increment lpSupply[pid] += amount; emit Deposit(msg.sender, pid, amount, to); // Interactions lpToken[pid].safeTransferFrom(msg.sender, address(this), amount); IMiniChefV3Rewarder _rewarder = rewarder[pid]; if (address(_rewarder) != address(0)) { _rewarder.onReward(pid, to, to, 0, user.amount); } } /** * @notice Withdraw LP tokens from MCV3. * @param pid The index of the pool. See `_poolInfo`. * @param amount LP token amount to withdraw. * @param to Receiver of the LP tokens. */ function harvestAndWithdraw(uint256 pid, uint256 amount, address to) public { if (amount == 0) { revert Errors.ZeroAmount(); } PoolInfo memory pool = updatePool(pid); UserInfo storage user = _userInfo[pid][msg.sender]; uint256 accumulatedReward = user.amount * pool.accRewardPerShare / _ACC_REWARD_TOKEN_PRECISION; uint256 pendingReward_ = accumulatedReward + user.unpaidRewards - user.rewardDebt; // Effects user.rewardDebt = accumulatedReward - amount * pool.accRewardPerShare / _ACC_REWARD_TOKEN_PRECISION; user.amount -= amount; lpSupply[pid] -= amount; uint256 rewardAmount = 0; if (pendingReward_ != 0) { uint256 availableReward_ = availableReward; uint256 unpaidRewards_ = 0; rewardAmount = pendingReward_ > availableReward_ ? availableReward_ : pendingReward_; /// @dev unchecked is used as the subtraction is guaranteed to not underflow because /// `rewardAmount` is always less than or equal to `availableReward_`. unchecked { availableReward -= rewardAmount; unpaidRewards_ = pendingReward_ - rewardAmount; } user.unpaidRewards = unpaidRewards_; // Interactions if (rewardAmount != 0) { emit Harvest(msg.sender, pid, rewardAmount); // slither-disable-next-line reentrancy-events REWARD_TOKEN.safeTransfer(to, rewardAmount); } } // Interactions emit Withdraw(msg.sender, pid, amount, to); lpToken[pid].safeTransfer(to, amount); IMiniChefV3Rewarder _rewarder = rewarder[pid]; if (address(_rewarder) != address(0)) { _rewarder.onReward(pid, msg.sender, to, rewardAmount, user.amount); } } /** * @notice Harvest proceeds for transaction sender to `to`. * @param pid The index of the pool. See `_poolInfo`. * @param to Receiver of REWARD_TOKEN rewards. */ function harvest(uint256 pid, address to) public { PoolInfo memory pool = updatePool(pid); UserInfo storage user = _userInfo[pid][msg.sender]; uint256 accumulatedReward = user.amount * pool.accRewardPerShare / _ACC_REWARD_TOKEN_PRECISION; uint256 pendingReward_ = accumulatedReward - user.rewardDebt + user.unpaidRewards; // Effects user.rewardDebt = accumulatedReward; // Interactions uint256 rewardAmount = 0; if (pendingReward_ != 0) { uint256 availableReward_ = availableReward; uint256 unpaidRewards_ = 0; rewardAmount = pendingReward_ > availableReward_ ? availableReward_ : pendingReward_; /// @dev unchecked is used as the subtraction is guaranteed to not underflow because /// `rewardAmount` is always less than or equal to `availableReward_`. unchecked { availableReward -= rewardAmount; unpaidRewards_ = pendingReward_ - rewardAmount; } user.unpaidRewards = unpaidRewards_; if (rewardAmount != 0) { emit Harvest(msg.sender, pid, rewardAmount); REWARD_TOKEN.safeTransfer(to, rewardAmount); } } IMiniChefV3Rewarder _rewarder = rewarder[pid]; if (address(_rewarder) != address(0)) { _rewarder.onReward(pid, msg.sender, to, rewardAmount, user.amount); } } /** * @notice Withdraw without caring about rewards. EMERGENCY ONLY. * @param pid The index of the pool. See `_poolInfo`. * @param to Receiver of the LP tokens. */ function emergencyWithdraw(uint256 pid, address to) public { UserInfo storage user = _userInfo[pid][msg.sender]; uint256 amount = user.amount; emit EmergencyWithdraw(msg.sender, pid, amount, to); // Effects user.amount = 0; user.rewardDebt = 0; user.unpaidRewards = 0; lpSupply[pid] -= amount; // Interactions // Note: transfer can fail or succeed if `amount` is zero. lpToken[pid].safeTransfer(to, amount); IMiniChefV3Rewarder _rewarder = rewarder[pid]; if (address(_rewarder) != address(0)) { bytes memory data = abi.encodeCall(IMiniChefV3Rewarder.onReward, (pid, msg.sender, to, 0, 0)); uint256 gasBefore = gasleft(); // slither-disable-next-line missing-zero-check,return-bomb,low-level-calls (bool success,) = address(_rewarder).call{ gas: gasBefore }(data); // Protect against griefing via specifying low gas to trigger a revert in the callee // https://ronan.eth.limo/blog/ethereum-gas-dangers/ // https://www.rareskills.io/post/eip-150-and-the-63-64-rule-for-gas if (gasleft() <= gasBefore / 63) { revert Errors.InsufficientGas(); } if (!success) { // slither-disable-next-line reentrancy-events emit LogRewarderEmergencyWithdrawFaulty(msg.sender, pid, amount, to); } } } /** * @dev Pauses the contract. Only callable by PAUSER_ROLE or DEFAULT_ADMIN_ROLE. */ function pause() external { if (!(hasRole(PAUSER_ROLE, msg.sender) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender))) { revert Errors.Unauthorized(); } _pause(); } /** * @dev Unpauses the contract. Only callable by DEFAULT_ADMIN_ROLE. */ function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) { _unpause(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.5) (utils/Multicall.sol) pragma solidity ^0.8.0; import "./Address.sol"; import "./Context.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * Consider any assumption about calldata validation performed by the sender may be violated if it's not especially * careful about sending transactions invoking {multicall}. For example, a relay address that filters function * selectors won't filter calls nested within a {multicall} operation. * * NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}). * If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data` * to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of * {_msgSender} are not propagated to subcalls. * * _Available since v4.1._ */ abstract contract Multicall is Context { /** * @dev Receives and executes a batch of function calls on this contract. * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { bytes memory context = msg.sender == _msgSender() ? new bytes(0) : msg.data[msg.data.length - _contextSuffixLength():]; results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), bytes.concat(data[i], context)); } return results; } }
// 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: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.18; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IMiniChefV3Rewarder { function onReward( uint256 pid, address user, address recipient, uint256 rewardAmount, uint256 newLpAmount ) external; function pendingTokens( uint256 pid, address user, uint256 rewardAmount ) external view returns (IERC20[] memory, uint256[] memory); }
// Forked from // https://github.com/Uniswap/v3-periphery/blob/5b4b9c603b2f728dade87871af2207ce1edab6b2/contracts/base/SelfPermit.sol // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import { ISelfPermit } from "src/interfaces/deps/uniswap/v3-periphery/ISelfPermit.sol"; import { IERC20PermitAllowed } from "src/interfaces/deps/uniswap/v3-periphery/external/IERC20PermitAllowed.sol"; /// @title Self Permit /// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route /// @dev These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a /// function /// that requires an approval in a single transaction. abstract contract SelfPermit is ISelfPermit { /// @inheritdoc ISelfPermit function selfPermit( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public payable override { IERC20Permit(token).permit(msg.sender, address(this), value, deadline, v, r, s); } /// @inheritdoc ISelfPermit function selfPermitIfNecessary( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable override { if (IERC20(token).allowance(msg.sender, address(this)) < value) selfPermit(token, value, deadline, v, r, s); } /// @inheritdoc ISelfPermit function selfPermitAllowed( address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public payable override { IERC20PermitAllowed(token).permit(msg.sender, address(this), nonce, expiry, true, v, r, s); } /// @inheritdoc ISelfPermit function selfPermitAllowedIfNecessary( address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external payable override { if (IERC20(token).allowance(msg.sender, address(this)) < type(uint256).max) { selfPermitAllowed(token, nonce, expiry, v, r, s); } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Errors } from "src/libraries/Errors.sol"; /** * @title Rescuable * @notice Allows the inheriting contract to rescue ERC20 tokens that are sent to it by mistake. */ contract Rescuable { // Libraries using SafeERC20 for IERC20; /** * @dev Rescue any ERC20 tokens that are stuck in this contract. * The inheriting contract that calls this function should specify required access controls * @param token address of the ERC20 token to rescue. Use zero address for ETH * @param to address to send the tokens to * @param balance amount of tokens to rescue. Use zero to rescue all */ function _rescue(IERC20 token, address to, uint256 balance) internal { if (address(token) == address(0)) { // for ether uint256 totalBalance = address(this).balance; balance = balance != 0 ? Math.min(totalBalance, balance) : totalBalance; if (balance != 0) { // slither-disable-next-line arbitrary-send // slither-disable-next-line low-level-calls (bool success,) = to.call{ value: balance }(""); if (!success) revert Errors.EthTransferFailed(); return; } revert Errors.ZeroEthTransfer(); } else { // for any other erc20 uint256 totalBalance = token.balanceOf(address(this)); balance = balance != 0 ? Math.min(totalBalance, balance) : totalBalance; if (balance != 0) { token.safeTransfer(to, balance); return; } revert Errors.ZeroTokenTransfer(); } } }
// 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: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 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: GPL-2.0-or-later pragma solidity >=0.7.5; /// @title Self Permit /// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route interface ISelfPermit { /// @notice Permits this contract to spend a given token from `msg.sender` /// @dev The `owner` is always msg.sender and the `spender` is always address(this). /// @param token The address of the token spent /// @param value The amount that can be spent of token /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function selfPermit( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; /// @notice Permits this contract to spend a given token from `msg.sender` /// @dev The `owner` is always msg.sender and the `spender` is always address(this). /// Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit /// @param token The address of the token spent /// @param value The amount that can be spent of token /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function selfPermitIfNecessary( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` /// parameter /// @dev The `owner` is always msg.sender and the `spender` is always address(this) /// @param token The address of the token spent /// @param nonce The current nonce of the owner /// @param expiry The timestamp at which the permit is no longer valid /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function selfPermitAllowed( address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external payable; /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` /// parameter /// @dev The `owner` is always msg.sender and the `spender` is always address(this) /// Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to /// #selfPermitAllowed. /// @param token The address of the token spent /// @param nonce The current nonce of the owner /// @param expiry The timestamp at which the permit is no longer valid /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function selfPermitAllowedIfNecessary( address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Interface for permit /// @notice Interface used by DAI/CHAI for permit interface IERC20PermitAllowed { /// @notice Approve the spender to spend some tokens via the holder signature /// @dev This is the permit interface used by DAI and CHAI /// @param holder The address of the token holder, the token owner /// @param spender The address of the token spender /// @param nonce The holder's nonce, increases at each call to permit /// @param expiry The timestamp at which the permit is no longer valid /// @param allowed Boolean that sets approval amount, true for type(uint256).max and false for 0 /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function permit( address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s ) external; }
// 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 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.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.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":"contract IERC20","name":"rewardToken_","type":"address"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"pauser","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"EthTransferFailed","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientGas","type":"error"},{"inputs":[],"name":"InvalidLPToken","type":"error"},{"inputs":[],"name":"LPTokenAlreadyAdded","type":"error"},{"inputs":[],"name":"LPTokenDoesNotMatchPoolId","type":"error"},{"inputs":[],"name":"LPTokenNotAdded","type":"error"},{"inputs":[],"name":"RewardRateTooHigh","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"ZeroEthTransfer","type":"error"},{"inputs":[],"name":"ZeroTokenTransfer","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"lpToken","type":"address"},{"indexed":true,"internalType":"contract IMiniChefV3Rewarder","name":"rewarder","type":"address"}],"name":"LogPoolAddition","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LogRewardCommitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerSecond","type":"uint256"}],"name":"LogRewardPerSecond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"LogRewarderEmergencyWithdrawFaulty","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":true,"internalType":"contract IMiniChefV3Rewarder","name":"rewarder","type":"address"},{"indexed":false,"internalType":"bool","name":"overwrite","type":"bool"}],"name":"LogSetPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"lastRewardTime","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"lpSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accRewardPerShare","type":"uint256"}],"name":"LogUpdatePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REWARD_TOKEN_PER_SECOND","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TIMELOCK_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"allocPoint","type":"uint32"},{"internalType":"contract IERC20","name":"lpToken_","type":"address"},{"internalType":"contract IMiniChefV3Rewarder","name":"rewarder_","type":"address"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"commitReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"getPoolInfo","outputs":[{"components":[{"internalType":"uint160","name":"accRewardPerShare","type":"uint160"},{"internalType":"uint64","name":"lastRewardTime","type":"uint64"},{"internalType":"uint32","name":"allocPoint","type":"uint32"}],"internalType":"struct MiniChefV3.PoolInfo","name":"info","type":"tuple"}],"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":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserInfo","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"unpaidRewards","type":"uint256"}],"internalType":"struct MiniChefV3.UserInfo","name":"info","type":"tuple"}],"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":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"harvestAndWithdraw","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":"contract IERC20","name":"lpToken_","type":"address"}],"name":"isLPTokenAdded","outputs":[{"internalType":"bool","name":"added","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lpSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lpToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"user_","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"pending","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"lpToken_","type":"address"}],"name":"pidOfLPToken","outputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"pools","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescue","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":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewarder","outputs":[{"internalType":"contract IMiniChefV3Rewarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint32","name":"allocPoint","type":"uint32"},{"internalType":"contract IERC20","name":"lpToken_","type":"address"},{"internalType":"contract IMiniChefV3Rewarder","name":"rewarder_","type":"address"},{"internalType":"bool","name":"overwrite","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardPerSecond_","type":"uint256"}],"name":"setRewardPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"updatePool","outputs":[{"components":[{"internalType":"uint160","name":"accRewardPerShare","type":"uint160"},{"internalType":"uint64","name":"lastRewardTime","type":"uint64"},{"internalType":"uint32","name":"allocPoint","type":"uint32"}],"internalType":"struct MiniChefV3.PoolInfo","name":"pool","type":"tuple"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040526040516200372f3803806200372f8339810160408190526200002691620002ac565b6002805460ff191690556001600160a01b03831615806200004e57506001600160a01b038216155b156200006d5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831660805262000087600083620000f2565b620000b37f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a82620000f2565b620000ce6000805160206200370f83398151915283620000f2565b620000e96000805160206200370f8339815191528062000135565b50505062000300565b6200010982826200018060201b620021631760201c565b600082815260016020908152604090912062000130918390620021e762000221821b17901c565b505050565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200021d576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001dc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000238836001600160a01b03841662000241565b90505b92915050565b60008181526001830160205260408120546200028a575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200023b565b5060006200023b565b6001600160a01b0381168114620002a957600080fd5b50565b600080600060608486031215620002c257600080fd5b8351620002cf8162000293565b6020850151909350620002e28162000293565b6040850151909250620002f58162000293565b809150509250925092565b6080516133d7620003386000396000818161067c01528181610c1c01528181610def0152818161100b01526120e401526133d76000f3fe60806040526004361061025c5760003560e01c806366da581511610144578063ac9650d8116100b6578063d547741f1161007a578063d547741f14610766578063dbba4fe414610786578063e63ab1e91461079b578063ec57afd1146107cf578063f288a2e2146107ef578063f3995c671461081157600080fd5b8063ac9650d8146106c6578063c18468e5146106f3578063c2e3140a14610713578063c346253d14610726578063ca15c8731461074657600080fd5b80639010d07c116101085780639010d07c1461060a57806391d148541461062a57806398969e821461064a57806399248ea71461066a578063a217fddf1461069e578063a4a78f0c146106b357600080fd5b806366da58151461056757806378ed5d1f146105875780638456cb59146105bf5780638dbdbe6d146105d45780638f10369a146105f457600080fd5b80632f2ff15d116101dd5780633f4ba83a116101a15780633f4ba83a146104b957806345231069146104ce5780634659a494146105065780634ad84b341461051957806351eb05a61461052f5780635c975abb1461054f57600080fd5b80632f2ff15d146103df5780632f380b35146103ff5780632f940c70146104595780633523e88f1461047957806336568abe1461049957600080fd5b806318fccc761161022457806318fccc761461032f5780631fcfdfdf1461034f57806320ff430b1461036f578063248a9ca31461038f5780632c8bcaf6146103bf57600080fd5b8063016f7e9b1461026157806301ffc9a714610283578063081e3eda146102b85780631069f3b5146102d757806317caf6f114610319575b600080fd5b34801561026d57600080fd5b5061028161027c366004612d70565b610824565b005b34801561028f57600080fd5b506102a361029e366004612db9565b610a87565b60405190151581526020015b60405180910390f35b3480156102c457600080fd5b506003545b6040519081526020016102af565b3480156102e357600080fd5b506102f76102f2366004612de3565b610ab2565b60408051825181526020808401519082015291810151908201526060016102af565b34801561032557600080fd5b506102c960095481565b34801561033b57600080fd5b5061028161034a366004612de3565b610b1f565b34801561035b57600080fd5b506102c961036a366004612e13565b610cea565b34801561037b57600080fd5b5061028161038a366004612e30565b610d2b565b34801561039b57600080fd5b506102c96103aa366004612e71565b60009081526020819052604090206001015490565b3480156103cb57600080fd5b506102816103da366004612e8a565b610e70565b3480156103eb57600080fd5b506102816103fa366004612de3565b61115c565b34801561040b57600080fd5b5061041f61041a366004612e71565b611186565b6040805182516001600160a01b031681526020808401516001600160401b0316908201529181015163ffffffff16908201526060016102af565b34801561046557600080fd5b50610281610474366004612de3565b61120e565b34801561048557600080fd5b50610281610494366004612ec6565b611440565b3480156104a557600080fd5b506102816104b4366004612de3565b611621565b3480156104c557600080fd5b506102816116a4565b3480156104da57600080fd5b506102a36104e9366004612e13565b6001600160a01b0316600090815260086020526040902054151590565b610281610514366004612f2c565b6116ba565b34801561052557600080fd5b506102c9600b5481565b34801561053b57600080fd5b5061041f61054a366004612e71565b61174f565b34801561055b57600080fd5b5060025460ff166102a3565b34801561057357600080fd5b50610281610582366004612e71565b61196e565b34801561059357600080fd5b506105a76105a2366004612e71565b6119fa565b6040516001600160a01b0390911681526020016102af565b3480156105cb57600080fd5b50610281611a24565b3480156105e057600080fd5b506102816105ef366004612e8a565b611a85565b34801561060057600080fd5b506102c9600a5481565b34801561061657600080fd5b506105a7610625366004612f8e565b611c47565b34801561063657600080fd5b506102a3610645366004612de3565b611c66565b34801561065657600080fd5b506102c9610665366004612de3565b611c8f565b34801561067657600080fd5b506105a77f000000000000000000000000000000000000000000000000000000000000000081565b3480156106aa57600080fd5b506102c9600081565b6102816106c1366004612f2c565b611e0f565b3480156106d257600080fd5b506106e66106e1366004612fb0565b611e95565b6040516102af9190613074565b3480156106ff57600080fd5b506102c961070e366004612e71565b611f87565b610281610721366004612f2c565b611fa8565b34801561073257600080fd5b506105a7610741366004612e71565b61202c565b34801561075257600080fd5b506102c9610761366004612e71565b61203c565b34801561077257600080fd5b50610281610781366004612de3565b612053565b34801561079257600080fd5b506102c9612078565b3480156107a757600080fd5b506102c97f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b3480156107db57600080fd5b506102816107ea366004612e71565b612093565b3480156107fb57600080fd5b506102c960008051602061335b83398151915281565b61028161081f366004612f2c565b61210c565b60008051602061335b83398151915261083c816121fc565b6001600160a01b0383166108635760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600860205260409020541561089a5760405163e558bd2960e01b815260040160405180910390fd5b8363ffffffff166009546108ae91906130ec565b6009556004805460018181019092557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b038087166001600160a01b0319928316179092556005805480850190915560007f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0909101819055600680548086019091557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018054878516931692909217909155604080516060810182528281526001600160401b034281166020830190815263ffffffff808c1694840194855260038054808a01825581885294517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b909501805493519651909216600160e01b026001600160e01b0396909416600160a01b026001600160e01b03199093169490971693909317179290921691909117905590549091610a15916130ff565b9050610a228160016130ec565b6001600160a01b03858116600081815260086020908152604091829020949094555163ffffffff8916815291861692909184917f81ee0f8c5c46e2cb41984886f77a84181724abb86c32a5f6de539b07509d45e5910160405180910390a45050505050565b60006001600160e01b03198216635a05180f60e01b1480610aac5750610aac82612206565b92915050565b610ad660405180606001604052806000815260200160008152602001600081525090565b5060009182526007602090815260408084206001600160a01b03909316845291815291819020815160608101835281548152600182015493810193909352600201549082015290565b6000610b2a8361174f565b6000848152600760209081526040808320338452909152812082518154939450909264e8d4a5100091610b68916001600160a01b0390911690613112565b610b729190613129565b905060008260020154836001015483610b8b91906130ff565b610b9591906130ec565b60018401839055905060008115610c4657600b546000818411610bb85783610bba565b815b600b805482900390558085036002880181905590935090508215610c4357604051838152899033907f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249549060200160405180910390a3610c436001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016898561223b565b50505b600060068881548110610c5b57610c5b61314b565b6000918252602090912001546001600160a01b031690508015610ce05784546040516344af0fa760e01b81526001600160a01b038316916344af0fa791610cad918c9133918d91899190600401613161565b600060405180830381600087803b158015610cc757600080fd5b505af1158015610cdb573d6000803e3d6000fd5b505050505b5050505050505050565b6001600160a01b03811660009081526008602052604081205480610d2157604051633d06185960e21b815260040160405180910390fd5b6000190192915050565b6000610d36816121fc565b6001600160a01b0384166000818152600860205260408082205490516370a0823160e01b81523060048201529092906370a0823190602401602060405180830381865afa158015610d8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610daf9190613190565b90508115610ded576005610dc46001846130ff565b81548110610dd457610dd461314b565b906000526020600020015481610dea91906130ff565b90505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b031603610e3657600b54610e3390826130ff565b90505b80841115610e5757604051631e9acf1760e31b815260040160405180910390fd5b8315610e6857610e6886868661229e565b505050505050565b81600003610e9157604051631f2a200560e01b815260040160405180910390fd5b6000610e9c8461174f565b6000858152600760209081526040808320338452909152812082518154939450909264e8d4a5100091610eda916001600160a01b0390911690613112565b610ee49190613129565b905060008260010154836002015483610efd91906130ec565b610f0791906130ff565b845190915064e8d4a5100090610f26906001600160a01b031688613112565b610f309190613129565b610f3a90836130ff565b6001840155825486908490600090610f539084906130ff565b925050819055508560058881548110610f6e57610f6e61314b565b906000526020600020016000828254610f8791906130ff565b9091555060009050811561103557600b546000818411610fa75783610fa9565b815b600b805482900390558085036002880181905590935090508215611032576040518381528a9033907f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249549060200160405180910390a36110326001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016898561223b565b50505b856001600160a01b031688336001600160a01b03167f8166bf25f8a2b7ed3c85049207da4358d16edbed977d23fa2ee6f0dde3ec21328a60405161107b91815260200190565b60405180910390a46110b7868860048b8154811061109b5761109b61314b565b6000918252602090912001546001600160a01b0316919061223b565b6000600689815481106110cc576110cc61314b565b6000918252602090912001546001600160a01b0316905080156111515784546040516344af0fa760e01b81526001600160a01b038316916344af0fa79161111e918d9133918d91899190600401613161565b600060405180830381600087803b15801561113857600080fd5b505af115801561114c573d6000803e3d6000fd5b505050505b505050505050505050565b600082815260208190526040902060010154611177816121fc565b611181838361241a565b505050565b6040805160608101825260008082526020820181905291810191909152600382815481106111b6576111b661314b565b60009182526020918290206040805160608101825291909201546001600160a01b03811682526001600160401b03600160a01b8204169382019390935263ffffffff600160e01b909304929092169082015292915050565b600082815260076020908152604080832033808552925291829020805492519092916001600160a01b038516918691907f2cac5e20e1541d836381527a43f651851e302817b71dc8e810284e69210c1c6b9061126d9086815260200190565b60405180910390a46000808355600183018190556002830155600580548291908690811061129d5761129d61314b565b9060005260206000200160008282546112b691906130ff565b925050819055506112d583826004878154811061109b5761109b61314b565b6000600685815481106112ea576112ea61314b565b6000918252602090912001546001600160a01b031690508015611439576000853386600080604051602401611323959493929190613161565b60408051601f198184030181529190526020810180516001600160e01b03166344af0fa760e01b179052905060005a90506000836001600160a01b0316828460405161136f91906131a9565b60006040518083038160008787f1925050503d80600081146113ad576040519150601f19603f3d011682016040523d82523d6000602084013e6113b2565b606091505b50509050603f826113c39190613129565b5a116113e2576040516307099c5360e21b815260040160405180910390fd5b80610ce057866001600160a01b031688336001600160a01b03167f56910fe7c9ffb3e13c65c1e345036b908085766a39b7e0fe840f54d2ac7add588860405161142d91815260200190565b60405180910390a45050505b5050505050565b60008051602061335b833981519152611458816121fc565b6001600160a01b038416600090815260086020526040902054600181101561149357604051639d8e98a760e01b815260040160405180910390fd5b61149e8760016130ec565b81146114bd5760405163a554875f60e01b815260040160405180910390fd5b8563ffffffff16600388815481106114d7576114d761314b565b6000918252602090912001546009546114fd91600160e01b900463ffffffff16906130ff565b61150791906130ec565b60098190555085600388815481106115215761152161314b565b90600052602060002001600001601c6101000a81548163ffffffff021916908363ffffffff16021790555082156115955783600688815481106115665761156661314b565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b826115c757600687815481106115ad576115ad61314b565b6000918252602090912001546001600160a01b03166115c9565b835b6040805163ffffffff8916815285151560208201526001600160a01b03929092169189917f95895a6ab1df54420d241b55243258a33e61b2194db66c1179ec521aae8e1865910160405180910390a350505050505050565b6001600160a01b03811633146116965760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6116a0828261243c565b5050565b60006116af816121fc565b6116b761245e565b50565b6040516323f2ebc360e21b815233600482015230602482015260448101869052606481018590526001608482015260ff841660a482015260c4810183905260e481018290526001600160a01b03871690638fcbaf0c90610104015b600060405180830381600087803b15801561172f57600080fd5b505af1158015611743573d6000803e3d6000fd5b50505050505050505050565b60408051606081018252600080825260208201819052918101919091526003828154811061177f5761177f61314b565b60009182526020918290206040805160608101825292909101546001600160a01b0381168352600160a01b81046001600160401b0316938301849052600160e01b900463ffffffff16908201529150421115611969576000600583815481106117ea576117ea61314b565b600091825260209091200154600954909150811561188e57801561188e57600083602001516001600160401b031642039050600082856040015163ffffffff16600a54846118389190613112565b6118429190613112565b61184c9190613129565b90506118708461186164e8d4a5100084613112565b61186b9190613129565b6124b0565b8551869061187f9083906131c5565b6001600160a01b031690525050505b6001600160401b034216602084015260038054849190869081106118b4576118b461314b565b60009182526020918290208351910180548484015160409586015163ffffffff16600160e01b026001600160e01b036001600160401b03928316600160a01b026001600160e01b03199094166001600160a01b03968716179390931792909216919091179091558683015187518551919092168152928301869052169181019190915284907f0fc9545022a542541ad085d091fb09a2ab36fee366a4576ab63714ea907ad3539060600160405180910390a250505b919050565b60008051602061335b833981519152611986816121fc565b61199e62093a806a52b7d2dcc80cd2e4000000613129565b8211156119be57604051633c6be1b360e01b815260040160405180910390fd5b600a8290556040518281527fde89cb17ac7f58f94792b3e91e086ed85403819c24ceea882491f960ccb1a2789060200160405180910390a15050565b60048181548110611a0a57600080fd5b6000918252602090912001546001600160a01b0316905081565b611a4e7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33611c66565b80611a5f5750611a5f600033611c66565b611a7b576040516282b42960e81b815260040160405180910390fd5b611a8361251d565b565b611a8d61255a565b81600003611aae57604051631f2a200560e01b815260040160405180910390fd5b6000611ab98461174f565b60008581526007602090815260408083206001600160a01b0387168452909152812080549293509185918391611af09084906130ec565b9091555050815164e8d4a5100090611b11906001600160a01b031686613112565b611b1b9190613129565b816001016000828254611b2e91906130ec565b925050819055508360058681548110611b4957611b4961314b565b906000526020600020016000828254611b6291906130ec565b90915550506040518481526001600160a01b03841690869033907f02d7e648dd130fc184d383e55bb126ac4c9c60e8f94bf05acdf557ba2d540b479060200160405180910390a4611bdf33308660048981548110611bc257611bc261314b565b6000918252602090912001546001600160a01b03169291906125a0565b600060068681548110611bf457611bf461314b565b6000918252602090912001546001600160a01b031690508015610e685781546040516344af0fa760e01b81526001600160a01b038316916344af0fa791611715918a918991829160009190600401613161565b6000828152600160205260408120611c5f90836125d8565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008060038481548110611ca557611ca561314b565b600091825260208083206040805160608101825293909101546001600160a01b038082168552600160a01b82046001600160401b031685850152600160e01b90910463ffffffff16848301528885526007835281852088821686529092528320825160058054949650919492169288908110611d2357611d2361314b565b906000526020600020015490506000600954905084602001516001600160401b0316421115611dc7578115611dc7578015611dc757600085602001516001600160401b031642039050600082876040015163ffffffff16600a5484611d889190613112565b611d929190613112565b611d9c9190613129565b905083611dae64e8d4a5100083613112565b611db89190613129565b611dc290866130ec565b945050505b60028401546001850154855464e8d4a5100090611de5908790613112565b611def9190613129565b611df991906130ff565b611e0391906130ec565b98975050505050505050565b604051636eb1769f60e11b8152336004820152306024820152600019906001600160a01b0388169063dd62ed3e90604401602060405180830381865afa158015611e5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e819190613190565b1015610e6857610e688686868686866116ba565b604080516000815260208101909152606090826001600160401b03811115611ebf57611ebf6131e5565b604051908082528060200260200182016040528015611ef257816020015b6060815260200190600190039081611edd5790505b50915060005b83811015611f7f57611f4f30868684818110611f1657611f1661314b565b9050602002810190611f2891906131fb565b85604051602001611f3b93929190613248565b6040516020818303038152906040526125e4565b838281518110611f6157611f6161314b565b60200260200101819052508080611f779061326f565b915050611ef8565b505092915050565b60058181548110611f9757600080fd5b600091825260209091200154905081565b604051636eb1769f60e11b815233600482015230602482015285906001600160a01b0388169063dd62ed3e90604401602060405180830381865afa158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120189190613190565b1015610e6857610e6886868686868661210c565b60068181548110611a0a57600080fd5b6000818152600160205260408120610aac90612609565b60008281526020819052604090206001015461206e816121fc565b611181838361243c565b61209062093a806a52b7d2dcc80cd2e4000000613129565b81565b80600b546120a191906130ec565b600b556040518181527f2d81fae00823ef9dcc72e88330c926409fe2ccb8601b77d68a6f73e27b6323429060200160405180910390a16116b76001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330846125a0565b60405163d505accf60e01b8152336004820152306024820152604481018690526064810185905260ff8416608482015260a4810183905260c481018290526001600160a01b0387169063d505accf9060e401611715565b61216d8282611c66565b6116a0576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556121a33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611c5f836001600160a01b038416612613565b6116b78133612662565b60006001600160e01b03198216637965db0b60e01b1480610aac57506301ffc9a760e01b6001600160e01b0319831614610aac565b6040516001600160a01b03831660248201526044810182905261118190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526126bb565b6001600160a01b03831661235b574760008290036122bc57806122c6565b6122c68183612790565b91508115612342576000836001600160a01b03168360405160006040518083038185875af1925050503d806000811461231b576040519150601f19603f3d011682016040523d82523d6000602084013e612320565b606091505b505090508061143957604051630db2c7f160e31b815260040160405180910390fd5b604051637c3d101560e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156123a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c69190613190565b9050816000036123d657806123e0565b6123e08183612790565b91508115612402576123fc6001600160a01b038516848461223b565b50505050565b604051625689bb60e41b815260040160405180910390fd5b6124248282612163565b600082815260016020526040902061118190826121e7565b61244682826127a6565b6000828152600160205260409020611181908261280b565b612466612820565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60006001600160a01b038211156125195760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663630206269747360c81b606482015260840161168d565b5090565b61252561255a565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586124933390565b60025460ff1615611a835760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161168d565b6040516001600160a01b03808516602483015283166044820152606481018290526123fc9085906323b872dd60e01b90608401612267565b6000611c5f8383612869565b6060611c5f838360405180606001604052806027815260200161337b60279139612893565b6000610aac825490565b600081815260018301602052604081205461265a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610aac565b506000610aac565b61266c8282611c66565b6116a0576126798161290b565b61268483602061291d565b604051602001612695929190613288565b60408051601f198184030181529082905262461bcd60e51b825261168d916004016132fd565b6000612710826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ab89092919063ffffffff16565b90508051600014806127315750808060200190518101906127319190613310565b6111815760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161168d565b600081831061279f5781611c5f565b5090919050565b6127b08282611c66565b156116a0576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611c5f836001600160a01b038416612acf565b60025460ff16611a835760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161168d565b60008260000182815481106128805761288061314b565b9060005260206000200154905092915050565b6060600080856001600160a01b0316856040516128b091906131a9565b600060405180830381855af49150503d80600081146128eb576040519150601f19603f3d011682016040523d82523d6000602084013e6128f0565b606091505b509150915061290186838387612bc9565b9695505050505050565b6060610aac6001600160a01b03831660145b6060600061292c836002613112565b6129379060026130ec565b6001600160401b0381111561294e5761294e6131e5565b6040519080825280601f01601f191660200182016040528015612978576020820181803683370190505b509050600360fc1b816000815181106129935761299361314b565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106129c2576129c261314b565b60200101906001600160f81b031916908160001a90535060006129e6846002613112565b6129f19060016130ec565b90505b6001811115612a69576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612a2557612a2561314b565b1a60f81b828281518110612a3b57612a3b61314b565b60200101906001600160f81b031916908160001a90535060049490941c93612a628161332d565b90506129f4565b508315611c5f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161168d565b6060612ac78484600085612c42565b949350505050565b60008181526001830160205260408120548015612bb8576000612af36001836130ff565b8554909150600090612b07906001906130ff565b9050818114612b6c576000866000018281548110612b2757612b2761314b565b9060005260206000200154905080876000018481548110612b4a57612b4a61314b565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612b7d57612b7d613344565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610aac565b6000915050610aac565b5092915050565b60608315612c38578251600003612c31576001600160a01b0385163b612c315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161168d565b5081612ac7565b612ac78383612d1d565b606082471015612ca35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161168d565b600080866001600160a01b03168587604051612cbf91906131a9565b60006040518083038185875af1925050503d8060008114612cfc576040519150601f19603f3d011682016040523d82523d6000602084013e612d01565b606091505b5091509150612d1287838387612bc9565b979650505050505050565b815115612d2d5781518083602001fd5b8060405162461bcd60e51b815260040161168d91906132fd565b803563ffffffff8116811461196957600080fd5b6001600160a01b03811681146116b757600080fd5b600080600060608486031215612d8557600080fd5b612d8e84612d47565b92506020840135612d9e81612d5b565b91506040840135612dae81612d5b565b809150509250925092565b600060208284031215612dcb57600080fd5b81356001600160e01b031981168114611c5f57600080fd5b60008060408385031215612df657600080fd5b823591506020830135612e0881612d5b565b809150509250929050565b600060208284031215612e2557600080fd5b8135611c5f81612d5b565b600080600060608486031215612e4557600080fd5b8335612e5081612d5b565b92506020840135612e6081612d5b565b929592945050506040919091013590565b600060208284031215612e8357600080fd5b5035919050565b600080600060608486031215612e9f57600080fd5b83359250602084013591506040840135612dae81612d5b565b80151581146116b757600080fd5b600080600080600060a08688031215612ede57600080fd5b85359450612eee60208701612d47565b93506040860135612efe81612d5b565b92506060860135612f0e81612d5b565b91506080860135612f1e81612eb8565b809150509295509295909350565b60008060008060008060c08789031215612f4557600080fd5b8635612f5081612d5b565b95506020870135945060408701359350606087013560ff81168114612f7457600080fd5b9598949750929560808101359460a0909101359350915050565b60008060408385031215612fa157600080fd5b50508035926020909101359150565b60008060208385031215612fc357600080fd5b82356001600160401b0380821115612fda57600080fd5b818501915085601f830112612fee57600080fd5b813581811115612ffd57600080fd5b8660208260051b850101111561301257600080fd5b60209290920196919550909350505050565b60005b8381101561303f578181015183820152602001613027565b50506000910152565b60008151808452613060816020860160208601613024565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156130c957603f198886030184526130b7858351613048565b9450928501929085019060010161309b565b5092979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610aac57610aac6130d6565b81810381811115610aac57610aac6130d6565b8082028115828204841417610aac57610aac6130d6565b60008261314657634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b9485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b6000602082840312156131a257600080fd5b5051919050565b600082516131bb818460208701613024565b9190910192915050565b6001600160a01b03818116838216019080821115612bc257612bc26130d6565b634e487b7160e01b600052604160045260246000fd5b6000808335601e1984360301811261321257600080fd5b8301803591506001600160401b0382111561322c57600080fd5b60200191503681900382131561324157600080fd5b9250929050565b828482376000838201600081528351613265818360208801613024565b0195945050505050565b600060018201613281576132816130d6565b5060010190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516132c0816017850160208801613024565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516132f1816028840160208801613024565b01602801949350505050565b602081526000611c5f6020830184613048565b60006020828403121561332257600080fd5b8151611c5f81612eb8565b60008161333c5761333c6130d6565b506000190190565b634e487b7160e01b600052603160045260246000fdfef66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f05416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208742341ceb7bcaa33ec4cb57c0fa5de235d6b82172a6bfbb4681d0559a1ad60e64736f6c63430008120033f66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0500000000000000000000000032fb7d6e0cbeb9433772689aa4647828cc7cbba80000000000000000000000008842fe65a7db9bb5de6d50e49af19496da09f9b500000000000000000000000071bdc5f3aba49538c76d58bc2ab4e3a1118dae4c
Deployed Bytecode
0x60806040526004361061025c5760003560e01c806366da581511610144578063ac9650d8116100b6578063d547741f1161007a578063d547741f14610766578063dbba4fe414610786578063e63ab1e91461079b578063ec57afd1146107cf578063f288a2e2146107ef578063f3995c671461081157600080fd5b8063ac9650d8146106c6578063c18468e5146106f3578063c2e3140a14610713578063c346253d14610726578063ca15c8731461074657600080fd5b80639010d07c116101085780639010d07c1461060a57806391d148541461062a57806398969e821461064a57806399248ea71461066a578063a217fddf1461069e578063a4a78f0c146106b357600080fd5b806366da58151461056757806378ed5d1f146105875780638456cb59146105bf5780638dbdbe6d146105d45780638f10369a146105f457600080fd5b80632f2ff15d116101dd5780633f4ba83a116101a15780633f4ba83a146104b957806345231069146104ce5780634659a494146105065780634ad84b341461051957806351eb05a61461052f5780635c975abb1461054f57600080fd5b80632f2ff15d146103df5780632f380b35146103ff5780632f940c70146104595780633523e88f1461047957806336568abe1461049957600080fd5b806318fccc761161022457806318fccc761461032f5780631fcfdfdf1461034f57806320ff430b1461036f578063248a9ca31461038f5780632c8bcaf6146103bf57600080fd5b8063016f7e9b1461026157806301ffc9a714610283578063081e3eda146102b85780631069f3b5146102d757806317caf6f114610319575b600080fd5b34801561026d57600080fd5b5061028161027c366004612d70565b610824565b005b34801561028f57600080fd5b506102a361029e366004612db9565b610a87565b60405190151581526020015b60405180910390f35b3480156102c457600080fd5b506003545b6040519081526020016102af565b3480156102e357600080fd5b506102f76102f2366004612de3565b610ab2565b60408051825181526020808401519082015291810151908201526060016102af565b34801561032557600080fd5b506102c960095481565b34801561033b57600080fd5b5061028161034a366004612de3565b610b1f565b34801561035b57600080fd5b506102c961036a366004612e13565b610cea565b34801561037b57600080fd5b5061028161038a366004612e30565b610d2b565b34801561039b57600080fd5b506102c96103aa366004612e71565b60009081526020819052604090206001015490565b3480156103cb57600080fd5b506102816103da366004612e8a565b610e70565b3480156103eb57600080fd5b506102816103fa366004612de3565b61115c565b34801561040b57600080fd5b5061041f61041a366004612e71565b611186565b6040805182516001600160a01b031681526020808401516001600160401b0316908201529181015163ffffffff16908201526060016102af565b34801561046557600080fd5b50610281610474366004612de3565b61120e565b34801561048557600080fd5b50610281610494366004612ec6565b611440565b3480156104a557600080fd5b506102816104b4366004612de3565b611621565b3480156104c557600080fd5b506102816116a4565b3480156104da57600080fd5b506102a36104e9366004612e13565b6001600160a01b0316600090815260086020526040902054151590565b610281610514366004612f2c565b6116ba565b34801561052557600080fd5b506102c9600b5481565b34801561053b57600080fd5b5061041f61054a366004612e71565b61174f565b34801561055b57600080fd5b5060025460ff166102a3565b34801561057357600080fd5b50610281610582366004612e71565b61196e565b34801561059357600080fd5b506105a76105a2366004612e71565b6119fa565b6040516001600160a01b0390911681526020016102af565b3480156105cb57600080fd5b50610281611a24565b3480156105e057600080fd5b506102816105ef366004612e8a565b611a85565b34801561060057600080fd5b506102c9600a5481565b34801561061657600080fd5b506105a7610625366004612f8e565b611c47565b34801561063657600080fd5b506102a3610645366004612de3565b611c66565b34801561065657600080fd5b506102c9610665366004612de3565b611c8f565b34801561067657600080fd5b506105a77f00000000000000000000000032fb7d6e0cbeb9433772689aa4647828cc7cbba881565b3480156106aa57600080fd5b506102c9600081565b6102816106c1366004612f2c565b611e0f565b3480156106d257600080fd5b506106e66106e1366004612fb0565b611e95565b6040516102af9190613074565b3480156106ff57600080fd5b506102c961070e366004612e71565b611f87565b610281610721366004612f2c565b611fa8565b34801561073257600080fd5b506105a7610741366004612e71565b61202c565b34801561075257600080fd5b506102c9610761366004612e71565b61203c565b34801561077257600080fd5b50610281610781366004612de3565b612053565b34801561079257600080fd5b506102c9612078565b3480156107a757600080fd5b506102c97f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b3480156107db57600080fd5b506102816107ea366004612e71565b612093565b3480156107fb57600080fd5b506102c960008051602061335b83398151915281565b61028161081f366004612f2c565b61210c565b60008051602061335b83398151915261083c816121fc565b6001600160a01b0383166108635760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600860205260409020541561089a5760405163e558bd2960e01b815260040160405180910390fd5b8363ffffffff166009546108ae91906130ec565b6009556004805460018181019092557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b038087166001600160a01b0319928316179092556005805480850190915560007f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0909101819055600680548086019091557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018054878516931692909217909155604080516060810182528281526001600160401b034281166020830190815263ffffffff808c1694840194855260038054808a01825581885294517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b909501805493519651909216600160e01b026001600160e01b0396909416600160a01b026001600160e01b03199093169490971693909317179290921691909117905590549091610a15916130ff565b9050610a228160016130ec565b6001600160a01b03858116600081815260086020908152604091829020949094555163ffffffff8916815291861692909184917f81ee0f8c5c46e2cb41984886f77a84181724abb86c32a5f6de539b07509d45e5910160405180910390a45050505050565b60006001600160e01b03198216635a05180f60e01b1480610aac5750610aac82612206565b92915050565b610ad660405180606001604052806000815260200160008152602001600081525090565b5060009182526007602090815260408084206001600160a01b03909316845291815291819020815160608101835281548152600182015493810193909352600201549082015290565b6000610b2a8361174f565b6000848152600760209081526040808320338452909152812082518154939450909264e8d4a5100091610b68916001600160a01b0390911690613112565b610b729190613129565b905060008260020154836001015483610b8b91906130ff565b610b9591906130ec565b60018401839055905060008115610c4657600b546000818411610bb85783610bba565b815b600b805482900390558085036002880181905590935090508215610c4357604051838152899033907f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249549060200160405180910390a3610c436001600160a01b037f00000000000000000000000032fb7d6e0cbeb9433772689aa4647828cc7cbba816898561223b565b50505b600060068881548110610c5b57610c5b61314b565b6000918252602090912001546001600160a01b031690508015610ce05784546040516344af0fa760e01b81526001600160a01b038316916344af0fa791610cad918c9133918d91899190600401613161565b600060405180830381600087803b158015610cc757600080fd5b505af1158015610cdb573d6000803e3d6000fd5b505050505b5050505050505050565b6001600160a01b03811660009081526008602052604081205480610d2157604051633d06185960e21b815260040160405180910390fd5b6000190192915050565b6000610d36816121fc565b6001600160a01b0384166000818152600860205260408082205490516370a0823160e01b81523060048201529092906370a0823190602401602060405180830381865afa158015610d8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610daf9190613190565b90508115610ded576005610dc46001846130ff565b81548110610dd457610dd461314b565b906000526020600020015481610dea91906130ff565b90505b7f00000000000000000000000032fb7d6e0cbeb9433772689aa4647828cc7cbba86001600160a01b0316866001600160a01b031603610e3657600b54610e3390826130ff565b90505b80841115610e5757604051631e9acf1760e31b815260040160405180910390fd5b8315610e6857610e6886868661229e565b505050505050565b81600003610e9157604051631f2a200560e01b815260040160405180910390fd5b6000610e9c8461174f565b6000858152600760209081526040808320338452909152812082518154939450909264e8d4a5100091610eda916001600160a01b0390911690613112565b610ee49190613129565b905060008260010154836002015483610efd91906130ec565b610f0791906130ff565b845190915064e8d4a5100090610f26906001600160a01b031688613112565b610f309190613129565b610f3a90836130ff565b6001840155825486908490600090610f539084906130ff565b925050819055508560058881548110610f6e57610f6e61314b565b906000526020600020016000828254610f8791906130ff565b9091555060009050811561103557600b546000818411610fa75783610fa9565b815b600b805482900390558085036002880181905590935090508215611032576040518381528a9033907f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249549060200160405180910390a36110326001600160a01b037f00000000000000000000000032fb7d6e0cbeb9433772689aa4647828cc7cbba816898561223b565b50505b856001600160a01b031688336001600160a01b03167f8166bf25f8a2b7ed3c85049207da4358d16edbed977d23fa2ee6f0dde3ec21328a60405161107b91815260200190565b60405180910390a46110b7868860048b8154811061109b5761109b61314b565b6000918252602090912001546001600160a01b0316919061223b565b6000600689815481106110cc576110cc61314b565b6000918252602090912001546001600160a01b0316905080156111515784546040516344af0fa760e01b81526001600160a01b038316916344af0fa79161111e918d9133918d91899190600401613161565b600060405180830381600087803b15801561113857600080fd5b505af115801561114c573d6000803e3d6000fd5b505050505b505050505050505050565b600082815260208190526040902060010154611177816121fc565b611181838361241a565b505050565b6040805160608101825260008082526020820181905291810191909152600382815481106111b6576111b661314b565b60009182526020918290206040805160608101825291909201546001600160a01b03811682526001600160401b03600160a01b8204169382019390935263ffffffff600160e01b909304929092169082015292915050565b600082815260076020908152604080832033808552925291829020805492519092916001600160a01b038516918691907f2cac5e20e1541d836381527a43f651851e302817b71dc8e810284e69210c1c6b9061126d9086815260200190565b60405180910390a46000808355600183018190556002830155600580548291908690811061129d5761129d61314b565b9060005260206000200160008282546112b691906130ff565b925050819055506112d583826004878154811061109b5761109b61314b565b6000600685815481106112ea576112ea61314b565b6000918252602090912001546001600160a01b031690508015611439576000853386600080604051602401611323959493929190613161565b60408051601f198184030181529190526020810180516001600160e01b03166344af0fa760e01b179052905060005a90506000836001600160a01b0316828460405161136f91906131a9565b60006040518083038160008787f1925050503d80600081146113ad576040519150601f19603f3d011682016040523d82523d6000602084013e6113b2565b606091505b50509050603f826113c39190613129565b5a116113e2576040516307099c5360e21b815260040160405180910390fd5b80610ce057866001600160a01b031688336001600160a01b03167f56910fe7c9ffb3e13c65c1e345036b908085766a39b7e0fe840f54d2ac7add588860405161142d91815260200190565b60405180910390a45050505b5050505050565b60008051602061335b833981519152611458816121fc565b6001600160a01b038416600090815260086020526040902054600181101561149357604051639d8e98a760e01b815260040160405180910390fd5b61149e8760016130ec565b81146114bd5760405163a554875f60e01b815260040160405180910390fd5b8563ffffffff16600388815481106114d7576114d761314b565b6000918252602090912001546009546114fd91600160e01b900463ffffffff16906130ff565b61150791906130ec565b60098190555085600388815481106115215761152161314b565b90600052602060002001600001601c6101000a81548163ffffffff021916908363ffffffff16021790555082156115955783600688815481106115665761156661314b565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b826115c757600687815481106115ad576115ad61314b565b6000918252602090912001546001600160a01b03166115c9565b835b6040805163ffffffff8916815285151560208201526001600160a01b03929092169189917f95895a6ab1df54420d241b55243258a33e61b2194db66c1179ec521aae8e1865910160405180910390a350505050505050565b6001600160a01b03811633146116965760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6116a0828261243c565b5050565b60006116af816121fc565b6116b761245e565b50565b6040516323f2ebc360e21b815233600482015230602482015260448101869052606481018590526001608482015260ff841660a482015260c4810183905260e481018290526001600160a01b03871690638fcbaf0c90610104015b600060405180830381600087803b15801561172f57600080fd5b505af1158015611743573d6000803e3d6000fd5b50505050505050505050565b60408051606081018252600080825260208201819052918101919091526003828154811061177f5761177f61314b565b60009182526020918290206040805160608101825292909101546001600160a01b0381168352600160a01b81046001600160401b0316938301849052600160e01b900463ffffffff16908201529150421115611969576000600583815481106117ea576117ea61314b565b600091825260209091200154600954909150811561188e57801561188e57600083602001516001600160401b031642039050600082856040015163ffffffff16600a54846118389190613112565b6118429190613112565b61184c9190613129565b90506118708461186164e8d4a5100084613112565b61186b9190613129565b6124b0565b8551869061187f9083906131c5565b6001600160a01b031690525050505b6001600160401b034216602084015260038054849190869081106118b4576118b461314b565b60009182526020918290208351910180548484015160409586015163ffffffff16600160e01b026001600160e01b036001600160401b03928316600160a01b026001600160e01b03199094166001600160a01b03968716179390931792909216919091179091558683015187518551919092168152928301869052169181019190915284907f0fc9545022a542541ad085d091fb09a2ab36fee366a4576ab63714ea907ad3539060600160405180910390a250505b919050565b60008051602061335b833981519152611986816121fc565b61199e62093a806a52b7d2dcc80cd2e4000000613129565b8211156119be57604051633c6be1b360e01b815260040160405180910390fd5b600a8290556040518281527fde89cb17ac7f58f94792b3e91e086ed85403819c24ceea882491f960ccb1a2789060200160405180910390a15050565b60048181548110611a0a57600080fd5b6000918252602090912001546001600160a01b0316905081565b611a4e7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33611c66565b80611a5f5750611a5f600033611c66565b611a7b576040516282b42960e81b815260040160405180910390fd5b611a8361251d565b565b611a8d61255a565b81600003611aae57604051631f2a200560e01b815260040160405180910390fd5b6000611ab98461174f565b60008581526007602090815260408083206001600160a01b0387168452909152812080549293509185918391611af09084906130ec565b9091555050815164e8d4a5100090611b11906001600160a01b031686613112565b611b1b9190613129565b816001016000828254611b2e91906130ec565b925050819055508360058681548110611b4957611b4961314b565b906000526020600020016000828254611b6291906130ec565b90915550506040518481526001600160a01b03841690869033907f02d7e648dd130fc184d383e55bb126ac4c9c60e8f94bf05acdf557ba2d540b479060200160405180910390a4611bdf33308660048981548110611bc257611bc261314b565b6000918252602090912001546001600160a01b03169291906125a0565b600060068681548110611bf457611bf461314b565b6000918252602090912001546001600160a01b031690508015610e685781546040516344af0fa760e01b81526001600160a01b038316916344af0fa791611715918a918991829160009190600401613161565b6000828152600160205260408120611c5f90836125d8565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008060038481548110611ca557611ca561314b565b600091825260208083206040805160608101825293909101546001600160a01b038082168552600160a01b82046001600160401b031685850152600160e01b90910463ffffffff16848301528885526007835281852088821686529092528320825160058054949650919492169288908110611d2357611d2361314b565b906000526020600020015490506000600954905084602001516001600160401b0316421115611dc7578115611dc7578015611dc757600085602001516001600160401b031642039050600082876040015163ffffffff16600a5484611d889190613112565b611d929190613112565b611d9c9190613129565b905083611dae64e8d4a5100083613112565b611db89190613129565b611dc290866130ec565b945050505b60028401546001850154855464e8d4a5100090611de5908790613112565b611def9190613129565b611df991906130ff565b611e0391906130ec565b98975050505050505050565b604051636eb1769f60e11b8152336004820152306024820152600019906001600160a01b0388169063dd62ed3e90604401602060405180830381865afa158015611e5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e819190613190565b1015610e6857610e688686868686866116ba565b604080516000815260208101909152606090826001600160401b03811115611ebf57611ebf6131e5565b604051908082528060200260200182016040528015611ef257816020015b6060815260200190600190039081611edd5790505b50915060005b83811015611f7f57611f4f30868684818110611f1657611f1661314b565b9050602002810190611f2891906131fb565b85604051602001611f3b93929190613248565b6040516020818303038152906040526125e4565b838281518110611f6157611f6161314b565b60200260200101819052508080611f779061326f565b915050611ef8565b505092915050565b60058181548110611f9757600080fd5b600091825260209091200154905081565b604051636eb1769f60e11b815233600482015230602482015285906001600160a01b0388169063dd62ed3e90604401602060405180830381865afa158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120189190613190565b1015610e6857610e6886868686868661210c565b60068181548110611a0a57600080fd5b6000818152600160205260408120610aac90612609565b60008281526020819052604090206001015461206e816121fc565b611181838361243c565b61209062093a806a52b7d2dcc80cd2e4000000613129565b81565b80600b546120a191906130ec565b600b556040518181527f2d81fae00823ef9dcc72e88330c926409fe2ccb8601b77d68a6f73e27b6323429060200160405180910390a16116b76001600160a01b037f00000000000000000000000032fb7d6e0cbeb9433772689aa4647828cc7cbba8163330846125a0565b60405163d505accf60e01b8152336004820152306024820152604481018690526064810185905260ff8416608482015260a4810183905260c481018290526001600160a01b0387169063d505accf9060e401611715565b61216d8282611c66565b6116a0576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556121a33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611c5f836001600160a01b038416612613565b6116b78133612662565b60006001600160e01b03198216637965db0b60e01b1480610aac57506301ffc9a760e01b6001600160e01b0319831614610aac565b6040516001600160a01b03831660248201526044810182905261118190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526126bb565b6001600160a01b03831661235b574760008290036122bc57806122c6565b6122c68183612790565b91508115612342576000836001600160a01b03168360405160006040518083038185875af1925050503d806000811461231b576040519150601f19603f3d011682016040523d82523d6000602084013e612320565b606091505b505090508061143957604051630db2c7f160e31b815260040160405180910390fd5b604051637c3d101560e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156123a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c69190613190565b9050816000036123d657806123e0565b6123e08183612790565b91508115612402576123fc6001600160a01b038516848461223b565b50505050565b604051625689bb60e41b815260040160405180910390fd5b6124248282612163565b600082815260016020526040902061118190826121e7565b61244682826127a6565b6000828152600160205260409020611181908261280b565b612466612820565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60006001600160a01b038211156125195760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663630206269747360c81b606482015260840161168d565b5090565b61252561255a565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586124933390565b60025460ff1615611a835760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161168d565b6040516001600160a01b03808516602483015283166044820152606481018290526123fc9085906323b872dd60e01b90608401612267565b6000611c5f8383612869565b6060611c5f838360405180606001604052806027815260200161337b60279139612893565b6000610aac825490565b600081815260018301602052604081205461265a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610aac565b506000610aac565b61266c8282611c66565b6116a0576126798161290b565b61268483602061291d565b604051602001612695929190613288565b60408051601f198184030181529082905262461bcd60e51b825261168d916004016132fd565b6000612710826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ab89092919063ffffffff16565b90508051600014806127315750808060200190518101906127319190613310565b6111815760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161168d565b600081831061279f5781611c5f565b5090919050565b6127b08282611c66565b156116a0576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611c5f836001600160a01b038416612acf565b60025460ff16611a835760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161168d565b60008260000182815481106128805761288061314b565b9060005260206000200154905092915050565b6060600080856001600160a01b0316856040516128b091906131a9565b600060405180830381855af49150503d80600081146128eb576040519150601f19603f3d011682016040523d82523d6000602084013e6128f0565b606091505b509150915061290186838387612bc9565b9695505050505050565b6060610aac6001600160a01b03831660145b6060600061292c836002613112565b6129379060026130ec565b6001600160401b0381111561294e5761294e6131e5565b6040519080825280601f01601f191660200182016040528015612978576020820181803683370190505b509050600360fc1b816000815181106129935761299361314b565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106129c2576129c261314b565b60200101906001600160f81b031916908160001a90535060006129e6846002613112565b6129f19060016130ec565b90505b6001811115612a69576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612a2557612a2561314b565b1a60f81b828281518110612a3b57612a3b61314b565b60200101906001600160f81b031916908160001a90535060049490941c93612a628161332d565b90506129f4565b508315611c5f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161168d565b6060612ac78484600085612c42565b949350505050565b60008181526001830160205260408120548015612bb8576000612af36001836130ff565b8554909150600090612b07906001906130ff565b9050818114612b6c576000866000018281548110612b2757612b2761314b565b9060005260206000200154905080876000018481548110612b4a57612b4a61314b565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612b7d57612b7d613344565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610aac565b6000915050610aac565b5092915050565b60608315612c38578251600003612c31576001600160a01b0385163b612c315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161168d565b5081612ac7565b612ac78383612d1d565b606082471015612ca35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161168d565b600080866001600160a01b03168587604051612cbf91906131a9565b60006040518083038185875af1925050503d8060008114612cfc576040519150601f19603f3d011682016040523d82523d6000602084013e612d01565b606091505b5091509150612d1287838387612bc9565b979650505050505050565b815115612d2d5781518083602001fd5b8060405162461bcd60e51b815260040161168d91906132fd565b803563ffffffff8116811461196957600080fd5b6001600160a01b03811681146116b757600080fd5b600080600060608486031215612d8557600080fd5b612d8e84612d47565b92506020840135612d9e81612d5b565b91506040840135612dae81612d5b565b809150509250925092565b600060208284031215612dcb57600080fd5b81356001600160e01b031981168114611c5f57600080fd5b60008060408385031215612df657600080fd5b823591506020830135612e0881612d5b565b809150509250929050565b600060208284031215612e2557600080fd5b8135611c5f81612d5b565b600080600060608486031215612e4557600080fd5b8335612e5081612d5b565b92506020840135612e6081612d5b565b929592945050506040919091013590565b600060208284031215612e8357600080fd5b5035919050565b600080600060608486031215612e9f57600080fd5b83359250602084013591506040840135612dae81612d5b565b80151581146116b757600080fd5b600080600080600060a08688031215612ede57600080fd5b85359450612eee60208701612d47565b93506040860135612efe81612d5b565b92506060860135612f0e81612d5b565b91506080860135612f1e81612eb8565b809150509295509295909350565b60008060008060008060c08789031215612f4557600080fd5b8635612f5081612d5b565b95506020870135945060408701359350606087013560ff81168114612f7457600080fd5b9598949750929560808101359460a0909101359350915050565b60008060408385031215612fa157600080fd5b50508035926020909101359150565b60008060208385031215612fc357600080fd5b82356001600160401b0380821115612fda57600080fd5b818501915085601f830112612fee57600080fd5b813581811115612ffd57600080fd5b8660208260051b850101111561301257600080fd5b60209290920196919550909350505050565b60005b8381101561303f578181015183820152602001613027565b50506000910152565b60008151808452613060816020860160208601613024565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156130c957603f198886030184526130b7858351613048565b9450928501929085019060010161309b565b5092979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610aac57610aac6130d6565b81810381811115610aac57610aac6130d6565b8082028115828204841417610aac57610aac6130d6565b60008261314657634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b9485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b6000602082840312156131a257600080fd5b5051919050565b600082516131bb818460208701613024565b9190910192915050565b6001600160a01b03818116838216019080821115612bc257612bc26130d6565b634e487b7160e01b600052604160045260246000fd5b6000808335601e1984360301811261321257600080fd5b8301803591506001600160401b0382111561322c57600080fd5b60200191503681900382131561324157600080fd5b9250929050565b828482376000838201600081528351613265818360208801613024565b0195945050505050565b600060018201613281576132816130d6565b5060010190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516132c0816017850160208801613024565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516132f1816028840160208801613024565b01602801949350505050565b602081526000611c5f6020830184613048565b60006020828403121561332257600080fd5b8151611c5f81612eb8565b60008161333c5761333c6130d6565b506000190190565b634e487b7160e01b600052603160045260246000fdfef66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f05416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208742341ceb7bcaa33ec4cb57c0fa5de235d6b82172a6bfbb4681d0559a1ad60e64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000032fb7d6e0cbeb9433772689aa4647828cc7cbba80000000000000000000000008842fe65a7db9bb5de6d50e49af19496da09f9b500000000000000000000000071bdc5f3aba49538c76d58bc2ab4e3a1118dae4c
-----Decoded View---------------
Arg [0] : rewardToken_ (address): 0x32fb7D6E0cBEb9433772689aA4647828Cc7cbBA8
Arg [1] : admin (address): 0x8842fe65A7Db9BB5De6d50e49aF19496da09F9b5
Arg [2] : pauser (address): 0x71BDC5F3AbA49538C76d58Bc2ab4E3A1118dAe4c
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000032fb7d6e0cbeb9433772689aa4647828cc7cbba8
Arg [1] : 0000000000000000000000008842fe65a7db9bb5de6d50e49af19496da09f9b5
Arg [2] : 00000000000000000000000071bdc5f3aba49538c76d58bc2ab4e3a1118dae4c
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.