Feature Tip: Add private address tag to any address under My Name Tag !
Overview
TokenID
6199
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
AZUMA
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/* The Official Azuma Contract - Gas-optimized ERC404 βββββ βββββββ ββ ββ βββ βββ βββββ ββ ββ βββ ββ ββ ββββ ββββ ββ ββ βββββββ βββ ββ ββ ββ ββββ ββ βββββββ ββ ββ βββ ββ ββ ββ ββ ββ ββ ββ ββ ββ βββββββ ββββββ ββ ββ ββ ββ */ /* Website: https://azumaeth.com Telegram: https://t.me/azumaportal Twitter: https://twitter.com/AZUMA_ERC404 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./lib/LibBitmap.sol"; import "./interface/IERC20.sol"; import "./interface/IERC721.sol"; import "./interface/ERC721Receiver.sol"; import "./interface/IERC1155.sol"; import "./interface/IAZUMA.sol"; contract AZUMA is IAZUMA, IERC20Metadata, IERC20Errors, ERC165, IERC1155, IERC1155MetadataURI, ERC721Receiver, Ownable { using Address for address; using LibBitmap for LibBitmap.Bitmap; using Strings for uint256; error InvalidQueryRange(); // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // Mapping from accout to owned tokens mapping(address => LibBitmap.Bitmap) internal _owned; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; // The next token ID to be minted. uint256 private _currentIndex; // NFT Approval mapping(uint256 => address) public getApproved; //Token balances mapping(address => uint256) internal _balances; //Token allowances mapping(address account => mapping(address spender => uint256)) private _allowances; // Token name string public name; // Token symbol string public symbol; // Decimals for supply uint8 public immutable decimals; // Total ERC20 supply uint256 public immutable totalSupply; // Tokens Per NFT uint256 public immutable decimalFactor; uint256 public immutable tokensPerNFT; // Don't mint for these wallets mapping(address => bool) public whitelist; // Easy Launch - auto-whitelist first transfer which is probably the LP uint256 public easyLaunch = 1; string public baseTokenURI; bool public limitsInEffect = true; uint256 public maxWallet; bool public transferDelay = true; mapping (address => uint256) private delayTimer; /** * @dev See {_setURI}. */ constructor() { _currentIndex = _startTokenId(); name = "Azuma ERC404"; symbol = "AZUMA"; decimals = 18; decimalFactor = 10 ** decimals; tokensPerNFT = decimalFactor; totalSupply = 5_000 * decimalFactor; whitelist[msg.sender] = true; _balances[msg.sender] = totalSupply; maxWallet = totalSupply * 2 / 100; emit Transfer(address(0), msg.sender, totalSupply); } /** @notice Initialization function to set pairs / etc * saving gas by avoiding mint / burn on unnecessary targets */ function setWhitelist(address target, bool state) public virtual onlyOwner { whitelist[target] = state; } function setTokenURI(string memory _tokenURI) public onlyOwner { baseTokenURI = _tokenURI; } function toggleDelay() external onlyOwner { transferDelay = !transferDelay; } function setMaxWallet(uint256 percent) external onlyOwner { require(percent >= 1, "Invalid value"); maxWallet = totalSupply * percent / 100; } function toggleLimit() external onlyOwner { limitsInEffect = !limitsInEffect; } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal pure virtual returns (uint256) { return 1; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view returns (uint256) { return _currentIndex; } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { return _nextTokenId() - _startTokenId(); } /** * @dev Returns true if the account owns the `id` token. */ function isOwnerOf(address account, uint256 id) public view virtual override returns(bool) { return _owned[account].get(id); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || interfaceId == type(IAZUMA).interfaceId || interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f || // ERC165 interface ID for ERC721Metadata. super.supportsInterface(interfaceId); } /** * @dev Returns the number of tokens owned by `owner`. */ function balanceOf(address owner) public view virtual returns (uint256) { return _balances[owner]; } /** * @dev Returns the number of nfts owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * Requirements: * * - `start < stop` */ function balanceOf(address owner, uint256 start, uint256 stop) public view virtual returns (uint256) { return _owned[owner].popCount(start, stop - start); } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { if(account == address(0)) { revert BalanceQueryForZeroAddress(); } if(_owned[account].get(id)) { return 1; } else { return 0; } } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { if(accounts.length != ids.length) { revert InputLengthMistmatch(); } uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { if(from == _msgSender() || isApprovedForAll(from, _msgSender())){ _safeTransferFrom(from, to, id, amount, data, true); } else { revert TransferCallerNotOwnerNorApproved(); } } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { if(!(from == _msgSender() || isApprovedForAll(from, _msgSender()))) { revert TransferCallerNotOwnerNorApproved(); } _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `amount` cannot be zero. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data, bool check ) internal virtual { if(to == address(0)) { revert TransferToZeroAddress(); } address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); _beforeTokenTransfer(operator, from, to, ids); if(amount == 1 && _owned[from].get(id)) { _owned[from].unset(id); _owned[to].set(id); _transfer(from, to, tokensPerNFT, false); } else { revert TransferFromIncorrectOwnerOrInvalidAmount(); } uint256 toMasked; uint256 fromMasked; assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) fromMasked := and(from, _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. fromMasked, // `from`. toMasked, // `to`. amount // `tokenId`. ) } emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids); if(check) _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { if(ids.length != amounts.length) { revert InputLengthMistmatch(); } if(to == address(0)) { revert TransferToZeroAddress(); } address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; if(amount == 1 && _owned[from].get(id)) { _owned[from].unset(id); _owned[to].set(id); } else { revert TransferFromIncorrectOwnerOrInvalidAmount(); } } _transfer(from, to, tokensPerNFT * ids.length, false); uint256 toMasked; uint256 fromMasked; uint256 end = ids.length + 1; // 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. fromMasked := and(from, _BITMASK_ADDRESS) 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. fromMasked, // `from`. toMasked, // `to`. mload(add(ids, 0x20)) // `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 arrayId := 2 } iszero(eq(arrayId, end)) { arrayId := add(arrayId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, toMasked, mload(add(ids, mul(0x20, arrayId)))) } } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } function _mint( address to, uint256 amount ) internal virtual { _mint(to, amount, ""); } /** * @dev Creates `amount` tokens, and assigns them to `to`. * * Emits a {TransferBatch} event. * * Requirements: * * - `to` cannot be the zero address. * - `amount` cannot be zero. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 amount, bytes memory data ) internal virtual { (uint256[] memory ids, uint256[] memory amounts) = _mintWithoutCheck(to, amount); uint256 end = _currentIndex; _doSafeBatchTransferAcceptanceCheck(_msgSender(), address(0), to, ids, amounts, data); if (_currentIndex != end) revert(); } function _mintWithoutCheck( address to, uint256 amount ) internal virtual returns(uint256[] memory ids, uint256[] memory amounts) { if(to == address(0)) { revert MintToZeroAddress(); } if(amount == 0) { revert MintZeroQuantity(); } address operator = _msgSender(); ids = new uint256[](amount); amounts = new uint256[](amount); uint256 startTokenId = _nextTokenId(); unchecked { require(type(uint256).max - amount >= startTokenId); for(uint256 i = 0; i < amount; i++) { ids[i] = startTokenId + i; amounts[i] = 1; } } _beforeTokenTransfer(operator, address(0), to, ids); _owned[to].setBatch(startTokenId, amount); _currentIndex += amount; uint256 toMasked; uint256 end = startTokenId + amount; assembly { toMasked := and(to, _BITMASK_ADDRESS) log4( 0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, startTokenId ) for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids); } /** * @dev Destroys token of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have the token of token type `id`. */ function _burn( address from, uint256 id ) internal virtual { if(from == address(0)){ revert BurnFromZeroAddress(); } address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); _beforeTokenTransfer(operator, from, address(0), ids); if(!_owned[from].get(id)) { revert BurnFromNonOnwerAddress(); } _owned[from].unset(id); uint256 fromMasked; assembly { fromMasked := and(from, _BITMASK_ADDRESS) log4( 0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, id ) } emit TransferSingle(operator, from, address(0), id, 1); _afterTokenTransfer(operator, from, address(0), ids); } /** * @dev Destroys tokens of token types in `ids` from `from` * * Emits a {TransferBatch} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have the token of token types in `ids`. */ function _burnBatch( address from, uint256[] memory ids ) internal virtual { if(from == address(0)){ revert BurnFromZeroAddress(); } address operator = _msgSender(); uint256[] memory amounts = new uint256[](ids.length); _beforeTokenTransfer(operator, from, address(0), ids); unchecked { for(uint256 i = 0; i < ids.length; i++) { amounts[i] = 1; uint256 id = ids[i]; if(!_owned[from].get(id)) { revert BurnFromNonOnwerAddress(); } _owned[from].unset(id); } } uint256 fromMasked; uint256 end = ids.length + 1; assembly { fromMasked := and(from, _BITMASK_ADDRESS) log4( 0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, mload(add(ids, 0x20)) ) for { let arrayId := 2 } iszero(eq(arrayId, end)) { arrayId := add(arrayId, 1) } { log4(0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, mload(add(ids, mul(0x20, arrayId)))) } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids); } function _burnBatch( address from, uint256 amount ) internal virtual { if(from == address(0)){ revert BurnFromZeroAddress(); } address operator = _msgSender(); uint256 searchFrom = _nextTokenId(); uint256[] memory amounts = new uint256[](amount); uint256[] memory ids = new uint256[](amount); unchecked { for(uint256 i = 0; i < amount; i++) { amounts[i] = 1; uint256 id = _owned[from].findLastSet(searchFrom); ids[i] = id; _owned[from].unset(id); searchFrom = id; } } //technically after, but we didn't have the IDs then _beforeTokenTransfer(operator, from, address(0), ids); uint256 fromMasked; uint256 end = amount + 1; assembly { fromMasked := and(from, _BITMASK_ADDRESS) log4( 0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, mload(add(ids, 0x20)) ) for { let arrayId := 2 } iszero(eq(arrayId, end)) { arrayId := add(arrayId, 1) } { log4(0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, mload(add(ids, mul(0x20, arrayId)))) } } if(amount == 1) emit TransferSingle(operator, from, address(0), ids[0], 1); else emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address, address, address to, uint256[] memory ) internal virtual { if(limitsInEffect && !whitelist[to]) { require(_balances[to] <= maxWallet, "Transfer exceeds maximum wallet"); if (transferDelay) { require(delayTimer[tx.origin] < block.number,"Only one transfer per block allowed."); delayTimer[tx.origin] = block.number; require(address(to).code.length == 0 && address(tx.origin).code.length == 0, "Contract trading restricted at launch"); } } } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { if (IERC165(to).supportsInterface(type(IERC1155).interfaceId)) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert TransferToNonERC1155ReceiverImplementer(); } } catch Error(string memory reason) { revert(reason); } catch { revert TransferToNonERC1155ReceiverImplementer(); } } else { try ERC721Receiver(to).onERC721Received(operator, from, id, data) returns (bytes4 response) { if (response != ERC721Receiver.onERC721Received.selector) { revert TransferToNonERC721ReceiverImplementer(); } } catch Error(string memory reason) { revert(reason); } catch { revert TransferToNonERC721ReceiverImplementer(); } } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert TransferToNonERC1155ReceiverImplementer(); } } catch Error(string memory reason) { revert(reason); } catch { revert TransferToNonERC1155ReceiverImplementer(); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory array) { array = new uint256[](1); array[0] = element; } function transfer(address to, uint256 value) public virtual returns (bool) { address owner = msg.sender; _transfer(owner, to, value, true); return true; } function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 value) public virtual returns (bool) { address owner = msg.sender; if (value < _nextTokenId() && value > 0) { if(!isOwnerOf(owner, value)) { revert ERC20InvalidSender(owner); } getApproved[value] = spender; emit Approval(owner, spender, value); } else { _approve(owner, spender, value); } return true; } /// @notice Function for mixed transfers /// @dev This function assumes id / native if amount less than or equal to current max id function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { if (value < _nextTokenId()) { if(!_owned[from].get(value)) { revert ERC20InvalidSpender(from); } if ( msg.sender != from && !isApprovedForAll(from, msg.sender) && msg.sender != getApproved[value] ) { revert ERC20InvalidSpender(msg.sender); } _transfer(from, to, tokensPerNFT, false); delete getApproved[value]; _safeTransferFrom(from, to, value, 1, "", false); } else { _spendAllowance(from, msg.sender, value); _transfer(from, to, value, true); } return true; } function _transfer(address from, address to, uint256 value, bool mint) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value, mint); } function _update(address from, address to, uint256 value, bool mint) internal virtual { uint256 fromBalance = _balances[from]; uint256 toBalance = _balances[to]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] = toBalance + value; } emit Transfer(from, to, value); if(mint) { // Skip burn for certain addresses to save gas bool wlf = whitelist[from]; if (!wlf) { uint256 tokens_to_burn = (fromBalance / tokensPerNFT) - ((fromBalance - value) / tokensPerNFT); if(tokens_to_burn > 0) _burnBatch(from, tokens_to_burn); } // Skip minting for certain addresses to save gas if (!whitelist[to]) { if(easyLaunch == 1 && wlf && from == owner()) { //auto-initialize first (assumed) LP whitelist[to] = true; easyLaunch = 2; } else { uint256 tokens_to_mint = ((toBalance + value) / tokensPerNFT) - (toBalance / tokensPerNFT); if(tokens_to_mint > 0) _mintWithoutCheck(to, tokens_to_mint); } } } } function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } /** * @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 {ERC1155DelataQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) public view virtual returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. uint256 stopLimit = _nextTokenId(); if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsLength; if(start < stop) { tokenIdsLength = balanceOf(owner, start, stop); } else { tokenIdsLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsLength); LibBitmap.Bitmap storage bmap = _owned[owner]; for ((uint256 i, uint256 tokenIdsIdx) = (start, 0); tokenIdsIdx != tokenIdsLength; ++i) { if(bmap.get(i) ) { tokenIds[tokenIdsIdx++] = i; } } 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 {ERC1155DeltaQueryable-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) public view virtual returns (uint256[] memory) { if(_totalMinted() == 0) { return new uint256[](0); } return tokensOfOwnerIn(owner, _startTokenId(), _nextTokenId()); } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual returns (string memory) { if(tokenId >= _nextTokenId()) revert InputLengthMistmatch(); string memory baseURI = baseTokenURI; return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } function uri(uint256 id) public view override returns (string memory) { return tokenURI(id); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // β `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // β `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract ERC721Receiver { function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { return ERC721Receiver.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IAZUMA { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * 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(); /** * Cannot burn from the zero address. */ error BurnFromZeroAddress(); /** * Cannot burn from the address that doesn't owne the token. */ error BurnFromNonOnwerAddress(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from` or the `amount` is not 1. */ error TransferFromIncorrectOwnerOrInvalidAmount(); /** * Cannot safely transfer to a contract that does not implement the * ERC1155Receiver interface. */ error TransferToNonERC1155ReceiverImplementer(); error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The length of input arraies is not matching. */ error InputLengthMistmatch(); function isOwnerOf(address account, uint256 id) external view returns(bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; } /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); } /** * @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 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); } /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); } interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } interface IERC20Errors { error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); error ERC20InvalidSender(address sender); error ERC20InvalidReceiver(address receiver); error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); error ERC20InvalidApprover(address approver); error ERC20InvalidSpender(address spender); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 { /** * @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); } interface IERC721Metadata is IERC721 { /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library for bit twiddling and boolean operations. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBit.sol) /// @author Inspired by (https://graphics.stanford.edu/~seander/bithacks.html) library LibBit { /*´:°β’.°+.*β’´.*:Λ.°*.Λβ’´.°:°β’.°β’.*β’´.*:Λ.°*.Λβ’´.°:°β’.°+.*β’´.*:*/ /* BIT TWIDDLING OPERATIONS */ /*.β’°:°.´+Λ.*°.Λ:*.´β’*.+°.β’°:´*.´β’*.β’°.β’°:°.´:β’Λ°.*°.Λ:*.´+°.β’*/ /// @dev Find last set. /// Returns the index of the most significant bit of `x`, /// counting from the least significant bit position. /// If `x` is zero, returns 256. function fls(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { r := or(shl(8, iszero(x)), shl(7, lt(0xffffffffffffffffffffffffffffffff, x))) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item r := or(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), 0x0706060506020504060203020504030106050205030304010505030400000000)) } } /// @dev Count leading zeros. /// Returns the number of zeros preceding the most significant one bit. /// If `x` is zero, returns 256. function clz(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item r := add(xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff)), iszero(x)) } } /// @dev Find first set. /// Returns the index of the least significant bit of `x`, /// counting from the least significant bit position. /// If `x` is zero, returns 256. /// Equivalent to `ctz` (count trailing zeros), which gives /// the number of zeros following the least significant one bit. function ffs(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { // Isolate the least significant bit. let b := and(x, add(not(x), 1)) r := or(shl(8, iszero(x)), shl(7, lt(0xffffffffffffffffffffffffffffffff, b))) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, b)))) r := or(r, shl(5, lt(0xffffffff, shr(r, b)))) // For the remaining 32 bits, use a De Bruijn lookup. // forgefmt: disable-next-item r := or(r, byte(and(div(0xd76453e0, shr(r, b)), 0x1f), 0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405)) } } /// @dev Returns the number of set bits in `x`. function popCount(uint256 x) internal pure returns (uint256 c) { /// @solidity memory-safe-assembly assembly { let max := not(0) let isMax := eq(x, max) x := sub(x, and(shr(1, x), div(max, 3))) x := add(and(x, div(max, 5)), and(shr(2, x), div(max, 5))) x := and(add(x, shr(4, x)), div(max, 17)) c := or(shl(8, isMax), shr(248, mul(x, div(max, 255)))) } } /// @dev Returns whether `x` is a power of 2. function isPo2(uint256 x) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { // Equivalent to `x && !(x & (x - 1))`. result := iszero(add(and(x, sub(x, 1)), iszero(x))) } } /// @dev Returns `x` reversed at the bit level. function reverseBits(uint256 x) internal pure returns (uint256 r) { uint256 m0 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f; uint256 m1 = m0 ^ (m0 << 2); uint256 m2 = m1 ^ (m1 << 1); r = reverseBytes(x); r = (m2 & (r >> 1)) | ((m2 & r) << 1); r = (m1 & (r >> 2)) | ((m1 & r) << 2); r = (m0 & (r >> 4)) | ((m0 & r) << 4); } /// @dev Returns `x` reversed at the byte level. function reverseBytes(uint256 x) internal pure returns (uint256 r) { unchecked { // Computing masks on-the-fly reduces bytecode size by about 200 bytes. uint256 m0 = 0x100000000000000000000000000000001 * (~toUint(x == 0) >> 192); uint256 m1 = m0 ^ (m0 << 32); uint256 m2 = m1 ^ (m1 << 16); uint256 m3 = m2 ^ (m2 << 8); r = (m3 & (x >> 8)) | ((m3 & x) << 8); r = (m2 & (r >> 16)) | ((m2 & r) << 16); r = (m1 & (r >> 32)) | ((m1 & r) << 32); r = (m0 & (r >> 64)) | ((m0 & r) << 64); r = (r >> 128) | (r << 128); } } /*´:°β’.°+.*β’´.*:Λ.°*.Λβ’´.°:°β’.°β’.*β’´.*:Λ.°*.Λβ’´.°:°β’.°+.*β’´.*:*/ /* BOOLEAN OPERATIONS */ /*.β’°:°.´+Λ.*°.Λ:*.´β’*.+°.β’°:´*.´β’*.β’°.β’°:°.´:β’Λ°.*°.Λ:*.´+°.β’*/ // A Solidity bool on the stack or memory is represented as a 256-bit word. // Non-zero values are true, zero is false. // A clean bool is either 0 (false) or 1 (true) under the hood. // Usually, if not always, the bool result of a regular Solidity expression, // or the argument of a public/external function will be a clean bool. // You can usually use the raw variants for more performance. // If uncertain, test (best with exact compiler settings). // Or use the non-raw variants (compiler can sometimes optimize out the double `iszero`s). /// @dev Returns `x & y`. Inputs must be clean. function rawAnd(bool x, bool y) internal pure returns (bool z) { /// @solidity memory-safe-assembly assembly { z := and(x, y) } } /// @dev Returns `x & y`. function and(bool x, bool y) internal pure returns (bool z) { /// @solidity memory-safe-assembly assembly { z := and(iszero(iszero(x)), iszero(iszero(y))) } } /// @dev Returns `x | y`. Inputs must be clean. function rawOr(bool x, bool y) internal pure returns (bool z) { /// @solidity memory-safe-assembly assembly { z := or(x, y) } } /// @dev Returns `x | y`. function or(bool x, bool y) internal pure returns (bool z) { /// @solidity memory-safe-assembly assembly { z := or(iszero(iszero(x)), iszero(iszero(y))) } } /// @dev Returns 1 if `b` is true, else 0. Input must be clean. function rawToUint(bool b) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := b } } /// @dev Returns 1 if `b` is true, else 0. function toUint(bool b) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := iszero(iszero(b)) } } } /// @notice Library for storage of packed unsigned booleans. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBitmap.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibBitmap.sol) /// @author Modified from Solidity-Bits (https://github.com/estarriolvetch/solidity-bits/blob/main/contracts/BitMaps.sol) library LibBitmap { /*´:°β’.°+.*β’´.*:Λ.°*.Λβ’´.°:°β’.°β’.*β’´.*:Λ.°*.Λβ’´.°:°β’.°+.*β’´.*:*/ /* CONSTANTS */ /*.β’°:°.´+Λ.*°.Λ:*.´β’*.+°.β’°:´*.´β’*.β’°.β’°:°.´:β’Λ°.*°.Λ:*.´+°.β’*/ /// @dev The constant returned when a bitmap scan does not find a result. uint256 internal constant NOT_FOUND = type(uint256).max; /*´:°β’.°+.*β’´.*:Λ.°*.Λβ’´.°:°β’.°β’.*β’´.*:Λ.°*.Λβ’´.°:°β’.°+.*β’´.*:*/ /* STRUCTS */ /*.β’°:°.´+Λ.*°.Λ:*.´β’*.+°.β’°:´*.´β’*.β’°.β’°:°.´:β’Λ°.*°.Λ:*.´+°.β’*/ /// @dev A bitmap in storage. struct Bitmap { mapping(uint256 => uint256) map; } /*´:°β’.°+.*β’´.*:Λ.°*.Λβ’´.°:°β’.°β’.*β’´.*:Λ.°*.Λβ’´.°:°β’.°+.*β’´.*:*/ /* OPERATIONS */ /*.β’°:°.´+Λ.*°.Λ:*.´β’*.+°.β’°:´*.´β’*.β’°.β’°:°.´:β’Λ°.*°.Λ:*.´+°.β’*/ /// @dev Returns the boolean value of the bit at `index` in `bitmap`. function get(Bitmap storage bitmap, uint256 index) internal view returns (bool isSet) { // It is better to set `isSet` to either 0 or 1, than zero vs non-zero. // Both cost the same amount of gas, but the former allows the returned value // to be reused without cleaning the upper bits. uint256 b = (bitmap.map[index >> 8] >> (index & 0xff)) & 1; /// @solidity memory-safe-assembly assembly { isSet := b } } /// @dev Updates the bit at `index` in `bitmap` to true. function set(Bitmap storage bitmap, uint256 index) internal { bitmap.map[index >> 8] |= (1 << (index & 0xff)); } /// @dev Updates the bit at `index` in `bitmap` to false. function unset(Bitmap storage bitmap, uint256 index) internal { bitmap.map[index >> 8] &= ~(1 << (index & 0xff)); } /// @dev Flips the bit at `index` in `bitmap`. /// Returns the boolean result of the flipped bit. function toggle(Bitmap storage bitmap, uint256 index) internal returns (bool newIsSet) { /// @solidity memory-safe-assembly assembly { mstore(0x20, bitmap.slot) mstore(0x00, shr(8, index)) let storageSlot := keccak256(0x00, 0x40) let shift := and(index, 0xff) let storageValue := xor(sload(storageSlot), shl(shift, 1)) // It makes sense to return the `newIsSet`, // as it allow us to skip an additional warm `sload`, // and it costs minimal gas (about 15), // which may be optimized away if the returned value is unused. newIsSet := and(1, shr(shift, storageValue)) sstore(storageSlot, storageValue) } } /// @dev Updates the bit at `index` in `bitmap` to `shouldSet`. function setTo(Bitmap storage bitmap, uint256 index, bool shouldSet) internal { /// @solidity memory-safe-assembly assembly { mstore(0x20, bitmap.slot) mstore(0x00, shr(8, index)) let storageSlot := keccak256(0x00, 0x40) let storageValue := sload(storageSlot) let shift := and(index, 0xff) sstore( storageSlot, // Unsets the bit at `shift` via `and`, then sets its new value via `or`. or(and(storageValue, not(shl(shift, 1))), shl(shift, iszero(iszero(shouldSet)))) ) } } /// @dev Consecutively sets `amount` of bits starting from the bit at `start`. function setBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let max := not(0) let shift := and(start, 0xff) mstore(0x20, bitmap.slot) mstore(0x00, shr(8, start)) if iszero(lt(add(shift, amount), 257)) { let storageSlot := keccak256(0x00, 0x40) sstore(storageSlot, or(sload(storageSlot), shl(shift, max))) let bucket := add(mload(0x00), 1) let bucketEnd := add(mload(0x00), shr(8, add(amount, shift))) amount := and(add(amount, shift), 0xff) shift := 0 for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } { mstore(0x00, bucket) sstore(keccak256(0x00, 0x40), max) } mstore(0x00, bucket) } let storageSlot := keccak256(0x00, 0x40) sstore(storageSlot, or(sload(storageSlot), shl(shift, shr(sub(256, amount), max)))) } } /// @dev Consecutively unsets `amount` of bits starting from the bit at `start`. function unsetBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let shift := and(start, 0xff) mstore(0x20, bitmap.slot) mstore(0x00, shr(8, start)) if iszero(lt(add(shift, amount), 257)) { let storageSlot := keccak256(0x00, 0x40) sstore(storageSlot, and(sload(storageSlot), not(shl(shift, not(0))))) let bucket := add(mload(0x00), 1) let bucketEnd := add(mload(0x00), shr(8, add(amount, shift))) amount := and(add(amount, shift), 0xff) shift := 0 for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } { mstore(0x00, bucket) sstore(keccak256(0x00, 0x40), 0) } mstore(0x00, bucket) } let storageSlot := keccak256(0x00, 0x40) sstore( storageSlot, and(sload(storageSlot), not(shl(shift, shr(sub(256, amount), not(0))))) ) } } /// @dev Returns number of set bits within a range by /// scanning `amount` of bits starting from the bit at `start`. function popCount(Bitmap storage bitmap, uint256 start, uint256 amount) internal view returns (uint256 count) { unchecked { uint256 bucket = start >> 8; uint256 shift = start & 0xff; if (!(amount + shift < 257)) { count = LibBit.popCount(bitmap.map[bucket] >> shift); uint256 bucketEnd = bucket + ((amount + shift) >> 8); amount = (amount + shift) & 0xff; shift = 0; for (++bucket; bucket != bucketEnd; ++bucket) { count += LibBit.popCount(bitmap.map[bucket]); } } count += LibBit.popCount((bitmap.map[bucket] >> shift) << (256 - amount)); } } /// @dev Returns the index of the most significant set bit before the bit at `before`. /// If no set bit is found, returns `NOT_FOUND`. function findLastSet(Bitmap storage bitmap, uint256 before) internal view returns (uint256 setBitIndex) { uint256 bucket; uint256 bucketBits; /// @solidity memory-safe-assembly assembly { setBitIndex := not(0) bucket := shr(8, before) mstore(0x00, bucket) mstore(0x20, bitmap.slot) let offset := and(0xff, not(before)) // `256 - (255 & before) - 1`. bucketBits := shr(offset, shl(offset, sload(keccak256(0x00, 0x40)))) if iszero(or(bucketBits, iszero(bucket))) { for {} 1 {} { bucket := add(bucket, setBitIndex) // `sub(bucket, 1)`. mstore(0x00, bucket) bucketBits := sload(keccak256(0x00, 0x40)) if or(bucketBits, iszero(bucket)) { break } } } } if (bucketBits != 0) { setBitIndex = (bucket << 8) | LibBit.fls(bucketBits); /// @solidity memory-safe-assembly assembly { setBitIndex := or(setBitIndex, sub(0, gt(setBitIndex, before))) } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BurnFromNonOnwerAddress","type":"error"},{"inputs":[],"name":"BurnFromZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"InputLengthMistmatch","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwnerOrInvalidAmount","type":"error"},{"inputs":[],"name":"TransferToNonERC1155ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"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":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","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":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimalFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"easyLaunch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"isOwnerOf","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"limitsInEffect","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"percent","type":"uint256"}],"name":"setMaxWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleLimit","outputs":[],"stateMutability":"nonpayable","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":"tokensPerNFT","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":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferDelay","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101006040526001600b819055600d805460ff199081168317909155600f805490911690911790553480156200003457600080fd5b5062000040336200015c565b600160045560408051808201909152600c81526b105e9d5b5848115490cd0c0d60a21b602082015260089062000077908262000251565b50604080518082019091526005815264415a554d4160d81b6020820152600990620000a3908262000251565b5060126080819052620000b890600a62000432565b60c081905260e0819052620000d0906113886200044a565b60a0819052336000908152600a60209081526040808320805460ff19166001179055600690915290208190556064906200010c9060026200044a565b62000118919062000464565b600e5560a05160405190815233906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a362000487565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620001d757607f821691505b602082108103620001f857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200024c57600081815260208120601f850160051c81016020861015620002275750805b601f850160051c820191505b81811015620002485782815560010162000233565b5050505b505050565b81516001600160401b038111156200026d576200026d620001ac565b62000285816200027e8454620001c2565b84620001fe565b602080601f831160018114620002bd5760008415620002a45750858301515b600019600386901b1c1916600185901b17855562000248565b600085815260208120601f198616915b82811015620002ee57888601518255948401946001909101908401620002cd565b50858210156200030d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620003745781600019048211156200035857620003586200031d565b808516156200036657918102915b93841c939080029062000338565b509250929050565b6000826200038d575060016200042c565b816200039c575060006200042c565b8160018114620003b55760028114620003c057620003e0565b60019150506200042c565b60ff841115620003d457620003d46200031d565b50506001821b6200042c565b5060208310610133831016604e8410600b841016171562000405575081810a6200042c565b62000411838362000333565b80600019048211156200042857620004286200031d565b0290505b92915050565b60006200044360ff8416836200037c565b9392505050565b80820281158282048414176200042c576200042c6200031d565b6000826200048257634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c05160e051613327620004f96000396000818161043e015281816109b5015281816111a7015281816114f7015281816119fd01528181611a3501528181611af90152611b200152600061047801526000818161035b0152610c3f015260006103bd01526133276000f3fe608060405234801561001057600080fd5b50600436106102475760003560e01c806370a082311161013b578063c5b8f772116100b8578063e985e9c51161007c578063e985e9c5146105d6578063f10f864e14610612578063f242432a1461061a578063f2fde38b1461062d578063f8b45b051461064057600080fd5b8063c5b8f7721461055c578063c87b56dd1461056f578063d547cfb714610582578063dd62ed3e1461058a578063e0df5b6f146105c357600080fd5b806399a2557a116100ff57806399a2557a146104f75780639b19251a1461050a578063a014e6e21461052d578063a22cb46514610536578063a9059cbb1461054957600080fd5b806370a082311461049a578063715018a6146104c35780638462151c146104cb5780638da5cb5b146104de57806395d89b41146104ef57600080fd5b80632d760d57116101c95780634eabf2c61161018d5780634eabf2c61461041e57806353d6fd59146104265780635afcc2f5146104395780635d0044ca146104605780636d6a6a4d1461047357600080fd5b80632d760d57146103905780632eb2c2d6146103a3578063313ce567146103b85780634a62bb65146103f15780634e1273f4146103fe57600080fd5b80630a702e8d116102105780630a702e8d146102fe5780630e89341c1461030b578063150b7a021461031e57806318160ddd1461035657806323b872dd1461037d57600080fd5b8062fdd58e1461024c57806301ffc9a71461027257806306fdde0314610295578063081812fc146102aa578063095ea7b3146102eb575b600080fd5b61025f61025a36600461289d565b610649565b6040519081526020015b60405180910390f35b6102856102803660046128dd565b6106b8565b6040519015158152602001610269565b61029d610759565b604051610269919061294a565b6102d36102b836600461295d565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610269565b6102856102f936600461289d565b6107e7565b600f546102859060ff1681565b61029d61031936600461295d565b6108ba565b61033d61032c366004612976565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610269565b61025f7f000000000000000000000000000000000000000000000000000000000000000081565b61028561038b366004612a10565b6108c5565b61025f61039e366004612a4c565b610a33565b6103b66103b1366004612bd2565b610a6a565b005b6103df7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610269565b600d546102859060ff1681565b61041161040c366004612c7b565b610ab7565b6040516102699190612d80565b6103b6610b9f565b6103b6610434366004612da1565b610bbb565b61025f7f000000000000000000000000000000000000000000000000000000000000000081565b6103b661046e36600461295d565b610bee565b61025f7f000000000000000000000000000000000000000000000000000000000000000081565b61025f6104a8366004612dd8565b6001600160a01b031660009081526006602052604090205490565b6103b6610c73565b6104116104d9366004612dd8565b610c87565b6000546001600160a01b03166102d3565b61029d610cba565b610411610505366004612a4c565b610cc7565b610285610518366004612dd8565b600a6020526000908152604090205460ff1681565b61025f600b5481565b6103b6610544366004612da1565b610df9565b61028561055736600461289d565b610e08565b61028561056a36600461289d565b610e18565b61029d61057d36600461295d565b610e4e565b61029d610f56565b61025f610598366004612df3565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b6103b66105d1366004612e26565b610f63565b6102856105e4366004612df3565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b6103b6610f77565b6103b6610628366004612e6e565b610f93565b6103b661063b366004612dd8565b610fe1565b61025f600e5481565b60006001600160a01b038316610672576040516323d3ad8160e21b815260040160405180910390fd5b6001600160a01b0383166000908152600160208181526040808420600887901c85529091529091205460ff84161c16156106ae575060016106b2565b5060005b92915050565b60006001600160e01b03198216636cdb3d1360e11b14806106e957506001600160e01b031982166303a24d0760e21b145b8061070457506001600160e01b031982166362dc7bb960e11b145b8061071f57506380ac58cd60e01b6001600160e01b03198316145b8061073a5750635b5e139f60e01b6001600160e01b03198316145b806106b257506301ffc9a760e01b6001600160e01b03198316146106b2565b6008805461076690612ed2565b80601f016020809104026020016040519081016040528092919081815260200182805461079290612ed2565b80156107df5780601f106107b4576101008083540402835291602001916107df565b820191906000526020600020905b8154815290600101906020018083116107c257829003601f168201915b505050505081565b6000336107f360045490565b831080156108015750600083115b156108a5576108108184610e18565b61083d57604051634b637e8f60e11b81526001600160a01b03821660048201526024015b60405180910390fd5b60008381526005602090815260409182902080546001600160a01b0319166001600160a01b038881169182179092559251868152908416917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a36108b0565b6108b081858561105a565b5060019392505050565b60606106b282610e4e565b60006108d060045490565b821015610a1b576001600160a01b0384166000908152600160208181526040808420600887901c85529091529091205460ff84161c1661092e57604051634a1406b160e11b81526001600160a01b0385166004820152602401610834565b336001600160a01b0385161480159061096b57506001600160a01b038416600090815260026020908152604080832033845290915290205460ff16155b801561098e57506000828152600560205260409020546001600160a01b03163314155b156109ae57604051634a1406b160e11b8152336004820152602401610834565b6109db84847f0000000000000000000000000000000000000000000000000000000000000000600061106c565b600082815260056020908152604080832080546001600160a01b031916905580519182019052818152610a16918691869186916001916110d2565b6108b0565b610a2684338461129a565b6108b0848484600161106c565b6000610a6283610a438185612f22565b6001600160a01b03871660009081526001602052604090209190611312565b949350505050565b6001600160a01b038516331480610a865750610a8685336105e4565b610aa357604051632ce44b5f60e11b815260040160405180910390fd5b610ab085858585856113b5565b5050505050565b60608151835114610adb57604051637801f4e960e01b815260040160405180910390fd5b600083516001600160401b03811115610af657610af6612a7f565b604051908082528060200260200182016040528015610b1f578160200160208202803683370190505b50905060005b8451811015610b9757610b6a858281518110610b4357610b43612f35565b6020026020010151858381518110610b5d57610b5d612f35565b6020026020010151610649565b828281518110610b7c57610b7c612f35565b6020908102919091010152610b9081612f4b565b9050610b25565b509392505050565b610ba7611619565b600f805460ff19811660ff90911615179055565b610bc3611619565b6001600160a01b03919091166000908152600a60205260409020805460ff1916911515919091179055565b610bf6611619565b6001811015610c375760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610834565b6064610c63827f0000000000000000000000000000000000000000000000000000000000000000612f64565b610c6d9190612f7b565b600e5550565b610c7b611619565b610c856000611673565b565b6060610c916116c3565b600003610cac57505060408051600081526020810190915290565b6106b2826001600454610cc7565b6009805461076690612ed2565b6060818310610ce957604051631960ccad60e11b815260040160405180910390fd5b6001831015610cf757600192505b6000610d0260045490565b905080831115610d10578092505b600083851015610d2c57610d25868686610a33565b9050610d30565b5060005b6000816001600160401b03811115610d4a57610d4a612a7f565b604051908082528060200260200182016040528015610d73578160200160208202803683370190505b506001600160a01b038816600090815260016020526040812091925087905b848114610deb57600882901c60009081526020849052604090205460ff83161c60011615610de05781848280600101935081518110610dd357610dd3612f35565b6020026020010181815250505b816001019150610d92565b509198975050505050505050565b610e043383836116d9565b5050565b6000336108b0818585600161106c565b6001600160a01b0382166000908152600160208181526040808420600886901c855290915282205460ff84161c165b9392505050565b6060610e5960045490565b8210610e7857604051637801f4e960e01b815260040160405180910390fd5b6000600c8054610e8790612ed2565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb390612ed2565b8015610f005780601f10610ed557610100808354040283529160200191610f00565b820191906000526020600020905b815481529060010190602001808311610ee357829003601f168201915b505050505090506000815111610f255760405180602001604052806000815250610e47565b80610f2f846117b9565b604051602001610f40929190612f9d565b6040516020818303038152906040529392505050565b600c805461076690612ed2565b610f6b611619565b600c610e048282613012565b610f7f611619565b600d805460ff19811660ff90911615179055565b6001600160a01b038516331480610faf5750610faf85336105e4565b15610fc857610fc3858585858560016110d2565b610ab0565b604051632ce44b5f60e11b815260040160405180910390fd5b610fe9611619565b6001600160a01b03811661104e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610834565b61105781611673565b50565b611067838383600161184b565b505050565b6001600160a01b03841661109657604051634b637e8f60e11b815260006004820152602401610834565b6001600160a01b0383166110c05760405163ec442f0560e01b815260006004820152602401610834565b6110cc84848484611920565b50505050565b6001600160a01b0385166110f957604051633a954ecd60e21b815260040160405180910390fd5b33600061110586611b7b565b905084600114801561114257506001600160a01b038816600090815260016020818152604080842060088b901c85529091529091205460ff88161c165b156111d1576001600160a01b03888116600090815260016020818152604080842060088c901c808652908352818520805460ff8e1686901b8019909116909155958d168552928252808420928452919052812080549092179091556111cc90899089907f00000000000000000000000000000000000000000000000000000000000000009061106c565b6111ea565b6040516337dbad3d60e01b815260040160405180910390fd5b6001600160a01b038781169089168682826000805160206132d2833981519152600080a4886001600160a01b03168a6001600160a01b0316856001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628b8b604051611266929190918252602082015260400190565b60405180910390a461127a848b8b86611bc2565b841561128e5761128e848b8b8b8b8b611d54565b50505050505050505050565b6001600160a01b0383811660009081526007602090815260408083209386168352929052205460001981146110cc578181101561130357604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610834565b6110cc8484848403600061184b565b6000600883901c60ff8416610101848201106113885760008281526020879052604090205461134290821c611fc2565b930160ff8116939250600182019160009160081c015b8083146113865760008381526020889052604090205461137790611fc2565b84019350826001019250611358565b505b6000828152602087905260409020546113a990821c6101008690031b611fc2565b90920195945050505050565b81518351146113d757604051637801f4e960e01b815260040160405180910390fd5b6001600160a01b0384166113fe57604051633a954ecd60e21b815260040160405180910390fd5b3360005b84518110156114ed57600085828151811061141f5761141f612f35565b60200260200101519050600085838151811061143d5761143d612f35565b6020026020010151905080600114801561148257506001600160a01b0389166000908152600160208181526040808420600887901c85529091529091205460ff84161c165b156111d157506001600160a01b038881166000908152600160208181526040808420600887901c808652908352818520805460ff90981685901b80199098169055948c1684529181528183209383529290925220805490911790556114e681612f4b565b9050611402565b50611527868686517f00000000000000000000000000000000000000000000000000000000000000006115209190612f64565b600061106c565b60008060008651600161153a91906130d1565b90506001600160a01b03891691506001600160a01b0388169250602087015183836000805160206132d2833981519152600080a460025b81811461159c578060200288015184846000805160206132d2833981519152600080a4600101611571565b50876001600160a01b0316896001600160a01b0316856001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8a8a6040516115ec9291906130e4565b60405180910390a4611600848a8a8a611bc2565b61160e848a8a8a8a8a612072565b505050505050505050565b6000546001600160a01b03163314610c855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610834565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060016004546116d49190612f22565b905090565b816001600160a01b0316836001600160a01b03160361174c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610834565b6001600160a01b03838116600081815260026020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b606060006117c68361212e565b60010190506000816001600160401b038111156117e5576117e5612a7f565b6040519080825280601f01601f19166020018201604052801561180f576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461181957509392505050565b6001600160a01b0384166118755760405163e602df0560e01b815260006004820152602401610834565b6001600160a01b03831661189f57604051634a1406b160e11b815260006004820152602401610834565b6001600160a01b03808516600090815260076020908152604080832093871683529290522082905580156110cc57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161191291815260200190565b60405180910390a350505050565b6001600160a01b038085166000908152600660205260408082205492861682529020548382101561197d5760405163391434e360e21b81526001600160a01b03871660048201526024810183905260448101859052606401610834565b6001600160a01b03808716600081815260066020526040808220888703905592881680825290839020848801905591516000805160206132d2833981519152906119ca9088815260200190565b60405180910390a38215611b73576001600160a01b0386166000908152600a602052604090205460ff1680611a785760007f0000000000000000000000000000000000000000000000000000000000000000611a268786612f22565b611a309190612f7b565b611a5a7f000000000000000000000000000000000000000000000000000000000000000086612f7b565b611a649190612f22565b90508015611a7657611a768882612206565b505b6001600160a01b0386166000908152600a602052604090205460ff16611b7157600b546001148015611aa75750805b8015611ac057506000546001600160a01b038881169116145b15611af2576001600160a01b0386166000908152600a60205260409020805460ff191660011790556002600b55611b71565b6000611b1e7f000000000000000000000000000000000000000000000000000000000000000084612f7b565b7f0000000000000000000000000000000000000000000000000000000000000000611b4988866130d1565b611b539190612f7b565b611b5d9190612f22565b90508015611b6f5761128e87826124c5565b505b505b505050505050565b604080516001808252818301909252606091602080830190803683370190505090508181600081518110611bb157611bb1612f35565b602002602001018181525050919050565b600d5460ff168015611bed57506001600160a01b0382166000908152600a602052604090205460ff16155b156110cc57600e546001600160a01b0383166000908152600660205260409020541115611c5c5760405162461bcd60e51b815260206004820152601f60248201527f5472616e736665722065786365656473206d6178696d756d2077616c6c6574006044820152606401610834565b600f5460ff16156110cc57326000908152601060205260409020544311611cd15760405162461bcd60e51b8152602060048201526024808201527f4f6e6c79206f6e65207472616e736665722070657220626c6f636b20616c6c6f6044820152633bb2b21760e11b6064820152608401610834565b3260009081526010602052604090204390556001600160a01b0382163b158015611cfa5750323b155b6110cc5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742074726164696e672072657374726963746564206174206c6044820152640c2eadcc6d60db1b6064820152608401610834565b6001600160a01b0384163b15611b73576040516301ffc9a760e01b8152636cdb3d1360e11b60048201526001600160a01b038516906301ffc9a790602401602060405180830381865afa158015611daf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd39190613112565b15611ede5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190611e0c908990899088908890889060040161312f565b6020604051808303816000875af1925050508015611e47575060408051601f3d908101601f19168201909252611e4491810190613174565b60015b611ea757611e53613191565b806308c379a003611e8c5750611e676131ad565b80611e725750611e8e565b8060405162461bcd60e51b8152600401610834919061294a565b505b604051639c05499b60e01b815260040160405180910390fd5b6001600160e01b0319811663f23a6e6160e01b14611ed857604051639c05499b60e01b815260040160405180910390fd5b50611b73565b604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611f10908990899088908790600401613236565b6020604051808303816000875af1925050508015611f4b575060408051601f3d908101601f19168201909252611f4891810190613174565b60015b611f9157611f57613191565b806308c379a003611f765750611f6b6131ad565b80611e725750611f78565b505b6040516368d2bf6b60e11b815260040160405180910390fd5b6001600160e01b03198116630a85bd0160e11b14611b71576040516368d2bf6b60e11b815260040160405180910390fd5b7f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f7f5555555555555555555555555555555555555555555555555555555555555555600183901c168203600281901c7f3333333333333333333333333333333333333333333333333333333333333333908116911601600481901c01167f01010101010101010101010101010101010101010101010101010101010101010260f81c6000199190911460081b1790565b6001600160a01b0384163b15611b735760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906120b69089908990889088908890600401613273565b6020604051808303816000875af19250505080156120f1575060408051601f3d908101601f191682019092526120ee91810190613174565b60015b6120fd57611e53613191565b6001600160e01b0319811663bc197c8160e01b14611b7157604051639c05499b60e01b815260040160405180910390fd5b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061216d5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612199576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106121b757662386f26fc10000830492506010015b6305f5e10083106121cf576305f5e100830492506008015b61271083106121e357612710830492506004015b606483106121f5576064830492506002015b600a83106106b25760010192915050565b6001600160a01b03821661222d5760405163b817eee760e01b815260040160405180910390fd5b60045433906000836001600160401b0381111561224c5761224c612a7f565b604051908082528060200260200182016040528015612275578160200160208202803683370190505b5090506000846001600160401b0381111561229257612292612a7f565b6040519080825280602002602001820160405280156122bb578160200160208202803683370190505b50905060005b8581101561236e5760018382815181106122dd576122dd612f35565b6020908102919091018101919091526001600160a01b038816600090815260019091526040812061230e9086612713565b90508083838151811061232357612323612f35565b6020908102919091018101919091526001600160a01b038916600090815260018083526040808320600886901c8452909352919020805460ff841683901b19169055909450016122c1565b5060008061237d8760016130d1565b90506001600160a01b038816915060208301516000836000805160206132d2833981519152600080a460025b8181146123d557806020028401516000846000805160206132d2833981519152600080a46001016123a9565b508660010361245f5760006001600160a01b0316886001600160a01b0316876001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628660008151811061243157612431612f35565b60200260200101516001604051612452929190918252602082015260400190565b60405180910390a46124b8565b60006001600160a01b0316886001600160a01b0316876001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86886040516124af9291906130e4565b60405180910390a45b611b6f8689600086611bc2565b6060806001600160a01b0384166124ee57604051622e076360e81b815260040160405180910390fd5b8260000361250f5760405163b562e8dd60e01b815260040160405180910390fd5b33836001600160401b0381111561252857612528612a7f565b604051908082528060200260200182016040528015612551578160200160208202803683370190505b509250836001600160401b0381111561256c5761256c612a7f565b604051908082528060200260200182016040528015612595578160200160208202803683370190505b50915060006125a360045490565b905080856000190310156125b657600080fd5b60005b85811015612609578082018582815181106125d6576125d6612f35565b60200260200101818152505060018482815181106125f6576125f6612f35565b60209081029190910101526001016125b9565b506001600160a01b038616600090815260016020526040902061262d908287612804565b846004600082825461263f91906130d1565b90915550600090508061265287846130d1565b90506001600160a01b0388169150828260006000805160206132d2833981519152600080a4600183015b8181146126a257808360006000805160206132d2833981519152600080a460010161267c565b50876001600160a01b031660006001600160a01b0316856001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb89896040516126f39291906130e4565b60405180910390a46127088460008a89611bc2565b505050509250929050565b600881901c600081815260208490526040902054600019919060ff84191690811b901c81158117612756575b50810160008181526040902054811581171561273f575b80156127fc576127ec817f0706060506020504060203020504030106050205030304010505030400000000601f6f8421084210842108cc6318c6db6d54be831560081b6fffffffffffffffffffffffffffffffff851160071b1784811c6001600160401b031060061b1784811c63ffffffff1060051b1784811c61ffff1060041b1784811c60ff1060031b1793841c1c161a1790565b600883901b178481116000031792505b505092915050565b60001960ff8316846020528360081c60005261010183820110612866576000805160408220805485851b1790559390910160ff811693600181019160081c015b808214612861578160005283604060002055600182019150612844565b506000525b60406000208284610100031c821b8154178155505050505050565b80356001600160a01b038116811461289857600080fd5b919050565b600080604083850312156128b057600080fd5b6128b983612881565b946020939093013593505050565b6001600160e01b03198116811461105757600080fd5b6000602082840312156128ef57600080fd5b8135610e47816128c7565b60005b838110156129155781810151838201526020016128fd565b50506000910152565b600081518084526129368160208601602086016128fa565b601f01601f19169290920160200192915050565b602081526000610e47602083018461291e565b60006020828403121561296f57600080fd5b5035919050565b60008060008060006080868803121561298e57600080fd5b61299786612881565b94506129a560208701612881565b93506040860135925060608601356001600160401b03808211156129c857600080fd5b818801915088601f8301126129dc57600080fd5b8135818111156129eb57600080fd5b8960208285010111156129fd57600080fd5b9699959850939650602001949392505050565b600080600060608486031215612a2557600080fd5b612a2e84612881565b9250612a3c60208501612881565b9150604084013590509250925092565b600080600060608486031215612a6157600080fd5b612a6a84612881565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715612aba57612aba612a7f565b6040525050565b60006001600160401b03821115612ada57612ada612a7f565b5060051b60200190565b600082601f830112612af557600080fd5b81356020612b0282612ac1565b604051612b0f8282612a95565b83815260059390931b8501820192828101915086841115612b2f57600080fd5b8286015b84811015612b4a5780358352918301918301612b33565b509695505050505050565b60006001600160401b03831115612b6e57612b6e612a7f565b604051612b85601f8501601f191660200182612a95565b809150838152848484011115612b9a57600080fd5b83836020830137600060208583010152509392505050565b600082601f830112612bc357600080fd5b610e4783833560208501612b55565b600080600080600060a08688031215612bea57600080fd5b612bf386612881565b9450612c0160208701612881565b935060408601356001600160401b0380821115612c1d57600080fd5b612c2989838a01612ae4565b94506060880135915080821115612c3f57600080fd5b612c4b89838a01612ae4565b93506080880135915080821115612c6157600080fd5b50612c6e88828901612bb2565b9150509295509295909350565b60008060408385031215612c8e57600080fd5b82356001600160401b0380821115612ca557600080fd5b818501915085601f830112612cb957600080fd5b81356020612cc682612ac1565b604051612cd38282612a95565b83815260059390931b8501820192828101915089841115612cf357600080fd5b948201945b83861015612d1857612d0986612881565b82529482019490820190612cf8565b96505086013592505080821115612d2e57600080fd5b50612d3b85828601612ae4565b9150509250929050565b600081518084526020808501945080840160005b83811015612d7557815187529582019590820190600101612d59565b509495945050505050565b602081526000610e476020830184612d45565b801515811461105757600080fd5b60008060408385031215612db457600080fd5b612dbd83612881565b91506020830135612dcd81612d93565b809150509250929050565b600060208284031215612dea57600080fd5b610e4782612881565b60008060408385031215612e0657600080fd5b612e0f83612881565b9150612e1d60208401612881565b90509250929050565b600060208284031215612e3857600080fd5b81356001600160401b03811115612e4e57600080fd5b8201601f81018413612e5f57600080fd5b610a6284823560208401612b55565b600080600080600060a08688031215612e8657600080fd5b612e8f86612881565b9450612e9d60208701612881565b9350604086013592506060860135915060808601356001600160401b03811115612ec657600080fd5b612c6e88828901612bb2565b600181811c90821680612ee657607f821691505b602082108103612f0657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106b2576106b2612f0c565b634e487b7160e01b600052603260045260246000fd5b600060018201612f5d57612f5d612f0c565b5060010190565b80820281158282048414176106b2576106b2612f0c565b600082612f9857634e487b7160e01b600052601260045260246000fd5b500490565b60008351612faf8184602088016128fa565b835190830190612fc38183602088016128fa565b01949350505050565b601f82111561106757600081815260208120601f850160051c81016020861015612ff35750805b601f850160051c820191505b81811015611b7357828155600101612fff565b81516001600160401b0381111561302b5761302b612a7f565b61303f816130398454612ed2565b84612fcc565b602080601f831160018114613074576000841561305c5750858301515b600019600386901b1c1916600185901b178555611b73565b600085815260208120601f198616915b828110156130a357888601518255948401946001909101908401613084565b50858210156130c15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808201808211156106b2576106b2612f0c565b6040815260006130f76040830185612d45565b82810360208401526131098185612d45565b95945050505050565b60006020828403121561312457600080fd5b8151610e4781612d93565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906131699083018461291e565b979650505050505050565b60006020828403121561318657600080fd5b8151610e47816128c7565b600060033d11156131aa5760046000803e5060005160e01c5b90565b600060443d10156131bb5790565b6040516003193d81016004833e81513d6001600160401b0381602484011181841117156131ea57505050505090565b82850191508151818111156132025750505050505090565b843d870101602082850101111561321c5750505050505090565b61322b60208286010187612a95565b509095945050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132699083018461291e565b9695505050505050565b6001600160a01b0386811682528516602082015260a06040820181905260009061329f90830186612d45565b82810360608401526132b18186612d45565b905082810360808401526132c5818561291e565b9897505050505050505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203151c9ac90702a111f52fbcedcd0097a0513ce95115502e6d7aeb2c034b6aaa064736f6c63430008130033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102475760003560e01c806370a082311161013b578063c5b8f772116100b8578063e985e9c51161007c578063e985e9c5146105d6578063f10f864e14610612578063f242432a1461061a578063f2fde38b1461062d578063f8b45b051461064057600080fd5b8063c5b8f7721461055c578063c87b56dd1461056f578063d547cfb714610582578063dd62ed3e1461058a578063e0df5b6f146105c357600080fd5b806399a2557a116100ff57806399a2557a146104f75780639b19251a1461050a578063a014e6e21461052d578063a22cb46514610536578063a9059cbb1461054957600080fd5b806370a082311461049a578063715018a6146104c35780638462151c146104cb5780638da5cb5b146104de57806395d89b41146104ef57600080fd5b80632d760d57116101c95780634eabf2c61161018d5780634eabf2c61461041e57806353d6fd59146104265780635afcc2f5146104395780635d0044ca146104605780636d6a6a4d1461047357600080fd5b80632d760d57146103905780632eb2c2d6146103a3578063313ce567146103b85780634a62bb65146103f15780634e1273f4146103fe57600080fd5b80630a702e8d116102105780630a702e8d146102fe5780630e89341c1461030b578063150b7a021461031e57806318160ddd1461035657806323b872dd1461037d57600080fd5b8062fdd58e1461024c57806301ffc9a71461027257806306fdde0314610295578063081812fc146102aa578063095ea7b3146102eb575b600080fd5b61025f61025a36600461289d565b610649565b6040519081526020015b60405180910390f35b6102856102803660046128dd565b6106b8565b6040519015158152602001610269565b61029d610759565b604051610269919061294a565b6102d36102b836600461295d565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610269565b6102856102f936600461289d565b6107e7565b600f546102859060ff1681565b61029d61031936600461295d565b6108ba565b61033d61032c366004612976565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610269565b61025f7f00000000000000000000000000000000000000000000010f0cf064dd5920000081565b61028561038b366004612a10565b6108c5565b61025f61039e366004612a4c565b610a33565b6103b66103b1366004612bd2565b610a6a565b005b6103df7f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff9091168152602001610269565b600d546102859060ff1681565b61041161040c366004612c7b565b610ab7565b6040516102699190612d80565b6103b6610b9f565b6103b6610434366004612da1565b610bbb565b61025f7f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b6103b661046e36600461295d565b610bee565b61025f7f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b61025f6104a8366004612dd8565b6001600160a01b031660009081526006602052604090205490565b6103b6610c73565b6104116104d9366004612dd8565b610c87565b6000546001600160a01b03166102d3565b61029d610cba565b610411610505366004612a4c565b610cc7565b610285610518366004612dd8565b600a6020526000908152604090205460ff1681565b61025f600b5481565b6103b6610544366004612da1565b610df9565b61028561055736600461289d565b610e08565b61028561056a36600461289d565b610e18565b61029d61057d36600461295d565b610e4e565b61029d610f56565b61025f610598366004612df3565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b6103b66105d1366004612e26565b610f63565b6102856105e4366004612df3565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b6103b6610f77565b6103b6610628366004612e6e565b610f93565b6103b661063b366004612dd8565b610fe1565b61025f600e5481565b60006001600160a01b038316610672576040516323d3ad8160e21b815260040160405180910390fd5b6001600160a01b0383166000908152600160208181526040808420600887901c85529091529091205460ff84161c16156106ae575060016106b2565b5060005b92915050565b60006001600160e01b03198216636cdb3d1360e11b14806106e957506001600160e01b031982166303a24d0760e21b145b8061070457506001600160e01b031982166362dc7bb960e11b145b8061071f57506380ac58cd60e01b6001600160e01b03198316145b8061073a5750635b5e139f60e01b6001600160e01b03198316145b806106b257506301ffc9a760e01b6001600160e01b03198316146106b2565b6008805461076690612ed2565b80601f016020809104026020016040519081016040528092919081815260200182805461079290612ed2565b80156107df5780601f106107b4576101008083540402835291602001916107df565b820191906000526020600020905b8154815290600101906020018083116107c257829003601f168201915b505050505081565b6000336107f360045490565b831080156108015750600083115b156108a5576108108184610e18565b61083d57604051634b637e8f60e11b81526001600160a01b03821660048201526024015b60405180910390fd5b60008381526005602090815260409182902080546001600160a01b0319166001600160a01b038881169182179092559251868152908416917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a36108b0565b6108b081858561105a565b5060019392505050565b60606106b282610e4e565b60006108d060045490565b821015610a1b576001600160a01b0384166000908152600160208181526040808420600887901c85529091529091205460ff84161c1661092e57604051634a1406b160e11b81526001600160a01b0385166004820152602401610834565b336001600160a01b0385161480159061096b57506001600160a01b038416600090815260026020908152604080832033845290915290205460ff16155b801561098e57506000828152600560205260409020546001600160a01b03163314155b156109ae57604051634a1406b160e11b8152336004820152602401610834565b6109db84847f0000000000000000000000000000000000000000000000000de0b6b3a7640000600061106c565b600082815260056020908152604080832080546001600160a01b031916905580519182019052818152610a16918691869186916001916110d2565b6108b0565b610a2684338461129a565b6108b0848484600161106c565b6000610a6283610a438185612f22565b6001600160a01b03871660009081526001602052604090209190611312565b949350505050565b6001600160a01b038516331480610a865750610a8685336105e4565b610aa357604051632ce44b5f60e11b815260040160405180910390fd5b610ab085858585856113b5565b5050505050565b60608151835114610adb57604051637801f4e960e01b815260040160405180910390fd5b600083516001600160401b03811115610af657610af6612a7f565b604051908082528060200260200182016040528015610b1f578160200160208202803683370190505b50905060005b8451811015610b9757610b6a858281518110610b4357610b43612f35565b6020026020010151858381518110610b5d57610b5d612f35565b6020026020010151610649565b828281518110610b7c57610b7c612f35565b6020908102919091010152610b9081612f4b565b9050610b25565b509392505050565b610ba7611619565b600f805460ff19811660ff90911615179055565b610bc3611619565b6001600160a01b03919091166000908152600a60205260409020805460ff1916911515919091179055565b610bf6611619565b6001811015610c375760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610834565b6064610c63827f00000000000000000000000000000000000000000000010f0cf064dd59200000612f64565b610c6d9190612f7b565b600e5550565b610c7b611619565b610c856000611673565b565b6060610c916116c3565b600003610cac57505060408051600081526020810190915290565b6106b2826001600454610cc7565b6009805461076690612ed2565b6060818310610ce957604051631960ccad60e11b815260040160405180910390fd5b6001831015610cf757600192505b6000610d0260045490565b905080831115610d10578092505b600083851015610d2c57610d25868686610a33565b9050610d30565b5060005b6000816001600160401b03811115610d4a57610d4a612a7f565b604051908082528060200260200182016040528015610d73578160200160208202803683370190505b506001600160a01b038816600090815260016020526040812091925087905b848114610deb57600882901c60009081526020849052604090205460ff83161c60011615610de05781848280600101935081518110610dd357610dd3612f35565b6020026020010181815250505b816001019150610d92565b509198975050505050505050565b610e043383836116d9565b5050565b6000336108b0818585600161106c565b6001600160a01b0382166000908152600160208181526040808420600886901c855290915282205460ff84161c165b9392505050565b6060610e5960045490565b8210610e7857604051637801f4e960e01b815260040160405180910390fd5b6000600c8054610e8790612ed2565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb390612ed2565b8015610f005780601f10610ed557610100808354040283529160200191610f00565b820191906000526020600020905b815481529060010190602001808311610ee357829003601f168201915b505050505090506000815111610f255760405180602001604052806000815250610e47565b80610f2f846117b9565b604051602001610f40929190612f9d565b6040516020818303038152906040529392505050565b600c805461076690612ed2565b610f6b611619565b600c610e048282613012565b610f7f611619565b600d805460ff19811660ff90911615179055565b6001600160a01b038516331480610faf5750610faf85336105e4565b15610fc857610fc3858585858560016110d2565b610ab0565b604051632ce44b5f60e11b815260040160405180910390fd5b610fe9611619565b6001600160a01b03811661104e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610834565b61105781611673565b50565b611067838383600161184b565b505050565b6001600160a01b03841661109657604051634b637e8f60e11b815260006004820152602401610834565b6001600160a01b0383166110c05760405163ec442f0560e01b815260006004820152602401610834565b6110cc84848484611920565b50505050565b6001600160a01b0385166110f957604051633a954ecd60e21b815260040160405180910390fd5b33600061110586611b7b565b905084600114801561114257506001600160a01b038816600090815260016020818152604080842060088b901c85529091529091205460ff88161c165b156111d1576001600160a01b03888116600090815260016020818152604080842060088c901c808652908352818520805460ff8e1686901b8019909116909155958d168552928252808420928452919052812080549092179091556111cc90899089907f0000000000000000000000000000000000000000000000000de0b6b3a76400009061106c565b6111ea565b6040516337dbad3d60e01b815260040160405180910390fd5b6001600160a01b038781169089168682826000805160206132d2833981519152600080a4886001600160a01b03168a6001600160a01b0316856001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628b8b604051611266929190918252602082015260400190565b60405180910390a461127a848b8b86611bc2565b841561128e5761128e848b8b8b8b8b611d54565b50505050505050505050565b6001600160a01b0383811660009081526007602090815260408083209386168352929052205460001981146110cc578181101561130357604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610834565b6110cc8484848403600061184b565b6000600883901c60ff8416610101848201106113885760008281526020879052604090205461134290821c611fc2565b930160ff8116939250600182019160009160081c015b8083146113865760008381526020889052604090205461137790611fc2565b84019350826001019250611358565b505b6000828152602087905260409020546113a990821c6101008690031b611fc2565b90920195945050505050565b81518351146113d757604051637801f4e960e01b815260040160405180910390fd5b6001600160a01b0384166113fe57604051633a954ecd60e21b815260040160405180910390fd5b3360005b84518110156114ed57600085828151811061141f5761141f612f35565b60200260200101519050600085838151811061143d5761143d612f35565b6020026020010151905080600114801561148257506001600160a01b0389166000908152600160208181526040808420600887901c85529091529091205460ff84161c165b156111d157506001600160a01b038881166000908152600160208181526040808420600887901c808652908352818520805460ff90981685901b80199098169055948c1684529181528183209383529290925220805490911790556114e681612f4b565b9050611402565b50611527868686517f0000000000000000000000000000000000000000000000000de0b6b3a76400006115209190612f64565b600061106c565b60008060008651600161153a91906130d1565b90506001600160a01b03891691506001600160a01b0388169250602087015183836000805160206132d2833981519152600080a460025b81811461159c578060200288015184846000805160206132d2833981519152600080a4600101611571565b50876001600160a01b0316896001600160a01b0316856001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8a8a6040516115ec9291906130e4565b60405180910390a4611600848a8a8a611bc2565b61160e848a8a8a8a8a612072565b505050505050505050565b6000546001600160a01b03163314610c855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610834565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060016004546116d49190612f22565b905090565b816001600160a01b0316836001600160a01b03160361174c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610834565b6001600160a01b03838116600081815260026020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b606060006117c68361212e565b60010190506000816001600160401b038111156117e5576117e5612a7f565b6040519080825280601f01601f19166020018201604052801561180f576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461181957509392505050565b6001600160a01b0384166118755760405163e602df0560e01b815260006004820152602401610834565b6001600160a01b03831661189f57604051634a1406b160e11b815260006004820152602401610834565b6001600160a01b03808516600090815260076020908152604080832093871683529290522082905580156110cc57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161191291815260200190565b60405180910390a350505050565b6001600160a01b038085166000908152600660205260408082205492861682529020548382101561197d5760405163391434e360e21b81526001600160a01b03871660048201526024810183905260448101859052606401610834565b6001600160a01b03808716600081815260066020526040808220888703905592881680825290839020848801905591516000805160206132d2833981519152906119ca9088815260200190565b60405180910390a38215611b73576001600160a01b0386166000908152600a602052604090205460ff1680611a785760007f0000000000000000000000000000000000000000000000000de0b6b3a7640000611a268786612f22565b611a309190612f7b565b611a5a7f0000000000000000000000000000000000000000000000000de0b6b3a764000086612f7b565b611a649190612f22565b90508015611a7657611a768882612206565b505b6001600160a01b0386166000908152600a602052604090205460ff16611b7157600b546001148015611aa75750805b8015611ac057506000546001600160a01b038881169116145b15611af2576001600160a01b0386166000908152600a60205260409020805460ff191660011790556002600b55611b71565b6000611b1e7f0000000000000000000000000000000000000000000000000de0b6b3a764000084612f7b565b7f0000000000000000000000000000000000000000000000000de0b6b3a7640000611b4988866130d1565b611b539190612f7b565b611b5d9190612f22565b90508015611b6f5761128e87826124c5565b505b505b505050505050565b604080516001808252818301909252606091602080830190803683370190505090508181600081518110611bb157611bb1612f35565b602002602001018181525050919050565b600d5460ff168015611bed57506001600160a01b0382166000908152600a602052604090205460ff16155b156110cc57600e546001600160a01b0383166000908152600660205260409020541115611c5c5760405162461bcd60e51b815260206004820152601f60248201527f5472616e736665722065786365656473206d6178696d756d2077616c6c6574006044820152606401610834565b600f5460ff16156110cc57326000908152601060205260409020544311611cd15760405162461bcd60e51b8152602060048201526024808201527f4f6e6c79206f6e65207472616e736665722070657220626c6f636b20616c6c6f6044820152633bb2b21760e11b6064820152608401610834565b3260009081526010602052604090204390556001600160a01b0382163b158015611cfa5750323b155b6110cc5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742074726164696e672072657374726963746564206174206c6044820152640c2eadcc6d60db1b6064820152608401610834565b6001600160a01b0384163b15611b73576040516301ffc9a760e01b8152636cdb3d1360e11b60048201526001600160a01b038516906301ffc9a790602401602060405180830381865afa158015611daf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd39190613112565b15611ede5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190611e0c908990899088908890889060040161312f565b6020604051808303816000875af1925050508015611e47575060408051601f3d908101601f19168201909252611e4491810190613174565b60015b611ea757611e53613191565b806308c379a003611e8c5750611e676131ad565b80611e725750611e8e565b8060405162461bcd60e51b8152600401610834919061294a565b505b604051639c05499b60e01b815260040160405180910390fd5b6001600160e01b0319811663f23a6e6160e01b14611ed857604051639c05499b60e01b815260040160405180910390fd5b50611b73565b604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611f10908990899088908790600401613236565b6020604051808303816000875af1925050508015611f4b575060408051601f3d908101601f19168201909252611f4891810190613174565b60015b611f9157611f57613191565b806308c379a003611f765750611f6b6131ad565b80611e725750611f78565b505b6040516368d2bf6b60e11b815260040160405180910390fd5b6001600160e01b03198116630a85bd0160e11b14611b71576040516368d2bf6b60e11b815260040160405180910390fd5b7f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f7f5555555555555555555555555555555555555555555555555555555555555555600183901c168203600281901c7f3333333333333333333333333333333333333333333333333333333333333333908116911601600481901c01167f01010101010101010101010101010101010101010101010101010101010101010260f81c6000199190911460081b1790565b6001600160a01b0384163b15611b735760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906120b69089908990889088908890600401613273565b6020604051808303816000875af19250505080156120f1575060408051601f3d908101601f191682019092526120ee91810190613174565b60015b6120fd57611e53613191565b6001600160e01b0319811663bc197c8160e01b14611b7157604051639c05499b60e01b815260040160405180910390fd5b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061216d5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612199576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106121b757662386f26fc10000830492506010015b6305f5e10083106121cf576305f5e100830492506008015b61271083106121e357612710830492506004015b606483106121f5576064830492506002015b600a83106106b25760010192915050565b6001600160a01b03821661222d5760405163b817eee760e01b815260040160405180910390fd5b60045433906000836001600160401b0381111561224c5761224c612a7f565b604051908082528060200260200182016040528015612275578160200160208202803683370190505b5090506000846001600160401b0381111561229257612292612a7f565b6040519080825280602002602001820160405280156122bb578160200160208202803683370190505b50905060005b8581101561236e5760018382815181106122dd576122dd612f35565b6020908102919091018101919091526001600160a01b038816600090815260019091526040812061230e9086612713565b90508083838151811061232357612323612f35565b6020908102919091018101919091526001600160a01b038916600090815260018083526040808320600886901c8452909352919020805460ff841683901b19169055909450016122c1565b5060008061237d8760016130d1565b90506001600160a01b038816915060208301516000836000805160206132d2833981519152600080a460025b8181146123d557806020028401516000846000805160206132d2833981519152600080a46001016123a9565b508660010361245f5760006001600160a01b0316886001600160a01b0316876001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628660008151811061243157612431612f35565b60200260200101516001604051612452929190918252602082015260400190565b60405180910390a46124b8565b60006001600160a01b0316886001600160a01b0316876001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86886040516124af9291906130e4565b60405180910390a45b611b6f8689600086611bc2565b6060806001600160a01b0384166124ee57604051622e076360e81b815260040160405180910390fd5b8260000361250f5760405163b562e8dd60e01b815260040160405180910390fd5b33836001600160401b0381111561252857612528612a7f565b604051908082528060200260200182016040528015612551578160200160208202803683370190505b509250836001600160401b0381111561256c5761256c612a7f565b604051908082528060200260200182016040528015612595578160200160208202803683370190505b50915060006125a360045490565b905080856000190310156125b657600080fd5b60005b85811015612609578082018582815181106125d6576125d6612f35565b60200260200101818152505060018482815181106125f6576125f6612f35565b60209081029190910101526001016125b9565b506001600160a01b038616600090815260016020526040902061262d908287612804565b846004600082825461263f91906130d1565b90915550600090508061265287846130d1565b90506001600160a01b0388169150828260006000805160206132d2833981519152600080a4600183015b8181146126a257808360006000805160206132d2833981519152600080a460010161267c565b50876001600160a01b031660006001600160a01b0316856001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb89896040516126f39291906130e4565b60405180910390a46127088460008a89611bc2565b505050509250929050565b600881901c600081815260208490526040902054600019919060ff84191690811b901c81158117612756575b50810160008181526040902054811581171561273f575b80156127fc576127ec817f0706060506020504060203020504030106050205030304010505030400000000601f6f8421084210842108cc6318c6db6d54be831560081b6fffffffffffffffffffffffffffffffff851160071b1784811c6001600160401b031060061b1784811c63ffffffff1060051b1784811c61ffff1060041b1784811c60ff1060031b1793841c1c161a1790565b600883901b178481116000031792505b505092915050565b60001960ff8316846020528360081c60005261010183820110612866576000805160408220805485851b1790559390910160ff811693600181019160081c015b808214612861578160005283604060002055600182019150612844565b506000525b60406000208284610100031c821b8154178155505050505050565b80356001600160a01b038116811461289857600080fd5b919050565b600080604083850312156128b057600080fd5b6128b983612881565b946020939093013593505050565b6001600160e01b03198116811461105757600080fd5b6000602082840312156128ef57600080fd5b8135610e47816128c7565b60005b838110156129155781810151838201526020016128fd565b50506000910152565b600081518084526129368160208601602086016128fa565b601f01601f19169290920160200192915050565b602081526000610e47602083018461291e565b60006020828403121561296f57600080fd5b5035919050565b60008060008060006080868803121561298e57600080fd5b61299786612881565b94506129a560208701612881565b93506040860135925060608601356001600160401b03808211156129c857600080fd5b818801915088601f8301126129dc57600080fd5b8135818111156129eb57600080fd5b8960208285010111156129fd57600080fd5b9699959850939650602001949392505050565b600080600060608486031215612a2557600080fd5b612a2e84612881565b9250612a3c60208501612881565b9150604084013590509250925092565b600080600060608486031215612a6157600080fd5b612a6a84612881565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715612aba57612aba612a7f565b6040525050565b60006001600160401b03821115612ada57612ada612a7f565b5060051b60200190565b600082601f830112612af557600080fd5b81356020612b0282612ac1565b604051612b0f8282612a95565b83815260059390931b8501820192828101915086841115612b2f57600080fd5b8286015b84811015612b4a5780358352918301918301612b33565b509695505050505050565b60006001600160401b03831115612b6e57612b6e612a7f565b604051612b85601f8501601f191660200182612a95565b809150838152848484011115612b9a57600080fd5b83836020830137600060208583010152509392505050565b600082601f830112612bc357600080fd5b610e4783833560208501612b55565b600080600080600060a08688031215612bea57600080fd5b612bf386612881565b9450612c0160208701612881565b935060408601356001600160401b0380821115612c1d57600080fd5b612c2989838a01612ae4565b94506060880135915080821115612c3f57600080fd5b612c4b89838a01612ae4565b93506080880135915080821115612c6157600080fd5b50612c6e88828901612bb2565b9150509295509295909350565b60008060408385031215612c8e57600080fd5b82356001600160401b0380821115612ca557600080fd5b818501915085601f830112612cb957600080fd5b81356020612cc682612ac1565b604051612cd38282612a95565b83815260059390931b8501820192828101915089841115612cf357600080fd5b948201945b83861015612d1857612d0986612881565b82529482019490820190612cf8565b96505086013592505080821115612d2e57600080fd5b50612d3b85828601612ae4565b9150509250929050565b600081518084526020808501945080840160005b83811015612d7557815187529582019590820190600101612d59565b509495945050505050565b602081526000610e476020830184612d45565b801515811461105757600080fd5b60008060408385031215612db457600080fd5b612dbd83612881565b91506020830135612dcd81612d93565b809150509250929050565b600060208284031215612dea57600080fd5b610e4782612881565b60008060408385031215612e0657600080fd5b612e0f83612881565b9150612e1d60208401612881565b90509250929050565b600060208284031215612e3857600080fd5b81356001600160401b03811115612e4e57600080fd5b8201601f81018413612e5f57600080fd5b610a6284823560208401612b55565b600080600080600060a08688031215612e8657600080fd5b612e8f86612881565b9450612e9d60208701612881565b9350604086013592506060860135915060808601356001600160401b03811115612ec657600080fd5b612c6e88828901612bb2565b600181811c90821680612ee657607f821691505b602082108103612f0657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106b2576106b2612f0c565b634e487b7160e01b600052603260045260246000fd5b600060018201612f5d57612f5d612f0c565b5060010190565b80820281158282048414176106b2576106b2612f0c565b600082612f9857634e487b7160e01b600052601260045260246000fd5b500490565b60008351612faf8184602088016128fa565b835190830190612fc38183602088016128fa565b01949350505050565b601f82111561106757600081815260208120601f850160051c81016020861015612ff35750805b601f850160051c820191505b81811015611b7357828155600101612fff565b81516001600160401b0381111561302b5761302b612a7f565b61303f816130398454612ed2565b84612fcc565b602080601f831160018114613074576000841561305c5750858301515b600019600386901b1c1916600185901b178555611b73565b600085815260208120601f198616915b828110156130a357888601518255948401946001909101908401613084565b50858210156130c15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808201808211156106b2576106b2612f0c565b6040815260006130f76040830185612d45565b82810360208401526131098185612d45565b95945050505050565b60006020828403121561312457600080fd5b8151610e4781612d93565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906131699083018461291e565b979650505050505050565b60006020828403121561318657600080fd5b8151610e47816128c7565b600060033d11156131aa5760046000803e5060005160e01c5b90565b600060443d10156131bb5790565b6040516003193d81016004833e81513d6001600160401b0381602484011181841117156131ea57505050505090565b82850191508151818111156132025750505050505090565b843d870101602082850101111561321c5750505050505090565b61322b60208286010187612a95565b509095945050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132699083018461291e565b9695505050505050565b6001600160a01b0386811682528516602082015260a06040820181905260009061329f90830186612d45565b82810360608401526132b18186612d45565b905082810360808401526132c5818561291e565b9897505050505050505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203151c9ac90702a111f52fbcedcd0097a0513ce95115502e6d7aeb2c034b6aaa064736f6c63430008130033
Loading...
Loading
Loading...
Loading
[ 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.