Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- DexiStake
- Optimization enabled
- true
- Compiler version
- v0.8.13+commit.abaa5c0e
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2023-03-25T16:49:09.836427Z
Contract source code
/** *Submitted for verification at polygonscan.com on 2022-11-27 */ // File: @openzeppelin/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // 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); } // File: @openzeppelin/contracts/utils/Context.sol // 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; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; /** * @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); } } // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: contracts/Dexi/DexiStake.sol pragma solidity ^0.8.9; contract DexiStake is Ownable, ReentrancyGuard { address public _rewardTokenAddress = 0xD22a58f79e9481D1a88e00c343885A588b34b68B; address public _stakingTokenAddress = 0xD22a58f79e9481D1a88e00c343885A588b34b68B; // apr = usdcPerSecondPerUsdc * 365 * 24 * 60 * 60 / 1e6 / 1e8 * 100 uint256 public _usdcPerSecondPerUsdc = 190258000; //8 decimals uint256 public _lockPeriod = 60 days; uint256 public totalDexiAwarded = 0; uint256 public totalUsdcAwarded = 0; struct UserInfo { address user; uint256 stakedAmount; uint256 rewardAmount; uint256 lastOperation; uint256 unlockTime; } mapping(address => UserInfo) public userInfo; address[] private users; modifier isUnlocked() { require( userInfo[msg.sender].unlockTime <= block.timestamp, "operator: your funds are still locked!" ); _; } constructor() { } function getUnlockingFundsAt(uint256 timestamp) public view returns (uint256) { uint256 result = 0; for (uint256 i = 0; i < users.length; i++) { if (timestamp >= userInfo[users[i]].unlockTime) { result += userInfo[users[i]].stakedAmount; } } return result; } function getStakedFundsAt(uint256 timestamp) public view returns (uint256) { uint256 result = 0; for (uint256 i = 0; i < users.length; i++) { result += userInfo[users[i]].stakedAmount; } return result; } function getTotalDexiRewardsAt(uint256 timestamp) public view returns (uint256) { uint256 usdcRewards = getTotalUsdcRewardsAt(timestamp); uint256 rewardsInDexi = usdcRewards; return rewardsInDexi; } function getTotalUsdcRewardsAt(uint256 timestamp) public view returns (uint256) { uint256 result = 0; for (uint256 i = 0; i < users.length; i++) { result += getRewardsAt(users[i], timestamp); } return result; } function getAllRewardsAt(uint256 timestamp) public view returns (uint256) { uint256 result = 0; for (uint256 i = 0; i < users.length; i++) { if (timestamp >= userInfo[users[i]].unlockTime) { result += getRewardsAt(users[i], timestamp); } } return result; } function getNeededDepositForUnlockingFunds(uint256 timestamp) public view returns (uint256, uint256) { uint256 unlockingFunds = getUnlockingFundsAt(timestamp); uint256 stakingTokenBalance = IERC20(_stakingTokenAddress).balanceOf( address(this) ); uint256 unlockingRewards = getAllRewardsAt(timestamp); uint256 rewardTokenBalance = IERC20(_rewardTokenAddress).balanceOf( address(this) ); uint256 rewardsInDexi = unlockingRewards; return ( stakingTokenBalance > unlockingFunds ? 0 : unlockingFunds - stakingTokenBalance, rewardTokenBalance > rewardsInDexi ? 0 : rewardsInDexi - rewardTokenBalance ); } function getPendingRewards(address user) public view returns (uint256) { uint256 pendingRewards = ((block.timestamp - userInfo[user].lastOperation) * (userInfo[user].stakedAmount) * _usdcPerSecondPerUsdc) / 100000000 / 1e9; return pendingRewards; } function getRewardsAt(address user, uint256 timestamp) public view returns (uint256) { if (timestamp <= block.timestamp) { return getTotalRewards(user); } else { uint256 futureRewards = ((((timestamp - block.timestamp) * userInfo[user].stakedAmount) / 1e9) * _usdcPerSecondPerUsdc) / 100000000; return getTotalRewards(user) + (futureRewards); } } function getTotalRewards(address user) public view returns (uint256) { return userInfo[user].rewardAmount + getPendingRewards(user); } function getTotalUsers() public view returns (uint256) { return users.length; } function deposit(uint256 amount) public nonReentrant { uint256 amountStaked = amount; uint256 rewardAmount = 0; if (userInfo[msg.sender].user == address(0)) { users.push(msg.sender); } else { amountStaked += userInfo[msg.sender].stakedAmount; rewardAmount = userInfo[msg.sender].rewardAmount + getPendingRewards(msg.sender); } userInfo[msg.sender] = UserInfo({ user: msg.sender, stakedAmount: amountStaked, rewardAmount: rewardAmount, lastOperation: block.timestamp, unlockTime: block.timestamp + _lockPeriod }); uint256 dexiPerAmount = amount; IERC20(_stakingTokenAddress).transferFrom( msg.sender, address(this), amount ); } function withdraw() public isUnlocked nonReentrant { userInfo[msg.sender].rewardAmount += getPendingRewards(msg.sender); userInfo[msg.sender].lastOperation = block.timestamp; userInfo[msg.sender].unlockTime = block.timestamp + _lockPeriod; IERC20(_stakingTokenAddress).transfer( msg.sender, userInfo[msg.sender].stakedAmount ); uint256 rewardsInDexi = userInfo[msg.sender].rewardAmount; if (rewardsInDexi > 0) { IERC20(_rewardTokenAddress).transfer(msg.sender, rewardsInDexi); totalDexiAwarded += rewardsInDexi; totalUsdcAwarded += userInfo[msg.sender].rewardAmount; } userInfo[msg.sender].rewardAmount = 0; userInfo[msg.sender].stakedAmount = 0; } function claim() public isUnlocked nonReentrant { userInfo[msg.sender].rewardAmount += getPendingRewards(msg.sender); userInfo[msg.sender].lastOperation = block.timestamp; userInfo[msg.sender].unlockTime = block.timestamp + _lockPeriod; uint256 rewardsInDexi = userInfo[msg.sender].rewardAmount; totalDexiAwarded += rewardsInDexi; totalUsdcAwarded += userInfo[msg.sender].rewardAmount; IERC20(_rewardTokenAddress).transfer(msg.sender, rewardsInDexi); userInfo[msg.sender].rewardAmount = 0; } function getCurrentDexiRewards(address user) public view returns (uint256) { uint256 rewardsInDexi = getTotalRewards(user); return rewardsInDexi; } function withdraw(address[] calldata tokenAddresses) public onlyOwner { for (uint256 i = 0; i < tokenAddresses.length; i++) { IERC20(tokenAddresses[i]).transfer( msg.sender, IERC20(tokenAddresses[i]).balanceOf(address(this)) ); } } function setRewardTokenAddress(address rewardTokenAddress) public onlyOwner { _rewardTokenAddress = rewardTokenAddress; } function setStakingTokenAddress(address stakingTokenAddress) public onlyOwner { _stakingTokenAddress = stakingTokenAddress; } function setUsdcPerSecondPerUsdc(uint256 usdcPerSecondPerUsdc) public onlyOwner { _usdcPerSecondPerUsdc = usdcPerSecondPerUsdc; } function setLockPeriod(uint256 lockPeriod) public onlyOwner { _lockPeriod = lockPeriod; } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"_lockPeriod","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"_rewardTokenAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"_stakingTokenAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"_usdcPerSecondPerUsdc","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getAllRewardsAt","inputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCurrentDexiRewards","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getNeededDepositForUnlockingFunds","inputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPendingRewards","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRewardsAt","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getStakedFundsAt","inputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalDexiRewardsAt","inputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalRewards","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalUsdcRewardsAt","inputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalUsers","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getUnlockingFundsAt","inputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLockPeriod","inputs":[{"type":"uint256","name":"lockPeriod","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRewardTokenAddress","inputs":[{"type":"address","name":"rewardTokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStakingTokenAddress","inputs":[{"type":"address","name":"stakingTokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setUsdcPerSecondPerUsdc","inputs":[{"type":"uint256","name":"usdcPerSecondPerUsdc","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalDexiAwarded","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalUsdcAwarded","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"stakedAmount","internalType":"uint256"},{"type":"uint256","name":"rewardAmount","internalType":"uint256"},{"type":"uint256","name":"lastOperation","internalType":"uint256"},{"type":"uint256","name":"unlockTime","internalType":"uint256"}],"name":"userInfo","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"address[]","name":"tokenAddresses","internalType":"address[]"}]}]
Contract Creation Code
0x60806040526002805473d22a58f79e9481d1a88e00c343885a588b34b68b6001600160a01b03199182168117909255600380549091169091179055630b571b50600455624f1a006005556000600681905560075534801561005f57600080fd5b5061006933610072565b600180556100c2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61144e806100d16000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c806379e7624211610104578063b8253522116100a2578063ed26300511610071578063ed26300514610401578063f2fde38b14610414578063f6ed201714610427578063fc01b9b31461043a57600080fd5b8063b8253522146103b4578063bd5dec98146103bd578063cdc416e9146103d0578063e777c015146103d957600080fd5b80639a6acf20116100de5780639a6acf20146103735780639aa865d1146103865780639be572f614610399578063b6b55f25146103a157600080fd5b806379e762421461033c5780638da5cb5b1461034f578063983784851461036057600080fd5b80633fd040a91161017157806359a612de1161014b57806359a612de146103055780635ab7b60914610318578063715018a614610321578063779972da1461032957600080fd5b80633fd040a9146102d757806340bd8e89146102ea5780634e71d92d146102fd57600080fd5b80631959a002116101ad5780631959a0021461022e5780632bcf161c146102a75780633ccfd60b146102ba5780633fc2755c146102c457600080fd5b806305c85b40146101d45780630ef562ad1461020457806315566a5b14610225575b600080fd5b6002546101e7906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6102176102123660046111bc565b61044d565b6040519081526020016101fb565b61021760055481565b61027561023c3660046111f1565b600860205260009081526040902080546001820154600283015460038401546004909401546001600160a01b0390931693919290919085565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a0016101fb565b6102176102b53660046111f1565b610460565b6102c2610497565b005b6102176102d23660046111bc565b6106d5565b6102176102e53660046111f1565b610780565b6102c26102f83660046111bc565b61078c565b6102c2610799565b6102176103133660046111bc565b610936565b61021760045481565b6102c26109a2565b6102c26103373660046111bc565b6109b6565b61021761034a3660046111bc565b6109c3565b6000546001600160a01b03166101e7565b6102c261036e3660046111f1565b610a06565b6102c26103813660046111f1565b610a30565b61021761039436600461120c565b610a5a565b600954610217565b6102c26103af3660046111bc565b610af0565b61021760075481565b6102c26103cb366004611236565b610cdb565b61021760065481565b6103ec6103e73660046111bc565b610e3c565b604080519283526020830191909152016101fb565b6003546101e7906001600160a01b031681565b6102c26104223660046111f1565b610f7e565b6102176104353660046111f1565b610ff7565b6102176104483660046111bc565b611060565b600080610459836109c3565b9392505050565b600061046b82610ff7565b6001600160a01b03831660009081526008602052604090206002015461049191906112c1565b92915050565b336000908152600860205260409020600401544210156104d25760405162461bcd60e51b81526004016104c9906112d9565b60405180910390fd5b6002600154036104f45760405162461bcd60e51b81526004016104c99061131f565b600260015561050233610ff7565b33600090815260086020526040812060020180549091906105249084906112c1565b909155505033600090815260086020526040902042600390910181905560055461054d916112c1565b3360008181526008602052604090819020600480820194909455600354600190910154915163a9059cbb60e01b81529384019290925260248301526001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de9190611356565b503360009081526008602052604090206002015480156106b15760025460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610649573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066d9190611356565b50806006600082825461068091906112c1565b90915550503360009081526008602052604081206002015460078054919290916106ab9084906112c1565b90915550505b50336000908152600860205260408120600281018290556001908101919091558055565b600080805b6009548110156107795760086000600983815481106106fb576106fb611378565b60009182526020808320909101546001600160a01b0316835282019290925260400190206004015484106107675761075a6009828154811061073f5761073f611378565b6000918252602090912001546001600160a01b031685610a5a565b61076490836112c1565b91505b806107718161138e565b9150506106da565b5092915050565b60008061045983610460565b610794611112565b600455565b336000908152600860205260409020600401544210156107cb5760405162461bcd60e51b81526004016104c9906112d9565b6002600154036107ed5760405162461bcd60e51b81526004016104c99061131f565b60026001556107fb33610ff7565b336000908152600860205260408120600201805490919061081d9084906112c1565b9091555050336000908152600860205260409020426003909101819055600554610846916112c1565b336000908152600860205260408120600481019290925560029091015460068054919283926108769084906112c1565b90915550503360009081526008602052604081206002015460078054919290916108a19084906112c1565b909155505060025460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156108f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091b9190611356565b50503360009081526008602052604081206002015560018055565b600080805b60095481101561077957600860006009838154811061095c5761095c611378565b60009182526020808320909101546001600160a01b0316835282019290925260400190206001015461098e90836112c1565b91508061099a8161138e565b91505061093b565b6109aa611112565b6109b4600061116c565b565b6109be611112565b600555565b600080805b600954811015610779576109e86009828154811061073f5761073f611378565b6109f290836112c1565b9150806109fe8161138e565b9150506109c8565b610a0e611112565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b610a38611112565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000428211610a7357610a6c83610460565b9050610491565b6004546001600160a01b03841660009081526008602052604081206001015490916305f5e10091633b9aca0090610aaa42886113a7565b610ab491906113be565b610abe91906113dd565b610ac891906113be565b610ad291906113dd565b905080610ade85610460565b610ae891906112c1565b949350505050565b600260015403610b125760405162461bcd60e51b81526004016104c99061131f565b6002600155336000908152600860205260408120548291906001600160a01b0316610b7e57600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b03191633179055610bc6565b33600090815260086020526040902060010154610b9b90836112c1565b9150610ba633610ff7565b33600090815260086020526040902060020154610bc391906112c1565b90505b6040518060a00160405280336001600160a01b0316815260200183815260200182815260200142815260200160055442610c0091906112c1565b905233600081815260086020908152604091829020845181546001600160a01b0319166001600160a01b039182161782559185015160018201558483015160028201556060850151600380830191909155608090950151600491820155935491516323b872dd60e01b8152938401929092523060248401526044830186905285929116906323b872dd906064016020604051808303816000875af1158015610cac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd09190611356565b505060018055505050565b610ce3611112565b60005b81811015610e3757828282818110610d0057610d00611378565b9050602002016020810190610d1591906111f1565b6001600160a01b031663a9059cbb33858585818110610d3657610d36611378565b9050602002016020810190610d4b91906111f1565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015610d91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db591906113ff565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610e00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e249190611356565b5080610e2f8161138e565b915050610ce6565b505050565b6000806000610e4a84611060565b6003546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610e98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebc91906113ff565b90506000610ec9866106d5565b6002546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610f17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3b91906113ff565b905081848411610f5457610f4f84866113a7565b610f57565b60005b818311610f6d57610f6883836113a7565b610f70565b60005b965096505050505050915091565b610f86611112565b6001600160a01b038116610feb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c9565b610ff48161116c565b50565b6004546001600160a01b0382166000908152600860205260408120600181015460039091015491928392633b9aca00926305f5e100929161103890426113a7565b61104291906113be565b61104c91906113be565b61105691906113dd565b61045991906113dd565b600080805b60095481101561077957600860006009838154811061108657611086611378565b60009182526020808320909101546001600160a01b0316835282019290925260400190206004015484106111005760086000600983815481106110cb576110cb611378565b60009182526020808320909101546001600160a01b031683528201929092526040019020600101546110fd90836112c1565b91505b8061110a8161138e565b915050611065565b6000546001600160a01b031633146109b45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104c9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156111ce57600080fd5b5035919050565b80356001600160a01b03811681146111ec57600080fd5b919050565b60006020828403121561120357600080fd5b610459826111d5565b6000806040838503121561121f57600080fd5b611228836111d5565b946020939093013593505050565b6000806020838503121561124957600080fd5b823567ffffffffffffffff8082111561126157600080fd5b818501915085601f83011261127557600080fd5b81358181111561128457600080fd5b8660208260051b850101111561129957600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156112d4576112d46112ab565b500190565b60208082526026908201527f6f70657261746f723a20796f75722066756e647320617265207374696c6c206c6040820152656f636b65642160d01b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561136857600080fd5b8151801515811461045957600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600182016113a0576113a06112ab565b5060010190565b6000828210156113b9576113b96112ab565b500390565b60008160001904831182151516156113d8576113d86112ab565b500290565b6000826113fa57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561141157600080fd5b505191905056fea264697066735822122095b59be1741d1ec496622c15887c0a5fbd3377a6985f4c51bfc9c908332f173464736f6c634300080d0033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806379e7624211610104578063b8253522116100a2578063ed26300511610071578063ed26300514610401578063f2fde38b14610414578063f6ed201714610427578063fc01b9b31461043a57600080fd5b8063b8253522146103b4578063bd5dec98146103bd578063cdc416e9146103d0578063e777c015146103d957600080fd5b80639a6acf20116100de5780639a6acf20146103735780639aa865d1146103865780639be572f614610399578063b6b55f25146103a157600080fd5b806379e762421461033c5780638da5cb5b1461034f578063983784851461036057600080fd5b80633fd040a91161017157806359a612de1161014b57806359a612de146103055780635ab7b60914610318578063715018a614610321578063779972da1461032957600080fd5b80633fd040a9146102d757806340bd8e89146102ea5780634e71d92d146102fd57600080fd5b80631959a002116101ad5780631959a0021461022e5780632bcf161c146102a75780633ccfd60b146102ba5780633fc2755c146102c457600080fd5b806305c85b40146101d45780630ef562ad1461020457806315566a5b14610225575b600080fd5b6002546101e7906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6102176102123660046111bc565b61044d565b6040519081526020016101fb565b61021760055481565b61027561023c3660046111f1565b600860205260009081526040902080546001820154600283015460038401546004909401546001600160a01b0390931693919290919085565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a0016101fb565b6102176102b53660046111f1565b610460565b6102c2610497565b005b6102176102d23660046111bc565b6106d5565b6102176102e53660046111f1565b610780565b6102c26102f83660046111bc565b61078c565b6102c2610799565b6102176103133660046111bc565b610936565b61021760045481565b6102c26109a2565b6102c26103373660046111bc565b6109b6565b61021761034a3660046111bc565b6109c3565b6000546001600160a01b03166101e7565b6102c261036e3660046111f1565b610a06565b6102c26103813660046111f1565b610a30565b61021761039436600461120c565b610a5a565b600954610217565b6102c26103af3660046111bc565b610af0565b61021760075481565b6102c26103cb366004611236565b610cdb565b61021760065481565b6103ec6103e73660046111bc565b610e3c565b604080519283526020830191909152016101fb565b6003546101e7906001600160a01b031681565b6102c26104223660046111f1565b610f7e565b6102176104353660046111f1565b610ff7565b6102176104483660046111bc565b611060565b600080610459836109c3565b9392505050565b600061046b82610ff7565b6001600160a01b03831660009081526008602052604090206002015461049191906112c1565b92915050565b336000908152600860205260409020600401544210156104d25760405162461bcd60e51b81526004016104c9906112d9565b60405180910390fd5b6002600154036104f45760405162461bcd60e51b81526004016104c99061131f565b600260015561050233610ff7565b33600090815260086020526040812060020180549091906105249084906112c1565b909155505033600090815260086020526040902042600390910181905560055461054d916112c1565b3360008181526008602052604090819020600480820194909455600354600190910154915163a9059cbb60e01b81529384019290925260248301526001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de9190611356565b503360009081526008602052604090206002015480156106b15760025460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610649573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066d9190611356565b50806006600082825461068091906112c1565b90915550503360009081526008602052604081206002015460078054919290916106ab9084906112c1565b90915550505b50336000908152600860205260408120600281018290556001908101919091558055565b600080805b6009548110156107795760086000600983815481106106fb576106fb611378565b60009182526020808320909101546001600160a01b0316835282019290925260400190206004015484106107675761075a6009828154811061073f5761073f611378565b6000918252602090912001546001600160a01b031685610a5a565b61076490836112c1565b91505b806107718161138e565b9150506106da565b5092915050565b60008061045983610460565b610794611112565b600455565b336000908152600860205260409020600401544210156107cb5760405162461bcd60e51b81526004016104c9906112d9565b6002600154036107ed5760405162461bcd60e51b81526004016104c99061131f565b60026001556107fb33610ff7565b336000908152600860205260408120600201805490919061081d9084906112c1565b9091555050336000908152600860205260409020426003909101819055600554610846916112c1565b336000908152600860205260408120600481019290925560029091015460068054919283926108769084906112c1565b90915550503360009081526008602052604081206002015460078054919290916108a19084906112c1565b909155505060025460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156108f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091b9190611356565b50503360009081526008602052604081206002015560018055565b600080805b60095481101561077957600860006009838154811061095c5761095c611378565b60009182526020808320909101546001600160a01b0316835282019290925260400190206001015461098e90836112c1565b91508061099a8161138e565b91505061093b565b6109aa611112565b6109b4600061116c565b565b6109be611112565b600555565b600080805b600954811015610779576109e86009828154811061073f5761073f611378565b6109f290836112c1565b9150806109fe8161138e565b9150506109c8565b610a0e611112565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b610a38611112565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000428211610a7357610a6c83610460565b9050610491565b6004546001600160a01b03841660009081526008602052604081206001015490916305f5e10091633b9aca0090610aaa42886113a7565b610ab491906113be565b610abe91906113dd565b610ac891906113be565b610ad291906113dd565b905080610ade85610460565b610ae891906112c1565b949350505050565b600260015403610b125760405162461bcd60e51b81526004016104c99061131f565b6002600155336000908152600860205260408120548291906001600160a01b0316610b7e57600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b03191633179055610bc6565b33600090815260086020526040902060010154610b9b90836112c1565b9150610ba633610ff7565b33600090815260086020526040902060020154610bc391906112c1565b90505b6040518060a00160405280336001600160a01b0316815260200183815260200182815260200142815260200160055442610c0091906112c1565b905233600081815260086020908152604091829020845181546001600160a01b0319166001600160a01b039182161782559185015160018201558483015160028201556060850151600380830191909155608090950151600491820155935491516323b872dd60e01b8152938401929092523060248401526044830186905285929116906323b872dd906064016020604051808303816000875af1158015610cac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd09190611356565b505060018055505050565b610ce3611112565b60005b81811015610e3757828282818110610d0057610d00611378565b9050602002016020810190610d1591906111f1565b6001600160a01b031663a9059cbb33858585818110610d3657610d36611378565b9050602002016020810190610d4b91906111f1565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015610d91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db591906113ff565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610e00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e249190611356565b5080610e2f8161138e565b915050610ce6565b505050565b6000806000610e4a84611060565b6003546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610e98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebc91906113ff565b90506000610ec9866106d5565b6002546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610f17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3b91906113ff565b905081848411610f5457610f4f84866113a7565b610f57565b60005b818311610f6d57610f6883836113a7565b610f70565b60005b965096505050505050915091565b610f86611112565b6001600160a01b038116610feb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c9565b610ff48161116c565b50565b6004546001600160a01b0382166000908152600860205260408120600181015460039091015491928392633b9aca00926305f5e100929161103890426113a7565b61104291906113be565b61104c91906113be565b61105691906113dd565b61045991906113dd565b600080805b60095481101561077957600860006009838154811061108657611086611378565b60009182526020808320909101546001600160a01b0316835282019290925260400190206004015484106111005760086000600983815481106110cb576110cb611378565b60009182526020808320909101546001600160a01b031683528201929092526040019020600101546110fd90836112c1565b91505b8061110a8161138e565b915050611065565b6000546001600160a01b031633146109b45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104c9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156111ce57600080fd5b5035919050565b80356001600160a01b03811681146111ec57600080fd5b919050565b60006020828403121561120357600080fd5b610459826111d5565b6000806040838503121561121f57600080fd5b611228836111d5565b946020939093013593505050565b6000806020838503121561124957600080fd5b823567ffffffffffffffff8082111561126157600080fd5b818501915085601f83011261127557600080fd5b81358181111561128457600080fd5b8660208260051b850101111561129957600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156112d4576112d46112ab565b500190565b60208082526026908201527f6f70657261746f723a20796f75722066756e647320617265207374696c6c206c6040820152656f636b65642160d01b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561136857600080fd5b8151801515811461045957600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600182016113a0576113a06112ab565b5060010190565b6000828210156113b9576113b96112ab565b500390565b60008160001904831182151516156113d8576113d86112ab565b500290565b6000826113fa57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561141157600080fd5b505191905056fea264697066735822122095b59be1741d1ec496622c15887c0a5fbd3377a6985f4c51bfc9c908332f173464736f6c634300080d0033