Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
0 AZG
Holders
735
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
0 AZGLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
AzuGoal
Compiler Version
v0.8.13+commit.abaa5c0e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // import "ERC721Psi.sol"; import "ERC721AQueryable.sol"; import "Ownable.sol"; import "Base64.sol"; import "ReentrancyGuard.sol"; import "SafeMath.sol"; import "DefaultOperatorFilterer.sol"; import "IVRFGenerator.sol"; import "IDDS.sol"; import "IAccessories.sol"; contract AzuGoal is ERC721AQueryable, DefaultOperatorFilterer, Ownable, ReentrancyGuard { using SafeMath for uint256; string[32] _teamName = [ "Brazil", "Portugal", "Spain", "Netherlands", "England", "U.S.", "Iran", "Wales", "Ghana", "Saudi Arabia", "Mexico", "Poland", "France", "Australia", "Denmark", "Tunisia", "Senegal", "Costa Rica", "Germany", "Japan", "Belgium", "Canada", "Morocco", "Croatia", "Qatar", "Serbia", "Switzerland", "Cameroon", "Ecuador", "Argentina", "Uruguay", "South Korea" ]; struct Publish { uint8 winner; address operator; bool published; } uint16 public constant MAX_SUPPLY = 9600; uint256 public constant FAR_FUTURE = type(uint256).max; uint256 _publicSaleStart = FAR_FUTURE; uint256 _showTimeStart = FAR_FUTURE; string _baseTokenURI; uint256 private _mintPrice; uint256 private _betPrice; uint16 private _share; mapping(uint8 => Publish) publish; uint24[] nfts; mapping(uint16 => uint8) airDrops; uint16[] finalWinners; uint16[] finalHolders; uint16 winner1 = type(uint16).max; uint16 winner2 = type(uint16).max; mapping(uint16 => bool) cashReady; bool[2] bigWinnerReady; mapping(address => uint8) holders; mapping(address => bool) operators; uint16[] gamblers; IAccessories aces; IVRFGenerator vrf; uint256 _vrfRequestId; uint256 pool; // money to share for every one event publicSaleStart(uint256 time); event publicSalePaused(uint256 time); event baseUIRChanged(string uri); event showTimeStart(uint256 time); event airDropped(address to, uint256 tokenId, uint8 amount); event cashedOut(address to, uint256 tokenId, uint256 amount); event winnerReleased(uint16 id, address currentOwner); modifier onlyEOA() { if (tx.origin != msg.sender) revert("Only Individual User"); _; } modifier onlyOperator() { if (!operators[tx.origin] && msg.sender != owner()) revert("Only Operator Accounts Allowed"); _; } constructor( string memory baseURI, uint256 bet_price, uint16 share ) ERC721A("AzuGoal", "AZG") { require(share >= 0 && share <= 1000, "share must between 0 and 1000"); _baseTokenURI = baseURI; _betPrice = bet_price; _share = share; vrf = IVRFGenerator( IDDS(BEE_DDS_ADDRESS).toAddress( IDDS(BEE_DDS_ADDRESS).get("ISOTOP", "BEE_VRF_ADDRESS") ) ); aces = IAccessories( IDDS(BEE_DDS_ADDRESS).toAddress( IDDS(BEE_DDS_ADDRESS).get("ISOTOP", "BEE_AZU_PROP_ADDRESS") ) ); } // publicSale function isPublicSaleActive() public view returns (bool) { return block.timestamp >= _publicSaleStart; } function isShowTimeStart() public view returns (bool) { return block.timestamp >= _showTimeStart; } function getAirDrops(uint256 tokenId) external view returns (uint8) { require(_exists(tokenId), "token not exists"); return airDrops[uint16(tokenId)]; } function claimAirDrops(uint256 tokenId) external onlyEOA { require(ownerOf(tokenId) == msg.sender, "Only owner"); uint8 value = airDrops[uint16(tokenId)]; if (value == 0) revert("no airdrops found"); // airdrop to msg.sender aces.mint(msg.sender, value); airDrops[uint16(tokenId)] = 0; emit airDropped(msg.sender, tokenId, value); } function getCash(uint256 tokenId) external view returns (uint256 _cash) { require(publish[64].published, "Final winner not released"); if (!cashReady[uint16(tokenId)]) return 0; uint256 count = finalWinners.length; // Do the math for (uint256 i = 0; i < count; i++) if (finalWinners[i] == tokenId) { _cash += pool.mul(92).mul(40).div(10000).div(count); break; } count = finalHolders.length; for (uint256 i = 0; i < count; i++) if (finalHolders[i] == tokenId) { _cash += pool.mul(92).mul(10).div(10000).div(count); break; } } function claimCash(uint256 tokenId) external onlyEOA nonReentrant { require(ownerOf(tokenId) == msg.sender, "Only owner"); require(publish[64].published, "Final winner not released"); if (!cashReady[uint16(tokenId)]) revert("no fund or cashed out"); uint256 _cash = 0; uint256 count = finalWinners.length; // Do the math for (uint256 i = 0; i < count; i++) if (finalWinners[i] == tokenId) { _cash += pool.mul(92).mul(40).div(10000).div(count); break; } count = finalHolders.length; for (uint256 i = 0; i < count; i++) if (finalHolders[i] == tokenId) { _cash += pool.mul(92).mul(10).div(10000).div(count); break; } // payable(msg.sender).transfer(_cash); (bool success, ) = msg.sender.call{value: _cash}(""); require(success, "Claim transfer failed"); cashReady[uint16(tokenId)] = false; emit cashedOut(msg.sender, tokenId, _cash); } function getBigWinnerCash(uint256 tokenId) external view returns (uint256 _cash) { require(publish[64].published, "Final winner not released"); if (tokenId == winner1) if (bigWinnerReady[0]) // you lucky buster _cash += pool.mul(92).mul(50).div(10000).div(2); if (tokenId == winner2) if (bigWinnerReady[1]) // you lucky buster two _cash += pool.mul(92).mul(50).div(10000).div(2); } function claimBigWinnerCash(uint256 tokenId) external onlyEOA nonReentrant { require(ownerOf(tokenId) == msg.sender, "Only owner"); require(publish[64].published, "Final winner not released"); uint256 _cash = 0; if (tokenId == winner1) { if (!bigWinnerReady[0]) revert("no fund or cashed out"); // you lucky buster _cash += pool.mul(92).mul(50).div(10000).div(2); bigWinnerReady[0] = false; } if (tokenId == winner2) { if (!bigWinnerReady[1]) revert("no fund or cashed out"); // you lucky buster two _cash += pool.mul(92).mul(50).div(10000).div(2); bigWinnerReady[1] = false; } (bool success, ) = msg.sender.call{value: _cash}(""); require(success, "Claim transfer failed"); emit cashedOut(msg.sender, tokenId, _cash); } function publicSaleMint(uint8 quantity) external onlyEOA { require(isPublicSaleActive(), "Public Sales Not Started"); require(!isShowTimeStart(), "Public Sales Finished"); require( holders[msg.sender] + quantity <= 4, "max 4 public sale NFT allowed" ); require(nfts.length + quantity <= MAX_SUPPLY, "max nft sold"); _mint(msg.sender, quantity); for (uint8 i = 0; i < quantity; i++) nfts.push(0); holders[msg.sender] += quantity; } function bet(uint16 tokenId, uint8 _team) external payable onlyEOA nonReentrant { require(isShowTimeStart(), "Public Sales Not Finished"); require(_team < 32, "Only 32 teams support"); require(_exists(tokenId), "token not exists"); require(ownerOf(tokenId) == msg.sender, "Only owner"); require(nfts[tokenId] & 0x20 == 0, "Bet token"); require(msg.value >= _betPrice, "Insufficient Payment"); nfts[tokenId] += _team | 0x20; gamblers.push(tokenId); // Refund overpayment if (msg.value > _betPrice) { (bool success, ) = msg.sender.call{value: msg.value.sub(_betPrice)}( "" ); require(success, "Bet transfer failed"); } pool += _betPrice; } // METADATA function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } // DISPLAY function tokenURI(uint256 tokenId) public view virtual override(ERC721A, IERC721A) returns (string memory) { require(_exists(tokenId), "nonexistent token"); if (!isShowTimeStart()) return string(abi.encodePacked(_baseURI(), "cover.json")); else { uint24 value = nfts[tokenId]; string memory team = _teamName[(value >> 15) & 0x1f]; string memory no = _toString(uint256((value >> 6) & 0x1ff)); string memory betTeam = "Not Bet"; uint256 _id = ((value >> 15) & 0x1f) * 300 + ((value >> 6) & 0x1ff); string memory _name; if (value & 0x20 > 0) { betTeam = _teamName[value & 0x1f]; _name = string( abi.encodePacked( "AzuGoal NFT #", _toString(_id), // ⭐️ = "\xe2\xad\x90\xef\xb8\x8f" "\xe2\xad\x90\xef\xb8\x8f", betTeam ) ); } else _name = string( abi.encodePacked("AzuGoal NFT #", _toString(_id)) ); bytes memory meta = abi.encodePacked( '{"name": "', _name, '", "description": "AzuGoal WorldCup 2022", "image": "', _baseURI(), _toString(_id), '.png", "designer": "isotop.top","attributes": [{"trait_type": "In-memory","value": "WorldCup 2022"}, {"trait_type": "Team","value": "', team, '"}, {"trait_type": "Number","value": "', no, '"}, {"trait_type": "Bet","value": "', betTeam, '"}]}' ); return string( abi.encodePacked( "data:application/json;base64,", Base64.encode(meta) ) ); } } function tokenInfo(uint256 tokenId) external view returns ( uint256 _team, uint256 _no, uint256 _bet ) { require(_exists(tokenId), "nonexistent token"); uint24 value = nfts[tokenId]; if (value & 0x20 > 0) _bet = uint256(value & 0x1f); else _bet = 32; _team = uint256((value >> 15) & 0x1f); _no = uint256((value >> 6) & 0x1ff); } function getRoundStatus(uint8 round) external view returns (Publish memory) { return publish[round]; } function getFinalHolders() external view returns (uint16[] memory) { return finalHolders; } function getFinalWinners() external view returns (uint16[] memory) { return finalWinners; } function getBigWinners() external view returns (uint16, uint16) { return (winner1, winner2); } function getGamblers() external view returns (uint16[] memory) { return gamblers; } // OPERATORS function setWinner(uint8 round, uint8 _team) external onlyOperator { require(round < 64, "max 64 matchs"); if (publish[round].published) revert("this round had published"); if ( publish[round].operator == ZERO || publish[round].operator == msg.sender ) { publish[round] = Publish(_team, msg.sender, false); return; } if (publish[round].winner != _team) { publish[round].operator = msg.sender; publish[round].winner = _team; return; } for (uint16 i = 0; i < nfts.length; i++) if (((nfts[i] >> 15) & 0x1f) == _team) airDrops[i] += 1; publish[round].published = true; } function setFinalWinner(uint8 round, uint8 _team) external onlyOperator { require(round == 64, "final round must be 64 matchs"); if (publish[round].published) revert("this round had published"); if ( publish[round].operator == ZERO || publish[round].operator == msg.sender ) { publish[round] = Publish(_team, msg.sender, false); return; } if (publish[round].winner != _team) { publish[round].operator = msg.sender; publish[round].winner = _team; return; } uint256 length = nfts.length; for (uint16 i = 0; i < length; i++) { uint24 value = nfts[i]; if (((value >> 15) & 0x1f) == _team) { airDrops[i] += 1; finalHolders.push(i); cashReady[i] = true; } if (value & 0x20 > 0 && (value & 0x1f == _team)) { finalWinners.push(i); cashReady[i] = true; } } if (finalWinners.length == 0) { publish[round].published = true; return; } if (finalWinners.length == 1) { winner1 = finalWinners[0]; winner2 = finalWinners[0]; } else if (finalWinners.length == 2) { winner1 = finalWinners[0]; winner2 = finalWinners[1]; } else { uint256 _random = block.timestamp; if (_vrfRequestId != 0) { (bool fulfilled, uint256[] memory randomWords) = vrf .getRequestStatus(_vrfRequestId); if (fulfilled) _random = randomWords[1]; } uint16[] memory _winners = vrf.shuffle16( uint16(finalWinners.length), _random ); winner1 = finalWinners[_winners[0]]; winner2 = finalWinners[_winners[1]]; } bigWinnerReady[0] = true; bigWinnerReady[1] = true; emit winnerReleased(winner1, ownerOf(winner1)); emit winnerReleased(winner2, ownerOf(winner2)); publish[round].published = true; cashReady[MAX_SUPPLY] = true; } function startPublicSale() external onlyOperator { _publicSaleStart = block.timestamp; // We need 2 shuffle random seeds // 1: blind box // 2: final winner _vrfRequestId = vrf.requestRandomWords(2); emit publicSaleStart(block.timestamp); } function pausePublicSale() external onlyOperator { _publicSaleStart = FAR_FUTURE; emit publicSalePaused(block.timestamp); } function startShowTime() external onlyOperator { require(_showTimeStart == FAR_FUTURE, "Shuffle happened"); _showTimeStart = block.timestamp; uint256 _random = block.timestamp; if (_vrfRequestId != 0) { (bool fulfilled, uint256[] memory randomWords) = vrf .getRequestStatus(_vrfRequestId); if (fulfilled) _random = randomWords[0]; } uint16[] memory id = vrf.shuffle16(9600, _random); unchecked { for (uint256 i = 0; i < nfts.length; i++) { uint24 _team = id[i] / 300; uint24 _no = id[i] % 300; // 0x3ff = '0b11111111111111' (14bit) // save 5 bits for voting team, 1 bit for bet or not yet nfts[i] = (_team << 15) + (_no << 6); } } emit showTimeStart(block.timestamp); } // Team/Partnerships & Community function marketingMint(address to, uint16 quantity) external onlyOperator { require(!isShowTimeStart(), "Public Sales Finished"); require(nfts.length + quantity <= MAX_SUPPLY, "max nft sold"); _mint(to, quantity); for (uint8 i = 0; i < quantity; i++) nfts.push(0); } function airDropMint(address[] calldata to) external onlyOwner { for (uint256 i = 0; i < to.length; i++) { _mint(to[i], 1); aces.mint(to[i], 1); nfts.push(0); } } // OWNERS + HELPERS function setOperators(address[] calldata _operators) external onlyOwner { for (uint256 i = 0; i < _operators.length; i++) operators[_operators[i]] = true; } function setURInew(string memory uri) external onlyOwner returns (string memory) { _baseTokenURI = uri; emit baseUIRChanged(uri); return _baseTokenURI; } function setPrice(uint256 bet_price) external onlyOwner { _betPrice = bet_price; } function withdraw() external onlyOwner returns (uint256 split1, uint256 split2) { require(publish[64].published, "final winner not revealed"); require(cashReady[MAX_SUPPLY], "cashed not ready or cashed out"); uint256 total = pool.mul(8).div(100); split1 = total.mul(_share).div(1000); split2 = total - split1; (bool success1, ) = address(0x7B0dc23E87febF1D053E7Df9aF4cce30F21fAe9C) .call{value: split1}(""); (bool success2, ) = address(0x9da32F03cc23F9156DaA7442cADbE8366ddAc123) .call{value: split2}(""); require(success1 && success2, "withdraw transfer failed"); cashReady[MAX_SUPPLY] = false; emit cashedOut(msg.sender, MAX_SUPPLY, total); } function getPool() external view onlyOwner returns (uint256) { return (pool); } function config() external view onlyOwner returns ( address, address, address ) { return (address(BEE_DDS_ADDRESS), address(vrf), address(aces)); } function reset() external onlyOwner { selfdestruct(payable(0x7B0dc23E87febF1D053E7Df9aF4cce30F21fAe9C)); } // Opensea required function setApprovalForAll(address operator, bool approved) public override(ERC721A, IERC721A) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve(address operator, uint256 tokenId) public payable override(ERC721A, IERC721A) onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } }
// SPDX-License-Identifier: MIT /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| */ pragma solidity ^0.8.0; import "IERC721.sol"; import "IERC721Receiver.sol"; import "IERC721Metadata.sol"; import "IERC721Enumerable.sol"; import "Context.sol"; import "Strings.sol"; import "ERC165.sol"; import "Address.sol"; import "StorageSlot.sol"; import "BitMaps.sol"; contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using Strings for uint256; using BitMaps for BitMaps.BitMap; BitMaps.BitMap private _batchHead; string private _name; string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) internal _owners; uint256 internal _minted; mapping(uint256 => address) private _tokenApprovals; 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 || interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require( owner != address(0), "ERC721Psi: balance query for the zero address" ); uint256 count; for (uint256 i; i < _minted; ++i) { if (_exists(i)) { if (owner == ownerOf(i)) { ++count; } } } return count; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { (address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf( tokenId ); return owner; } function _ownerAndBatchHeadOf(uint256 tokenId) internal view returns (address owner, uint256 tokenIdBatchHead) { require( _exists(tokenId), "ERC721Psi: owner query for nonexistent token" ); tokenIdBatchHead = _getBatchHead(tokenId); owner = _owners[tokenIdBatchHead]; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); require(to != owner, "ERC721Psi: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721Psi: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require( _exists(tokenId), "ERC721Psi: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721Psi: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_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), "ERC721Psi: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721Psi: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, 1, _data), "ERC721Psi: 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`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _minted; } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require( _exists(tokenId), "ERC721Psi: operator query for nonexistent token" ); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ""); } function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { uint256 startTokenId = _minted; _mint(to, quantity); require( _checkOnERC721Received( address(0), to, startTokenId, quantity, _data ), "ERC721Psi: transfer to non ERC721Receiver implementer" ); } function _mint(address to, uint256 quantity) internal virtual { uint256 tokenIdBatchHead = _minted; require(quantity > 0, "ERC721Psi: quantity must be greater 0"); require(to != address(0), "ERC721Psi: mint to the zero address"); _beforeTokenTransfers(address(0), to, tokenIdBatchHead, quantity); _minted += quantity; _owners[tokenIdBatchHead] = to; _batchHead.set(tokenIdBatchHead); _afterTokenTransfers(address(0), to, tokenIdBatchHead, quantity); // Emit events for ( uint256 tokenId = tokenIdBatchHead; tokenId < tokenIdBatchHead + quantity; tokenId++ ) { emit Transfer(address(0), to, 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 { (address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf( tokenId ); require(owner == from, "ERC721Psi: transfer of token that is not own"); require(to != address(0), "ERC721Psi: transfer to the zero address"); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId); uint256 nextTokenId = tokenId + 1; if (!_batchHead.get(nextTokenId) && nextTokenId < _minted) { _owners[nextTokenId] = from; _batchHead.set(nextTokenId); } _owners[tokenId] = to; if (tokenId != tokenIdBatchHead) { _batchHead.set(tokenId); } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ownerOf(tokenId), to, tokenId); } /** * @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 startTokenId uint256 the first ID of the tokens to be transferred * @param quantity uint256 amount of the tokens to be transfered. * @param _data bytes optional data to send along with the call * @return r bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 startTokenId, uint256 quantity, bytes memory _data ) private returns (bool r) { if (to.isContract()) { r = true; for ( uint256 tokenId = startTokenId; tokenId < startTokenId + quantity; tokenId++ ) { try IERC721Receiver(to).onERC721Received( _msgSender(), from, tokenId, _data ) returns (bytes4 retval) { r = r && retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert( "ERC721Psi: transfer to non ERC721Receiver implementer" ); } else { assembly { revert(add(32, reason), mload(reason)) } } } } return r; } else { return true; } } function _getBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdBatchHead) { tokenIdBatchHead = _batchHead.scanForward(tokenId); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _minted; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < totalSupply(), "ERC721Psi: global index out of bounds"); uint256 count; for (uint256 i; i < _minted; i++) { if (_exists(i)) { if (count == index) return i; else count++; } } } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256 tokenId) { uint256 count; for (uint256 i; i < _minted; i++) { if (_exists(i) && owner == ownerOf(i)) { if (count == index) return i; else count++; } } revert("ERC721Psi: owner index out of bounds"); } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * 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`. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "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 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) (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 (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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) (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 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/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) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; import "BitScan.sol"; import "Popcount.sol"; /** * @dev This Library is a modified version of Openzeppelin's BitMaps library with extra features. * * 1. Functions of finding the index of the closest set bit from a given index are added. * The indexing of each bucket is modifed to count from the MSB to the LSB instead of from the LSB to the MSB. * The modification of indexing makes finding the closest previous set bit more efficient in gas usage. * 2. Setting and unsetting the bitmap consecutively. * 3. Accounting number of set bits within a given range. * */ /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. */ library BitMaps { using BitScan for uint256; uint256 private constant MASK_INDEX_ZERO = (1 << 255); uint256 private constant MASK_FULL = type(uint256).max; struct BitMap { mapping(uint256 => uint256) _data; } /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); return bitmap._data[bucket] & mask != 0; } /** * @dev Sets the bit at `index` to the boolean `value`. */ function setTo( BitMap storage bitmap, uint256 index, bool value ) internal { if (value) { set(bitmap, index); } else { unset(bitmap, index); } } /** * @dev Sets the bit at `index`. */ function set(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); bitmap._data[bucket] |= mask; } /** * @dev Unsets the bit at `index`. */ function unset(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); bitmap._data[bucket] &= ~mask; } /** * @dev Consecutively sets `amount` of bits starting from the bit at `startIndex`. */ function setBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { bitmap._data[bucket] |= MASK_FULL << (256 - amount) >> bucketStartIndex; } else { bitmap._data[bucket] |= MASK_FULL >> bucketStartIndex; amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { bitmap._data[bucket] = MASK_FULL; amount -= 256; bucket++; } bitmap._data[bucket] |= MASK_FULL << (256 - amount); } } } /** * @dev Consecutively unsets `amount` of bits starting from the bit at `startIndex`. */ function unsetBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount) >> bucketStartIndex); } else { bitmap._data[bucket] &= ~(MASK_FULL >> bucketStartIndex); amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { bitmap._data[bucket] = 0; amount -= 256; bucket++; } bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount)); } } } /** * @dev Returns number of set bits within a range. */ function popcountA(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { count += Popcount.popcount256A( bitmap._data[bucket] << bucketStartIndex >> (256 - amount) ); } else { count += Popcount.popcount256A( bitmap._data[bucket] << bucketStartIndex ); amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { count += Popcount.popcount256A(bitmap._data[bucket]); amount -= 256; bucket++; } count += Popcount.popcount256A( bitmap._data[bucket] >> (256 - amount) ); } } } /** * @dev Returns number of set bits within a range. */ function popcountB(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { count += Popcount.popcount256B( bitmap._data[bucket] << bucketStartIndex >> (256 - amount) ); } else { count += Popcount.popcount256B( bitmap._data[bucket] << bucketStartIndex ); amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { count += Popcount.popcount256B(bitmap._data[bucket]); amount -= 256; bucket++; } count += Popcount.popcount256B( bitmap._data[bucket] >> (256 - amount) ); } } } /** * @dev Find the closest index of the set bit before `index`. */ function scanForward(BitMap storage bitmap, uint256 index) internal view returns (uint256 setBitIndex) { uint256 bucket = index >> 8; // index within the bucket uint256 bucketIndex = (index & 0xff); // load a bitboard from the bitmap. uint256 bb = bitmap._data[bucket]; // offset the bitboard to scan from `bucketIndex`. bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex) if(bb > 0) { unchecked { setBitIndex = (bucket << 8) | (bucketIndex - bb.bitScanForward256()); } } else { while(true) { require(bucket > 0, "BitMaps: The set bit before the index doesn't exist."); unchecked { bucket--; } // No offset. Always scan from the least significiant bit now. bb = bitmap._data[bucket]; if(bb > 0) { unchecked { setBitIndex = (bucket << 8) | (255 - bb.bitScanForward256()); break; } } } } } function getBucket(BitMap storage bitmap, uint256 bucket) internal view returns (uint256) { return bitmap._data[bucket]; } }
// SPDX-License-Identifier: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; library BitScan { uint256 constant private DEBRUIJN_256 = 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff; bytes constant private LOOKUP_TABLE_256 = hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8"; /** @dev Isolate the least significant set bit. */ function isolateLS1B256(uint256 bb) pure internal returns (uint256) { require(bb > 0); unchecked { return bb & (0 - bb); } } /** @dev Isolate the most significant set bit. */ function isolateMS1B256(uint256 bb) pure internal returns (uint256) { require(bb > 0); unchecked { bb |= bb >> 128; bb |= bb >> 64; bb |= bb >> 32; bb |= bb >> 16; bb |= bb >> 8; bb |= bb >> 4; bb |= bb >> 2; bb |= bb >> 1; return (bb >> 1) + 1; } } /** @dev Find the index of the lest significant set bit. (trailing zero count) */ function bitScanForward256(uint256 bb) pure internal returns (uint8) { unchecked { return uint8(LOOKUP_TABLE_256[(isolateLS1B256(bb) * DEBRUIJN_256) >> 248]); } } /** @dev Find the index of the most significant set bit. */ function bitScanReverse256(uint256 bb) pure internal returns (uint8) { unchecked { return 255 - uint8(LOOKUP_TABLE_256[((isolateMS1B256(bb) * DEBRUIJN_256) >> 248)]); } } function log2(uint256 bb) pure internal returns (uint8) { unchecked { return uint8(LOOKUP_TABLE_256[(isolateMS1B256(bb) * DEBRUIJN_256) >> 248]); } } }
// SPDX-License-Identifier: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; library Popcount { uint256 private constant m1 = 0x5555555555555555555555555555555555555555555555555555555555555555; uint256 private constant m2 = 0x3333333333333333333333333333333333333333333333333333333333333333; uint256 private constant m4 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f; uint256 private constant h01 = 0x0101010101010101010101010101010101010101010101010101010101010101; function popcount256A(uint256 x) internal pure returns (uint256 count) { unchecked{ for (count=0; x!=0; count++) x &= x - 1; } } function popcount256B(uint256 x) internal pure returns (uint256) { if (x == type(uint256).max) { return 256; } unchecked { x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits x = (x * h01) >> 248; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ... } return x; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "IERC721AQueryable.sol"; import "ERC721A.sol"; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "IERC721A.sol"; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` 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 payable; /** * @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 payable; /** * @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); // ============================================================= // IERC721Metadata // ============================================================= /** * @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); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "IERC721A.sol"; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string internal _name; // Token symbol string internal _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals /// @dev Note THIS IS BY ISOTOP from private to internal mapping(address => mapping(address => bool)) internal _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ""; } /** * @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, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or( owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags) ) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @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) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @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) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @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. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); ( uint256 approvedAddressSlot, address approvedAddress ) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if ( !_isSenderApprovedOrOwner( approvedAddress, from, _msgSenderERC721A() ) ) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @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 memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * 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, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received( _msgSenderERC721A(), from, tokenId, _data ) returns (bytes4 retval) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer( startTokenId, startTokenId + quantity - 1, address(0), to ); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if ( !_checkContractOnERC721Received( address(0), to, index++, _data ) ) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ""); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); ( uint256 approvedAddressSlot, address approvedAddress ) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if ( !_isSenderApprovedOrOwner( approvedAddress, from, _msgSenderERC721A() ) ) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * 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, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "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.7.0) (utils/Base64.sol) pragma solidity ^0.8.0; /** * @dev Provides a set of functions to operate with Base64 strings. * * _Available since v4.5._ */ library Base64 { /** * @dev Base64 Encoding/Decoding Table */ string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** * @dev Converts a `bytes` to its Bytes64 `string` representation. */ function encode(bytes memory data) internal pure returns (string memory) { /** * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol */ if (data.length == 0) return ""; // Loads the table into memory string memory table = _TABLE; // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter // and split into 4 numbers of 6 bits. // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up // - `data.length + 2` -> Round up // - `/ 3` -> Number of 3-bytes chunks // - `4 *` -> 4 characters for each chunk string memory result = new string(4 * ((data.length + 2) / 3)); /// @solidity memory-safe-assembly assembly { // Prepare the lookup table (skip the first "length" byte) let tablePtr := add(table, 1) // Prepare result pointer, jump over length let resultPtr := add(result, 32) // Run over the input, 3 bytes at a time for { let dataPtr := data let endPtr := add(data, mload(data)) } lt(dataPtr, endPtr) { } { // Advance 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // To write each character, shift the 3 bytes (18 bits) chunk // 4 times in blocks of 6 bits for each character (18, 12, 6, 0) // and apply logical AND with 0x3F which is the number of // the previous character in the ASCII table prior to the Base64 Table // The result is then added to the table to get the character to write, // and finally write it in the result pointer but with a left shift // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F)))) resultPtr := add(resultPtr, 1) // Advance } // When data `bytes` is not exactly 3 bytes long // it is padded with `=` characters at the end switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) } case 2 { mstore8(sub(resultPtr, 1), 0x3d) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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 pragma solidity ^0.8.13; import {OperatorFilterer} from "OperatorFilterer.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "IOperatorFilterRegistry.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. */ abstract contract OperatorFilterer { error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries(address registrant, address registrantToCopy) external; function unregister(address addr) external; function updateOperator(address registrant, address operator, bool filtered) external; function updateOperators(address registrant, address[] calldata operators, bool filtered) external; function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; uint256 constant FOEVER = type(uint256).max; address constant ZERO = 0x0000000000000000000000000000000000000000; interface IVRFGenerator { event RequestSent(uint256 requestId, uint32 numWords); event RequestFulfilled(uint256 requestId, uint256[] randomWords); // Assumes the subscription is funded sufficiently. function requestRandomWords(uint32 numWords) external returns (uint256 requestId); function getRequestStatus(uint256 _requestId) external view returns (bool fulfilled, uint256[] memory randomWords); function shuffle(uint256 size, uint256 entropy) external pure returns (uint256[] memory); function shuffle16(uint16 size, uint256 entropy) external pure returns (uint16[] memory); }
// SPDX-License-Identifier: MIT // IISOTOP version 0.10 // Creator: Dr. Zu team pragma solidity ^0.8.4; // mumbai // address constant BEE_DDS_ADDRESS = 0x040E4c68d0B22C390C176515701D2B8dEcd17BEe; // Mainnet address constant BEE_DDS_ADDRESS = 0x8C0813590b65952197F5654ec953Ccc601725bEe; /// @title PLAN-BEE IDDS Domain Data System 域名数据系统 /// @author Iwan Cao /// @notice 开放使用合约,任何人可以存储自己的数据 /// @dev 每个domain可以存储一组key,每个key存储一个bytes数据. 默认的domain是公开的,任何人可读。如果需要私有化数据,选择DATATYPE 为PRIVATE。 /// @dev 数据的拥有者才能更改数据,更改为bytes(0)意味着删除这个key. /// @dev 数据默认是msg.sender作为拥有者,如果需要个人账户tx.origin作为拥有者,请选择DATATYPE 为PERSONAL /// @custom:planbee 这是一个PLAN-BEE计划认证的合约 interface IDDS { enum DATATYPE { PUBLIC_CONTRACT, PUBLIC_PERSONAL, PRIVATE_CONTRACT, PRIVATE_PERSONAL } function put( string calldata _domain, string calldata _key, bytes calldata _data, DATATYPE _type ) external; function put( string calldata _domain, string calldata _key, bytes calldata _data ) external; function getOwner(string calldata _domain) external view returns (address); function get(string calldata _domain, string calldata _key) external view returns (bytes memory); function get( string calldata _domain, string calldata _key, bool _personal ) external view returns (bytes memory); function getKeys(string calldata _domain) external view returns (string[] memory); function getKeys(string calldata _domain, bool _personal) external view returns (string[] memory); function toAddress(bytes memory b) external pure returns (address addr); function toInt(bytes calldata b) external pure returns (uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IAccessories { function mint(address _to, uint256 _amount) external; function burn(uint256 tokenId) external; }
{ "evmVersion": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "AzuGoal.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"uint256","name":"bet_price","type":"uint256"},{"internalType":"uint16","name":"share","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"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":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","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":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"amount","type":"uint8"}],"name":"airDropped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"baseUIRChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"cashedOut","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"publicSalePaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"publicSaleStart","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"showTimeStart","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"id","type":"uint16"},{"indexed":false,"internalType":"address","name":"currentOwner","type":"address"}],"name":"winnerReleased","type":"event"},{"inputs":[],"name":"FAR_FUTURE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"}],"name":"airDropMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint8","name":"_team","type":"uint8"}],"name":"bet","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claimAirDrops","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claimBigWinnerCash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claimCash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"config","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getAirDrops","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBigWinnerCash","outputs":[{"internalType":"uint256","name":"_cash","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBigWinners","outputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCash","outputs":[{"internalType":"uint256","name":"_cash","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFinalHolders","outputs":[{"internalType":"uint16[]","name":"","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFinalWinners","outputs":[{"internalType":"uint16[]","name":"","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGamblers","outputs":[{"internalType":"uint16[]","name":"","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"round","type":"uint8"}],"name":"getRoundStatus","outputs":[{"components":[{"internalType":"uint8","name":"winner","type":"uint8"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"published","type":"bool"}],"internalType":"struct AzuGoal.Publish","name":"","type":"tuple"}],"stateMutability":"view","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":"isPublicSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isShowTimeStart","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint16","name":"quantity","type":"uint16"}],"name":"marketingMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pausePublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"quantity","type":"uint8"}],"name":"publicSaleMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reset","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":"payable","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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"round","type":"uint8"},{"internalType":"uint8","name":"_team","type":"uint8"}],"name":"setFinalWinner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_operators","type":"address[]"}],"name":"setOperators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bet_price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setURInew","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"round","type":"uint8"},{"internalType":"uint8","name":"_team","type":"uint8"}],"name":"setWinner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startShowTime","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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenInfo","outputs":[{"internalType":"uint256","name":"_team","type":"uint256"},{"internalType":"uint256","name":"_no","type":"uint256"},{"internalType":"uint256","name":"_bet","type":"uint256"}],"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":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[{"internalType":"uint256","name":"split1","type":"uint256"},{"internalType":"uint256","name":"split2","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
600661048081815265109c985e9a5b60d21b6104a052608090815260086104c081815267141bdc9d1d59d85b60c21b6104e05260a05260056105008181526429b830b4b760d91b6105205260c052600b6105408181526a4e65746865726c616e647360a81b6105605260e052600761058081815266115b99db185b9960ca1b6105a0526101005260046105c0818152632a97299760e11b6105e052610120526106009081526324b930b760e11b61062052610140526106408381526457616c657360d81b6106605261016052610680838152644768616e6160d81b6106a05261018052600c6106c09081526b53617564692041726162696160a01b6106e0526101a052610700868152654d657869636f60d01b610720526101c05261074086815265141bdb185b9960d21b610760526101e052610780868152654672616e636560d01b6107a0526102005260096107c0818152684175737472616c696160b81b6107e052610220526108008281526644656e6d61726b60c81b61082052610240526108408281526654756e6973696160c81b61086052610260526108808281526614d95b9959d85b60ca1b6108a05261028052600a6108c081815269436f737461205269636160b01b6108e0526102a052610900838152664765726d616e7960c81b610920526102c052610940858152642530b830b760d91b610960526102e0526109808381526642656c6769756d60c81b6109a052610300526109c08881526543616e61646160d01b6109e05261032052610a00838152664d6f726f63636f60c81b610a205261034052610a408381526643726f6174696160c81b610a605261036052610a809485526428b0ba30b960d91b610aa05261038094909452610ac09687526553657262696160d01b610ae0526103a096909652610b008281526a14ddda5d1e995c9b185b9960aa1b610b20526103c052610b409384526721b0b6b2b937b7b760c11b610b60526103e093909352610b808381526622b1bab0b237b960c91b610ba05261040052610bc094855268417267656e74696e6160b81b610be05261042094909452610c00918252665572756775617960c81b610c205261044091909152610c80604052610c409283526a536f757468204b6f72656160a81b610c605261046092909252620003599190602062000875565b50600019602a819055602b556035805463ffffffff191663ffffffff1790553480156200038557600080fd5b506040516200621c3803806200621c833981016040819052620003a89162000a96565b6040805180820182526007815266105e9d51dbd85b60ca1b602080830191825283518085019094526003845262415a4760e81b908401528151733cc6cdda760b79bafa08df41ecfa224f810dceb6936001939290916200040b91600291620008cc565b50805162000421906003906020840190620008cc565b506000805550506daaeb6d7670e522a718067333cd4e3b156200056d578015620004bb57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200049c57600080fd5b505af1158015620004b1573d6000803e3d6000fd5b505050506200056d565b6001600160a01b038216156200050c5760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af29039060440162000481565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b1580156200055357600080fd5b505af115801562000568573d6000803e3d6000fd5b505050505b506200057b90503362000823565b60016009556103e861ffff82161115620005db5760405162461bcd60e51b815260206004820152601d60248201527f7368617265206d757374206265747765656e203020616e642031303030000000604482015260640160405180910390fd5b8251620005f090602c906020860190620008cc565b50602e829055602f805461ffff191661ffff8316179055604051633e10510b60e01b8152738c0813590b65952197f5654ec953ccc601725bee90632d888869908290633e10510b90620006469060040162000b11565b600060405180830381865afa15801562000664573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200068e919081019062000b66565b6040518263ffffffff1660e01b8152600401620006ac919062000bbb565b602060405180830381865afa158015620006ca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006f0919062000bf0565b603c80546001600160a01b0319166001600160a01b0392909216919091179055604051633e10510b60e01b8152738c0813590b65952197f5654ec953ccc601725bee90632d888869908290633e10510b906200074f9060040162000c22565b600060405180830381865afa1580156200076d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000797919081019062000b66565b6040518263ffffffff1660e01b8152600401620007b5919062000bbb565b602060405180830381865afa158015620007d3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007f9919062000bf0565b603b80546001600160a01b0319166001600160a01b03929092169190911790555062000cc1915050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8260208101928215620008ba579160200282015b82811115620008ba5782518051620008a9918491602090910190620008cc565b509160200191906001019062000889565b50620008c892915062000957565b5090565b828054620008da9062000c85565b90600052602060002090601f016020900481019282620008fe576000855562000949565b82601f106200091957805160ff191683800117855562000949565b8280016001018555821562000949579182015b82811115620009495782518255916020019190600101906200092c565b50620008c892915062000978565b80821115620008c85760006200096e82826200098f565b5060010162000957565b5b80821115620008c8576000815560010162000979565b5080546200099d9062000c85565b6000825580601f10620009ae575050565b601f016020900490600052602060002090810190620009ce919062000978565b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000a04578181015183820152602001620009ea565b8381111562000a14576000848401525b50505050565b60006001600160401b038084111562000a375762000a37620009d1565b604051601f8501601f19908116603f0116810190828211818310171562000a625762000a62620009d1565b8160405280935085815286868601111562000a7c57600080fd5b62000a8c866020830187620009e7565b5050509392505050565b60008060006060848603121562000aac57600080fd5b83516001600160401b0381111562000ac357600080fd5b8401601f8101861362000ad557600080fd5b62000ae68682516020840162000a1a565b93505060208401519150604084015161ffff8116811462000b0657600080fd5b809150509250925092565b60408152600062000b38604083016006815265049534f544f560d41b602082015260400190565b828103602093840152600f81526e4245455f5652465f4144445245535360881b928101929092525060400190565b60006020828403121562000b7957600080fd5b81516001600160401b0381111562000b9057600080fd5b8201601f8101841362000ba257600080fd5b62000bb38482516020840162000a1a565b949350505050565b602081526000825180602084015262000bdc816040850160208701620009e7565b601f01601f19169190910160400192915050565b60006020828403121562000c0357600080fd5b81516001600160a01b038116811462000c1b57600080fd5b9392505050565b60408152600062000c49604083016006815265049534f544f560d41b602082015260400190565b828103602093840152601481527f4245455f415a555f50524f505f41444452455353000000000000000000000000928101929092525060400190565b600181811c9082168062000c9a57607f821691505b60208210810362000cbb57634e487b7160e01b600052602260045260246000fd5b50919050565b61554b8062000cd16000396000f3fe6080604052600436106103355760003560e01c80636b747d63116101ab578063b88d4fde116100f7578063cc33c87511610095578063d826f88f1161006f578063d826f88f14610a25578063ddf71cd514610a3a578063e985e9c514610a5a578063f2fde38b14610aa357600080fd5b8063cc33c875146109b2578063ce70cd8d146109ed578063d58b83e314610a0d57600080fd5b8063c76df80e116100d1578063c76df80e14610932578063c82b942514610952578063c87b56dd14610972578063ca905dc01461099257600080fd5b8063b88d4fde146108d2578063be9a2d23146108e5578063c23dc68f1461090557600080fd5b80638da5cb5b1161016457806399a2557a1161013e57806399a2557a1461086a578063a21555391461088a578063a22cb4651461089f578063a7d2161c146108bf57600080fd5b80638da5cb5b1461081757806391b7f5ed1461083557806395d89b411461085557600080fd5b80636b747d631461074057806370a0823114610756578063715018a6146107765780637679e0561461078b57806379502c55146107ab5780638462151c146107ea57600080fd5b806323b872dd1161028557806342842e0e1161022357806355d5a012116101fd57806355d5a012146106b35780635bbb2177146106d35780636352211e14610700578063644ae0631461072057600080fd5b806342842e0e146105d3578063436ffa3f146105e6578063535a70231461069357600080fd5b806332cb6b0c1161025f57806332cb6b0c146105495780633ccfd60b1461057257806341f434341461059c578063422326f4146105be57600080fd5b806323b872dd146104e457806328b6b4f8146104f75780632c09e7c11461051757600080fd5b80630c1c972a116102f257806314748994116102cc578063147489941461046d57806318160ddd146104825780631845994d1461049b5780631e84c413146104cc57600080fd5b80630c1c972a146104235780630c41f4971461043857806313069dfd1461044d57600080fd5b806301ffc9a71461033a578063026b1d5f1461036f57806306fdde0314610392578063081812fc146103b4578063095ea7b3146103ec57806309eeebb014610401575b600080fd5b34801561034657600080fd5b5061035a610355366004614749565b610ac3565b60405190151581526020015b60405180910390f35b34801561037b57600080fd5b50610384610b15565b604051908152602001610366565b34801561039e57600080fd5b506103a7610b26565b60405161036691906147be565b3480156103c057600080fd5b506103d46103cf3660046147d1565b610bb8565b6040516001600160a01b039091168152602001610366565b6103ff6103fa366004614801565b610bfc565b005b34801561040d57600080fd5b50610416610c15565b604051610366919061482b565b34801561042f57600080fd5b506103ff610c94565b34801561044457600080fd5b506103ff610d91565b34801561045957600080fd5b506103ff6104683660046147d1565b610e0f565b34801561047957600080fd5b50610416610f86565b34801561048e57600080fd5b5060015460005403610384565b3480156104a757600080fd5b506035546040805161ffff808416825262010000909304909216602083015201610366565b3480156104d857600080fd5b50602a5442101561035a565b6103ff6104f2366004614867565b610fe1565b34801561050357600080fd5b506103846105123660046147d1565b61100c565b34801561052357600080fd5b506105376105323660046147d1565b6110fd565b60405160ff9091168152602001610366565b34801561055557600080fd5b5061055f61258081565b60405161ffff9091168152602001610366565b34801561057e57600080fd5b50610587611161565b60408051928352602083019190915201610366565b3480156105a857600080fd5b506103d46daaeb6d7670e522a718067333cd4e81565b3480156105ca57600080fd5b50610416611436565b6103ff6105e1366004614867565b611491565b3480156105f257600080fd5b506106636106013660046148b4565b60408051606080820183526000808352602080840182905292840181905260ff9485168152603083528390208351918201845254808516825261010081046001600160a01b031692820192909252600160a81b90910490921615159082015290565b60408051825160ff1681526020808401516001600160a01b03169082015291810151151590820152606001610366565b34801561069f57600080fd5b506103ff6106ae36600461491a565b6114b6565b3480156106bf57600080fd5b506103846106ce3660046147d1565b6115f5565b3480156106df57600080fd5b506106f36106ee36600461491a565b611785565b6040516103669190614997565b34801561070c57600080fd5b506103d461071b3660046147d1565b611850565b34801561072c57600080fd5b506103ff61073b3660046149d9565b61185b565b34801561074c57600080fd5b5061038460001981565b34801561076257600080fd5b50610384610771366004614a0c565b611b42565b34801561078257600080fd5b506103ff611b90565b34801561079757600080fd5b506103ff6107a6366004614a37565b611ba4565b3480156107b757600080fd5b506107c0611d0a565b604080516001600160a01b0394851681529284166020840152921691810191909152606001610366565b3480156107f657600080fd5b5061080a610805366004614a0c565b611d47565b6040516103669190614a6e565b34801561082357600080fd5b506008546001600160a01b03166103d4565b34801561084157600080fd5b506103ff6108503660046147d1565b611e4f565b34801561086157600080fd5b506103a7611e5c565b34801561087657600080fd5b5061080a610885366004614aa6565b611e6b565b34801561089657600080fd5b506103ff611fe4565b3480156108ab57600080fd5b506103ff6108ba366004614ae7565b6122ba565b6103ff6108cd366004614b13565b6122ce565b6103ff6108e0366004614bce565b612674565b3480156108f157600080fd5b506103ff6109003660046147d1565b6126a1565b34801561091157600080fd5b506109256109203660046147d1565b6129a9565b6040516103669190614c49565b34801561093e57600080fd5b506103ff61094d3660046148b4565b612a21565b34801561095e57600080fd5b506103a761096d366004614c57565b612c5d565b34801561097e57600080fd5b506103a761098d3660046147d1565b612d44565b34801561099e57600080fd5b506103ff6109ad3660046149d9565b61309e565b3480156109be57600080fd5b506109d26109cd3660046147d1565b6138e8565b60408051938452602084019290925290820152606001610366565b3480156109f957600080fd5b506103ff610a083660046147d1565b6139af565b348015610a1957600080fd5b50602b5442101561035a565b348015610a3157600080fd5b506103ff613c27565b348015610a4657600080fd5b506103ff610a5536600461491a565b613c46565b348015610a6657600080fd5b5061035a610a75366004614c9f565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610aaf57600080fd5b506103ff610abe366004614a0c565b613cc0565b60006301ffc9a760e01b6001600160e01b031983161480610af457506380ac58cd60e01b6001600160e01b03198316145b80610b0f5750635b5e139f60e01b6001600160e01b03198316145b92915050565b6000610b1f613d39565b50603e5490565b606060028054610b3590614cc9565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6190614cc9565b8015610bae5780601f10610b8357610100808354040283529160200191610bae565b820191906000526020600020905b815481529060010190602001808311610b9157829003601f168201915b5050505050905090565b6000610bc382613d93565b610be0576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b81610c0681613dba565b610c108383613e73565b505050565b6060603a805480602002602001604051908101604052809291908181526020018280548015610bae57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411610c525790505050505050905090565b3260009081526039602052604090205460ff16158015610cbf57506008546001600160a01b03163314155b15610ce55760405162461bcd60e51b8152600401610cdc90614d03565b60405180910390fd5b42602a55603c5460405163e726f2e160e01b8152600260048201526001600160a01b039091169063e726f2e1906024016020604051808303816000875af1158015610d34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d589190614d3a565b603d556040514281527ff5873041cf54025a0d378efc70d90938908e7499c3f41d007dc37938ae92345d906020015b60405180910390a1565b3260009081526039602052604090205460ff16158015610dbc57506008546001600160a01b03163314155b15610dd95760405162461bcd60e51b8152600401610cdc90614d03565b600019602a556040514281527f1557f02db43c040d49a0619c1083e57b0c263e11d8dd388416ab9a6ce1a4380f90602001610d87565b323314610e2e5760405162461bcd60e51b8152600401610cdc90614d53565b33610e3882611850565b6001600160a01b031614610e5e5760405162461bcd60e51b8152600401610cdc90614d81565b61ffff811660009081526032602052604081205460ff1690819003610eb95760405162461bcd60e51b81526020600482015260116024820152701b9bc8185a5c991c9bdc1cc8199bdd5b99607a1b6044820152606401610cdc565b603b546040516340c10f1960e01b815233600482015260ff831660248201526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610f0757600080fd5b505af1158015610f1b573d6000803e3d6000fd5b5050505061ffff8216600090815260326020908152604091829020805460ff19169055815133815290810184905260ff8316918101919091527f2f977e68df69d63cdf91a6aa90360df2140f3e62de2b992f6152b00d3714d98e906060015b60405180910390a15050565b60606033805480602002602001604051908101604052809291908181526020018280548015610bae576000918252602091829020805461ffff168452908202830192909160029101808411610c525790505050505050905090565b826001600160a01b0381163314610ffb57610ffb33613dba565b611006848484613f13565b50505050565b6040600090815260306020526000805160206154b683398151915254600160a81b900460ff1661104e5760405162461bcd60e51b8152600401610cdc90614da5565b60355461ffff1682036110a55760375460ff16156110a5576110986002611092612710611092603261108c605c603e546140ab90919063ffffffff16565b906140ab565b906140b7565b6110a29082614e08565b90505b60355462010000900461ffff1682036110f857603754610100900460ff16156110f8576110ee6002611092612710611092603261108c605c603e546140ab90919063ffffffff16565b610b0f9082614e08565b919050565b600061110882613d93565b6111475760405162461bcd60e51b815260206004820152601060248201526f746f6b656e206e6f742065786973747360801b6044820152606401610cdc565b5061ffff1660009081526032602052604090205460ff1690565b60008061116c613d39565b604060005260306020526000805160206154b683398151915254600160a81b900460ff166111dc5760405162461bcd60e51b815260206004820152601960248201527f66696e616c2077696e6e6572206e6f742072657665616c6564000000000000006044820152606401610cdc565b61258060005260366020527f11c0ccfb97a6042c43c2edb5a89642faf75742170dd1ae5b00d64d60aa31b4295460ff166112585760405162461bcd60e51b815260206004820152601e60248201527f636173686564206e6f74207265616479206f7220636173686564206f757400006044820152606401610cdc565b600061127560646110926008603e546140ab90919063ffffffff16565b602f54909150611292906103e89061109290849061ffff166140ab565b925061129e8382614e20565b604051909250600090737b0dc23e87febf1d053e7df9af4cce30f21fae9c9085908381818185875af1925050503d80600081146112f7576040519150601f19603f3d011682016040523d82523d6000602084013e6112fc565b606091505b5050604051909150600090739da32f03cc23f9156daa7442cadbe8366ddac1239085908381818185875af1925050503d8060008114611357576040519150601f19603f3d011682016040523d82523d6000602084013e61135c565b606091505b5050905081801561136a5750805b6113b65760405162461bcd60e51b815260206004820152601860248201527f7769746864726177207472616e73666572206661696c656400000000000000006044820152606401610cdc565b6125806000819052603660209081527f11c0ccfb97a6042c43c2edb5a89642faf75742170dd1ae5b00d64d60aa31b429805460ff1916905560408051338152918201929092529081018490527fd08149829b4708b5a796078ac79020343425f5db94b97dfc5fe89f1e9caffb139060600160405180910390a15050509091565b60606034805480602002602001604051908101604052809291908181526020018280548015610bae576000918252602091829020805461ffff168452908202830192909160029101808411610c525790505050505050905090565b826001600160a01b03811633146114ab576114ab33613dba565b6110068484846140c3565b6114be613d39565b60005b81811015610c10576114fa8383838181106114de576114de614ddc565b90506020020160208101906114f39190614a0c565b60016140de565b603b546001600160a01b03166340c10f1984848481811061151d5761151d614ddc565b90506020020160208101906115329190614a0c565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260016024820152604401600060405180830381600087803b15801561157a57600080fd5b505af115801561158e573d6000803e3d6000fd5b5050603180546001810182556000919091527fc54045fa7c6ec765e825df7f9e9bf9dec12c5cef146f93a5eee56772ee647fbc600a808304919091018054919092066003026101000a62ffffff0219169055508190506115ed81614e37565b9150506114c1565b6040600090815260306020526000805160206154b683398151915254600160a81b900460ff166116375760405162461bcd60e51b8152600401610cdc90614da5565b61ffff821660009081526036602052604090205460ff1661165a57506000919050565b60335460005b818110156116eb57836033828154811061167c5761167c614ddc565b60009182526020909120601082040154600f9091166002026101000a900461ffff16036116d9576116c882611092612710611092602861108c605c603e546140ab90919063ffffffff16565b6116d29084614e08565b92506116eb565b806116e381614e37565b915050611660565b505060345460005b8181101561177e57836034828154811061170f5761170f614ddc565b60009182526020909120601082040154600f9091166002026101000a900461ffff160361176c5761175b82611092612710611092600a61108c605c603e546140ab90919063ffffffff16565b6117659084614e08565b925061177e565b8061177681614e37565b9150506116f3565b5050919050565b6060816000816001600160401b038111156117a2576117a2614b31565b6040519080825280602002602001820160405280156117f457816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816117c05790505b50905060005b8281146118475761182286868381811061181657611816614ddc565b905060200201356129a9565b82828151811061183457611834614ddc565b60209081029190910101526001016117fa565b50949350505050565b6000610b0f826141dc565b3260009081526039602052604090205460ff1615801561188657506008546001600160a01b03163314155b156118a35760405162461bcd60e51b8152600401610cdc90614d03565b60408260ff16106118e65760405162461bcd60e51b815260206004820152600d60248201526c6d6178203634206d617463687360981b6044820152606401610cdc565b60ff808316600090815260306020526040902054600160a81b9004161561194a5760405162461bcd60e51b81526020600482015260186024820152771d1a1a5cc81c9bdd5b99081a1859081c1d589b1a5cda195960421b6044820152606401610cdc565b60ff821660009081526030602052604090205461010090046001600160a01b03161580611996575060ff821660009081526030602052604090205461010090046001600160a01b031633145b15611a11576040805160608101825260ff80841682523360208084019182526000848601818152888516825260309092529490942092518354915194511515600160a81b0260ff60a81b196001600160a01b0396909616610100026001600160a81b0319909316919093161717929092169190911790555050565b60ff828116600090815260306020526040902054811690821614611a615760ff918216600090815260306020526040902080546001600160a81b031916336101000260ff19161791909216179055565b60005b60315461ffff82161015611b1a578160ff16600f60318361ffff1681548110611a8f57611a8f614ddc565b90600052602060002090600a91828204019190066003029054906101000a900462ffffff1662ffffff16901c601f1662ffffff1603611b085761ffff81166000908152603260205260408120805460019290611aef90849060ff16614e50565b92506101000a81548160ff021916908360ff1602179055505b80611b1281614e75565b915050611a64565b5060ff82166000908152603060205260409020805460ff60a81b1916600160a81b1790555050565b60006001600160a01b038216611b6b576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b611b98613d39565b611ba26000614243565b565b3260009081526039602052604090205460ff16158015611bcf57506008546001600160a01b03163314155b15611bec5760405162461bcd60e51b8152600401610cdc90614d03565b602b544210611c355760405162461bcd60e51b8152602060048201526015602482015274141d589b1a58c814d85b195cc8119a5b9a5cda1959605a1b6044820152606401610cdc565b60315461258090611c4b9061ffff841690614e08565b1115611c885760405162461bcd60e51b815260206004820152600c60248201526b1b585e081b999d081cdbdb1960a21b6044820152606401610cdc565b611c96828261ffff166140de565b60005b8161ffff168160ff161015610c1057603180546001810182556000919091527fc54045fa7c6ec765e825df7f9e9bf9dec12c5cef146f93a5eee56772ee647fbc600a808304919091018054919092066003026101000a62ffffff021916905580611d0281614e96565b915050611c99565b6000806000611d17613d39565b5050603c54603b54738c0813590b65952197f5654ec953ccc601725bee936001600160a01b039283169350911690565b60606000806000611d5785611b42565b90506000816001600160401b03811115611d7357611d73614b31565b604051908082528060200260200182016040528015611d9c578160200160208202803683370190505b509050611dc960408051608081018252600080825260208201819052918101829052606081019190915290565b60005b838614611e4357611ddc81614295565b91508160400151611e3b5781516001600160a01b031615611dfc57815194505b876001600160a01b0316856001600160a01b031603611e3b5780838780600101985081518110611e2e57611e2e614ddc565b6020026020010181815250505b600101611dcc565b50909695505050505050565b611e57613d39565b602e55565b606060038054610b3590614cc9565b6060818310611e8d57604051631960ccad60e11b815260040160405180910390fd5b600080611e9960005490565b905080841115611ea7578093505b6000611eb287611b42565b905084861015611ed15785850381811015611ecb578091505b50611ed5565b5060005b6000816001600160401b03811115611eef57611eef614b31565b604051908082528060200260200182016040528015611f18578160200160208202803683370190505b50905081600003611f2e579350611fdd92505050565b6000611f39886129a9565b905060008160400151611f4a575080515b885b888114158015611f5c5750848714155b15611fd157611f6a81614295565b92508260400151611fc95782516001600160a01b031615611f8a57825191505b8a6001600160a01b0316826001600160a01b031603611fc95780848880600101995081518110611fbc57611fbc614ddc565b6020026020010181815250505b600101611f4c565b50505092835250909150505b9392505050565b3260009081526039602052604090205460ff1615801561200f57506008546001600160a01b03163314155b1561202c5760405162461bcd60e51b8152600401610cdc90614d03565b600019602b54146120725760405162461bcd60e51b815260206004820152601060248201526f14da1d59999b19481a185c1c195b995960821b6044820152606401610cdc565b42602b819055603d541561212a57603c54603d5460405163d8a4676f60e01b815260009283926001600160a01b039091169163d8a4676f916120ba9160040190815260200190565b600060405180830381865afa1580156120d7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120ff9190810190614ed8565b915091508115612127578060008151811061211c5761211c614ddc565b602002602001015192505b50505b603c54604051634039d7e760e11b81526125806004820152602481018390526000916001600160a01b031690638073afce90604401600060405180830381865afa15801561217c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121a49190810190614f84565b905060005b60315481101561228957600061012c8383815181106121ca576121ca614ddc565b602002602001015161ffff16816121e3576121e361501d565b0461ffff169050600061012c84848151811061220157612201614ddc565b602002602001015161ffff168161221a5761221a61501d565b0661ffff16905060068162ffffff16901b600f8362ffffff16901b016031848154811061224957612249614ddc565b90600052602060002090600a91828204019190066003026101000a81548162ffffff021916908362ffffff160217905550505080806001019150506121a9565b506040514281527f4e79c0a66a5bc111570353aa23cc02a57113c396631897691b3bcce74bc015f590602001610f7a565b816122c481613dba565b610c1083836142d1565b3233146122ed5760405162461bcd60e51b8152600401610cdc90614d53565b60026009540361230f5760405162461bcd60e51b8152600401610cdc90615033565b6002600955602b544210156123665760405162461bcd60e51b815260206004820152601960248201527f5075626c69632053616c6573204e6f742046696e6973686564000000000000006044820152606401610cdc565b60208160ff16106123b15760405162461bcd60e51b815260206004820152601560248201527413db9b1e480ccc881d19585b5cc81cdd5c1c1bdc9d605a1b6044820152606401610cdc565b6123be8261ffff16613d93565b6123fd5760405162461bcd60e51b815260206004820152601060248201526f746f6b656e206e6f742065786973747360801b6044820152606401610cdc565b3361240b61ffff8416611850565b6001600160a01b0316146124315760405162461bcd60e51b8152600401610cdc90614d81565b60318261ffff168154811061244857612448614ddc565b6000918252602091829020600a8083049091015491066003026101000a900416156124a15760405162461bcd60e51b81526020600482015260096024820152682132ba103a37b5b2b760b91b6044820152606401610cdc565b602e543410156124ea5760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d0814185e5b595b9d60621b6044820152606401610cdc565b8060201760ff1660318361ffff168154811061250857612508614ddc565b90600052602060002090600a91828204019190066003028282829054906101000a900462ffffff1661253a919061506a565b825461010092830a62ffffff81810219909216929091160217909155603a80546001810182556000919091527fa2999d817b6757290b50e8ecf3fa939673403dd35c97de392fdb343b4015ce9e60108204018054600f90921660020290920a61ffff818102199092169186160217905550602e5434111561265257602e5460009033906125c890349061433d565b604051600081818185875af1925050503d8060008114612604576040519150601f19603f3d011682016040523d82523d6000602084013e612609565b606091505b50509050806126505760405162461bcd60e51b815260206004820152601360248201527210995d081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610cdc565b505b602e54603e60008282546126669190614e08565b909155505060016009555050565b836001600160a01b038116331461268e5761268e33613dba565b61269a85858585614349565b5050505050565b3233146126c05760405162461bcd60e51b8152600401610cdc90614d53565b6002600954036126e25760405162461bcd60e51b8152600401610cdc90615033565b6002600955336126f182611850565b6001600160a01b0316146127175760405162461bcd60e51b8152600401610cdc90614d81565b604060005260306020526000805160206154b683398151915254600160a81b900460ff166127575760405162461bcd60e51b8152600401610cdc90614da5565b61ffff811660009081526036602052604090205460ff1661278a5760405162461bcd60e51b8152600401610cdc90615091565b603354600090815b8181101561281d5783603382815481106127ae576127ae614ddc565b60009182526020909120601082040154600f9091166002026101000a900461ffff160361280b576127fa82611092612710611092602861108c605c603e546140ab90919063ffffffff16565b6128049084614e08565b925061281d565b8061281581614e37565b915050612792565b505060345460005b818110156128b057836034828154811061284157612841614ddc565b60009182526020909120601082040154600f9091166002026101000a900461ffff160361289e5761288d82611092612710611092600a61108c605c603e546140ab90919063ffffffff16565b6128979084614e08565b92506128b0565b806128a881614e37565b915050612825565b50604051600090339084908381818185875af1925050503d80600081146128f3576040519150601f19603f3d011682016040523d82523d6000602084013e6128f8565b606091505b50509050806129415760405162461bcd60e51b815260206004820152601560248201527410db185a5b481d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610cdc565b61ffff8416600090815260366020908152604091829020805460ff1916905581513381529081018690529081018490527fd08149829b4708b5a796078ac79020343425f5db94b97dfc5fe89f1e9caffb139060600160405180910390a1505060016009555050565b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060005483106129fd5792915050565b612a0683614295565b9050806040015115612a185792915050565b611fdd8361438d565b323314612a405760405162461bcd60e51b8152600401610cdc90614d53565b602a54421015612a925760405162461bcd60e51b815260206004820152601860248201527f5075626c69632053616c6573204e6f74205374617274656400000000000000006044820152606401610cdc565b602b544210612adb5760405162461bcd60e51b8152602060048201526015602482015274141d589b1a58c814d85b195cc8119a5b9a5cda1959605a1b6044820152606401610cdc565b33600090815260386020526040902054600490612afc90839060ff16614e50565b60ff161115612b4d5760405162461bcd60e51b815260206004820152601d60248201527f6d61782034207075626c69632073616c65204e465420616c6c6f7765640000006044820152606401610cdc565b60315461258090612b629060ff841690614e08565b1115612b9f5760405162461bcd60e51b815260206004820152600c60248201526b1b585e081b999d081cdbdb1960a21b6044820152606401610cdc565b612bac338260ff166140de565b60005b8160ff168160ff161015612c1f57603180546001810182556000919091527fc54045fa7c6ec765e825df7f9e9bf9dec12c5cef146f93a5eee56772ee647fbc600a808304919091018054919092066003026101000a62ffffff021916905580612c1781614e96565b915050612baf565b503360009081526038602052604081208054839290612c4290849060ff16614e50565b92506101000a81548160ff021916908360ff16021790555050565b6060612c67613d39565b8151612c7a90602c90602085019061469a565b507fbd6f5dd2ce6bb9b156a79d476e3238d1b38751859176633c23f0a0f4f53b63c182604051612caa91906147be565b60405180910390a1602c8054612cbf90614cc9565b80601f0160208091040260200160405190810160405280929190818152602001828054612ceb90614cc9565b8015612d385780601f10612d0d57610100808354040283529160200191612d38565b820191906000526020600020905b815481529060010190602001808311612d1b57829003601f168201915b50505050509050919050565b6060612d4f82613d93565b612d8f5760405162461bcd60e51b81526020600482015260116024820152703737b732bc34b9ba32b73a103a37b5b2b760791b6044820152606401610cdc565b602b54421015612dc757612da16143c2565b604051602001612db191906150dc565b6040516020818303038152906040529050919050565b600060318381548110612ddc57612ddc614ddc565b90600052602060002090600a91828204019190066003029054906101000a900462ffffff1690506000600a600f8362ffffff16901c601f1662ffffff1660208110612e2957612e29614ddc565b018054612e3590614cc9565b80601f0160208091040260200160405190810160405280929190818152602001828054612e6190614cc9565b8015612eae5780601f10612e8357610100808354040283529160200191612eae565b820191906000526020600020905b815481529060010190602001808311612e9157829003601f168201915b505050505090506000612ed260068462ffffff16901c6101ff1662ffffff166143d1565b604080518082019091526007815266139bdd0810995d60ca1b602082015290915060006101ff600686901c16612f11601f600f88901c1661012c61510a565b612f1b919061506a565b62ffffff1690506060602086161561300057600a601f871660208110612f4357612f43614ddc565b018054612f4f90614cc9565b80601f0160208091040260200160405190810160405280929190818152602001828054612f7b90614cc9565b8015612fc85780601f10612f9d57610100808354040283529160200191612fc8565b820191906000526020600020905b815481529060010190602001808311612fab57829003601f168201915b50505050509250612fd8826143d1565b83604051602001612fea929190615135565b604051602081830303815290604052905061302b565b613009826143d1565b604051602001613019919061518f565b60405160208183030381529060405290505b6000816130366143c2565b61303f856143d1565b888888604051602001613057969594939291906151c4565b604051602081830303815290604052905061307181614415565b60405160200161308191906153b8565b604051602081830303815290604052975050505050505050919050565b3260009081526039602052604090205460ff161580156130c957506008546001600160a01b03163314155b156130e65760405162461bcd60e51b8152600401610cdc90614d03565b8160ff166040146131395760405162461bcd60e51b815260206004820152601d60248201527f66696e616c20726f756e64206d757374206265203634206d61746368730000006044820152606401610cdc565b60ff808316600090815260306020526040902054600160a81b9004161561319d5760405162461bcd60e51b81526020600482015260186024820152771d1a1a5cc81c9bdd5b99081a1859081c1d589b1a5cda195960421b6044820152606401610cdc565b60ff821660009081526030602052604090205461010090046001600160a01b031615806131e9575060ff821660009081526030602052604090205461010090046001600160a01b031633145b15613264576040805160608101825260ff80841682523360208084019182526000848601818152888516825260309092529490942092518354915194511515600160a81b0260ff60a81b196001600160a01b0396909616610100026001600160a81b0319909316919093161717929092169190911790555050565b60ff8281166000908152603060205260409020548116908216146132b45760ff918216600090815260306020526040902080546001600160a81b031916336101000260ff19161791909216179055565b60315460005b818161ffff16101561347057600060318261ffff16815481106132df576132df614ddc565b90600052602060002090600a91828204019190066003029054906101000a900462ffffff1690508360ff16600f8262ffffff16901c601f1662ffffff16036133d25761ffff8216600090815260326020526040812080546001929061334890849060ff16614e50565b825460ff91821661010093840a9081029202191617909155603480546001818101909255601081047f46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c101805461ffff8089166002600f9095169490940290950a8381029502191693909317909255600091825260366020526040909120805460ff19169091179055505b60208116158015906133e95750601f811660ff8516145b1561345d57603380546001818101909255601081047f82a75bdeeae8604d839476ae9efd8b0e15aa447e21bfd7f41283bb54e22c9a8201805461ffff8087166002600f909516949094026101000a8481029102199091161790556000908152603660205260409020805460ff191690911790555b508061346881614e75565b9150506132ba565b506033546000036134a3575060ff82166000908152603060205260409020805460ff60a81b1916600160a81b1790555050565b60335460010361354c5760336000815481106134c1576134c1614ddc565b60009182526020822060108204015460358054600f9093166002026101000a90910461ffff1661ffff199092169190911790556033805490919061350757613507614ddc565b90600052602060002090601091828204019190066002029054906101000a900461ffff16603560026101000a81548161ffff021916908361ffff1602179055506137c5565b6033546002036135b357603360008154811061356a5761356a614ddc565b6000918252602090912060108204015460358054600f9093166002026101000a90910461ffff1661ffff1990921691909117905560338054600190811061350757613507614ddc565b603d5442901561366757603c54603d5460405163d8a4676f60e01b815260009283926001600160a01b039091169163d8a4676f916135f79160040190815260200190565b600060405180830381865afa158015613614573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261363c9190810190614ed8565b915091508115613664578060018151811061365957613659614ddc565b602002602001015192505b50505b603c54603354604051634039d7e760e11b815261ffff9091166004820152602481018390526000916001600160a01b031690638073afce90604401600060405180830381865afa1580156136bf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136e79190810190614f84565b90506033816000815181106136fe576136fe614ddc565b602002602001015161ffff168154811061371a5761371a614ddc565b6000918252602090912060108204015460358054600f9093166002026101000a90910461ffff1661ffff1990921691909117905580516033908290600190811061376657613766614ddc565b602002602001015161ffff168154811061378257613782614ddc565b90600052602060002090601091828204019190066002029054906101000a900461ffff16603560026101000a81548161ffff021916908361ffff16021790555050505b6037805461ffff19166101011790556035547f246071332ec3cecbddeebfd36569844838470b18b27bf4c8f06390c7ef630b0f9061ffff1661380681611850565b6040805161ffff90931683526001600160a01b0390911660208301520160405180910390a16035547f246071332ec3cecbddeebfd36569844838470b18b27bf4c8f06390c7ef630b0f9062010000900461ffff1661386381611850565b6040805161ffff90931683526001600160a01b0390911660208301520160405180910390a15060ff821660009081526030602090815260408220805460ff60a81b1916600160a81b179055612580909152603690527f11c0ccfb97a6042c43c2edb5a89642faf75742170dd1ae5b00d64d60aa31b429805460ff191660011790555050565b60008060006138f684613d93565b6139365760405162461bcd60e51b81526020600482015260116024820152703737b732bc34b9ba32b73a103a37b5b2b760791b6044820152606401610cdc565b60006031858154811061394b5761394b614ddc565b90600052602060002090600a91828204019190066003029054906101000a900462ffffff16905060008160201662ffffff16111561398e57601f81169150613993565b602091505b601f600f82901c169560069190911c6101ff1694509092509050565b3233146139ce5760405162461bcd60e51b8152600401610cdc90614d53565b6002600954036139f05760405162461bcd60e51b8152600401610cdc90615033565b6002600955336139ff82611850565b6001600160a01b031614613a255760405162461bcd60e51b8152600401610cdc90614d81565b604060005260306020526000805160206154b683398151915254600160a81b900460ff16613a655760405162461bcd60e51b8152600401610cdc90614da5565b60355460009061ffff168203613ad45760375460ff16613a975760405162461bcd60e51b8152600401610cdc90615091565b613abd6002611092612710611092603261108c605c603e546140ab90919063ffffffff16565b613ac79082614e08565b6037805460ff1916905590505b60355462010000900461ffff168203613b4c57603754610100900460ff16613b0e5760405162461bcd60e51b8152600401610cdc90615091565b613b346002611092612710611092603261108c605c603e546140ab90919063ffffffff16565b613b3e9082614e08565b6037805461ff001916905590505b604051600090339083908381818185875af1925050503d8060008114613b8e576040519150601f19603f3d011682016040523d82523d6000602084013e613b93565b606091505b5050905080613bdc5760405162461bcd60e51b815260206004820152601560248201527410db185a5b481d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610cdc565b60408051338152602081018590529081018390527fd08149829b4708b5a796078ac79020343425f5db94b97dfc5fe89f1e9caffb139060600160405180910390a15050600160095550565b613c2f613d39565b737b0dc23e87febf1d053e7df9af4cce30f21fae9cff5b613c4e613d39565b60005b81811015610c1057600160396000858585818110613c7157613c71614ddc565b9050602002016020810190613c869190614a0c565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580613cb881614e37565b915050613c51565b613cc8613d39565b6001600160a01b038116613d2d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610cdc565b613d3681614243565b50565b6008546001600160a01b03163314611ba25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cdc565b6000805482108015610b0f575050600090815260046020526040902054600160e01b161590565b6daaeb6d7670e522a718067333cd4e3b15613d3657604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015613e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e4b91906153fd565b613d3657604051633b79c77360e21b81526001600160a01b0382166004820152602401610cdc565b6000613e7e82611850565b9050336001600160a01b03821614613eb757613e9a8133610a75565b613eb7576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000613f1e826141dc565b9050836001600160a01b0316816001600160a01b031614613f515760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417613f9e57613f818633610a75565b613f9e57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516613fc557604051633a954ecd60e21b815260040160405180910390fd5b8015613fd057600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003614062576001840160008181526004602052604081205490036140605760005481146140605760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6000611fdd828461541a565b6000611fdd8284615439565b610c1083838360405180602001604052806000815250612674565b60008054908290036141035760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146141b257808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161417a565b50816000036141d357604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008160005481101561422a5760008181526004602052604081205490600160e01b82169003614228575b80600003611fdd575060001901600081815260046020526040902054614207565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610b0f90614567565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000611fdd8284614e20565b614354848484610fe1565b6001600160a01b0383163b1561100657614370848484846145ae565b611006576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610b0f6143bd836141dc565b614567565b6060602c8054610b3590614cc9565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806143eb5750819003601f19909101908152919050565b6060815160000361443457505060408051602081019091526000815290565b60006040518060600160405280604081526020016154d660409139905060006003845160026144639190614e08565b61446d9190615439565b61447890600461541a565b6001600160401b0381111561448f5761448f614b31565b6040519080825280601f01601f1916602001820160405280156144b9576020820181803683370190505b509050600182016020820185865187015b80821015614525576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506144ca565b505060038651066001811461454157600281146145545761455c565b603d6001830353603d600283035361455c565b603d60018303535b509195945050505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906145e390339089908890889060040161545b565b6020604051808303816000875af192505050801561461e575060408051601f3d908101601f1916820190925261461b91810190615498565b60015b61467c573d80801561464c576040519150601f19603f3d011682016040523d82523d6000602084013e614651565b606091505b508051600003614674576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b8280546146a690614cc9565b90600052602060002090601f0160209004810192826146c8576000855561470e565b82601f106146e157805160ff191683800117855561470e565b8280016001018555821561470e579182015b8281111561470e5782518255916020019190600101906146f3565b5061471a92915061471e565b5090565b5b8082111561471a576000815560010161471f565b6001600160e01b031981168114613d3657600080fd5b60006020828403121561475b57600080fd5b8135611fdd81614733565b60005b83811015614781578181015183820152602001614769565b838111156110065750506000910152565b600081518084526147aa816020860160208601614766565b601f01601f19169290920160200192915050565b602081526000611fdd6020830184614792565b6000602082840312156147e357600080fd5b5035919050565b80356001600160a01b03811681146110f857600080fd5b6000806040838503121561481457600080fd5b61481d836147ea565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015611e4357835161ffff1683529284019291840191600101614847565b60008060006060848603121561487c57600080fd5b614885846147ea565b9250614893602085016147ea565b9150604084013590509250925092565b803560ff811681146110f857600080fd5b6000602082840312156148c657600080fd5b611fdd826148a3565b60008083601f8401126148e157600080fd5b5081356001600160401b038111156148f857600080fd5b6020830191508360208260051b850101111561491357600080fd5b9250929050565b6000806020838503121561492d57600080fd5b82356001600160401b0381111561494357600080fd5b61494f858286016148cf565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611e43576149c683855161495b565b92840192608092909201916001016149b3565b600080604083850312156149ec57600080fd5b6149f5836148a3565b9150614a03602084016148a3565b90509250929050565b600060208284031215614a1e57600080fd5b611fdd826147ea565b61ffff81168114613d3657600080fd5b60008060408385031215614a4a57600080fd5b614a53836147ea565b91506020830135614a6381614a27565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015611e4357835183529284019291840191600101614a8a565b600080600060608486031215614abb57600080fd5b614ac4846147ea565b95602085013595506040909401359392505050565b8015158114613d3657600080fd5b60008060408385031215614afa57600080fd5b614b03836147ea565b91506020830135614a6381614ad9565b60008060408385031215614b2657600080fd5b82356149f581614a27565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614b6f57614b6f614b31565b604052919050565b60006001600160401b03831115614b9057614b90614b31565b614ba3601f8401601f1916602001614b47565b9050828152838383011115614bb757600080fd5b828260208301376000602084830101529392505050565b60008060008060808587031215614be457600080fd5b614bed856147ea565b9350614bfb602086016147ea565b92506040850135915060608501356001600160401b03811115614c1d57600080fd5b8501601f81018713614c2e57600080fd5b614c3d87823560208401614b77565b91505092959194509250565b60808101610b0f828461495b565b600060208284031215614c6957600080fd5b81356001600160401b03811115614c7f57600080fd5b8201601f81018413614c9057600080fd5b61469284823560208401614b77565b60008060408385031215614cb257600080fd5b614cbb836147ea565b9150614a03602084016147ea565b600181811c90821680614cdd57607f821691505b602082108103614cfd57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601e908201527f4f6e6c79204f70657261746f72204163636f756e747320416c6c6f7765640000604082015260600190565b600060208284031215614d4c57600080fd5b5051919050565b60208082526014908201527327b7363c9024b73234bb34b23ab0b6102ab9b2b960611b604082015260600190565b6020808252600a908201526927b7363c9037bbb732b960b11b604082015260600190565b60208082526019908201527f46696e616c2077696e6e6572206e6f742072656c656173656400000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115614e1b57614e1b614df2565b500190565b600082821015614e3257614e32614df2565b500390565b600060018201614e4957614e49614df2565b5060010190565b600060ff821660ff84168060ff03821115614e6d57614e6d614df2565b019392505050565b600061ffff808316818103614e8c57614e8c614df2565b6001019392505050565b600060ff821660ff8103614eac57614eac614df2565b60010192915050565b60006001600160401b03821115614ece57614ece614b31565b5060051b60200190565b60008060408385031215614eeb57600080fd5b8251614ef681614ad9565b809250506020808401516001600160401b03811115614f1457600080fd5b8401601f81018613614f2557600080fd5b8051614f38614f3382614eb5565b614b47565b81815260059190911b82018301908381019088831115614f5757600080fd5b928401925b82841015614f7557835182529284019290840190614f5c565b80955050505050509250929050565b60006020808385031215614f9757600080fd5b82516001600160401b03811115614fad57600080fd5b8301601f81018513614fbe57600080fd5b8051614fcc614f3382614eb5565b81815260059190911b82018301908381019087831115614feb57600080fd5b928401925b8284101561501257835161500381614a27565b82529284019290840190614ff0565b979650505050505050565b634e487b7160e01b600052601260045260246000fd5b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600062ffffff80831681851680830382111561508857615088614df2565b01949350505050565b6020808252601590820152741b9bc8199d5b99081bdc8818d85cda1959081bdd5d605a1b604082015260600190565b600081516150d2818560208601614766565b9290920192915050565b600082516150ee818460208701614766565b6931b7bb32b9173539b7b760b11b920191825250600a01919050565b600062ffffff8083168185168183048111821515161561512c5761512c614df2565b02949350505050565b6c417a75476f616c204e4654202360981b81526000835161515d81600d850160208801614766565b65e2ad90efb88f60d01b600d918401918201528351615183816013840160208801614766565b01601301949350505050565b6c417a75476f616c204e4654202360981b8152600082516151b781600d850160208701614766565b91909101600d0192915050565b693d913730b6b2911d101160b11b815286516000906151ea81600a850160208c01614766565b7f222c20226465736372697074696f6e223a2022417a75476f616c20576f726c64600a918401918201527421bab810191819191116101134b6b0b3b2911d101160591b602a820152875161524581603f840160208c01614766565b875191019061525b81603f840160208b01614766565b7f2e706e67222c202264657369676e6572223a202269736f746f702e746f70222c603f92909101918201527f2261747472696275746573223a205b7b2274726169745f74797065223a202249605f8201527f6e2d6d656d6f7279222c2276616c7565223a2022576f726c6443757020323032607f8201527f32227d2c207b2274726169745f74797065223a20225465616d222c2276616c75609f8201526432911d101160d91b60bf8201526153ab61539b61539561536061535a61532260c487018c6150c0565b7f227d2c207b2274726169745f74797065223a20224e756d626572222c2276616c8152653ab2911d101160d11b602082015260260190565b896150c0565b7f227d2c207b2274726169745f74797065223a2022426574222c2276616c7565228152621d101160e91b602082015260230190565b866150c0565b63227d5d7d60e01b815260040190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516153f081601d850160208701614766565b91909101601d0192915050565b60006020828403121561540f57600080fd5b8151611fdd81614ad9565b600081600019048311821515161561543457615434614df2565b500290565b60008261545657634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061548e90830184614792565b9695505050505050565b6000602082840312156154aa57600080fd5b8151611fdd8161473356fe9162896c89f2817382e37e4cce16bd90663a1699fb4d15731f7aab2fba66192a4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212204c5b1c14f64e313df5a5c5b11e31a5a5cb42d33bb8c48343657773980916edea64736f6c634300080d00330000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000001770000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656965366a7978796b69703334366f637869336b6c6d326b3234676b766f78376a6d7666706a76616d6a7673616c7934746f786771342f0000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106103355760003560e01c80636b747d63116101ab578063b88d4fde116100f7578063cc33c87511610095578063d826f88f1161006f578063d826f88f14610a25578063ddf71cd514610a3a578063e985e9c514610a5a578063f2fde38b14610aa357600080fd5b8063cc33c875146109b2578063ce70cd8d146109ed578063d58b83e314610a0d57600080fd5b8063c76df80e116100d1578063c76df80e14610932578063c82b942514610952578063c87b56dd14610972578063ca905dc01461099257600080fd5b8063b88d4fde146108d2578063be9a2d23146108e5578063c23dc68f1461090557600080fd5b80638da5cb5b1161016457806399a2557a1161013e57806399a2557a1461086a578063a21555391461088a578063a22cb4651461089f578063a7d2161c146108bf57600080fd5b80638da5cb5b1461081757806391b7f5ed1461083557806395d89b411461085557600080fd5b80636b747d631461074057806370a0823114610756578063715018a6146107765780637679e0561461078b57806379502c55146107ab5780638462151c146107ea57600080fd5b806323b872dd1161028557806342842e0e1161022357806355d5a012116101fd57806355d5a012146106b35780635bbb2177146106d35780636352211e14610700578063644ae0631461072057600080fd5b806342842e0e146105d3578063436ffa3f146105e6578063535a70231461069357600080fd5b806332cb6b0c1161025f57806332cb6b0c146105495780633ccfd60b1461057257806341f434341461059c578063422326f4146105be57600080fd5b806323b872dd146104e457806328b6b4f8146104f75780632c09e7c11461051757600080fd5b80630c1c972a116102f257806314748994116102cc578063147489941461046d57806318160ddd146104825780631845994d1461049b5780631e84c413146104cc57600080fd5b80630c1c972a146104235780630c41f4971461043857806313069dfd1461044d57600080fd5b806301ffc9a71461033a578063026b1d5f1461036f57806306fdde0314610392578063081812fc146103b4578063095ea7b3146103ec57806309eeebb014610401575b600080fd5b34801561034657600080fd5b5061035a610355366004614749565b610ac3565b60405190151581526020015b60405180910390f35b34801561037b57600080fd5b50610384610b15565b604051908152602001610366565b34801561039e57600080fd5b506103a7610b26565b60405161036691906147be565b3480156103c057600080fd5b506103d46103cf3660046147d1565b610bb8565b6040516001600160a01b039091168152602001610366565b6103ff6103fa366004614801565b610bfc565b005b34801561040d57600080fd5b50610416610c15565b604051610366919061482b565b34801561042f57600080fd5b506103ff610c94565b34801561044457600080fd5b506103ff610d91565b34801561045957600080fd5b506103ff6104683660046147d1565b610e0f565b34801561047957600080fd5b50610416610f86565b34801561048e57600080fd5b5060015460005403610384565b3480156104a757600080fd5b506035546040805161ffff808416825262010000909304909216602083015201610366565b3480156104d857600080fd5b50602a5442101561035a565b6103ff6104f2366004614867565b610fe1565b34801561050357600080fd5b506103846105123660046147d1565b61100c565b34801561052357600080fd5b506105376105323660046147d1565b6110fd565b60405160ff9091168152602001610366565b34801561055557600080fd5b5061055f61258081565b60405161ffff9091168152602001610366565b34801561057e57600080fd5b50610587611161565b60408051928352602083019190915201610366565b3480156105a857600080fd5b506103d46daaeb6d7670e522a718067333cd4e81565b3480156105ca57600080fd5b50610416611436565b6103ff6105e1366004614867565b611491565b3480156105f257600080fd5b506106636106013660046148b4565b60408051606080820183526000808352602080840182905292840181905260ff9485168152603083528390208351918201845254808516825261010081046001600160a01b031692820192909252600160a81b90910490921615159082015290565b60408051825160ff1681526020808401516001600160a01b03169082015291810151151590820152606001610366565b34801561069f57600080fd5b506103ff6106ae36600461491a565b6114b6565b3480156106bf57600080fd5b506103846106ce3660046147d1565b6115f5565b3480156106df57600080fd5b506106f36106ee36600461491a565b611785565b6040516103669190614997565b34801561070c57600080fd5b506103d461071b3660046147d1565b611850565b34801561072c57600080fd5b506103ff61073b3660046149d9565b61185b565b34801561074c57600080fd5b5061038460001981565b34801561076257600080fd5b50610384610771366004614a0c565b611b42565b34801561078257600080fd5b506103ff611b90565b34801561079757600080fd5b506103ff6107a6366004614a37565b611ba4565b3480156107b757600080fd5b506107c0611d0a565b604080516001600160a01b0394851681529284166020840152921691810191909152606001610366565b3480156107f657600080fd5b5061080a610805366004614a0c565b611d47565b6040516103669190614a6e565b34801561082357600080fd5b506008546001600160a01b03166103d4565b34801561084157600080fd5b506103ff6108503660046147d1565b611e4f565b34801561086157600080fd5b506103a7611e5c565b34801561087657600080fd5b5061080a610885366004614aa6565b611e6b565b34801561089657600080fd5b506103ff611fe4565b3480156108ab57600080fd5b506103ff6108ba366004614ae7565b6122ba565b6103ff6108cd366004614b13565b6122ce565b6103ff6108e0366004614bce565b612674565b3480156108f157600080fd5b506103ff6109003660046147d1565b6126a1565b34801561091157600080fd5b506109256109203660046147d1565b6129a9565b6040516103669190614c49565b34801561093e57600080fd5b506103ff61094d3660046148b4565b612a21565b34801561095e57600080fd5b506103a761096d366004614c57565b612c5d565b34801561097e57600080fd5b506103a761098d3660046147d1565b612d44565b34801561099e57600080fd5b506103ff6109ad3660046149d9565b61309e565b3480156109be57600080fd5b506109d26109cd3660046147d1565b6138e8565b60408051938452602084019290925290820152606001610366565b3480156109f957600080fd5b506103ff610a083660046147d1565b6139af565b348015610a1957600080fd5b50602b5442101561035a565b348015610a3157600080fd5b506103ff613c27565b348015610a4657600080fd5b506103ff610a5536600461491a565b613c46565b348015610a6657600080fd5b5061035a610a75366004614c9f565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610aaf57600080fd5b506103ff610abe366004614a0c565b613cc0565b60006301ffc9a760e01b6001600160e01b031983161480610af457506380ac58cd60e01b6001600160e01b03198316145b80610b0f5750635b5e139f60e01b6001600160e01b03198316145b92915050565b6000610b1f613d39565b50603e5490565b606060028054610b3590614cc9565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6190614cc9565b8015610bae5780601f10610b8357610100808354040283529160200191610bae565b820191906000526020600020905b815481529060010190602001808311610b9157829003601f168201915b5050505050905090565b6000610bc382613d93565b610be0576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b81610c0681613dba565b610c108383613e73565b505050565b6060603a805480602002602001604051908101604052809291908181526020018280548015610bae57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411610c525790505050505050905090565b3260009081526039602052604090205460ff16158015610cbf57506008546001600160a01b03163314155b15610ce55760405162461bcd60e51b8152600401610cdc90614d03565b60405180910390fd5b42602a55603c5460405163e726f2e160e01b8152600260048201526001600160a01b039091169063e726f2e1906024016020604051808303816000875af1158015610d34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d589190614d3a565b603d556040514281527ff5873041cf54025a0d378efc70d90938908e7499c3f41d007dc37938ae92345d906020015b60405180910390a1565b3260009081526039602052604090205460ff16158015610dbc57506008546001600160a01b03163314155b15610dd95760405162461bcd60e51b8152600401610cdc90614d03565b600019602a556040514281527f1557f02db43c040d49a0619c1083e57b0c263e11d8dd388416ab9a6ce1a4380f90602001610d87565b323314610e2e5760405162461bcd60e51b8152600401610cdc90614d53565b33610e3882611850565b6001600160a01b031614610e5e5760405162461bcd60e51b8152600401610cdc90614d81565b61ffff811660009081526032602052604081205460ff1690819003610eb95760405162461bcd60e51b81526020600482015260116024820152701b9bc8185a5c991c9bdc1cc8199bdd5b99607a1b6044820152606401610cdc565b603b546040516340c10f1960e01b815233600482015260ff831660248201526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610f0757600080fd5b505af1158015610f1b573d6000803e3d6000fd5b5050505061ffff8216600090815260326020908152604091829020805460ff19169055815133815290810184905260ff8316918101919091527f2f977e68df69d63cdf91a6aa90360df2140f3e62de2b992f6152b00d3714d98e906060015b60405180910390a15050565b60606033805480602002602001604051908101604052809291908181526020018280548015610bae576000918252602091829020805461ffff168452908202830192909160029101808411610c525790505050505050905090565b826001600160a01b0381163314610ffb57610ffb33613dba565b611006848484613f13565b50505050565b6040600090815260306020526000805160206154b683398151915254600160a81b900460ff1661104e5760405162461bcd60e51b8152600401610cdc90614da5565b60355461ffff1682036110a55760375460ff16156110a5576110986002611092612710611092603261108c605c603e546140ab90919063ffffffff16565b906140ab565b906140b7565b6110a29082614e08565b90505b60355462010000900461ffff1682036110f857603754610100900460ff16156110f8576110ee6002611092612710611092603261108c605c603e546140ab90919063ffffffff16565b610b0f9082614e08565b919050565b600061110882613d93565b6111475760405162461bcd60e51b815260206004820152601060248201526f746f6b656e206e6f742065786973747360801b6044820152606401610cdc565b5061ffff1660009081526032602052604090205460ff1690565b60008061116c613d39565b604060005260306020526000805160206154b683398151915254600160a81b900460ff166111dc5760405162461bcd60e51b815260206004820152601960248201527f66696e616c2077696e6e6572206e6f742072657665616c6564000000000000006044820152606401610cdc565b61258060005260366020527f11c0ccfb97a6042c43c2edb5a89642faf75742170dd1ae5b00d64d60aa31b4295460ff166112585760405162461bcd60e51b815260206004820152601e60248201527f636173686564206e6f74207265616479206f7220636173686564206f757400006044820152606401610cdc565b600061127560646110926008603e546140ab90919063ffffffff16565b602f54909150611292906103e89061109290849061ffff166140ab565b925061129e8382614e20565b604051909250600090737b0dc23e87febf1d053e7df9af4cce30f21fae9c9085908381818185875af1925050503d80600081146112f7576040519150601f19603f3d011682016040523d82523d6000602084013e6112fc565b606091505b5050604051909150600090739da32f03cc23f9156daa7442cadbe8366ddac1239085908381818185875af1925050503d8060008114611357576040519150601f19603f3d011682016040523d82523d6000602084013e61135c565b606091505b5050905081801561136a5750805b6113b65760405162461bcd60e51b815260206004820152601860248201527f7769746864726177207472616e73666572206661696c656400000000000000006044820152606401610cdc565b6125806000819052603660209081527f11c0ccfb97a6042c43c2edb5a89642faf75742170dd1ae5b00d64d60aa31b429805460ff1916905560408051338152918201929092529081018490527fd08149829b4708b5a796078ac79020343425f5db94b97dfc5fe89f1e9caffb139060600160405180910390a15050509091565b60606034805480602002602001604051908101604052809291908181526020018280548015610bae576000918252602091829020805461ffff168452908202830192909160029101808411610c525790505050505050905090565b826001600160a01b03811633146114ab576114ab33613dba565b6110068484846140c3565b6114be613d39565b60005b81811015610c10576114fa8383838181106114de576114de614ddc565b90506020020160208101906114f39190614a0c565b60016140de565b603b546001600160a01b03166340c10f1984848481811061151d5761151d614ddc565b90506020020160208101906115329190614a0c565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260016024820152604401600060405180830381600087803b15801561157a57600080fd5b505af115801561158e573d6000803e3d6000fd5b5050603180546001810182556000919091527fc54045fa7c6ec765e825df7f9e9bf9dec12c5cef146f93a5eee56772ee647fbc600a808304919091018054919092066003026101000a62ffffff0219169055508190506115ed81614e37565b9150506114c1565b6040600090815260306020526000805160206154b683398151915254600160a81b900460ff166116375760405162461bcd60e51b8152600401610cdc90614da5565b61ffff821660009081526036602052604090205460ff1661165a57506000919050565b60335460005b818110156116eb57836033828154811061167c5761167c614ddc565b60009182526020909120601082040154600f9091166002026101000a900461ffff16036116d9576116c882611092612710611092602861108c605c603e546140ab90919063ffffffff16565b6116d29084614e08565b92506116eb565b806116e381614e37565b915050611660565b505060345460005b8181101561177e57836034828154811061170f5761170f614ddc565b60009182526020909120601082040154600f9091166002026101000a900461ffff160361176c5761175b82611092612710611092600a61108c605c603e546140ab90919063ffffffff16565b6117659084614e08565b925061177e565b8061177681614e37565b9150506116f3565b5050919050565b6060816000816001600160401b038111156117a2576117a2614b31565b6040519080825280602002602001820160405280156117f457816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816117c05790505b50905060005b8281146118475761182286868381811061181657611816614ddc565b905060200201356129a9565b82828151811061183457611834614ddc565b60209081029190910101526001016117fa565b50949350505050565b6000610b0f826141dc565b3260009081526039602052604090205460ff1615801561188657506008546001600160a01b03163314155b156118a35760405162461bcd60e51b8152600401610cdc90614d03565b60408260ff16106118e65760405162461bcd60e51b815260206004820152600d60248201526c6d6178203634206d617463687360981b6044820152606401610cdc565b60ff808316600090815260306020526040902054600160a81b9004161561194a5760405162461bcd60e51b81526020600482015260186024820152771d1a1a5cc81c9bdd5b99081a1859081c1d589b1a5cda195960421b6044820152606401610cdc565b60ff821660009081526030602052604090205461010090046001600160a01b03161580611996575060ff821660009081526030602052604090205461010090046001600160a01b031633145b15611a11576040805160608101825260ff80841682523360208084019182526000848601818152888516825260309092529490942092518354915194511515600160a81b0260ff60a81b196001600160a01b0396909616610100026001600160a81b0319909316919093161717929092169190911790555050565b60ff828116600090815260306020526040902054811690821614611a615760ff918216600090815260306020526040902080546001600160a81b031916336101000260ff19161791909216179055565b60005b60315461ffff82161015611b1a578160ff16600f60318361ffff1681548110611a8f57611a8f614ddc565b90600052602060002090600a91828204019190066003029054906101000a900462ffffff1662ffffff16901c601f1662ffffff1603611b085761ffff81166000908152603260205260408120805460019290611aef90849060ff16614e50565b92506101000a81548160ff021916908360ff1602179055505b80611b1281614e75565b915050611a64565b5060ff82166000908152603060205260409020805460ff60a81b1916600160a81b1790555050565b60006001600160a01b038216611b6b576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b611b98613d39565b611ba26000614243565b565b3260009081526039602052604090205460ff16158015611bcf57506008546001600160a01b03163314155b15611bec5760405162461bcd60e51b8152600401610cdc90614d03565b602b544210611c355760405162461bcd60e51b8152602060048201526015602482015274141d589b1a58c814d85b195cc8119a5b9a5cda1959605a1b6044820152606401610cdc565b60315461258090611c4b9061ffff841690614e08565b1115611c885760405162461bcd60e51b815260206004820152600c60248201526b1b585e081b999d081cdbdb1960a21b6044820152606401610cdc565b611c96828261ffff166140de565b60005b8161ffff168160ff161015610c1057603180546001810182556000919091527fc54045fa7c6ec765e825df7f9e9bf9dec12c5cef146f93a5eee56772ee647fbc600a808304919091018054919092066003026101000a62ffffff021916905580611d0281614e96565b915050611c99565b6000806000611d17613d39565b5050603c54603b54738c0813590b65952197f5654ec953ccc601725bee936001600160a01b039283169350911690565b60606000806000611d5785611b42565b90506000816001600160401b03811115611d7357611d73614b31565b604051908082528060200260200182016040528015611d9c578160200160208202803683370190505b509050611dc960408051608081018252600080825260208201819052918101829052606081019190915290565b60005b838614611e4357611ddc81614295565b91508160400151611e3b5781516001600160a01b031615611dfc57815194505b876001600160a01b0316856001600160a01b031603611e3b5780838780600101985081518110611e2e57611e2e614ddc565b6020026020010181815250505b600101611dcc565b50909695505050505050565b611e57613d39565b602e55565b606060038054610b3590614cc9565b6060818310611e8d57604051631960ccad60e11b815260040160405180910390fd5b600080611e9960005490565b905080841115611ea7578093505b6000611eb287611b42565b905084861015611ed15785850381811015611ecb578091505b50611ed5565b5060005b6000816001600160401b03811115611eef57611eef614b31565b604051908082528060200260200182016040528015611f18578160200160208202803683370190505b50905081600003611f2e579350611fdd92505050565b6000611f39886129a9565b905060008160400151611f4a575080515b885b888114158015611f5c5750848714155b15611fd157611f6a81614295565b92508260400151611fc95782516001600160a01b031615611f8a57825191505b8a6001600160a01b0316826001600160a01b031603611fc95780848880600101995081518110611fbc57611fbc614ddc565b6020026020010181815250505b600101611f4c565b50505092835250909150505b9392505050565b3260009081526039602052604090205460ff1615801561200f57506008546001600160a01b03163314155b1561202c5760405162461bcd60e51b8152600401610cdc90614d03565b600019602b54146120725760405162461bcd60e51b815260206004820152601060248201526f14da1d59999b19481a185c1c195b995960821b6044820152606401610cdc565b42602b819055603d541561212a57603c54603d5460405163d8a4676f60e01b815260009283926001600160a01b039091169163d8a4676f916120ba9160040190815260200190565b600060405180830381865afa1580156120d7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120ff9190810190614ed8565b915091508115612127578060008151811061211c5761211c614ddc565b602002602001015192505b50505b603c54604051634039d7e760e11b81526125806004820152602481018390526000916001600160a01b031690638073afce90604401600060405180830381865afa15801561217c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121a49190810190614f84565b905060005b60315481101561228957600061012c8383815181106121ca576121ca614ddc565b602002602001015161ffff16816121e3576121e361501d565b0461ffff169050600061012c84848151811061220157612201614ddc565b602002602001015161ffff168161221a5761221a61501d565b0661ffff16905060068162ffffff16901b600f8362ffffff16901b016031848154811061224957612249614ddc565b90600052602060002090600a91828204019190066003026101000a81548162ffffff021916908362ffffff160217905550505080806001019150506121a9565b506040514281527f4e79c0a66a5bc111570353aa23cc02a57113c396631897691b3bcce74bc015f590602001610f7a565b816122c481613dba565b610c1083836142d1565b3233146122ed5760405162461bcd60e51b8152600401610cdc90614d53565b60026009540361230f5760405162461bcd60e51b8152600401610cdc90615033565b6002600955602b544210156123665760405162461bcd60e51b815260206004820152601960248201527f5075626c69632053616c6573204e6f742046696e6973686564000000000000006044820152606401610cdc565b60208160ff16106123b15760405162461bcd60e51b815260206004820152601560248201527413db9b1e480ccc881d19585b5cc81cdd5c1c1bdc9d605a1b6044820152606401610cdc565b6123be8261ffff16613d93565b6123fd5760405162461bcd60e51b815260206004820152601060248201526f746f6b656e206e6f742065786973747360801b6044820152606401610cdc565b3361240b61ffff8416611850565b6001600160a01b0316146124315760405162461bcd60e51b8152600401610cdc90614d81565b60318261ffff168154811061244857612448614ddc565b6000918252602091829020600a8083049091015491066003026101000a900416156124a15760405162461bcd60e51b81526020600482015260096024820152682132ba103a37b5b2b760b91b6044820152606401610cdc565b602e543410156124ea5760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d0814185e5b595b9d60621b6044820152606401610cdc565b8060201760ff1660318361ffff168154811061250857612508614ddc565b90600052602060002090600a91828204019190066003028282829054906101000a900462ffffff1661253a919061506a565b825461010092830a62ffffff81810219909216929091160217909155603a80546001810182556000919091527fa2999d817b6757290b50e8ecf3fa939673403dd35c97de392fdb343b4015ce9e60108204018054600f90921660020290920a61ffff818102199092169186160217905550602e5434111561265257602e5460009033906125c890349061433d565b604051600081818185875af1925050503d8060008114612604576040519150601f19603f3d011682016040523d82523d6000602084013e612609565b606091505b50509050806126505760405162461bcd60e51b815260206004820152601360248201527210995d081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610cdc565b505b602e54603e60008282546126669190614e08565b909155505060016009555050565b836001600160a01b038116331461268e5761268e33613dba565b61269a85858585614349565b5050505050565b3233146126c05760405162461bcd60e51b8152600401610cdc90614d53565b6002600954036126e25760405162461bcd60e51b8152600401610cdc90615033565b6002600955336126f182611850565b6001600160a01b0316146127175760405162461bcd60e51b8152600401610cdc90614d81565b604060005260306020526000805160206154b683398151915254600160a81b900460ff166127575760405162461bcd60e51b8152600401610cdc90614da5565b61ffff811660009081526036602052604090205460ff1661278a5760405162461bcd60e51b8152600401610cdc90615091565b603354600090815b8181101561281d5783603382815481106127ae576127ae614ddc565b60009182526020909120601082040154600f9091166002026101000a900461ffff160361280b576127fa82611092612710611092602861108c605c603e546140ab90919063ffffffff16565b6128049084614e08565b925061281d565b8061281581614e37565b915050612792565b505060345460005b818110156128b057836034828154811061284157612841614ddc565b60009182526020909120601082040154600f9091166002026101000a900461ffff160361289e5761288d82611092612710611092600a61108c605c603e546140ab90919063ffffffff16565b6128979084614e08565b92506128b0565b806128a881614e37565b915050612825565b50604051600090339084908381818185875af1925050503d80600081146128f3576040519150601f19603f3d011682016040523d82523d6000602084013e6128f8565b606091505b50509050806129415760405162461bcd60e51b815260206004820152601560248201527410db185a5b481d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610cdc565b61ffff8416600090815260366020908152604091829020805460ff1916905581513381529081018690529081018490527fd08149829b4708b5a796078ac79020343425f5db94b97dfc5fe89f1e9caffb139060600160405180910390a1505060016009555050565b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060005483106129fd5792915050565b612a0683614295565b9050806040015115612a185792915050565b611fdd8361438d565b323314612a405760405162461bcd60e51b8152600401610cdc90614d53565b602a54421015612a925760405162461bcd60e51b815260206004820152601860248201527f5075626c69632053616c6573204e6f74205374617274656400000000000000006044820152606401610cdc565b602b544210612adb5760405162461bcd60e51b8152602060048201526015602482015274141d589b1a58c814d85b195cc8119a5b9a5cda1959605a1b6044820152606401610cdc565b33600090815260386020526040902054600490612afc90839060ff16614e50565b60ff161115612b4d5760405162461bcd60e51b815260206004820152601d60248201527f6d61782034207075626c69632073616c65204e465420616c6c6f7765640000006044820152606401610cdc565b60315461258090612b629060ff841690614e08565b1115612b9f5760405162461bcd60e51b815260206004820152600c60248201526b1b585e081b999d081cdbdb1960a21b6044820152606401610cdc565b612bac338260ff166140de565b60005b8160ff168160ff161015612c1f57603180546001810182556000919091527fc54045fa7c6ec765e825df7f9e9bf9dec12c5cef146f93a5eee56772ee647fbc600a808304919091018054919092066003026101000a62ffffff021916905580612c1781614e96565b915050612baf565b503360009081526038602052604081208054839290612c4290849060ff16614e50565b92506101000a81548160ff021916908360ff16021790555050565b6060612c67613d39565b8151612c7a90602c90602085019061469a565b507fbd6f5dd2ce6bb9b156a79d476e3238d1b38751859176633c23f0a0f4f53b63c182604051612caa91906147be565b60405180910390a1602c8054612cbf90614cc9565b80601f0160208091040260200160405190810160405280929190818152602001828054612ceb90614cc9565b8015612d385780601f10612d0d57610100808354040283529160200191612d38565b820191906000526020600020905b815481529060010190602001808311612d1b57829003601f168201915b50505050509050919050565b6060612d4f82613d93565b612d8f5760405162461bcd60e51b81526020600482015260116024820152703737b732bc34b9ba32b73a103a37b5b2b760791b6044820152606401610cdc565b602b54421015612dc757612da16143c2565b604051602001612db191906150dc565b6040516020818303038152906040529050919050565b600060318381548110612ddc57612ddc614ddc565b90600052602060002090600a91828204019190066003029054906101000a900462ffffff1690506000600a600f8362ffffff16901c601f1662ffffff1660208110612e2957612e29614ddc565b018054612e3590614cc9565b80601f0160208091040260200160405190810160405280929190818152602001828054612e6190614cc9565b8015612eae5780601f10612e8357610100808354040283529160200191612eae565b820191906000526020600020905b815481529060010190602001808311612e9157829003601f168201915b505050505090506000612ed260068462ffffff16901c6101ff1662ffffff166143d1565b604080518082019091526007815266139bdd0810995d60ca1b602082015290915060006101ff600686901c16612f11601f600f88901c1661012c61510a565b612f1b919061506a565b62ffffff1690506060602086161561300057600a601f871660208110612f4357612f43614ddc565b018054612f4f90614cc9565b80601f0160208091040260200160405190810160405280929190818152602001828054612f7b90614cc9565b8015612fc85780601f10612f9d57610100808354040283529160200191612fc8565b820191906000526020600020905b815481529060010190602001808311612fab57829003601f168201915b50505050509250612fd8826143d1565b83604051602001612fea929190615135565b604051602081830303815290604052905061302b565b613009826143d1565b604051602001613019919061518f565b60405160208183030381529060405290505b6000816130366143c2565b61303f856143d1565b888888604051602001613057969594939291906151c4565b604051602081830303815290604052905061307181614415565b60405160200161308191906153b8565b604051602081830303815290604052975050505050505050919050565b3260009081526039602052604090205460ff161580156130c957506008546001600160a01b03163314155b156130e65760405162461bcd60e51b8152600401610cdc90614d03565b8160ff166040146131395760405162461bcd60e51b815260206004820152601d60248201527f66696e616c20726f756e64206d757374206265203634206d61746368730000006044820152606401610cdc565b60ff808316600090815260306020526040902054600160a81b9004161561319d5760405162461bcd60e51b81526020600482015260186024820152771d1a1a5cc81c9bdd5b99081a1859081c1d589b1a5cda195960421b6044820152606401610cdc565b60ff821660009081526030602052604090205461010090046001600160a01b031615806131e9575060ff821660009081526030602052604090205461010090046001600160a01b031633145b15613264576040805160608101825260ff80841682523360208084019182526000848601818152888516825260309092529490942092518354915194511515600160a81b0260ff60a81b196001600160a01b0396909616610100026001600160a81b0319909316919093161717929092169190911790555050565b60ff8281166000908152603060205260409020548116908216146132b45760ff918216600090815260306020526040902080546001600160a81b031916336101000260ff19161791909216179055565b60315460005b818161ffff16101561347057600060318261ffff16815481106132df576132df614ddc565b90600052602060002090600a91828204019190066003029054906101000a900462ffffff1690508360ff16600f8262ffffff16901c601f1662ffffff16036133d25761ffff8216600090815260326020526040812080546001929061334890849060ff16614e50565b825460ff91821661010093840a9081029202191617909155603480546001818101909255601081047f46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c101805461ffff8089166002600f9095169490940290950a8381029502191693909317909255600091825260366020526040909120805460ff19169091179055505b60208116158015906133e95750601f811660ff8516145b1561345d57603380546001818101909255601081047f82a75bdeeae8604d839476ae9efd8b0e15aa447e21bfd7f41283bb54e22c9a8201805461ffff8087166002600f909516949094026101000a8481029102199091161790556000908152603660205260409020805460ff191690911790555b508061346881614e75565b9150506132ba565b506033546000036134a3575060ff82166000908152603060205260409020805460ff60a81b1916600160a81b1790555050565b60335460010361354c5760336000815481106134c1576134c1614ddc565b60009182526020822060108204015460358054600f9093166002026101000a90910461ffff1661ffff199092169190911790556033805490919061350757613507614ddc565b90600052602060002090601091828204019190066002029054906101000a900461ffff16603560026101000a81548161ffff021916908361ffff1602179055506137c5565b6033546002036135b357603360008154811061356a5761356a614ddc565b6000918252602090912060108204015460358054600f9093166002026101000a90910461ffff1661ffff1990921691909117905560338054600190811061350757613507614ddc565b603d5442901561366757603c54603d5460405163d8a4676f60e01b815260009283926001600160a01b039091169163d8a4676f916135f79160040190815260200190565b600060405180830381865afa158015613614573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261363c9190810190614ed8565b915091508115613664578060018151811061365957613659614ddc565b602002602001015192505b50505b603c54603354604051634039d7e760e11b815261ffff9091166004820152602481018390526000916001600160a01b031690638073afce90604401600060405180830381865afa1580156136bf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136e79190810190614f84565b90506033816000815181106136fe576136fe614ddc565b602002602001015161ffff168154811061371a5761371a614ddc565b6000918252602090912060108204015460358054600f9093166002026101000a90910461ffff1661ffff1990921691909117905580516033908290600190811061376657613766614ddc565b602002602001015161ffff168154811061378257613782614ddc565b90600052602060002090601091828204019190066002029054906101000a900461ffff16603560026101000a81548161ffff021916908361ffff16021790555050505b6037805461ffff19166101011790556035547f246071332ec3cecbddeebfd36569844838470b18b27bf4c8f06390c7ef630b0f9061ffff1661380681611850565b6040805161ffff90931683526001600160a01b0390911660208301520160405180910390a16035547f246071332ec3cecbddeebfd36569844838470b18b27bf4c8f06390c7ef630b0f9062010000900461ffff1661386381611850565b6040805161ffff90931683526001600160a01b0390911660208301520160405180910390a15060ff821660009081526030602090815260408220805460ff60a81b1916600160a81b179055612580909152603690527f11c0ccfb97a6042c43c2edb5a89642faf75742170dd1ae5b00d64d60aa31b429805460ff191660011790555050565b60008060006138f684613d93565b6139365760405162461bcd60e51b81526020600482015260116024820152703737b732bc34b9ba32b73a103a37b5b2b760791b6044820152606401610cdc565b60006031858154811061394b5761394b614ddc565b90600052602060002090600a91828204019190066003029054906101000a900462ffffff16905060008160201662ffffff16111561398e57601f81169150613993565b602091505b601f600f82901c169560069190911c6101ff1694509092509050565b3233146139ce5760405162461bcd60e51b8152600401610cdc90614d53565b6002600954036139f05760405162461bcd60e51b8152600401610cdc90615033565b6002600955336139ff82611850565b6001600160a01b031614613a255760405162461bcd60e51b8152600401610cdc90614d81565b604060005260306020526000805160206154b683398151915254600160a81b900460ff16613a655760405162461bcd60e51b8152600401610cdc90614da5565b60355460009061ffff168203613ad45760375460ff16613a975760405162461bcd60e51b8152600401610cdc90615091565b613abd6002611092612710611092603261108c605c603e546140ab90919063ffffffff16565b613ac79082614e08565b6037805460ff1916905590505b60355462010000900461ffff168203613b4c57603754610100900460ff16613b0e5760405162461bcd60e51b8152600401610cdc90615091565b613b346002611092612710611092603261108c605c603e546140ab90919063ffffffff16565b613b3e9082614e08565b6037805461ff001916905590505b604051600090339083908381818185875af1925050503d8060008114613b8e576040519150601f19603f3d011682016040523d82523d6000602084013e613b93565b606091505b5050905080613bdc5760405162461bcd60e51b815260206004820152601560248201527410db185a5b481d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610cdc565b60408051338152602081018590529081018390527fd08149829b4708b5a796078ac79020343425f5db94b97dfc5fe89f1e9caffb139060600160405180910390a15050600160095550565b613c2f613d39565b737b0dc23e87febf1d053e7df9af4cce30f21fae9cff5b613c4e613d39565b60005b81811015610c1057600160396000858585818110613c7157613c71614ddc565b9050602002016020810190613c869190614a0c565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580613cb881614e37565b915050613c51565b613cc8613d39565b6001600160a01b038116613d2d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610cdc565b613d3681614243565b50565b6008546001600160a01b03163314611ba25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cdc565b6000805482108015610b0f575050600090815260046020526040902054600160e01b161590565b6daaeb6d7670e522a718067333cd4e3b15613d3657604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015613e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e4b91906153fd565b613d3657604051633b79c77360e21b81526001600160a01b0382166004820152602401610cdc565b6000613e7e82611850565b9050336001600160a01b03821614613eb757613e9a8133610a75565b613eb7576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000613f1e826141dc565b9050836001600160a01b0316816001600160a01b031614613f515760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417613f9e57613f818633610a75565b613f9e57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516613fc557604051633a954ecd60e21b815260040160405180910390fd5b8015613fd057600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003614062576001840160008181526004602052604081205490036140605760005481146140605760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6000611fdd828461541a565b6000611fdd8284615439565b610c1083838360405180602001604052806000815250612674565b60008054908290036141035760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146141b257808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161417a565b50816000036141d357604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008160005481101561422a5760008181526004602052604081205490600160e01b82169003614228575b80600003611fdd575060001901600081815260046020526040902054614207565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610b0f90614567565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000611fdd8284614e20565b614354848484610fe1565b6001600160a01b0383163b1561100657614370848484846145ae565b611006576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610b0f6143bd836141dc565b614567565b6060602c8054610b3590614cc9565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806143eb5750819003601f19909101908152919050565b6060815160000361443457505060408051602081019091526000815290565b60006040518060600160405280604081526020016154d660409139905060006003845160026144639190614e08565b61446d9190615439565b61447890600461541a565b6001600160401b0381111561448f5761448f614b31565b6040519080825280601f01601f1916602001820160405280156144b9576020820181803683370190505b509050600182016020820185865187015b80821015614525576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506144ca565b505060038651066001811461454157600281146145545761455c565b603d6001830353603d600283035361455c565b603d60018303535b509195945050505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906145e390339089908890889060040161545b565b6020604051808303816000875af192505050801561461e575060408051601f3d908101601f1916820190925261461b91810190615498565b60015b61467c573d80801561464c576040519150601f19603f3d011682016040523d82523d6000602084013e614651565b606091505b508051600003614674576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b8280546146a690614cc9565b90600052602060002090601f0160209004810192826146c8576000855561470e565b82601f106146e157805160ff191683800117855561470e565b8280016001018555821561470e579182015b8281111561470e5782518255916020019190600101906146f3565b5061471a92915061471e565b5090565b5b8082111561471a576000815560010161471f565b6001600160e01b031981168114613d3657600080fd5b60006020828403121561475b57600080fd5b8135611fdd81614733565b60005b83811015614781578181015183820152602001614769565b838111156110065750506000910152565b600081518084526147aa816020860160208601614766565b601f01601f19169290920160200192915050565b602081526000611fdd6020830184614792565b6000602082840312156147e357600080fd5b5035919050565b80356001600160a01b03811681146110f857600080fd5b6000806040838503121561481457600080fd5b61481d836147ea565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015611e4357835161ffff1683529284019291840191600101614847565b60008060006060848603121561487c57600080fd5b614885846147ea565b9250614893602085016147ea565b9150604084013590509250925092565b803560ff811681146110f857600080fd5b6000602082840312156148c657600080fd5b611fdd826148a3565b60008083601f8401126148e157600080fd5b5081356001600160401b038111156148f857600080fd5b6020830191508360208260051b850101111561491357600080fd5b9250929050565b6000806020838503121561492d57600080fd5b82356001600160401b0381111561494357600080fd5b61494f858286016148cf565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611e43576149c683855161495b565b92840192608092909201916001016149b3565b600080604083850312156149ec57600080fd5b6149f5836148a3565b9150614a03602084016148a3565b90509250929050565b600060208284031215614a1e57600080fd5b611fdd826147ea565b61ffff81168114613d3657600080fd5b60008060408385031215614a4a57600080fd5b614a53836147ea565b91506020830135614a6381614a27565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015611e4357835183529284019291840191600101614a8a565b600080600060608486031215614abb57600080fd5b614ac4846147ea565b95602085013595506040909401359392505050565b8015158114613d3657600080fd5b60008060408385031215614afa57600080fd5b614b03836147ea565b91506020830135614a6381614ad9565b60008060408385031215614b2657600080fd5b82356149f581614a27565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614b6f57614b6f614b31565b604052919050565b60006001600160401b03831115614b9057614b90614b31565b614ba3601f8401601f1916602001614b47565b9050828152838383011115614bb757600080fd5b828260208301376000602084830101529392505050565b60008060008060808587031215614be457600080fd5b614bed856147ea565b9350614bfb602086016147ea565b92506040850135915060608501356001600160401b03811115614c1d57600080fd5b8501601f81018713614c2e57600080fd5b614c3d87823560208401614b77565b91505092959194509250565b60808101610b0f828461495b565b600060208284031215614c6957600080fd5b81356001600160401b03811115614c7f57600080fd5b8201601f81018413614c9057600080fd5b61469284823560208401614b77565b60008060408385031215614cb257600080fd5b614cbb836147ea565b9150614a03602084016147ea565b600181811c90821680614cdd57607f821691505b602082108103614cfd57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601e908201527f4f6e6c79204f70657261746f72204163636f756e747320416c6c6f7765640000604082015260600190565b600060208284031215614d4c57600080fd5b5051919050565b60208082526014908201527327b7363c9024b73234bb34b23ab0b6102ab9b2b960611b604082015260600190565b6020808252600a908201526927b7363c9037bbb732b960b11b604082015260600190565b60208082526019908201527f46696e616c2077696e6e6572206e6f742072656c656173656400000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115614e1b57614e1b614df2565b500190565b600082821015614e3257614e32614df2565b500390565b600060018201614e4957614e49614df2565b5060010190565b600060ff821660ff84168060ff03821115614e6d57614e6d614df2565b019392505050565b600061ffff808316818103614e8c57614e8c614df2565b6001019392505050565b600060ff821660ff8103614eac57614eac614df2565b60010192915050565b60006001600160401b03821115614ece57614ece614b31565b5060051b60200190565b60008060408385031215614eeb57600080fd5b8251614ef681614ad9565b809250506020808401516001600160401b03811115614f1457600080fd5b8401601f81018613614f2557600080fd5b8051614f38614f3382614eb5565b614b47565b81815260059190911b82018301908381019088831115614f5757600080fd5b928401925b82841015614f7557835182529284019290840190614f5c565b80955050505050509250929050565b60006020808385031215614f9757600080fd5b82516001600160401b03811115614fad57600080fd5b8301601f81018513614fbe57600080fd5b8051614fcc614f3382614eb5565b81815260059190911b82018301908381019087831115614feb57600080fd5b928401925b8284101561501257835161500381614a27565b82529284019290840190614ff0565b979650505050505050565b634e487b7160e01b600052601260045260246000fd5b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600062ffffff80831681851680830382111561508857615088614df2565b01949350505050565b6020808252601590820152741b9bc8199d5b99081bdc8818d85cda1959081bdd5d605a1b604082015260600190565b600081516150d2818560208601614766565b9290920192915050565b600082516150ee818460208701614766565b6931b7bb32b9173539b7b760b11b920191825250600a01919050565b600062ffffff8083168185168183048111821515161561512c5761512c614df2565b02949350505050565b6c417a75476f616c204e4654202360981b81526000835161515d81600d850160208801614766565b65e2ad90efb88f60d01b600d918401918201528351615183816013840160208801614766565b01601301949350505050565b6c417a75476f616c204e4654202360981b8152600082516151b781600d850160208701614766565b91909101600d0192915050565b693d913730b6b2911d101160b11b815286516000906151ea81600a850160208c01614766565b7f222c20226465736372697074696f6e223a2022417a75476f616c20576f726c64600a918401918201527421bab810191819191116101134b6b0b3b2911d101160591b602a820152875161524581603f840160208c01614766565b875191019061525b81603f840160208b01614766565b7f2e706e67222c202264657369676e6572223a202269736f746f702e746f70222c603f92909101918201527f2261747472696275746573223a205b7b2274726169745f74797065223a202249605f8201527f6e2d6d656d6f7279222c2276616c7565223a2022576f726c6443757020323032607f8201527f32227d2c207b2274726169745f74797065223a20225465616d222c2276616c75609f8201526432911d101160d91b60bf8201526153ab61539b61539561536061535a61532260c487018c6150c0565b7f227d2c207b2274726169745f74797065223a20224e756d626572222c2276616c8152653ab2911d101160d11b602082015260260190565b896150c0565b7f227d2c207b2274726169745f74797065223a2022426574222c2276616c7565228152621d101160e91b602082015260230190565b866150c0565b63227d5d7d60e01b815260040190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516153f081601d850160208701614766565b91909101601d0192915050565b60006020828403121561540f57600080fd5b8151611fdd81614ad9565b600081600019048311821515161561543457615434614df2565b500290565b60008261545657634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061548e90830184614792565b9695505050505050565b6000602082840312156154aa57600080fd5b8151611fdd8161473356fe9162896c89f2817382e37e4cce16bd90663a1699fb4d15731f7aab2fba66192a4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212204c5b1c14f64e313df5a5c5b11e31a5a5cb42d33bb8c48343657773980916edea64736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000001770000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656965366a7978796b69703334366f637869336b6c6d326b3234676b766f78376a6d7666706a76616d6a7673616c7934746f786771342f0000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : baseURI (string): ipfs://bafybeie6jyxykip346ocxi3klm2k24gkvox7jmvfpjvamjvsaly4toxgq4/
Arg [1] : bet_price (uint256): 100000000000000000
Arg [2] : share (uint16): 375
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 000000000000000000000000000000000000000000000000016345785d8a0000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000177
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [4] : 697066733a2f2f6261667962656965366a7978796b69703334366f637869336b
Arg [5] : 6c6d326b3234676b766f78376a6d7666706a76616d6a7673616c7934746f7867
Arg [6] : 71342f0000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.