Source Code
Overview
MNT Balance
MNT Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
StakedINTX
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 2048 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.18;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
library Math {
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
contract StakedINTX is ReentrancyGuardUpgradeable, ERC721Upgradeable, Ownable2StepUpgradeable, PausableUpgradeable {
using SafeERC20 for IERC20;
uint public constant DURATION = 1 weeks;
uint public constant P = 1e18; // PRECISSION
uint constant initialExchangeRate = 1e18;
uint public lastTokenId;
uint public totalXINTX;
uint public loyaltyDuration;
uint public maxLoyaltyBoost;
uint public maxPenalty;
uint public minPenalty;
uint public lastUpdateTime;
uint public periodFinish;
uint public rewardRate;
uint public rewardPerWeightStored;
uint public totalWeight;
IERC20 public INTX;
IERC20 public rewardToken;
mapping(uint => uint) public loyalSince;
mapping(uint => uint) public balanceOfId;
mapping(uint => uint) private _lastWeightOfTokenId;
mapping(uint => uint) private _rewardPerWeightPaid;
mapping(uint => uint) private _rewards;
mapping(address => uint) public pendingRewards;
mapping(uint => uint8) public restrictedToken;
address public teamVestingContract;
event Mint (address indexed from, address indexed to, uint indexed tokenId, uint amountMinted, uint amountIntxIn, uint totalXINTXNew, uint newTotalWeight);
event Burn (address indexed owner, uint indexed tokenId, uint amountBurned, uint amountIntxOut, uint amountIntxPenalized, uint totalXINTXNew);
event Split (address indexed owner, uint indexed tokenIdFrom, uint tokenIdTo, uint balanceSplitted);
event Merge (address indexed owner, uint indexed tokenIdFrom, uint tokenIdTo, uint newBalance, uint newLoyalSince);
event RewardAdded (uint rewardAdded);
event Claim( address indexed owner, uint amountOut, uint[] indexed tokenIds);
event StatusEvent( uint intxBalance, uint totalXINTX, uint totalWeight);
event AddToBackingRatio( uint intxAdded, uint oldExchangeRate, uint newExchangeRate);
struct PositionInfo {
uint tokenId;
address owner;
uint balanceOfId;
uint amountStakedOf;
uint withdrawableAmountOf; // In case of a Withdraw of the position, the amount of intx that the user would receive after the penalization
uint loyalSince;
uint boostPercentageOf;
uint penaltyPercentageOf;
uint penaltyAmountOf;
uint pendingReward;
uint lastWeightKnown;
}
constructor() {
_disableInitializers();
}
function initialize ( address _intx, address _usdt ) public initializer {
__ReentrancyGuard_init();
__ERC721_init( "Staked INTX", "XINTX" );
__Ownable2Step_init();
__Pausable_init();
require ( _intx != address(0), "Can't use 0x address");
require ( _usdt != address(0), "Can't use 0x address");
INTX = IERC20(_intx);
rewardToken = IERC20(_usdt);
loyaltyDuration = 16 weeks; // 16 weeks
maxLoyaltyBoost = 25 * 1e17; // 2.5x
maxPenalty = 25 * 1e16; // 25%
minPenalty = 1 * 1e16; // 1%
_pause();
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
EXTERNAL VIEW FUNCTIONS, POSITION INFO
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
function currentExchangeRate() external view returns(uint _exchangeRate) {
_exchangeRate = _exchangeRateInternal();
}
/**
* @notice Calculates the boost percentage of a position.
* @param _tokenId the tokenId of the position.
*/
function boostPercentageOf( uint _tokenId) external view returns(uint boostPercentage) {
if (_exists(_tokenId)) {
boostPercentage = _boostPercentageOf(_tokenId);
}
}
/**
* @notice Calculates the penalty percentage of a position.
* @param _tokenId the tokenId of the position.
*/
function penaltyPercentageOf( uint _tokenId) external view returns(uint penaltyPercentage) {
if (_exists(_tokenId)) {
penaltyPercentage = _penaltyPercentageOf(_tokenId);
}
}
/**
* @notice Calculates the amount of INTX staked that a position has.
* @param _tokenId the tokenId of the position.
*/
function amountStakedOf( uint _tokenId) external view returns(uint amount) {
if (_exists(_tokenId)) {
amount = _amountStakedOf(_tokenId);
}
}
/**
* @notice Calculates the amount of INTX that a position will give when unstaked (having in mind the penalty).
* @param _tokenId the tokenId of the position.
*/
function withdrawableAmountOf( uint _tokenId) external view returns(uint withdrawableAmount ) {
uint _amount = _amountStakedOf(_tokenId);
uint _penalty = _penaltyPercentageOf(_tokenId);
if (_amount > 0) {
withdrawableAmount = _amount - (_amount * _penalty / P);
}
}
/**
* @notice Calculates the amount of INTX that would be penalized from a position when unstaked.
* @param _tokenId the tokenId of the position.
*/
function penaltyAmountOf( uint _tokenId) public view returns(uint penaltyAmount ) {
uint _amount = _amountStakedOf(_tokenId);
uint _penalty = _penaltyPercentageOf(_tokenId);
if (_amount > 0) {
penaltyAmount = _amount * _penalty / P;
}
}
function getPositionInfo (uint _tokenId) external view returns (PositionInfo memory _positionInfo) {
_positionInfo = _getPositionInfo(_tokenId);
}
function getPositionsInfo (uint[] calldata _tokenId) external view returns (PositionInfo[] memory _positionInfo) {
uint len = _tokenId.length;
_positionInfo = new PositionInfo[](len);
for ( uint i; i < len; i++ ) {
_positionInfo[i] = _getPositionInfo(_tokenId[i]);
}
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
INTERNAL VIEW FUNCTIONS, POSITION INFO
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
/**
* @dev gives all the important info.
* @param _tokenId the tokenId of the position.
*/
function _getPositionInfo( uint _tokenId ) internal view returns(PositionInfo memory positionInfo) {
uint _amount = _amountStakedOf(_tokenId);
uint _penalty = _penaltyPercentageOf(_tokenId);
positionInfo.tokenId = _tokenId;
positionInfo.owner = _ownerOf(_tokenId);
positionInfo.balanceOfId = balanceOfId[_tokenId];
positionInfo.amountStakedOf= _amount;
positionInfo.withdrawableAmountOf = _amount - (_amount * _penalty / P);
positionInfo.loyalSince = loyalSince[_tokenId];
positionInfo.boostPercentageOf = _boostPercentageOf( _tokenId );
positionInfo.penaltyPercentageOf = _penalty;
positionInfo.penaltyAmountOf = (_amount * _penalty / P);
positionInfo.pendingReward = _rewards[_tokenId];
positionInfo.lastWeightKnown = _lastWeightOfTokenId[_tokenId];
}
/**
* @dev Calculates the boost percentage of a position.
* @param _tokenId the tokenId of the position.
*/
function _boostPercentageOf( uint _tokenId ) internal view returns(uint boostPercentage) {
uint _timestamp = loyalSince[_tokenId];
if ( _timestamp == 0 ) return 0;
uint _timeStaked = block.timestamp - _timestamp;
if ( _timeStaked > loyaltyDuration ) _timeStaked = loyaltyDuration;
boostPercentage = P + (( _timeStaked * P/loyaltyDuration ) * (maxLoyaltyBoost - P) / P);
}
/**
* @dev Calculates the penalty percentage of a position.
* @param _tokenId the tokenId of the position.
*/
function _penaltyPercentageOf( uint _tokenId ) internal view returns(uint penaltyPercentage) {
uint _timestamp = loyalSince[_tokenId];
if ( _timestamp == 0 ) return 0;
uint _timeStaked = block.timestamp - _timestamp;
if ( _timeStaked > loyaltyDuration ) _timeStaked = loyaltyDuration;
penaltyPercentage = maxPenalty - ( ( _timeStaked * P/loyaltyDuration ) * maxPenalty / P);
if ( penaltyPercentage < minPenalty) penaltyPercentage = minPenalty;
}
/**
* @dev Calculates the amount of INTX staked that a position has.
* @param _tokenId the tokenId of the position.
*/
function _amountStakedOf( uint _tokenId) internal view returns(uint amount) {
uint _balance = balanceOfId[_tokenId];
uint _exchangeRate = _exchangeRateInternal();
amount = _balance * _exchangeRate / P;
}
/**
* @dev Gets balance of INTX of this contract.
*/
function _getCurrentIntxBalance() internal view returns (uint) {
return INTX.balanceOf(address(this));
}
/**
* @dev Calculates the exchange rate from INTX to xINTX.
*/
function _exchangeRateInternal() internal view virtual returns (uint) {
if (totalXINTX == 0) {
// This is the first time to mint, so current exchange rate is equal to initial exchange rate.
return initialExchangeRate;
} else {
// exchangeRate = (intxBalance / total
return _getCurrentIntxBalance() * P / totalXINTX;
}
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
EXTERNAL FUNCTIONS, INTERACTION POSITIONS
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
function stake(uint _intxAmount) external returns(uint _tokenId) {
_tokenId = _stake( _msgSender(), _msgSender(), _intxAmount );
emitStatus();
}
function stakeFor(address _to, uint _intxAmount) external returns (uint _tokenId) {
_tokenId = _stake( _msgSender(), _to, _intxAmount );
if( _msgSender() == teamVestingContract) {
restrictedToken[_tokenId] = 1;
}
emitStatus();
}
function unstake(uint _tokenId) external returns(uint _intxAmountOut) {
require( !isRestrictedToken(_tokenId), "This token is restricted, you can't unstake/transfer/split");
_intxAmountOut = _unstake( _tokenId );
emitStatus();
}
function split(uint _tokenId, uint[] calldata _splitWeights) external returns ( uint[] memory _tokenIds) {
require( !isRestrictedToken(_tokenId), "This token is restricted, you can't unstake/transfer/split");
_tokenIds = _split( _tokenId, _splitWeights);
emitStatus();
}
function merge(uint _tokenFrom, uint tokenTo) external {
require( restrictedToken[_tokenFrom] == restrictedToken[tokenTo], "You can't merge tokens with different types.");
_merge(_tokenFrom, tokenTo);
emitStatus();
}
function add(uint _intxAmount, uint tokenTo) external {
require( !isRestrictedToken(tokenTo), "This token is restricted, you can't add intx to it, create a new position instead.");
uint _tokenFrom = _stake( _msgSender(), _msgSender(), _intxAmount );
_merge(_tokenFrom, tokenTo);
emitStatus();
}
function unstakePartially(uint _tokenId, uint _xIntxAmountWithdraw) external returns(uint _intxAmountOut, uint _newTokenId) {
require( !isRestrictedToken(_tokenId), "This token is restricted, you can't unstake/transfer/split");
uint _balance = balanceOfId[_tokenId];
require(_balance > _xIntxAmountWithdraw, "You can't partially withdraw more than you own");
uint[] memory _splitWeights = new uint[](2);
_splitWeights[0] = _xIntxAmountWithdraw;
_splitWeights[1] = _balance - _xIntxAmountWithdraw;
uint[] memory _tokenIds = _split( _tokenId, _splitWeights);
_intxAmountOut = _unstake( _tokenIds[0] );
_newTokenId = _tokenIds[1];
emitStatus();
}
function addToBackingRatio( uint _intxAmount ) external {
_updateReward(0);
uint _oldExchangeRate = _exchangeRateInternal();
INTX.safeTransferFrom( _msgSender(), address(this), _intxAmount);
emit AddToBackingRatio( _intxAmount, _oldExchangeRate, _exchangeRateInternal());
emitStatus();
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
INTERNAL FUNCTIONS, INTERACTION POSITIONS
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
function _stake(address _from, address _to, uint _intxAmount) internal nonReentrant returns (uint _tokenId) {
require(_intxAmount > 0, "Can't stake 0 intX." );
uint _exchangeRate = _exchangeRateInternal();
INTX.safeTransferFrom( _from, address(this), _intxAmount);
lastTokenId++;
_mint(_to, lastTokenId);
_updateReward(lastTokenId);
uint _tokenMinted = _intxAmount * P / _exchangeRate;
loyalSince[lastTokenId] = block.timestamp;
balanceOfId[lastTokenId] = _tokenMinted;
totalXINTX += _tokenMinted;
totalWeight += _tokenMinted;
_lastWeightOfTokenId[lastTokenId] = _tokenMinted;
emit Mint (_from, _to, lastTokenId, _tokenMinted, _intxAmount, totalXINTX, totalWeight);
return lastTokenId;
}
function _unstake( uint _tokenId ) internal nonReentrant whenNotPaused returns( uint _intxAmountOut) {
require(_exists(_tokenId), "This position doesn't exist.");
address _owner = _ownerOf(_tokenId);
require(_owner == _msgSender(), "Not your xINTX NFT.");
_updateReward(_tokenId);
uint _amount = balanceOfId[_tokenId];
uint _weight = _amount * _boostPercentageOf(_tokenId) / P;
uint _exchangeRate = _exchangeRateInternal();
uint _intxAmount = (_amount * _exchangeRate) / P;
uint _intxAmountPenalization = (_intxAmount * _penaltyPercentageOf(_tokenId)) / P;
_intxAmountOut = (_intxAmount - _intxAmountPenalization);
if ( _rewards[_tokenId] > 0 ) {
pendingRewards[_owner] += _rewards[_tokenId];
}
delete loyalSince[_tokenId];
delete balanceOfId[_tokenId];
delete _lastWeightOfTokenId[_tokenId];
delete _rewardPerWeightPaid[_tokenId];
delete _rewards[_tokenId];
_burn( _tokenId );
totalXINTX -= _amount;
totalWeight -= _weight;
INTX.safeTransfer( _owner, _intxAmountOut);
emit Burn (_owner, _tokenId, _amount, _intxAmountOut, _intxAmountPenalization, totalXINTX);
}
function _split( uint _tokenId, uint[] memory _splitWeights ) internal nonReentrant returns( uint[] memory _tokenIds ) {
require(_exists(_tokenId), "This position doesn't exist.");
address _owner = _ownerOf(_tokenId);
require(_owner == _msgSender(), "Not your xINTX NFT.");
uint len = _splitWeights.length;
require(len > 1, "You can't split this XINTX less than 2 times");
require(len <= 10, "You can't split this XINTX more than 10 times");
_tokenIds = new uint[](len);
_updateReward(_tokenId);
uint _totalWeightSplit = 0;
uint _originalBalance = balanceOfId[_tokenId];
uint _originalLoyal = loyalSince[_tokenId];
uint _originalRewardPerWeightPaid = _rewardPerWeightPaid[_tokenId];
totalXINTX -= _originalBalance;
totalWeight -= _lastWeightOfTokenId[_tokenId];
for (uint i; i < len; i++) {
_totalWeightSplit += _splitWeights[i];
}
for (uint i; i < len; i++) {
uint splitAmount = (_splitWeights[i] * _originalBalance) / _totalWeightSplit;
require(splitAmount > 0, "Can't split 0 xINTX." );
lastTokenId++;
_mint(_owner, lastTokenId);
_tokenIds[i] = lastTokenId;
loyalSince[lastTokenId] = _originalLoyal;
balanceOfId[lastTokenId] = splitAmount;
uint _lastWeight = splitAmount * _boostPercentageOf(lastTokenId) / P;
_lastWeightOfTokenId[lastTokenId] = _lastWeight;
_rewardPerWeightPaid[lastTokenId] = _originalRewardPerWeightPaid;
totalXINTX += splitAmount;
totalWeight += _lastWeight;
emit Split(_owner, _tokenId, lastTokenId, splitAmount);
}
if ( _rewards[_tokenId] > 0 ) {
pendingRewards[_owner] += _rewards[_tokenId];
}
delete loyalSince[_tokenId];
delete balanceOfId[_tokenId];
delete _lastWeightOfTokenId[_tokenId];
delete _rewardPerWeightPaid[_tokenId];
delete _rewards[_tokenId];
_burn( _tokenId );
}
function _merge( uint _tokenFrom, uint _tokenTo ) internal nonReentrant {
require(_exists(_tokenFrom), "This position doesn't exist.");
require(_exists(_tokenTo), "This position doesn't exist.");
address _owner = _ownerOf(_tokenFrom);
require(_owner == _msgSender(), "From NFT isn't your xINTX NFT.");
require(_owner == _ownerOf(_tokenTo), "To NFT isn't xINTX NFT.");
_updateReward(_tokenFrom);
_updateReward(_tokenTo);
uint _balanceFrom = balanceOfId[_tokenFrom];
uint _loyalFrom = block.timestamp - loyalSince[_tokenFrom];
if ( _loyalFrom > loyaltyDuration ) _loyalFrom = loyaltyDuration;
uint _balanceTo = balanceOfId[_tokenTo];
uint _loyalTo = block.timestamp - loyalSince[_tokenTo];
if ( _loyalTo > loyaltyDuration ) _loyalTo = loyaltyDuration;
uint _balanceNew = _balanceFrom + _balanceTo;
require(_balanceNew > 0, "Can't make a position with 0 xINTX." );
uint _loyalNew = (_loyalFrom * _balanceFrom / _balanceNew) + (_loyalTo * _balanceTo / _balanceNew);
balanceOfId[_tokenTo] = _balanceNew;
loyalSince[_tokenTo] = block.timestamp - _loyalNew;
uint _newWeight = _balanceNew * _boostPercentageOf(_tokenTo) / P;
_lastWeightOfTokenId[_tokenTo] = _newWeight;
if ( _rewards[_tokenFrom] > 0 ) {
pendingRewards[_owner] += _rewards[_tokenFrom];
}
delete loyalSince[_tokenFrom];
delete balanceOfId[_tokenFrom];
delete _lastWeightOfTokenId[_tokenFrom];
delete _rewardPerWeightPaid[_tokenFrom];
delete _rewards[_tokenFrom];
_burn( _tokenFrom );
emit Merge (_owner, _tokenFrom, _tokenTo, _balanceNew, block.timestamp - _loyalNew);
}
function emitStatus() internal {
emit StatusEvent( _getCurrentIntxBalance(), totalXINTX, totalWeight);
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
REWARDS CALCULATION
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
/**
* @dev Receives reward in USDC and makes calculations for the distribution
* @param _rewardAmount the amount of USDC that will be distributed
*/
function notifyReward( uint _rewardAmount ) external nonReentrant onlyOwner{
_updateReward(0);
rewardToken.safeTransferFrom( _msgSender(), address(this), _rewardAmount);
if (block.timestamp >= periodFinish) {
rewardRate = _rewardAmount / DURATION;
} else {
uint remaining = periodFinish - block.timestamp;
uint leftover = remaining * rewardRate;
rewardRate = (_rewardAmount + leftover) / DURATION;
}
// Ensure the provided reward amount is not more than the balance in the contract.
// This keeps the reward rate in the right range, preventing overflows due to
// very high values of rewardRate in the earned and rewardsPerToken functions;
// Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.
uint balance = rewardToken.balanceOf(address(this));
require(rewardRate <= balance / DURATION, "Provided reward too high");
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp + DURATION;
emit RewardAdded(_rewardAmount);
emitStatus();
}
///@dev last time reward
function lastTimeRewardApplicable() public view returns (uint) {
return Math.min(block.timestamp, periodFinish);
}
function _updateReward(uint _tokenId) private {
rewardPerWeightStored = rewardPerWeight();
lastUpdateTime = lastTimeRewardApplicable();
if (_tokenId != 0) {
_rewards[_tokenId] = earned(_tokenId);
uint _newWeight = balanceOfId[_tokenId] * _boostPercentageOf(_tokenId) / P;
totalWeight = (totalWeight - _lastWeightOfTokenId[_tokenId]) + _newWeight;
_lastWeightOfTokenId[_tokenId] = _newWeight;
_rewardPerWeightPaid[_tokenId] = rewardPerWeightStored;
}
}
///@notice reward for a single weight
function rewardPerWeight() public view returns (uint) {
if (totalWeight == 0) {
return rewardPerWeightStored;
} else {
require(totalWeight > 0, "Incorrect weight");
//time past without reward
uint _timeDiff = lastTimeRewardApplicable() - lastUpdateTime;
return rewardPerWeightStored + ( _timeDiff * rewardRate * 1e36 / totalWeight );
}
}
///@notice earned rewards for nft
function earned(uint _tokenId) public view returns (uint) {
uint _lastWeight = _lastWeightOfTokenId[_tokenId];
return
((_lastWeight * (rewardPerWeight() - _rewardPerWeightPaid[_tokenId]) ) / 1e36) +
_rewards[_tokenId];
}
///@notice total earned rewards
function earned(uint[] calldata _tokenIds) public view returns (uint totalReward, uint[] memory claimableAmounts) {
uint len = _tokenIds.length;
claimableAmounts = new uint[](len);
for ( uint i = 0; i<len; i++ ) {
uint _claimable = earned(_tokenIds[i]);
totalReward += _claimable;
claimableAmounts[i] = _claimable;
}
}
function claim(uint[] calldata _tokenIds) external {
uint len = _tokenIds.length;
uint _tokenId;
address _owner;
uint _amountOut = pendingRewards[_msgSender()];
for (uint i; i < len; i++ ) {
_tokenId = _tokenIds[i];
require(_exists(_tokenId), "This position doesn't exist.");
_owner = _ownerOf(_tokenId);
require(_owner == _msgSender(), "You are not the owner of this position.");
_updateReward(_tokenId);
_amountOut += _rewards[_tokenId];
_rewards[_tokenId] = 0;
}
pendingRewards[_msgSender()] = 0;
rewardToken.safeTransfer( _msgSender(), _amountOut);
emit Claim( _owner, _amountOut, _tokenIds);
emitStatus();
}
function updateWeights( uint[] calldata _tokenIds ) external {
uint len = _tokenIds.length;
for ( uint i; i < len; i++ ) {
_updateReward(_tokenIds[i]);
}
emitStatus();
}
function isRestrictedToken( uint _tokenId ) public view returns (bool isRestricted) {
isRestricted = false;
if (restrictedToken[_tokenId] == 1) {
if ( block.timestamp < 1716976800 + (60*60*24*365) ) { // 1 year after vesting unlock
isRestricted = true;
}
}
}
function setTeamVestingContract (address _teamVestingContract) external onlyOwner {
//require ( teamVestingContract == address(0), "Team vesting contract is already initialized." );
teamVestingContract = _teamVestingContract;
}
//this function, and pause and unpause functions are only used to avoid people having liquid intx before we provide liquidity.
function unpause() onlyOwner whenPaused external {
_unpause();
}
function renounceOwnership() public override onlyOwner {}
function _transfer(address from, address to, uint256 tokenId) whenNotPaused internal override {
require( !isRestrictedToken(tokenId), "This token is restricted, you can't unstake/transfer/merge/split");
super._transfer(from, to, tokenId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./OwnableUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides 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} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
function __Ownable2Step_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable2Step_init_unchained() internal onlyInitializing {
}
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ReentrancyGuardUpgradeable is Initializable {
// 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;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_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;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
using AddressUpgradeable for address;
using StringsUpgradeable for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC721_init_unchained(name_, symbol_);
}
function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
return
interfaceId == type(IERC721Upgradeable).interfaceId ||
interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: address zero is not a valid owner");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _ownerOf(tokenId);
require(owner != address(0), "ERC721: invalid token ID");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
_requireMinted(tokenId);
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721Upgradeable.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not token owner or approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
_safeTransfer(from, to, tokenId, data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
*/
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _ownerOf(tokenId) != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
address owner = ERC721Upgradeable.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId, 1);
// Check that tokenId was not minted by `_beforeTokenTransfer` hook
require(!_exists(tokenId), "ERC721: token already minted");
unchecked {
// Will not overflow unless all 2**256 token ids are minted to the same owner.
// Given that tokens are minted one by one, it is impossible in practice that
// this ever happens. Might change if we allow batch minting.
// The ERC fails to describe this case.
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId, 1);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
* This is an internal function that does not check if the sender is authorized to operate on the token.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721Upgradeable.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
// Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
owner = ERC721Upgradeable.ownerOf(tokenId);
// Clear approvals
delete _tokenApprovals[tokenId];
unchecked {
// Cannot overflow, as that would require more tokens to be burned/transferred
// out than the owner initially received through minting and transferring in.
_balances[owner] -= 1;
}
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId, 1);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId, 1);
// Check that tokenId was not transferred by `_beforeTokenTransfer` hook
require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
// Clear approvals from the previous owner
delete _tokenApprovals[tokenId];
unchecked {
// `_balances[from]` cannot overflow for the same reason as described in `_burn`:
// `from`'s balance is the number of token held, which is at least one before the current
// transfer.
// `_balances[to]` could overflow in the conditions described in `_mint`. That would require
// all 2**256 token ids to be minted, which in practice is impossible.
_balances[from] -= 1;
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory data
) private returns (bool) {
if (to.isContract()) {
try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
* - When `from` is zero, the tokens will be minted for `to`.
* - When `to` is zero, ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
* - When `from` is zero, the tokens were minted for `to`.
* - When `to` is zero, ``from``'s tokens were burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}
/**
* @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
*
* WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
* being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
* that `ownerOf(tokenId)` is `a`.
*/
// solhint-disable-next-line func-name-mixedcase
function __unsafe_increaseBalance(address account, uint256 amount) internal {
_balances[account] += amount;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[44] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (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 IERC721ReceiverUpgradeable {
/**
* @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/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @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.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
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;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// 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 IERC165Upgradeable {
/**
* @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/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// 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.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);
}
}
}{
"optimizer": {
"enabled": true,
"runs": 2048
},
"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":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"intxAdded","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldExchangeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newExchangeRate","type":"uint256"}],"name":"AddToBackingRatio","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountIntxOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountIntxPenalized","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalXINTXNew","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":true,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenIdFrom","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenIdTo","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLoyalSince","type":"uint256"}],"name":"Merge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountMinted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountIntxIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalXINTXNew","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalWeight","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardAdded","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenIdFrom","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenIdTo","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"balanceSplitted","type":"uint256"}],"name":"Split","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"intxBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalXINTX","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWeight","type":"uint256"}],"name":"StatusEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INTX","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"P","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_intxAmount","type":"uint256"},{"internalType":"uint256","name":"tokenTo","type":"uint256"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_intxAmount","type":"uint256"}],"name":"addToBackingRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"amountStakedOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"balanceOfId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"boostPercentageOf","outputs":[{"internalType":"uint256","name":"boostPercentage","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentExchangeRate","outputs":[{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"earned","outputs":[{"internalType":"uint256","name":"totalReward","type":"uint256"},{"internalType":"uint256[]","name":"claimableAmounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getPositionInfo","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"balanceOfId","type":"uint256"},{"internalType":"uint256","name":"amountStakedOf","type":"uint256"},{"internalType":"uint256","name":"withdrawableAmountOf","type":"uint256"},{"internalType":"uint256","name":"loyalSince","type":"uint256"},{"internalType":"uint256","name":"boostPercentageOf","type":"uint256"},{"internalType":"uint256","name":"penaltyPercentageOf","type":"uint256"},{"internalType":"uint256","name":"penaltyAmountOf","type":"uint256"},{"internalType":"uint256","name":"pendingReward","type":"uint256"},{"internalType":"uint256","name":"lastWeightKnown","type":"uint256"}],"internalType":"struct StakedINTX.PositionInfo","name":"_positionInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenId","type":"uint256[]"}],"name":"getPositionsInfo","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"balanceOfId","type":"uint256"},{"internalType":"uint256","name":"amountStakedOf","type":"uint256"},{"internalType":"uint256","name":"withdrawableAmountOf","type":"uint256"},{"internalType":"uint256","name":"loyalSince","type":"uint256"},{"internalType":"uint256","name":"boostPercentageOf","type":"uint256"},{"internalType":"uint256","name":"penaltyPercentageOf","type":"uint256"},{"internalType":"uint256","name":"penaltyAmountOf","type":"uint256"},{"internalType":"uint256","name":"pendingReward","type":"uint256"},{"internalType":"uint256","name":"lastWeightKnown","type":"uint256"}],"internalType":"struct StakedINTX.PositionInfo[]","name":"_positionInfo","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_intx","type":"address"},{"internalType":"address","name":"_usdt","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isRestrictedToken","outputs":[{"internalType":"bool","name":"isRestricted","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"loyalSince","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"loyaltyDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLoyaltyBoost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPenalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenFrom","type":"uint256"},{"internalType":"uint256","name":"tokenTo","type":"uint256"}],"name":"merge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minPenalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardAmount","type":"uint256"}],"name":"notifyReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"penaltyAmountOf","outputs":[{"internalType":"uint256","name":"penaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"penaltyPercentageOf","outputs":[{"internalType":"uint256","name":"penaltyPercentage","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"restrictedToken","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerWeightStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_teamVestingContract","type":"address"}],"name":"setTeamVestingContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256[]","name":"_splitWeights","type":"uint256[]"}],"name":"split","outputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_intxAmount","type":"uint256"}],"name":"stake","outputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_intxAmount","type":"uint256"}],"name":"stakeFor","outputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamVestingContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalXINTX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"unstake","outputs":[{"internalType":"uint256","name":"_intxAmountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_xIntxAmountWithdraw","type":"uint256"}],"name":"unstakePartially","outputs":[{"internalType":"uint256","name":"_intxAmountOut","type":"uint256"},{"internalType":"uint256","name":"_newTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"updateWeights","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawableAmountOf","outputs":[{"internalType":"uint256","name":"withdrawableAmount","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61509780620000f36000396000f3fe608060405234801561001057600080fd5b50600436106104065760003560e01c806379ba50971161021a578063c205f34111610135578063e30c3978116100c8578063f290dfa711610097578063f3058d4e1161007c578063f3058d4e146108fa578063f7c618c11461090d578063f84ddf0b1461092157600080fd5b8063f290dfa7146108bf578063f2fde38b146108e757600080fd5b8063e30c397814610854578063e985e9c514610865578063ebe2b12b146108a1578063ef7297de146108ab57600080fd5b8063d1a249ab11610104578063d1a249ab14610810578063d1c2babb1461081a578063d975dfed1461082d578063df2e0b971461084057600080fd5b8063c205f341146107bf578063c87b56dd146107d2578063c8f33c91146107e5578063cfd0e125146107ef57600080fd5b8063988dc31e116101ad578063a345280a1161017c578063a345280a1461077e578063a368497714610791578063a694fc3a14610799578063b88d4fde146107ac57600080fd5b8063988dc31e14610724578063a00ea0c514610737578063a1c95e5a1461074a578063a22cb4651461076b57600080fd5b80638da5cb5b116101e95780638da5cb5b146106e15780638fca5a59146106f257806395d89b411461071257806396c82e571461071a57600080fd5b806379ba5097146106b85780637b0a47ee146106c057806380faa57d146106ca5780638b8fbd92146106d257600080fd5b806342842e0e116103255780635c975abb116102b857806369c672471161028757806370a082311161026c57806370a082311461068a578063715018a61461069d578063771602f7146106a557600080fd5b806369c67247146106575780636ba4c1381461067757600080fd5b80635c975abb1461061257806360993b5b1461061e5780636352211e14610631578063645bfd9a1461064457600080fd5b8063519f5099116102f4578063519f5099146105cb5780635200e79e146105eb578063520bf08a146105f55780635a48a97f146105ff57600080fd5b806342842e0e14610571578063485cc955146105845780634d62f590146105975780634d6ed8c4146105b857600080fd5b806323b872dd1161039d57806330f916191161036c57806330f916191461052b57806331d7a2621461053e5780633228dd591461055f5780633f4ba83a1461056957600080fd5b806323b872dd146104ea5780632ac3f450146104fd5780632e17de78146105055780632ee409081461051857600080fd5b8063095ea7b3116103d9578063095ea7b3146104a95780630eba9849146104be5780631be05289146104d65780632212b806146104e057600080fd5b806301ffc9a71461040b57806306fdde0314610433578063081812fc1461044857806308d9788d14610473575b600080fd5b61041e610419366004614881565b61092b565b60405190151581526020015b60405180910390f35b61043b610a10565b60405161042a91906148ee565b61045b610456366004614901565b610aa2565b6040516001600160a01b03909116815260200161042a565b610497610481366004614901565b6101726020526000908152604090205460ff1681565b60405160ff909116815260200161042a565b6104bc6104b7366004614931565b610ac9565b005b6104c86101645481565b60405190815260200161042a565b6104c862093a8081565b6104c86101625481565b6104bc6104f836600461495b565b610bff565b6104c8610c86565b6104c8610513366004614901565b610d52565b6104c8610526366004614931565b610de8565b6104bc6105393660046149e3565b610e2e565b6104c861054c366004614a25565b6101716020526000908152604090205481565b6104c86101685481565b6104bc610e76565b6104bc61057f36600461495b565b610e90565b6104bc610592366004614a40565b610eab565b6105aa6105a53660046149e3565b611171565b60405161042a929190614aae565b6104c86105c6366004614901565b611231565b6105de6105d9366004614901565b6112a2565b60405161042a9190614b4a565b6104c86101635481565b6104c86101605481565b6104c861060d366004614901565b611311565b61012d5460ff1661041e565b6104bc61062c366004614901565b611359565b61045b61063f366004614901565b61153a565b6104c8610652366004614901565b61159f565b61066a610665366004614b59565b6115c5565b60405161042a9190614ba5565b6104bc6106853660046149e3565b61168a565b6104c8610698366004614a25565b61189f565b6104bc611939565b6104bc6106b3366004614bb8565b611941565b6104bc611a04565b6104c86101675481565b6104c8611a8f565b6104c8670de0b6b3a764000081565b60c9546001600160a01b031661045b565b6107056107003660046149e3565b611aa3565b60405161042a9190614bda565b61043b611bbd565b6104c86101695481565b6104c8610732366004614901565b611bcc565b6104c8610745366004614901565b611bf2565b6104c8610758366004614901565b61016d6020526000908152604090205481565b6104bc610779366004614c37565b611c18565b61041e61078c366004614901565b611c27565b6104c8611c55565b6104c86107a7366004614901565b611c5f565b6104bc6107ba366004614c84565b611c6c565b6104bc6107cd366004614a25565b611cfa565b61043b6107e0366004614901565b611d32565b6104c86101655481565b6104c86107fd366004614901565b61016c6020526000908152604090205481565b6104c86101615481565b6104bc610828366004614bb8565b611da5565b6104c861083b366004614901565b611e48565b61016a5461045b906001600160a01b031681565b60fb546001600160a01b031661045b565b61041e610873366004614a40565b6001600160a01b039182166000908152609c6020908152604080832093909416825291909152205460ff1690565b6104c86101665481565b6101735461045b906001600160a01b031681565b6108d26108cd366004614bb8565b611e90565b6040805192835260208301919091520161042a565b6104bc6108f5366004614a25565b61205f565b6104bc610908366004614901565b6120dd565b61016b5461045b906001600160a01b031681565b6104c861015f5481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806109be57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610a0a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b606060978054610a1f90614d60565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4b90614d60565b8015610a985780601f10610a6d57610100808354040283529160200191610a98565b820191906000526020600020905b815481529060010190602001808311610a7b57829003601f168201915b5050505050905090565b6000610aad8261215d565b506000908152609b60205260409020546001600160a01b031690565b6000610ad48261153a565b9050806001600160a01b0316836001600160a01b031603610b625760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610b7e5750610b7e8133610873565b610bf05760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610b59565b610bfa83836121c1565b505050565b610c09338261223c565b610c7b5760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610b59565b610bfa8383836122bb565b600061016954600003610c9b57506101685490565b60006101695411610cee5760405162461bcd60e51b815260206004820152601060248201527f496e636f727265637420776569676874000000000000000000000000000000006044820152606401610b59565b600061016554610cfc611a8f565b610d069190614db0565b9050610169546101675482610d1b9190614dc3565b610d34906ec097ce7bc90715b34b9f1000000000614dc3565b610d3e9190614dda565b61016854610d4c9190614dfc565b91505090565b6000610d5d82611c27565b15610dd05760405162461bcd60e51b815260206004820152603a60248201527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e277420756e7374616b652f7472616e736665722f73706c69740000000000006064820152608401610b59565b610dd98261234c565b9050610de361261b565b919050565b6000610df533848461266d565b610173549091506001600160a01b03163303610e2657600081815261017260205260409020805460ff191660011790555b610a0a61261b565b8060005b81811015610e6d57610e5b848483818110610e4f57610e4f614e0f565b90506020020135612826565b80610e6581614e25565b915050610e32565b50610bfa61261b565b610e7e6128ec565b610e86612946565b610e8e612999565b565b610bfa83838360405180602001604052806000815250611c6c565b600054610100900460ff1615808015610ecb5750600054600160ff909116105b80610ee55750303b158015610ee5575060005460ff166001145b610f575760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610b59565b6000805460ff191660011790558015610f7a576000805461ff0019166101001790555b610f826129e7565b610ff66040518060400160405280600b81526020017f5374616b656420494e54580000000000000000000000000000000000000000008152506040518060400160405280600581526020017f58494e5458000000000000000000000000000000000000000000000000000000815250612a5a565b610ffe612acf565b611006612b42565b6001600160a01b03831661105c5760405162461bcd60e51b815260206004820152601460248201527f43616e27742075736520307820616464726573730000000000000000000000006044820152606401610b59565b6001600160a01b0382166110b25760405162461bcd60e51b815260206004820152601460248201527f43616e27742075736520307820616464726573730000000000000000000000006044820152606401610b59565b61016a80546001600160a01b0380861673ffffffffffffffffffffffffffffffffffffffff199283161790925561016b8054928516929091169190911790556293a800610161556722b1c8c1227a0000610162556703782dace9d9000061016355662386f26fc1000061016455611127612bb5565b8015610bfa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b60006060828067ffffffffffffffff81111561118f5761118f614c6e565b6040519080825280602002602001820160405280156111b8578160200160208202803683370190505b50915060005b818110156112285760006111e98787848181106111dd576111dd614e0f565b90506020020135611231565b90506111f58186614dfc565b94508084838151811061120a5761120a614e0f565b6020908102919091010152508061122081614e25565b9150506111be565b50509250929050565b600081815261016e602090815260408083205461017083528184205461016f909352908320549091906ec097ce7bc90715b34b9f100000000090611273610c86565b61127d9190614db0565b6112879084614dc3565b6112919190614dda565b61129b9190614dfc565b9392505050565b6113086040518061016001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610a0a82612bf3565b60008061131d83612d58565b9050600061132a84612d86565b9050811561135257670de0b6b3a76400006113458284614dc3565b61134f9190614dda565b92505b5050919050565b611361612e2f565b6113696128ec565b6113736000612826565b61138c3361016b546001600160a01b0316903084612e88565b6101665442106113ac576113a362093a8082614dda565b610167556113f1565b600042610166546113bd9190614db0565b9050600061016754826113d09190614dc3565b905062093a806113e08285614dfc565b6113ea9190614dda565b6101675550505b61016b546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114789190614e3f565b905061148762093a8082614dda565b6101675411156114d95760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152606401610b59565b426101658190556114ee9062093a8090614dfc565b610166556040518281527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a161152d61261b565b5061153760018055565b50565b6000818152609960205260408120546001600160a01b031680610a0a5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610b59565b6000818152609960205260408120546001600160a01b031615610de357610a0a82612f3f565b60606115d084611c27565b156116435760405162461bcd60e51b815260206004820152603a60248201527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e277420756e7374616b652f7472616e736665722f73706c69740000000000006064820152608401610b59565b61168084848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612fdc92505050565b905061129b61261b565b33600090815261017160205260408120548291908190815b84811015611808578686828181106116bc576116bc614e0f565b9050602002013593506116e6846000908152609960205260409020546001600160a01b0316151590565b6117325760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000848152609960205260409020546001600160a01b031692503383146117c15760405162461bcd60e51b815260206004820152602760248201527f596f7520617265206e6f7420746865206f776e6572206f66207468697320706f60448201527f736974696f6e2e000000000000000000000000000000000000000000000000006064820152608401610b59565b6117ca84612826565b600084815261017060205260409020546117e49083614dfc565b6000858152610170602052604081205591508061180081614e25565b9150506116a2565b50336000818152610171602052604081205561016b54611834916001600160a01b039091169083613530565b8585604051611844929190614e58565b6040518091039020826001600160a01b03167f916f43dce61aa4c4d8761c25ddcacfe178ea96a18f68d2775354bbc06be75aaa8360405161188791815260200190565b60405180910390a361189761261b565b505050505050565b60006001600160a01b03821661191d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610b59565b506001600160a01b03166000908152609a602052604090205490565b610e8e6128ec565b61194a81611c27565b156119e35760405162461bcd60e51b815260206004820152605260248201527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e27742061646420696e747820746f2069742c206372656174652061206e657760648201527f20706f736974696f6e20696e73746561642e0000000000000000000000000000608482015260a401610b59565b60006119f033338561266d565b90506119fc8183613579565b610bfa61261b565b60fb5433906001600160a01b03168114611a865760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152608401610b59565b611537816139ca565b6000611a9e42610166546139f0565b905090565b6060818067ffffffffffffffff811115611abf57611abf614c6e565b604051908082528060200260200182016040528015611b5657816020015b611b436040518061016001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b815260200190600190039081611add5790505b50915060005b81811015611bb557611b85858583818110611b7957611b79614e0f565b90506020020135612bf3565b838281518110611b9757611b97614e0f565b60200260200101819052508080611bad90614e25565b915050611b5c565b505092915050565b606060988054610a1f90614d60565b6000818152609960205260408120546001600160a01b031615610de357610a0a82612d86565b6000818152609960205260408120546001600160a01b031615610de357610a0a82612d58565b611c23338383613a06565b5050565b6000818152610172602052604081205460ff16600103610de3576368383020421015610de357506001919050565b6000611a9e613ad4565b6000610dd933338461266d565b611c76338361223c565b611ce85760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610b59565b611cf484848484613b17565b50505050565b611d026128ec565b610173805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6060611d3d8261215d565b6000611d5460408051602081019091526000815290565b90506000815111611d74576040518060200160405280600081525061129b565b80611d7e84613ba0565b604051602001611d8f929190614e9a565b6040516020818303038152906040529392505050565b600081815261017260205260408082205484835291205460ff908116911614611e365760405162461bcd60e51b815260206004820152602c60248201527f596f752063616e2774206d6572676520746f6b656e732077697468206469666660448201527f6572656e742074797065732e00000000000000000000000000000000000000006064820152608401610b59565b611e408282613579565b611c2361261b565b600080611e5483612d58565b90506000611e6184612d86565b9050811561135257670de0b6b3a7640000611e7c8284614dc3565b611e869190614dda565b61134f9083614db0565b600080611e9c84611c27565b15611f0f5760405162461bcd60e51b815260206004820152603a60248201527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e277420756e7374616b652f7472616e736665722f73706c69740000000000006064820152608401610b59565b600084815261016d6020526040902054838111611f945760405162461bcd60e51b815260206004820152602e60248201527f596f752063616e2774207061727469616c6c79207769746864726177206d6f7260448201527f65207468616e20796f75206f776e0000000000000000000000000000000000006064820152608401610b59565b6040805160028082526060820183526000926020830190803683370190505090508481600081518110611fc957611fc9614e0f565b6020908102919091010152611fde8583614db0565b81600181518110611ff157611ff1614e0f565b60200260200101818152505060006120098783612fdc565b905061202e8160008151811061202157612021614e0f565b602002602001015161234c565b94508060018151811061204357612043614e0f565b6020026020010151935061205561261b565b5050509250929050565b6120676128ec565b60fb80546001600160a01b03831673ffffffffffffffffffffffffffffffffffffffff1990911681179091556120a560c9546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6120e76000612826565b60006120f1613ad4565b905061210c3361016a546001600160a01b0316903085612e88565b7fd6f85071f759d68953f2d6e2c919755921656cd303fba98e49af3074585bd7518282612137613ad4565b6040805193845260208401929092529082015260600160405180910390a1611c2361261b565b6000818152609960205260409020546001600160a01b03166115375760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610b59565b6000818152609b60205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915581906122038261153a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806122488361153a565b9050806001600160a01b0316846001600160a01b0316148061228f57506001600160a01b038082166000908152609c602090815260408083209388168352929052205460ff165b806122b35750836001600160a01b03166122a884610aa2565b6001600160a01b0316145b949350505050565b6122c3613c40565b6122cc81611c27565b15612341576040805162461bcd60e51b81526020600482015260248101919091527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e277420756e7374616b652f7472616e736665722f6d657267652f73706c69746064820152608401610b59565b610bfa838383613c94565b6000612356612e2f565b61235e613c40565b6000828152609960205260409020546001600160a01b03166123c25760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000828152609960205260409020546001600160a01b03163381146124295760405162461bcd60e51b815260206004820152601360248201527f4e6f7420796f75722078494e5458204e46542e000000000000000000000000006044820152606401610b59565b61243283612826565b600083815261016d602052604081205490670de0b6b3a764000061245586612f3f565b61245f9084614dc3565b6124699190614dda565b90506000612475613ad4565b90506000670de0b6b3a764000061248c8386614dc3565b6124969190614dda565b90506000670de0b6b3a76400006124ac89612d86565b6124b69084614dc3565b6124c09190614dda565b90506124cc8183614db0565b600089815261017060205260409020549097501561252257600088815261017060209081526040808320546001600160a01b038a168452610171909252822080549192909161251c908490614dfc565b90915550505b600088815261016c6020908152604080832083905561016d825280832083905561016e825280832083905561016f825280832083905561017090915281205561256a88613eca565b84610160600082825461257d9190614db0565b925050819055508361016960008282546125979190614db0565b909155505061016a546125b4906001600160a01b03168789613530565b6101605460408051878152602081018a905280820184905260608101929092525189916001600160a01b038916917f44bd20a79e993bdcc7cbedf54a3b4d19fb78490124b6b90d04fe3242eea579e89181900360800190a3505050505050610de360018055565b7f107ded4700c40c119c1250039eb39b50e8a49f47e8de2028d5efe1d7bc5b4ebd612644613f6c565b6101605461016954604080519384526020840192909252908201526060015b60405180910390a1565b6000612677612e2f565b600082116126c75760405162461bcd60e51b815260206004820152601360248201527f43616e2774207374616b65203020696e74582e000000000000000000000000006044820152606401610b59565b60006126d1613ad4565b61016a549091506126ed906001600160a01b0316863086612e88565b61015f80549060006126fe83614e25565b91905055506127108461015f54613ff3565b61271c61015f54612826565b600081612731670de0b6b3a764000086614dc3565b61273b9190614dda565b61015f8054600090815261016c602090815260408083204290559254825261016d90529081208290556101608054929350839290919061277c908490614dfc565b925050819055508061016960008282546127969190614dfc565b909155505061015f8054600090815261016e6020908152604091829020849055915461016054610169548351868152948501899052928401526060830191909152906001600160a01b0380881691908916907f52c6b7a228763dc832bef1e2dee48707b24b8f1400a6335b3af6d5def4f5bb219060800160405180910390a461015f549250505061129b60018055565b61282e610c86565b6101685561283a611a8f565b6101655580156115375761284d81611231565b60008281526101706020526040812091909155670de0b6b3a764000061287283612f3f565b600084815261016d602052604090205461288c9190614dc3565b6128969190614dda565b600083815261016e60205260409020546101695491925082916128b99190614db0565b6128c39190614dfc565b61016955600091825261016e60209081526040808420929092556101685461016f909152912055565b60c9546001600160a01b03163314610e8e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b59565b61012d5460ff16610e8e5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610b59565b6129a1612946565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001612663565b600054610100900460ff16612a525760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b610e8e61418b565b600054610100900460ff16612ac55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b611c2382826141f6565b600054610100900460ff16612b3a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b610e8e61427a565b600054610100900460ff16612bad5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b610e8e6142ee565b612bbd613c40565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586129cf3390565b612c596040518061016001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000612c6483612d58565b90506000612c7184612d86565b8484526000858152609960209081526040808320546001600160a01b03168288015287835261016d909152908190205490850152606084018390529050670de0b6b3a7640000612cc18284614dc3565b612ccb9190614dda565b612cd59083614db0565b6080840152600084815261016c602052604090205460a0840152612cf884612f3f565b60c084015260e08301819052670de0b6b3a7640000612d178284614dc3565b612d219190614dda565b61010084015250506000828152610170602090815260408083205461012085015293825261016e9052919091205461014082015290565b600081815261016d602052604081205481612d71613ad4565b9050670de0b6b3a76400006113458284614dc3565b600081815261016c6020526040812054808203612da65750600092915050565b6000612db28242614db0565b905061016154811115612dc55750610161545b670de0b6b3a76400006101635461016154670de0b6b3a764000084612dea9190614dc3565b612df49190614dda565b612dfe9190614dc3565b612e089190614dda565b61016354612e169190614db0565b9250610164548310156113525750506101645492915050565b600260015403612e815760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b59565b6002600155565b6040516001600160a01b0380851660248301528316604482015260648101829052611cf49085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152614366565b60018055565b600081815261016c6020526040812054808203612f5f5750600092915050565b6000612f6b8242614db0565b905061016154811115612f7e5750610161545b670de0b6b3a76400008061016254612f969190614db0565b61016154612fac670de0b6b3a764000085614dc3565b612fb69190614dda565b612fc09190614dc3565b612fca9190614dda565b61134f90670de0b6b3a7640000614dfc565b6060612fe6612e2f565b6000838152609960205260409020546001600160a01b031661304a5760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000838152609960205260409020546001600160a01b03163381146130b15760405162461bcd60e51b815260206004820152601360248201527f4e6f7420796f75722078494e5458204e46542e000000000000000000000000006044820152606401610b59565b8251600181116131295760405162461bcd60e51b815260206004820152602c60248201527f596f752063616e27742073706c697420746869732058494e5458206c6573732060448201527f7468616e20322074696d657300000000000000000000000000000000000000006064820152608401610b59565b600a8111156131a05760405162461bcd60e51b815260206004820152602d60248201527f596f752063616e27742073706c697420746869732058494e5458206d6f72652060448201527f7468616e2031302074696d6573000000000000000000000000000000000000006064820152608401610b59565b8067ffffffffffffffff8111156131b9576131b9614c6e565b6040519080825280602002602001820160405280156131e2578160200160208202803683370190505b5092506131ee85612826565b600085815261016d602090815260408083205461016c83528184205461016f909352908320546101608054929392849190869061322c908490614db0565b9091555050600089815261016e6020526040812054610169805491929091613255908490614db0565b90915550600090505b8581101561329f5788818151811061327857613278614e0f565b60200260200101518561328b9190614dfc565b94508061329781614e25565b91505061325e565b5060005b8581101561348557600085858b84815181106132c1576132c1614e0f565b60200260200101516132d39190614dc3565b6132dd9190614dda565b90506000811161332f5760405162461bcd60e51b815260206004820152601460248201527f43616e27742073706c697420302078494e54582e0000000000000000000000006044820152606401610b59565b61015f805490600061334083614e25565b91905055506133528861015f54613ff3565b61015f5489838151811061336857613368614e0f565b60209081029190910181019190915261015f8054600090815261016c835260408082208890558254825261016d90935291822083905554670de0b6b3a7640000906133b290612f3f565b6133bc9084614dc3565b6133c69190614dda565b61015f8054600090815261016e602090815260408083208590559254825261016f905290812086905561016080549293508492909190613407908490614dfc565b925050819055508061016960008282546134219190614dfc565b909155505061015f5460408051918252602082018490528d916001600160a01b038c16917ff66885c33d648fcd0d97e0f2a18e30102169c22763473af0fb716f11b4a17dd6910160405180910390a35050808061347d90614e25565b9150506132a3565b5060008981526101706020526040902054156134d957600089815261017060209081526040808320546001600160a01b038a16845261017190925282208054919290916134d3908490614dfc565b90915550505b600089815261016c6020908152604080832083905561016d825280832083905561016e825280832083905561016f825280832083905561017090915281205561352189613eca565b505050505050610a0a60018055565b6040516001600160a01b038316602482015260448101829052610bfa9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612ed5565b613581612e2f565b6000828152609960205260409020546001600160a01b03166135e55760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000818152609960205260409020546001600160a01b03166136495760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000828152609960205260409020546001600160a01b03163381146136b05760405162461bcd60e51b815260206004820152601e60248201527f46726f6d204e46542069736e277420796f75722078494e5458204e46542e00006044820152606401610b59565b6000828152609960205260409020546001600160a01b038281169116146137195760405162461bcd60e51b815260206004820152601760248201527f546f204e46542069736e27742078494e5458204e46542e0000000000000000006044820152606401610b59565b61372283612826565b61372b82612826565b600083815261016d602090815260408083205461016c9092528220549091906137549042614db0565b9050610161548111156137675750610161545b600084815261016d602090815260408083205461016c9092528220549091906137909042614db0565b9050610161548111156137a35750610161545b60006137af8386614dfc565b9050600081116138275760405162461bcd60e51b815260206004820152602360248201527f43616e2774206d616b65206120706f736974696f6e207769746820302078494e60448201527f54582e00000000000000000000000000000000000000000000000000000000006064820152608401610b59565b6000816138348585614dc3565b61383e9190614dda565b826138498888614dc3565b6138539190614dda565b61385d9190614dfc565b600089815261016d60205260409020839055905061387b8142614db0565b600089815261016c6020526040812091909155670de0b6b3a76400006138a08a612f3f565b6138aa9085614dc3565b6138b49190614dda565b60008a815261016e602090815260408083208490558d83526101709091529020549091501561391b5760008a815261017060209081526040808320546001600160a01b038c1684526101719092528220805491929091613915908490614dfc565b90915550505b60008a815261016c6020908152604080832083905561016d825280832083905561016e825280832083905561016f82528083208390556101709091528120556139638a613eca565b896001600160a01b0389167f50d7f0ef4f7b59921566f6b835fb032efa0fd0dacccb9361292f89b7aa6bafdd8b8661399b8742614db0565b6040805193845260208401929092529082015260600160405180910390a35050505050505050611c2360018055565b60fb805473ffffffffffffffffffffffffffffffffffffffff191690556115378161444e565b60008183106139ff578161129b565b5090919050565b816001600160a01b0316836001600160a01b031603613a675760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610b59565b6001600160a01b038381166000818152609c6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600061016054600003613aee5750670de0b6b3a764000090565b61016054670de0b6b3a7640000613b03613f6c565b613b0d9190614dc3565b611a9e9190614dda565b613b228484846122bb565b613b2e848484846144ad565b611cf45760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b59565b60606000613bad8361464e565b600101905060008167ffffffffffffffff811115613bcd57613bcd614c6e565b6040519080825280601f01601f191660200182016040528015613bf7576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084613c0157509392505050565b61012d5460ff1615610e8e5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610b59565b826001600160a01b0316613ca78261153a565b6001600160a01b031614613d235760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610b59565b6001600160a01b038216613d9e5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610b59565b826001600160a01b0316613db18261153a565b6001600160a01b031614613e2d5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610b59565b6000818152609b60209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b03878116808652609a8552838620805460001901905590871680865283862080546001019055868652609990945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000613ed58261153a565b9050613ee08261153a565b6000838152609b60209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b038516808552609a845282852080546000190190558785526099909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61016a546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015613fcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9e9190614e3f565b6001600160a01b0382166140495760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b59565b6000818152609960205260409020546001600160a01b0316156140ae5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610b59565b6000818152609960205260409020546001600160a01b0316156141135760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610b59565b6001600160a01b0382166000818152609a60209081526040808320805460010190558483526099909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600054610100900460ff16612f395760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b600054610100900460ff166142615760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b609761426d8382614f0f565b506098610bfa8282614f0f565b600054610100900460ff166142e55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b610e8e336139ca565b600054610100900460ff166143595760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b61012d805460ff19169055565b60006143bb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147309092919063ffffffff16565b90508051600014806143dc5750808060200190518101906143dc9190614fcf565b610bfa5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610b59565b60c980546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001600160a01b0384163b15614643576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a029061450a903390899088908890600401614fec565b6020604051808303816000875af1925050508015614545575060408051601f3d908101601f1916820190925261454291810190615028565b60015b6145f8573d808015614573576040519150601f19603f3d011682016040523d82523d6000602084013e614578565b606091505b5080516000036145f05760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b59565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490506122b3565b506001949350505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310614697577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef810000000083106146c3576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106146e157662386f26fc10000830492506010015b6305f5e10083106146f9576305f5e100830492506008015b612710831061470d57612710830492506004015b6064831061471f576064830492506002015b600a8310610a0a5760010192915050565b60606122b3848460008585600080866001600160a01b031685876040516147579190615045565b60006040518083038185875af1925050503d8060008114614794576040519150601f19603f3d011682016040523d82523d6000602084013e614799565b606091505b50915091506147aa878383876147b5565b979650505050505050565b6060831561482457825160000361481d576001600160a01b0385163b61481d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b59565b50816122b3565b6122b383838151156148395781518083602001fd5b8060405162461bcd60e51b8152600401610b5991906148ee565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461153757600080fd5b60006020828403121561489357600080fd5b813561129b81614853565b60005b838110156148b95781810151838201526020016148a1565b50506000910152565b600081518084526148da81602086016020860161489e565b601f01601f19169290920160200192915050565b60208152600061129b60208301846148c2565b60006020828403121561491357600080fd5b5035919050565b80356001600160a01b0381168114610de357600080fd5b6000806040838503121561494457600080fd5b61494d8361491a565b946020939093013593505050565b60008060006060848603121561497057600080fd5b6149798461491a565b92506149876020850161491a565b9150604084013590509250925092565b60008083601f8401126149a957600080fd5b50813567ffffffffffffffff8111156149c157600080fd5b6020830191508360208260051b85010111156149dc57600080fd5b9250929050565b600080602083850312156149f657600080fd5b823567ffffffffffffffff811115614a0d57600080fd5b614a1985828601614997565b90969095509350505050565b600060208284031215614a3757600080fd5b61129b8261491a565b60008060408385031215614a5357600080fd5b614a5c8361491a565b9150614a6a6020840161491a565b90509250929050565b600081518084526020808501945080840160005b83811015614aa357815187529582019590820190600101614a87565b509495945050505050565b8281526040602082015260006122b36040830184614a73565b805182526020810151614ae560208401826001600160a01b03169052565b5060408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301526101008082015181840152506101208082015181840152506101408082015181840152505050565b6101608101610a0a8284614ac7565b600080600060408486031215614b6e57600080fd5b83359250602084013567ffffffffffffffff811115614b8c57600080fd5b614b9886828701614997565b9497909650939450505050565b60208152600061129b6020830184614a73565b60008060408385031215614bcb57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b81811015614c1d57614c09838551614ac7565b928401926101609290920191600101614bf6565b50909695505050505050565b801515811461153757600080fd5b60008060408385031215614c4a57600080fd5b614c538361491a565b91506020830135614c6381614c29565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215614c9a57600080fd5b614ca38561491a565b9350614cb16020860161491a565b925060408501359150606085013567ffffffffffffffff80821115614cd557600080fd5b818701915087601f830112614ce957600080fd5b813581811115614cfb57614cfb614c6e565b604051601f8201601f19908116603f01168101908382118183101715614d2357614d23614c6e565b816040528281528a6020848701011115614d3c57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600181811c90821680614d7457607f821691505b602082108103614d9457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610a0a57610a0a614d9a565b8082028115828204841417610a0a57610a0a614d9a565b600082614df757634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610a0a57610a0a614d9a565b634e487b7160e01b600052603260045260246000fd5b60006000198203614e3857614e38614d9a565b5060010190565b600060208284031215614e5157600080fd5b5051919050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115614e8757600080fd5b8260051b80858437919091019392505050565b60008351614eac81846020880161489e565b835190830190614ec081836020880161489e565b01949350505050565b601f821115610bfa57600081815260208120601f850160051c81016020861015614ef05750805b601f850160051c820191505b8181101561189757828155600101614efc565b815167ffffffffffffffff811115614f2957614f29614c6e565b614f3d81614f378454614d60565b84614ec9565b602080601f831160018114614f725760008415614f5a5750858301515b600019600386901b1c1916600185901b178555611897565b600085815260208120601f198616915b82811015614fa157888601518255948401946001909101908401614f82565b5085821015614fbf5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215614fe157600080fd5b815161129b81614c29565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261501e60808301846148c2565b9695505050505050565b60006020828403121561503a57600080fd5b815161129b81614853565b6000825161505781846020870161489e565b919091019291505056fea26469706673582212209a1c5f5c19d7ba373989c1f202587f518b4889cf86c6fd746d309fce1fef9f8764736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106104065760003560e01c806379ba50971161021a578063c205f34111610135578063e30c3978116100c8578063f290dfa711610097578063f3058d4e1161007c578063f3058d4e146108fa578063f7c618c11461090d578063f84ddf0b1461092157600080fd5b8063f290dfa7146108bf578063f2fde38b146108e757600080fd5b8063e30c397814610854578063e985e9c514610865578063ebe2b12b146108a1578063ef7297de146108ab57600080fd5b8063d1a249ab11610104578063d1a249ab14610810578063d1c2babb1461081a578063d975dfed1461082d578063df2e0b971461084057600080fd5b8063c205f341146107bf578063c87b56dd146107d2578063c8f33c91146107e5578063cfd0e125146107ef57600080fd5b8063988dc31e116101ad578063a345280a1161017c578063a345280a1461077e578063a368497714610791578063a694fc3a14610799578063b88d4fde146107ac57600080fd5b8063988dc31e14610724578063a00ea0c514610737578063a1c95e5a1461074a578063a22cb4651461076b57600080fd5b80638da5cb5b116101e95780638da5cb5b146106e15780638fca5a59146106f257806395d89b411461071257806396c82e571461071a57600080fd5b806379ba5097146106b85780637b0a47ee146106c057806380faa57d146106ca5780638b8fbd92146106d257600080fd5b806342842e0e116103255780635c975abb116102b857806369c672471161028757806370a082311161026c57806370a082311461068a578063715018a61461069d578063771602f7146106a557600080fd5b806369c67247146106575780636ba4c1381461067757600080fd5b80635c975abb1461061257806360993b5b1461061e5780636352211e14610631578063645bfd9a1461064457600080fd5b8063519f5099116102f4578063519f5099146105cb5780635200e79e146105eb578063520bf08a146105f55780635a48a97f146105ff57600080fd5b806342842e0e14610571578063485cc955146105845780634d62f590146105975780634d6ed8c4146105b857600080fd5b806323b872dd1161039d57806330f916191161036c57806330f916191461052b57806331d7a2621461053e5780633228dd591461055f5780633f4ba83a1461056957600080fd5b806323b872dd146104ea5780632ac3f450146104fd5780632e17de78146105055780632ee409081461051857600080fd5b8063095ea7b3116103d9578063095ea7b3146104a95780630eba9849146104be5780631be05289146104d65780632212b806146104e057600080fd5b806301ffc9a71461040b57806306fdde0314610433578063081812fc1461044857806308d9788d14610473575b600080fd5b61041e610419366004614881565b61092b565b60405190151581526020015b60405180910390f35b61043b610a10565b60405161042a91906148ee565b61045b610456366004614901565b610aa2565b6040516001600160a01b03909116815260200161042a565b610497610481366004614901565b6101726020526000908152604090205460ff1681565b60405160ff909116815260200161042a565b6104bc6104b7366004614931565b610ac9565b005b6104c86101645481565b60405190815260200161042a565b6104c862093a8081565b6104c86101625481565b6104bc6104f836600461495b565b610bff565b6104c8610c86565b6104c8610513366004614901565b610d52565b6104c8610526366004614931565b610de8565b6104bc6105393660046149e3565b610e2e565b6104c861054c366004614a25565b6101716020526000908152604090205481565b6104c86101685481565b6104bc610e76565b6104bc61057f36600461495b565b610e90565b6104bc610592366004614a40565b610eab565b6105aa6105a53660046149e3565b611171565b60405161042a929190614aae565b6104c86105c6366004614901565b611231565b6105de6105d9366004614901565b6112a2565b60405161042a9190614b4a565b6104c86101635481565b6104c86101605481565b6104c861060d366004614901565b611311565b61012d5460ff1661041e565b6104bc61062c366004614901565b611359565b61045b61063f366004614901565b61153a565b6104c8610652366004614901565b61159f565b61066a610665366004614b59565b6115c5565b60405161042a9190614ba5565b6104bc6106853660046149e3565b61168a565b6104c8610698366004614a25565b61189f565b6104bc611939565b6104bc6106b3366004614bb8565b611941565b6104bc611a04565b6104c86101675481565b6104c8611a8f565b6104c8670de0b6b3a764000081565b60c9546001600160a01b031661045b565b6107056107003660046149e3565b611aa3565b60405161042a9190614bda565b61043b611bbd565b6104c86101695481565b6104c8610732366004614901565b611bcc565b6104c8610745366004614901565b611bf2565b6104c8610758366004614901565b61016d6020526000908152604090205481565b6104bc610779366004614c37565b611c18565b61041e61078c366004614901565b611c27565b6104c8611c55565b6104c86107a7366004614901565b611c5f565b6104bc6107ba366004614c84565b611c6c565b6104bc6107cd366004614a25565b611cfa565b61043b6107e0366004614901565b611d32565b6104c86101655481565b6104c86107fd366004614901565b61016c6020526000908152604090205481565b6104c86101615481565b6104bc610828366004614bb8565b611da5565b6104c861083b366004614901565b611e48565b61016a5461045b906001600160a01b031681565b60fb546001600160a01b031661045b565b61041e610873366004614a40565b6001600160a01b039182166000908152609c6020908152604080832093909416825291909152205460ff1690565b6104c86101665481565b6101735461045b906001600160a01b031681565b6108d26108cd366004614bb8565b611e90565b6040805192835260208301919091520161042a565b6104bc6108f5366004614a25565b61205f565b6104bc610908366004614901565b6120dd565b61016b5461045b906001600160a01b031681565b6104c861015f5481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806109be57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610a0a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b606060978054610a1f90614d60565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4b90614d60565b8015610a985780601f10610a6d57610100808354040283529160200191610a98565b820191906000526020600020905b815481529060010190602001808311610a7b57829003601f168201915b5050505050905090565b6000610aad8261215d565b506000908152609b60205260409020546001600160a01b031690565b6000610ad48261153a565b9050806001600160a01b0316836001600160a01b031603610b625760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610b7e5750610b7e8133610873565b610bf05760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610b59565b610bfa83836121c1565b505050565b610c09338261223c565b610c7b5760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610b59565b610bfa8383836122bb565b600061016954600003610c9b57506101685490565b60006101695411610cee5760405162461bcd60e51b815260206004820152601060248201527f496e636f727265637420776569676874000000000000000000000000000000006044820152606401610b59565b600061016554610cfc611a8f565b610d069190614db0565b9050610169546101675482610d1b9190614dc3565b610d34906ec097ce7bc90715b34b9f1000000000614dc3565b610d3e9190614dda565b61016854610d4c9190614dfc565b91505090565b6000610d5d82611c27565b15610dd05760405162461bcd60e51b815260206004820152603a60248201527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e277420756e7374616b652f7472616e736665722f73706c69740000000000006064820152608401610b59565b610dd98261234c565b9050610de361261b565b919050565b6000610df533848461266d565b610173549091506001600160a01b03163303610e2657600081815261017260205260409020805460ff191660011790555b610a0a61261b565b8060005b81811015610e6d57610e5b848483818110610e4f57610e4f614e0f565b90506020020135612826565b80610e6581614e25565b915050610e32565b50610bfa61261b565b610e7e6128ec565b610e86612946565b610e8e612999565b565b610bfa83838360405180602001604052806000815250611c6c565b600054610100900460ff1615808015610ecb5750600054600160ff909116105b80610ee55750303b158015610ee5575060005460ff166001145b610f575760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610b59565b6000805460ff191660011790558015610f7a576000805461ff0019166101001790555b610f826129e7565b610ff66040518060400160405280600b81526020017f5374616b656420494e54580000000000000000000000000000000000000000008152506040518060400160405280600581526020017f58494e5458000000000000000000000000000000000000000000000000000000815250612a5a565b610ffe612acf565b611006612b42565b6001600160a01b03831661105c5760405162461bcd60e51b815260206004820152601460248201527f43616e27742075736520307820616464726573730000000000000000000000006044820152606401610b59565b6001600160a01b0382166110b25760405162461bcd60e51b815260206004820152601460248201527f43616e27742075736520307820616464726573730000000000000000000000006044820152606401610b59565b61016a80546001600160a01b0380861673ffffffffffffffffffffffffffffffffffffffff199283161790925561016b8054928516929091169190911790556293a800610161556722b1c8c1227a0000610162556703782dace9d9000061016355662386f26fc1000061016455611127612bb5565b8015610bfa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b60006060828067ffffffffffffffff81111561118f5761118f614c6e565b6040519080825280602002602001820160405280156111b8578160200160208202803683370190505b50915060005b818110156112285760006111e98787848181106111dd576111dd614e0f565b90506020020135611231565b90506111f58186614dfc565b94508084838151811061120a5761120a614e0f565b6020908102919091010152508061122081614e25565b9150506111be565b50509250929050565b600081815261016e602090815260408083205461017083528184205461016f909352908320549091906ec097ce7bc90715b34b9f100000000090611273610c86565b61127d9190614db0565b6112879084614dc3565b6112919190614dda565b61129b9190614dfc565b9392505050565b6113086040518061016001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610a0a82612bf3565b60008061131d83612d58565b9050600061132a84612d86565b9050811561135257670de0b6b3a76400006113458284614dc3565b61134f9190614dda565b92505b5050919050565b611361612e2f565b6113696128ec565b6113736000612826565b61138c3361016b546001600160a01b0316903084612e88565b6101665442106113ac576113a362093a8082614dda565b610167556113f1565b600042610166546113bd9190614db0565b9050600061016754826113d09190614dc3565b905062093a806113e08285614dfc565b6113ea9190614dda565b6101675550505b61016b546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114789190614e3f565b905061148762093a8082614dda565b6101675411156114d95760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152606401610b59565b426101658190556114ee9062093a8090614dfc565b610166556040518281527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a161152d61261b565b5061153760018055565b50565b6000818152609960205260408120546001600160a01b031680610a0a5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610b59565b6000818152609960205260408120546001600160a01b031615610de357610a0a82612f3f565b60606115d084611c27565b156116435760405162461bcd60e51b815260206004820152603a60248201527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e277420756e7374616b652f7472616e736665722f73706c69740000000000006064820152608401610b59565b61168084848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612fdc92505050565b905061129b61261b565b33600090815261017160205260408120548291908190815b84811015611808578686828181106116bc576116bc614e0f565b9050602002013593506116e6846000908152609960205260409020546001600160a01b0316151590565b6117325760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000848152609960205260409020546001600160a01b031692503383146117c15760405162461bcd60e51b815260206004820152602760248201527f596f7520617265206e6f7420746865206f776e6572206f66207468697320706f60448201527f736974696f6e2e000000000000000000000000000000000000000000000000006064820152608401610b59565b6117ca84612826565b600084815261017060205260409020546117e49083614dfc565b6000858152610170602052604081205591508061180081614e25565b9150506116a2565b50336000818152610171602052604081205561016b54611834916001600160a01b039091169083613530565b8585604051611844929190614e58565b6040518091039020826001600160a01b03167f916f43dce61aa4c4d8761c25ddcacfe178ea96a18f68d2775354bbc06be75aaa8360405161188791815260200190565b60405180910390a361189761261b565b505050505050565b60006001600160a01b03821661191d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610b59565b506001600160a01b03166000908152609a602052604090205490565b610e8e6128ec565b61194a81611c27565b156119e35760405162461bcd60e51b815260206004820152605260248201527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e27742061646420696e747820746f2069742c206372656174652061206e657760648201527f20706f736974696f6e20696e73746561642e0000000000000000000000000000608482015260a401610b59565b60006119f033338561266d565b90506119fc8183613579565b610bfa61261b565b60fb5433906001600160a01b03168114611a865760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152608401610b59565b611537816139ca565b6000611a9e42610166546139f0565b905090565b6060818067ffffffffffffffff811115611abf57611abf614c6e565b604051908082528060200260200182016040528015611b5657816020015b611b436040518061016001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b815260200190600190039081611add5790505b50915060005b81811015611bb557611b85858583818110611b7957611b79614e0f565b90506020020135612bf3565b838281518110611b9757611b97614e0f565b60200260200101819052508080611bad90614e25565b915050611b5c565b505092915050565b606060988054610a1f90614d60565b6000818152609960205260408120546001600160a01b031615610de357610a0a82612d86565b6000818152609960205260408120546001600160a01b031615610de357610a0a82612d58565b611c23338383613a06565b5050565b6000818152610172602052604081205460ff16600103610de3576368383020421015610de357506001919050565b6000611a9e613ad4565b6000610dd933338461266d565b611c76338361223c565b611ce85760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610b59565b611cf484848484613b17565b50505050565b611d026128ec565b610173805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6060611d3d8261215d565b6000611d5460408051602081019091526000815290565b90506000815111611d74576040518060200160405280600081525061129b565b80611d7e84613ba0565b604051602001611d8f929190614e9a565b6040516020818303038152906040529392505050565b600081815261017260205260408082205484835291205460ff908116911614611e365760405162461bcd60e51b815260206004820152602c60248201527f596f752063616e2774206d6572676520746f6b656e732077697468206469666660448201527f6572656e742074797065732e00000000000000000000000000000000000000006064820152608401610b59565b611e408282613579565b611c2361261b565b600080611e5483612d58565b90506000611e6184612d86565b9050811561135257670de0b6b3a7640000611e7c8284614dc3565b611e869190614dda565b61134f9083614db0565b600080611e9c84611c27565b15611f0f5760405162461bcd60e51b815260206004820152603a60248201527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e277420756e7374616b652f7472616e736665722f73706c69740000000000006064820152608401610b59565b600084815261016d6020526040902054838111611f945760405162461bcd60e51b815260206004820152602e60248201527f596f752063616e2774207061727469616c6c79207769746864726177206d6f7260448201527f65207468616e20796f75206f776e0000000000000000000000000000000000006064820152608401610b59565b6040805160028082526060820183526000926020830190803683370190505090508481600081518110611fc957611fc9614e0f565b6020908102919091010152611fde8583614db0565b81600181518110611ff157611ff1614e0f565b60200260200101818152505060006120098783612fdc565b905061202e8160008151811061202157612021614e0f565b602002602001015161234c565b94508060018151811061204357612043614e0f565b6020026020010151935061205561261b565b5050509250929050565b6120676128ec565b60fb80546001600160a01b03831673ffffffffffffffffffffffffffffffffffffffff1990911681179091556120a560c9546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6120e76000612826565b60006120f1613ad4565b905061210c3361016a546001600160a01b0316903085612e88565b7fd6f85071f759d68953f2d6e2c919755921656cd303fba98e49af3074585bd7518282612137613ad4565b6040805193845260208401929092529082015260600160405180910390a1611c2361261b565b6000818152609960205260409020546001600160a01b03166115375760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610b59565b6000818152609b60205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915581906122038261153a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806122488361153a565b9050806001600160a01b0316846001600160a01b0316148061228f57506001600160a01b038082166000908152609c602090815260408083209388168352929052205460ff165b806122b35750836001600160a01b03166122a884610aa2565b6001600160a01b0316145b949350505050565b6122c3613c40565b6122cc81611c27565b15612341576040805162461bcd60e51b81526020600482015260248101919091527f5468697320746f6b656e20697320726573747269637465642c20796f7520636160448201527f6e277420756e7374616b652f7472616e736665722f6d657267652f73706c69746064820152608401610b59565b610bfa838383613c94565b6000612356612e2f565b61235e613c40565b6000828152609960205260409020546001600160a01b03166123c25760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000828152609960205260409020546001600160a01b03163381146124295760405162461bcd60e51b815260206004820152601360248201527f4e6f7420796f75722078494e5458204e46542e000000000000000000000000006044820152606401610b59565b61243283612826565b600083815261016d602052604081205490670de0b6b3a764000061245586612f3f565b61245f9084614dc3565b6124699190614dda565b90506000612475613ad4565b90506000670de0b6b3a764000061248c8386614dc3565b6124969190614dda565b90506000670de0b6b3a76400006124ac89612d86565b6124b69084614dc3565b6124c09190614dda565b90506124cc8183614db0565b600089815261017060205260409020549097501561252257600088815261017060209081526040808320546001600160a01b038a168452610171909252822080549192909161251c908490614dfc565b90915550505b600088815261016c6020908152604080832083905561016d825280832083905561016e825280832083905561016f825280832083905561017090915281205561256a88613eca565b84610160600082825461257d9190614db0565b925050819055508361016960008282546125979190614db0565b909155505061016a546125b4906001600160a01b03168789613530565b6101605460408051878152602081018a905280820184905260608101929092525189916001600160a01b038916917f44bd20a79e993bdcc7cbedf54a3b4d19fb78490124b6b90d04fe3242eea579e89181900360800190a3505050505050610de360018055565b7f107ded4700c40c119c1250039eb39b50e8a49f47e8de2028d5efe1d7bc5b4ebd612644613f6c565b6101605461016954604080519384526020840192909252908201526060015b60405180910390a1565b6000612677612e2f565b600082116126c75760405162461bcd60e51b815260206004820152601360248201527f43616e2774207374616b65203020696e74582e000000000000000000000000006044820152606401610b59565b60006126d1613ad4565b61016a549091506126ed906001600160a01b0316863086612e88565b61015f80549060006126fe83614e25565b91905055506127108461015f54613ff3565b61271c61015f54612826565b600081612731670de0b6b3a764000086614dc3565b61273b9190614dda565b61015f8054600090815261016c602090815260408083204290559254825261016d90529081208290556101608054929350839290919061277c908490614dfc565b925050819055508061016960008282546127969190614dfc565b909155505061015f8054600090815261016e6020908152604091829020849055915461016054610169548351868152948501899052928401526060830191909152906001600160a01b0380881691908916907f52c6b7a228763dc832bef1e2dee48707b24b8f1400a6335b3af6d5def4f5bb219060800160405180910390a461015f549250505061129b60018055565b61282e610c86565b6101685561283a611a8f565b6101655580156115375761284d81611231565b60008281526101706020526040812091909155670de0b6b3a764000061287283612f3f565b600084815261016d602052604090205461288c9190614dc3565b6128969190614dda565b600083815261016e60205260409020546101695491925082916128b99190614db0565b6128c39190614dfc565b61016955600091825261016e60209081526040808420929092556101685461016f909152912055565b60c9546001600160a01b03163314610e8e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b59565b61012d5460ff16610e8e5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610b59565b6129a1612946565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001612663565b600054610100900460ff16612a525760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b610e8e61418b565b600054610100900460ff16612ac55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b611c2382826141f6565b600054610100900460ff16612b3a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b610e8e61427a565b600054610100900460ff16612bad5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b610e8e6142ee565b612bbd613c40565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586129cf3390565b612c596040518061016001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000612c6483612d58565b90506000612c7184612d86565b8484526000858152609960209081526040808320546001600160a01b03168288015287835261016d909152908190205490850152606084018390529050670de0b6b3a7640000612cc18284614dc3565b612ccb9190614dda565b612cd59083614db0565b6080840152600084815261016c602052604090205460a0840152612cf884612f3f565b60c084015260e08301819052670de0b6b3a7640000612d178284614dc3565b612d219190614dda565b61010084015250506000828152610170602090815260408083205461012085015293825261016e9052919091205461014082015290565b600081815261016d602052604081205481612d71613ad4565b9050670de0b6b3a76400006113458284614dc3565b600081815261016c6020526040812054808203612da65750600092915050565b6000612db28242614db0565b905061016154811115612dc55750610161545b670de0b6b3a76400006101635461016154670de0b6b3a764000084612dea9190614dc3565b612df49190614dda565b612dfe9190614dc3565b612e089190614dda565b61016354612e169190614db0565b9250610164548310156113525750506101645492915050565b600260015403612e815760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b59565b6002600155565b6040516001600160a01b0380851660248301528316604482015260648101829052611cf49085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152614366565b60018055565b600081815261016c6020526040812054808203612f5f5750600092915050565b6000612f6b8242614db0565b905061016154811115612f7e5750610161545b670de0b6b3a76400008061016254612f969190614db0565b61016154612fac670de0b6b3a764000085614dc3565b612fb69190614dda565b612fc09190614dc3565b612fca9190614dda565b61134f90670de0b6b3a7640000614dfc565b6060612fe6612e2f565b6000838152609960205260409020546001600160a01b031661304a5760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000838152609960205260409020546001600160a01b03163381146130b15760405162461bcd60e51b815260206004820152601360248201527f4e6f7420796f75722078494e5458204e46542e000000000000000000000000006044820152606401610b59565b8251600181116131295760405162461bcd60e51b815260206004820152602c60248201527f596f752063616e27742073706c697420746869732058494e5458206c6573732060448201527f7468616e20322074696d657300000000000000000000000000000000000000006064820152608401610b59565b600a8111156131a05760405162461bcd60e51b815260206004820152602d60248201527f596f752063616e27742073706c697420746869732058494e5458206d6f72652060448201527f7468616e2031302074696d6573000000000000000000000000000000000000006064820152608401610b59565b8067ffffffffffffffff8111156131b9576131b9614c6e565b6040519080825280602002602001820160405280156131e2578160200160208202803683370190505b5092506131ee85612826565b600085815261016d602090815260408083205461016c83528184205461016f909352908320546101608054929392849190869061322c908490614db0565b9091555050600089815261016e6020526040812054610169805491929091613255908490614db0565b90915550600090505b8581101561329f5788818151811061327857613278614e0f565b60200260200101518561328b9190614dfc565b94508061329781614e25565b91505061325e565b5060005b8581101561348557600085858b84815181106132c1576132c1614e0f565b60200260200101516132d39190614dc3565b6132dd9190614dda565b90506000811161332f5760405162461bcd60e51b815260206004820152601460248201527f43616e27742073706c697420302078494e54582e0000000000000000000000006044820152606401610b59565b61015f805490600061334083614e25565b91905055506133528861015f54613ff3565b61015f5489838151811061336857613368614e0f565b60209081029190910181019190915261015f8054600090815261016c835260408082208890558254825261016d90935291822083905554670de0b6b3a7640000906133b290612f3f565b6133bc9084614dc3565b6133c69190614dda565b61015f8054600090815261016e602090815260408083208590559254825261016f905290812086905561016080549293508492909190613407908490614dfc565b925050819055508061016960008282546134219190614dfc565b909155505061015f5460408051918252602082018490528d916001600160a01b038c16917ff66885c33d648fcd0d97e0f2a18e30102169c22763473af0fb716f11b4a17dd6910160405180910390a35050808061347d90614e25565b9150506132a3565b5060008981526101706020526040902054156134d957600089815261017060209081526040808320546001600160a01b038a16845261017190925282208054919290916134d3908490614dfc565b90915550505b600089815261016c6020908152604080832083905561016d825280832083905561016e825280832083905561016f825280832083905561017090915281205561352189613eca565b505050505050610a0a60018055565b6040516001600160a01b038316602482015260448101829052610bfa9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612ed5565b613581612e2f565b6000828152609960205260409020546001600160a01b03166135e55760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000818152609960205260409020546001600160a01b03166136495760405162461bcd60e51b815260206004820152601c60248201527f5468697320706f736974696f6e20646f65736e27742065786973742e000000006044820152606401610b59565b6000828152609960205260409020546001600160a01b03163381146136b05760405162461bcd60e51b815260206004820152601e60248201527f46726f6d204e46542069736e277420796f75722078494e5458204e46542e00006044820152606401610b59565b6000828152609960205260409020546001600160a01b038281169116146137195760405162461bcd60e51b815260206004820152601760248201527f546f204e46542069736e27742078494e5458204e46542e0000000000000000006044820152606401610b59565b61372283612826565b61372b82612826565b600083815261016d602090815260408083205461016c9092528220549091906137549042614db0565b9050610161548111156137675750610161545b600084815261016d602090815260408083205461016c9092528220549091906137909042614db0565b9050610161548111156137a35750610161545b60006137af8386614dfc565b9050600081116138275760405162461bcd60e51b815260206004820152602360248201527f43616e2774206d616b65206120706f736974696f6e207769746820302078494e60448201527f54582e00000000000000000000000000000000000000000000000000000000006064820152608401610b59565b6000816138348585614dc3565b61383e9190614dda565b826138498888614dc3565b6138539190614dda565b61385d9190614dfc565b600089815261016d60205260409020839055905061387b8142614db0565b600089815261016c6020526040812091909155670de0b6b3a76400006138a08a612f3f565b6138aa9085614dc3565b6138b49190614dda565b60008a815261016e602090815260408083208490558d83526101709091529020549091501561391b5760008a815261017060209081526040808320546001600160a01b038c1684526101719092528220805491929091613915908490614dfc565b90915550505b60008a815261016c6020908152604080832083905561016d825280832083905561016e825280832083905561016f82528083208390556101709091528120556139638a613eca565b896001600160a01b0389167f50d7f0ef4f7b59921566f6b835fb032efa0fd0dacccb9361292f89b7aa6bafdd8b8661399b8742614db0565b6040805193845260208401929092529082015260600160405180910390a35050505050505050611c2360018055565b60fb805473ffffffffffffffffffffffffffffffffffffffff191690556115378161444e565b60008183106139ff578161129b565b5090919050565b816001600160a01b0316836001600160a01b031603613a675760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610b59565b6001600160a01b038381166000818152609c6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600061016054600003613aee5750670de0b6b3a764000090565b61016054670de0b6b3a7640000613b03613f6c565b613b0d9190614dc3565b611a9e9190614dda565b613b228484846122bb565b613b2e848484846144ad565b611cf45760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b59565b60606000613bad8361464e565b600101905060008167ffffffffffffffff811115613bcd57613bcd614c6e565b6040519080825280601f01601f191660200182016040528015613bf7576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084613c0157509392505050565b61012d5460ff1615610e8e5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610b59565b826001600160a01b0316613ca78261153a565b6001600160a01b031614613d235760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610b59565b6001600160a01b038216613d9e5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610b59565b826001600160a01b0316613db18261153a565b6001600160a01b031614613e2d5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610b59565b6000818152609b60209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b03878116808652609a8552838620805460001901905590871680865283862080546001019055868652609990945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000613ed58261153a565b9050613ee08261153a565b6000838152609b60209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b038516808552609a845282852080546000190190558785526099909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61016a546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015613fcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9e9190614e3f565b6001600160a01b0382166140495760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b59565b6000818152609960205260409020546001600160a01b0316156140ae5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610b59565b6000818152609960205260409020546001600160a01b0316156141135760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610b59565b6001600160a01b0382166000818152609a60209081526040808320805460010190558483526099909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600054610100900460ff16612f395760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b600054610100900460ff166142615760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b609761426d8382614f0f565b506098610bfa8282614f0f565b600054610100900460ff166142e55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b610e8e336139ca565b600054610100900460ff166143595760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610b59565b61012d805460ff19169055565b60006143bb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147309092919063ffffffff16565b90508051600014806143dc5750808060200190518101906143dc9190614fcf565b610bfa5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610b59565b60c980546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001600160a01b0384163b15614643576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a029061450a903390899088908890600401614fec565b6020604051808303816000875af1925050508015614545575060408051601f3d908101601f1916820190925261454291810190615028565b60015b6145f8573d808015614573576040519150601f19603f3d011682016040523d82523d6000602084013e614578565b606091505b5080516000036145f05760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b59565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490506122b3565b506001949350505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310614697577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef810000000083106146c3576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106146e157662386f26fc10000830492506010015b6305f5e10083106146f9576305f5e100830492506008015b612710831061470d57612710830492506004015b6064831061471f576064830492506002015b600a8310610a0a5760010192915050565b60606122b3848460008585600080866001600160a01b031685876040516147579190615045565b60006040518083038185875af1925050503d8060008114614794576040519150601f19603f3d011682016040523d82523d6000602084013e614799565b606091505b50915091506147aa878383876147b5565b979650505050505050565b6060831561482457825160000361481d576001600160a01b0385163b61481d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b59565b50816122b3565b6122b383838151156148395781518083602001fd5b8060405162461bcd60e51b8152600401610b5991906148ee565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461153757600080fd5b60006020828403121561489357600080fd5b813561129b81614853565b60005b838110156148b95781810151838201526020016148a1565b50506000910152565b600081518084526148da81602086016020860161489e565b601f01601f19169290920160200192915050565b60208152600061129b60208301846148c2565b60006020828403121561491357600080fd5b5035919050565b80356001600160a01b0381168114610de357600080fd5b6000806040838503121561494457600080fd5b61494d8361491a565b946020939093013593505050565b60008060006060848603121561497057600080fd5b6149798461491a565b92506149876020850161491a565b9150604084013590509250925092565b60008083601f8401126149a957600080fd5b50813567ffffffffffffffff8111156149c157600080fd5b6020830191508360208260051b85010111156149dc57600080fd5b9250929050565b600080602083850312156149f657600080fd5b823567ffffffffffffffff811115614a0d57600080fd5b614a1985828601614997565b90969095509350505050565b600060208284031215614a3757600080fd5b61129b8261491a565b60008060408385031215614a5357600080fd5b614a5c8361491a565b9150614a6a6020840161491a565b90509250929050565b600081518084526020808501945080840160005b83811015614aa357815187529582019590820190600101614a87565b509495945050505050565b8281526040602082015260006122b36040830184614a73565b805182526020810151614ae560208401826001600160a01b03169052565b5060408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301526101008082015181840152506101208082015181840152506101408082015181840152505050565b6101608101610a0a8284614ac7565b600080600060408486031215614b6e57600080fd5b83359250602084013567ffffffffffffffff811115614b8c57600080fd5b614b9886828701614997565b9497909650939450505050565b60208152600061129b6020830184614a73565b60008060408385031215614bcb57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b81811015614c1d57614c09838551614ac7565b928401926101609290920191600101614bf6565b50909695505050505050565b801515811461153757600080fd5b60008060408385031215614c4a57600080fd5b614c538361491a565b91506020830135614c6381614c29565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215614c9a57600080fd5b614ca38561491a565b9350614cb16020860161491a565b925060408501359150606085013567ffffffffffffffff80821115614cd557600080fd5b818701915087601f830112614ce957600080fd5b813581811115614cfb57614cfb614c6e565b604051601f8201601f19908116603f01168101908382118183101715614d2357614d23614c6e565b816040528281528a6020848701011115614d3c57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600181811c90821680614d7457607f821691505b602082108103614d9457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610a0a57610a0a614d9a565b8082028115828204841417610a0a57610a0a614d9a565b600082614df757634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610a0a57610a0a614d9a565b634e487b7160e01b600052603260045260246000fd5b60006000198203614e3857614e38614d9a565b5060010190565b600060208284031215614e5157600080fd5b5051919050565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115614e8757600080fd5b8260051b80858437919091019392505050565b60008351614eac81846020880161489e565b835190830190614ec081836020880161489e565b01949350505050565b601f821115610bfa57600081815260208120601f850160051c81016020861015614ef05750805b601f850160051c820191505b8181101561189757828155600101614efc565b815167ffffffffffffffff811115614f2957614f29614c6e565b614f3d81614f378454614d60565b84614ec9565b602080601f831160018114614f725760008415614f5a5750858301515b600019600386901b1c1916600185901b178555611897565b600085815260208120601f198616915b82811015614fa157888601518255948401946001909101908401614f82565b5085821015614fbf5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215614fe157600080fd5b815161129b81614c29565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261501e60808301846148c2565b9695505050505050565b60006020828403121561503a57600080fd5b815161129b81614853565b6000825161505781846020870161489e565b919091019291505056fea26469706673582212209a1c5f5c19d7ba373989c1f202587f518b4889cf86c6fd746d309fce1fef9f8764736f6c63430008120033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MNT
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.