Source Code
Latest 25 from a total of 804 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Harvest | 91061725 | 2 hrs ago | IN | 0 XDC | 0.0036775 | ||||
Harvest | 91056611 | 5 hrs ago | IN | 0 XDC | 0.00315568 | ||||
Increase Lock Am... | 91016847 | 29 hrs ago | IN | 0 XDC | 0.00453618 | ||||
Harvest | 91016677 | 29 hrs ago | IN | 0 XDC | 0.00334318 | ||||
Harvest | 90987366 | 46 hrs ago | IN | 0 XDC | 0.00240827 | ||||
Harvest | 90985112 | 47 hrs ago | IN | 0 XDC | 0.0036775 | ||||
Harvest | 90966982 | 2 days ago | IN | 0 XDC | 0.00422391 | ||||
Batch NFT Stake | 90929571 | 3 days ago | IN | 0 XDC | 0.00712161 | ||||
Harvest | 90878028 | 4 days ago | IN | 0 XDC | 0.00646396 | ||||
Harvest | 90871364 | 4 days ago | IN | 0 XDC | 0.00386783 | ||||
Harvest | 90759523 | 7 days ago | IN | 0 XDC | 0.00446087 | ||||
Increase Lock Am... | 90739296 | 8 days ago | IN | 0 XDC | 0.00583633 | ||||
Harvest | 90728464 | 8 days ago | IN | 0 XDC | 0.00279961 | ||||
Batch NFT Withdr... | 90713167 | 8 days ago | IN | 0 XDC | 0.0049539 | ||||
Increase Lock Am... | 90706177 | 9 days ago | IN | 0 XDC | 0.00499156 | ||||
Batch NFT Stake | 90706103 | 9 days ago | IN | 0 XDC | 0.03009682 | ||||
Batch NFT Stake | 90706021 | 9 days ago | IN | 0 XDC | 0.01364583 | ||||
Deposit | 90705686 | 9 days ago | IN | 0 XDC | 0.00435495 | ||||
Batch NFT Withdr... | 90705674 | 9 days ago | IN | 0 XDC | 0.01802994 | ||||
Batch NFT Stake | 90690375 | 9 days ago | IN | 0 XDC | 0.04843885 | ||||
Batch NFT Stake | 90690309 | 9 days ago | IN | 0 XDC | 0.01631516 | ||||
Batch NFT Stake | 90689769 | 9 days ago | IN | 0 XDC | 0.03480557 | ||||
Batch NFT Stake | 90689752 | 9 days ago | IN | 0 XDC | 0.05883275 | ||||
Batch NFT Stake | 90689721 | 9 days ago | IN | 0 XDC | 0.06093893 | ||||
Harvest | 90689260 | 9 days ago | IN | 0 XDC | 0.00386783 |
Loading...
Loading
Contract Name:
NexusNFTMultiStaking
Compiler Version
v0.8.12+commit.f00d7308
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.12; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./NexusSwap/Interfaces/INexusNFTWeight.sol"; contract NexusNFTMultiStaking is Ownable, ReentrancyGuard, ERC721Holder { using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.AddressToUintMap; using SafeERC20 for IERC20; event OnTokenLock( address indexed owner, uint256 amount, uint256 unlockTime, uint8 lockMode ); event OnTokenUnlock(address user); event OnLockWithdrawal(address user, uint256 amount, uint8 mode); event OnLockAmountIncreased(address user, uint256 amount); event OnLockDurationIncreased(address user, uint256 newUnlockTime); uint256 public PRECISION_FACTOR = 10 ** 8; address public constant deadAddress = 0x000000000000000000000000000000000000dEaD; address public immutable nexusToken; uint256[] public LOCK_TIME_MULTIPLIER = [10, 15, 70, 150, 310]; uint256[] public LOCK_TIME_DURATION = [ 0, 30 days, 90 days, 180 days, 365 days ]; address public immutable nexusNFT; uint256 public minNexusAmount = 1111 ether; uint256 public minNexusCollateralAmount = 11111 ether; uint256 private constant PERCENT_FACTOR = 1e4; address public nexusWeight; struct TokenLock { uint256 totalWeight; uint256 unlockTime; uint256 nftWeight; uint256 lockedAmount; // How many staked tokens the user has provided, uint256 lockMode; // duration uint256 nexusLock; } struct Reward { address token; uint256 amount; } address public distributor; modifier onlyDistributorOrOwner() { require( msg.sender == distributor || msg.sender == owner(), "caller is not distributor or owner" ); _; } mapping(address => TokenLock) public userLocks; mapping(address => EnumerableSet.UintSet) private userNFTBalances; uint256 public totalPoolWeight; uint256 public totalnexusLocked; uint256 public totalNFTWeight; bool public enableEmergency; uint256[] public nexusAmountForLock = new uint256[](5); EnumerableMap.AddressToUintMap private accRewardPerWeight; EnumerableMap.AddressToUintMap private totalReward; mapping(address => EnumerableMap.AddressToUintMap) private userDebtRewards; mapping(address => EnumerableMap.AddressToUintMap) private userTotalReward; EnumerableSet.UintSet private rewardHistoryTimes; mapping(uint256 => Reward) private rewardHistory; receive() external payable {} fallback() external payable {} constructor(address _nexusToken, address _nexusNFT, address _nexusWeight) { require(_nexusWeight != address(0), "wrong weighter"); require(_nexusToken != address(0), "wrong weighter"); nexusToken = _nexusToken; nexusWeight = _nexusWeight; nexusNFT = _nexusNFT; } function totalStakedNFTCount() public view returns (uint256 tokenCount) { tokenCount = IERC721Enumerable(nexusNFT).balanceOf(address(this)); } function totalStakedNFT() external view returns (uint256[] memory) { uint256 tokenCount = IERC721Enumerable(nexusNFT).balanceOf( address(this) ); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = IERC721Enumerable(nexusNFT).tokenOfOwnerByIndex( address(this), index ); } return result; } } function userWalletNFT( address _owner ) external view returns (uint256[] memory) { uint256 tokenCount = IERC721Enumerable(nexusNFT).balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = IERC721Enumerable(nexusNFT).tokenOfOwnerByIndex( _owner, index ); } return result; } } function userStakedNFT( address _owner ) public view returns (uint256[] memory) { return userNFTBalances[_owner].values(); } function userStakedNFTCount(address _owner) public view returns (uint256) { return userNFTBalances[_owner].length(); } function isStaked( address account, uint256 tokenId ) public view returns (bool) { return userNFTBalances[account].contains(tokenId); } function distributeReward( address token, uint256 _amount ) public payable onlyDistributorOrOwner { require(_amount > 0, "zero reward"); if (token != address(0)) { uint256 beforeBalance = IERC20(token).balanceOf(address(this)); IERC20(token).safeTransferFrom( address(msg.sender), address(this), _amount ); uint256 afterBalance = IERC20(token).balanceOf(address(this)); _amount = afterBalance - beforeBalance; } else { _amount = msg.value; } if (totalPoolWeight > 0) { (, uint256 lastValue) = accRewardPerWeight.tryGet(token); uint256 newValue = lastValue + (_amount * PRECISION_FACTOR) / totalPoolWeight; accRewardPerWeight.set(token, newValue); } (, uint256 lastTotalValue) = totalReward.tryGet(token); uint256 newTotalValue = lastTotalValue + _amount; totalReward.set(token, newTotalValue); rewardHistoryTimes.add(block.timestamp); rewardHistory[block.timestamp] = Reward({ token: token, amount: _amount }); } function backToPool(address token, uint256 _amount) private { if (totalPoolWeight > 0) { (, uint256 lastValue) = accRewardPerWeight.tryGet(token); uint256 newValue = lastValue + (_amount * PRECISION_FACTOR) / totalPoolWeight; accRewardPerWeight.set(token, newValue); } (, uint256 lastTotalValue) = totalReward.tryGet(token); uint256 newTotalValue = lastTotalValue + _amount; totalReward.set(token, newTotalValue); rewardHistoryTimes.add(block.timestamp); rewardHistory[block.timestamp] = Reward({ token: token, amount: _amount }); } function distributedUserTotalReward( address user ) external view returns (Reward[] memory rewards) { uint256 rewardCount = userTotalReward[user].length(); rewards = new Reward[](rewardCount); for (uint256 i; i < rewardCount; ) { (address token, uint256 distributed) = userTotalReward[user].at(i); rewards[i] = Reward({token: token, amount: distributed}); unchecked { i++; } } } function distributedTotalReward() external view returns (Reward[] memory rewards) { uint256 rewardCount = totalReward.length(); rewards = new Reward[](rewardCount); for (uint256 i; i < rewardCount; ) { (address token, uint256 distributed) = totalReward.at(i); rewards[i] = Reward({token: token, amount: distributed}); unchecked { i++; } } } function updateDebt() private { TokenLock storage lock = userLocks[msg.sender]; if (lock.totalWeight > 0) { uint256 rewardCount = accRewardPerWeight.length(); for (uint256 i; i < rewardCount; ) { (address token, uint256 acc) = accRewardPerWeight.at(i); uint256 newDebt = (lock.totalWeight * acc) / PRECISION_FACTOR; userDebtRewards[msg.sender].set(token, newDebt); unchecked { i++; } } } } function pendingRewards( address user ) external view returns (Reward[] memory rewards) { TokenLock memory lock = userLocks[user]; if (lock.totalWeight > 0) { uint256 rewardCount = accRewardPerWeight.length(); rewards = new Reward[](rewardCount); for (uint256 i; i < rewardCount; ) { (address token, uint256 acc) = accRewardPerWeight.at(i); (, uint256 debtReward) = userDebtRewards[user].tryGet(token); uint256 reward = (lock.totalWeight * acc) / PRECISION_FACTOR - debtReward; rewards[i] = Reward({token: token, amount: reward}); unchecked { i++; } } } } function _harvest() internal { TokenLock storage lock = userLocks[msg.sender]; if (lock.totalWeight > 0) { uint256 rewardCount = accRewardPerWeight.length(); for (uint256 i; i < rewardCount; ) { (address token, uint256 acc) = accRewardPerWeight.at(i); (, uint256 debtReward) = userDebtRewards[msg.sender].tryGet( token ); uint256 reward = (lock.totalWeight * acc) / PRECISION_FACTOR - debtReward; if (reward > 0) { if (token == address(0)) { transferETH(msg.sender, reward); } else { IERC20(token).safeTransfer(msg.sender, reward); } (, uint256 lastTotalValue) = userTotalReward[msg.sender] .tryGet(token); uint256 newTotalValue = lastTotalValue + reward; userTotalReward[msg.sender].set(token, newTotalValue); } uint256 newDebt = (lock.totalWeight * acc) / PRECISION_FACTOR; userDebtRewards[msg.sender].set(token, newDebt); unchecked { i++; } } } } function harvest() public { _harvest(); TokenLock storage lock = userLocks[msg.sender]; if (lock.unlockTime < block.timestamp && lock.lockMode > 0) { shortenLockTime(0); } } function rewardBackToPool() private { TokenLock storage lock = userLocks[msg.sender]; if (lock.totalWeight > 0) { uint256 rewardCount = accRewardPerWeight.length(); for (uint256 i; i < rewardCount; ) { (address token, uint256 acc) = accRewardPerWeight.at(i); (, uint256 debtReward) = userDebtRewards[msg.sender].tryGet( token ); uint256 reward = (lock.totalWeight * acc) / PRECISION_FACTOR - debtReward; if (reward > 0) { if (totalPoolWeight > 0) { (, uint256 lastValue) = accRewardPerWeight.tryGet( token ); uint256 newValue = lastValue + (reward * PRECISION_FACTOR) / totalPoolWeight; accRewardPerWeight.set(token, newValue); } (, uint256 lastTotalValue) = totalReward.tryGet(token); uint256 newTotalValue = lastTotalValue + reward; totalReward.set(token, newTotalValue); rewardHistoryTimes.add(block.timestamp + i); rewardHistory[block.timestamp + i] = Reward({ token: token, amount: reward }); } uint256 newDebt = (lock.totalWeight * acc) / PRECISION_FACTOR; userDebtRewards[msg.sender].set(token, newDebt); unchecked { i++; } } } } function depositNexusBar(uint256 amount) private { require(amount > 0, "zero amount"); require( IERC20(nexusToken).balanceOf(msg.sender) >= amount, "small nexusToken balance to stake" ); require( IERC20(nexusToken).allowance(msg.sender, address(this)) >= amount, "small nexusToken allowance to stake" ); uint256 beforeBalance = IERC20(nexusToken).balanceOf(address(this)); IERC20(nexusToken).safeTransferFrom( address(msg.sender), address(this), amount ); uint256 afterBalance = IERC20(nexusToken).balanceOf(address(this)); amount = afterBalance - beforeBalance; TokenLock storage lock = userLocks[msg.sender]; lock.nexusLock += amount; totalnexusLocked += amount; } function withdrawNexusBar(uint256 amount) private { require(amount > 0, "zero amount"); TokenLock storage lock = userLocks[msg.sender]; // require(lock.nexusLock >= amount, "small lock amount"); uint8 mode = 0; if (block.timestamp < lock.unlockTime) { mode = 1; } uint256 tokenFee = (amount * 50 * mode) / 100; uint256 amountWithdraw = amount - tokenFee; IERC20(nexusToken).safeTransfer(msg.sender, amountWithdraw); if (mode == 1) { uint256 burnAmount = (tokenFee * 50) / 100; IERC20(nexusToken).safeTransfer(deadAddress, burnAmount); backToPool(nexusToken, tokenFee - burnAmount); } lock.nexusLock -= amount; totalnexusLocked -= amount; } function batchNFTStake(uint256[] calldata tokenIds) public nonReentrant { require( IERC721(nexusNFT).isApprovedForAll(_msgSender(), address(this)), "Not approve nft to staker address" ); uint256 count = tokenIds.length; require(count > 0, "zero stake nft"); TokenLock storage lock = userLocks[msg.sender]; if (lock.lockMode != 0) { if (lock.lockedAmount > 0) { require( lock.lockedAmount >= minNexusAmount, "small nexus staked" ); depositNexusBar(minNexusCollateralAmount * count); } } uint256 newWeight = lock.nftWeight; uint256 addedWeight = 0; for (uint256 i = 0; i < count; ) { uint256 tokenId = tokenIds[i]; require( IERC721(nexusNFT).ownerOf(tokenId) == _msgSender(), "wrong owner" ); IERC721(nexusNFT).safeTransferFrom( _msgSender(), address(this), tokenId ); userNFTBalances[_msgSender()].add(tokenId); uint256 nexusNFTWeight = INexusNFTWeight(nexusWeight) .nexusNFTWeight(tokenId) * 10 ** 18; newWeight += nexusNFTWeight; // addedWeight += // (nexusNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) / // 10; if (lock.lockedAmount > 0) { addedWeight += (nexusNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10; } else { addedWeight += nexusNFTWeight; } unchecked { i++; } } _harvest(); lock.nftWeight = newWeight; lock.totalWeight = addedWeight + lock.totalWeight; totalPoolWeight += addedWeight; if (lock.unlockTime < block.timestamp && lock.lockMode > 0) { shortenLockTime(0); } else { updateDebt(); } } function NFTStake(uint256 tokenId) public nonReentrant { require( IERC721(nexusNFT).ownerOf(tokenId) == _msgSender(), "wrong owner" ); require( IERC721(nexusNFT).isApprovedForAll(_msgSender(), address(this)) || IERC721(nexusNFT).getApproved(tokenId) == address(this), "not approved" ); TokenLock storage lock = userLocks[msg.sender]; if (lock.lockMode != 0) { if (lock.lockedAmount > 0) { require( lock.lockedAmount >= minNexusAmount, "small nexus staked" ); depositNexusBar(minNexusCollateralAmount); } } IERC721(nexusNFT).safeTransferFrom( _msgSender(), address(this), tokenId ); _harvest(); userNFTBalances[_msgSender()].add(tokenId); uint256 oldWeight = lock.nftWeight; uint256 nexusNFTWeight = INexusNFTWeight(nexusWeight).nexusNFTWeight( tokenId ) * 10 ** 18; uint256 newWeight = oldWeight + nexusNFTWeight; lock.nftWeight = newWeight; uint256 addedWeight; if (lock.lockedAmount > 0) { addedWeight = (nexusNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10; } else { addedWeight = nexusNFTWeight; } lock.totalWeight += addedWeight; totalPoolWeight += addedWeight; if (lock.unlockTime < block.timestamp && lock.lockMode > 0) { shortenLockTime(0); } else { updateDebt(); } } function NFTWithdraw(uint256 tokenId) public nonReentrant { require(isStaked(_msgSender(), tokenId), "Not staked this nft"); IERC721(nexusNFT).safeTransferFrom( address(this), _msgSender(), tokenId ); TokenLock storage lock = userLocks[msg.sender]; if (lock.nexusLock >= minNexusCollateralAmount) { withdrawNexusBar(minNexusCollateralAmount); } else if (lock.nexusLock > 0) { withdrawNexusBar(lock.nexusLock); } userNFTBalances[_msgSender()].remove(tokenId); _harvest(); uint256 oldWeight = lock.nftWeight; uint256 nexusNFTWeight = INexusNFTWeight(nexusWeight).nexusNFTWeight( tokenId ) * 10 ** 18; uint256 newWeight = oldWeight - nexusNFTWeight; lock.nftWeight = newWeight; uint256 reduceddWeight; // (nexusNFTWeight * // LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10; if (lock.lockedAmount > 0) { reduceddWeight = (nexusNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10; } else { reduceddWeight = nexusNFTWeight; } lock.totalWeight -= reduceddWeight; totalPoolWeight -= reduceddWeight; if (lock.unlockTime < block.timestamp && lock.lockMode > 0) { shortenLockTime(0); } else { updateDebt(); } if (lock.lockedAmount == 0) { if (userStakedNFTCount(msg.sender) == 0) { delete userLocks[msg.sender]; } emit OnTokenUnlock(msg.sender); } } function batchNFTWithdraw(uint256[] calldata tokenIds) public nonReentrant { uint256 count = tokenIds.length; require(count > 0, "zero stake nft"); TokenLock storage lock = userLocks[msg.sender]; uint256 newWeight = lock.nftWeight; uint256 reduceddWeight = 0; for (uint256 i = 0; i < count; ) { uint256 tokenId = tokenIds[i]; require(isStaked(_msgSender(), tokenId), "Not staked this nft"); IERC721(nexusNFT).safeTransferFrom( address(this), _msgSender(), tokenId ); userNFTBalances[_msgSender()].remove(tokenId); uint256 nexusNFTWeight = INexusNFTWeight(nexusWeight) .nexusNFTWeight(tokenId) * 10 ** 18; newWeight -= nexusNFTWeight; // reduceddWeight += // (nexusNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) / // 10; if (lock.lockedAmount > 0) { reduceddWeight += (nexusNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10; } else { reduceddWeight += nexusNFTWeight; } unchecked { i++; } } _harvest(); if (lock.nexusLock >= minNexusCollateralAmount * count) { withdrawNexusBar(minNexusCollateralAmount * count); } else if (lock.nexusLock > 0) { withdrawNexusBar(lock.nexusLock); } lock.nftWeight = newWeight; lock.totalWeight -= reduceddWeight; totalPoolWeight -= reduceddWeight; if (lock.unlockTime < block.timestamp && lock.lockMode > 0) { shortenLockTime(0); } else { updateDebt(); } if (lock.lockedAmount == 0) { if (userStakedNFTCount(msg.sender) == 0) { delete userLocks[msg.sender]; } emit OnTokenUnlock(msg.sender); } } function calculateUserNFTWeight( address _account ) public view returns (uint256 weight) { uint256 tokenCount = userNFTBalances[_account].length(); if (tokenCount == 0) { return 0; } else { uint256[] memory staked = userStakedNFT(_account); uint256 i; for (i; i < tokenCount; ) { weight += INexusNFTWeight(nexusWeight).nexusNFTWeight(staked[i]) * 10 ** 18; unchecked { i++; } } } } /** * @notice locks nexus token until specified time * @param amount amount of tokens to lock * @param lockMode unix time in seconds after that tokens can be withdrawn */ function deposit( uint256 amount, uint8 lockMode ) external payable nonReentrant { require(amount > 0, "ZERO AMOUNT"); require( IERC20(nexusToken).balanceOf(msg.sender) >= amount, "small NEXUS balance to stake" ); require( IERC20(nexusToken).allowance(msg.sender, address(this)) >= amount, "small NEXUS allowance to stake" ); require(lockMode >= 0 && lockMode < 5, "Invalid lock mode"); TokenLock storage lock = userLocks[msg.sender]; require(lock.lockedAmount == 0, "already deposit"); uint256 beforeBalance = IERC20(nexusToken).balanceOf(address(this)); IERC20(nexusToken).safeTransferFrom( address(msg.sender), address(this), amount ); uint256 afterBalance = IERC20(nexusToken).balanceOf(address(this)); amount = afterBalance - beforeBalance; uint256 unlockTime = block.timestamp + LOCK_TIME_DURATION[lockMode]; uint256 addeddWeight = (amount * LOCK_TIME_MULTIPLIER[lockMode]) / 10; if (lock.nftWeight > 0) { addeddWeight += (lock.nftWeight * (LOCK_TIME_MULTIPLIER[lockMode] - 10)) / 10; if (lockMode > 0) { require(amount >= minNexusAmount, "small nexus amount for nft"); uint256 count = userStakedNFTCount(msg.sender); if ( count > 0 && minNexusCollateralAmount * count > lock.nexusLock ) { depositNexusBar( minNexusCollateralAmount * count - lock.nexusLock ); } } } _harvest(); totalPoolWeight += addeddWeight; nexusAmountForLock[lockMode] += amount; lock.totalWeight += addeddWeight; lock.lockedAmount += amount; if (lock.unlockTime < unlockTime) { lock.unlockTime = unlockTime; } lock.lockMode = lockMode; updateDebt(); emit OnTokenLock(msg.sender, amount, unlockTime, lockMode); } function extendLockTime(uint256 lockMode) external nonReentrant { require(lockMode > 0 && lockMode < 5, "Invalid lock mode"); TokenLock storage lock = userLocks[msg.sender]; require(lock.lockedAmount > 0, "no lock"); require(lock.lockMode < lockMode, "NOT INCREASING UNLOCK TIME"); uint256 count = userStakedNFTCount(msg.sender); uint256 unlockTime = lock.unlockTime + LOCK_TIME_DURATION[lockMode] - LOCK_TIME_DURATION[lock.lockMode]; uint256 addedWeight = ((lock.lockedAmount + lock.nftWeight) * (LOCK_TIME_MULTIPLIER[lockMode] - LOCK_TIME_MULTIPLIER[lock.lockMode])) / 10; uint256 requiredCollateral = count * minNexusCollateralAmount; uint256 additionalCollateralNeeded = 0; if (lock.nexusLock < requiredCollateral) { additionalCollateralNeeded = requiredCollateral - lock.nexusLock; // Check user balance and allowance before proceeding require( IERC20(nexusToken).balanceOf(msg.sender) >= additionalCollateralNeeded, "Insufficient balance for additional collateral" ); require( IERC20(nexusToken).allowance(msg.sender, address(this)) >= additionalCollateralNeeded, "Insufficient allowance for additional collateral" ); depositNexusBar(additionalCollateralNeeded); } _harvest(); totalPoolWeight += addedWeight; nexusAmountForLock[lock.lockMode] -= lock.lockedAmount; nexusAmountForLock[lockMode] += lock.lockedAmount; lock.totalWeight += addedWeight; lock.lockMode = lockMode; lock.unlockTime = unlockTime; updateDebt(); emit OnLockDurationIncreased(msg.sender, unlockTime); } function shortenLockTime(uint256 lockMode) internal { require(lockMode >= 0 && lockMode < 5, "Invalid lock mode"); TokenLock storage lock = userLocks[msg.sender]; require(lock.lockMode > lockMode, "NOT DECREASING UNLOCK TIME"); require(lock.unlockTime < block.timestamp, "original lock duration"); uint256 unlockTime = block.timestamp + LOCK_TIME_DURATION[lockMode]; uint256 reducedWeight = ((lock.lockedAmount + lock.nftWeight) * (LOCK_TIME_MULTIPLIER[lock.lockMode] - LOCK_TIME_MULTIPLIER[lockMode])) / 10; totalPoolWeight -= reducedWeight; nexusAmountForLock[lock.lockMode] -= lock.lockedAmount; nexusAmountForLock[lockMode] += lock.lockedAmount; lock.totalWeight -= reducedWeight; lock.lockMode = lockMode; lock.unlockTime = unlockTime; updateDebt(); } /** * @notice add tokens to an existing lock * @param amount tokens amount to add */ function increaseLockAmount(uint256 amount) external payable nonReentrant { require(amount > 0, "ZERO AMOUNT"); TokenLock storage lock = userLocks[msg.sender]; require(lock.lockedAmount > 0, "no original lock"); uint256 beforeBalance = IERC20(nexusToken).balanceOf(address(this)); IERC20(nexusToken).safeTransferFrom( address(msg.sender), address(this), amount ); uint256 afterBalance = IERC20(nexusToken).balanceOf(address(this)); amount = afterBalance - beforeBalance; _harvest(); uint256 addeddWeight = ((amount) * LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10; totalPoolWeight += addeddWeight; nexusAmountForLock[lock.lockMode] += amount; lock.totalWeight += addeddWeight; lock.lockedAmount += amount; if (lock.unlockTime < block.timestamp && lock.lockMode > 0) { shortenLockTime(0); } else { updateDebt(); } emit OnLockAmountIncreased(msg.sender, amount); } /** * @notice withdraw specified amount of tokens from lock. Current time must be greater than unlock time * @param amount amount of tokens to withdraw */ function withdraw(uint256 amount) public nonReentrant { TokenLock storage lock = userLocks[msg.sender]; require(lock.lockedAmount >= amount, "more withdraw"); require(amount > 0, "zero amount"); uint8 mode = 0; if (block.timestamp < lock.unlockTime) { mode = 1; rewardBackToPool(); } else { _harvest(); } uint256 tokenFee = (amount * 50 * mode) / 100; uint256 amountWithdraw = amount - tokenFee; if (amountWithdraw > 0) { IERC20(nexusToken).safeTransfer(msg.sender, amountWithdraw); } if (mode == 1) { uint256 burnAmount = (tokenFee * 5) / 10; IERC20(nexusToken).safeTransfer(deadAddress, burnAmount); backToPool(nexusToken, tokenFee - burnAmount); } nexusAmountForLock[lock.lockMode] -= amount; lock.lockedAmount -= amount; if (lock.lockedAmount == 0) { totalPoolWeight = totalPoolWeight + lock.nftWeight - lock.totalWeight; if (userStakedNFTCount(msg.sender) == 0) { delete userLocks[msg.sender]; } else { // lock.lockMode = 0; lock.totalWeight = lock.nftWeight; } } else { uint256 reducedWeight = (amount * LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10; totalPoolWeight -= reducedWeight; lock.totalWeight -= reducedWeight; } if (lock.unlockTime < block.timestamp && lock.lockMode > 0) { shortenLockTime(0); } else { updateDebt(); } if (lock.lockedAmount == 0) { emit OnTokenUnlock(msg.sender); } else { emit OnLockWithdrawal(msg.sender, amount, mode); } } function transferETH(address recipient, uint256 amount) private { (bool res, ) = payable(recipient).call{value: amount}(""); require(res, "ETH TRANSFER FAILED"); } function totalNexusLocked() public view returns (uint256 amount) { for (uint256 i; i < nexusAmountForLock.length; ) { amount += nexusAmountForLock[i]; unchecked { i++; } } } function setNexusWeight(address _nexusWeight) external onlyOwner { require(_nexusWeight != address(0), "wrong address"); nexusWeight = _nexusWeight; } function setMinNexusCollateral(uint256 _min) external onlyOwner { minNexusCollateralAmount = _min; } function setMinNexusAmount(uint256 _min) external onlyOwner { minNexusAmount = _min; } function setEmergency(bool _flag) external onlyOwner { enableEmergency = _flag; } function setDistributor(address _distributor) external onlyOwner { distributor = _distributor; } function emergencyWithdraw() public nonReentrant { require(enableEmergency, "not emergency feature"); // TokenLock storage lock = userLocks[msg.sender]; uint256[] memory staked = userStakedNFT(msg.sender); uint256 count = staked.length; for (uint256 i = 0; i < count; ) { uint256 tokenId = staked[i]; IERC721(nexusNFT).safeTransferFrom( address(this), _msgSender(), tokenId ); userNFTBalances[_msgSender()].remove(tokenId); unchecked { i++; } } } function getGlobalStatus() external view returns ( uint256 poolSize, uint256 nexusAmount, uint256 nftCount, uint256 NexusCollateralAmount ) { poolSize = totalPoolWeight; nexusAmount = totalNexusLocked(); nftCount = totalStakedNFTCount(); NexusCollateralAmount = totalnexusLocked; } function getRewardHistory() external view returns (uint256[] memory times, Reward[] memory rewards) { uint256 rewardCount = rewardHistoryTimes.length(); times = new uint256[](rewardCount); rewards = new Reward[](rewardCount); for (uint256 i; i < rewardCount; ) { uint256 rewardTime = rewardHistoryTimes.at(i); rewards[i] = rewardHistory[rewardTime]; times[i] = rewardTime; unchecked { i++; } } } function onERC721Received( address, address, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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`. * * 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; /** * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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 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 the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (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 `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol) pragma solidity ^0.8.0; import "../IERC721Receiver.sol"; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. */ contract ERC721Holder is IERC721Receiver { /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableMap.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableMap.js. pragma solidity ^0.8.0; import "./EnumerableSet.sol"; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * The following map types are supported: * * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0 * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableMap. * ==== */ library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct Bytes32ToBytes32Map { // Storage of keys EnumerableSet.Bytes32Set _keys; mapping(bytes32 => bytes32) _values; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) { map._values[key] = value; return map._keys.add(key); } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { delete map._values[key]; return map._keys.remove(key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { return map._keys.contains(key); } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { return map._keys.length(); } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) { bytes32 key = map._keys.at(index); return (key, map._values[key]); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (contains(map, key), bytes32(0)); } else { return (true, value); } } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key"); return value; } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( Bytes32ToBytes32Map storage map, bytes32 key, string memory errorMessage ) internal view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || contains(map, key), errorMessage); return value; } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) { return map._keys.values(); } // UintToUintMap struct UintToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToUintMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key), errorMessage)); } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToUintMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintToAddressMap struct UintToAddressMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( UintToAddressMap storage map, uint256 key, string memory errorMessage ) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage)))); } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressToUintMap struct AddressToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(AddressToUintMap storage map, address key) internal returns (bool) { return remove(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(AddressToUintMap storage map, address key) internal view returns (bool) { return contains(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns the number of elements in the map. O(1). */ function length(AddressToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (address(uint160(uint256(key))), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key)))); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(AddressToUintMap storage map, address key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( AddressToUintMap storage map, address key, string memory errorMessage ) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage)); } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(AddressToUintMap storage map) internal view returns (address[] memory) { bytes32[] memory store = keys(map._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // Bytes32ToUintMap struct Bytes32ToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) { return set(map._inner, key, bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) { return remove(map._inner, key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) { return contains(map._inner, key); } /** * @dev Returns the number of elements in the map. O(1). */ function length(Bytes32ToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (key, uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, key); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) { return uint256(get(map._inner, key)); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( Bytes32ToUintMap storage map, bytes32 key, string memory errorMessage ) internal view returns (uint256) { return uint256(get(map._inner, key, errorMessage)); } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) { bytes32[] memory store = keys(map._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; interface INexusNFTWeight { function nexusNFTWeight(uint256 tokenId) external view returns (uint256); }
{ "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
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_nexusToken","type":"address"},{"internalType":"address","name":"_nexusNFT","type":"address"},{"internalType":"address","name":"_nexusWeight","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OnLockAmountIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"newUnlockTime","type":"uint256"}],"name":"OnLockDurationIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"mode","type":"uint8"}],"name":"OnLockWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockTime","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"lockMode","type":"uint8"}],"name":"OnTokenLock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"}],"name":"OnTokenUnlock","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"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"LOCK_TIME_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"LOCK_TIME_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NFTStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NFTWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchNFTStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchNFTWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"calculateUserNFTWeight","outputs":[{"internalType":"uint256","name":"weight","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deadAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"lockMode","type":"uint8"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"distributeReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"distributedTotalReward","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct NexusNFTMultiStaking.Reward[]","name":"rewards","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"distributedUserTotalReward","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct NexusNFTMultiStaking.Reward[]","name":"rewards","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableEmergency","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"lockMode","type":"uint256"}],"name":"extendLockTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getGlobalStatus","outputs":[{"internalType":"uint256","name":"poolSize","type":"uint256"},{"internalType":"uint256","name":"nexusAmount","type":"uint256"},{"internalType":"uint256","name":"nftCount","type":"uint256"},{"internalType":"uint256","name":"NexusCollateralAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardHistory","outputs":[{"internalType":"uint256[]","name":"times","type":"uint256[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct NexusNFTMultiStaking.Reward[]","name":"rewards","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"increaseLockAmount","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isStaked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minNexusAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minNexusCollateralAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nexusAmountForLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nexusNFT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nexusToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nexusWeight","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":"nonpayable","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":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct NexusNFTMultiStaking.Reward[]","name":"rewards","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_distributor","type":"address"}],"name":"setDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_flag","type":"bool"}],"name":"setEmergency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_min","type":"uint256"}],"name":"setMinNexusAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_min","type":"uint256"}],"name":"setMinNexusCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nexusWeight","type":"address"}],"name":"setNexusWeight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalNFTWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalNexusLocked","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPoolWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakedNFT","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakedNFTCount","outputs":[{"internalType":"uint256","name":"tokenCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalnexusLocked","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":"address","name":"","type":"address"}],"name":"userLocks","outputs":[{"internalType":"uint256","name":"totalWeight","type":"uint256"},{"internalType":"uint256","name":"unlockTime","type":"uint256"},{"internalType":"uint256","name":"nftWeight","type":"uint256"},{"internalType":"uint256","name":"lockedAmount","type":"uint256"},{"internalType":"uint256","name":"lockMode","type":"uint256"},{"internalType":"uint256","name":"nexusLock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"userStakedNFT","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"userStakedNFTCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"userWalletNFT","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6305f5e100600255610160604052600a60c0908152600f60e052604661010052609661012052610136610140526200003c90600390600562000225565b506040805160a0810182526000815262278d0060208201526276a7009181019190915262ed4e0060608201526301e133806080820152620000829060049060056200027b565b50683c3a38e5ab72fc0000600590815569025a5419af66253c00006006556040805182815260c08101909152906020820160a08036833750508151620000d092600f925060200190620002c1565b50348015620000de57600080fd5b506040516200585e3803806200585e833981016040819052620001019162000333565b6200010c33620001d5565b600180556001600160a01b0381166200015d5760405162461bcd60e51b815260206004820152600e60248201526d3bb937b733903bb2b4b3b43a32b960911b60448201526064015b60405180910390fd5b6001600160a01b038316620001a65760405162461bcd60e51b815260206004820152600e60248201526d3bb937b733903bb2b4b3b43a32b960911b604482015260640162000154565b6001600160a01b03928316608052600780546001600160a01b0319169184169190911790551660a0526200037d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b82805482825590600052602060002090810192821562000269579160200282015b8281111562000269578251829061ffff1690559160200191906001019062000246565b5062000277929150620002ff565b5090565b82805482825590600052602060002090810192821562000269579160200282015b8281111562000269578251829063ffffffff169055916020019190600101906200029c565b82805482825590600052602060002090810192821562000269579160200282015b8281111562000269578251825591602001919060010190620002e2565b5b8082111562000277576000815560010162000300565b80516001600160a01b03811681146200032e57600080fd5b919050565b6000806000606084860312156200034957600080fd5b620003548462000316565b9250620003646020850162000316565b9150620003746040850162000316565b90509250925092565b60805160a0516153bf6200049f6000396000818161050b015281816117c301528181612107015281816121c00152818161227a015281816123b3015281816125e1015281816126d5015281816127d1015281816128d501528181612f7d01528181613144015281816134b8015281816136b9015281816138b8015261397601526000818161067a01528181610dcf01528181610e2a01528181610e580152818161132a015281816113ac015281816113ec01528181611ae801528181611bc601528181611d1501528181611d9701528181611dd701528181612b7301528181612c600152818161443601528181614491015281816144bf015281816145660152818161464e01528181614733015281816147b501526147f501526153bf6000f3fe6080604052600436106102975760003560e01c8063715018a611610166578063cc6f6163116100d3578063e20bc9321161008f578063e66891db1161006c578063e66891db14610893578063e829b6c0146108b3578063f2fde38b146108c9578063fdd93214146108e957005b8063e20bc93214610839578063e42c4e6314610859578063e5baa10c1461087357005b8063cc6f616314610779578063ccd34cd514610799578063cd0559eb146107af578063db2e21bc146107cf578063dcfc2006146107e4578063df3664b81461081957005b80638da5cb5b116101225780638da5cb5b146106dc5780638dea9e2e146106fa5780639231e9ad1461070f578063946de4a114610724578063bdc2db7014610739578063bfe109281461075957005b8063715018a61461061e57806375233e321461063357806375619ab51461064857806378f337e714610668578063808e61861461069c578063828047a5146106bc57005b806335b419eb116102045780635451da1b116101c05780635451da1b1461055857806359fc298e146105885780635ccedd95146105a85780636317cea5146105cb578063654cfdff146105eb5780636ef8d8f3146105fe57005b806335b419eb1461049957806340376ba2146104b9578063403f4447146104e657806344faeec4146104f95780634641257d1461052d57806353a457061461054257005b80631ec8bb8c116102535780631ec8bb8c146103e257806327c8f835146103f557806329e3dc12146104235780632c1777d6146104435780632e1a7d4d1461045957806331d7a2621461047957005b806302559004146102a05780630259ef58146102c95780630501d556146103465780630e41ef2214610366578063150b7a02146103935780631e2153a6146103cc57005b3661029e57005b005b3480156102ac57600080fd5b506102b6600b5481565b6040519081526020015b60405180910390f35b3480156102d557600080fd5b506103196102e4366004614e79565b600960205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909186565b604080519687526020870195909552938501929092526060840152608083015260a082015260c0016102c0565b34801561035257600080fd5b5061029e610361366004614ea4565b610909565b34801561037257600080fd5b50610386610381366004614e79565b610924565b6040516102c09190614f10565b34801561039f57600080fd5b506103b36103ae366004614f39565b610a2b565b6040516001600160e01b031990911681526020016102c0565b3480156103d857600080fd5b506102b660055481565b61029e6103f0366004615019565b610a3c565b34801561040157600080fd5b5061040b61dead81565b6040516001600160a01b0390911681526020016102c0565b34801561042f57600080fd5b5060075461040b906001600160a01b031681565b34801561044f57600080fd5b506102b6600c5481565b34801561046557600080fd5b5061029e610474366004615045565b610ce4565b34801561048557600080fd5b50610386610494366004614e79565b61108e565b3480156104a557600080fd5b506102b66104b4366004615045565b61122e565b3480156104c557600080fd5b506104d96104d4366004614e79565b61124f565b6040516102c0919061508e565b61029e6104f4366004615045565b611279565b34801561050557600080fd5b5061040b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561053957600080fd5b5061029e61159e565b34801561054e57600080fd5b506102b6600d5481565b34801561056457600080fd5b50610578610573366004615019565b6115db565b60405190151581526020016102c0565b34801561059457600080fd5b5061029e6105a3366004615045565b611604565b3480156105b457600080fd5b506105bd611611565b6040516102c09291906150a1565b3480156105d757600080fd5b5061029e6105e6366004615045565b61175f565b61029e6105f93660046150cf565b611a8b565b34801561060a57600080fd5b5061029e610619366004615045565b6120dc565b34801561062a57600080fd5b5061029e6125aa565b34801561063f57600080fd5b506104d96125be565b34801561065457600080fd5b5061029e610663366004614e79565b612782565b34801561067457600080fd5b5061040b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156106a857600080fd5b506104d96106b7366004614e79565b6127ac565b3480156106c857600080fd5b5061029e6106d7366004615045565b61296f565b3480156106e857600080fd5b506000546001600160a01b031661040b565b34801561070657600080fd5b506102b6612e4c565b34801561071b57600080fd5b50610386612e8d565b34801561073057600080fd5b506102b6612f65565b34801561074557600080fd5b5061029e610754366004614e79565b612ff5565b34801561076557600080fd5b5060085461040b906001600160a01b031681565b34801561078557600080fd5b5061029e610794366004615105565b613065565b3480156107a557600080fd5b506102b660025481565b3480156107bb57600080fd5b506102b66107ca366004614e79565b61340a565b3480156107db57600080fd5b5061029e61342b565b3480156107f057600080fd5b506107f9613563565b6040805194855260208501939093529183015260608201526080016102c0565b34801561082557600080fd5b5061029e610834366004615045565b613589565b34801561084557600080fd5b506102b6610854366004615045565b613596565b34801561086557600080fd5b50600e546105789060ff1681565b34801561087f57600080fd5b506102b661088e366004614e79565b6135a6565b34801561089f57600080fd5b5061029e6108ae366004615105565b6136a7565b3480156108bf57600080fd5b506102b660065481565b3480156108d557600080fd5b5061029e6108e4366004614e79565b613b5e565b3480156108f557600080fd5b506102b6610904366004615045565b613bd4565b610911613be4565b600e805460ff1916911515919091179055565b6001600160a01b03811660009081526017602052604081206060919061094990613c3e565b90508067ffffffffffffffff81111561096457610964614f23565b6040519080825280602002602001820160405280156109a957816020015b60408051808201909152600080825260208201528152602001906001900390816109825790505b50915060005b81811015610a24576001600160a01b038416600090815260176020526040812081906109db9084613c49565b915091506040518060400160405280836001600160a01b0316815260200182815250858481518110610a0f57610a0f61517a565b602090810291909101015250506001016109af565b5050919050565b630a85bd0160e11b5b949350505050565b6008546001600160a01b0316331480610a5f57506000546001600160a01b031633145b610abb5760405162461bcd60e51b815260206004820152602260248201527f63616c6c6572206973206e6f74206469737472696275746f72206f72206f776e60448201526132b960f11b60648201526084015b60405180910390fd5b60008111610af95760405162461bcd60e51b815260206004820152600b60248201526a1e995c9bc81c995dd85c9960aa1b6044820152606401610ab2565b6001600160a01b03821615610c0a576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b739190615190565b9050610b8a6001600160a01b038416333085613c67565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf59190615190565b9050610c0182826151bf565b92505050610c0d565b50345b600b5415610c5e576000610c22601084613cc5565b9150506000600b5460025484610c3891906151d6565b610c4291906151f5565b610c4c9083615217565b9050610c5a60108583613cdd565b5050505b6000610c6b601384613cc5565b915060009050610c7b8383615217565b9050610c8960138583613cdd565b50610c95601842613cf3565b50506040805180820182526001600160a01b0394851681526020808201948552426000908152601a90915291909120905181546001600160a01b03191694169390931783555051600190910155565b610cec613cff565b3360009081526009602052604090206003810154821115610d3f5760405162461bcd60e51b815260206004820152600d60248201526c6d6f726520776974686472617760981b6044820152606401610ab2565b60008211610d5f5760405162461bcd60e51b8152600401610ab29061522f565b60008160010154421015610d7d57506001610d78613d59565b610d85565b610d85613f35565b6000606460ff8316610d988660326151d6565b610da291906151d6565b610dac91906151f5565b90506000610dba82866151bf565b90508015610df657610df66001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383614090565b8260ff1660011415610e88576000600a610e118460056151d6565b610e1b91906151f5565b9050610e536001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661dead83614090565b610e867f0000000000000000000000000000000000000000000000000000000000000000610e8183866151bf565b610c0d565b505b84600f856004015481548110610ea057610ea061517a565b906000526020600020016000828254610eb991906151bf565b9250508190555084846003016000828254610ed491906151bf565b90915550506003840154610f535783546002850154600b54610ef69190615217565b610f0091906151bf565b600b55610f0c3361340a565b610f47573360009081526009602052604081208181556001810182905560028101829055600381018290556004810182905560050155610fc2565b60028401548455610fc2565b6000600a6003866004015481548110610f6e57610f6e61517a565b906000526020600020015487610f8491906151d6565b610f8e91906151f5565b905080600b6000828254610fa291906151bf565b9091555050845481908690600090610fbb9084906151bf565b9091555050505b428460010154108015610fd9575060008460040154115b15610fed57610fe860006140c0565b610ff5565b610ff56142e8565b6003840154611036576040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a161107e565b604080513381526020810187905260ff8516918101919091527f704f033850f47d833e5cf47aa6ea3fd43639cb4cac971745ef4f98bb5b0b78dd906060015b60405180910390a15b5050505061108b60018055565b50565b6001600160a01b038116600090815260096020908152604091829020825160c081018452815480825260018301549382019390935260028201549381019390935260038101546060848101919091526004820154608085015260059091015460a08401529190156112285760006111056010613c3e565b90508067ffffffffffffffff81111561112057611120614f23565b60405190808252806020026020018201604052801561116557816020015b604080518082019091526000808252602082015281526020019060019003908161113e5790505b50925060005b8181101561122557600080611181601084613c49565b6001600160a01b0389166000908152601660205260408120929450909250906111aa9084613cc5565b9150506000816002548489600001516111c391906151d6565b6111cd91906151f5565b6111d791906151bf565b90506040518060400160405280856001600160a01b03168152602001828152508886815181106112095761120961517a565b602002602001018190525084806001019550505050505061116b565b50505b50919050565b6004818154811061123e57600080fd5b600091825260209091200154905081565b6001600160a01b0381166000908152600a6020526040902060609061127390614375565b92915050565b611281613cff565b600081116112bf5760405162461bcd60e51b815260206004820152600b60248201526a16915493c8105353d5539560aa1b6044820152606401610ab2565b33600090815260096020526040902060038101546113125760405162461bcd60e51b815260206004820152601060248201526f6e6f206f726967696e616c206c6f636b60801b6044820152606401610ab2565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611379573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139d9190615190565b90506113d46001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333086613c67565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561143b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145f9190615190565b905061146b82826151bf565b9350611475613f35565b6000600a60038560040154815481106114905761149061517a565b9060005260206000200154866114a691906151d6565b6114b091906151f5565b905080600b60008282546114c49190615217565b9250508190555084600f8560040154815481106114e3576114e361517a565b9060005260206000200160008282546114fc9190615217565b9091555050835481908590600090611515908490615217565b92505081905550848460030160008282546115309190615217565b909155505060018401544211801561154c575060008460040154115b156115605761155b60006140c0565b611568565b6115686142e8565b60408051338152602081018790527f6a8757d829ee8d3cfb766d2dcfcb8ef4cef7d832778893fa7a1f3fa0cbaef6c39101611075565b6115a6613f35565b3360009081526009602052604090206001810154421180156115cc575060008160040154115b1561108b5761108b60006140c0565b6001600160a01b0382166000908152600a602052604081206115fd9083614382565b9392505050565b61160c613be4565b600655565b6060806000611620601861439a565b90508067ffffffffffffffff81111561163b5761163b614f23565b604051908082528060200260200182016040528015611664578160200160208202803683370190505b5092508067ffffffffffffffff81111561168057611680614f23565b6040519080825280602002602001820160405280156116c557816020015b604080518082019091526000808252602082015281526020019060019003908161169e5790505b50915060005b818110156117595760006116e06018836143a4565b6000818152601a6020908152604091829020825180840190935280546001600160a01b0316835260010154908201528551919250908590849081106117275761172761517a565b6020026020010181905250808583815181106117455761174561517a565b6020908102919091010152506001016116cb565b50509091565b611767613cff565b611772335b826115db565b6117b45760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610ab2565b604051632142170760e11b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342842e0e9061180490309033908690600401615254565b600060405180830381600087803b15801561181e57600080fd5b505af1158015611832573d6000803e3d6000fd5b50503360009081526009602052604090206006546005820154919350119050611865576118606006546143b0565b61187c565b60058101541561187c5761187c81600501546143b0565b6118a582600a6000335b6001600160a01b03168152602081019190915260400160002090614523565b506118ae613f35565b6002810154600754604051630628935760e11b8152600481018590526000916001600160a01b031690630c5126ae90602401602060405180830381865afa1580156118fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119219190615190565b61193390670de0b6b3a76400006151d6565b9050600061194182846151bf565b6002850181905560038501549091506000901561199857600a60038660040154815481106119715761197161517a565b90600052602060002001548461198791906151d6565b61199191906151f5565b905061199b565b50815b808560000160008282546119af91906151bf565b9250508190555080600b60008282546119c891906151bf565b90915550506001850154421180156119e4575060008560040154115b156119f8576119f360006140c0565b611a00565b611a006142e8565b6003850154611a7d57611a123361340a565b611a495733600090815260096020526040812081815560018101829055600281018290556003810182905560048101829055600501555b6040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a15b505050505061108b60018055565b611a93613cff565b60008211611ad15760405162461bcd60e51b815260206004820152600b60248201526a16915493c8105353d5539560aa1b6044820152606401610ab2565b6040516370a0823160e01b815233600482015282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611b37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5b9190615190565b1015611ba95760405162461bcd60e51b815260206004820152601c60248201527f736d616c6c204e455855532062616c616e636520746f207374616b65000000006044820152606401610ab2565b604051636eb1769f60e11b815233600482015230602482015282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015611c15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c399190615190565b1015611c875760405162461bcd60e51b815260206004820152601e60248201527f736d616c6c204e4558555320616c6c6f77616e636520746f207374616b6500006044820152606401610ab2565b60058160ff1610611caa5760405162461bcd60e51b8152600401610ab290615278565b336000908152600960205260409020600381015415611cfd5760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4819195c1bdcda5d608a1b6044820152606401610ab2565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611d64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d889190615190565b9050611dbf6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333087613c67565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611e26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4a9190615190565b9050611e5682826151bf565b9450600060048560ff1681548110611e7057611e7061517a565b906000526020600020015442611e869190615217565b90506000600a60038760ff1681548110611ea257611ea261517a565b906000526020600020015488611eb891906151d6565b611ec291906151f5565b600286015490915015611fd657600a8060038860ff1681548110611ee857611ee861517a565b9060005260206000200154611efd91906151bf565b8660020154611f0c91906151d6565b611f1691906151f5565b611f209082615217565b905060ff861615611fd657600554871015611f7d5760405162461bcd60e51b815260206004820152601a60248201527f736d616c6c206e6578757320616d6f756e7420666f72206e66740000000000006044820152606401610ab2565b6000611f883361340a565b9050600081118015611faa5750856005015481600654611fa891906151d6565b115b15611fd457611fd4866005015482600654611fc591906151d6565b611fcf91906151bf565b61452f565b505b611fde613f35565b80600b6000828254611ff09190615217565b9250508190555086600f8760ff168154811061200e5761200e61517a565b9060005260206000200160008282546120279190615217565b9091555050845481908690600090612040908490615217565b925050819055508685600301600082825461205b9190615217565b9091555050600185015482111561207457600185018290555b60ff861660048601556120856142e8565b604080518881526020810184905260ff881681830152905133917f33a7e23572980d21f64adcd089e8f9555c21859f029b3b67aa3dc68eb74ea8c1919081900360600190a250505050506120d860018055565b5050565b6120e4613cff565b336040516331a9108f60e11b8152600481018390526001600160a01b03918216917f00000000000000000000000000000000000000000000000000000000000000001690636352211e90602401602060405180830381865afa15801561214e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217291906152a3565b6001600160a01b0316146121b65760405162461bcd60e51b815260206004820152600b60248201526a3bb937b7339037bbb732b960a91b6044820152606401610ab2565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015612230573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225491906152c0565b806122f0575060405163020604bf60e21b81526004810182905230906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063081812fc90602401602060405180830381865afa1580156122c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122e591906152a3565b6001600160a01b0316145b61232b5760405162461bcd60e51b815260206004820152600c60248201526b1b9bdd08185c1c1c9bdd995960a21b6044820152606401610ab2565b3360009081526009602052604090206004810154156123a4576003810154156123a457600554816003015410156123995760405162461bcd60e51b81526020600482015260126024820152711cdb585b1b081b995e1d5cc81cdd185ad95960721b6044820152606401610ab2565b6123a460065461452f565b604051632142170760e11b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342842e0e906123f490339030908790600401615254565b600060405180830381600087803b15801561240e57600080fd5b505af1158015612422573d6000803e3d6000fd5b5050505061242e613f35565b61245782600a6000335b6001600160a01b03168152602081019190915260400160002090613cf3565b506002810154600754604051630628935760e11b8152600481018590526000916001600160a01b031690630c5126ae90602401602060405180830381865afa1580156124a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124cb9190615190565b6124dd90670de0b6b3a76400006151d6565b905060006124eb8284615217565b6002850181905560038501549091506000901561254257600a600386600401548154811061251b5761251b61517a565b90600052602060002001548461253191906151d6565b61253b91906151f5565b9050612545565b50815b808560000160008282546125599190615217565b9250508190555080600b60008282546125729190615217565b909155505060018501544211801561258e575060008560040154115b156125a25761259d60006140c0565b611a7d565b611a7d6142e8565b6125b2613be4565b6125bc60006148c0565b565b6040516370a0823160e01b81523060048201526060906000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612628573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061264c9190615190565b90508061266757505060408051600081526020810190915290565b60008167ffffffffffffffff81111561268257612682614f23565b6040519080825280602002602001820160405280156126ab578160200160208202803683370190505b50905060005b8281101561277757604051632f745c5960e01b8152306004820152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f745c5990604401602060405180830381865afa158015612724573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127489190615190565b82828151811061275a5761275a61517a565b60209081029190910101528061276f816152dd565b9150506126b1565b5092915050565b5090565b61278a613be4565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6040516370a0823160e01b81526001600160a01b0382811660048301526060916000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612818573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283c9190615190565b90508061285d5760408051600080825260208201909252905b509392505050565b60008167ffffffffffffffff81111561287857612878614f23565b6040519080825280602002602001820160405280156128a1578160200160208202803683370190505b50905060005b8281101561285557604051632f745c5960e01b81526001600160a01b038681166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690632f745c5990604401602060405180830381865afa15801561291c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129409190615190565b8282815181106129525761295261517a565b602090810291909101015280612967816152dd565b9150506128a7565b612977613cff565b6000811180156129875750600581105b6129a35760405162461bcd60e51b8152600401610ab290615278565b33600090815260096020526040902060038101546129ed5760405162461bcd60e51b81526020600482015260076024820152666e6f206c6f636b60c81b6044820152606401610ab2565b81816004015410612a405760405162461bcd60e51b815260206004820152601a60248201527f4e4f5420494e4352454153494e4720554e4c4f434b2054494d450000000000006044820152606401610ab2565b6000612a4b3361340a565b905060006004836004015481548110612a6657612a6661517a565b906000526020600020015460048581548110612a8457612a8461517a565b90600052602060002001548460010154612a9e9190615217565b612aa891906151bf565b90506000600a6003856004015481548110612ac557612ac561517a565b906000526020600020015460038781548110612ae357612ae361517a565b9060005260206000200154612af891906151bf565b85600201548660030154612b0c9190615217565b612b1691906151d6565b612b2091906151f5565b9050600060065484612b3291906151d6565b905060008186600501541015612d43576005860154612b5190836151bf565b6040516370a0823160e01b815233600482015290915081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bde9190615190565b1015612c435760405162461bcd60e51b815260206004820152602e60248201527f496e73756666696369656e742062616c616e636520666f72206164646974696f60448201526d1b985b0818dbdb1b185d195c985b60921b6064820152608401610ab2565b604051636eb1769f60e11b815233600482015230602482015281907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015612caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd39190615190565b1015612d3a5760405162461bcd60e51b815260206004820152603060248201527f496e73756666696369656e7420616c6c6f77616e636520666f7220616464697460448201526f1a5bdb985b0818dbdb1b185d195c985b60821b6064820152608401610ab2565b612d438161452f565b612d4b613f35565b82600b6000828254612d5d9190615217565b925050819055508560030154600f876004015481548110612d8057612d8061517a565b906000526020600020016000828254612d9991906151bf565b90915550506003860154600f805489908110612db757612db761517a565b906000526020600020016000828254612dd09190615217565b9091555050855483908790600090612de9908490615217565b90915550506004860187905560018601849055612e046142e8565b60408051338152602081018690527f753995fad25c940c55e7593d632fd28103c8a8f3b44a67b472e0c07a7231f7e5910160405180910390a150505050505061108b60018055565b6000805b600f5481101561277e57600f8181548110612e6d57612e6d61517a565b906000526020600020015482612e839190615217565b9150600101612e50565b60606000612e9b6013613c3e565b90508067ffffffffffffffff811115612eb657612eb6614f23565b604051908082528060200260200182016040528015612efb57816020015b6040805180820190915260008082526020820152815260200190600190039081612ed45790505b50915060005b81811015612f6057600080612f17601384613c49565b915091506040518060400160405280836001600160a01b0316815260200182815250858481518110612f4b57612f4b61517a565b60209081029190910101525050600101612f01565b505090565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612fcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ff09190615190565b905090565b612ffd613be4565b6001600160a01b0381166130435760405162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b6044820152606401610ab2565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b61306d613cff565b80806130ac5760405162461bcd60e51b815260206004820152600e60248201526d1e995c9bc81cdd185ad9481b999d60921b6044820152606401610ab2565b33600090815260096020526040812060028101549091805b848110156132c15760008787838181106130e0576130e061517a565b9050602002013590506130f361176c3390565b6131355760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610ab2565b604051632142170760e11b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342842e0e9061318590309033908690600401615254565b600060405180830381600087803b15801561319f57600080fd5b505af11580156131b3573d6000803e3d6000fd5b505050506131c681600a60006118863390565b50600754604051630628935760e11b8152600481018390526000916001600160a01b031690630c5126ae90602401602060405180830381865afa158015613211573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132359190615190565b61324790670de0b6b3a76400006151d6565b905061325381866151bf565b6003870154909550156132aa57600a60038760040154815481106132795761327961517a565b90600052602060002001548261328f91906151d6565b61329991906151f5565b6132a39085615217565b93506132b7565b6132b48185615217565b93505b50506001016130c4565b506132ca613f35565b836006546132d891906151d6565b8360050154106132fd576132f8846006546132f391906151d6565b6143b0565b613314565b6005830154156133145761331483600501546143b0565b6002830182905582548190849060009061332f9084906151bf565b9250508190555080600b600082825461334891906151bf565b9091555050600183015442118015613364575060008360040154115b156133785761337360006140c0565b613380565b6133806142e8565b60038301546133fd576133923361340a565b6133c95733600090815260096020526040812081815560018101829055600281018290556003810182905560048101829055600501555b6040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a15b505050506120d860018055565b6001600160a01b0381166000908152600a602052604081206112739061439a565b613433613cff565b600e5460ff1661347d5760405162461bcd60e51b81526020600482015260156024820152746e6f7420656d657267656e6379206665617475726560581b6044820152606401610ab2565b60006134883361124f565b805190915060005b818110156135575760008382815181106134ac576134ac61517a565b602002602001015190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166342842e0e306134ed3390565b846040518463ffffffff1660e01b815260040161350c93929190615254565b600060405180830381600087803b15801561352657600080fd5b505af115801561353a573d6000803e3d6000fd5b5050505061354d81600a60006118863390565b5050600101613490565b5050506125bc60018055565b600b5460008080613572612e4c565b925061357c612f65565b9150600c54905090919293565b613591613be4565b600555565b600f818154811061123e57600080fd5b6001600160a01b0381166000908152600a6020526040812081906135c99061439a565b9050806135d95750600092915050565b60006135e48461124f565b905060005b828110156112255760075482516001600160a01b0390911690630c5126ae9084908490811061361a5761361a61517a565b60200260200101516040518263ffffffff1660e01b815260040161364091815260200190565b602060405180830381865afa15801561365d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136819190615190565b61369390670de0b6b3a76400006151d6565b61369d9085615217565b93506001016135e9565b6136af613cff565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015613729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061374d91906152c0565b6137a35760405162461bcd60e51b815260206004820152602160248201527f4e6f7420617070726f7665206e667420746f207374616b6572206164647265736044820152607360f81b6064820152608401610ab2565b80806137e25760405162461bcd60e51b815260206004820152600e60248201526d1e995c9bc81cdd185ad9481b999d60921b6044820152606401610ab2565b3360009081526009602052604090206004810154156138615760038101541561386157600554816003015410156138505760405162461bcd60e51b81526020600482015260126024820152711cdb585b1b081b995e1d5cc81cdd185ad95960721b6044820152606401610ab2565b61386182600654611fcf91906151d6565b60028101546000805b84811015613af35760008787838181106138865761388661517a565b9050602002013590506138963390565b6040516331a9108f60e11b8152600481018390526001600160a01b03918216917f00000000000000000000000000000000000000000000000000000000000000001690636352211e90602401602060405180830381865afa1580156138ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061392391906152a3565b6001600160a01b0316146139675760405162461bcd60e51b815260206004820152600b60248201526a3bb937b7339037bbb732b960a91b6044820152606401610ab2565b604051632142170760e11b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342842e0e906139b790339030908690600401615254565b600060405180830381600087803b1580156139d157600080fd5b505af11580156139e5573d6000803e3d6000fd5b505050506139f881600a60006124383390565b50600754604051630628935760e11b8152600481018390526000916001600160a01b031690630c5126ae90602401602060405180830381865afa158015613a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a679190615190565b613a7990670de0b6b3a76400006151d6565b9050613a858186615217565b600387015490955015613adc57600a6003876004015481548110613aab57613aab61517a565b906000526020600020015482613ac191906151d6565b613acb91906151f5565b613ad59085615217565b9350613ae9565b613ae68185615217565b93505b505060010161386a565b50613afc613f35565b600283018290558254613b0f9082615217565b8355600b8054829190600090613b26908490615217565b9091555050600183015442118015613b42575060008360040154115b15613b5657613b5160006140c0565b6133fd565b6133fd6142e8565b613b66613be4565b6001600160a01b038116613bcb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ab2565b61108b816148c0565b6003818154811061123e57600080fd5b6000546001600160a01b031633146125bc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ab2565b600061127382614910565b6000808080613c58868661491b565b909450925050505b9250929050565b613cbf846323b872dd60e01b858585604051602401613c8893929190615254565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614946565b50505050565b6000808080613c58866001600160a01b038716614a1b565b6000610a34846001600160a01b03851684614a55565b60006115fd8383614a72565b60026001541415613d525760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ab2565b6002600155565b33600090815260096020526040902080541561108b576000613d7b6010613c3e565b905060005b81811015613f3057600080613d96601084613c49565b33600090815260166020526040812092945090925090613db69084613cc5565b915050600081600254848960000154613dcf91906151d6565b613dd991906151f5565b613de391906151bf565b90508015613ee257600b5415613e3c576000613e00601086613cc5565b9150506000600b5460025484613e1691906151d6565b613e2091906151f5565b613e2a9083615217565b9050613e3860108783613cdd565b5050505b6000613e49601386613cc5565b915060009050613e598383615217565b9050613e6760138783613cdd565b50613e7d613e758842615217565b601890613cf3565b50604080518082019091526001600160a01b038716815260208101849052601a6000613ea98a42615217565b8152602080820192909252604001600020825181546001600160a01b0319166001600160a01b0390911617815591015160019091015550505b6000600254848960000154613ef791906151d6565b613f0191906151f5565b336000908152601660205260409020909150613f1e908683613cdd565b505060019094019350613d8092505050565b505050565b33600090815260096020526040902080541561108b576000613f576010613c3e565b905060005b81811015613f3057600080613f72601084613c49565b33600090815260166020526040812092945090925090613f929084613cc5565b915050600081600254848960000154613fab91906151d6565b613fb591906151f5565b613fbf91906151bf565b90508015614042576001600160a01b038416613fe457613fdf3382614ac1565b613ff8565b613ff86001600160a01b0385163383614090565b3360009081526017602052604081206140119086613cc5565b9150600090506140218383615217565b33600090815260176020526040902090915061403e908783613cdd565b5050505b600060025484896000015461405791906151d6565b61406191906151f5565b33600090815260166020526040902090915061407e908683613cdd565b505060019094019350613f5c92505050565b6040516001600160a01b038316602482015260448101829052613f3090849063a9059cbb60e01b90606401613c88565b600581106140e05760405162461bcd60e51b8152600401610ab290615278565b336000908152600960205260409020600481015482106141425760405162461bcd60e51b815260206004820152601a60248201527f4e4f542044454352454153494e4720554e4c4f434b2054494d450000000000006044820152606401610ab2565b4281600101541061418e5760405162461bcd60e51b815260206004820152601660248201527537b934b3b4b730b6103637b1b590323ab930ba34b7b760511b6044820152606401610ab2565b6000600483815481106141a3576141a361517a565b9060005260206000200154426141b99190615217565b90506000600a600385815481106141d2576141d261517a565b906000526020600020015460038560040154815481106141f4576141f461517a565b906000526020600020015461420991906151bf565b8460020154856003015461421d9190615217565b61422791906151d6565b61423191906151f5565b905080600b600082825461424591906151bf565b925050819055508260030154600f8460040154815481106142685761426861517a565b90600052602060002001600082825461428191906151bf565b90915550506003830154600f80548690811061429f5761429f61517a565b9060005260206000200160008282546142b89190615217565b90915550508254819084906000906142d19084906151bf565b90915550506004830184905560018301829055613cbf5b33600090815260096020526040902080541561108b57600061430a6010613c3e565b905060005b81811015613f3057600080614325601084613c49565b91509150600060025482876000015461433e91906151d6565b61434891906151f5565b336000908152601660205260409020909150614365908483613cdd565b50506001909201915061430f9050565b606060006115fd83614b5a565b600081815260018301602052604081205415156115fd565b6000611273825490565b60006115fd8383614bb6565b600081116143d05760405162461bcd60e51b8152600401610ab29061522f565b33600090815260096020526040812060018101549091904210156143f2575060015b6000606460ff83166144058660326151d6565b61440f91906151d6565b61441991906151f5565b9050600061442782866151bf565b905061445d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383614090565b8260ff16600114156144ea57600060646144788460326151d6565b61448291906151f5565b90506144ba6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661dead83614090565b6144e87f0000000000000000000000000000000000000000000000000000000000000000610e8183866151bf565b505b848460050160008282546144fe91906151bf565b9250508190555084600c600082825461451791906151bf565b90915550505050505050565b60006115fd8383614be0565b6000811161454f5760405162461bcd60e51b8152600401610ab29061522f565b6040516370a0823160e01b815233600482015281907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156145b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145d99190615190565b10156146315760405162461bcd60e51b815260206004820152602160248201527f736d616c6c206e65787573546f6b656e2062616c616e636520746f207374616b6044820152606560f81b6064820152608401610ab2565b604051636eb1769f60e11b815233600482015230602482015281907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063dd62ed3e90604401602060405180830381865afa15801561469d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146c19190615190565b101561471b5760405162461bcd60e51b815260206004820152602360248201527f736d616c6c206e65787573546f6b656e20616c6c6f77616e636520746f207374604482015262616b6560e81b6064820152608401610ab2565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015614782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147a69190615190565b90506147dd6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333085613c67565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015614844573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148689190615190565b905061487482826151bf565b336000908152600960205260408120600581018054939650909286929061489c908490615217565b9250508190555083600c60008282546148b59190615217565b909155505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006112738261439a565b6000808061492985856143a4565b600081815260029690960160205260409095205494959350505050565b600061499b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cd39092919063ffffffff16565b90508051600014806149bc5750808060200190518101906149bc91906152c0565b613f305760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610ab2565b6000818152600283016020526040812054819080614a4a57614a3d8585614ce2565b925060009150613c609050565b600192509050613c60565b60008281526002840160205260408120829055610a348484613cf3565b6000818152600183016020526040812054614ab957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611273565b506000611273565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614b0e576040519150601f19603f3d011682016040523d82523d6000602084013e614b13565b606091505b5050905080613f305760405162461bcd60e51b8152602060048201526013602482015272115512081514905394d1915488119052531151606a1b6044820152606401610ab2565b606081600001805480602002602001604051908101604052809291908181526020018280548015614baa57602002820191906000526020600020905b815481526020019060010190808311614b96575b50505050509050919050565b6000826000018281548110614bcd57614bcd61517a565b9060005260206000200154905092915050565b60008181526001830160205260408120548015614cc9576000614c046001836151bf565b8554909150600090614c18906001906151bf565b9050818114614c7d576000866000018281548110614c3857614c3861517a565b9060005260206000200154905080876000018481548110614c5b57614c5b61517a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614c8e57614c8e6152f8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611273565b6000915050611273565b6060610a348484600085614cee565b60006115fd8383614382565b606082471015614d4f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610ab2565b600080866001600160a01b03168587604051614d6b919061533a565b60006040518083038185875af1925050503d8060008114614da8576040519150601f19603f3d011682016040523d82523d6000602084013e614dad565b606091505b5091509150614dbe87838387614dc9565b979650505050505050565b60608315614e35578251614e2e576001600160a01b0385163b614e2e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ab2565b5081610a34565b610a348383815115614e4a5781518083602001fd5b8060405162461bcd60e51b8152600401610ab29190615356565b6001600160a01b038116811461108b57600080fd5b600060208284031215614e8b57600080fd5b81356115fd81614e64565b801515811461108b57600080fd5b600060208284031215614eb657600080fd5b81356115fd81614e96565b600081518084526020808501945080840160005b83811015614f0557815180516001600160a01b031688528301518388015260409096019590820190600101614ed5565b509495945050505050565b6020815260006115fd6020830184614ec1565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215614f4f57600080fd5b8435614f5a81614e64565b93506020850135614f6a81614e64565b925060408501359150606085013567ffffffffffffffff80821115614f8e57600080fd5b818701915087601f830112614fa257600080fd5b813581811115614fb457614fb4614f23565b604051601f8201601f19908116603f01168101908382118183101715614fdc57614fdc614f23565b816040528281528a6020848701011115614ff557600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561502c57600080fd5b823561503781614e64565b946020939093013593505050565b60006020828403121561505757600080fd5b5035919050565b600081518084526020808501945080840160005b83811015614f0557815187529582019590820190600101615072565b6020815260006115fd602083018461505e565b6040815260006150b4604083018561505e565b82810360208401526150c68185614ec1565b95945050505050565b600080604083850312156150e257600080fd5b82359150602083013560ff811681146150fa57600080fd5b809150509250929050565b6000806020838503121561511857600080fd5b823567ffffffffffffffff8082111561513057600080fd5b818501915085601f83011261514457600080fd5b81358181111561515357600080fd5b8660208260051b850101111561516857600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156151a257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156151d1576151d16151a9565b500390565b60008160001904831182151516156151f0576151f06151a9565b500290565b60008261521257634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561522a5761522a6151a9565b500190565b6020808252600b908201526a1e995c9bc8185b5bdd5b9d60aa1b604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b602080825260119082015270496e76616c6964206c6f636b206d6f646560781b604082015260600190565b6000602082840312156152b557600080fd5b81516115fd81614e64565b6000602082840312156152d257600080fd5b81516115fd81614e96565b60006000198214156152f1576152f16151a9565b5060010190565b634e487b7160e01b600052603160045260246000fd5b60005b83811015615329578181015183820152602001615311565b83811115613cbf5750506000910152565b6000825161534c81846020870161530e565b9190910192915050565b602081526000825180602084015261537581604085016020870161530e565b601f01601f1916919091016040019291505056fea264697066735822122018596dea729b26175ccb15113bb2bbb93d740d271b7251ae08d897e7eff70ca864736f6c634300080c00330000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd0000000000000000000000008ddd0fd4c84bf3fdb2a14cf98faa48d0f82f4caf
Deployed Bytecode
0x6080604052600436106102975760003560e01c8063715018a611610166578063cc6f6163116100d3578063e20bc9321161008f578063e66891db1161006c578063e66891db14610893578063e829b6c0146108b3578063f2fde38b146108c9578063fdd93214146108e957005b8063e20bc93214610839578063e42c4e6314610859578063e5baa10c1461087357005b8063cc6f616314610779578063ccd34cd514610799578063cd0559eb146107af578063db2e21bc146107cf578063dcfc2006146107e4578063df3664b81461081957005b80638da5cb5b116101225780638da5cb5b146106dc5780638dea9e2e146106fa5780639231e9ad1461070f578063946de4a114610724578063bdc2db7014610739578063bfe109281461075957005b8063715018a61461061e57806375233e321461063357806375619ab51461064857806378f337e714610668578063808e61861461069c578063828047a5146106bc57005b806335b419eb116102045780635451da1b116101c05780635451da1b1461055857806359fc298e146105885780635ccedd95146105a85780636317cea5146105cb578063654cfdff146105eb5780636ef8d8f3146105fe57005b806335b419eb1461049957806340376ba2146104b9578063403f4447146104e657806344faeec4146104f95780634641257d1461052d57806353a457061461054257005b80631ec8bb8c116102535780631ec8bb8c146103e257806327c8f835146103f557806329e3dc12146104235780632c1777d6146104435780632e1a7d4d1461045957806331d7a2621461047957005b806302559004146102a05780630259ef58146102c95780630501d556146103465780630e41ef2214610366578063150b7a02146103935780631e2153a6146103cc57005b3661029e57005b005b3480156102ac57600080fd5b506102b6600b5481565b6040519081526020015b60405180910390f35b3480156102d557600080fd5b506103196102e4366004614e79565b600960205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909186565b604080519687526020870195909552938501929092526060840152608083015260a082015260c0016102c0565b34801561035257600080fd5b5061029e610361366004614ea4565b610909565b34801561037257600080fd5b50610386610381366004614e79565b610924565b6040516102c09190614f10565b34801561039f57600080fd5b506103b36103ae366004614f39565b610a2b565b6040516001600160e01b031990911681526020016102c0565b3480156103d857600080fd5b506102b660055481565b61029e6103f0366004615019565b610a3c565b34801561040157600080fd5b5061040b61dead81565b6040516001600160a01b0390911681526020016102c0565b34801561042f57600080fd5b5060075461040b906001600160a01b031681565b34801561044f57600080fd5b506102b6600c5481565b34801561046557600080fd5b5061029e610474366004615045565b610ce4565b34801561048557600080fd5b50610386610494366004614e79565b61108e565b3480156104a557600080fd5b506102b66104b4366004615045565b61122e565b3480156104c557600080fd5b506104d96104d4366004614e79565b61124f565b6040516102c0919061508e565b61029e6104f4366004615045565b611279565b34801561050557600080fd5b5061040b7f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd81565b34801561053957600080fd5b5061029e61159e565b34801561054e57600080fd5b506102b6600d5481565b34801561056457600080fd5b50610578610573366004615019565b6115db565b60405190151581526020016102c0565b34801561059457600080fd5b5061029e6105a3366004615045565b611604565b3480156105b457600080fd5b506105bd611611565b6040516102c09291906150a1565b3480156105d757600080fd5b5061029e6105e6366004615045565b61175f565b61029e6105f93660046150cf565b611a8b565b34801561060a57600080fd5b5061029e610619366004615045565b6120dc565b34801561062a57600080fd5b5061029e6125aa565b34801561063f57600080fd5b506104d96125be565b34801561065457600080fd5b5061029e610663366004614e79565b612782565b34801561067457600080fd5b5061040b7f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e81565b3480156106a857600080fd5b506104d96106b7366004614e79565b6127ac565b3480156106c857600080fd5b5061029e6106d7366004615045565b61296f565b3480156106e857600080fd5b506000546001600160a01b031661040b565b34801561070657600080fd5b506102b6612e4c565b34801561071b57600080fd5b50610386612e8d565b34801561073057600080fd5b506102b6612f65565b34801561074557600080fd5b5061029e610754366004614e79565b612ff5565b34801561076557600080fd5b5060085461040b906001600160a01b031681565b34801561078557600080fd5b5061029e610794366004615105565b613065565b3480156107a557600080fd5b506102b660025481565b3480156107bb57600080fd5b506102b66107ca366004614e79565b61340a565b3480156107db57600080fd5b5061029e61342b565b3480156107f057600080fd5b506107f9613563565b6040805194855260208501939093529183015260608201526080016102c0565b34801561082557600080fd5b5061029e610834366004615045565b613589565b34801561084557600080fd5b506102b6610854366004615045565b613596565b34801561086557600080fd5b50600e546105789060ff1681565b34801561087f57600080fd5b506102b661088e366004614e79565b6135a6565b34801561089f57600080fd5b5061029e6108ae366004615105565b6136a7565b3480156108bf57600080fd5b506102b660065481565b3480156108d557600080fd5b5061029e6108e4366004614e79565b613b5e565b3480156108f557600080fd5b506102b6610904366004615045565b613bd4565b610911613be4565b600e805460ff1916911515919091179055565b6001600160a01b03811660009081526017602052604081206060919061094990613c3e565b90508067ffffffffffffffff81111561096457610964614f23565b6040519080825280602002602001820160405280156109a957816020015b60408051808201909152600080825260208201528152602001906001900390816109825790505b50915060005b81811015610a24576001600160a01b038416600090815260176020526040812081906109db9084613c49565b915091506040518060400160405280836001600160a01b0316815260200182815250858481518110610a0f57610a0f61517a565b602090810291909101015250506001016109af565b5050919050565b630a85bd0160e11b5b949350505050565b6008546001600160a01b0316331480610a5f57506000546001600160a01b031633145b610abb5760405162461bcd60e51b815260206004820152602260248201527f63616c6c6572206973206e6f74206469737472696275746f72206f72206f776e60448201526132b960f11b60648201526084015b60405180910390fd5b60008111610af95760405162461bcd60e51b815260206004820152600b60248201526a1e995c9bc81c995dd85c9960aa1b6044820152606401610ab2565b6001600160a01b03821615610c0a576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b739190615190565b9050610b8a6001600160a01b038416333085613c67565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf59190615190565b9050610c0182826151bf565b92505050610c0d565b50345b600b5415610c5e576000610c22601084613cc5565b9150506000600b5460025484610c3891906151d6565b610c4291906151f5565b610c4c9083615217565b9050610c5a60108583613cdd565b5050505b6000610c6b601384613cc5565b915060009050610c7b8383615217565b9050610c8960138583613cdd565b50610c95601842613cf3565b50506040805180820182526001600160a01b0394851681526020808201948552426000908152601a90915291909120905181546001600160a01b03191694169390931783555051600190910155565b610cec613cff565b3360009081526009602052604090206003810154821115610d3f5760405162461bcd60e51b815260206004820152600d60248201526c6d6f726520776974686472617760981b6044820152606401610ab2565b60008211610d5f5760405162461bcd60e51b8152600401610ab29061522f565b60008160010154421015610d7d57506001610d78613d59565b610d85565b610d85613f35565b6000606460ff8316610d988660326151d6565b610da291906151d6565b610dac91906151f5565b90506000610dba82866151bf565b90508015610df657610df66001600160a01b037f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e163383614090565b8260ff1660011415610e88576000600a610e118460056151d6565b610e1b91906151f5565b9050610e536001600160a01b037f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e1661dead83614090565b610e867f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e610e8183866151bf565b610c0d565b505b84600f856004015481548110610ea057610ea061517a565b906000526020600020016000828254610eb991906151bf565b9250508190555084846003016000828254610ed491906151bf565b90915550506003840154610f535783546002850154600b54610ef69190615217565b610f0091906151bf565b600b55610f0c3361340a565b610f47573360009081526009602052604081208181556001810182905560028101829055600381018290556004810182905560050155610fc2565b60028401548455610fc2565b6000600a6003866004015481548110610f6e57610f6e61517a565b906000526020600020015487610f8491906151d6565b610f8e91906151f5565b905080600b6000828254610fa291906151bf565b9091555050845481908690600090610fbb9084906151bf565b9091555050505b428460010154108015610fd9575060008460040154115b15610fed57610fe860006140c0565b610ff5565b610ff56142e8565b6003840154611036576040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a161107e565b604080513381526020810187905260ff8516918101919091527f704f033850f47d833e5cf47aa6ea3fd43639cb4cac971745ef4f98bb5b0b78dd906060015b60405180910390a15b5050505061108b60018055565b50565b6001600160a01b038116600090815260096020908152604091829020825160c081018452815480825260018301549382019390935260028201549381019390935260038101546060848101919091526004820154608085015260059091015460a08401529190156112285760006111056010613c3e565b90508067ffffffffffffffff81111561112057611120614f23565b60405190808252806020026020018201604052801561116557816020015b604080518082019091526000808252602082015281526020019060019003908161113e5790505b50925060005b8181101561122557600080611181601084613c49565b6001600160a01b0389166000908152601660205260408120929450909250906111aa9084613cc5565b9150506000816002548489600001516111c391906151d6565b6111cd91906151f5565b6111d791906151bf565b90506040518060400160405280856001600160a01b03168152602001828152508886815181106112095761120961517a565b602002602001018190525084806001019550505050505061116b565b50505b50919050565b6004818154811061123e57600080fd5b600091825260209091200154905081565b6001600160a01b0381166000908152600a6020526040902060609061127390614375565b92915050565b611281613cff565b600081116112bf5760405162461bcd60e51b815260206004820152600b60248201526a16915493c8105353d5539560aa1b6044820152606401610ab2565b33600090815260096020526040902060038101546113125760405162461bcd60e51b815260206004820152601060248201526f6e6f206f726967696e616c206c6f636b60801b6044820152606401610ab2565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b0316906370a0823190602401602060405180830381865afa158015611379573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139d9190615190565b90506113d46001600160a01b037f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e16333086613c67565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b0316906370a0823190602401602060405180830381865afa15801561143b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145f9190615190565b905061146b82826151bf565b9350611475613f35565b6000600a60038560040154815481106114905761149061517a565b9060005260206000200154866114a691906151d6565b6114b091906151f5565b905080600b60008282546114c49190615217565b9250508190555084600f8560040154815481106114e3576114e361517a565b9060005260206000200160008282546114fc9190615217565b9091555050835481908590600090611515908490615217565b92505081905550848460030160008282546115309190615217565b909155505060018401544211801561154c575060008460040154115b156115605761155b60006140c0565b611568565b6115686142e8565b60408051338152602081018790527f6a8757d829ee8d3cfb766d2dcfcb8ef4cef7d832778893fa7a1f3fa0cbaef6c39101611075565b6115a6613f35565b3360009081526009602052604090206001810154421180156115cc575060008160040154115b1561108b5761108b60006140c0565b6001600160a01b0382166000908152600a602052604081206115fd9083614382565b9392505050565b61160c613be4565b600655565b6060806000611620601861439a565b90508067ffffffffffffffff81111561163b5761163b614f23565b604051908082528060200260200182016040528015611664578160200160208202803683370190505b5092508067ffffffffffffffff81111561168057611680614f23565b6040519080825280602002602001820160405280156116c557816020015b604080518082019091526000808252602082015281526020019060019003908161169e5790505b50915060005b818110156117595760006116e06018836143a4565b6000818152601a6020908152604091829020825180840190935280546001600160a01b0316835260010154908201528551919250908590849081106117275761172761517a565b6020026020010181905250808583815181106117455761174561517a565b6020908102919091010152506001016116cb565b50509091565b611767613cff565b611772335b826115db565b6117b45760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610ab2565b604051632142170760e11b81527f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd6001600160a01b0316906342842e0e9061180490309033908690600401615254565b600060405180830381600087803b15801561181e57600080fd5b505af1158015611832573d6000803e3d6000fd5b50503360009081526009602052604090206006546005820154919350119050611865576118606006546143b0565b61187c565b60058101541561187c5761187c81600501546143b0565b6118a582600a6000335b6001600160a01b03168152602081019190915260400160002090614523565b506118ae613f35565b6002810154600754604051630628935760e11b8152600481018590526000916001600160a01b031690630c5126ae90602401602060405180830381865afa1580156118fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119219190615190565b61193390670de0b6b3a76400006151d6565b9050600061194182846151bf565b6002850181905560038501549091506000901561199857600a60038660040154815481106119715761197161517a565b90600052602060002001548461198791906151d6565b61199191906151f5565b905061199b565b50815b808560000160008282546119af91906151bf565b9250508190555080600b60008282546119c891906151bf565b90915550506001850154421180156119e4575060008560040154115b156119f8576119f360006140c0565b611a00565b611a006142e8565b6003850154611a7d57611a123361340a565b611a495733600090815260096020526040812081815560018101829055600281018290556003810182905560048101829055600501555b6040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a15b505050505061108b60018055565b611a93613cff565b60008211611ad15760405162461bcd60e51b815260206004820152600b60248201526a16915493c8105353d5539560aa1b6044820152606401610ab2565b6040516370a0823160e01b815233600482015282907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b0316906370a0823190602401602060405180830381865afa158015611b37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5b9190615190565b1015611ba95760405162461bcd60e51b815260206004820152601c60248201527f736d616c6c204e455855532062616c616e636520746f207374616b65000000006044820152606401610ab2565b604051636eb1769f60e11b815233600482015230602482015282907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015611c15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c399190615190565b1015611c875760405162461bcd60e51b815260206004820152601e60248201527f736d616c6c204e4558555320616c6c6f77616e636520746f207374616b6500006044820152606401610ab2565b60058160ff1610611caa5760405162461bcd60e51b8152600401610ab290615278565b336000908152600960205260409020600381015415611cfd5760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4819195c1bdcda5d608a1b6044820152606401610ab2565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b0316906370a0823190602401602060405180830381865afa158015611d64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d889190615190565b9050611dbf6001600160a01b037f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e16333087613c67565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b0316906370a0823190602401602060405180830381865afa158015611e26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4a9190615190565b9050611e5682826151bf565b9450600060048560ff1681548110611e7057611e7061517a565b906000526020600020015442611e869190615217565b90506000600a60038760ff1681548110611ea257611ea261517a565b906000526020600020015488611eb891906151d6565b611ec291906151f5565b600286015490915015611fd657600a8060038860ff1681548110611ee857611ee861517a565b9060005260206000200154611efd91906151bf565b8660020154611f0c91906151d6565b611f1691906151f5565b611f209082615217565b905060ff861615611fd657600554871015611f7d5760405162461bcd60e51b815260206004820152601a60248201527f736d616c6c206e6578757320616d6f756e7420666f72206e66740000000000006044820152606401610ab2565b6000611f883361340a565b9050600081118015611faa5750856005015481600654611fa891906151d6565b115b15611fd457611fd4866005015482600654611fc591906151d6565b611fcf91906151bf565b61452f565b505b611fde613f35565b80600b6000828254611ff09190615217565b9250508190555086600f8760ff168154811061200e5761200e61517a565b9060005260206000200160008282546120279190615217565b9091555050845481908690600090612040908490615217565b925050819055508685600301600082825461205b9190615217565b9091555050600185015482111561207457600185018290555b60ff861660048601556120856142e8565b604080518881526020810184905260ff881681830152905133917f33a7e23572980d21f64adcd089e8f9555c21859f029b3b67aa3dc68eb74ea8c1919081900360600190a250505050506120d860018055565b5050565b6120e4613cff565b336040516331a9108f60e11b8152600481018390526001600160a01b03918216917f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd1690636352211e90602401602060405180830381865afa15801561214e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217291906152a3565b6001600160a01b0316146121b65760405162461bcd60e51b815260206004820152600b60248201526a3bb937b7339037bbb732b960a91b6044820152606401610ab2565b6001600160a01b037f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd1663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015612230573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225491906152c0565b806122f0575060405163020604bf60e21b81526004810182905230906001600160a01b037f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd169063081812fc90602401602060405180830381865afa1580156122c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122e591906152a3565b6001600160a01b0316145b61232b5760405162461bcd60e51b815260206004820152600c60248201526b1b9bdd08185c1c1c9bdd995960a21b6044820152606401610ab2565b3360009081526009602052604090206004810154156123a4576003810154156123a457600554816003015410156123995760405162461bcd60e51b81526020600482015260126024820152711cdb585b1b081b995e1d5cc81cdd185ad95960721b6044820152606401610ab2565b6123a460065461452f565b604051632142170760e11b81527f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd6001600160a01b0316906342842e0e906123f490339030908790600401615254565b600060405180830381600087803b15801561240e57600080fd5b505af1158015612422573d6000803e3d6000fd5b5050505061242e613f35565b61245782600a6000335b6001600160a01b03168152602081019190915260400160002090613cf3565b506002810154600754604051630628935760e11b8152600481018590526000916001600160a01b031690630c5126ae90602401602060405180830381865afa1580156124a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124cb9190615190565b6124dd90670de0b6b3a76400006151d6565b905060006124eb8284615217565b6002850181905560038501549091506000901561254257600a600386600401548154811061251b5761251b61517a565b90600052602060002001548461253191906151d6565b61253b91906151f5565b9050612545565b50815b808560000160008282546125599190615217565b9250508190555080600b60008282546125729190615217565b909155505060018501544211801561258e575060008560040154115b156125a25761259d60006140c0565b611a7d565b611a7d6142e8565b6125b2613be4565b6125bc60006148c0565b565b6040516370a0823160e01b81523060048201526060906000906001600160a01b037f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd16906370a0823190602401602060405180830381865afa158015612628573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061264c9190615190565b90508061266757505060408051600081526020810190915290565b60008167ffffffffffffffff81111561268257612682614f23565b6040519080825280602002602001820160405280156126ab578160200160208202803683370190505b50905060005b8281101561277757604051632f745c5960e01b8152306004820152602481018290527f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd6001600160a01b031690632f745c5990604401602060405180830381865afa158015612724573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127489190615190565b82828151811061275a5761275a61517a565b60209081029190910101528061276f816152dd565b9150506126b1565b5092915050565b5090565b61278a613be4565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6040516370a0823160e01b81526001600160a01b0382811660048301526060916000917f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd16906370a0823190602401602060405180830381865afa158015612818573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283c9190615190565b90508061285d5760408051600080825260208201909252905b509392505050565b60008167ffffffffffffffff81111561287857612878614f23565b6040519080825280602002602001820160405280156128a1578160200160208202803683370190505b50905060005b8281101561285557604051632f745c5960e01b81526001600160a01b038681166004830152602482018390527f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd1690632f745c5990604401602060405180830381865afa15801561291c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129409190615190565b8282815181106129525761295261517a565b602090810291909101015280612967816152dd565b9150506128a7565b612977613cff565b6000811180156129875750600581105b6129a35760405162461bcd60e51b8152600401610ab290615278565b33600090815260096020526040902060038101546129ed5760405162461bcd60e51b81526020600482015260076024820152666e6f206c6f636b60c81b6044820152606401610ab2565b81816004015410612a405760405162461bcd60e51b815260206004820152601a60248201527f4e4f5420494e4352454153494e4720554e4c4f434b2054494d450000000000006044820152606401610ab2565b6000612a4b3361340a565b905060006004836004015481548110612a6657612a6661517a565b906000526020600020015460048581548110612a8457612a8461517a565b90600052602060002001548460010154612a9e9190615217565b612aa891906151bf565b90506000600a6003856004015481548110612ac557612ac561517a565b906000526020600020015460038781548110612ae357612ae361517a565b9060005260206000200154612af891906151bf565b85600201548660030154612b0c9190615217565b612b1691906151d6565b612b2091906151f5565b9050600060065484612b3291906151d6565b905060008186600501541015612d43576005860154612b5190836151bf565b6040516370a0823160e01b815233600482015290915081906001600160a01b037f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e16906370a0823190602401602060405180830381865afa158015612bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bde9190615190565b1015612c435760405162461bcd60e51b815260206004820152602e60248201527f496e73756666696369656e742062616c616e636520666f72206164646974696f60448201526d1b985b0818dbdb1b185d195c985b60921b6064820152608401610ab2565b604051636eb1769f60e11b815233600482015230602482015281907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015612caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd39190615190565b1015612d3a5760405162461bcd60e51b815260206004820152603060248201527f496e73756666696369656e7420616c6c6f77616e636520666f7220616464697460448201526f1a5bdb985b0818dbdb1b185d195c985b60821b6064820152608401610ab2565b612d438161452f565b612d4b613f35565b82600b6000828254612d5d9190615217565b925050819055508560030154600f876004015481548110612d8057612d8061517a565b906000526020600020016000828254612d9991906151bf565b90915550506003860154600f805489908110612db757612db761517a565b906000526020600020016000828254612dd09190615217565b9091555050855483908790600090612de9908490615217565b90915550506004860187905560018601849055612e046142e8565b60408051338152602081018690527f753995fad25c940c55e7593d632fd28103c8a8f3b44a67b472e0c07a7231f7e5910160405180910390a150505050505061108b60018055565b6000805b600f5481101561277e57600f8181548110612e6d57612e6d61517a565b906000526020600020015482612e839190615217565b9150600101612e50565b60606000612e9b6013613c3e565b90508067ffffffffffffffff811115612eb657612eb6614f23565b604051908082528060200260200182016040528015612efb57816020015b6040805180820190915260008082526020820152815260200190600190039081612ed45790505b50915060005b81811015612f6057600080612f17601384613c49565b915091506040518060400160405280836001600160a01b0316815260200182815250858481518110612f4b57612f4b61517a565b60209081029190910101525050600101612f01565b505090565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd6001600160a01b0316906370a0823190602401602060405180830381865afa158015612fcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ff09190615190565b905090565b612ffd613be4565b6001600160a01b0381166130435760405162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b6044820152606401610ab2565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b61306d613cff565b80806130ac5760405162461bcd60e51b815260206004820152600e60248201526d1e995c9bc81cdd185ad9481b999d60921b6044820152606401610ab2565b33600090815260096020526040812060028101549091805b848110156132c15760008787838181106130e0576130e061517a565b9050602002013590506130f361176c3390565b6131355760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610ab2565b604051632142170760e11b81527f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd6001600160a01b0316906342842e0e9061318590309033908690600401615254565b600060405180830381600087803b15801561319f57600080fd5b505af11580156131b3573d6000803e3d6000fd5b505050506131c681600a60006118863390565b50600754604051630628935760e11b8152600481018390526000916001600160a01b031690630c5126ae90602401602060405180830381865afa158015613211573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132359190615190565b61324790670de0b6b3a76400006151d6565b905061325381866151bf565b6003870154909550156132aa57600a60038760040154815481106132795761327961517a565b90600052602060002001548261328f91906151d6565b61329991906151f5565b6132a39085615217565b93506132b7565b6132b48185615217565b93505b50506001016130c4565b506132ca613f35565b836006546132d891906151d6565b8360050154106132fd576132f8846006546132f391906151d6565b6143b0565b613314565b6005830154156133145761331483600501546143b0565b6002830182905582548190849060009061332f9084906151bf565b9250508190555080600b600082825461334891906151bf565b9091555050600183015442118015613364575060008360040154115b156133785761337360006140c0565b613380565b6133806142e8565b60038301546133fd576133923361340a565b6133c95733600090815260096020526040812081815560018101829055600281018290556003810182905560048101829055600501555b6040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a15b505050506120d860018055565b6001600160a01b0381166000908152600a602052604081206112739061439a565b613433613cff565b600e5460ff1661347d5760405162461bcd60e51b81526020600482015260156024820152746e6f7420656d657267656e6379206665617475726560581b6044820152606401610ab2565b60006134883361124f565b805190915060005b818110156135575760008382815181106134ac576134ac61517a565b602002602001015190507f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd6001600160a01b03166342842e0e306134ed3390565b846040518463ffffffff1660e01b815260040161350c93929190615254565b600060405180830381600087803b15801561352657600080fd5b505af115801561353a573d6000803e3d6000fd5b5050505061354d81600a60006118863390565b5050600101613490565b5050506125bc60018055565b600b5460008080613572612e4c565b925061357c612f65565b9150600c54905090919293565b613591613be4565b600555565b600f818154811061123e57600080fd5b6001600160a01b0381166000908152600a6020526040812081906135c99061439a565b9050806135d95750600092915050565b60006135e48461124f565b905060005b828110156112255760075482516001600160a01b0390911690630c5126ae9084908490811061361a5761361a61517a565b60200260200101516040518263ffffffff1660e01b815260040161364091815260200190565b602060405180830381865afa15801561365d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136819190615190565b61369390670de0b6b3a76400006151d6565b61369d9085615217565b93506001016135e9565b6136af613cff565b6001600160a01b037f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd1663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015613729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061374d91906152c0565b6137a35760405162461bcd60e51b815260206004820152602160248201527f4e6f7420617070726f7665206e667420746f207374616b6572206164647265736044820152607360f81b6064820152608401610ab2565b80806137e25760405162461bcd60e51b815260206004820152600e60248201526d1e995c9bc81cdd185ad9481b999d60921b6044820152606401610ab2565b3360009081526009602052604090206004810154156138615760038101541561386157600554816003015410156138505760405162461bcd60e51b81526020600482015260126024820152711cdb585b1b081b995e1d5cc81cdd185ad95960721b6044820152606401610ab2565b61386182600654611fcf91906151d6565b60028101546000805b84811015613af35760008787838181106138865761388661517a565b9050602002013590506138963390565b6040516331a9108f60e11b8152600481018390526001600160a01b03918216917f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd1690636352211e90602401602060405180830381865afa1580156138ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061392391906152a3565b6001600160a01b0316146139675760405162461bcd60e51b815260206004820152600b60248201526a3bb937b7339037bbb732b960a91b6044820152606401610ab2565b604051632142170760e11b81527f0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd6001600160a01b0316906342842e0e906139b790339030908690600401615254565b600060405180830381600087803b1580156139d157600080fd5b505af11580156139e5573d6000803e3d6000fd5b505050506139f881600a60006124383390565b50600754604051630628935760e11b8152600481018390526000916001600160a01b031690630c5126ae90602401602060405180830381865afa158015613a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a679190615190565b613a7990670de0b6b3a76400006151d6565b9050613a858186615217565b600387015490955015613adc57600a6003876004015481548110613aab57613aab61517a565b906000526020600020015482613ac191906151d6565b613acb91906151f5565b613ad59085615217565b9350613ae9565b613ae68185615217565b93505b505060010161386a565b50613afc613f35565b600283018290558254613b0f9082615217565b8355600b8054829190600090613b26908490615217565b9091555050600183015442118015613b42575060008360040154115b15613b5657613b5160006140c0565b6133fd565b6133fd6142e8565b613b66613be4565b6001600160a01b038116613bcb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ab2565b61108b816148c0565b6003818154811061123e57600080fd5b6000546001600160a01b031633146125bc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ab2565b600061127382614910565b6000808080613c58868661491b565b909450925050505b9250929050565b613cbf846323b872dd60e01b858585604051602401613c8893929190615254565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614946565b50505050565b6000808080613c58866001600160a01b038716614a1b565b6000610a34846001600160a01b03851684614a55565b60006115fd8383614a72565b60026001541415613d525760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ab2565b6002600155565b33600090815260096020526040902080541561108b576000613d7b6010613c3e565b905060005b81811015613f3057600080613d96601084613c49565b33600090815260166020526040812092945090925090613db69084613cc5565b915050600081600254848960000154613dcf91906151d6565b613dd991906151f5565b613de391906151bf565b90508015613ee257600b5415613e3c576000613e00601086613cc5565b9150506000600b5460025484613e1691906151d6565b613e2091906151f5565b613e2a9083615217565b9050613e3860108783613cdd565b5050505b6000613e49601386613cc5565b915060009050613e598383615217565b9050613e6760138783613cdd565b50613e7d613e758842615217565b601890613cf3565b50604080518082019091526001600160a01b038716815260208101849052601a6000613ea98a42615217565b8152602080820192909252604001600020825181546001600160a01b0319166001600160a01b0390911617815591015160019091015550505b6000600254848960000154613ef791906151d6565b613f0191906151f5565b336000908152601660205260409020909150613f1e908683613cdd565b505060019094019350613d8092505050565b505050565b33600090815260096020526040902080541561108b576000613f576010613c3e565b905060005b81811015613f3057600080613f72601084613c49565b33600090815260166020526040812092945090925090613f929084613cc5565b915050600081600254848960000154613fab91906151d6565b613fb591906151f5565b613fbf91906151bf565b90508015614042576001600160a01b038416613fe457613fdf3382614ac1565b613ff8565b613ff86001600160a01b0385163383614090565b3360009081526017602052604081206140119086613cc5565b9150600090506140218383615217565b33600090815260176020526040902090915061403e908783613cdd565b5050505b600060025484896000015461405791906151d6565b61406191906151f5565b33600090815260166020526040902090915061407e908683613cdd565b505060019094019350613f5c92505050565b6040516001600160a01b038316602482015260448101829052613f3090849063a9059cbb60e01b90606401613c88565b600581106140e05760405162461bcd60e51b8152600401610ab290615278565b336000908152600960205260409020600481015482106141425760405162461bcd60e51b815260206004820152601a60248201527f4e4f542044454352454153494e4720554e4c4f434b2054494d450000000000006044820152606401610ab2565b4281600101541061418e5760405162461bcd60e51b815260206004820152601660248201527537b934b3b4b730b6103637b1b590323ab930ba34b7b760511b6044820152606401610ab2565b6000600483815481106141a3576141a361517a565b9060005260206000200154426141b99190615217565b90506000600a600385815481106141d2576141d261517a565b906000526020600020015460038560040154815481106141f4576141f461517a565b906000526020600020015461420991906151bf565b8460020154856003015461421d9190615217565b61422791906151d6565b61423191906151f5565b905080600b600082825461424591906151bf565b925050819055508260030154600f8460040154815481106142685761426861517a565b90600052602060002001600082825461428191906151bf565b90915550506003830154600f80548690811061429f5761429f61517a565b9060005260206000200160008282546142b89190615217565b90915550508254819084906000906142d19084906151bf565b90915550506004830184905560018301829055613cbf5b33600090815260096020526040902080541561108b57600061430a6010613c3e565b905060005b81811015613f3057600080614325601084613c49565b91509150600060025482876000015461433e91906151d6565b61434891906151f5565b336000908152601660205260409020909150614365908483613cdd565b50506001909201915061430f9050565b606060006115fd83614b5a565b600081815260018301602052604081205415156115fd565b6000611273825490565b60006115fd8383614bb6565b600081116143d05760405162461bcd60e51b8152600401610ab29061522f565b33600090815260096020526040812060018101549091904210156143f2575060015b6000606460ff83166144058660326151d6565b61440f91906151d6565b61441991906151f5565b9050600061442782866151bf565b905061445d6001600160a01b037f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e163383614090565b8260ff16600114156144ea57600060646144788460326151d6565b61448291906151f5565b90506144ba6001600160a01b037f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e1661dead83614090565b6144e87f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e610e8183866151bf565b505b848460050160008282546144fe91906151bf565b9250508190555084600c600082825461451791906151bf565b90915550505050505050565b60006115fd8383614be0565b6000811161454f5760405162461bcd60e51b8152600401610ab29061522f565b6040516370a0823160e01b815233600482015281907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b0316906370a0823190602401602060405180830381865afa1580156145b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145d99190615190565b10156146315760405162461bcd60e51b815260206004820152602160248201527f736d616c6c206e65787573546f6b656e2062616c616e636520746f207374616b6044820152606560f81b6064820152608401610ab2565b604051636eb1769f60e11b815233600482015230602482015281907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b03169063dd62ed3e90604401602060405180830381865afa15801561469d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146c19190615190565b101561471b5760405162461bcd60e51b815260206004820152602360248201527f736d616c6c206e65787573546f6b656e20616c6c6f77616e636520746f207374604482015262616b6560e81b6064820152608401610ab2565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b0316906370a0823190602401602060405180830381865afa158015614782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147a69190615190565b90506147dd6001600160a01b037f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e16333085613c67565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e6001600160a01b0316906370a0823190602401602060405180830381865afa158015614844573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148689190615190565b905061487482826151bf565b336000908152600960205260408120600581018054939650909286929061489c908490615217565b9250508190555083600c60008282546148b59190615217565b909155505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006112738261439a565b6000808061492985856143a4565b600081815260029690960160205260409095205494959350505050565b600061499b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cd39092919063ffffffff16565b90508051600014806149bc5750808060200190518101906149bc91906152c0565b613f305760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610ab2565b6000818152600283016020526040812054819080614a4a57614a3d8585614ce2565b925060009150613c609050565b600192509050613c60565b60008281526002840160205260408120829055610a348484613cf3565b6000818152600183016020526040812054614ab957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611273565b506000611273565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614b0e576040519150601f19603f3d011682016040523d82523d6000602084013e614b13565b606091505b5050905080613f305760405162461bcd60e51b8152602060048201526013602482015272115512081514905394d1915488119052531151606a1b6044820152606401610ab2565b606081600001805480602002602001604051908101604052809291908181526020018280548015614baa57602002820191906000526020600020905b815481526020019060010190808311614b96575b50505050509050919050565b6000826000018281548110614bcd57614bcd61517a565b9060005260206000200154905092915050565b60008181526001830160205260408120548015614cc9576000614c046001836151bf565b8554909150600090614c18906001906151bf565b9050818114614c7d576000866000018281548110614c3857614c3861517a565b9060005260206000200154905080876000018481548110614c5b57614c5b61517a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614c8e57614c8e6152f8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611273565b6000915050611273565b6060610a348484600085614cee565b60006115fd8383614382565b606082471015614d4f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610ab2565b600080866001600160a01b03168587604051614d6b919061533a565b60006040518083038185875af1925050503d8060008114614da8576040519150601f19603f3d011682016040523d82523d6000602084013e614dad565b606091505b5091509150614dbe87838387614dc9565b979650505050505050565b60608315614e35578251614e2e576001600160a01b0385163b614e2e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ab2565b5081610a34565b610a348383815115614e4a5781518083602001fd5b8060405162461bcd60e51b8152600401610ab29190615356565b6001600160a01b038116811461108b57600080fd5b600060208284031215614e8b57600080fd5b81356115fd81614e64565b801515811461108b57600080fd5b600060208284031215614eb657600080fd5b81356115fd81614e96565b600081518084526020808501945080840160005b83811015614f0557815180516001600160a01b031688528301518388015260409096019590820190600101614ed5565b509495945050505050565b6020815260006115fd6020830184614ec1565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215614f4f57600080fd5b8435614f5a81614e64565b93506020850135614f6a81614e64565b925060408501359150606085013567ffffffffffffffff80821115614f8e57600080fd5b818701915087601f830112614fa257600080fd5b813581811115614fb457614fb4614f23565b604051601f8201601f19908116603f01168101908382118183101715614fdc57614fdc614f23565b816040528281528a6020848701011115614ff557600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561502c57600080fd5b823561503781614e64565b946020939093013593505050565b60006020828403121561505757600080fd5b5035919050565b600081518084526020808501945080840160005b83811015614f0557815187529582019590820190600101615072565b6020815260006115fd602083018461505e565b6040815260006150b4604083018561505e565b82810360208401526150c68185614ec1565b95945050505050565b600080604083850312156150e257600080fd5b82359150602083013560ff811681146150fa57600080fd5b809150509250929050565b6000806020838503121561511857600080fd5b823567ffffffffffffffff8082111561513057600080fd5b818501915085601f83011261514457600080fd5b81358181111561515357600080fd5b8660208260051b850101111561516857600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156151a257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156151d1576151d16151a9565b500390565b60008160001904831182151516156151f0576151f06151a9565b500290565b60008261521257634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561522a5761522a6151a9565b500190565b6020808252600b908201526a1e995c9bc8185b5bdd5b9d60aa1b604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b602080825260119082015270496e76616c6964206c6f636b206d6f646560781b604082015260600190565b6000602082840312156152b557600080fd5b81516115fd81614e64565b6000602082840312156152d257600080fd5b81516115fd81614e96565b60006000198214156152f1576152f16151a9565b5060010190565b634e487b7160e01b600052603160045260246000fd5b60005b83811015615329578181015183820152602001615311565b83811115613cbf5750506000910152565b6000825161534c81846020870161530e565b9190910192915050565b602081526000825180602084015261537581604085016020870161530e565b601f01601f1916919091016040019291505056fea264697066735822122018596dea729b26175ccb15113bb2bbb93d740d271b7251ae08d897e7eff70ca864736f6c634300080c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd0000000000000000000000008ddd0fd4c84bf3fdb2a14cf98faa48d0f82f4caf
-----Decoded View---------------
Arg [0] : _nexusToken (address): 0x6DaF228391e388B05BBc682FEA3CB1Cc3E38c44E
Arg [1] : _nexusNFT (address): 0x5272CAeB01711AF57A119A53BE1b863cDe8178bd
Arg [2] : _nexusWeight (address): 0x8DdD0FD4c84bf3FDb2A14CF98fAA48D0f82f4caF
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e
Arg [1] : 0000000000000000000000005272caeb01711af57a119a53be1b863cde8178bd
Arg [2] : 0000000000000000000000008ddd0fd4c84bf3fdb2a14cf98faa48d0f82f4caf
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ 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.