Contract Overview
Balance:
0 MATIC
Token:
My Name Tag:
Not Available
TokenTracker:
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x7b57b8ecb34b36ca7722faab2b8c097f693eaca5b052db14b8006e045a36328d | Add Address | 33186415 | 14 days 6 hrs ago | 0x03870c7d6afc54ecff73ede201a4fbd6b614e46a | IN | 0xfc2c3080e03c732f37e5196db13ac804ee541315 | 0 MATIC | 0.000075570001 | |
0xb360bed455afde67a20d05597cf0416f2cd0b0cbeb5a7cda1647b228dccff3b8 | Add Address | 33186362 | 14 days 6 hrs ago | 0x03870c7d6afc54ecff73ede201a4fbd6b614e46a | IN | 0xfc2c3080e03c732f37e5196db13ac804ee541315 | 0 MATIC | 0.000092670001 | |
0xd405f747fc48d4342f2bfc2aacfab0b4cda9781057916516e27e5ce62ba64d04 | 0x60a06040 | 33171633 | 14 days 15 hrs ago | 0x03870c7d6afc54ecff73ede201a4fbd6b614e46a | IN | Create: SlabsBundleCollection | 0 MATIC | 0.006153136561 |
[ Download CSV Export ]
Contract Name:
SlabsBundleCollection
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: None pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/metatx/ERC2771Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "./Interfaces/IERC998ERC721TopDown.sol"; import "./Interfaces/IERC998ERC721TopDownEnumerable.sol"; import "./Interfaces/IERC998ERC721BottomUp.sol"; import "./MarketPlace/interfaces/IRoyaltyFeeRegistry.sol"; import "./utils/Whitelist.sol"; contract SlabsBundleCollection is ERC2771Context, ERC2981, Whitelist, ERC721URIStorage, IERC998ERC721TopDown, IERC998ERC721TopDownEnumerable { using Address for address; // return address(this).rootOwnerOf.selector ^ this.rootOwnerOfChild.selector ^ // this.tokenOwnerOf.selector ^ this.ownerOfChild.selector; bytes4 constant ERC998_MAGIC_VALUE = 0xcd740db5; //from zepellin ERC721Receiver.sol //old version bytes4 constant ERC721_RECEIVED_OLD = 0xf0b9e5ba; //new version bytes4 constant ERC721_RECEIVED_NEW = 0x150b7a02; uint256 public tokenCount = 0; address public forwarder; uint256 maxRoyalty; // tokenId => token owner mapping(uint256 => address) public tokenIdToTokenOwner; // root token owner address => (tokenId => approved address) mapping(address => mapping(uint256 => address)) internal rootOwnerAndTokenIdToApprovedAddress; // token owner address => token count mapping(address => uint256) internal tokenOwnerToTokenCount; // token owner => (operator address => bool) mapping(address => mapping(address => bool)) internal tokenOwnerToOperators; // tokenId => child contract mapping(uint256 => address[]) private childContracts; // tokenId => (child address => contract index+1) mapping(uint256 => mapping(address => uint256)) private childContractIndex; // tokenId => (child address => array of child tokens) mapping(uint256 => mapping(address => uint256[])) private childTokens; // tokenId => (child address => (child token => child index+1) mapping(uint256 => mapping(address => mapping(uint256 => uint256))) private childTokenIndex; // child address => childId => tokenId mapping(address => mapping(uint256 => uint256)) internal childTokenOwner; //event event RoyalityLimitChanged( address _owner, uint256 _oldLimit, uint256 _newLimit ); constructor( string memory _name, string memory _symbol, address _forwarder ) ERC721(_name, _symbol) ERC2771Context(_forwarder) { forwarder = _forwarder; maxRoyalty = 2000; } modifier onlyValidAddress() { require( msg.sender == forwarder || _msgSender() == owner(), "only owner can call this function" ); _; } /** * @dev Create a new bundle on NFTs. * @param _childContract array of all NFTs address * @param _childTokenId 2D array of all NFTs address index to NFTs ID's. */ function createBundle( address[] memory _childContract, uint256[][] memory _childTokenId, string memory _tokenURI, uint96 _feeNumerator ) external returns (uint256 _tokenId) { uint256 tokensContractIndexLength = _childTokenId.length; uint256 contractLength = _childContract.length; address _from = _msgSender(); require(tokensContractIndexLength == contractLength, "Invalid length"); if (contractLength == 1) { require( _childTokenId[0].length > 1, "tokens must be greater than one" ); } _tokenId = mint(_from, _tokenURI, _feeNumerator); for (uint256 i = 0; i < contractLength; i++) { require(_childTokenId[i].length > 0, "child tokens is empty"); for (uint256 j = 0; j < _childTokenId[i].length; j++) { receiveChild( _from, _tokenId, _childContract[i], _childTokenId[i][j] ); ERC721(_childContract[i]).transferFrom( _from, address(this), _childTokenId[i][j] ); } } emit BundleCreated(_tokenId, _msgSender()); } /** * @dev Transfer child token from top-down composable to address. * @param _fromTokenId The owning token to transfer from. * @param _to The address that receives the child token * @param _childContract The ERC721 contract of the child token. * @param _childTokenId The tokenId of the token that is being transferre */ function safeTransferChild( uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId ) external { uint256 tokenId = childTokenOwner[_childContract][_childTokenId]; require( tokenId > 0 || childTokenIndex[tokenId][_childContract][_childTokenId] > 0 ); require(tokenId == _fromTokenId); require(_to != address(0)); address rootOwner = address(rootOwnerOf(tokenId)); require( rootOwner == _msgSender() || tokenOwnerToOperators[rootOwner][_msgSender()] || rootOwnerAndTokenIdToApprovedAddress[rootOwner][tokenId] == _msgSender() ); removeChild(tokenId, _childContract, _childTokenId); IERC721(_childContract).safeTransferFrom( address(this), _to, _childTokenId ); emit TransferChild(tokenId, _to, _childContract, _childTokenId); } /** * @dev Transfer child token from top-down composable to address. * @param _fromTokenId The owning token to transfer from. * @param _to The address that receives the child token * @param _childContract The ERC721 contract of the child token. * @param _childTokenId The tokenId of the token that is being transferred. * @param _data Additional data with no specified format */ function safeTransferChild( uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId, bytes memory _data ) external { uint256 tokenId = childTokenOwner[_childContract][_childTokenId]; require( tokenId > 0 || childTokenIndex[tokenId][_childContract][_childTokenId] > 0 ); require(tokenId == _fromTokenId); require(_to != address(0)); address rootOwner = address(rootOwnerOf(tokenId)); require( rootOwner == _msgSender() || tokenOwnerToOperators[rootOwner][_msgSender()] || rootOwnerAndTokenIdToApprovedAddress[rootOwner][tokenId] == _msgSender() ); removeChild(tokenId, _childContract, _childTokenId); IERC721(_childContract).safeTransferFrom( address(this), _to, _childTokenId, _data ); emit TransferChild(tokenId, _to, _childContract, _childTokenId); } /** * @dev Transfer child token from top-down composable to address. * @param _fromTokenId The owning token to transfer from. * @param _to The address that receives the child token * @param _childContract The ERC721 contract of the child token. * @param _childTokenId The tokenId of the token that is being transferred. */ function transferChild( uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId ) external { uint256 tokenId = childTokenOwner[_childContract][_childTokenId]; require( tokenId > 0 || childTokenIndex[tokenId][_childContract][_childTokenId] > 0 ); require(tokenId == _fromTokenId); require(_to != address(0)); address rootOwner = address(rootOwnerOf(tokenId)); require( rootOwner == _msgSender() || tokenOwnerToOperators[rootOwner][_msgSender()] || rootOwnerAndTokenIdToApprovedAddress[rootOwner][tokenId] == _msgSender() ); removeChild(tokenId, _childContract, _childTokenId); //this is here to be compatible with cryptokitties and other old contracts that require being owner and approved // before transferring. //does not work with current standard which does not allow approving self, so we must let it fail in that case. //0x095ea7b3 == "approve(address,uint256)" bytes memory _calldata = abi.encodeWithSelector( 0x095ea7b3, this, _childTokenId ); assembly { let success := call( gas(), _childContract, 0, add(_calldata, 0x20), mload(_calldata), _calldata, 0 ) } IERC721(_childContract).transferFrom(address(this), _to, _childTokenId); emit TransferChild(tokenId, _to, _childContract, _childTokenId); } /** * @dev Transfer bottom-up composable child token from top-down composable to other ERC721 token. * @param _fromTokenId The owning token to transfer from. * @param _toContract The ERC721 contract of the receiving token * @param _toTokenId The receiving token * @param _childContract The bottom-up composable contract of the child token. * @param _childTokenId The token that is being transferred. * @param _data Additional data with no specified format */ function transferChildToParent( uint256 _fromTokenId, address _toContract, uint256 _toTokenId, address _childContract, uint256 _childTokenId, bytes memory _data ) external { uint256 tokenId = childTokenOwner[_childContract][_childTokenId]; require( tokenId > 0 || childTokenIndex[tokenId][_childContract][_childTokenId] > 0 ); require(tokenId == _fromTokenId); require(_toContract != address(0)); address rootOwner = address(rootOwnerOf(tokenId)); require( rootOwner == _msgSender() || tokenOwnerToOperators[rootOwner][_msgSender()] || rootOwnerAndTokenIdToApprovedAddress[rootOwner][tokenId] == _msgSender() ); removeChild(_fromTokenId, _childContract, _childTokenId); IERC998ERC721BottomUp(_childContract).transferToParent( address(address(this)), _toContract, _toTokenId, _childTokenId, _data ); emit TransferChild( _fromTokenId, _toContract, _childContract, _childTokenId ); } /** * @dev Get a child token from an ERC721 contract. * @param _from The address that owns the child token. * @param _tokenId The token that becomes the parent owner * @param _childContract The ERC721 contract of the child token * @param _childTokenId The tokenId of the child token */ function getChild( address _from, uint256 _tokenId, address _childContract, uint256 _childTokenId ) external { receiveChild(_from, _tokenId, _childContract, _childTokenId); require( _from == _msgSender() || ERC721(_childContract).isApprovedForAll(_from, _msgSender()) || ERC721(_childContract).getApproved(_childTokenId) == _msgSender() ); ERC721(_childContract).transferFrom( _from, address(this), _childTokenId ); } /** * @dev A token receives a child token * @param _from The owner of the child token. * @param _childTokenId The token that is being transferred to the parent. * @param _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId. */ function onERC721Received( address _from, uint256 _childTokenId, bytes memory _data ) external returns (bytes4) { require( _data.length > 0, "_data must contain the uint256 tokenId to transfer the child token to." ); // convert up to 32 bytes of_data to uint256, owner nft tokenId passed as uint in bytes uint256 tokenId; assembly { tokenId := calldataload(132) } if (_data.length < 32) { tokenId = tokenId >> (256 - _data.length * 8); } receiveChild(_from, tokenId, _msgSender(), _childTokenId); require( ERC721(_msgSender()).ownerOf(_childTokenId) != address(0), "Child token not owned." ); return ERC721_RECEIVED_OLD; } /** * @dev A token receives a child token * @param _from The owner of the child token. * @param _childTokenId The token that is being transferred to the parent. * @param _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId. */ function onERC721Received( address, address _from, uint256 _childTokenId, bytes memory _data ) external returns (bytes4) { require( _data.length > 0, "_data must contain the uint256 tokenId to transfer the child token to." ); // convert up to 32 bytes of_data to uint256, owner nft tokenId passed as uint in bytes uint256 tokenId; assembly { tokenId := calldataload(164) } if (_data.length < 32) { tokenId = tokenId >> (256 - _data.length * 8); } receiveChild(_from, tokenId, _msgSender(), _childTokenId); require( ERC721(_msgSender()).ownerOf(_childTokenId) != address(0), "Child token not owned." ); return ERC721_RECEIVED_NEW; } /** * @dev Unbundle all the NFTs of tokenID * @param _tokenId The token id of parent. */ function unbundle(address _to, uint256 _tokenId) external { address rootOwner = address(rootOwnerOf(_tokenId)); uint256 numOfContracts = childContracts[_tokenId].length; uint256 i = numOfContracts - 1; uint256 j = 0; uint256 numOfTokens; uint256 _childTokenId; address _childContract; require( rootOwner == _msgSender() || tokenOwnerToOperators[rootOwner][_msgSender()] || rootOwnerAndTokenIdToApprovedAddress[rootOwner][_tokenId] == _msgSender(), "Invalid caller" ); require(numOfContracts > 0, "not able to bundled"); while (i >= 0) { _childContract = childContracts[_tokenId][i]; numOfTokens = childTokens[_tokenId][_childContract].length; j = numOfTokens - 1; while (j >= 0) { _childTokenId = childTokens[_tokenId][_childContract][j]; removeChild(_tokenId, _childContract, _childTokenId); IERC721(_childContract).safeTransferFrom( address(this), _to, _childTokenId ); //Looping through all of this and sending it emit TransferChild( _tokenId, _to, _childContract, _childTokenId ); if (j == 0) break; else j -= 1; } if (i == 0) break; else i -= 1; } _burn(_msgSender(), _tokenId); } /** * @dev change the royality limit. * @param _limit limit of the royalty percentage */ function changeLimitOfRoyality(uint256 _limit) external onlyOwner { require( _limit <= _feeDenominator(), "royalty must be less than equal to 100%" ); uint256 _oldLimit = maxRoyalty; require(_limit != _oldLimit, "limit must be different"); maxRoyalty = _limit; emit RoyalityLimitChanged(_msgSender(), _oldLimit, _limit); } /** * @dev Create a new bundle on NFTs. * @param _to mint to _to address. */ function mint( address _to, string memory _tokenURI, uint96 _feeNumerator ) public onlyValidAddress returns (uint256) { require(_feeNumerator <= maxRoyalty, "Royalty fee is too high"); tokenCount++; uint256 tokenCount_ = tokenCount; tokenIdToTokenOwner[tokenCount_] = _to; tokenOwnerToTokenCount[_to]++; _setTokenURI(tokenCount_, _tokenURI); _setTokenRoyalty(tokenCount_, _to, _feeNumerator); return tokenCount_; } function _burn(address _to, uint256 tokenId) internal { require(tokenIdToTokenOwner[tokenId] == _to, "invalid token Owner"); require(tokenOwnerToTokenCount[_to] > 0, "invalid token amount"); tokenIdToTokenOwner[tokenId] = address(0); tokenOwnerToTokenCount[_to]--; } /** * @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 override returns (bool) { return tokenIdToTokenOwner[tokenId] != address(0); } function transferFrom( address _from, address _to, uint256 _tokenId ) public override { _transferFrom(_from, _to, _tokenId); } function safeTransferFrom( address _from, address _to, uint256 _tokenId ) public override { _transferFrom(_from, _to, _tokenId); if (_to.isContract()) { bytes4 retval = IERC721Receiver(_to).onERC721Received( _msgSender(), _from, _tokenId, "" ); require(retval == ERC721_RECEIVED_OLD); } } function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes memory _data ) public override { _transferFrom(_from, _to, _tokenId); if (_to.isContract()) { bytes4 retval = IERC721Receiver(_to).onERC721Received( _msgSender(), _from, _tokenId, _data ); require(retval == ERC721_RECEIVED_OLD); } } function setApprovalForAll( address _operator, bool _approved ) public override { if (_operator.isContract()) { require( isWhitelisted(_operator), "ERC998: Only whitelist is allowed" ); } require(_operator != address(0)); tokenOwnerToOperators[_msgSender()][_operator] = _approved; emit ApprovalForAll(_msgSender(), _operator, _approved); } function approve(address _approved, uint256 _tokenId) public override { if (_approved.isContract()) { require( isWhitelisted(_approved), "ERC998: Only whitelist is allowed" ); } address rootOwner = address(rootOwnerOf(_tokenId)); require( rootOwner == _msgSender() || tokenOwnerToOperators[rootOwner][_msgSender()] ); rootOwnerAndTokenIdToApprovedAddress[rootOwner][_tokenId] = _approved; emit Approval(rootOwner, _approved, _tokenId); } function supportsInterface( bytes4 interfaceId ) public view override(ERC721, ERC2981) returns (bool) { if (interfaceId == ERC998_MAGIC_VALUE) { return true; } return super.supportsInterface(interfaceId); } function _transferFrom( address _from, address _to, uint256 _tokenId ) private { require(_from != address(0)); require(tokenIdToTokenOwner[_tokenId] == _from); require(_to != address(0)); if (_msgSender() != _from) { bytes32 rootOwner; bool callSuccess; // 0xed81cdda == rootOwnerOfChild(address,uint256) bytes memory _calldata = abi.encodeWithSelector( 0xed81cdda, address(this), _tokenId ); assembly { callSuccess := staticcall( gas(), _from, add(_calldata, 0x20), mload(_calldata), _calldata, 0x20 ) if callSuccess { rootOwner := mload(_calldata) } } if (callSuccess == true) { require( rootOwner >> 224 != ERC998_MAGIC_VALUE, "Token is child of other top down composable" ); } require( tokenOwnerToOperators[_from][_msgSender()] || rootOwnerAndTokenIdToApprovedAddress[_from][_tokenId] == _msgSender() ); } // clear approval if ( rootOwnerAndTokenIdToApprovedAddress[_from][_tokenId] != address(0) ) { delete rootOwnerAndTokenIdToApprovedAddress[_from][_tokenId]; emit Approval(_from, address(0), _tokenId); } // remove and transfer token if (_from != _to) { assert(tokenOwnerToTokenCount[_from] > 0); tokenOwnerToTokenCount[_from]--; tokenIdToTokenOwner[_tokenId] = _to; tokenOwnerToTokenCount[_to]++; } emit Transfer(_from, _to, _tokenId); } /** * @dev update token mappig data for Transfer child token.. * @param _tokenId The owning token Id from child token remove. * @param _childContract The ERC721 contract of the child token. * @param _childTokenId The tokenId of the token that is being removed. */ function removeChild( uint256 _tokenId, address _childContract, uint256 _childTokenId ) private { uint256 tokenIndex = childTokenIndex[_tokenId][_childContract][ _childTokenId ]; require(tokenIndex != 0, "Child token not owned by token."); // remove child token uint256 lastTokenIndex = childTokens[_tokenId][_childContract].length - 1; uint256 lastToken = childTokens[_tokenId][_childContract][ lastTokenIndex ]; if (_childTokenId == lastToken) { childTokens[_tokenId][_childContract][tokenIndex - 1] = lastToken; childTokenIndex[_tokenId][_childContract][lastToken] = tokenIndex; } childTokens[_tokenId][_childContract].pop(); delete childTokenIndex[_tokenId][_childContract][_childTokenId]; delete childTokenOwner[_childContract][_childTokenId]; // remove contract if (lastTokenIndex == 0) { uint256 lastContractIndex = childContracts[_tokenId].length - 1; address lastContract = childContracts[_tokenId][lastContractIndex]; if (_childContract != lastContract) { uint256 contractIndex = childContractIndex[_tokenId][ _childContract ]; childContracts[_tokenId][contractIndex] = lastContract; childContractIndex[_tokenId][lastContract] = contractIndex; } childContracts[_tokenId].pop(); delete childContractIndex[_tokenId][_childContract]; } } /** * @dev update the mappings data of child token that receive from an ERC721 contract. * @param _from The address that owns the child token. * @param _tokenId The token that becomes the parent owner * @param _childContract The ERC721 contract of the child token * @param _childTokenId The tokenId of the child token */ function receiveChild( address _from, uint256 _tokenId, address _childContract, uint256 _childTokenId ) private { require( tokenIdToTokenOwner[_tokenId] != address(0), "_tokenId does not exist." ); require( childTokenIndex[_tokenId][_childContract][_childTokenId] == 0, "Cannot receive child token because it has already been received." ); uint256 childTokensLength = childTokens[_tokenId][_childContract] .length; if (childTokensLength == 0) { childContractIndex[_tokenId][_childContract] = childContracts[ _tokenId ].length; childContracts[_tokenId].push(_childContract); } childTokens[_tokenId][_childContract].push(_childTokenId); childTokenIndex[_tokenId][_childContract][_childTokenId] = childTokensLength + 1; childTokenOwner[_childContract][_childTokenId] = _tokenId; emit ReceivedChild(_from, _tokenId, _childContract, _childTokenId); } function _msgSender() internal view override(Context, ERC2771Context) returns (address sender) { sender = ERC2771Context._msgSender(); } function _msgData() internal view override(Context, ERC2771Context) returns (bytes calldata) { return ERC2771Context._msgData(); } function _ownerOfChild( address _childContract, uint256 _childTokenId ) internal view returns (address parentTokenOwner, uint256 parentTokenId) { parentTokenId = childTokenOwner[_childContract][_childTokenId]; require( parentTokenId > 0 || childTokenIndex[parentTokenId][_childContract][_childTokenId] > 0 ); return (tokenIdToTokenOwner[parentTokenId], parentTokenId); } /** * @dev Get the parent tokenId of a child token. * @param _childContract The contract address of the child token. * @param _childTokenId The tokenId of the child. * @return parentTokenOwner The parent address of the parent token and ERC998 magic value * @return parentTokenId The parent tokenId of _tokenId */ function ownerOfChild( address _childContract, uint256 _childTokenId ) external view returns (bytes32 parentTokenOwner, uint256 parentTokenId) { parentTokenId = childTokenOwner[_childContract][_childTokenId]; require( parentTokenId > 0 || childTokenIndex[parentTokenId][_childContract][_childTokenId] > 0 ); return ( (ERC998_MAGIC_VALUE << 224) | bytes20(tokenIdToTokenOwner[parentTokenId]), parentTokenId ); } /** * @dev check child exit or not. */ function childExists( address _childContract, uint256 _childTokenId ) external view returns (bool) { uint256 tokenId = childTokenOwner[_childContract][_childTokenId]; return childTokenIndex[tokenId][_childContract][_childTokenId] != 0; } /** * @dev Get total child tokens contracts amount. */ function totalChildContracts( uint256 _tokenId ) external view returns (uint256) { return childContracts[_tokenId].length; } /** * @dev Get child token contract address. */ function childContractByIndex( uint256 _tokenId, uint256 _index ) external view returns (address childContract) { require( _index < childContracts[_tokenId].length, "Contract address does not exist for address(this) token and index." ); return childContracts[_tokenId][_index]; } /** * @dev Get total child token amount. */ function totalChildTokens( uint256 _tokenId, address _childContract ) external view returns (uint256) { return childTokens[_tokenId][_childContract].length; } /** * @dev Get child token ID. */ function childTokenByIndex( uint256 _tokenId, address _childContract, uint256 _index ) external view returns (uint256 childTokenId) { require( _index < childTokens[_tokenId][_childContract].length, "Token does not own a child token at contract address and index." ); return childTokens[_tokenId][_childContract][_index]; } /** * @dev Get the root owner of tokenId. * @param _tokenId The token to query for a root owner address * @return rootOwner The root owner at the top of tree of tokens and ERC998 magic value. */ function rootOwnerOf( uint256 _tokenId ) public view returns (bytes20 rootOwner) { return rootOwnerOfChild(address(0), _tokenId); } /** * @dev Get the root owner of a child token. * @param _childContract The contract address of the child token. * @param _childTokenId The tokenId of the child. * @return rootOwner The root owner at the top of tree of tokens and ERC998 magic value. */ function rootOwnerOfChild( address _childContract, uint256 _childTokenId ) public view returns (bytes20 rootOwner) { address rootOwnerAddress; if (_childContract != address(0)) { (rootOwnerAddress, _childTokenId) = _ownerOfChild( _childContract, _childTokenId ); } else { rootOwnerAddress = tokenIdToTokenOwner[_childTokenId]; } // Case 1: Token owner is this contract and token. while (rootOwnerAddress == address(this)) { (rootOwnerAddress, _childTokenId) = _ownerOfChild( rootOwnerAddress, _childTokenId ); } bool callSuccess; bytes memory _calldata; // 0xed81cdda == rootOwnerOfChild(address,uint256) _calldata = abi.encodeWithSelector( 0xed81cdda, address(this), _childTokenId ); assembly { callSuccess := staticcall( gas(), rootOwnerAddress, add(_calldata, 0x20), mload(_calldata), _calldata, 0x20 ) if callSuccess { rootOwner := mload(_calldata) } } if (callSuccess == true && rootOwner >> 224 == ERC998_MAGIC_VALUE) { // Case 2: Token owner is other top-down composable return rootOwner; } else { // Case 3: Token owner is other contract // Or // Case 4: Token owner is user return (ERC998_MAGIC_VALUE << 224) | bytes20(rootOwnerAddress); } } /** * @dev ERC721 override function * @dev Returns the owner of the `tokenId` token. * - `tokenId` must exist. */ function ownerOf( uint256 _tokenId ) public view override returns (address tokenOwner) { tokenOwner = tokenIdToTokenOwner[_tokenId]; require(tokenOwner != address(0)); return tokenOwner; } function balanceOf( address _tokenOwner ) public view override returns (uint256) { require(_tokenOwner != address(0)); return tokenOwnerToTokenCount[_tokenOwner]; } function getApproved( uint256 _tokenId ) public view override returns (address) { address rootOwner = address(rootOwnerOf(_tokenId)); return rootOwnerAndTokenIdToApprovedAddress[rootOwner][_tokenId]; } function isApprovedForAll( address _owner, address _operator ) public view override returns (bool) { require(_owner != address(0)); require(_operator != address(0)); return tokenOwnerToOperators[_owner][_operator]; } }
// SPDX-License-Identifier: None pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; interface IERC998ERC721BottomUp { function transferToParent( address _from, address _toContract, uint256 _toTokenId, uint256 _tokenId, bytes memory _data ) external; }
// SPDX-License-Identifier: None pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; interface IERC998ERC721TopDownEnumerable { function totalChildContracts(uint256 _tokenId) external view returns (uint256); function childContractByIndex(uint256 _tokenId, uint256 _index) external view returns (address childContract); function totalChildTokens(uint256 _tokenId, address _childContract) external view returns (uint256); function childTokenByIndex( uint256 _tokenId, address _childContract, uint256 _index ) external view returns (uint256 childTokenId); }
// SPDX-License-Identifier: None pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; interface IERC998ERC721TopDown { event ReceivedChild( address indexed _from, uint256 indexed _tokenId, address indexed _childContract, uint256 _childTokenId ); event TransferChild( uint256 indexed tokenId, address indexed _to, address indexed _childContract, uint256 _childTokenId ); event BundleCreated(uint256 indexed tokenId, address _to); function rootOwnerOf(uint256 _tokenId) external view returns (bytes20 rootOwner); function rootOwnerOfChild(address _childContract, uint256 _childTokenId) external view returns (bytes20 rootOwner); function ownerOfChild(address _childContract, uint256 _childTokenId) external view returns (bytes32 parentTokenOwner, uint256 parentTokenId); function onERC721Received( address _operator, address _from, uint256 _childTokenId, bytes memory _data ) external returns (bytes4); function transferChild( uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId ) external; function safeTransferChild( uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId ) external; function safeTransferChild( uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId, bytes memory _data ) external; function transferChildToParent( uint256 _fromTokenId, address _toContract, uint256 _toTokenId, address _childContract, uint256 _childTokenId, bytes memory _data ) external; // getChild function enables older contracts like cryptokitties to be transferred into a composable // The _childContract must approve address(this) contract. Then getChild can be called. function getChild( address _from, uint256 _tokenId, address _childContract, uint256 _childTokenId ) external; }
// SPDX-License-Identifier: None pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; contract Whitelist is Ownable { using EnumerableSet for EnumerableSet.AddressSet; EnumerableSet.AddressSet private whitelistedMap; bool public isPublicSale; event Whitelisted(address indexed account, bool isWhitelisted); event ChangeSaleType(bool _isPublicSale); /** * @dev Whitelist MarketPlace address and any contract address to approve. * @param _address address want to whitelist */ function addAddress(address _address) external onlyOwner { require( !whitelistedMap.contains(_address), "WhiteList: address already whitelisted" ); whitelistedMap.add(_address); emit Whitelisted(_address, true); } /** * @dev remove from Whitelist. */ function removeAddress(address _address) external onlyOwner { require( whitelistedMap.contains(_address), "WhiteList: address already removed" ); whitelistedMap.remove(_address); emit Whitelisted(_address, false); } /** * @dev chnage sale type is public or not. */ function changeSaleType(bool _isPublicSale) external onlyOwner { require(_isPublicSale != isPublicSale, " already set"); isPublicSale = _isPublicSale; emit ChangeSaleType(_isPublicSale); } /** * @notice Returns if an _address is in the whitelisted * @param _address address of the strategy */ function isWhitelisted(address _address) public view returns (bool) { return whitelistedMap.contains(_address); } /** * @notice View number of whitelisted */ function viewCountWhitelisted() external view returns (uint256) { return whitelistedMap.length(); } /** * @notice See whitelisted in the system * @param cursor cursor (should start at 0 for first request) * @param size size of the response (e.g., 50) */ function viewWhitelisted(uint256 cursor, uint256 size) external view returns (address[] memory, uint256) { uint256 length = size; if (length > whitelistedMap.length() - cursor) { length = whitelistedMap.length() - cursor; } address[] memory whitelisted = new address[](length); for (uint256 i = 0; i < length; i++) { whitelisted[i] = whitelistedMap.at(cursor + i); } return (whitelisted, cursor + length); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IRoyaltyFeeRegistry { function updateRoyaltyFeeLimitForERC721(uint256 _royaltyFeeLimit) external; function updateRoyaltyFeeLimitForERC1155(uint256 _royaltyFeeLimit) external; function updateRoyaltyReceiverLimit(uint256 newMaxNumberOfReceivers) external; function updateRoyaltyInfoForNFT( address collection, uint256 tokenId, address[] memory receivers, uint256[] memory fees ) external; function royaltyFeeInfoCollection(address collection) external view returns (address, uint256); function royaltyFeeInfoCollection(address collection, uint256 tokenId) external view returns (address[] memory, uint256[] memory); function removeRoyaltyInfoForNFT(address collection, uint256 tokenId) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol) pragma solidity ^0.8.9; import "../utils/Context.sol"; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771Context is Context { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable _trustedForwarder; /// @custom:oz-upgrades-unsafe-allow constructor constructor(address trustedForwarder) { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. /// @solidity memory-safe-assembly assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @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.7.0) (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev See {ERC721-_burn}. This override additionally checks to see if a * token-specific URI was set for the token, and if so, it deletes the token URI from * the storage mapping. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: 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 = _owners[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 = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor 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 nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _safeTransfer(from, to, tokenId, data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits 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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @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. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_forwarder","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_to","type":"address"}],"name":"BundleCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_isPublicSale","type":"bool"}],"name":"ChangeSaleType","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"_childContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"ReceivedChild","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"_oldLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newLimit","type":"uint256"}],"name":"RoyalityLimitChanged","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":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_childContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"TransferChild","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"Whitelisted","type":"event"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_approved","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"changeLimitOfRoyality","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isPublicSale","type":"bool"}],"name":"changeSaleType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"childContractByIndex","outputs":[{"internalType":"address","name":"childContract","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"childExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"childTokenByIndex","outputs":[{"internalType":"uint256","name":"childTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_childContract","type":"address[]"},{"internalType":"uint256[][]","name":"_childTokenId","type":"uint256[][]"},{"internalType":"string","name":"_tokenURI","type":"string"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"createBundle","outputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"forwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"getChild","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":[],"name":"isPublicSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"string","name":"_tokenURI","type":"string"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"tokenOwner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"ownerOfChild","outputs":[{"internalType":"bytes32","name":"parentTokenOwner","type":"bytes32"},{"internalType":"uint256","name":"parentTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"rootOwnerOf","outputs":[{"internalType":"bytes20","name":"rootOwner","type":"bytes20"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"rootOwnerOfChild","outputs":[{"internalType":"bytes20","name":"rootOwner","type":"bytes20"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"safeTransferChild","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferChild","outputs":[],"stateMutability":"nonpayable","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":"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":"tokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToTokenOwner","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":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"totalChildContracts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_childContract","type":"address"}],"name":"totalChildTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"transferChild","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"internalType":"address","name":"_toContract","type":"address"},{"internalType":"uint256","name":"_toTokenId","type":"uint256"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"transferChildToParent","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"unbundle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"viewCountWhitelisted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cursor","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"name":"viewWhitelisted","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a06040526000600d553480156200001657600080fd5b5060405162004aa238038062004aa28339810160408190526200003991620002d7565b6001600160a01b03811660805282826200005c62000056620000b9565b620000d5565b81516200007190600690602085019062000164565b5080516200008790600790602084019062000164565b5050600e80546001600160a01b0319166001600160a01b03939093169290921790915550506107d0600f5550620003a1565b6000620000d06200012760201b620029821760201c565b905090565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6080516000906001600160a01b03163314156200014b575060131936013560601c90565b620000d06200016060201b620029c71760201c565b3390565b828054620001729062000364565b90600052602060002090601f016020900481019282620001965760008555620001e1565b82601f10620001b157805160ff1916838001178555620001e1565b82800160010185558215620001e1579182015b82811115620001e1578251825591602001919060010190620001c4565b50620001ef929150620001f3565b5090565b5b80821115620001ef5760008155600101620001f4565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023257600080fd5b81516001600160401b03808211156200024f576200024f6200020a565b604051601f8301601f19908116603f011681019082821181831017156200027a576200027a6200020a565b816040528381526020925086838588010111156200029757600080fd5b600091505b83821015620002bb57858201830151818301840152908201906200029c565b83821115620002cd5760008385830101525b9695505050505050565b600080600060608486031215620002ed57600080fd5b83516001600160401b03808211156200030557600080fd5b620003138783880162000220565b945060208601519150808211156200032a57600080fd5b50620003398682870162000220565b604086015190935090506001600160a01b03811681146200035957600080fd5b809150509250925092565b600181811c908216806200037957607f821691505b602082108114156200039b57634e487b7160e01b600052602260045260246000fd5b50919050565b6080516146de620003c460003960008181610519015261298601526146de6000f3fe608060405234801561001057600080fd5b50600436106102955760003560e01c8063715018a611610167578063ba6b5f96116100ce578063ed81cdda11610087578063ed81cdda146106cd578063f0b9e5ba146106e0578063f0f89871146106f3578063f2fde38b1461071c578063f645d4f91461072f578063fbe90b4d1461074257600080fd5b8063ba6b5f9614610638578063bef44f181461064b578063c87b56dd1461065e578063d318830214610671578063e985e9c514610692578063eadb80b8146106a557600080fd5b806395d89b411161012057806395d89b41146105e15780639f181b5e146105e9578063a22cb465146105f2578063a5a865dc14610605578063b4dc3dc714610612578063b88d4fde1461062557600080fd5b8063715018a61461056f5780637b17b7a81461057757806388347ef41461058a5780638d81f51e1461059d5780638da5cb5b146105b05780638da7d0b5146105c157600080fd5b80632a55205a1161020b57806343a61a8e116101c457806343a61a8e146104775780634ba79dfe146104a35780635680a3ad146104b6578063572b6c05146105095780636352211e1461054957806370a082311461055c57600080fd5b80632a55205a146103c3578063315a403d146103f557806335b21ceb1461040857806338eada1c1461043e5780633af32abf1461045157806342842e0e1461046457600080fd5b80630d5a621b1161025d5780630d5a621b1461032a5780630fee7d2a1461033d578063150b7a0214610350578063160b01a11461037c5780631d98f3c51461039d57806323b872dd146103b057600080fd5b806301ffc9a71461029a57806306fdde03146102c2578063081812fc146102d757806308937f6214610302578063095ea7b314610317575b600080fd5b6102ad6102a8366004613b65565b61074a565b60405190151581526020015b60405180910390f35b6102ca61077c565b6040516102b99190613bda565b6102ea6102e5366004613bed565b61080e565b6040516001600160a01b0390911681526020016102b9565b610315610310366004613cd2565b610848565b005b610315610325366004613d50565b610a35565b6102ea610338366004613d7c565b610b53565b61031561034b366004613bed565b610c1d565b61036361035e366004613d9e565b610d34565b6040516001600160e01b031990911681526020016102b9565b61038f61038a366004613e0a565b610e6c565b6040519081526020016102b9565b6103156103ab366004613e42565b610f4b565b6103156103be366004613e8a565b611132565b6103d66103d1366004613d7c565b611142565b604080516001600160a01b0390931683526020830191909152016102b9565b610315610403366004613ec8565b6111ee565b61038f610416366004613ee5565b60009182526016602090815260408084206001600160a01b0393909316845291905290205490565b61031561044c366004613f15565b611285565b6102ad61045f366004613f15565b611343565b610315610472366004613e8a565b611350565b61048a610485366004613bed565b611430565b6040516001600160601b031990911681526020016102b9565b6103156104b1366004613f15565b61143d565b6102ad6104c4366004613d50565b6001600160a01b038216600081815260186020908152604080832085845282528083205483526017825280832093835292815282822084835290522054151592915050565b6102ad610517366004613f15565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b6102ea610557366004613bed565b6114ef565b61038f61056a366004613f15565b611516565b610315611547565b61038f610585366004613f49565b61155b565b61038f6105983660046140b3565b6116be565b6103156105ab3660046141aa565b61199f565b6002546001600160a01b03166102ea565b61038f6105cf366004613bed565b60009081526014602052604090205490565b6102ca611b89565b61038f600d5481565b610315610600366004614220565b611b98565b6005546102ad9060ff1681565b610315610620366004613d50565b611c79565b610315610633366004613d9e565b611f6a565b61031561064636600461424e565b612029565b610315610659366004613e42565b6121d5565b6102ca61066c366004613bed565b6123f7565b61068461067f366004613d7c565b612500565b6040516102b9929190614286565b6102ad6106a03660046142d7565b6125f5565b6106b86106b3366004613d50565b61264c565b604080519283526020830191909152016102b9565b61048a6106db366004613d50565b6126d5565b6103636106ee366004614305565b6127c7565b6102ea610701366004613bed565b6010602052600090815260409020546001600160a01b031681565b61031561072a366004613f15565b6128f8565b600e546102ea906001600160a01b031681565b61038f612971565b60006001600160e01b0319821663cd740db560e01b141561076d57506001919050565b610776826129cb565b92915050565b60606006805461078b9061435e565b80601f01602080910402602001604051908101604052809291908181526020018280546107b79061435e565b80156108045780601f106107d957610100808354040283529160200191610804565b820191906000526020600020905b8154815290600101906020018083116107e757829003601f168201915b5050505050905090565b60008061081a83611430565b60601c600090815260116020908152604080832095835294905292909220546001600160a01b031692915050565b6001600160a01b0383166000908152601860209081526040808320858452909152902054801515806108a3575060008181526017602090815260408083206001600160a01b0388168452825280832086845290915290205415155b6108ac57600080fd5b8681146108b857600080fd5b6001600160a01b0386166108cb57600080fd5b60006108d682611430565b60601c90506108e3612a0b565b6001600160a01b0316816001600160a01b0316148061093c57506001600160a01b03811660009081526013602052604081209061091e612a0b565b6001600160a01b0316815260208101919091526040016000205460ff165b80610975575061094a612a0b565b6001600160a01b03828116600090815260116020908152604080832087845290915290205481169116145b61097e57600080fd5b610989888686612a15565b6040516307a8567d60e51b81526001600160a01b0386169063f50acfa0906109bd9030908b908b908a908a90600401614399565b600060405180830381600087803b1580156109d757600080fd5b505af11580156109eb573d6000803e3d6000fd5b50505050846001600160a01b0316876001600160a01b03168960008051602061468983398151915287604051610a2391815260200190565b60405180910390a45050505050505050565b6001600160a01b0382163b15610a7357610a4e82611343565b610a735760405162461bcd60e51b8152600401610a6a906143de565b60405180910390fd5b6000610a7e82611430565b60601c9050610a8b612a0b565b6001600160a01b0316816001600160a01b03161480610ae457506001600160a01b038116600090815260136020526040812090610ac6612a0b565b6001600160a01b0316815260208101919091526040016000205460ff165b610aed57600080fd5b6001600160a01b03818116600081815260116020908152604080832087845290915280822080546001600160a01b031916948816948517905551859392917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000828152601460205260408120548210610be15760405162461bcd60e51b815260206004820152604260248201527f436f6e7472616374206164647265737320646f6573206e6f742065786973742060448201527f666f72206164647265737328746869732920746f6b656e20616e6420696e64656064820152613c1760f11b608482015260a401610a6a565b6000838152601460205260409020805483908110610c0157610c0161441f565b6000918252602090912001546001600160a01b03169392505050565b610c25612d5e565b612710811115610c875760405162461bcd60e51b815260206004820152602760248201527f726f79616c7479206d757374206265206c657373207468616e20657175616c20604482015266746f203130302560c81b6064820152608401610a6a565b600f5481811415610cda5760405162461bcd60e51b815260206004820152601760248201527f6c696d6974206d75737420626520646966666572656e740000000000000000006044820152606401610a6a565b600f8290557f24e9ac82874a292ce9f8cd8bab098623c61cf4c32301b7a050722aa0dd765e85610d08612a0b565b604080516001600160a01b03909216825260208201849052810184905260600160405180910390a15050565b600080825111610d565760405162461bcd60e51b8152600401610a6a90614435565b815160a4359060201115610d7f578251610d719060086144b7565b610d7d906101006144d6565b1c5b610d928582610d8c612a0b565b87612dd7565b6000610d9c612a0b565b6001600160a01b0316636352211e866040518263ffffffff1660e01b8152600401610dc991815260200190565b602060405180830381865afa158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a91906144ed565b6001600160a01b03161415610e5a5760405162461bcd60e51b815260206004820152601660248201527521b434b632103a37b5b2b7103737ba1037bbb732b21760511b6044820152606401610a6a565b50630a85bd0160e11b95945050505050565b60008381526016602090815260408083206001600160a01b03861684529091528120548210610f035760405162461bcd60e51b815260206004820152603f60248201527f546f6b656e20646f6573206e6f74206f776e2061206368696c6420746f6b656e60448201527f20617420636f6e7472616374206164647265737320616e6420696e6465782e006064820152608401610a6a565b60008481526016602090815260408083206001600160a01b03871684529091529020805483908110610f3757610f3761441f565b906000526020600020015490509392505050565b6001600160a01b038216600090815260186020908152604080832084845290915290205480151580610fa6575060008181526017602090815260408083206001600160a01b0387168452825280832085845290915290205415155b610faf57600080fd5b848114610fbb57600080fd5b6001600160a01b038416610fce57600080fd5b6000610fd982611430565b60601c9050610fe6612a0b565b6001600160a01b0316816001600160a01b0316148061103f57506001600160a01b038116600090815260136020526040812090611021612a0b565b6001600160a01b0316815260208101919091526040016000205460ff165b80611078575061104d612a0b565b6001600160a01b03828116600090815260116020908152604080832087845290915290205481169116145b61108157600080fd5b61108c828585612a15565b604051632142170760e11b81526001600160a01b038516906342842e0e906110bc9030908990889060040161450a565b600060405180830381600087803b1580156110d657600080fd5b505af11580156110ea573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b0316836000805160206146898339815191528660405161112291815260200190565b60405180910390a4505050505050565b61113d838383613018565b505050565b60008281526001602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916111b75750604080518082019091526000546001600160a01b0381168252600160a01b90046001600160601b031660208201525b6020810151600090612710906111d6906001600160601b0316876144b7565b6111e09190614544565b915196919550909350505050565b6111f6612d5e565b60055460ff161515811515141561123e5760405162461bcd60e51b815260206004820152600c60248201526b08185b1c9958591e481cd95d60a21b6044820152606401610a6a565b6005805460ff19168215159081179091556040519081527f91fc31429831c0c8ac26b9e7b1f6e2755d47bdfb3e8a18d8a7e37bca99b5a4849060200160405180910390a150565b61128d612d5e565b61129860038261335a565b156112f45760405162461bcd60e51b815260206004820152602660248201527f57686974654c6973743a206164647265737320616c72656164792077686974656044820152651b1a5cdd195960d21b6064820152608401610a6a565b6112ff60038261337f565b50604051600181526001600160a01b038216907fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f26440906020015b60405180910390a250565b600061077660038361335a565b61135b838383613018565b6001600160a01b0382163b1561113d576000826001600160a01b031663150b7a02611384612a0b565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908716602482015260448101859052608060648201526000608482015260a4016020604051808303816000875af11580156113e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140b9190614558565b90506001600160e01b0319811663785cf2dd60e11b1461142a57600080fd5b50505050565b60006107766000836126d5565b611445612d5e565b61145060038261335a565b6114a75760405162461bcd60e51b815260206004820152602260248201527f57686974654c6973743a206164647265737320616c72656164792072656d6f76604482015261195960f21b6064820152608401610a6a565b6114b2600382613394565b50604051600081526001600160a01b038216907fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f2644090602001611338565b6000818152601060205260409020546001600160a01b03168061151157600080fd5b919050565b60006001600160a01b03821661152b57600080fd5b506001600160a01b031660009081526012602052604090205490565b61154f612d5e565b61155960006133a9565b565b600e546000906001600160a01b031633148061159157506002546001600160a01b0316611586612a0b565b6001600160a01b0316145b6115e75760405162461bcd60e51b815260206004820152602160248201527f6f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6044820152603760f91b6064820152608401610a6a565b600f54826001600160601b031611156116425760405162461bcd60e51b815260206004820152601760248201527f526f79616c74792066656520697320746f6f20686967680000000000000000006044820152606401610a6a565b600d805490600061165283614575565b9091555050600d54600081815260106020908152604080832080546001600160a01b0319166001600160a01b038a1690811790915583526012909152812080549161169c83614575565b91905055506116ab81856133fb565b6116b6818685613495565b949350505050565b8251845160009190826116cf612a0b565b90508183146117115760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b6044820152606401610a6a565b81600114156117855760018760008151811061172f5761172f61441f565b602002602001015151116117855760405162461bcd60e51b815260206004820152601f60248201527f746f6b656e73206d7573742062652067726561746572207468616e206f6e65006044820152606401610a6a565b61179081878761155b565b935060005b8281101561194e5760008882815181106117b1576117b161441f565b602002602001015151116117ff5760405162461bcd60e51b81526020600482015260156024820152746368696c6420746f6b656e7320697320656d70747960581b6044820152606401610a6a565b60005b8882815181106118145761181461441f565b60200260200101515181101561193b5761187b83878c858151811061183b5761183b61441f565b60200260200101518c86815181106118555761185561441f565b6020026020010151858151811061186e5761186e61441f565b6020026020010151612dd7565b89828151811061188d5761188d61441f565b60200260200101516001600160a01b03166323b872dd84308c86815181106118b7576118b761441f565b602002602001015185815181106118d0576118d061441f565b60200260200101516040518463ffffffff1660e01b81526004016118f69392919061450a565b600060405180830381600087803b15801561191057600080fd5b505af1158015611924573d6000803e3d6000fd5b50505050808061193390614575565b915050611802565b508061194681614575565b915050611795565b50837f70840306de89dda231cb16a2feaa0e2a8dbff922cd2500962c55607b4f339b76611979612a0b565b6040516001600160a01b03909116815260200160405180910390a2505050949350505050565b6001600160a01b0383166000908152601860209081526040808320858452909152902054801515806119fa575060008181526017602090815260408083206001600160a01b0388168452825280832086845290915290205415155b611a0357600080fd5b858114611a0f57600080fd5b6001600160a01b038516611a2257600080fd5b6000611a2d82611430565b60601c9050611a3a612a0b565b6001600160a01b0316816001600160a01b03161480611a9357506001600160a01b038116600090815260136020526040812090611a75612a0b565b6001600160a01b0316815260208101919091526040016000205460ff165b80611acc5750611aa1612a0b565b6001600160a01b03828116600090815260116020908152604080832087845290915290205481169116145b611ad557600080fd5b611ae0828686612a15565b604051635c46a7ef60e11b81526001600160a01b0386169063b88d4fde90611b129030908a9089908990600401614590565b600060405180830381600087803b158015611b2c57600080fd5b505af1158015611b40573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b03168360008051602061468983398151915287604051611b7891815260200190565b60405180910390a450505050505050565b60606007805461078b9061435e565b6001600160a01b0382163b15611bcd57611bb182611343565b611bcd5760405162461bcd60e51b8152600401610a6a906143de565b6001600160a01b038216611be057600080fd5b8060136000611bed612a0b565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155611c31612a0b565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611c6d911515815260200190565b60405180910390a35050565b6000611c8482611430565b60008381526014602052604081205460609290921c9250611ca66001836144d6565b9050600080806000611cb6612a0b565b6001600160a01b0316876001600160a01b03161480611d0f57506001600160a01b038716600090815260136020526040812090611cf1612a0b565b6001600160a01b0316815260208101919091526040016000205460ff165b80611d485750611d1d612a0b565b6001600160a01b0388811660009081526011602090815260408083208d845290915290205481169116145b611d855760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b0b63632b960911b6044820152606401610a6a565b60008611611dcb5760405162461bcd60e51b81526020600482015260136024820152721b9bdd0818589b19481d1bc8189d5b991b1959606a1b6044820152606401610a6a565b6000888152601460205260409020805486908110611deb57611deb61441f565b60009182526020808320909101548a83526016825260408084206001600160a01b039092168085529190925291205493509050611e296001846144d6565b93505b60008881526016602090815260408083206001600160a01b03851684529091529020805485908110611e6057611e6061441f565b90600052602060002001549150611e78888284612a15565b604051632142170760e11b81526001600160a01b038216906342842e0e90611ea89030908d90879060040161450a565b600060405180830381600087803b158015611ec257600080fd5b505af1158015611ed6573d6000803e3d6000fd5b50505050806001600160a01b0316896001600160a01b03168960008051602061468983398151915285604051611f0e91815260200190565b60405180910390a483611f2057611f32565b611f2b6001856144d6565b9350611e2c565b84611f3c57611f4e565b611f476001866144d6565b9450611dcb565b611f5f611f59612a0b565b896135a3565b505050505050505050565b611f75848484613018565b6001600160a01b0383163b1561142a576000836001600160a01b031663150b7a02611f9e612a0b565b8786866040518563ffffffff1660e01b8152600401611fc09493929190614590565b6020604051808303816000875af1158015611fdf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120039190614558565b90506001600160e01b0319811663785cf2dd60e11b1461202257600080fd5b5050505050565b61203584848484612dd7565b61203d612a0b565b6001600160a01b0316846001600160a01b031614806120de5750816001600160a01b031663e985e9c58561206f612a0b565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa1580156120ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120de91906145cd565b8061216457506120ec612a0b565b60405163020604bf60e21b8152600481018390526001600160a01b039182169184169063081812fc90602401602060405180830381865afa158015612135573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215991906144ed565b6001600160a01b0316145b61216d57600080fd5b6040516323b872dd60e01b81526001600160a01b038316906323b872dd9061219d9087903090869060040161450a565b600060405180830381600087803b1580156121b757600080fd5b505af11580156121cb573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038216600090815260186020908152604080832084845290915290205480151580612230575060008181526017602090815260408083206001600160a01b0387168452825280832085845290915290205415155b61223957600080fd5b84811461224557600080fd5b6001600160a01b03841661225857600080fd5b600061226382611430565b60601c9050612270612a0b565b6001600160a01b0316816001600160a01b031614806122c957506001600160a01b0381166000908152601360205260408120906122ab612a0b565b6001600160a01b0316815260208101919091526040016000205460ff165b8061230257506122d7612a0b565b6001600160a01b03828116600090815260116020908152604080832087845290915290205481169116145b61230b57600080fd5b612316828585612a15565b6040805130602482015260448082018690528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b178152815160009183919083895af1506040516323b872dd60e01b81526001600160a01b038616906323b872dd906123919030908a90899060040161450a565b600060405180830381600087803b1580156123ab57600080fd5b505af11580156123bf573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b03168460008051602061468983398151915287604051611b7891815260200190565b6060612402826136a5565b6000828152600c60205260408120805461241b9061435e565b80601f01602080910402602001604051908101604052809291908181526020018280546124479061435e565b80156124945780601f1061246957610100808354040283529160200191612494565b820191906000526020600020905b81548152906001019060200180831161247757829003601f168201915b5050505050905060006124b260408051602081019091526000815290565b90508051600014156124c5575092915050565b8151156124f75780826040516020016124df9291906145ea565b60405160208183030381529060405292505050919050565b6116b684613709565b606060008284612510600361377c565b61251a91906144d6565b811115612539578461252c600361377c565b61253691906144d6565b90505b60008167ffffffffffffffff81111561255457612554613c1b565b60405190808252806020026020018201604052801561257d578160200160208202803683370190505b50905060005b828110156125dc576125a06125988289614619565b600390613786565b8282815181106125b2576125b261441f565b6001600160a01b0390921660209283029190910190910152806125d481614575565b915050612583565b50806125e88388614619565b9350935050509250929050565b60006001600160a01b03831661260a57600080fd5b6001600160a01b03821661261d57600080fd5b506001600160a01b03918216600090815260136020908152604080832093909416825291909152205460ff1690565b6001600160a01b0382166000908152601860209081526040808320848452909152812054801515806126a7575060008181526017602090815260408083206001600160a01b0388168452825280832086845290915290205415155b6126b057600080fd5b60008181526010602052604090205460601b6001600160601b03191694909350915050565b6000806001600160a01b038416156126fa576126f18484613792565b93509050612714565b506000828152601060205260409020546001600160a01b03165b6001600160a01b03811630141561272f576126f18184613792565b604080513060248201526044808201869052825180830390910181526064909101909152602080820180516001600160e01b03166376c0e6ed60e11b17815282516000939291839190865afa9150811561278857805193505b60018215151480156127ae575060e084901c6001600160601b03191663cd740db560e01b145b156127bb57505050610776565b505060601b9050610776565b6000808251116127e95760405162461bcd60e51b8152600401610a6a90614435565b815160843590602011156128125782516128049060086144b7565b612810906101006144d6565b1c5b61281f8582610d8c612a0b565b6000612829612a0b565b6001600160a01b0316636352211e866040518263ffffffff1660e01b815260040161285691815260200190565b602060405180830381865afa158015612873573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289791906144ed565b6001600160a01b031614156128e75760405162461bcd60e51b815260206004820152601660248201527521b434b632103a37b5b2b7103737ba1037bbb732b21760511b6044820152606401610a6a565b5063785cf2dd60e11b949350505050565b612900612d5e565b6001600160a01b0381166129655760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a6a565b61296e816133a9565b50565b600061297d600361377c565b905090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163314156129c2575060131936013560601c90565b503390565b3390565b60006001600160e01b031982166380ac58cd60e01b14806129fc57506001600160e01b03198216635b5e139f60e01b145b80610776575061077682613817565b600061297d612982565b60008381526017602090815260408083206001600160a01b0386168452825280832084845290915290205480612a8d5760405162461bcd60e51b815260206004820152601f60248201527f4368696c6420746f6b656e206e6f74206f776e656420627920746f6b656e2e006044820152606401610a6a565b60008481526016602090815260408083206001600160a01b0387168452909152812054612abc906001906144d6565b60008681526016602090815260408083206001600160a01b038916845290915281208054929350909183908110612af557612af561441f565b9060005260206000200154905080841415612b825760008681526016602090815260408083206001600160a01b038916845290915290208190612b396001866144d6565b81548110612b4957612b4961441f565b60009182526020808320909101929092558781526017825260408082206001600160a01b03891683528352808220848352909252208390555b60008681526016602090815260408083206001600160a01b03891684529091529020805480612bb357612bb3614631565b6000828152602080822083016000199081018390559092019092558782526017815260408083206001600160a01b038916808552908352818420888552835281842084905583526018825280832087845290915281205581612d5657600086815260146020526040812054612c2a906001906144d6565b60008881526014602052604081208054929350909183908110612c4f57612c4f61441f565b6000918252602090912001546001600160a01b03908116915087168114612cf25760008881526015602090815260408083206001600160a01b038b1684528252808320548b84526014909252909120805483919083908110612cb357612cb361441f565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790558b8252601581526040808320938616835292905220555b6000888152601460205260409020805480612d0f57612d0f614631565b60008281526020808220830160001990810180546001600160a01b03191690559092019092558982526015815260408083206001600160a01b038b16845290915281205550505b505050505050565b612d66612a0b565b6001600160a01b0316612d816002546001600160a01b031690565b6001600160a01b0316146115595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a6a565b6000838152601060205260409020546001600160a01b0316612e3b5760405162461bcd60e51b815260206004820152601860248201527f5f746f6b656e496420646f6573206e6f742065786973742e00000000000000006044820152606401610a6a565b60008381526017602090815260408083206001600160a01b0386168452825280832084845290915290205415612edb576040805162461bcd60e51b81526020600482015260248101919091527f43616e6e6f742072656365697665206368696c6420746f6b656e20626563617560448201527f73652069742068617320616c7265616479206265656e2072656365697665642e6064820152608401610a6a565b60008381526016602090815260408083206001600160a01b038616845290915290205480612f535760008481526014602081815260408084208054601584528286206001600160a01b038a16808852908552928620819055938352600184018155845292200180546001600160a01b03191690911790555b60008481526016602090815260408083206001600160a01b0387168452825282208054600181810183559184529190922001839055612f93908290614619565b60008581526017602090815260408083206001600160a01b03888116808652918452828520888652845282852095909555808452601883528184208785528352928190208890555185815291928792908916917f0371ddf2288ad1ba92626a7e31c86a9d006e592cfe57d7d946ef08b13457c08b910160405180910390a45050505050565b6001600160a01b03831661302b57600080fd5b6000818152601060205260409020546001600160a01b0384811691161461305157600080fd5b6001600160a01b03821661306457600080fd5b826001600160a01b0316613076612a0b565b6001600160a01b0316146131de57604080513060248201526044808201849052825180830390910181526064909101909152602080820180516001600160e01b03166376c0e6ed60e11b17815282516000938493909290918391895afa915081156130e057805192505b6001821515141561315a5760e083901c63cd740db560e01b141561315a5760405162461bcd60e51b815260206004820152602b60248201527f546f6b656e206973206368696c64206f66206f7468657220746f7020646f776e60448201526a20636f6d706f7361626c6560a81b6064820152608401610a6a565b6001600160a01b03861660009081526013602052604081209061317b612a0b565b6001600160a01b0316815260208101919091526040016000205460ff16806131d157506131a6612a0b565b6001600160a01b03878116600090815260116020908152604080832089845290915290205481169116145b6131da57600080fd5b5050505b6001600160a01b0383811660009081526011602090815260408083208584529091529020541615613265576001600160a01b038316600081815260116020908152604080832085845290915280822080546001600160a01b0319169055518392907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925908390a45b816001600160a01b0316836001600160a01b031614613314576001600160a01b0383166000908152601260205260409020546132a3576132a3614647565b6001600160a01b03831660009081526012602052604081208054916132c78361465d565b9091555050600081815260106020908152604080832080546001600160a01b0319166001600160a01b03871690811790915583526012909152812080549161330e83614575565b91905055505b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6000613378836001600160a01b03841661384c565b6000613378836001600160a01b03841661389b565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000828152601060205260409020546001600160a01b03166134765760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610a6a565b6000828152600c60209081526040909120825161113d92840190613ab6565b6127106001600160601b03821611156135035760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610a6a565b6001600160a01b0382166135595760405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606401610a6a565b6040805180820182526001600160a01b0393841681526001600160601b0392831660208083019182526000968752600190529190942093519051909116600160a01b029116179055565b6000818152601060205260409020546001600160a01b038381169116146136025760405162461bcd60e51b815260206004820152601360248201527234b73b30b634b2103a37b5b2b71027bbb732b960691b6044820152606401610a6a565b6001600160a01b03821660009081526012602052604090205461365e5760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081d1bdad95b88185b5bdd5b9d60621b6044820152606401610a6a565b600081815260106020908152604080832080546001600160a01b03191690556001600160a01b03851683526012909152812080549161369c8361465d565b91905055505050565b6000818152601060205260409020546001600160a01b031661296e5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610a6a565b6060613714826136a5565b600061372b60408051602081019091526000815290565b9050600081511161374b5760405180602001604052806000815250613378565b806137558461398e565b6040516020016137669291906145ea565b6040516020818303038152906040529392505050565b6000610776825490565b60006133788383613a8c565b6001600160a01b0382166000908152601860209081526040808320848452909152812054801515806137ed575060008181526017602090815260408083206001600160a01b0388168452825280832086845290915290205415155b6137f657600080fd5b6000818152601060205260409020546001600160a01b031691509250929050565b60006001600160e01b0319821663152a902d60e11b148061077657506301ffc9a760e01b6001600160e01b0319831614610776565b600081815260018301602052604081205461389357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610776565b506000610776565b600081815260018301602052604081205480156139845760006138bf6001836144d6565b85549091506000906138d3906001906144d6565b90508181146139385760008660000182815481106138f3576138f361441f565b90600052602060002001549050808760000184815481106139165761391661441f565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061394957613949614631565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610776565b6000915050610776565b6060816139b25750506040805180820190915260018152600360fc1b602082015290565b8160005b81156139dc57806139c681614575565b91506139d59050600a83614544565b91506139b6565b60008167ffffffffffffffff8111156139f7576139f7613c1b565b6040519080825280601f01601f191660200182016040528015613a21576020820181803683370190505b5090505b84156116b657613a366001836144d6565b9150613a43600a86614674565b613a4e906030614619565b60f81b818381518110613a6357613a6361441f565b60200101906001600160f81b031916908160001a905350613a85600a86614544565b9450613a25565b6000826000018281548110613aa357613aa361441f565b9060005260206000200154905092915050565b828054613ac29061435e565b90600052602060002090601f016020900481019282613ae45760008555613b2a565b82601f10613afd57805160ff1916838001178555613b2a565b82800160010185558215613b2a579182015b82811115613b2a578251825591602001919060010190613b0f565b50613b36929150613b3a565b5090565b5b80821115613b365760008155600101613b3b565b6001600160e01b03198116811461296e57600080fd5b600060208284031215613b7757600080fd5b813561337881613b4f565b60005b83811015613b9d578181015183820152602001613b85565b8381111561142a5750506000910152565b60008151808452613bc6816020860160208601613b82565b601f01601f19169290920160200192915050565b6020815260006133786020830184613bae565b600060208284031215613bff57600080fd5b5035919050565b6001600160a01b038116811461296e57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613c5a57613c5a613c1b565b604052919050565b600082601f830112613c7357600080fd5b813567ffffffffffffffff811115613c8d57613c8d613c1b565b613ca0601f8201601f1916602001613c31565b818152846020838601011115613cb557600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c08789031215613ceb57600080fd5b863595506020870135613cfd81613c06565b9450604087013593506060870135613d1481613c06565b92506080870135915060a087013567ffffffffffffffff811115613d3757600080fd5b613d4389828a01613c62565b9150509295509295509295565b60008060408385031215613d6357600080fd5b8235613d6e81613c06565b946020939093013593505050565b60008060408385031215613d8f57600080fd5b50508035926020909101359150565b60008060008060808587031215613db457600080fd5b8435613dbf81613c06565b93506020850135613dcf81613c06565b925060408501359150606085013567ffffffffffffffff811115613df257600080fd5b613dfe87828801613c62565b91505092959194509250565b600080600060608486031215613e1f57600080fd5b833592506020840135613e3181613c06565b929592945050506040919091013590565b60008060008060808587031215613e5857600080fd5b843593506020850135613e6a81613c06565b92506040850135613e7a81613c06565b9396929550929360600135925050565b600080600060608486031215613e9f57600080fd5b8335613eaa81613c06565b92506020840135613e3181613c06565b801515811461296e57600080fd5b600060208284031215613eda57600080fd5b813561337881613eba565b60008060408385031215613ef857600080fd5b823591506020830135613f0a81613c06565b809150509250929050565b600060208284031215613f2757600080fd5b813561337881613c06565b80356001600160601b038116811461151157600080fd5b600080600060608486031215613f5e57600080fd5b8335613f6981613c06565b9250602084013567ffffffffffffffff811115613f8557600080fd5b613f9186828701613c62565b925050613fa060408501613f32565b90509250925092565b600067ffffffffffffffff821115613fc357613fc3613c1b565b5060051b60200190565b600082601f830112613fde57600080fd5b81356020613ff3613fee83613fa9565b613c31565b828152600592831b850182019282820191908785111561401257600080fd5b8387015b858110156140a657803567ffffffffffffffff8111156140365760008081fd5b8801603f81018a136140485760008081fd5b85810135604061405a613fee83613fa9565b82815291851b8301810191888101908d8411156140775760008081fd5b938201935b838510156140955784358252938901939089019061407c565b885250505093850193508401614016565b5090979650505050505050565b600080600080608085870312156140c957600080fd5b843567ffffffffffffffff808211156140e157600080fd5b818701915087601f8301126140f557600080fd5b81356020614105613fee83613fa9565b82815260059290921b8401810191818101908b84111561412457600080fd5b948201945b8386101561414b57853561413c81613c06565b82529482019490820190614129565b9850508801359250508082111561416157600080fd5b61416d88838901613fcd565b9450604087013591508082111561418357600080fd5b5061419087828801613c62565b92505061419f60608601613f32565b905092959194509250565b600080600080600060a086880312156141c257600080fd5b8535945060208601356141d481613c06565b935060408601356141e481613c06565b925060608601359150608086013567ffffffffffffffff81111561420757600080fd5b61421388828901613c62565b9150509295509295909350565b6000806040838503121561423357600080fd5b823561423e81613c06565b91506020830135613f0a81613eba565b6000806000806080858703121561426457600080fd5b843561426f81613c06565b9350602085013592506040850135613e7a81613c06565b604080825283519082018190526000906020906060840190828701845b828110156142c85781516001600160a01b0316845292840192908401906001016142a3565b50505092019290925292915050565b600080604083850312156142ea57600080fd5b82356142f581613c06565b91506020830135613f0a81613c06565b60008060006060848603121561431a57600080fd5b833561432581613c06565b925060208401359150604084013567ffffffffffffffff81111561434857600080fd5b61435486828701613c62565b9150509250925092565b600181811c9082168061437257607f821691505b6020821081141561439357634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906143d390830184613bae565b979650505050505050565b60208082526021908201527f4552433939383a204f6e6c792077686974656c69737420697320616c6c6f77656040820152601960fa1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b60208082526046908201527f5f64617461206d75737420636f6e7461696e207468652075696e74323536207460408201527f6f6b656e496420746f207472616e7366657220746865206368696c6420746f6b60608201526532b7103a379760d11b608082015260a00190565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156144d1576144d16144a1565b500290565b6000828210156144e8576144e86144a1565b500390565b6000602082840312156144ff57600080fd5b815161337881613c06565b6001600160a01b039384168152919092166020820152604081019190915260600190565b634e487b7160e01b600052601260045260246000fd5b6000826145535761455361452e565b500490565b60006020828403121561456a57600080fd5b815161337881613b4f565b6000600019821415614589576145896144a1565b5060010190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906145c390830184613bae565b9695505050505050565b6000602082840312156145df57600080fd5b815161337881613eba565b600083516145fc818460208801613b82565b835190830190614610818360208801613b82565b01949350505050565b6000821982111561462c5761462c6144a1565b500190565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b60008161466c5761466c6144a1565b506000190190565b6000826146835761468361452e565b50069056fe0ef52e516fb5aec15a5d3587e5480481b702b26db93c8430eca78b61990fd3f6a2646970667358221220fa170fdeee8f73f49d9cd23f554aa7e084f2eed621dee5797835c92531b70c8f64736f6c634300080b0033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000003de6b7eea508d747a0fa14a3809cff3ced60f89c0000000000000000000000000000000000000000000000000000000000000016536c61627342756e646c652d436f6c6c656374696f6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000a4c4e512d42756e646c6500000000000000000000000000000000000000000000
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000003de6b7eea508d747a0fa14a3809cff3ced60f89c0000000000000000000000000000000000000000000000000000000000000016536c61627342756e646c652d436f6c6c656374696f6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000a4c4e512d42756e646c6500000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): SlabsBundle-Collection
Arg [1] : _symbol (string): LNQ-Bundle
Arg [2] : _forwarder (address): 0x3de6b7eea508d747a0fa14a3809cff3ced60f89c
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 0000000000000000000000003de6b7eea508d747a0fa14a3809cff3ced60f89c
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [4] : 536c61627342756e646c652d436f6c6c656374696f6e00000000000000000000
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [6] : 4c4e512d42756e646c6500000000000000000000000000000000000000000000
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|