More Info
Private Name Tags
ContractCreator
TokenTracker
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
LionVault
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 3000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol'; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/security/Pausable.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; /// @title LionVault Contract /// @notice This contract manages staking, rewards distribution, and pool management for Lion Boost Tokens (LBoost). /// @dev Inherits from ERC20 for token functionality, ReentrancyGuard for reentrancy protection, /// Pausable for pausing functionality, and Ownable for access control. contract LionVault is ERC20, ReentrancyGuard, Pausable, Ownable { using SafeERC20 for IERC20; using SafeERC20 for IERC20Metadata; // Struct to store information about each stake struct Stake { uint256 poolId; // ID of the pool where the stake is made uint256 amount; // Amount of tokens staked uint256 weightedAmount; // Weighted amount of the stake, used for rewards calculation uint256 stakeTimestamp; // Timestamp when the stake was made uint256 unlockTimestamp; // Timestamp when the stake can be unlocked bool active; // Status of the stake, whether it is active or not } // Struct to store information about each pool struct PoolInfo { uint256 multiplier; // Multiplier for the pool, used for rewards calculation uint256 lockPeriod; // Lock period for the pool, during which stakes cannot be withdrawn uint256 totalAmount; // Total amount of tokens staked in the pool } // Struct to store information about each user struct UserInfo { uint256 totalAmount; // Total amount of tokens staked by the user uint256 totalWeightedAmount; // Total weighted amount of the user's stakes, used for rewards calculation uint256 rewardDebt; // Reward debt of the user, used for rewards calculation uint256 totalClaimed; // Total amount of rewards claimed by the user Stake[] stakes; // Array of stakes made by the user } uint256 public immutable PRECISION; /// The reward token IERC20Metadata public immutable rewardToken; /// The staked token IERC20 public immutable stakeToken; /// Emission per second uint256 public rewardPerSecond; /// @notice Accumulated tokens per share, scaled by the precision factor. /// @dev This variable tracks the amount of reward tokens accumulated per share of the total weighted amount. /// It is used to calculate the pending rewards for each user based on their weighted stake. uint256 public accTokenPerShare; /// Emission starting timestamp uint256 public rewardStartTimestamp; /// Emission ending timestamp uint256 public rewardEndTimestamp; /// The timestamp of the last pool update uint256 public lastRewardTimeStamp; // Mapping to store user information mapping(address => UserInfo) public userInfo; // Mapping to store active pool information mapping(uint256 => mapping(uint256 => uint256)) public activePoolMap; PoolInfo[] public poolInfo; // Events for logging important actions event Deposit( address indexed user, uint256 indexed pid, uint256 indexed stakeId, uint256 amount, uint256 weightedAmount, uint256 unlockTimestamp ); event Withdraw(address indexed user, uint256 indexed stakeId, uint256 amount, uint256 weightedAmount); event Upgrade( address indexed user, uint256 indexed stakeId, uint256 indexed newPid, uint256 newWeightedAmount, uint256 newUnlockTimestamp ); event AddPool(uint256 indexed poolId, uint256 multiplier, uint256 lockPeriod); event SetPool(uint256 indexed poolId, uint256 multiplier, uint256 lockPeriod); event SetRewardPerSecond(uint256 rewardPerSecond); event SetRewardStartTimestamp(uint256 rewardStartTimestamp); event SetRewardEndTimestamp(uint256 rewardEndTimestamp); // Custom errors for more efficient error handling error InvalidRewardTokenDecimal(); error InvalidPid(); error ZeroAddress(); error InvalidTimestamp(); error LengthMismatch(); error TooEarly(); error InvalidStake(); error LongerPeriod(); error HigherMultiplier(); error VaultHasStarted(); error DuplicatePool(); error InvalidMultiplier(); error NonTransferable(); constructor( IERC20 _stakeToken, IERC20Metadata _rewardToken, uint256 _rewardPerSecond, uint256 _rewardStartTimestamp, uint256 _rewardEndTimestamp ) ERC20('Lion Boost Token', 'LBoost') { if (address(_stakeToken) == address(0) || address(_rewardToken) == address(0)) revert ZeroAddress(); if (_rewardStartTimestamp >= _rewardEndTimestamp) revert InvalidTimestamp(); stakeToken = _stakeToken; rewardToken = _rewardToken; rewardPerSecond = _rewardPerSecond; rewardStartTimestamp = _rewardStartTimestamp; rewardEndTimestamp = _rewardEndTimestamp; uint256 rewardTokenDecimals = uint256(rewardToken.decimals()); if (rewardTokenDecimals >= 36) revert InvalidRewardTokenDecimal(); PRECISION = 10 ** (36 - rewardTokenDecimals); lastRewardTimeStamp = block.timestamp > rewardStartTimestamp ? block.timestamp : rewardStartTimestamp; } /** * @notice Allows a user to deposit a specified amount of tokens into a pool. * @dev This function can only be called when the contract is not paused and is protected against reentrancy. * @param _pid The ID of the pool into which the tokens are being deposited. * @param _amount The amount of tokens to deposit. * * Requirements: * - The pool must exist and have a valid multiplier. * - The user must have approved the contract to spend at least `_amount` of the staked token. * * Effects: * - Updates the user's stake and pool information. * - Transfers the specified amount of tokens from the user to the contract. * - Mints new Lion Boost Tokens (LBoost) to the user based on the pool's multiplier. * - Emits a `Deposit` event. */ function deposit(uint256 _pid, uint256 _amount) external whenNotPaused nonReentrant { PoolInfo storage pool = poolInfo[_pid]; if (pool.multiplier == 0) revert InvalidPid(); _harvest(); UserInfo storage user = userInfo[msg.sender]; if (user.totalWeightedAmount > 0) { uint256 pending = (user.totalWeightedAmount * accTokenPerShare) / PRECISION - user.rewardDebt; if (pending > 0) { user.totalClaimed += pending; rewardToken.safeTransfer(msg.sender, pending); } } if (_amount > 0) { uint256 weightedAmount = pool.multiplier * _amount; Stake memory stake; stake.amount = _amount; stake.poolId = _pid; stake.weightedAmount = weightedAmount; stake.stakeTimestamp = block.timestamp; stake.unlockTimestamp = block.timestamp + pool.lockPeriod; stake.active = true; user.stakes.push(stake); user.totalAmount += _amount; user.totalWeightedAmount += weightedAmount; pool.totalAmount += _amount; stakeToken.safeTransferFrom(msg.sender, address(this), _amount); _mint(msg.sender, weightedAmount); emit Deposit( msg.sender, _pid, user.stakes.length - 1, _amount, stake.weightedAmount, stake.unlockTimestamp ); } user.rewardDebt = (user.totalWeightedAmount * accTokenPerShare) / PRECISION; } /** * @notice Allows a user to withdraw their staked tokens from a specific stake. * @dev This function can only be called when the contract is not paused and is protected against reentrancy. * @param _stakeId The ID of the stake to withdraw from. * * Requirements: * - The stake must be active and the unlock timestamp must have passed. * * Effects: * - Transfers the staked tokens back to the user. * - Burns the corresponding Lion Boost Tokens (LBoost). * - Updates the user's stake and pool information. * - Emits a `Withdraw` event. */ function withdraw(uint256 _stakeId) public whenNotPaused nonReentrant { UserInfo storage user = userInfo[msg.sender]; Stake storage stake = user.stakes[_stakeId]; PoolInfo storage pool = poolInfo[stake.poolId]; if (block.timestamp < stake.unlockTimestamp) revert TooEarly(); if (!stake.active) revert InvalidStake(); _harvest(); if (user.totalWeightedAmount > 0) { uint256 pending = (user.totalWeightedAmount * accTokenPerShare) / PRECISION - user.rewardDebt; if (pending > 0) { user.totalClaimed += pending; rewardToken.safeTransfer(msg.sender, pending); } } user.totalAmount -= stake.amount; user.totalWeightedAmount -= stake.weightedAmount; pool.totalAmount -= stake.amount; stake.active = false; stakeToken.safeTransfer(msg.sender, stake.amount); _burn(msg.sender, stake.weightedAmount); user.rewardDebt = (user.totalWeightedAmount * accTokenPerShare) / PRECISION; emit Withdraw(msg.sender, _stakeId, stake.amount, stake.weightedAmount); } /** * @notice Allows a user to upgrade their stake to a new pool with potentially different parameters. * @dev This function can only be called when the contract is not paused and is protected against reentrancy. * @param _stakeId The ID of the stake to upgrade. * @param _newPid The ID of the new pool to which the stake is being upgraded. * * Requirements: * - The stake must be active. * - The new pool's lock period must not be shorter than the remaining lock period of the current stake. * - The new pool's multiplier must be at least equal to the current stake's weighted amount per token. * * Effects: * - Updates the stake's pool ID and unlock timestamp. * - Adjusts the user's total weighted amount and mints additional Lion Boost Tokens (LBoost) if necessary. * - Updates the total amount in the old and new pools. * - Emits an `Upgrade` event. */ function upgrade(uint256 _stakeId, uint256 _newPid) public whenNotPaused nonReentrant { UserInfo storage user = userInfo[msg.sender]; Stake storage stake = user.stakes[_stakeId]; PoolInfo storage oldPool = poolInfo[stake.poolId]; PoolInfo storage newPool = poolInfo[_newPid]; if (!stake.active) revert InvalidStake(); if (stake.stakeTimestamp + newPool.lockPeriod < stake.unlockTimestamp) revert LongerPeriod(); if (newPool.multiplier < stake.weightedAmount / stake.amount) revert HigherMultiplier(); _harvest(); if (user.totalWeightedAmount > 0) { uint256 pending = (user.totalWeightedAmount * accTokenPerShare) / PRECISION - user.rewardDebt; if (pending > 0) { user.totalClaimed += pending; rewardToken.safeTransfer(msg.sender, pending); } } oldPool.totalAmount -= stake.amount; stake.poolId = _newPid; stake.unlockTimestamp = stake.stakeTimestamp + newPool.lockPeriod; uint256 upgradeAmount = newPool.multiplier * stake.amount - stake.weightedAmount; user.totalWeightedAmount += upgradeAmount; stake.weightedAmount += upgradeAmount; _mint(msg.sender, upgradeAmount); newPool.totalAmount += stake.amount; user.rewardDebt = (user.totalWeightedAmount * accTokenPerShare) / PRECISION; emit Upgrade(msg.sender, _stakeId, _newPid, stake.weightedAmount, stake.unlockTimestamp); } function batchWithdraw(uint256[] calldata _stakeIds) external { for (uint256 i; i < _stakeIds.length; i++) { withdraw(_stakeIds[i]); } } function batchUpgrade(uint256[] calldata _stakeIds, uint256[] calldata _newPids) external { if (_stakeIds.length != _newPids.length) revert LengthMismatch(); for (uint256 i; i < _stakeIds.length; i++) { upgrade(_stakeIds[i], _newPids[i]); } } /** * @notice Internal function to distribute pending rewards to the vault. * @dev Updates the accumulated token per share and the last reward timestamp. * * Effects: * - Calculates the reward multiplier based on the time elapsed since the last update. * - Computes the total reward to be distributed and updates the accumulated token per share. * - Updates the last reward timestamp to the current block timestamp. * * Requirements: * - The function does nothing if the current timestamp is not greater than the last reward timestamp. * - If the total supply of the vault is zero, only updates the last reward timestamp. */ function _harvest() internal { if (block.timestamp <= lastRewardTimeStamp) { return; } uint256 total = totalSupply(); if (total == 0) { lastRewardTimeStamp = block.timestamp; return; } uint256 multiplier = _getMultiplier(lastRewardTimeStamp, block.timestamp); uint256 reward = multiplier * rewardPerSecond; accTokenPerShare += (reward * PRECISION) / total; lastRewardTimeStamp = block.timestamp; } /** * @notice Adds a new pool with specified parameters. * @dev Can only be called by the contract owner. * @param _multiplier The multiplier for the pool, used to calculate weighted amounts. * @param _lockPeriod The lock period for the pool in seconds. * * Requirements: * - The pool with the given multiplier and lock period must not already exist. * - The multiplier must be greater than zero. * * Effects: * - Creates a new pool and adds it to the list of pools. * - Updates the active pool mapping to include the new pool. * - Emits an `AddPool` event. */ function add(uint256 _multiplier, uint256 _lockPeriod) public onlyOwner { if (activePoolMap[_multiplier][_lockPeriod] != 0) revert DuplicatePool(); if (_multiplier == 0) revert InvalidMultiplier(); poolInfo.push(PoolInfo({multiplier: _multiplier, lockPeriod: _lockPeriod, totalAmount: 0})); activePoolMap[_multiplier][_lockPeriod] = poolInfo.length; emit AddPool(poolInfo.length - 1, _multiplier, _lockPeriod); } /** * @notice Updates the parameters of an existing pool. * @dev Can only be called by the contract owner. * @param _pid The ID of the pool to update. * @param _multiplier The new multiplier for the pool. * @param _lockPeriod The new lock period for the pool in seconds. * * Requirements: * - The pool with the given multiplier and lock period must not already exist. * - The multiplier must be greater than zero. * * Effects: * - Updates the pool's multiplier and lock period. * - Adjusts the active pool mapping to reflect the changes. * - Emits a `SetPool` event. */ function set(uint256 _pid, uint256 _multiplier, uint256 _lockPeriod) public onlyOwner { if (activePoolMap[_multiplier][_lockPeriod] != 0) revert DuplicatePool(); if (_multiplier == 0) revert InvalidMultiplier(); _harvest(); PoolInfo storage pool = poolInfo[_pid]; activePoolMap[pool.multiplier][pool.lockPeriod] = 0; pool.multiplier = _multiplier; pool.lockPeriod = _lockPeriod; activePoolMap[_multiplier][_lockPeriod] = _pid + 1; emit SetPool(_pid, _multiplier, _lockPeriod); } function _getMultiplier(uint256 _lastRewardTime, uint256 _currentTimestamp) internal view returns (uint256) { // Scenario 1: Not started yet if (block.timestamp < rewardStartTimestamp) { return 0; } // Scenario 2: Reward started and not ended. (on-going) if (_currentTimestamp <= rewardEndTimestamp) { return _currentTimestamp - _lastRewardTime; } // Scenario 3: pool's last reward already over rewardEndTimestamp if (_lastRewardTime >= rewardEndTimestamp) { return 0; } // Scenario 4: reward ended, calculate the diff from last claim return rewardEndTimestamp - _lastRewardTime; } /** * @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 onlyOwner { _harvest(); rewardPerSecond = _rewardPerSecond; emit SetRewardPerSecond(_rewardPerSecond); } /** * @notice Sets the reward start timestamp. Can only be called by the owner. * @param _rewardStartTimestamp The timestamp when the reward starts. * @custom:throws VaultHasStarted if the vault has already started. * @custom:throws InvalidTimestamp if the reward start timestamp is invalid. */ function setRewardStartTimestamp(uint256 _rewardStartTimestamp) public onlyOwner { if (block.timestamp > rewardStartTimestamp) revert VaultHasStarted(); if (block.timestamp > _rewardStartTimestamp || _rewardStartTimestamp > rewardEndTimestamp) revert InvalidTimestamp(); rewardStartTimestamp = _rewardStartTimestamp; emit SetRewardStartTimestamp(_rewardStartTimestamp); } /** * @notice Sets the reward end timestamp. Can only be called by the owner. * @param _rewardEndTimestamp The timestamp when the reward ends. * @custom:throws InvalidTimestamp if the reward end timestamp is invalid. */ function setRewardEndTimestamp(uint256 _rewardEndTimestamp) public onlyOwner { if (block.timestamp > _rewardEndTimestamp || rewardStartTimestamp > _rewardEndTimestamp) revert InvalidTimestamp(); _harvest(); rewardEndTimestamp = _rewardEndTimestamp; emit SetRewardEndTimestamp(_rewardEndTimestamp); } function getUserInfo(address _user) external view returns (uint256, uint256, uint256, uint256, Stake[] memory) { UserInfo memory user = userInfo[_user]; return (user.totalAmount, user.totalWeightedAmount, user.totalClaimed, user.rewardDebt, user.stakes); } /** * @dev Just in case there are too many Stakes and jams `getUserInfo` */ function getUserStake(address _user, uint256 _stakeId) external view returns (Stake memory) { return userInfo[_user].stakes[_stakeId]; } /** * @notice Calculates the pending reward for a user. * @dev This function provides a view of the rewards that a user can claim. * @param _user The address of the user for whom to calculate the pending reward. * @return The amount of reward tokens that are pending for the user. * * Effects: * - Computes the pending accumulated token per share if the current timestamp is greater than the last reward timestamp. * - Calculates the pending reward based on the user's total weighted amount and reward debt. */ function pendingReward(address _user) external view returns (uint256) { UserInfo memory user = userInfo[_user]; uint256 pendingAccTokenPerShare = accTokenPerShare; if (block.timestamp > lastRewardTimeStamp && totalSupply() != 0) { uint256 multiplier = _getMultiplier(lastRewardTimeStamp, block.timestamp); uint256 reward = multiplier * rewardPerSecond; pendingAccTokenPerShare += (reward * PRECISION) / totalSupply(); } return (user.totalWeightedAmount * pendingAccTokenPerShare) / PRECISION - user.rewardDebt; } function poolLength() external view returns (uint256) { return poolInfo.length; } /** * @dev BOOST Token is currently non-transferable */ function _beforeTokenTransfer(address _from, address _to, uint256) internal pure override { if (_from != address(0) && _to != address(0)) revert NonTransferable(); } /** * @notice Pause contract * * Requirements: * - The contract should not be paused before calling this function */ function pause() external onlyOwner { _pause(); } /** * @notice Unpause contract * * Requirements: * - The contract should be paused before calling this function */ function unpause() external onlyOwner { _unpause(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (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: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "optimizer": { "enabled": true, "runs": 3000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IERC20","name":"_stakeToken","type":"address"},{"internalType":"contract IERC20Metadata","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardPerSecond","type":"uint256"},{"internalType":"uint256","name":"_rewardStartTimestamp","type":"uint256"},{"internalType":"uint256","name":"_rewardEndTimestamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DuplicatePool","type":"error"},{"inputs":[],"name":"HigherMultiplier","type":"error"},{"inputs":[],"name":"InvalidMultiplier","type":"error"},{"inputs":[],"name":"InvalidPid","type":"error"},{"inputs":[],"name":"InvalidRewardTokenDecimal","type":"error"},{"inputs":[],"name":"InvalidStake","type":"error"},{"inputs":[],"name":"InvalidTimestamp","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"LongerPeriod","type":"error"},{"inputs":[],"name":"NonTransferable","type":"error"},{"inputs":[],"name":"TooEarly","type":"error"},{"inputs":[],"name":"VaultHasStarted","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockPeriod","type":"uint256"}],"name":"AddPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weightedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockTimestamp","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockPeriod","type":"uint256"}],"name":"SetPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardEndTimestamp","type":"uint256"}],"name":"SetRewardEndTimestamp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerSecond","type":"uint256"}],"name":"SetRewardPerSecond","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardStartTimestamp","type":"uint256"}],"name":"SetRewardStartTimestamp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","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":"stakeId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"newPid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newWeightedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newUnlockTimestamp","type":"uint256"}],"name":"Upgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weightedAmount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"activePoolMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_multiplier","type":"uint256"},{"internalType":"uint256","name":"_lockPeriod","type":"uint256"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_stakeIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_newPids","type":"uint256[]"}],"name":"batchUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_stakeIds","type":"uint256[]"}],"name":"batchWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"weightedAmount","type":"uint256"},{"internalType":"uint256","name":"stakeTimestamp","type":"uint256"},{"internalType":"uint256","name":"unlockTimestamp","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct LionVault.Stake[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_stakeId","type":"uint256"}],"name":"getUserStake","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"weightedAmount","type":"uint256"},{"internalType":"uint256","name":"stakeTimestamp","type":"uint256"},{"internalType":"uint256","name":"unlockTimestamp","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct LionVault.Stake","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastRewardTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"uint256","name":"multiplier","type":"uint256"},{"internalType":"uint256","name":"lockPeriod","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardEndTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardStartTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_multiplier","type":"uint256"},{"internalType":"uint256","name":"_lockPeriod","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardEndTimestamp","type":"uint256"}],"name":"setRewardEndTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerSecond","type":"uint256"}],"name":"setRewardPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardStartTimestamp","type":"uint256"}],"name":"setRewardStartTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeId","type":"uint256"},{"internalType":"uint256","name":"_newPid","type":"uint256"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"totalWeightedAmount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"totalClaimed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e060405234801562000010575f80fd5b506040516200337738038062003377833981016040819052620000339162000276565b6040518060400160405280601081526020016f2634b7b7102137b7b9ba102a37b5b2b760811b8152506040518060400160405280600681526020016513109bdbdcdd60d21b81525081600390816200008c919062000368565b5060046200009b828262000368565b50506001600555506006805460ff19169055620000b83362000205565b6001600160a01b0385161580620000d657506001600160a01b038416155b15620000f55760405163d92e233d60e01b815260040160405180910390fd5b808210620001165760405163b7d0949760e01b815260040160405180910390fd5b6001600160a01b0380861660c052841660a081905260078490556009839055600a8290556040805163313ce56760e01b815290515f929163313ce5679160048083019260209291908290030181865afa15801562000176573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906200019c919062000434565b60ff16905060248110620001c357604051635fd5a78560e11b815260040160405180910390fd5b620001d081602462000471565b620001dd90600a62000586565b6080526009544211620001f357600954620001f5565b425b600b555062000593945050505050565b600680546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b038116811462000273575f80fd5b50565b5f805f805f60a086880312156200028b575f80fd5b855162000298816200025e565b6020870151909550620002ab816200025e565b6040870151606088015160809098015196999198509695945092505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c90821680620002f357607f821691505b6020821081036200031257634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156200036357805f5260205f20601f840160051c810160208510156200033f5750805b601f840160051c820191505b8181101562000360575f81556001016200034b565b50505b505050565b81516001600160401b03811115620003845762000384620002ca565b6200039c81620003958454620002de565b8462000318565b602080601f831160018114620003d2575f8415620003ba5750858301515b5f19600386901b1c1916600185901b1785556200042c565b5f85815260208120601f198616915b828110156200040257888601518255948401946001909101908401620003e1565b50858210156200042057878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b5f6020828403121562000445575f80fd5b815160ff8116811462000456575f80fd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156200048757620004876200045d565b92915050565b600181815b80851115620004cd57815f1904821115620004b157620004b16200045d565b80851615620004bf57918102915b93841c939080029062000492565b509250929050565b5f82620004e55750600162000487565b81620004f357505f62000487565b81600181146200050c5760028114620005175762000537565b600191505062000487565b60ff8411156200052b576200052b6200045d565b50506001821b62000487565b5060208310610133831016604e8410600b84101617156200055c575081810a62000487565b6200056883836200048d565b805f19048211156200057e576200057e6200045d565b029392505050565b5f620004568383620004d5565b60805160a05160c051612d57620006205f395f8181610447015281816109c5015261185d01525f81816106630152818161092801528181610ec9015261170001525f8181610598015281816108b5015281816109fd01528181610e5601528181610fb10152818161168d015281816118f101528181611af201528181611b3701526120ff0152612d575ff3fe608060405234801561000f575f80fd5b50600436106102cd575f3560e01c806372e553991161017c578063a9059cbb116100dd578063f2fde38b11610093578063f7c618c11161006e578063f7c618c11461065e578063f9586e3f14610685578063fcb685bc146106af575f80fd5b8063f2fde38b14610625578063f40f0f5214610638578063f577988e1461064b575f80fd5b8063cec695fa116100c3578063cec695fa146105ba578063dd62ed3e146105da578063e2bbb15814610612575f80fd5b8063a9059cbb14610580578063aaf5eb6814610593575f80fd5b80638da5cb5b116101325780638f662915116101185780638f6629151461055c57806395d89b4114610565578063a457c2d71461056d575f80fd5b80638da5cb5b1461053d5780638f10369a14610553575f80fd5b8063823c27ff11610162578063823c27ff146105195780638456cb591461052c5780638bc1d8c014610534575f80fd5b806372e55399146104f3578063771602f714610506575f80fd5b8063395093511161023157806351ed6a30116101e757806366da5815116101c257806366da5815146104b057806370a08231146104c3578063715018a6146104eb575f80fd5b806351ed6a30146104425780635c975abb146104815780636386c1c71461048c575f80fd5b80633f4ba83a116102175780633f4ba83a1461041457806343b0e8df1461041c578063451450ec1461042f575f80fd5b806339509351146103ee5780633c011b5f14610401575f80fd5b80631959a002116102865780632e1a7d4d1161026c5780632e1a7d4d146103c1578063313ce567146103d6578063356c7284146103e5575f80fd5b80631959a0021461035a57806323b872dd146103ae575f80fd5b8063095ea7b3116102b6578063095ea7b3146103015780631526fe271461032457806318160ddd14610352575f80fd5b806306fdde03146102d1578063081e3eda146102ef575b5f80fd5b6102d96106b8565b6040516102e691906128fc565b60405180910390f35b600e545b6040519081526020016102e6565b61031461030f366004612949565b610748565b60405190151581526020016102e6565b610337610332366004612971565b610761565b604080519384526020840192909252908201526060016102e6565b6002546102f3565b61038e610368366004612988565b600c6020525f908152604090208054600182015460028301546003909301549192909184565b6040805194855260208501939093529183015260608201526080016102e6565b6103146103bc3660046129a1565b610792565b6103d46103cf366004612971565b6107b5565b005b604051601281526020016102e6565b6102f3600b5481565b6103146103fc366004612949565b610aa5565b6103d461040f366004612a22565b610ae3565b6103d4610b6f565b6103d461042a366004612a89565b610b81565b6103d461043d366004612ab2565b610cd0565b6104697f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016102e6565b60065460ff16610314565b61049f61049a366004612988565b611055565b6040516102e6959493929190612ad2565b6103d46104be366004612971565b611171565b6102f36104d1366004612988565b6001600160a01b03165f9081526020819052604090205490565b6103d46111bd565b6103d4610501366004612b76565b6111ce565b6103d4610514366004612ab2565b611206565b6103d4610527366004612971565b61139c565b6103d461145b565b6102f3600a5481565b60065461010090046001600160a01b0316610469565b6102f360075481565b6102f360085481565b6102d961146b565b61031461057b366004612949565b61147a565b61031461058e366004612949565b611528565b6102f37f000000000000000000000000000000000000000000000000000000000000000081565b6105cd6105c8366004612949565b611535565b6040516102e69190612bb5565b6102f36105e8366004612bfa565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6103d4610620366004612ab2565b6115f7565b6103d4610633366004612988565b61193d565b6102f3610646366004612988565b6119ca565b6103d4610659366004612971565b611b82565b6104697f000000000000000000000000000000000000000000000000000000000000000081565b6102f3610693366004612ab2565b600d60209081525f928352604080842090915290825290205481565b6102f360095481565b6060600380546106c790612c2b565b80601f01602080910402602001604051908101604052809291908181526020018280546106f390612c2b565b801561073e5780601f106107155761010080835404028352916020019161073e565b820191905f5260205f20905b81548152906001019060200180831161072157829003601f168201915b5050505050905090565b5f33610755818585611c0c565b60019150505b92915050565b600e8181548110610770575f80fd5b5f91825260209091206003909102018054600182015460029092015490925083565b5f3361079f858285611d63565b6107aa858585611e12565b506001949350505050565b6107bd612008565b6107c561205b565b335f908152600c60205260408120600481018054919291849081106107ec576107ec612c63565b905f5260205f20906006020190505f600e825f01548154811061081157610811612c63565b905f5260205f2090600302019050816004015442101561085d576040517f085de62500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600582015460ff1661089b576040517f9d749a9200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108a36120b4565b600183015415610951575f83600201547f000000000000000000000000000000000000000000000000000000000000000060085486600101546108e69190612c8b565b6108f09190612ca2565b6108fa9190612cc1565b9050801561094f5780846003015f8282546109159190612cd4565b9091555061094f90506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338361214c565b505b8160010154835f015f8282546109679190612cc1565b909155505060028201546001840180545f90610984908490612cc1565b909155505060018201546002820180545f906109a1908490612cc1565b909155505060058201805460ff1916905560018201546109ed906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690339061214c565b6109fb3383600201546121f5565b7f00000000000000000000000000000000000000000000000000000000000000006008548460010154610a2e9190612c8b565b610a389190612ca2565b836002018190555083336001600160a01b03167f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca9484600101548560020154604051610a8d929190918252602082015260400190565b60405180910390a3505050610aa26001600555565b50565b335f8181526001602090815260408083206001600160a01b03871684529091528120549091906107559082908690610ade908790612cd4565b611c0c565b828114610b1c576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b83811015610b6857610b60858583818110610b3b57610b3b612c63565b90506020020135848484818110610b5457610b54612c63565b90506020020135610cd0565b600101610b1e565b5050505050565b610b77612367565b610b7f6123c7565b565b610b89612367565b5f828152600d6020908152604080832084845290915290205415610bd9576040517fb82a474600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f03610c12576040517f6f12f3dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c1a6120b4565b5f600e8481548110610c2e57610c2e612c63565b5f9182526020808320600390920290910180548352600d82526040808420600180840180548752919094529084209390935585815591849055909150610c75908590612cd4565b5f848152600d6020908152604080832086845282529182902092909255805185815291820184905285917f17cb2943c2b75826e10c84d8d48b9953b663936eb40867b23dfe8f4930b98686910160405180910390a250505050565b610cd8612008565b610ce061205b565b335f908152600c6020526040812060048101805491929185908110610d0757610d07612c63565b905f5260205f20906006020190505f600e825f015481548110610d2c57610d2c612c63565b905f5260205f20906003020190505f600e8581548110610d4e57610d4e612c63565b5f91825260209091206005850154600390920201915060ff16610d9d576040517f9d749a9200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b826004015481600101548460030154610db69190612cd4565b1015610dee576040517febfe7e1100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82600101548360020154610e029190612ca2565b81541015610e3c576040517f27cd7f8600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e446120b4565b600184015415610ef2575f84600201547f00000000000000000000000000000000000000000000000000000000000000006008548760010154610e879190612c8b565b610e919190612ca2565b610e9b9190612cc1565b90508015610ef05780856003015f828254610eb69190612cd4565b90915550610ef090506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338361214c565b505b8260010154826002015f828254610f099190612cc1565b909155505084835560018101546003840154610f259190612cd4565b60048401556002830154600184015482545f9291610f4291612c8b565b610f4c9190612cc1565b905080856001015f828254610f619190612cd4565b9250508190555080846002015f828254610f7b9190612cd4565b90915550610f8b90503382612419565b8360010154826002015f828254610fa29190612cd4565b909155505060085460018601547f000000000000000000000000000000000000000000000000000000000000000091610fda91612c8b565b610fe49190612ca2565b85600201819055508587336001600160a01b03167fa0ad55fd11cc19ae2402e185f0103dc5a70da0930212e8db8d1b5020fa15728c8760020154886004015460405161103a929190918252602082015260400190565b60405180910390a450505050506110516001600555565b5050565b5f805f8060605f600c5f886001600160a01b03166001600160a01b031681526020019081526020015f206040518060a00160405290815f820154815260200160018201548152602001600282015481526020016003820154815260200160048201805480602002602001604051908101604052809291908181526020015f905b82821015611141575f8481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a083015290835290920191016110d5565b505050915250508051602082015160608301516040840151608090940151929b919a509850919650945092505050565b611179612367565b6111816120b4565b60078190556040518181527f9981f93efb1f00e191e4911e94be7586e0643ea2948cd594baa6c3fe23ae654d906020015b60405180910390a150565b6111c5612367565b610b7f5f6124e1565b5f5b81811015611201576111f98383838181106111ed576111ed612c63565b905060200201356107b5565b6001016111d0565b505050565b61120e612367565b5f828152600d602090815260408083208484529091529020541561125e576040517fb82a474600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f03611297576040517f6f12f3dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160608101825283815260208082018481525f838501818152600e80546001808201835582855296517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd60039092029182015593517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fe85015590517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3ff909301929092559054868252600d83528482208683529092529290922082905561135f91612cc1565b60408051848152602081018490527f4d93067d0d628fe42c457623322c0f22ad92f71762a2eebe06e2a0e7d2aa61c7910160405180910390a25050565b6113a4612367565b6009544211156113e0576040517fe76c625f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b804211806113ef5750600a5481115b15611426576040517fb7d0949700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098190556040518181527f333fbfe183fcd0d2b5c40ad00a9aea8f2ef8d7187c5e0d7c76f40b060286b87c906020016111b2565b611463612367565b610b7f612551565b6060600480546106c790612c2b565b335f8181526001602090815260408083206001600160a01b03871684529091528120549091908381101561151b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6107aa8286868403611c0c565b5f33610755818585611e12565b61156a6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f151581525090565b6001600160a01b0383165f908152600c6020526040902060040180548390811061159657611596612c63565b5f9182526020918290206040805160c081018252600690930290910180548352600181015493830193909352600283015490820152600382015460608201526004820154608082015260059091015460ff16151560a0820152905092915050565b6115ff612008565b61160761205b565b5f600e838154811061161b5761161b612c63565b905f5260205f2090600302019050805f01545f03611665576040517f87e8068300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61166d6120b4565b335f908152600c60205260409020600181015415611729575f81600201547f000000000000000000000000000000000000000000000000000000000000000060085484600101546116be9190612c8b565b6116c89190612ca2565b6116d29190612cc1565b905080156117275780826003015f8282546116ed9190612cd4565b9091555061172790506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338361214c565b505b82156118ef5781545f9061173e908590612c8b565b90506117756040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f151581525090565b60208101859052858152604081018290524260608201819052600185015461179c91612cd4565b60808201908152600160a083018181526004868101805480850182555f91825260208083208851600690930201918255870151948101949094556040860151600285015560608601516003850155935190830155516005909101805460ff1916911515919091179055835486918591611816908490612cd4565b9250508190555081836001015f8282546118309190612cd4565b9250508190555084846002015f82825461184a9190612cd4565b9091555061188590506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308861258e565b61188f3383612419565b60048301546118a090600190612cc1565b604082810151608084015182518981526020810192909252818301529051889133917ff943cf10ef4d1e3239f4716ddecdf546e8ba8ab0e41deafd9a71a99936827e459181900360600190a450505b7f000000000000000000000000000000000000000000000000000000000000000060085482600101546119229190612c8b565b61192c9190612ca2565b600290910155506110516001600555565b611945612367565b6001600160a01b0381166119c15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401611512565b610aa2816124e1565b6001600160a01b0381165f908152600c60209081526040808320815160a081018352815481526001820154818501526002820154818401526003820154606082015260048201805484518187028101870190955280855286959294608086019390929190879084015b82821015611a9f575f8481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a08301529083529092019101611a33565b50505091525050600854600b549192509042118015611abf575060025415155b15611b30575f611ad1600b54426125df565b90505f60075482611ae29190612c8b565b9050611aed60025490565b611b177f000000000000000000000000000000000000000000000000000000000000000083612c8b565b611b219190612ca2565b611b2b9084612cd4565b925050505b81604001517f0000000000000000000000000000000000000000000000000000000000000000828460200151611b669190612c8b565b611b709190612ca2565b611b7a9190612cc1565b949350505050565b611b8a612367565b80421180611b99575080600954115b15611bd0576040517fb7d0949700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611bd86120b4565b600a8190556040518181527ec120dc5e082694674c24ab7b88010f8ec91c9cfa404fc7b0418d5d267468ec906020016111b2565b6001600160a01b038316611c875760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b038216611d035760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b038381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381165f908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611e0c5781811015611dff5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611512565b611e0c8484848403611c0c565b50505050565b6001600160a01b038316611e8e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b038216611f0a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401611512565b611f15838383612630565b6001600160a01b0383165f9081526020819052604090205481811015611fa35760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b038481165f81815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611e0c565b60065460ff1615610b7f5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401611512565b6002600554036120ad5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611512565b6002600555565b600b5442116120bf57565b5f6120c960025490565b9050805f036120d9575042600b55565b5f6120e6600b54426125df565b90505f600754826120f79190612c8b565b9050826121247f000000000000000000000000000000000000000000000000000000000000000083612c8b565b61212e9190612ca2565b60085f82825461213e9190612cd4565b909155505042600b55505050565b6040516001600160a01b0383166024820152604481018290526112019084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612687565b6001600160a01b0382166122715760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401611512565b61227c825f83612630565b6001600160a01b0382165f908152602081905260409020548181101561230a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b0383165f818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6006546001600160a01b03610100909104163314610b7f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611512565b6123cf61276b565b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b03821661246f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611512565b61247a5f8383612630565b8060025f82825461248b9190612cd4565b90915550506001600160a01b0382165f81815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600680546001600160a01b038381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b612559612008565b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586123fc3390565b6040516001600160a01b0380851660248301528316604482015260648101829052611e0c9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612191565b5f6009544210156125f157505f61075b565b600a54821161260b576126048383612cc1565b905061075b565b600a54831061261b57505f61075b565b82600a546126299190612cc1565b9392505050565b6001600160a01b0383161580159061265057506001600160a01b03821615155b15611201576040517f9cbe235700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6126db826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127bd9092919063ffffffff16565b80519091501561120157808060200190518101906126f99190612ce7565b6112015760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401611512565b60065460ff16610b7f5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401611512565b6060611b7a84845f85855f80866001600160a01b031685876040516127e29190612d06565b5f6040518083038185875af1925050503d805f811461281c576040519150601f19603f3d011682016040523d82523d5f602084013e612821565b606091505b50915091506128328783838761283d565b979650505050505050565b606083156128ab5782515f036128a4576001600160a01b0385163b6128a45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611512565b5081611b7a565b611b7a83838151156128c05781518083602001fd5b8060405162461bcd60e51b815260040161151291906128fc565b5f5b838110156128f45781810151838201526020016128dc565b50505f910152565b602081525f825180602084015261291a8160408501602087016128da565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114612944575f80fd5b919050565b5f806040838503121561295a575f80fd5b6129638361292e565b946020939093013593505050565b5f60208284031215612981575f80fd5b5035919050565b5f60208284031215612998575f80fd5b6126298261292e565b5f805f606084860312156129b3575f80fd5b6129bc8461292e565b92506129ca6020850161292e565b9150604084013590509250925092565b5f8083601f8401126129ea575f80fd5b50813567ffffffffffffffff811115612a01575f80fd5b6020830191508360208260051b8501011115612a1b575f80fd5b9250929050565b5f805f8060408587031215612a35575f80fd5b843567ffffffffffffffff80821115612a4c575f80fd5b612a58888389016129da565b90965094506020870135915080821115612a70575f80fd5b50612a7d878288016129da565b95989497509550505050565b5f805f60608486031215612a9b575f80fd5b505081359360208301359350604090920135919050565b5f8060408385031215612ac3575f80fd5b50508035926020909101359150565b5f60a08201878352602087602085015286604085015285606085015260a0608085015281855180845260c0935060c086019150602087015f5b82811015612b6557612b55848351805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a0810151151560a08301525050565b9285019290840190600101612b0b565b50919b9a5050505050505050505050565b5f8060208385031215612b87575f80fd5b823567ffffffffffffffff811115612b9d575f80fd5b612ba9858286016129da565b90969095509350505050565b60c0810161075b8284805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a0810151151560a08301525050565b5f8060408385031215612c0b575f80fd5b612c148361292e565b9150612c226020840161292e565b90509250929050565b600181811c90821680612c3f57607f821691505b602082108103612c5d57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761075b5761075b612c77565b5f82612cbc57634e487b7160e01b5f52601260045260245ffd5b500490565b8181038181111561075b5761075b612c77565b8082018082111561075b5761075b612c77565b5f60208284031215612cf7575f80fd5b81518015158114612629575f80fd5b5f8251612d178184602087016128da565b919091019291505056fea264697066735822122063e31393f39d0bf302c30a94ff1fb370e960ca7f4ba1ef009c70f1a39f9d05e264736f6c634300081800330000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e450000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e45000000000000000000000000000000000000000000000000593bf2eeb1c300000000000000000000000000000000000000000000000000000000000067c599c000000000000000000000000000000000000000000000000000000000712cecc0
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106102cd575f3560e01c806372e553991161017c578063a9059cbb116100dd578063f2fde38b11610093578063f7c618c11161006e578063f7c618c11461065e578063f9586e3f14610685578063fcb685bc146106af575f80fd5b8063f2fde38b14610625578063f40f0f5214610638578063f577988e1461064b575f80fd5b8063cec695fa116100c3578063cec695fa146105ba578063dd62ed3e146105da578063e2bbb15814610612575f80fd5b8063a9059cbb14610580578063aaf5eb6814610593575f80fd5b80638da5cb5b116101325780638f662915116101185780638f6629151461055c57806395d89b4114610565578063a457c2d71461056d575f80fd5b80638da5cb5b1461053d5780638f10369a14610553575f80fd5b8063823c27ff11610162578063823c27ff146105195780638456cb591461052c5780638bc1d8c014610534575f80fd5b806372e55399146104f3578063771602f714610506575f80fd5b8063395093511161023157806351ed6a30116101e757806366da5815116101c257806366da5815146104b057806370a08231146104c3578063715018a6146104eb575f80fd5b806351ed6a30146104425780635c975abb146104815780636386c1c71461048c575f80fd5b80633f4ba83a116102175780633f4ba83a1461041457806343b0e8df1461041c578063451450ec1461042f575f80fd5b806339509351146103ee5780633c011b5f14610401575f80fd5b80631959a002116102865780632e1a7d4d1161026c5780632e1a7d4d146103c1578063313ce567146103d6578063356c7284146103e5575f80fd5b80631959a0021461035a57806323b872dd146103ae575f80fd5b8063095ea7b3116102b6578063095ea7b3146103015780631526fe271461032457806318160ddd14610352575f80fd5b806306fdde03146102d1578063081e3eda146102ef575b5f80fd5b6102d96106b8565b6040516102e691906128fc565b60405180910390f35b600e545b6040519081526020016102e6565b61031461030f366004612949565b610748565b60405190151581526020016102e6565b610337610332366004612971565b610761565b604080519384526020840192909252908201526060016102e6565b6002546102f3565b61038e610368366004612988565b600c6020525f908152604090208054600182015460028301546003909301549192909184565b6040805194855260208501939093529183015260608201526080016102e6565b6103146103bc3660046129a1565b610792565b6103d46103cf366004612971565b6107b5565b005b604051601281526020016102e6565b6102f3600b5481565b6103146103fc366004612949565b610aa5565b6103d461040f366004612a22565b610ae3565b6103d4610b6f565b6103d461042a366004612a89565b610b81565b6103d461043d366004612ab2565b610cd0565b6104697f0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e4581565b6040516001600160a01b0390911681526020016102e6565b60065460ff16610314565b61049f61049a366004612988565b611055565b6040516102e6959493929190612ad2565b6103d46104be366004612971565b611171565b6102f36104d1366004612988565b6001600160a01b03165f9081526020819052604090205490565b6103d46111bd565b6103d4610501366004612b76565b6111ce565b6103d4610514366004612ab2565b611206565b6103d4610527366004612971565b61139c565b6103d461145b565b6102f3600a5481565b60065461010090046001600160a01b0316610469565b6102f360075481565b6102f360085481565b6102d961146b565b61031461057b366004612949565b61147a565b61031461058e366004612949565b611528565b6102f37f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b6105cd6105c8366004612949565b611535565b6040516102e69190612bb5565b6102f36105e8366004612bfa565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6103d4610620366004612ab2565b6115f7565b6103d4610633366004612988565b61193d565b6102f3610646366004612988565b6119ca565b6103d4610659366004612971565b611b82565b6104697f0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e4581565b6102f3610693366004612ab2565b600d60209081525f928352604080842090915290825290205481565b6102f360095481565b6060600380546106c790612c2b565b80601f01602080910402602001604051908101604052809291908181526020018280546106f390612c2b565b801561073e5780601f106107155761010080835404028352916020019161073e565b820191905f5260205f20905b81548152906001019060200180831161072157829003601f168201915b5050505050905090565b5f33610755818585611c0c565b60019150505b92915050565b600e8181548110610770575f80fd5b5f91825260209091206003909102018054600182015460029092015490925083565b5f3361079f858285611d63565b6107aa858585611e12565b506001949350505050565b6107bd612008565b6107c561205b565b335f908152600c60205260408120600481018054919291849081106107ec576107ec612c63565b905f5260205f20906006020190505f600e825f01548154811061081157610811612c63565b905f5260205f2090600302019050816004015442101561085d576040517f085de62500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600582015460ff1661089b576040517f9d749a9200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108a36120b4565b600183015415610951575f83600201547f0000000000000000000000000000000000000000000000000de0b6b3a764000060085486600101546108e69190612c8b565b6108f09190612ca2565b6108fa9190612cc1565b9050801561094f5780846003015f8282546109159190612cd4565b9091555061094f90506001600160a01b037f0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e4516338361214c565b505b8160010154835f015f8282546109679190612cc1565b909155505060028201546001840180545f90610984908490612cc1565b909155505060018201546002820180545f906109a1908490612cc1565b909155505060058201805460ff1916905560018201546109ed906001600160a01b037f0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e451690339061214c565b6109fb3383600201546121f5565b7f0000000000000000000000000000000000000000000000000de0b6b3a76400006008548460010154610a2e9190612c8b565b610a389190612ca2565b836002018190555083336001600160a01b03167f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca9484600101548560020154604051610a8d929190918252602082015260400190565b60405180910390a3505050610aa26001600555565b50565b335f8181526001602090815260408083206001600160a01b03871684529091528120549091906107559082908690610ade908790612cd4565b611c0c565b828114610b1c576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b83811015610b6857610b60858583818110610b3b57610b3b612c63565b90506020020135848484818110610b5457610b54612c63565b90506020020135610cd0565b600101610b1e565b5050505050565b610b77612367565b610b7f6123c7565b565b610b89612367565b5f828152600d6020908152604080832084845290915290205415610bd9576040517fb82a474600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f03610c12576040517f6f12f3dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c1a6120b4565b5f600e8481548110610c2e57610c2e612c63565b5f9182526020808320600390920290910180548352600d82526040808420600180840180548752919094529084209390935585815591849055909150610c75908590612cd4565b5f848152600d6020908152604080832086845282529182902092909255805185815291820184905285917f17cb2943c2b75826e10c84d8d48b9953b663936eb40867b23dfe8f4930b98686910160405180910390a250505050565b610cd8612008565b610ce061205b565b335f908152600c6020526040812060048101805491929185908110610d0757610d07612c63565b905f5260205f20906006020190505f600e825f015481548110610d2c57610d2c612c63565b905f5260205f20906003020190505f600e8581548110610d4e57610d4e612c63565b5f91825260209091206005850154600390920201915060ff16610d9d576040517f9d749a9200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b826004015481600101548460030154610db69190612cd4565b1015610dee576040517febfe7e1100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82600101548360020154610e029190612ca2565b81541015610e3c576040517f27cd7f8600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e446120b4565b600184015415610ef2575f84600201547f0000000000000000000000000000000000000000000000000de0b6b3a76400006008548760010154610e879190612c8b565b610e919190612ca2565b610e9b9190612cc1565b90508015610ef05780856003015f828254610eb69190612cd4565b90915550610ef090506001600160a01b037f0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e4516338361214c565b505b8260010154826002015f828254610f099190612cc1565b909155505084835560018101546003840154610f259190612cd4565b60048401556002830154600184015482545f9291610f4291612c8b565b610f4c9190612cc1565b905080856001015f828254610f619190612cd4565b9250508190555080846002015f828254610f7b9190612cd4565b90915550610f8b90503382612419565b8360010154826002015f828254610fa29190612cd4565b909155505060085460018601547f0000000000000000000000000000000000000000000000000de0b6b3a764000091610fda91612c8b565b610fe49190612ca2565b85600201819055508587336001600160a01b03167fa0ad55fd11cc19ae2402e185f0103dc5a70da0930212e8db8d1b5020fa15728c8760020154886004015460405161103a929190918252602082015260400190565b60405180910390a450505050506110516001600555565b5050565b5f805f8060605f600c5f886001600160a01b03166001600160a01b031681526020019081526020015f206040518060a00160405290815f820154815260200160018201548152602001600282015481526020016003820154815260200160048201805480602002602001604051908101604052809291908181526020015f905b82821015611141575f8481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a083015290835290920191016110d5565b505050915250508051602082015160608301516040840151608090940151929b919a509850919650945092505050565b611179612367565b6111816120b4565b60078190556040518181527f9981f93efb1f00e191e4911e94be7586e0643ea2948cd594baa6c3fe23ae654d906020015b60405180910390a150565b6111c5612367565b610b7f5f6124e1565b5f5b81811015611201576111f98383838181106111ed576111ed612c63565b905060200201356107b5565b6001016111d0565b505050565b61120e612367565b5f828152600d602090815260408083208484529091529020541561125e576040517fb82a474600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f03611297576040517f6f12f3dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160608101825283815260208082018481525f838501818152600e80546001808201835582855296517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd60039092029182015593517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fe85015590517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3ff909301929092559054868252600d83528482208683529092529290922082905561135f91612cc1565b60408051848152602081018490527f4d93067d0d628fe42c457623322c0f22ad92f71762a2eebe06e2a0e7d2aa61c7910160405180910390a25050565b6113a4612367565b6009544211156113e0576040517fe76c625f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b804211806113ef5750600a5481115b15611426576040517fb7d0949700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098190556040518181527f333fbfe183fcd0d2b5c40ad00a9aea8f2ef8d7187c5e0d7c76f40b060286b87c906020016111b2565b611463612367565b610b7f612551565b6060600480546106c790612c2b565b335f8181526001602090815260408083206001600160a01b03871684529091528120549091908381101561151b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6107aa8286868403611c0c565b5f33610755818585611e12565b61156a6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f151581525090565b6001600160a01b0383165f908152600c6020526040902060040180548390811061159657611596612c63565b5f9182526020918290206040805160c081018252600690930290910180548352600181015493830193909352600283015490820152600382015460608201526004820154608082015260059091015460ff16151560a0820152905092915050565b6115ff612008565b61160761205b565b5f600e838154811061161b5761161b612c63565b905f5260205f2090600302019050805f01545f03611665576040517f87e8068300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61166d6120b4565b335f908152600c60205260409020600181015415611729575f81600201547f0000000000000000000000000000000000000000000000000de0b6b3a764000060085484600101546116be9190612c8b565b6116c89190612ca2565b6116d29190612cc1565b905080156117275780826003015f8282546116ed9190612cd4565b9091555061172790506001600160a01b037f0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e4516338361214c565b505b82156118ef5781545f9061173e908590612c8b565b90506117756040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f151581525090565b60208101859052858152604081018290524260608201819052600185015461179c91612cd4565b60808201908152600160a083018181526004868101805480850182555f91825260208083208851600690930201918255870151948101949094556040860151600285015560608601516003850155935190830155516005909101805460ff1916911515919091179055835486918591611816908490612cd4565b9250508190555081836001015f8282546118309190612cd4565b9250508190555084846002015f82825461184a9190612cd4565b9091555061188590506001600160a01b037f0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e451633308861258e565b61188f3383612419565b60048301546118a090600190612cc1565b604082810151608084015182518981526020810192909252818301529051889133917ff943cf10ef4d1e3239f4716ddecdf546e8ba8ab0e41deafd9a71a99936827e459181900360600190a450505b7f0000000000000000000000000000000000000000000000000de0b6b3a764000060085482600101546119229190612c8b565b61192c9190612ca2565b600290910155506110516001600555565b611945612367565b6001600160a01b0381166119c15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401611512565b610aa2816124e1565b6001600160a01b0381165f908152600c60209081526040808320815160a081018352815481526001820154818501526002820154818401526003820154606082015260048201805484518187028101870190955280855286959294608086019390929190879084015b82821015611a9f575f8481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a08301529083529092019101611a33565b50505091525050600854600b549192509042118015611abf575060025415155b15611b30575f611ad1600b54426125df565b90505f60075482611ae29190612c8b565b9050611aed60025490565b611b177f0000000000000000000000000000000000000000000000000de0b6b3a764000083612c8b565b611b219190612ca2565b611b2b9084612cd4565b925050505b81604001517f0000000000000000000000000000000000000000000000000de0b6b3a7640000828460200151611b669190612c8b565b611b709190612ca2565b611b7a9190612cc1565b949350505050565b611b8a612367565b80421180611b99575080600954115b15611bd0576040517fb7d0949700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611bd86120b4565b600a8190556040518181527ec120dc5e082694674c24ab7b88010f8ec91c9cfa404fc7b0418d5d267468ec906020016111b2565b6001600160a01b038316611c875760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b038216611d035760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b038381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381165f908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611e0c5781811015611dff5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611512565b611e0c8484848403611c0c565b50505050565b6001600160a01b038316611e8e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b038216611f0a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401611512565b611f15838383612630565b6001600160a01b0383165f9081526020819052604090205481811015611fa35760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b038481165f81815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611e0c565b60065460ff1615610b7f5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401611512565b6002600554036120ad5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611512565b6002600555565b600b5442116120bf57565b5f6120c960025490565b9050805f036120d9575042600b55565b5f6120e6600b54426125df565b90505f600754826120f79190612c8b565b9050826121247f0000000000000000000000000000000000000000000000000de0b6b3a764000083612c8b565b61212e9190612ca2565b60085f82825461213e9190612cd4565b909155505042600b55505050565b6040516001600160a01b0383166024820152604481018290526112019084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612687565b6001600160a01b0382166122715760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401611512565b61227c825f83612630565b6001600160a01b0382165f908152602081905260409020548181101561230a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401611512565b6001600160a01b0383165f818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6006546001600160a01b03610100909104163314610b7f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611512565b6123cf61276b565b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b03821661246f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611512565b61247a5f8383612630565b8060025f82825461248b9190612cd4565b90915550506001600160a01b0382165f81815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600680546001600160a01b038381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b612559612008565b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586123fc3390565b6040516001600160a01b0380851660248301528316604482015260648101829052611e0c9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612191565b5f6009544210156125f157505f61075b565b600a54821161260b576126048383612cc1565b905061075b565b600a54831061261b57505f61075b565b82600a546126299190612cc1565b9392505050565b6001600160a01b0383161580159061265057506001600160a01b03821615155b15611201576040517f9cbe235700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6126db826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127bd9092919063ffffffff16565b80519091501561120157808060200190518101906126f99190612ce7565b6112015760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401611512565b60065460ff16610b7f5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401611512565b6060611b7a84845f85855f80866001600160a01b031685876040516127e29190612d06565b5f6040518083038185875af1925050503d805f811461281c576040519150601f19603f3d011682016040523d82523d5f602084013e612821565b606091505b50915091506128328783838761283d565b979650505050505050565b606083156128ab5782515f036128a4576001600160a01b0385163b6128a45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611512565b5081611b7a565b611b7a83838151156128c05781518083602001fd5b8060405162461bcd60e51b815260040161151291906128fc565b5f5b838110156128f45781810151838201526020016128dc565b50505f910152565b602081525f825180602084015261291a8160408501602087016128da565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114612944575f80fd5b919050565b5f806040838503121561295a575f80fd5b6129638361292e565b946020939093013593505050565b5f60208284031215612981575f80fd5b5035919050565b5f60208284031215612998575f80fd5b6126298261292e565b5f805f606084860312156129b3575f80fd5b6129bc8461292e565b92506129ca6020850161292e565b9150604084013590509250925092565b5f8083601f8401126129ea575f80fd5b50813567ffffffffffffffff811115612a01575f80fd5b6020830191508360208260051b8501011115612a1b575f80fd5b9250929050565b5f805f8060408587031215612a35575f80fd5b843567ffffffffffffffff80821115612a4c575f80fd5b612a58888389016129da565b90965094506020870135915080821115612a70575f80fd5b50612a7d878288016129da565b95989497509550505050565b5f805f60608486031215612a9b575f80fd5b505081359360208301359350604090920135919050565b5f8060408385031215612ac3575f80fd5b50508035926020909101359150565b5f60a08201878352602087602085015286604085015285606085015260a0608085015281855180845260c0935060c086019150602087015f5b82811015612b6557612b55848351805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a0810151151560a08301525050565b9285019290840190600101612b0b565b50919b9a5050505050505050505050565b5f8060208385031215612b87575f80fd5b823567ffffffffffffffff811115612b9d575f80fd5b612ba9858286016129da565b90969095509350505050565b60c0810161075b8284805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a0810151151560a08301525050565b5f8060408385031215612c0b575f80fd5b612c148361292e565b9150612c226020840161292e565b90509250929050565b600181811c90821680612c3f57607f821691505b602082108103612c5d57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761075b5761075b612c77565b5f82612cbc57634e487b7160e01b5f52601260045260245ffd5b500490565b8181038181111561075b5761075b612c77565b8082018082111561075b5761075b612c77565b5f60208284031215612cf7575f80fd5b81518015158114612629575f80fd5b5f8251612d178184602087016128da565b919091019291505056fea264697066735822122063e31393f39d0bf302c30a94ff1fb370e960ca7f4ba1ef009c70f1a39f9d05e264736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e450000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e45000000000000000000000000000000000000000000000000593bf2eeb1c300000000000000000000000000000000000000000000000000000000000067c599c000000000000000000000000000000000000000000000000000000000712cecc0
-----Decoded View---------------
Arg [0] : _stakeToken (address): 0x9D8c68F185A04314DDC8B8216732455e8dbb7E45
Arg [1] : _rewardToken (address): 0x9D8c68F185A04314DDC8B8216732455e8dbb7E45
Arg [2] : _rewardPerSecond (uint256): 6430000000000000000
Arg [3] : _rewardStartTimestamp (uint256): 1741003200
Arg [4] : _rewardEndTimestamp (uint256): 1898769600
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e45
Arg [1] : 0000000000000000000000009d8c68f185a04314ddc8b8216732455e8dbb7e45
Arg [2] : 000000000000000000000000000000000000000000000000593bf2eeb1c30000
Arg [3] : 0000000000000000000000000000000000000000000000000000000067c599c0
Arg [4] : 00000000000000000000000000000000000000000000000000000000712cecc0
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
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.