More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 1,293 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Harvest | 17159282 | 2 hrs ago | IN | 0 CRO | 0.37480568 | ||||
Harvest | 17158020 | 4 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17157349 | 5 hrs ago | IN | 0 CRO | 0.37306102 | ||||
Harvest | 17157104 | 5 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17154841 | 9 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17153349 | 11 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Withdraw | 17153295 | 11 hrs ago | IN | 0 CRO | 1.05807095 | ||||
Harvest | 17152867 | 12 hrs ago | IN | 0 CRO | 0.46127205 | ||||
Harvest | 17152778 | 12 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17152512 | 12 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17152483 | 13 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17152362 | 13 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17151045 | 15 hrs ago | IN | 0 CRO | 0.26338275 | ||||
Harvest | 17150660 | 15 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Withdraw | 17150605 | 16 hrs ago | IN | 0 CRO | 1.11103535 | ||||
Harvest | 17149933 | 17 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17149461 | 17 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Withdraw | 17149329 | 18 hrs ago | IN | 0 CRO | 1.02468035 | ||||
Harvest | 17149011 | 18 hrs ago | IN | 0 CRO | 0.46127205 | ||||
Harvest | 17148407 | 19 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Harvest | 17148353 | 19 hrs ago | IN | 0 CRO | 0.37480568 | ||||
Harvest | 17147910 | 20 hrs ago | IN | 0 CRO | 0.37491705 | ||||
Deposit | 17144430 | 26 hrs ago | IN | 0 CRO | 1.96323038 | ||||
Harvest | 17143260 | 27 hrs ago | IN | 0 CRO | 0.46127205 | ||||
Harvest | 17141822 | 30 hrs ago | IN | 0 CRO | 0.37480568 |
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
16616429 | 36 days ago | Contract Creation | 0 CRO |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x9AC4FbE8...328c3214d The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
NFTMasterChef
Compiler Version
v0.8.18+commit.87f61d96
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.18; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC721, IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract NFTMasterChef is Ownable, IERC721Receiver, ReentrancyGuard { using EnumerableSet for EnumerableSet.UintSet; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many NFT ids the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. EnumerableSet.UintSet tokenIdList; } uint256 public constant PRECISION_FACTOR = 1e12; // The address of the nft master chef factory address public immutable nftMasterChefFactory; IERC721 public nftContract; IERC20 public rewardToken; uint256 public totalStaked; uint256 public startTime; uint256 public endTime; uint256 public rewardsPerSecond; uint256 public lastRewardTime; uint256 public accTokenPerShare; address public treasury; uint256 public lockPeriod; bool public isInitialized; // lockPeriodMap (tokenId => unlockTime) mapping(uint256 => uint256) public lockPeriodMap; // Info of each user that stakes NFT (poolID => UserInfo) mapping(address => UserInfo) internal userInfo; event Deposit(address indexed user, uint256 tokenId, uint256 unlockTime); event Harvest(address indexed user, uint256 amount); event Withdraw(address indexed user, uint256 tokenId); event EmergencyWithdraw(address indexed user, uint256 amount); event UpdateRewardToken(address _rewardToken, address _oldRewardToken); event UpdateRewardsPerSecond( uint256 newRewardsPerSecond, uint256 oldRewardsPerSecond ); event UpdateTreasury(address _newTreasury, address _oldTreasury); event EmergencyStop(uint256 timeStamp); event EmergencyRewardWithdraw(address indexed user, uint256 amount); event SetStartAndEndTime(uint256 startTime, uint256 endTime); event SetMultiplier(uint256 newMultiplier, uint256 oldMultiplier); event UpdateLockPeriod(uint256 _lockPeriod, uint256 lockPeriod); constructor() { nftMasterChefFactory = msg.sender; } function initialize( IERC721 _nft, IERC20 _rewardToken, uint256 _rewardsPerSecond, uint256 _startTime, uint256 _endTime, address _treasury, uint256 _lockPeriod, address _admin ) external { require(!isInitialized, "Already initialized"); require(msg.sender == nftMasterChefFactory, "Not factory"); // Make this contract initialized isInitialized = true; uint256 _lastRewardTime = block.timestamp > _startTime ? block.timestamp : _startTime; nftContract = _nft; startTime = _startTime; endTime = _endTime; rewardToken = _rewardToken; rewardsPerSecond = _rewardsPerSecond; treasury = _treasury; lockPeriod = _lockPeriod; lastRewardTime = _lastRewardTime; // Transfer ownership to the admin address who becomes owner of the contract transferOwnership(_admin); } function onERC721Received( address, address, uint256, bytes calldata ) external pure override returns (bytes4) { return bytes4( keccak256("onERC721Received(address,address,uint256,bytes)") ); } /** * @notice Update treasury address * @param _newTreasury new treasury address */ function updateTreasury(address _newTreasury) external onlyOwner { require(_newTreasury != address(0), "Invalid address"); require(_newTreasury != treasury, "treasury already exist"); address _oldTreasury = treasury; treasury = _newTreasury; emit UpdateTreasury(_newTreasury, _oldTreasury); } function updateLockPeriod(uint256 _lockPeriod) external onlyOwner { emit UpdateLockPeriod(_lockPeriod, lockPeriod); lockPeriod = _lockPeriod; } function updateRewardToken(address _rewardToken) external onlyOwner { require(block.timestamp <= endTime, "staking closed"); require( _rewardToken != address(0) && accTokenPerShare == 0, "rewardToken can not be modified" ); address _oldRewardToken = address(rewardToken); rewardToken = IERC20(_rewardToken); emit UpdateRewardToken(_rewardToken, _oldRewardToken); } //Update emission rate function updateRewardsPerSecond(uint256 _rewardsPerSecond) public onlyOwner { updatePool(); uint256 _oldRewardsPerSecond = rewardsPerSecond; rewardsPerSecond = _rewardsPerSecond; emit UpdateRewardsPerSecond(rewardsPerSecond, _oldRewardsPerSecond); } function setStartAndEndTime(uint256 _startTime, uint256 _endTime) public onlyOwner { if (block.timestamp > _startTime) { require( startTime == _startTime, "reward already started, can't update startTime" ); } require(_endTime > block.timestamp, "invalid timestamp"); require(_startTime <= _endTime, "must follow _startTime <= _endTime"); startTime = _startTime; endTime = _endTime; emit SetStartAndEndTime(startTime, endTime); } // Get tokenIds staked function getStakedTokenIds(address _user) external view returns (uint256[] memory) { UserInfo storage user = userInfo[_user]; return user.tokenIdList.values(); } // Return reward multiplier over the given _fromTime to _toTime block. function getMultiplier(uint256 _fromTime, uint256 _toTime) public view returns (uint256) { uint256 fromTime = _fromTime; uint256 toTime = _toTime; if (_fromTime > endTime || _toTime < startTime) { return 0; } if (_fromTime < startTime) { fromTime = startTime; } if (_toTime > endTime) { toTime = endTime; } return (toTime - fromTime); } // View function to see pending MTDs on frontend. function pendingRewards(address _user) external view returns (uint256) { UserInfo storage user = userInfo[_user]; uint256 _accTokenPerShare = accTokenPerShare; if (block.timestamp > lastRewardTime && totalStaked != 0) { uint256 multiplier = getMultiplier(lastRewardTime, block.timestamp); uint256 harvestedReward = multiplier * rewardsPerSecond; // add precision factor _accTokenPerShare += ((harvestedReward * PRECISION_FACTOR) / totalStaked); } return (((user.amount * _accTokenPerShare) / PRECISION_FACTOR) - user.rewardDebt); } // Update reward variables of the given pool to be up-to-date. function updatePool() public { if (block.timestamp <= lastRewardTime) { return; } if (totalStaked == 0) { lastRewardTime = block.timestamp; return; } uint256 multiplier = getMultiplier(lastRewardTime, block.timestamp); uint256 harvestedReward = multiplier * rewardsPerSecond; accTokenPerShare += (harvestedReward * PRECISION_FACTOR) / totalStaked; lastRewardTime = block.timestamp; } function deposit(uint256[] calldata _tokenIds) external nonReentrant { _requireTokenIds(_tokenIds); _harvest(msg.sender); UserInfo storage user = userInfo[msg.sender]; uint256 _tokenId; uint256 tokenIdLength = _tokenIds.length; uint256 unlockTime = block.timestamp + lockPeriod; for (uint256 i; i < tokenIdLength; ++i) { _tokenId = _tokenIds[i]; lockPeriodMap[_tokenId] = unlockTime; user.tokenIdList.add(_tokenId); nftContract.safeTransferFrom(msg.sender, address(this), _tokenId); emit Deposit(msg.sender, _tokenId, unlockTime); } totalStaked += tokenIdLength; user.amount += tokenIdLength; user.rewardDebt = (user.amount * accTokenPerShare) / PRECISION_FACTOR; } // Harvest rewards. function harvest() public nonReentrant { _harvest(msg.sender); } function _harvest(address _user) internal { UserInfo storage user = userInfo[_user]; updatePool(); uint256 pending; if (user.amount > 0) { pending = ((user.amount * accTokenPerShare) / PRECISION_FACTOR) - user.rewardDebt; if (pending > 0) { rewardToken.safeTransfer(_user, pending); } } user.rewardDebt = (user.amount * accTokenPerShare) / PRECISION_FACTOR; emit Harvest(_user, pending); } // Withdraw NFT token from MasterChef. function withdraw(uint256[] calldata _tokenIds) external nonReentrant { uint256 tokenIdLength = _tokenIds.length; for (uint256 i; i < tokenIdLength; ++i) { require( block.timestamp >= lockPeriodMap[_tokenIds[i]], "Stake not Ready for Withdrawal" ); } _requireTokenIds(_tokenIds); _harvest(msg.sender); UserInfo storage user = userInfo[msg.sender]; uint256 _tokenId; for (uint256 i; i < tokenIdLength; ++i) { _tokenId = _tokenIds[i]; require(user.tokenIdList.contains(_tokenId), "not staked tokenId"); user.tokenIdList.remove(_tokenId); nftContract.safeTransferFrom(address(this), msg.sender, _tokenId); delete lockPeriodMap[_tokenId]; emit Withdraw(msg.sender, _tokenId); } user.amount -= tokenIdLength; totalStaked -= tokenIdLength; user.rewardDebt = (user.amount * accTokenPerShare) / PRECISION_FACTOR; } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _limit) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; uint256 length = user.tokenIdList.length(); if (_limit > 0 && _limit < length) { length = _limit; } uint256[] memory _tokenIds = user.tokenIdList.values(); for (uint256 i; i < length; ++i) { uint256 _tokenId = _tokenIds[i]; nftContract.safeTransferFrom(address(this), msg.sender, _tokenId); user.tokenIdList.remove(_tokenId); } user.amount -= length; totalStaked -= length; user.rewardDebt = (user.amount * accTokenPerShare) / PRECISION_FACTOR; emit EmergencyWithdraw(msg.sender, length); } /* * @dev Only callable by owner. Needs to be for emergency. */ function emergencyStop() external onlyOwner nonReentrant { require(block.timestamp <= endTime, "staking already finished"); endTime = block.timestamp; emit EmergencyStop(block.timestamp); } /* * @dev Only callable by owner. Needs to be for emergency. */ function emergencyRewardWithdraw(uint256 _amount) external onlyOwner { rewardToken.safeTransfer(treasury, _amount); emit EmergencyRewardWithdraw(treasury, _amount); } function _requireTokenIds(uint256[] calldata _tokenIds) internal pure { require(_tokenIds.length > 0, "empty tokenIds"); require(!_hasDuplicate(_tokenIds), "duplicate tokenIds"); } function _hasDuplicate(uint256[] calldata A) internal pure returns (bool) { uint256 length = A.length; for (uint256 i; i < length - 1; ++i) { for (uint256 j = i + 1; j < length; ++j) { if (A[i] == A[j]) { return true; } } } return false; } function getUserStakesLength(address _user) external view returns (uint256) { return userInfo[_user].amount; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) 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 // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) 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 // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) 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. * - `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 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev 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 { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @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 // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "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":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockTime","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyRewardWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"EmergencyStop","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMultiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldMultiplier","type":"uint256"}],"name":"SetMultiplier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"SetStartAndEndTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_lockPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockPeriod","type":"uint256"}],"name":"UpdateLockPeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_rewardToken","type":"address"},{"indexed":false,"internalType":"address","name":"_oldRewardToken","type":"address"}],"name":"UpdateRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRewardsPerSecond","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldRewardsPerSecond","type":"uint256"}],"name":"UpdateRewardsPerSecond","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"_oldTreasury","type":"address"}],"name":"UpdateTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"PRECISION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"emergencyRewardWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyStop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTime","type":"uint256"},{"internalType":"uint256","name":"_toTime","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getStakedTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserStakesLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardsPerSecond","type":"uint256"},{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_endTime","type":"uint256"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_lockPeriod","type":"uint256"},{"internalType":"address","name":"_admin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockPeriodMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftContract","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftMasterChefFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_endTime","type":"uint256"}],"name":"setStartAndEndTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","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":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockPeriod","type":"uint256"}],"name":"updateLockPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"updateRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsPerSecond","type":"uint256"}],"name":"updateRewardsPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newTreasury","type":"address"}],"name":"updateTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102115760003560e01c806379ec4f19116101255780639f5662e2116100ad578063e3161ddd1161007c578063e3161ddd146104a3578063eacdaabc146104ab578063f2fde38b146104b4578063f7c618c1146104c7578063f8cf31cb146104da57600080fd5b80639f5662e21461045e578063ccd34cd514610471578063d56d229d1461047d578063dc999b941461049057600080fd5b80638dbb1e3a116100f45780638dbb1e3a146104135780638f6629151461042657806391db7b0d1461042f5780639231cf7414610442578063983d95ce1461044b57600080fd5b806379ec4f19146103d35780637f51bb1f146103e6578063817b1cd2146103f95780638da5cb5b1461040257600080fd5b80634641257d116101a857806361d027b31161017757806361d027b31461038757806363a599a41461039a5780637047bc52146103a2578063715018a6146103c257806378e97925146103ca57600080fd5b80634641257d146103305780635312ea8e1461033857806356f3d1971461034b578063598b8e711461037457600080fd5b806331d7a262116101e457806331d7a262146102e25780633279beab146102f5578063392e53cd1461030a5780633fd8b02f1461032757600080fd5b806309ce53ba14610216578063150b7a02146102495780632c22f6101461029a5780633197cbb6146102d9575b600080fd5b610236610224366004611b86565b600d6020526000908152604090205481565b6040519081526020015b60405180910390f35b610281610257366004611bb4565b7f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f95945050505050565b6040516001600160e01b03199091168152602001610240565b6102c17f000000000000000000000000178e1a8eb55650a2cbf1225d348463f1d0d6627981565b6040516001600160a01b039091168152602001610240565b61023660065481565b6102366102f0366004611c53565b6104ed565b610308610303366004611b86565b6105a2565b005b600c546103179060ff1681565b6040519015158152602001610240565b610236600b5481565b610308610637565b610308610346366004611b86565b61066d565b610236610359366004611c53565b6001600160a01b03166000908152600e602052604090205490565b610308610382366004611c70565b610826565b600a546102c1906001600160a01b031681565b6103086109e3565b6103b56103b0366004611c53565b610ac5565b6040516102409190611ce5565b610308610af3565b61023660055481565b6103086103e1366004611d29565b610b29565b6103086103f4366004611c53565b610ca9565b61023660045481565b6000546001600160a01b03166102c1565b610236610421366004611d29565b610dca565b61023660095481565b61030861043d366004611b86565b610e26565b61023660085481565b610308610459366004611c70565b610e92565b61030861046c366004611b86565b611125565b61023664e8d4a5100081565b6002546102c1906001600160a01b031681565b61030861049e366004611d4b565b611195565b6103086112ce565b61023660075481565b6103086104c2366004611c53565b611346565b6003546102c1906001600160a01b031681565b6103086104e8366004611c53565b6113e1565b6001600160a01b0381166000908152600e602052604081206009546008544211801561051a575060045415155b1561056d57600061052d60085442610dca565b905060006007548261053f9190611de6565b60045490915061055464e8d4a5100083611de6565b61055e9190611dfd565b6105689084611e1f565b925050505b6001820154825464e8d4a5100090610586908490611de6565b6105909190611dfd565b61059a9190611e32565b949350505050565b6000546001600160a01b031633146105d55760405162461bcd60e51b81526004016105cc90611e45565b60405180910390fd5b600a546003546105f2916001600160a01b0391821691168361150a565b600a546040518281526001600160a01b03909116907f2d4434bb59801e733e9ce3df40b0c5518861a5fcdeec1906e83e03c755872b429060200160405180910390a250565b6002600154036106595760405162461bcd60e51b81526004016105cc90611e7a565b600260015561066733611561565b60018055565b60026001540361068f5760405162461bcd60e51b81526004016105cc90611e7a565b60026001819055336000908152600e60205260408120916106b190830161163f565b90506000831180156106c257508083105b156106ca5750815b60006106d883600201611649565b905060005b828110156107905760008282815181106106f9576106f9611eb1565b6020908102919091010151600254604051632142170760e11b8152306004820152336024820152604481018390529192506001600160a01b0316906342842e0e90606401600060405180830381600087803b15801561075757600080fd5b505af115801561076b573d6000803e3d6000fd5b5061077d925050506002860182611656565b50508061078990611ec7565b90506106dd565b50818360000160008282546107a59190611e32565b9250508190555081600460008282546107be9190611e32565b9091555050600954835464e8d4a51000916107d891611de6565b6107e29190611dfd565b600184015560405182815233907f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd96959060200160405180910390a25050600180555050565b6002600154036108485760405162461bcd60e51b81526004016105cc90611e7a565b60026001556108578282611662565b61086033611561565b336000908152600e60205260408120600b54909190839082906108839042611e1f565b905060005b82811015610984578686828181106108a2576108a2611eb1565b602090810292909201356000818152600d90935260409092208490555093506108ce60028601856116f0565b50600254604051632142170760e11b8152336004820152306024820152604481018690526001600160a01b03909116906342842e0e90606401600060405180830381600087803b15801561092157600080fd5b505af1158015610935573d6000803e3d6000fd5b505060408051878152602081018690523393507f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1592500160405180910390a261097d81611ec7565b9050610888565b5081600460008282546109979190611e1f565b90915550508354829085906000906109b0908490611e1f565b9091555050600954845464e8d4a51000916109ca91611de6565b6109d49190611dfd565b60019485015550505080555050565b6000546001600160a01b03163314610a0d5760405162461bcd60e51b81526004016105cc90611e45565b600260015403610a2f5760405162461bcd60e51b81526004016105cc90611e7a565b6002600155600654421115610a865760405162461bcd60e51b815260206004820152601860248201527f7374616b696e6720616c72656164792066696e6973686564000000000000000060448201526064016105cc565b4260068190556040519081527f1e8ac57e9803840915f0284b77b570a882fb2db69108ac8eba578bb30fcaf1529060200160405180910390a160018055565b6001600160a01b0381166000908152600e60205260409020606090610aec60028201611649565b9392505050565b6000546001600160a01b03163314610b1d5760405162461bcd60e51b81526004016105cc90611e45565b610b2760006116fc565b565b6000546001600160a01b03163314610b535760405162461bcd60e51b81526004016105cc90611e45565b81421115610bc3578160055414610bc35760405162461bcd60e51b815260206004820152602e60248201527f72657761726420616c726561647920737461727465642c2063616e277420757060448201526d6461746520737461727454696d6560901b60648201526084016105cc565b428111610c065760405162461bcd60e51b81526020600482015260116024820152700696e76616c69642074696d657374616d7607c1b60448201526064016105cc565b80821115610c615760405162461bcd60e51b815260206004820152602260248201527f6d75737420666f6c6c6f77205f737461727454696d65203c3d205f656e6454696044820152616d6560f01b60648201526084016105cc565b6005829055600681905560408051838152602081018390527f3225b288c63e1ea0f452fc9e095768edde7d6417c27d888573e65fb804af60e891015b60405180910390a15050565b6000546001600160a01b03163314610cd35760405162461bcd60e51b81526004016105cc90611e45565b6001600160a01b038116610d1b5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064016105cc565b600a546001600160a01b0390811690821603610d725760405162461bcd60e51b81526020600482015260166024820152751d1c99585cdd5c9e48185b1c9958591e48195e1a5cdd60521b60448201526064016105cc565b600a80546001600160a01b038381166001600160a01b03198316811790935560408051938452911660208301819052917fd101a15f9e9364a1c0a7c4cc8eb4cd9220094e83353915b0c74e09f72ec73edb9101610c9d565b60065460009083908390821180610de2575060055484105b15610df257600092505050610e20565b600554851015610e025760055491505b600654841115610e1157506006545b610e1b8282611e32565b925050505b92915050565b6000546001600160a01b03163314610e505760405162461bcd60e51b81526004016105cc90611e45565b600b546040805183815260208101929092527ff814eafa160e3546fc1ea6b8939a578ef5f64d31e04888bcd82e8cd9f9ec2909910160405180910390a1600b55565b600260015403610eb45760405162461bcd60e51b81526004016105cc90611e7a565b60026001558060005b81811015610f5057600d6000858584818110610edb57610edb611eb1565b90506020020135815260200190815260200160002054421015610f405760405162461bcd60e51b815260206004820152601e60248201527f5374616b65206e6f7420526561647920666f72205769746864726177616c000060448201526064016105cc565b610f4981611ec7565b9050610ebd565b50610f5b8383611662565b610f6433611561565b336000908152600e6020526040812090805b838110156110c557858582818110610f9057610f90611eb1565b905060200201359150610faf828460020161174c90919063ffffffff16565b610ff05760405162461bcd60e51b81526020600482015260126024820152711b9bdd081cdd185ad959081d1bdad95b925960721b60448201526064016105cc565b610ffd6002840183611656565b50600254604051632142170760e11b8152306004820152336024820152604481018490526001600160a01b03909116906342842e0e90606401600060405180830381600087803b15801561105057600080fd5b505af1158015611064573d6000803e3d6000fd5b5050506000838152600d602052604080822091909155513391507f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364906110ad9085815260200190565b60405180910390a26110be81611ec7565b9050610f76565b50828260000160008282546110da9190611e32565b9250508190555082600460008282546110f39190611e32565b9091555050600954825464e8d4a510009161110d91611de6565b6111179190611dfd565b600192830155508055505050565b6000546001600160a01b0316331461114f5760405162461bcd60e51b81526004016105cc90611e45565b6111576112ce565b600780549082905560408051838152602081018390527f255f7493937d4f1520c6f6e07048685d99968f0b4a9a3c77b7c4fb4a380687069101610c9d565b600c5460ff16156111de5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016105cc565b336001600160a01b037f000000000000000000000000178e1a8eb55650a2cbf1225d348463f1d0d6627916146112445760405162461bcd60e51b815260206004820152600b60248201526a4e6f7420666163746f727960a81b60448201526064016105cc565b600c805460ff1916600117905560004286106112605785611262565b425b600280546001600160a01b03808d166001600160a01b03199283161790925560058990556006889055600380548c841690831617905560078a9055600a805492881692909116919091179055600b849055600881905590506112c382611346565b505050505050505050565b60085442116112d957565b6004546000036112e95742600855565b60006112f760085442610dca565b90506000600754826113099190611de6565b60045490915061131e64e8d4a5100083611de6565b6113289190611dfd565b600960008282546113399190611e1f565b9091555050426008555050565b6000546001600160a01b031633146113705760405162461bcd60e51b81526004016105cc90611e45565b6001600160a01b0381166113d55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105cc565b6113de816116fc565b50565b6000546001600160a01b0316331461140b5760405162461bcd60e51b81526004016105cc90611e45565b60065442111561144e5760405162461bcd60e51b815260206004820152600e60248201526d1cdd185ada5b99c818db1bdcd95960921b60448201526064016105cc565b6001600160a01b038116158015906114665750600954155b6114b25760405162461bcd60e51b815260206004820152601f60248201527f726577617264546f6b656e2063616e206e6f74206265206d6f6469666965640060448201526064016105cc565b600380546001600160a01b038381166001600160a01b03198316811790935560408051938452911660208301819052917fc30eb506689648404822be5551d0b5c732da6df0983ad57dd760118e9e0bab989101610c9d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261155c908490611764565b505050565b6001600160a01b0381166000908152600e602052604090206115816112ce565b8054600090156115d8576001820154600954835464e8d4a51000916115a591611de6565b6115af9190611dfd565b6115b99190611e32565b905080156115d8576003546115d8906001600160a01b0316848361150a565b600954825464e8d4a51000916115ed91611de6565b6115f79190611dfd565b60018301556040518181526001600160a01b038416907fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba9060200160405180910390a2505050565b6000610e20825490565b60606000610aec83611836565b6000610aec8383611892565b806116a05760405162461bcd60e51b815260206004820152600e60248201526d656d70747920746f6b656e49647360901b60448201526064016105cc565b6116aa8282611985565b156116ec5760405162461bcd60e51b81526020600482015260126024820152716475706c696361746520746f6b656e49647360701b60448201526064016105cc565b5050565b6000610aec8383611a23565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008181526001830160205260408120541515610aec565b60006117b9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a729092919063ffffffff16565b80519091501561155c57808060200190518101906117d79190611ee0565b61155c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105cc565b60608160000180548060200260200160405190810160405280929190818152602001828054801561188657602002820191906000526020600020905b815481526020019060010190808311611872575b50505050509050919050565b6000818152600183016020526040812054801561197b5760006118b6600183611e32565b85549091506000906118ca90600190611e32565b905081811461192f5760008660000182815481106118ea576118ea611eb1565b906000526020600020015490508087600001848154811061190d5761190d611eb1565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061194057611940611f02565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e20565b6000915050610e20565b600081815b611995600183611e32565b811015611a185760006119a9826001611e1f565b90505b82811015611a07578585828181106119c6576119c6611eb1565b905060200201358686848181106119df576119df611eb1565b90506020020135036119f75760019350505050610e20565b611a0081611ec7565b90506119ac565b50611a1181611ec7565b905061198a565b506000949350505050565b6000818152600183016020526040812054611a6a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e20565b506000610e20565b606061059a8484600085856001600160a01b0385163b611ad45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105cc565b600080866001600160a01b03168587604051611af09190611f3c565b60006040518083038185875af1925050503d8060008114611b2d576040519150601f19603f3d011682016040523d82523d6000602084013e611b32565b606091505b5091509150611b42828286611b4d565b979650505050505050565b60608315611b5c575081610aec565b825115611b6c5782518084602001fd5b8160405162461bcd60e51b81526004016105cc9190611f58565b600060208284031215611b9857600080fd5b5035919050565b6001600160a01b03811681146113de57600080fd5b600080600080600060808688031215611bcc57600080fd5b8535611bd781611b9f565b94506020860135611be781611b9f565b935060408601359250606086013567ffffffffffffffff80821115611c0b57600080fd5b818801915088601f830112611c1f57600080fd5b813581811115611c2e57600080fd5b896020828501011115611c4057600080fd5b9699959850939650602001949392505050565b600060208284031215611c6557600080fd5b8135610aec81611b9f565b60008060208385031215611c8357600080fd5b823567ffffffffffffffff80821115611c9b57600080fd5b818501915085601f830112611caf57600080fd5b813581811115611cbe57600080fd5b8660208260051b8501011115611cd357600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611d1d57835183529284019291840191600101611d01565b50909695505050505050565b60008060408385031215611d3c57600080fd5b50508035926020909101359150565b600080600080600080600080610100898b031215611d6857600080fd5b8835611d7381611b9f565b97506020890135611d8381611b9f565b965060408901359550606089013594506080890135935060a0890135611da881611b9f565b925060c0890135915060e0890135611dbf81611b9f565b809150509295985092959890939650565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610e2057610e20611dd0565b600082611e1a57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610e2057610e20611dd0565b81810381811115610e2057610e20611dd0565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060018201611ed957611ed9611dd0565b5060010190565b600060208284031215611ef257600080fd5b81518015158114610aec57600080fd5b634e487b7160e01b600052603160045260246000fd5b60005b83811015611f33578181015183820152602001611f1b565b50506000910152565b60008251611f4e818460208701611f18565b9190910192915050565b6020815260008251806020840152611f77816040850160208701611f18565b601f01601f1916919091016040019291505056fea2646970667358221220e919ab4573c0f3831611766c42e252032aec585574eedbc2575802198a34162b64736f6c63430008120033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
CRONOS | 100.00% | $0.001137 | 16,730,762.4248 | $19,015.01 |
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.