Contract Overview
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0xc977442062f80adbb8e628a12f5c6ff4d0167eee5c06887483bb4cb6bad54554 | 30829716 | 317 days 6 hrs ago | 0x2fae83b3916e1467c970c113399ee91b31412bcd | Contract Creation | 0 MATIC |
[ Download CSV Export ]
Contract Name:
ElysianFields
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import './JRTFutures.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; contract ElysianFields is Ownable { using SafeMath for uint256; using SafeERC20 for JRTFutures; using SafeERC20 for IERC20; struct UserInfo { uint256 amount; // amount of LP tokens provided by the user uint256 rewardDebt; // Reward debt. See explanation below. // // We do some fancy math here. Basically, any point in time, the amount of AURs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accRwdPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accRwdPerShare` (and `lastRewardBlock`) gets updated. // 2. User receives the pending reward sent to his/her address. // 3. User's `amount` gets updated. // 4. User's `rewardDebt` gets updated. } struct PoolInfo { IERC20 lpToken; // address of the LP token contract uint256 allocPoint; // Allocation points for said pool. AURs to be distributed to pool participants per block uint256 lastRewardBlock; // Last block number that AURs distribution occurs. uint256 accRwdPerShare; // Accumulated AUR rewards per share, times 1e18 } constructor( address _owner, string memory _name, string memory _symbol, uint256 _cap, uint256 _amountForPool, address _rewardReceiver ) { transferOwnership(_owner); deployJrtFutures(_name, _symbol, _cap, _amountForPool, _rewardReceiver); } // The Reward token JRTFutures public rwdToken; // Info of each pool. PoolInfo[] public poolInfo; // Info of each user that stakes LP tokens. mapping(uint256 => mapping(address => UserInfo)) public userInfo; // Total allocation points in all pools. uint256 public totalAllocPoints = 0; // Reward tokens per block to be distributed uint256 public rwdPerBlock; // The block number when RWD mining starts uint256 public startBlock; // The ending block of the current program - rwdPerBlock will be set to 0 after block number is reached uint256 public endBlock; // The timeout expressed in block, after which owner can withdraw excess amount uint256 public claimTimeout; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw( address indexed user, uint256 indexed pid, uint256 amount ); /** @dev Deploys a new RewardToken contract. Callable only by Owner. Mints the cap amount and transfers it to this contract * @param _name - Pass a name for the token * @param _symbol - Pass a symbol for the token * @param _cap - set a cap on how many ERC20 reward tokens can be minted * @param _amountForPool - a portion of the ERC20 reward token is transferred to owner to create a new pool on a DEX * @param _rewardReceiver - receiver of the portion of ERC20 reward token */ function deployJrtFutures( string memory _name, string memory _symbol, uint256 _cap, uint256 _amountForPool, address _rewardReceiver ) internal { rwdToken = new JRTFutures(_name, _symbol, _cap); rwdToken.safeTransfer(_rewardReceiver, _amountForPool); } /** @dev - A function to add a pool or multiple pools to the contract * @param _allocPoints - An array of the allocation points for each pool that will be added * @param _lpTokens - An array of each LP token for which a pool is created */ function add(uint256[] calldata _allocPoints, IERC20[] calldata _lpTokens) external onlyOwner { require( address(rwdToken) != address(0), 'A reward token has not been deployed' ); require( _allocPoints.length == _lpTokens.length, 'Arrays length doesnt match' ); massUpdatePools(); uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; uint256 tempTotalAllocPoints = totalAllocPoints; for (uint256 j = 0; j < _lpTokens.length; j++) { tempTotalAllocPoints = tempTotalAllocPoints.add(_allocPoints[j]); poolInfo.push( PoolInfo({ lpToken: _lpTokens[j], allocPoint: _allocPoints[j], lastRewardBlock: lastRewardBlock, accRwdPerShare: 0 }) ); } totalAllocPoints = tempTotalAllocPoints; } /** @dev - Updates the allocationPoints for an array of pools * @param _pids - An array of pool ids which will be updated * @param _allocPoints - An array of allocationPoints for each pool that will be updated */ function set(uint256[] calldata _pids, uint256[] calldata _allocPoints) external onlyOwner { require(_pids.length == _allocPoints.length, 'Arrays length doesnt match'); massUpdatePools(); uint256 tempTotalAllocPoints = totalAllocPoints; for (uint256 j = 0; j < _pids.length; j++) { tempTotalAllocPoints = tempTotalAllocPoints .sub(poolInfo[_pids[j]].allocPoint) .add(_allocPoints[j]); poolInfo[_pids[j]].allocPoint = _allocPoints[j]; } totalAllocPoints = tempTotalAllocPoints; } /** @dev Allows the owner to set the parameters for a new upcomming farming program * @param _startBlock - the starting block when the farming program will start * @param _endBlock - the block on which the farming program will end * @param _rwdPerBlock - updates the rwdPerBlock variable for the new farming program * @param _ownerWithdrawBlockTimeout - The added timeout after a program finishes after which the excess ERC20 tokens stored can be withdrawn by the owner */ function setProgramParameters( uint256 _startBlock, uint256 _endBlock, uint256 _rwdPerBlock, uint256 _ownerWithdrawBlockTimeout ) external onlyOwner { require( startBlock == 0, 'The start block of a program has already been set' ); require(poolInfo.length > 0, 'No pools added'); require( _startBlock > block.number, 'The start block passed is before the current block number' ); require( _endBlock > _startBlock, 'The end block passed should be bigger than _startBlock' ); require(_rwdPerBlock != 0, 'The reward per block can not be set to 0'); require( _ownerWithdrawBlockTimeout > 0, 'Claim timeout can not be set to 0' ); require( rwdToken.balanceOf(address(this)) >= _rwdPerBlock.mul(_endBlock - _startBlock), 'Smart contract has not enough balance in rewards token' ); startBlock = _startBlock; endBlock = _endBlock; rwdPerBlock = _rwdPerBlock; claimTimeout = endBlock.add(_ownerWithdrawBlockTimeout); } /** @dev Allows the owner to withdraw any excess ERC20 tokens stored in the contract * @param _receiver - The receiving address for the ERC20 tokens */ function withdrawExcessRwd(address _receiver) external onlyOwner { require( block.number > claimTimeout, 'The current farming program has not finished' ); uint256 amount = rwdToken.balanceOf(address(this)); rwdToken.safeTransfer(_receiver, amount); } /** @dev - A function to be called when depositing LP tokens to a certain pool * @param _pid - The pool id to which the user wants to deposit LP tokens * @param _amount - The amount of LP tokens to be deposited * emit - Emits the Deposit event */ function deposit(uint256 _pid, uint256 _amount) external { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(startBlock != 0, 'Program parameters not set'); updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accRwdPerShare).div(1e18).sub(user.rewardDebt); safeRewardTransfer(msg.sender, pending); } pool.lpToken.safeTransferFrom(msg.sender, address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accRwdPerShare).div(1e18); emit Deposit(msg.sender, _pid, _amount); } /** @dev - A function which is called to withdraw LP tokens from a pool * @param _pid - The pool id from which to withdraw the deposited LP tokens * @param _amount - The amount of LP tokens to withdraw * emits - Withdraw event is emited */ function withdraw(uint256 _pid, uint256 _amount) external { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, 'withdraw: not good'); updatePool(_pid); uint256 pending = user.amount.mul(pool.accRwdPerShare).div(1e18).sub(user.rewardDebt); safeRewardTransfer(msg.sender, pending); user.amount = user.amount.sub(_amount); user.rewardDebt = user.amount.mul(pool.accRwdPerShare).div(1e18); pool.lpToken.safeTransfer(address(msg.sender), _amount); emit Withdraw(msg.sender, _pid, _amount); } /** @dev - A function to withdraw any outstanding LP tokens of a user without withdrawing ERC20 reward tokens * @param _pid - The pool id on which to perform emergency withdraw */ function emergencyWithdraw(uint256 _pid) external { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; } /** @dev - Calculates the pending ERC20 reward tokens the user can claim * @param _pid - The pool id * @param _user - The address of the user * return - the pending ERC20 reward tokens to be claimed */ function pendingRwd(uint256 _pid, address _user) external view returns (uint256) { if (startBlock == 0 || block.number < startBlock) { return 0; } PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accRwdPerShare = pool.accRwdPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 rwdReward = multiplier.mul(rwdPerBlock).mul(pool.allocPoint).div(totalAllocPoints); accRwdPerShare = accRwdPerShare.add(rwdReward.mul(1e18).div(lpSupply)); } return user.amount.mul(accRwdPerShare).div(1e18).sub(user.rewardDebt); } /** @dev Checks the poolInfo struct lenght * return the number of active pools */ function poolLength() external view returns (uint256) { return poolInfo.length; } /** @dev - Updates the variables of each pool in the array */ function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } /** @dev - Updates the pool variables to be up to date * @param _pid - The ID of the pool to be updated */ function updatePool(uint256 _pid) public { require( block.number >= startBlock, 'The farming program has not yet started!' ); PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 rwdReward = multiplier.mul(rwdPerBlock).mul(pool.allocPoint).div(totalAllocPoints); pool.accRwdPerShare = pool.accRwdPerShare.add( rwdReward.mul(1e18).div(lpSupply) ); pool.lastRewardBlock = block.number < endBlock ? block.number : endBlock; } /** @dev - Calculates and returns reward multiplier over the given _from to _to block. * @param _from - Should be a block number * @param _to - Should be a block number */ function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { if (_to <= endBlock) { return _to.sub(_from); } else if (_from >= endBlock) { return (_to.sub(_from)).mul(0); } else { return endBlock.sub(_from); } } /** @dev - A function used for safeTransfer of ERC20 tokens to the user * @param _to - The address to which the ERC20 tokens should be transferred * @param _amount - The amount to be transferred */ function safeRewardTransfer(address _to, uint256 _amount) internal { uint256 rwdTokenBal = rwdToken.balanceOf(address(this)); if (_amount > rwdTokenBal) { rwdToken.transfer(_to, rwdTokenBal); } else { rwdToken.transfer(_to, _amount); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; contract JRTFutures is ERC20Capped, Ownable { /** @dev - The constructor creates the ERC20 token and mints the cap amount * @param _name - The name of the ERC20 token that is deployed * @param _symbol - The symbol which will be used to distinguish the ERC20 token * @param _cap - The cap amount which can be minted of the ERC20 token */ constructor( string memory _name, string memory _symbol, uint256 _cap ) ERC20(_name, _symbol) ERC20Capped(_cap) { ERC20._mint(msg.sender, _cap); } /** @dev - A burn function to be called for the ERC20 token from another contract/user * @param _amount - The amount of ERC20 tokens to be burned */ function burn(uint256 _amount) external { _burn(msg.sender, _amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT 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 no longer needed starting with Solidity 0.8. 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 substraction 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; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT 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() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; /** * @dev Extension of {ERC20} that adds a cap to the supply of tokens. */ abstract contract ERC20Capped is ERC20 { uint256 private immutable _cap; /** * @dev Sets the value of the `cap`. This value is immutable, it can only be * set once during construction. */ constructor(uint256 cap_) { require(cap_ > 0, "ERC20Capped: cap is 0"); _cap = cap_; } /** * @dev Returns the cap on the token's total supply. */ function cap() public view virtual returns (uint256) { return _cap; } /** * @dev See {ERC20-_mint}. */ function _mint(address account, uint256 amount) internal virtual override { require(ERC20.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded"); super._mint(account, amount); } }
// SPDX-License-Identifier: MIT 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.zeppelin.solutions/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: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, 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}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), 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}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - 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) { _approve(_msgSender(), spender, _allowances[_msgSender()][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) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * 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: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, 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; _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; } _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 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 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 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; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_cap","type":"uint256"},{"internalType":"uint256","name":"_amountForPool","type":"uint256"},{"internalType":"address","name":"_rewardReceiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","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":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"uint256[]","name":"_allocPoints","type":"uint256[]"},{"internalType":"contract IERC20[]","name":"_lpTokens","type":"address[]"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimTimeout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingRwd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accRwdPerShare","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":"rwdPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rwdToken","outputs":[{"internalType":"contract JRTFutures","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_pids","type":"uint256[]"},{"internalType":"uint256[]","name":"_allocPoints","type":"uint256[]"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_endBlock","type":"uint256"},{"internalType":"uint256","name":"_rwdPerBlock","type":"uint256"},{"internalType":"uint256","name":"_ownerWithdrawBlockTimeout","type":"uint256"}],"name":"setProgramParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"withdrawExcessRwd","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405260006004553480156200001657600080fd5b50604051620035a8380380620035a883398101604081905262000039916200058c565b62000044336200006a565b6200004f86620000ba565b6200005e85858585856200018f565b50505050505062000731565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146200011a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038116620001815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000111565b6200018c816200006a565b50565b848484604051620001a090620004d2565b620001ae93929190620006ae565b604051809103906000f080158015620001cb573d6000803e3d6000fd5b50600180546001600160a01b0319166001600160a01b03929092169182179055620002049082846200020b602090811b6200146917901c565b5050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663a9059cbb60e01b17909152620002639185916200026816565b505050565b6000620002c4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200034660201b620014d1179092919060201c565b805190915015620002635780806020019051810190620002e591906200062b565b620002635760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000111565b606062000357848460008562000361565b90505b9392505050565b606082471015620003c45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000111565b843b620004145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000111565b600080866001600160a01b031685876040516200043291906200067b565b60006040518083038185875af1925050503d806000811462000471576040519150601f19603f3d011682016040523d82523d6000602084013e62000476565b606091505b5090925090506200048982828662000494565b979650505050505050565b60608315620004a55750816200035a565b825115620004b65782518084602001fd5b8160405162461bcd60e51b815260040162000111919062000699565b6111f080620023b883390190565b80516001600160a01b0381168114620004f857600080fd5b919050565b600082601f8301126200050e578081fd5b81516001600160401b03808211156200052b576200052b6200071b565b604051601f8301601f19908116603f011681019082821181831017156200055657620005566200071b565b816040528381528660208588010111156200056f578485fd5b62000582846020830160208901620006e8565b9695505050505050565b60008060008060008060c08789031215620005a5578182fd5b620005b087620004e0565b60208801519096506001600160401b0380821115620005cd578384fd5b620005db8a838b01620004fd565b96506040890151915080821115620005f1578384fd5b506200060089828a01620004fd565b94505060608701519250608087015191506200061f60a08801620004e0565b90509295509295509295565b6000602082840312156200063d578081fd5b815180151581146200035a578182fd5b6000815180845262000667816020860160208601620006e8565b601f01601f19169290920160200192915050565b600082516200068f818460208701620006e8565b9190910192915050565b6020815260006200035a60208301846200064d565b606081526000620006c360608301866200064d565b8281036020840152620006d781866200064d565b915050826040830152949350505050565b60005b8381101562000705578181015183820152602001620006eb565b8381111562000715576000848401525b50505050565b634e487b7160e01b600052604160045260246000fd5b611c7780620007416000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c8063715018a6116100c3578063b16049a21161007c578063b16049a2146102d1578063bb366bf2146102e4578063e2bbb158146102f7578063f214b7121461030a578063f2fde38b1461031d578063f61a7ff01461033057600080fd5b8063715018a6146102205780637d787a24146102285780638da5cb5b146102535780638dbb1e3a1461026457806393f1a40b14610277578063abc7c069146102be57600080fd5b8063441a3e7011610115578063441a3e70146101c157806348cd4cb1146101d657806351eb05a6146101df5780635312ea8e146101f2578063630b5ba1146102055780637064f1301461020d57600080fd5b8063081e3eda14610152578063083c6323146101695780630e1da6c3146101725780631526fe271461017b5780631fa36cbe146101b8575b600080fd5b6002545b6040519081526020015b60405180910390f35b61015660075481565b61015660085481565b61018e610189366004611a2c565b610339565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610160565b61015660045481565b6101d46101cf366004611a8b565b61037d565b005b61015660065481565b6101d46101ed366004611a2c565b6104ea565b6101d4610200366004611a2c565b6106a6565b6101d4610756565b6101d461021b36600461195b565b610781565b6101d46108a7565b60015461023b906001600160a01b031681565b6040516001600160a01b039091168152602001610160565b6000546001600160a01b031661023b565b610156610272366004611a8b565b6108dd565b6102a9610285366004611a5c565b60036020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610160565b6101d46102cc3660046119e0565b610924565b6101d46102df366004611977565b610aee565b6101d46102f2366004611aac565b610d30565b6101d4610305366004611a8b565b6110bd565b610156610318366004611a5c565b61122b565b6101d461032b36600461195b565b6113ce565b61015660055481565b6002818154811061034957600080fd5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b6000600283815481106103a057634e487b7160e01b600052603260045260246000fd5b6000918252602080832086845260038252604080852033865290925292208054600490920290920192508311156104135760405162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b60448201526064015b60405180910390fd5b61041c846104ea565b60006104598260010154610453670de0b6b3a764000061044d876003015487600001546114ea90919063ffffffff16565b906114f6565b90611502565b9050610465338261150e565b81546104719085611502565b808355600384015461049191670de0b6b3a76400009161044d91906114ea565b600183015582546104ac906001600160a01b03163386611469565b604051848152859033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a35050505050565b60065443101561054d5760405162461bcd60e51b815260206004820152602860248201527f546865206661726d696e672070726f6772616d20686173206e6f742079657420604482015267737461727465642160c01b606482015260840161040a565b60006002828154811061057057634e487b7160e01b600052603260045260246000fd5b906000526020600020906004020190508060020154431161058f575050565b80546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156105d257600080fd5b505afa1580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611a44565b90508061061c57504360029091015550565b600061062c8360020154436108dd565b9050600061065960045461044d8660010154610653600554876114ea90919063ffffffff16565b906114ea565b905061067f6106748461044d84670de0b6b3a76400006114ea565b60038601549061165a565b6003850155600754431061069557600754610697565b435b84600201819055505050505050565b6000600282815481106106c957634e487b7160e01b600052603260045260246000fd5b6000918252602080832085845260038252604080852033808752935290932080546004909302909301805490945061070e926001600160a01b03919091169190611469565b8054604051908152839033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a360008082556001909101555050565b60025460005b8181101561077d5761076d816104ea565b61077681611bfb565b905061075c565b5050565b6000546001600160a01b031633146107ab5760405162461bcd60e51b815260040161040a90611b2c565b60085443116108115760405162461bcd60e51b815260206004820152602c60248201527f5468652063757272656e74206661726d696e672070726f6772616d206861732060448201526b1b9bdd08199a5b9a5cda195960a21b606482015260840161040a565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561085557600080fd5b505afa158015610869573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088d9190611a44565b60015490915061077d906001600160a01b03168383611469565b6000546001600160a01b031633146108d15760405162461bcd60e51b815260040161040a90611b2c565b6108db6000611666565b565b600060075482116108f9576108f28284611502565b905061091e565b6007548310610911576108f260006106538486611502565b6007546108f29084611502565b92915050565b6000546001600160a01b0316331461094e5760405162461bcd60e51b815260040161040a90611b2c565b82811461099d5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206c656e67746820646f65736e74206d61746368000000000000604482015260640161040a565b6109a5610756565b60045460005b84811015610ae457610a4e8484838181106109d657634e487b7160e01b600052603260045260246000fd5b90506020020135610a486002898986818110610a0257634e487b7160e01b600052603260045260246000fd5b9050602002013581548110610a2757634e487b7160e01b600052603260045260246000fd5b9060005260206000209060040201600101548561150290919063ffffffff16565b9061165a565b9150838382818110610a7057634e487b7160e01b600052603260045260246000fd5b905060200201356002878784818110610a9957634e487b7160e01b600052603260045260246000fd5b9050602002013581548110610abe57634e487b7160e01b600052603260045260246000fd5b600091825260209091206001600490920201015580610adc81611bfb565b9150506109ab565b5060045550505050565b6000546001600160a01b03163314610b185760405162461bcd60e51b815260040161040a90611b2c565b6001546001600160a01b0316610b7c5760405162461bcd60e51b8152602060048201526024808201527f412072657761726420746f6b656e20686173206e6f74206265656e206465706c6044820152631bde595960e21b606482015260840161040a565b828114610bcb5760405162461bcd60e51b815260206004820152601a60248201527f417272617973206c656e67746820646f65736e74206d61746368000000000000604482015260640161040a565b610bd3610756565b60006006544311610be657600654610be8565b435b60045490915060005b83811015610d2557610c32878783818110610c1c57634e487b7160e01b600052603260045260246000fd5b905060200201358361165a90919063ffffffff16565b915060026040518060800160405280878785818110610c6157634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610c76919061195b565b6001600160a01b03168152602001898985818110610ca457634e487b7160e01b600052603260045260246000fd5b602090810292909201358352508181018790526000604092830181905284546001808201875595825290829020845160049092020180546001600160a01b0319166001600160a01b03909216919091178155908301519381019390935581015160028301556060015160039091015580610d1d81611bfb565b915050610bf1565b506004555050505050565b6000546001600160a01b03163314610d5a5760405162461bcd60e51b815260040161040a90611b2c565b60065415610dc45760405162461bcd60e51b815260206004820152603160248201527f54686520737461727420626c6f636b206f6620612070726f6772616d2068617360448201527008185b1c9958591e481899595b881cd95d607a1b606482015260840161040a565b600254610e045760405162461bcd60e51b815260206004820152600e60248201526d139bc81c1bdbdb1cc8185919195960921b604482015260640161040a565b438411610e795760405162461bcd60e51b815260206004820152603960248201527f54686520737461727420626c6f636b20706173736564206973206265666f726560448201527f207468652063757272656e7420626c6f636b206e756d62657200000000000000606482015260840161040a565b838311610ee75760405162461bcd60e51b815260206004820152603660248201527f54686520656e6420626c6f636b207061737365642073686f756c6420626520626044820152756967676572207468616e205f7374617274426c6f636b60501b606482015260840161040a565b81610f455760405162461bcd60e51b815260206004820152602860248201527f546865207265776172642070657220626c6f636b2063616e206e6f7420626520604482015267073657420746f20360c41b606482015260840161040a565b60008111610f9f5760405162461bcd60e51b815260206004820152602160248201527f436c61696d2074696d656f75742063616e206e6f742062652073657420746f206044820152600360fc1b606482015260840161040a565b610fb3610fac8585611bb8565b83906114ea565b6001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015610ff657600080fd5b505afa15801561100a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102e9190611a44565b101561109b5760405162461bcd60e51b815260206004820152603660248201527f536d61727420636f6e747261637420686173206e6f7420656e6f7567682062616044820152753630b731b29034b7103932bbb0b93239903a37b5b2b760511b606482015260840161040a565b6006849055600783905560058290556110b4838261165a565b60085550505050565b6000600283815481106110e057634e487b7160e01b600052603260045260246000fd5b600091825260208083208684526003825260408085203386529092529220600654600490920290920192506111575760405162461bcd60e51b815260206004820152601a60248201527f50726f6772616d20706172616d6574657273206e6f7420736574000000000000604482015260640161040a565b611160846104ea565b8054156111a65760006111988260010154610453670de0b6b3a764000061044d876003015487600001546114ea90919063ffffffff16565b90506111a4338261150e565b505b81546111bd906001600160a01b03163330866116b6565b80546111c9908461165a565b80825560038301546111e991670de0b6b3a76400009161044d91906114ea565b6001820155604051838152849033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060200160405180910390a350505050565b60006006546000148061123f575060065443105b1561124c5750600061091e565b60006002848154811061126f57634e487b7160e01b600052603260045260246000fd5b60009182526020808320878452600380835260408086206001600160a01b038a811688529452808620600495860290930191820154825491516370a0823160e01b8152309681019690965291965091949093909291909116906370a082319060240160206040518083038186803b1580156112e957600080fd5b505afa1580156112fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113219190611a44565b905083600201544311801561133557508015155b1561139857600061134a8560020154436108dd565b9050600061137160045461044d8860010154610653600554876114ea90919063ffffffff16565b905061139361138c8461044d84670de0b6b3a76400006114ea565b859061165a565b935050505b6113c38360010154610453670de0b6b3a764000061044d8688600001546114ea90919063ffffffff16565b979650505050505050565b6000546001600160a01b031633146113f85760405162461bcd60e51b815260040161040a90611b2c565b6001600160a01b03811661145d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161040a565b61146681611666565b50565b6040516001600160a01b0383166024820152604481018290526114cc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526116ee565b505050565b60606114e084846000856117c0565b90505b9392505050565b60006114e38284611b99565b60006114e38284611b79565b60006114e38284611bb8565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561155257600080fd5b505afa158015611566573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158a9190611a44565b9050808211156116215760015460405163a9059cbb60e01b81526001600160a01b038581166004830152602482018490529091169063a9059cbb906044015b602060405180830381600087803b1580156115e357600080fd5b505af11580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b9190611a0c565b50505050565b60015460405163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529091169063a9059cbb906044016115c9565b60006114e38284611b61565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261161b9085906323b872dd60e01b90608401611495565b6000611743826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114d19092919063ffffffff16565b8051909150156114cc57808060200190518101906117619190611a0c565b6114cc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161040a565b6060824710156118215760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161040a565b843b61186f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161040a565b600080866001600160a01b0316858760405161188b9190611add565b60006040518083038185875af1925050503d80600081146118c8576040519150601f19603f3d011682016040523d82523d6000602084013e6118cd565b606091505b50915091506113c3828286606083156118e75750816114e3565b8251156118f75782518084602001fd5b8160405162461bcd60e51b815260040161040a9190611af9565b60008083601f840112611922578182fd5b50813567ffffffffffffffff811115611939578182fd5b6020830191508360208260051b850101111561195457600080fd5b9250929050565b60006020828403121561196c578081fd5b81356114e381611c2c565b6000806000806040858703121561198c578283fd5b843567ffffffffffffffff808211156119a3578485fd5b6119af88838901611911565b909650945060208701359150808211156119c7578384fd5b506119d487828801611911565b95989497509550505050565b600080600080604085870312156119f5578384fd5b843567ffffffffffffffff808211156119a3578586fd5b600060208284031215611a1d578081fd5b815180151581146114e3578182fd5b600060208284031215611a3d578081fd5b5035919050565b600060208284031215611a55578081fd5b5051919050565b60008060408385031215611a6e578182fd5b823591506020830135611a8081611c2c565b809150509250929050565b60008060408385031215611a9d578182fd5b50508035926020909101359150565b60008060008060808587031215611ac1578384fd5b5050823594602084013594506040840135936060013592509050565b60008251611aef818460208701611bcf565b9190910192915050565b6020815260008251806020840152611b18816040850160208701611bcf565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115611b7457611b74611c16565b500190565b600082611b9457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611bb357611bb3611c16565b500290565b600082821015611bca57611bca611c16565b500390565b60005b83811015611bea578181015183820152602001611bd2565b8381111561161b5750506000910152565b6000600019821415611c0f57611c0f611c16565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461146657600080fdfea2646970667358221220f9c178aaf5f7a133d0e0defee56a846a87827eab339cb57887d8b836a5cd371a64736f6c6343000804003360a06040523480156200001157600080fd5b50604051620011f0380380620011f083398101604081905262000034916200037c565b80838381600390805190602001906200004f92919062000223565b5080516200006590600490602084019062000223565b50505060008111620000be5760405162461bcd60e51b815260206004820152601560248201527f45524332304361707065643a206361702069732030000000000000000000000060448201526064015b60405180910390fd5b608052620000cc33620000ec565b620000e333826200013e60201b620006111760201c565b50505062000464565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216620001965760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401620000b5565b8060026000828254620001aa9190620003ec565b90915550506001600160a01b03821660009081526020819052604081208054839290620001d9908490620003ec565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b828054620002319062000411565b90600052602060002090601f016020900481019282620002555760008555620002a0565b82601f106200027057805160ff1916838001178555620002a0565b82800160010185558215620002a0579182015b82811115620002a057825182559160200191906001019062000283565b50620002ae929150620002b2565b5090565b5b80821115620002ae5760008155600101620002b3565b600082601f830112620002da578081fd5b81516001600160401b0380821115620002f757620002f76200044e565b604051601f8301601f19908116603f011681019082821181831017156200032257620003226200044e565b816040528381526020925086838588010111156200033e578485fd5b8491505b8382101562000361578582018301518183018401529082019062000342565b838211156200037257848385830101525b9695505050505050565b60008060006060848603121562000391578283fd5b83516001600160401b0380821115620003a8578485fd5b620003b687838801620002c9565b94506020860151915080821115620003cc578384fd5b50620003db86828701620002c9565b925050604084015190509250925092565b600082198211156200040c57634e487b7160e01b81526011600452602481fd5b500190565b600181811c908216806200042657607f821691505b602082108114156200044857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b608051610d7062000480600039600061017c0152610d706000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d71461021c578063a9059cbb1461022f578063dd62ed3e14610242578063f2fde38b1461027b57600080fd5b806370a08231146101c8578063715018a6146101f15780638da5cb5b146101f957806395d89b411461021457600080fd5b8063313ce567116100d3578063313ce5671461016b578063355274ea1461017a57806339509351146101a057806342966c68146101b357600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d61028e565b60405161011a9190610c67565b60405180910390f35b610136610131366004610c26565b610320565b604051901515815260200161011a565b6002545b60405190815260200161011a565b610136610166366004610beb565b610336565b6040516012815260200161011a565b7f000000000000000000000000000000000000000000000000000000000000000061014a565b6101366101ae366004610c26565b6103e5565b6101c66101c1366004610c4f565b610421565b005b61014a6101d6366004610b98565b6001600160a01b031660009081526020819052604090205490565b6101c661042e565b6005546040516001600160a01b03909116815260200161011a565b61010d610494565b61013661022a366004610c26565b6104a3565b61013661023d366004610c26565b61053c565b61014a610250366004610bb9565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6101c6610289366004610b98565b610549565b60606003805461029d90610ce9565b80601f01602080910402602001604051908101604052809291908181526020018280546102c990610ce9565b80156103165780601f106102eb57610100808354040283529160200191610316565b820191906000526020600020905b8154815290600101906020018083116102f957829003601f168201915b5050505050905090565b600061032d3384846106f0565b50600192915050565b6000610343848484610815565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103cd5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103da85338584036106f0565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161032d91859061041c908690610cba565b6106f0565b61042b33826109e4565b50565b6005546001600160a01b031633146104885760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103c4565b6104926000610b2a565b565b60606004805461029d90610ce9565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156105255760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016103c4565b61053233858584036106f0565b5060019392505050565b600061032d338484610815565b6005546001600160a01b031633146105a35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103c4565b6001600160a01b0381166106085760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103c4565b61042b81610b2a565b6001600160a01b0382166106675760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016103c4565b80600260008282546106799190610cba565b90915550506001600160a01b038216600090815260208190526040812080548392906106a6908490610cba565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0383166107525760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103c4565b6001600160a01b0382166107b35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103c4565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166108795760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103c4565b6001600160a01b0382166108db5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103c4565b6001600160a01b038316600090815260208190526040902054818110156109535760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103c4565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061098a908490610cba565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516109d691815260200190565b60405180910390a350505050565b6001600160a01b038216610a445760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016103c4565b6001600160a01b03821660009081526020819052604090205481811015610ab85760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016103c4565b6001600160a01b0383166000908152602081905260408120838303905560028054849290610ae7908490610cd2565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610808565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80356001600160a01b0381168114610b9357600080fd5b919050565b600060208284031215610ba9578081fd5b610bb282610b7c565b9392505050565b60008060408385031215610bcb578081fd5b610bd483610b7c565b9150610be260208401610b7c565b90509250929050565b600080600060608486031215610bff578081fd5b610c0884610b7c565b9250610c1660208501610b7c565b9150604084013590509250925092565b60008060408385031215610c38578182fd5b610c4183610b7c565b946020939093013593505050565b600060208284031215610c60578081fd5b5035919050565b6000602080835283518082850152825b81811015610c9357858101830151858201604001528201610c77565b81811115610ca45783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610ccd57610ccd610d24565b500190565b600082821015610ce457610ce4610d24565b500390565b600181811c90821680610cfd57607f821691505b60208210811415610d1e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220037a5ca2f0e11673aaf58c8d680f1dd310fd2577547d38432053295a419354b364736f6c63430008040033000000000000000000000000685723b9dc89bdf28ba5f98f9a8c0ac899bd6e7700000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000056bc75e2d631000000000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000c31249ba48763df46388ba5c4e7565d62ed4801c000000000000000000000000000000000000000000000000000000000000000a4a5254467574757265730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000094a52542d53455032320000000000000000000000000000000000000000000000
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000685723b9dc89bdf28ba5f98f9a8c0ac899bd6e7700000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000056bc75e2d631000000000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000c31249ba48763df46388ba5c4e7565d62ed4801c000000000000000000000000000000000000000000000000000000000000000a4a5254467574757265730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000094a52542d53455032320000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _owner (address): 0x685723b9dc89bdf28ba5f98f9a8c0ac899bd6e77
Arg [1] : _name (string): JRTFutures
Arg [2] : _symbol (string): JRT-SEP22
Arg [3] : _cap (uint256): 100000000000000000000
Arg [4] : _amountForPool (uint256): 2000000000000000000
Arg [5] : _rewardReceiver (address): 0xc31249ba48763df46388ba5c4e7565d62ed4801c
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000685723b9dc89bdf28ba5f98f9a8c0ac899bd6e77
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 0000000000000000000000000000000000000000000000056bc75e2d63100000
Arg [4] : 0000000000000000000000000000000000000000000000001bc16d674ec80000
Arg [5] : 000000000000000000000000c31249ba48763df46388ba5c4e7565d62ed4801c
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [7] : 4a52544675747572657300000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [9] : 4a52542d53455032320000000000000000000000000000000000000000000000
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.