Feature Tip: Add private address tag to any address under My Name Tag !
ERC-1155
Overview
Max Total Supply
0 LFTWRP_500
Holders
1
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Filtered by Token Holder
9999 Luftballons: LUFTBALLONS TokenLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
LuftdropHelper
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // ERC721AirdropTarget Contracts v4.0.0 // Creator: Chance Santana-Wees pragma solidity ^0.8.11; import './IERC721AirdropTarget.sol'; import './ERC20Spendable.sol'; import './Luftballons.sol'; import './strings.sol'; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; interface ILuftballons { function setCustomNFTPrice(address collection, uint256 tokenPrice) external; } interface IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } interface IERC1155MetadataURI is IERC1155 { function uri(uint256 id) external view returns (string memory); } contract LuftdropHelper is IERC1155, Ownable, IERC1155Receiver, IERC721Receiver { using strings for *; address immutable public luft_ballons; uint256 immutable public burn_cost; mapping(uint256 => address) public base_collection; mapping(uint256 => uint256) public wrapped_token; mapping(uint256 => uint256) public wrapped_quantity; mapping(address => mapping(uint256 => uint256)) public token_to_wrapper; uint256 public total_quantity; uint256 currentTokenID = 1; event token_wrapped_721(address collection, uint256 tokenID); event token_wrapped_1155(address collection, uint256 tokenID, uint256 quantity); constructor(address luftballons, uint256 burn) { luft_ballons = luftballons; burn_cost = burn; //transferOwnership(address(this)); //ILuftballons(luft_ballons).setCustomNFTPrice(address(this), burn_cost); } /*function owner() public view override returns (address) { return address(this); }*/ function onERC721Received(address, address, uint256 tokenId, bytes calldata) public returns (bytes4) { require(IERC165(msg.sender).supportsInterface(type(IERC721).interfaceId), "Sender not valid ERC721 Collection"); wrapToken(msg.sender, tokenId, 1); emit token_wrapped_721(msg.sender, tokenId); return IERC721Receiver.onERC721Received.selector; } function onERC1155Received(address, address, uint256 tokenId, uint256 quantity, bytes calldata) public returns (bytes4) { require(IERC165(msg.sender).supportsInterface(type(IERC1155).interfaceId), "Sender not valid ERC1155 Collection"); wrapToken(msg.sender, tokenId, quantity); emit token_wrapped_1155(msg.sender, tokenId, quantity); return IERC1155Receiver.onERC1155Received.selector; } function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) public pure returns (bytes4) { require(false, "Not Supported"); return bytes4(0); } function noticeERC721(address collection, uint256 tokenID) external { uint256 wrapper = token_to_wrapper[collection][tokenID]; require(wrapper == 0 || wrapped_quantity[wrapper] == 0, "Already Wrapped"); require(IERC721(collection).ownerOf(tokenID) == address(this), "Not Mine"); wrapToken(collection, tokenID, 1); emit token_wrapped_721(collection, tokenID); } function noticeERC1155(address collection, uint256 tokenID) external { uint256 wrapper = token_to_wrapper[collection][tokenID]; uint256 hidden_balance = IERC1155(collection).balanceOf(address(this), tokenID) - wrapped_quantity[wrapper]; require(wrapper == 0 || hidden_balance > 0, "Nothing to Wrap"); wrapToken(collection, tokenID, hidden_balance); emit token_wrapped_1155(collection, tokenID, hidden_balance); } function wrapToken(address collection, uint256 tokenID, uint256 quantity) internal returns (uint256 wrapper_id) { if(token_to_wrapper[collection][tokenID] == 0) { wrapper_id = currentTokenID; currentTokenID++; token_to_wrapper[collection][tokenID] = wrapper_id; base_collection[wrapper_id] = collection; wrapped_token[wrapper_id] = tokenID; } else { wrapper_id = token_to_wrapper[collection][tokenID]; } emit TransferSingle(address(this), address(collection), luft_ballons, wrapper_id, quantity); emit URI(uri(wrapper_id), wrapper_id); IERC1155Receiver(luft_ballons).onERC1155Received(collection, collection, wrapper_id, quantity, ""); wrapped_quantity[wrapper_id] += quantity; total_quantity+=quantity; } function balanceOf(address owner, uint256 wrapper_id) public view returns (uint256 balance) { if(owner == luft_ballons) return wrapped_quantity[wrapper_id]; return 0; } function balanceOfBatch(address[] calldata accounts, uint256[] memory tokens) external view returns (uint256[] memory balance) { for(uint i = 0; i < accounts.length; i++) { tokens[i] = balanceOf(accounts[i], tokens[i]); } return tokens; } function ownerOf(uint256 tokenId) external view returns (address owner) { if(wrapped_quantity[tokenId] == 0) return address(0); return luft_ballons; } function safeTransferFrom( address from, address to, uint256 tokenId, uint256 quantity, bytes calldata ) external { safeTransferFrom(from,to,tokenId,quantity); } function safeTransferFrom( address from, address to, uint256 tokenId, uint256 quantity ) public { transferFrom(from,to,tokenId,quantity); } function transferFrom( address from, address to, uint256 tokenId, uint256 quantity ) public { require(msg.sender == luft_ballons && from == luft_ballons && wrapped_quantity[tokenId] > 0); unwrap(to, tokenId, quantity); } function safeBatchTransferFrom( address, address, uint256[] memory, uint256[] memory, bytes calldata ) external pure { require(false, "Not Supported"); } function unwrap(address recipient, uint256 wrapper_id, uint256 quantity) internal { if(IERC165(base_collection[wrapper_id]).supportsInterface(type(IERC1155).interfaceId)) { IERC1155(base_collection[wrapper_id]).safeTransferFrom(address(this), recipient, wrapped_token[wrapper_id], quantity, ""); } else { IERC721(base_collection[wrapper_id]).safeTransferFrom(address(this), recipient, wrapped_token[wrapper_id], ""); } wrapped_quantity[wrapper_id]--; total_quantity--; emit TransferSingle(address(this), luft_ballons, address(0), wrapper_id, quantity); } function approve(address to, uint256 tokenId) external {} function setApprovalForAll(address operator, bool _approved) external {} function getApproved(uint256 tokenId) external view returns (address operator) {} function isApprovedForAll(address owner, address operator) external view returns (bool) {} function name() public view returns (string memory) { return string.concat("LuftWrapped NFTs - ", Strings.toString(burn_cost/10**18), " $LUFT"); } function symbol() public view returns (string memory) { return string.concat("LFTWRP_",Strings.toString(burn_cost/10**18)); } function uri(uint256 tokenId) public view returns (string memory) { return tokenURI(tokenId); } function tokenURI(uint256 tokenId) public view returns (string memory) { address collection = base_collection[tokenId]; require(collection != address(0)); uint256 wrappedTokenID = wrapped_token[tokenId]; if(IERC165(collection).supportsInterface(type(IERC1155).interfaceId)) { strings.slice memory metadata = IERC1155MetadataURI(collection).uri(wrappedTokenID).toSlice(); strings.slice memory id_mark = "{id}".toSlice(); if(metadata.contains(id_mark)) { strings.slice memory pre = metadata.split(id_mark); return string.concat(pre.toString(),toPaddedHexID(wrappedTokenID),metadata.toString()); } return metadata.toString(); } else { return IERC721Metadata(collection).tokenURI(wrappedTokenID); } } function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == type(IERC1155).interfaceId || // ERC165 interface ID for ERC721. interfaceId == type(IERC1155MetadataURI).interfaceId || // ERC165 interface ID for ERC721Metadata. interfaceId == type(IERC1155Receiver).interfaceId || interfaceId == type(IERC721Receiver).interfaceId; } function forwardAirdroppedTokens(IToken token_) external { uint256 balance = token_.balanceOf(address(this)); require(balance > 0, "No Tokens Detected"); require(token_.transfer(luft_ballons, balance), "Failed Transfer"); IERC721AirdropTarget(luft_ballons).noticeAirdrop(address(token_)); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation left padded with 0s to 64 bit length without 0x prefix */ function toPaddedHexID(uint256 value) internal pure returns (string memory) { strings.slice memory baseString = Strings.toHexString(value).toSlice(); baseString = baseString.beyond("0x".toSlice()); string memory zeros = string(new bytes(128 - baseString.len()*2)); return string.concat(zeros, baseString.toString()); } } interface IToken { function transfer(address spender, uint256 amount) external returns (bool); function balanceOf(address spender) external returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ 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 // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/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 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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
/* * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <[email protected]> * * @dev Functionality in this library is largely implemented using an * abstraction called a 'slice'. A slice represents a part of a string - * anything from the entire string to a single character, or even no * characters at all (a 0-length slice). Since a slice only has to specify * an offset and a length, copying and manipulating slices is a lot less * expensive than copying and manipulating the strings they reference. * * To further reduce gas costs, most functions on slice that need to return * a slice modify the original one instead of allocating a new one; for * instance, `s.split(".")` will return the text up to the first '.', * modifying s to only contain the remainder of the string after the '.'. * In situations where you do not want to modify the original slice, you * can make a copy first with `.copy()`, for example: * `s.copy().split(".")`. Try and avoid using this idiom in loops; since * Solidity has no memory management, it will result in allocating many * short-lived slices that are later discarded. * * Functions that return two slices come in two versions: a non-allocating * version that takes the second slice as an argument, modifying it in * place, and an allocating version that allocates and returns the second * slice; see `nextRune` for example. * * Functions that have to copy string data will return strings rather than * slices; these can be cast back to slices for further processing if * required. * * For convenience, some functions are provided with non-modifying * variants that create a new slice and return both; for instance, * `s.splitNew('.')` leaves s unmodified, and returns two values * corresponding to the left and right parts of the string. */ pragma solidity ^0.8.0; library strings { struct slice { uint _len; uint _ptr; } function memcpy(uint dest, uint src, uint _len) private pure { // Copy word-length chunks while possible for(; _len >= 32; _len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Copy remaining bytes uint mask = type(uint).max; if (_len > 0) { mask = 256 ** (32 - _len) - 1; } assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } /* * @dev Returns a slice containing the entire string. * @param self The string to make a slice from. * @return A newly allocated slice containing the entire string. */ function toSlice(string memory self) internal pure returns (slice memory) { uint ptr; assembly { ptr := add(self, 0x20) } return slice(bytes(self).length, ptr); } /* * @dev Returns the length of a null-terminated bytes32 string. * @param self The value to find the length of. * @return The length of the string, from 0 to 32. */ function len(bytes32 self) internal pure returns (uint) { uint ret; if (self == 0) return 0; if (uint(self) & type(uint128).max == 0) { ret += 16; self = bytes32(uint(self) / 0x100000000000000000000000000000000); } if (uint(self) & type(uint64).max == 0) { ret += 8; self = bytes32(uint(self) / 0x10000000000000000); } if (uint(self) & type(uint32).max == 0) { ret += 4; self = bytes32(uint(self) / 0x100000000); } if (uint(self) & type(uint16).max == 0) { ret += 2; self = bytes32(uint(self) / 0x10000); } if (uint(self) & type(uint8).max == 0) { ret += 1; } return 32 - ret; } /* * @dev Returns a slice containing the entire bytes32, interpreted as a * null-terminated utf-8 string. * @param self The bytes32 value to convert to a slice. * @return A new slice containing the value of the input argument up to the * first null. */ function toSliceB32(bytes32 self) internal pure returns (slice memory ret) { // Allocate space for `self` in memory, copy it there, and point ret at it assembly { let ptr := mload(0x40) mstore(0x40, add(ptr, 0x20)) mstore(ptr, self) mstore(add(ret, 0x20), ptr) } ret._len = len(self); } /* * @dev Returns a new slice containing the same data as the current slice. * @param self The slice to copy. * @return A new slice containing the same data as `self`. */ function copy(slice memory self) internal pure returns (slice memory) { return slice(self._len, self._ptr); } /* * @dev Copies a slice to a new string. * @param self The slice to copy. * @return A newly allocated string containing the slice's text. */ function toString(slice memory self) internal pure returns (string memory) { string memory ret = new string(self._len); uint retptr; assembly { retptr := add(ret, 32) } memcpy(retptr, self._ptr, self._len); return ret; } /* * @dev Returns the length in runes of the slice. Note that this operation * takes time proportional to the length of the slice; avoid using it * in loops, and call `slice.empty()` if you only need to know whether * the slice is empty or not. * @param self The slice to operate on. * @return The length of the slice in runes. */ function len(slice memory self) internal pure returns (uint l) { // Starting at ptr-31 means the LSB will be the byte we care about uint ptr = self._ptr - 31; uint end = ptr + self._len; for (l = 0; ptr < end; l++) { uint8 b; assembly { b := and(mload(ptr), 0xFF) } if (b < 0x80) { ptr += 1; } else if(b < 0xE0) { ptr += 2; } else if(b < 0xF0) { ptr += 3; } else if(b < 0xF8) { ptr += 4; } else if(b < 0xFC) { ptr += 5; } else { ptr += 6; } } } /* * @dev Returns true if the slice is empty (has a length of 0). * @param self The slice to operate on. * @return True if the slice is empty, False otherwise. */ function empty(slice memory self) internal pure returns (bool) { return self._len == 0; } /* * @dev Returns a positive number if `other` comes lexicographically after * `self`, a negative number if it comes before, or zero if the * contents of the two slices are equal. Comparison is done per-rune, * on unicode codepoints. * @param self The first slice to compare. * @param other The second slice to compare. * @return The result of the comparison. */ function compare(slice memory self, slice memory other) internal pure returns (int) { uint shortest = self._len; if (other._len < self._len) shortest = other._len; uint selfptr = self._ptr; uint otherptr = other._ptr; for (uint idx = 0; idx < shortest; idx += 32) { uint a; uint b; assembly { a := mload(selfptr) b := mload(otherptr) } if (a != b) { // Mask out irrelevant bytes and check again uint mask = type(uint).max; // 0xffff... if(shortest < 32) { mask = ~(2 ** (8 * (32 - shortest + idx)) - 1); } unchecked { uint diff = (a & mask) - (b & mask); if (diff != 0) return int(diff); } } selfptr += 32; otherptr += 32; } return int(self._len) - int(other._len); } /* * @dev Returns true if the two slices contain the same text. * @param self The first slice to compare. * @param self The second slice to compare. * @return True if the slices are equal, false otherwise. */ function equals(slice memory self, slice memory other) internal pure returns (bool) { return compare(self, other) == 0; } /* * @dev Extracts the first rune in the slice into `rune`, advancing the * slice to point to the next rune and returning `self`. * @param self The slice to operate on. * @param rune The slice that will contain the first rune. * @return `rune`. */ function nextRune(slice memory self, slice memory rune) internal pure returns (slice memory) { rune._ptr = self._ptr; if (self._len == 0) { rune._len = 0; return rune; } uint l; uint b; // Load the first byte of the rune into the LSBs of b assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) } if (b < 0x80) { l = 1; } else if(b < 0xE0) { l = 2; } else if(b < 0xF0) { l = 3; } else { l = 4; } // Check for truncated codepoints if (l > self._len) { rune._len = self._len; self._ptr += self._len; self._len = 0; return rune; } self._ptr += l; self._len -= l; rune._len = l; return rune; } /* * @dev Returns the first rune in the slice, advancing the slice to point * to the next rune. * @param self The slice to operate on. * @return A slice containing only the first rune from `self`. */ function nextRune(slice memory self) internal pure returns (slice memory ret) { nextRune(self, ret); } /* * @dev Returns the number of the first codepoint in the slice. * @param self The slice to operate on. * @return The number of the first codepoint in the slice. */ function ord(slice memory self) internal pure returns (uint ret) { if (self._len == 0) { return 0; } uint word; uint length; uint divisor = 2 ** 248; // Load the rune into the MSBs of b assembly { word:= mload(mload(add(self, 32))) } uint b = word / divisor; if (b < 0x80) { ret = b; length = 1; } else if(b < 0xE0) { ret = b & 0x1F; length = 2; } else if(b < 0xF0) { ret = b & 0x0F; length = 3; } else { ret = b & 0x07; length = 4; } // Check for truncated codepoints if (length > self._len) { return 0; } for (uint i = 1; i < length; i++) { divisor = divisor / 256; b = (word / divisor) & 0xFF; if (b & 0xC0 != 0x80) { // Invalid UTF-8 sequence return 0; } ret = (ret * 64) | (b & 0x3F); } return ret; } /* * @dev Returns the keccak-256 hash of the slice. * @param self The slice to hash. * @return The hash of the slice. */ function keccak(slice memory self) internal pure returns (bytes32 ret) { assembly { ret := keccak256(mload(add(self, 32)), mload(self)) } } /* * @dev Returns true if `self` starts with `needle`. * @param self The slice to operate on. * @param needle The slice to search for. * @return True if the slice starts with the provided text, false otherwise. */ function startsWith(slice memory self, slice memory needle) internal pure returns (bool) { if (self._len < needle._len) { return false; } if (self._ptr == needle._ptr) { return true; } bool equal; assembly { let length := mload(needle) let selfptr := mload(add(self, 0x20)) let needleptr := mload(add(needle, 0x20)) equal := eq(keccak256(selfptr, length), keccak256(needleptr, length)) } return equal; } /* * @dev If `self` starts with `needle`, `needle` is removed from the * beginning of `self`. Otherwise, `self` is unmodified. * @param self The slice to operate on. * @param needle The slice to search for. * @return `self` */ function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) { if (self._len < needle._len) { return self; } bool equal = true; if (self._ptr != needle._ptr) { assembly { let length := mload(needle) let selfptr := mload(add(self, 0x20)) let needleptr := mload(add(needle, 0x20)) equal := eq(keccak256(selfptr, length), keccak256(needleptr, length)) } } if (equal) { self._len -= needle._len; self._ptr += needle._len; } return self; } /* * @dev Returns true if the slice ends with `needle`. * @param self The slice to operate on. * @param needle The slice to search for. * @return True if the slice starts with the provided text, false otherwise. */ function endsWith(slice memory self, slice memory needle) internal pure returns (bool) { if (self._len < needle._len) { return false; } uint selfptr = self._ptr + self._len - needle._len; if (selfptr == needle._ptr) { return true; } bool equal; assembly { let length := mload(needle) let needleptr := mload(add(needle, 0x20)) equal := eq(keccak256(selfptr, length), keccak256(needleptr, length)) } return equal; } /* * @dev If `self` ends with `needle`, `needle` is removed from the * end of `self`. Otherwise, `self` is unmodified. * @param self The slice to operate on. * @param needle The slice to search for. * @return `self` */ function until(slice memory self, slice memory needle) internal pure returns (slice memory) { if (self._len < needle._len) { return self; } uint selfptr = self._ptr + self._len - needle._len; bool equal = true; if (selfptr != needle._ptr) { assembly { let length := mload(needle) let needleptr := mload(add(needle, 0x20)) equal := eq(keccak256(selfptr, length), keccak256(needleptr, length)) } } if (equal) { self._len -= needle._len; } return self; } // Returns the memory address of the first byte of the first occurrence of // `needle` in `self`, or the first byte after `self` if not found. function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr = selfptr; uint idx; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask; if (needlelen > 0) { mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1)); } bytes32 needledata; assembly { needledata := and(mload(needleptr), mask) } uint end = selfptr + selflen - needlelen; bytes32 ptrdata; assembly { ptrdata := and(mload(ptr), mask) } while (ptrdata != needledata) { if (ptr >= end) return selfptr + selflen; ptr++; assembly { ptrdata := and(mload(ptr), mask) } } return ptr; } else { // For long needles, use hashing bytes32 hash; assembly { hash := keccak256(needleptr, needlelen) } for (idx = 0; idx <= selflen - needlelen; idx++) { bytes32 testHash; assembly { testHash := keccak256(ptr, needlelen) } if (hash == testHash) return ptr; ptr += 1; } } } return selfptr + selflen; } // Returns the memory address of the first byte after the last occurrence of // `needle` in `self`, or the address of `self` if not found. function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask; if (needlelen > 0) { mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1)); } bytes32 needledata; assembly { needledata := and(mload(needleptr), mask) } ptr = selfptr + selflen - needlelen; bytes32 ptrdata; assembly { ptrdata := and(mload(ptr), mask) } while (ptrdata != needledata) { if (ptr <= selfptr) return selfptr; ptr--; assembly { ptrdata := and(mload(ptr), mask) } } return ptr + needlelen; } else { // For long needles, use hashing bytes32 hash; assembly { hash := keccak256(needleptr, needlelen) } ptr = selfptr + (selflen - needlelen); while (ptr >= selfptr) { bytes32 testHash; assembly { testHash := keccak256(ptr, needlelen) } if (hash == testHash) return ptr + needlelen; ptr -= 1; } } } return selfptr; } /* * @dev Modifies `self` to contain everything from the first occurrence of * `needle` to the end of the slice. `self` is set to the empty slice * if `needle` is not found. * @param self The slice to search and modify. * @param needle The text to search for. * @return `self`. */ function find(slice memory self, slice memory needle) internal pure returns (slice memory) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); self._len -= ptr - self._ptr; self._ptr = ptr; return self; } /* * @dev Modifies `self` to contain the part of the string from the start of * `self` to the end of the first occurrence of `needle`. If `needle` * is not found, `self` is set to the empty slice. * @param self The slice to search and modify. * @param needle The text to search for. * @return `self`. */ function rfind(slice memory self, slice memory needle) internal pure returns (slice memory) { uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); self._len = ptr - self._ptr; return self; } /* * @dev Splits the slice, setting `self` to everything after the first * occurrence of `needle`, and `token` to everything before it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and `token` is set to the entirety of `self`. * @param self The slice to split. * @param needle The text to search for in `self`. * @param token An output parameter to which the first token is written. * @return `token`. */ function split(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = self._ptr; token._len = ptr - self._ptr; if (ptr == self._ptr + self._len) { // Not found self._len = 0; } else { self._len -= token._len + needle._len; self._ptr = ptr + needle._len; } return token; } /* * @dev Splits the slice, setting `self` to everything after the first * occurrence of `needle`, and returning everything before it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and the entirety of `self` is returned. * @param self The slice to split. * @param needle The text to search for in `self`. * @return The part of `self` up to the first occurrence of `delim`. */ function split(slice memory self, slice memory needle) internal pure returns (slice memory token) { split(self, needle, token); } /* * @dev Splits the slice, setting `self` to everything before the last * occurrence of `needle`, and `token` to everything after it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and `token` is set to the entirety of `self`. * @param self The slice to split. * @param needle The text to search for in `self`. * @param token An output parameter to which the first token is written. * @return `token`. */ function rsplit(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) { uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = ptr; token._len = self._len - (ptr - self._ptr); if (ptr == self._ptr) { // Not found self._len = 0; } else { self._len -= token._len + needle._len; } return token; } /* * @dev Splits the slice, setting `self` to everything before the last * occurrence of `needle`, and returning everything after it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and the entirety of `self` is returned. * @param self The slice to split. * @param needle The text to search for in `self`. * @return The part of `self` after the last occurrence of `delim`. */ function rsplit(slice memory self, slice memory needle) internal pure returns (slice memory token) { rsplit(self, needle, token); } /* * @dev Counts the number of nonoverlapping occurrences of `needle` in `self`. * @param self The slice to search. * @param needle The text to search for in `self`. * @return The number of occurrences of `needle` found in `self`. */ function count(slice memory self, slice memory needle) internal pure returns (uint cnt) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len; while (ptr <= self._ptr + self._len) { cnt++; ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len; } } /* * @dev Returns True if `self` contains `needle`. * @param self The slice to search. * @param needle The text to search for in `self`. * @return True if `needle` is found in `self`, false otherwise. */ function contains(slice memory self, slice memory needle) internal pure returns (bool) { return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr; } /* * @dev Returns a newly allocated string containing the concatenation of * `self` and `other`. * @param self The first slice to concatenate. * @param other The second slice to concatenate. * @return The concatenation of the two strings. */ function concat(slice memory self, slice memory other) internal pure returns (string memory) { string memory ret = new string(self._len + other._len); uint retptr; assembly { retptr := add(ret, 32) } memcpy(retptr, self._ptr, self._len); memcpy(retptr + self._len, other._ptr, other._len); return ret; } /* * @dev Joins an array of slices, using `self` as a delimiter, returning a * newly allocated string. * @param self The delimiter to use. * @param parts A list of slices to join. * @return A newly allocated string containing all the slices in `parts`, * joined with `self`. */ function join(slice memory self, slice[] memory parts) internal pure returns (string memory) { if (parts.length == 0) return ""; uint length = self._len * (parts.length - 1); for(uint i = 0; i < parts.length; i++) length += parts[i]._len; string memory ret = new string(length); uint retptr; assembly { retptr := add(ret, 32) } for(uint i = 0; i < parts.length; i++) { memcpy(retptr, parts[i]._ptr, parts[i]._len); retptr += parts[i]._len; if (i < parts.length - 1) { memcpy(retptr, self._ptr, self._len); retptr += self._len; } } return ret; } }
// SPDX-License-Identifier: MIT // ERC721AirdropTarget Contracts v4.0.0 // Creator: Chance Santana-Wees pragma solidity ^0.8.11; import './ERC721A.sol'; import './ERC721AirdropTarget.sol'; import "@openzeppelin/contracts/token/common/ERC2981.sol"; contract Luftballons is ERC721AirdropTarget, ERC2981, ERC721A { IERC721 constant gmDAO = IERC721(0x36F4D96Fe0D4Eb33cdC2dC6C0bCA15b9Cdd0d648); mapping(uint256 => bool) private gmTokenMinted; uint256 private reservedMinted = 0; string private baseURI = "https://luftballons.mypinata.cloud/ipfs/QmXXo2pCyi5GF2fFrbZVUzRHRmDkhR4WQKFwALEmiFrYqB/"; string private _contractURI = "https://luftballons.mypinata.cloud/ipfs/QmdQ71dZRdSdfiwx5tbuH2HKJBd7PEyfkSqzxWRr4fFUNg"; ERC20Spendable public LuftToken; mapping(address => uint256) public customLuftPricePerNFT; mapping(uint256 => uint256) public claimedLuft; uint256 startBlock; uint256 spentLuft; event LuftClaimed(uint256[] tokenIDs, address claimant, uint256 quantityHarvested); event LuftSpent(address collection, address spender, uint256 nftID, uint256 luft, uint256 nftQuantity); constructor() ERC721AirdropTarget() ERC721A("9999 Luftballons", "LUFTBALLONS") { _setDefaultRoyalty(owner(), 1000); _safeMint(owner(), 25); startBlock = block.number; LuftToken = new ERC20Spendable("Luft", "LUFT"); } function _claimableLuft() internal view returns (uint256) { return (block.number - startBlock) * TokensPerblock; } function setCustomNFTPrice(address collection, uint256 tokenPrice) external { require(Ownable(collection).owner() == _msgSender(), "Not Detectable as Collection Owner"); customLuftPricePerNFT[collection] = tokenPrice; } function _beforeHarvestERC721(address collection, uint256 tokenID) internal override { uint256 luftSpent = LuftPerNFT(collection); LuftToken.spend(_msgSender(), luftSpent); emit LuftSpent(collection, _msgSender(), tokenID, luftSpent, 1); } function _beforeHarvestERC1155(address collection, uint256 tokenID, uint256 quantity) internal override { uint256 luftSpent = LuftPerNFT(collection) * quantity; LuftToken.spend(_msgSender(), luftSpent); emit LuftSpent(collection, _msgSender(), tokenID, luftSpent, 1); } function LuftPerNFT(address collection) public view returns (uint256) { if(customLuftPricePerNFT[collection] > 0) return customLuftPricePerNFT[collection]; uint benchmarkBlock = (100*(block.number/100)); if(benchmarkBlock < startBlock) benchmarkBlock = startBlock; uint benchmarkTotal = (benchmarkBlock - startBlock) * TokensPerblock; uint availableTokens = benchmarkTotal - spentLuft; if(availableTokens < 1000 ether) return 1 ether; else if(availableTokens > 100_000 ether) return 100 ether; else return availableTokens / 1000; } function claimableLuft(uint256[] memory tokenIDs) public view returns (uint256) { uint256 claimable = _claimableLuft(); uint256 claimed = 0; for(uint i = 0; i < tokenIDs.length; i++) { claimed += claimable - claimedLuft[tokenIDs[i]]; } return claimed; } function claimLuft(uint256[] memory tokenIDs) public { uint256 claimable = _claimableLuft(); uint256 claimed = 0; for(uint i = 0; i < tokenIDs.length; i++) { require(ownerOf(tokenIDs[i]) == _msgSender(), "Not owner of TokenID"); claimed += claimable - claimedLuft[tokenIDs[i]]; claimedLuft[tokenIDs[i]] = claimable; } emit LuftClaimed(tokenIDs, _msgSender(), claimed); LuftToken.mint(_msgSender(), claimed); } function mint(address to, uint256 quantity) external { require(_numberMinted(_msgSenderERC721A()) + quantity < 3, "Don't be greedy."); require(totalSupply() + quantity < 9000, "Exceeds Unreserved Supply"); require(totalSupply() + quantity < 10000, "Exceeds Max Supply"); _safeMint(to,quantity); } function mint3_gmdao(uint256 gm_tokenID) external { require(!gmTokenMinted[gm_tokenID], "Allocation Minted"); require(reservedMinted < 999, "No more reserved"); require(totalSupply() + 3 < 10000, "Exceeds Max Supply"); address to = gmDAO.ownerOf(gm_tokenID); gmTokenMinted[gm_tokenID] = true; reservedMinted += 3; _safeMint(to,3); } function setContractURI(string memory uri) external onlyOwner { _contractURI = uri; } function setBaseURI(string memory uri) external onlyOwner { baseURI = uri; } function setDefaultRoyalty(uint96 basisPoints) external onlyOwner { _setDefaultRoyalty(owner(), basisPoints); } function contractURI() public view returns (string memory) { return _contractURI; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view override returns (string memory) { return baseURI; } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal pure override returns (uint256) { return 1; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override(ERC721A, ERC721AirdropTarget) returns (address) { return super.ownerOf(tokenId); } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see `_totalMinted`. */ function maxSupply() public pure override(ERC721AirdropTarget) returns (uint256) { return 9999; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721AirdropTarget, ERC2981, ERC721A) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // ERC721AirdropTarget Contracts v4.0.0 // Creator: Chance Santana-Wees pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol"; contract ERC20Spendable is ERC20PresetMinterPauser { constructor(string memory name, string memory symbol) ERC20PresetMinterPauser(name, symbol) {} function spend(address spender, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to spend"); _burn(spender, amount); } }
// SPDX-License-Identifier: MIT // ERC721AirdropTarget Contracts v4.0.0 // Creator: Chance Santana-Wees pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; interface IERC721AirdropTarget is IERC1155Receiver, IERC721Receiver { event ERC20AirdropHarvested(address token, address claimant, uint256[] claimIDs, uint256 totalClaimed); event ERC721AirdropHarvested(address collection, address claimant, uint256 nftID); event ERC1155AirdropHarvested(address collection, address claimant, uint256 nftID, uint256 quantity); function harvestERC721Airdrop(address collection, uint256 tokenID) external; function harvestERC1155Airdrop(address collection, uint256 tokenID, uint quantity) external; function noticeAirdrop(address tokenAddress) external; function pullAirdrop(address tokenAddress, uint256 quantity) external; function claimableAirdrops(address airdropToken, uint256 tokenID) external view returns (uint256); function harvestAirdrops(address[] memory airdropTokens, uint256[] memory tokenIDs) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // ERC721AirdropTarget Contracts v4.0.0 // Creator: Chance Santana-Wees pragma solidity ^0.8.11; import './IERC721AirdropTarget.sol'; import './ERC20Spendable.sol'; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract ERC721AirdropTarget is Ownable, ERC165, IERC721, IERC1155Receiver, IERC721Receiver, IERC721AirdropTarget { uint256 constant TokensPerblock = 1.75e-4 ether; address[] public availableAirdrops; mapping(address => uint256) public airdroppedQuantity; mapping(address => mapping(uint256 => uint256)) public claimedQuantities; mapping(address => uint256) totalClaimed; uint mutex = 1; modifier reentrancyGuard { require(mutex == 1); mutex = 2; _; mutex = 1; } function onERC721Received(address,address,uint256,bytes calldata) public pure returns (bytes4) { return IERC721Receiver.onERC721Received.selector; } function onERC1155Received(address,address,uint256,uint256,bytes calldata) public pure returns (bytes4) { return IERC1155Receiver.onERC1155Received.selector; } function onERC1155BatchReceived(address,address,uint256[] calldata,uint256[] calldata, bytes calldata) public pure returns (bytes4) { return IERC1155Receiver.onERC1155BatchReceived.selector; } function _beforeHarvestERC721(address collection, uint256 tokenID) internal virtual; function _beforeHarvestERC1155(address collection, uint256 tokenID, uint256 quantity) internal virtual; function harvestERC721Airdrop(address collection, uint256 tokenID) external { _beforeHarvestERC721(collection, tokenID); IERC721(collection).safeTransferFrom(address(this), _msgSender(), tokenID); emit ERC721AirdropHarvested(collection, _msgSender(), tokenID); } function harvestERC1155Airdrop(address collection, uint256 tokenID, uint256 quantity) external { _beforeHarvestERC1155(collection, tokenID, quantity); IERC1155(collection).safeTransferFrom(address(this), _msgSender(), tokenID, quantity, ""); emit ERC1155AirdropHarvested(collection, _msgSender(), tokenID, quantity); } function noticeAirdrop(address tokenAddress) external { IERC20 token = IERC20(tokenAddress); uint256 balance = token.balanceOf(address(this)) + totalClaimed[tokenAddress]; if(airdroppedQuantity[tokenAddress] == 0 && balance > 0) { availableAirdrops.push(tokenAddress); } airdroppedQuantity[tokenAddress] = balance; } function pullAirdrop(address tokenAddress, uint256 quantity) external { IERC20 token = IERC20(tokenAddress); token.transferFrom(_msgSender(), address(this), quantity); if(airdroppedQuantity[tokenAddress] == 0) { availableAirdrops.push(tokenAddress); } airdroppedQuantity[tokenAddress] += quantity; } function claimableAirdrops(address airdropToken, uint256 tokenID) public view returns (uint256){ uint256 claimed = claimedQuantities[airdropToken][tokenID]; uint256 claimable = airdroppedQuantity[airdropToken] / maxSupply(); return claimable - claimed; } function harvestAirdrops(address[] memory airdropTokens, uint256[] memory tokenIDs) public reentrancyGuard { uint256 allClaimed = 0; for(uint a = 0; a < airdropTokens.length; a++) { require(airdroppedQuantity[airdropTokens[a]] > 0, "Airdrop not found"); uint totalClaimable; for(uint t = 0; t < tokenIDs.length; t++) { require(ownerOf(tokenIDs[t]) == _msgSender(), "Not owner of TokenID"); uint256 claimable = claimableAirdrops(airdropTokens[a], tokenIDs[t]); if(claimable > 0) { claimedQuantities[airdropTokens[a]][tokenIDs[t]] += claimable; totalClaimed[airdropTokens[a]] += claimable; totalClaimable += claimable; } } IERC20(airdropTokens[a]).transfer(_msgSender(),totalClaimable); allClaimed += totalClaimable; emit ERC20AirdropHarvested(airdropTokens[a], _msgSender(), tokenIDs, totalClaimable); } require(allClaimed > 0, "No tokens harvested"); } function maxSupply() public view virtual returns (uint256); function ownerOf(uint256 tokenId) public view virtual returns (address); /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165,IERC165) returns (bool) { // The interface IDs are constants representing the first 4 bytes of the XOR of // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165 // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)` return interfaceId == type(IERC721AirdropTarget).interfaceId || interfaceId == type(IERC721Receiver).interfaceId || interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.0.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev ERC721 token receiver interface. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Mask of an entry in packed address data. uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225; // The tokenId of the next token to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See `_packedOwnershipOf` implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see `_totalMinted`. */ function totalSupply() public view virtual returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to `_startTokenId()` unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view returns (uint256) { return _burnCounter; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes of the XOR of // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165 // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)` return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (_addressToUint256(owner) == 0) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> BITPOS_AUX); } /** * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; assembly { // Cast aux without masking. auxCasted := aux } packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX); _packedAddressData[owner] = packed; } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & BITMASK_BURNED == 0) { // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. // // We can directly compare the packed value. // If the address is zero, packed is zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP); ownership.burned = packed & BITMASK_BURNED != 0; } /** * Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev Casts the address to uint256 without masking. */ function _addressToUint256(address value) private pure returns (uint256 result) { assembly { result := value } } /** * @dev Casts the boolean to uint256 without branching. */ function _boolToUint256(bool value) private pure returns (uint256 result) { assembly { result := value } } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = address(uint160(_packedOwnershipOf(tokenId))); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSenderERC721A()) revert ApproveToCaller(); _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { _transfer(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned. } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (_addressToUint256(to) == 0) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the balance and number minted. _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _addressToUint256(to) | (block.timestamp << BITPOS_START_TIMESTAMP) | (_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED); uint256 offset; do { emit Transfer(address(0), to, startTokenId + offset++); } while (offset < quantity); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); address approvedAddress = _tokenApprovals[tokenId]; bool isApprovedOrOwner = (_msgSenderERC721A() == from || isApprovedForAll(from, _msgSenderERC721A()) || approvedAddress == _msgSenderERC721A()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (_addressToUint256(to) == 0) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. if (_addressToUint256(approvedAddress) != 0) { delete _tokenApprovals[tokenId]; } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _addressToUint256(to) | (block.timestamp << BITPOS_START_TIMESTAMP) | BITMASK_NEXT_INITIALIZED; // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); address approvedAddress = _tokenApprovals[tokenId]; if (approvalCheck) { bool isApprovedOrOwner = (_msgSenderERC721A() == from || isApprovedForAll(from, _msgSenderERC721A()) || approvedAddress == _msgSenderERC721A()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. if (_addressToUint256(approvedAddress) != 0) { delete _tokenApprovals[tokenId]; } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _addressToUint256(from) | (block.timestamp << BITPOS_START_TIMESTAMP) | BITMASK_BURNED | BITMASK_NEXT_INITIALIZED; // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function _toString(uint256 value) internal pure returns (string memory ptr) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged. // We will need 1 32-byte word to store the length, // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128. ptr := add(mload(0x40), 128) // Update the free memory pointer to allocate. mstore(0x40, ptr) // Cache the end of the memory to calculate the length later. let end := ptr // We write the string from the rightmost digit to the leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // Costs a bit more than early returning for the zero case, // but cheaper in terms of deployment and overall runtime costs. for { // Initialize and perform the first pass without check. let temp := value // Move the pointer 1 byte leftwards to point to an empty character slot. ptr := sub(ptr, 1) // Write the character to the pointer. 48 is the ASCII index of '0'. mstore8(ptr, add(48, mod(temp, 10))) temp := div(temp, 10) } temp { // Keep dividing `temp` until zero. temp := div(temp, 10) } { // Body of the for loop. ptr := sub(ptr, 1) mstore8(ptr, add(48, mod(temp, 10))) } let length := sub(end, ptr) // Move the pointer 32 bytes leftwards to make room for the length. ptr := sub(ptr, 32) // Store the length. mstore(ptr, length) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../extensions/ERC20Burnable.sol"; import "../extensions/ERC20Pausable.sol"; import "../../../access/AccessControlEnumerable.sol"; import "../../../utils/Context.sol"; /** * @dev {ERC20} token, including: * * - ability for holders to burn (destroy) their tokens * - a minter role that allows for token minting (creation) * - a pauser role that allows to stop all token transfers * * This contract uses {AccessControl} to lock permissioned functions using the * different roles - head to its documentation for details. * * The account that deploys the contract will be granted the minter and pauser * roles, as well as the default admin role, which will let it grant both minter * and pauser roles to other accounts. * * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._ */ contract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the * account that deploys the contract. * * See {ERC20-constructor}. */ constructor(string memory name, string memory symbol) ERC20(name, symbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); } /** * @dev Creates `amount` new tokens for `to`. * * See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); _mint(to, amount); } /** * @dev Pauses all token transfers. * * See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause"); _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC20Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause"); _unpause(); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.0.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; /** * @dev Interface of an ERC721A compliant contract. */ interface IERC721A is IERC721 { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } /** * @dev Returns the total amount of tokens stored by the contract. * * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens. */ function totalSupply() external view returns (uint256); // ============================== // 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); // ============================== // IERC721 // ============================== /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================== // IERC721Metadata // ============================== /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../security/Pausable.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"luftballons","type":"address"},{"internalType":"uint256","name":"burn","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"token_wrapped_1155","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"token_wrapped_721","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"wrapper_id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"tokens","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"balance","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"base_collection","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burn_cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IToken","name":"token_","type":"address"}],"name":"forwardAirdroppedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"operator","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luft_ballons","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"noticeERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"noticeERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"token_to_wrapper","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"total_quantity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"wrapped_quantity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"wrapped_token","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c060405260016006553480156200001657600080fd5b5060405162002cc138038062002cc18339810160408190526200003991620000ab565b62000044336200005b565b6001600160a01b0390911660805260a052620000e7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060408385031215620000bf57600080fd5b82516001600160a01b0381168114620000d757600080fd5b6020939093015192949293505050565b60805160a051612b676200015a600039600081816102e6015281816105ed0152610d730152600081816103a1015281816104fd01528181610b2c01528181610c2f01528181610d080152818161121b01528181611245015281816114750152818161151f0152611a1b0152612b676000f3fe608060405234801561001057600080fd5b50600436106101ef5760003560e01c8063715018a61161010f578063c0df7333116100a2578063f242432a11610071578063f242432a14610497578063f2fde38b146104aa578063f6ecaa96146104bd578063fe99049a146104e657600080fd5b8063c0df733314610430578063c87b56dd1461045b578063e985e9c51461046e578063f23a6e611461048457600080fd5b806395d89b41116100de57806395d89b41146103e7578063a22cb465146103ef578063a3333c5a146103fd578063bc197c811461041d57600080fd5b8063715018a61461039457806371512b1f1461039c57806389448276146103c35780638da5cb5b146103d657600080fd5b8063150b7a021161018757806342a73e281161015657806342a73e281461032e57806347330f29146103415780634e1273f4146103615780636352211e1461038157600080fd5b8063150b7a02146102c157806322374b61146102e157806322c41d70146103085780632eb2c2d61461031b57600080fd5b8063081812fc116101c3578063081812fc1461025b578063095ea7b3146102875780630e89341c1461029b5780630febdd49146102ae57600080fd5b8062fdd58e146101f457806301ffc9a71461021a57806305b1d4351461023d57806306fdde0314610246575b600080fd5b610207610202366004612130565b6104f9565b6040519081526020015b60405180910390f35b61022d610228366004612172565b610553565b6040519015158152602001610211565b61020760055481565b61024e6105da565b60405161021191906121bb565b61026f6102693660046121ee565b50600090565b6040516001600160a01b039091168152602001610211565b610299610295366004612130565b5050565b005b61024e6102a93660046121ee565b61063a565b6102996102bc366004612207565b610645565b6102d46102cf366004612295565b610657565b6040516102119190612307565b6102077f000000000000000000000000000000000000000000000000000000000000000081565b610299610316366004612130565b610779565b6102996103293660046123d6565b6108c3565b61029961033c366004612130565b610903565b61020761034f3660046121ee565b60026020526000908152604090205481565b61037461036f3660046124cd565b610a7e565b6040516102119190612535565b61026f61038f3660046121ee565b610b0c565b610299610b50565b61026f7f000000000000000000000000000000000000000000000000000000000000000081565b6102996103d1366004612579565b610b64565b6000546001600160a01b031661026f565b61024e610d60565b6102996102953660046125a4565b61020761040b3660046121ee565b60036020526000908152604090205481565b6102d461042b3660046125dd565b610da7565b61020761043e366004612130565b600460209081526000928352604080842090915290825290205481565b61024e6104693660046121ee565b610de2565b61022d61047c36600461269b565b600092915050565b6102d46104923660046126c9565b611065565b6102996104a53660046126c9565b61118b565b6102996104b8366004612579565b611197565b61026f6104cb3660046121ee565b6001602052600090815260409020546001600160a01b031681565b6102996104f4366004612207565b611210565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603610549575060008181526003602052604090205461054d565b5060005b92915050565b60006301ffc9a760e01b6001600160e01b03198316148061058457506001600160e01b03198216636cdb3d1360e11b145b8061059f57506001600160e01b031982166303a24d0760e21b145b806105ba57506001600160e01b03198216630271189760e51b145b8061054d57506001600160e01b03198216630a85bd0160e11b1492915050565b6060610616610611670de0b6b3a76400007f000000000000000000000000000000000000000000000000000000000000000061275e565b6112a6565b6040516020016106269190612772565b604051602081830303815290604052905090565b606061054d82610de2565b61065184848484611210565b50505050565b6040516301ffc9a760e01b815260009033906301ffc9a790610684906380ac58cd60e01b90600401612307565b602060405180830381865afa1580156106a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c591906127bd565b6107215760405162461bcd60e51b815260206004820152602260248201527f53656e646572206e6f742076616c69642045524337323120436f6c6c6563746960448201526137b760f11b60648201526084015b60405180910390fd5b61072d338560016113a6565b5060408051338152602081018690527fd8849998bc25e191ab728e8e2422e27bfb61ae02db1e46cfb7f14034ba1e8442910160405180910390a150630a85bd0160e11b95945050505050565b6001600160a01b03821660008181526004602081815260408084208685528252808420548085526003909252808420549051627eeac760e11b81523093810193909352602483018690529093909162fdd58e90604401602060405180830381865afa1580156107ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081091906127da565b61081a91906127f3565b90508115806108295750600081115b6108675760405162461bcd60e51b815260206004820152600f60248201526e04e6f7468696e6720746f205772617608c1b6044820152606401610718565b6108728484836113a6565b50604080516001600160a01b0386168152602081018590529081018290527f211299555bcc377f276054ce2fdc7521661a98f166120ed0baa706d436e743799060600160405180910390a150505050565b60405162461bcd60e51b815260206004820152600d60248201526c139bdd0814dd5c1c1bdc9d1959609a1b6044820152606401610718565b505050505050565b6001600160a01b03821660009081526004602090815260408083208484529091529020548015806109405750600081815260036020526040902054155b61097e5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4815dc985c1c1959608a1b6044820152606401610718565b6040516331a9108f60e11b81526004810183905230906001600160a01b03851690636352211e90602401602060405180830381865afa1580156109c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e9919061280a565b6001600160a01b031614610a2a5760405162461bcd60e51b81526020600482015260086024820152674e6f74204d696e6560c01b6044820152606401610718565b610a36838360016113a6565b50604080516001600160a01b0385168152602081018490527fd8849998bc25e191ab728e8e2422e27bfb61ae02db1e46cfb7f14034ba1e8442910160405180910390a1505050565b606060005b83811015610b0357610ad4858583818110610aa057610aa0612827565b9050602002016020810190610ab59190612579565b848381518110610ac757610ac7612827565b60200260200101516104f9565b838281518110610ae657610ae6612827565b602090810291909101015280610afb8161283d565b915050610a83565b50909392505050565b6000818152600360205260408120548103610b2957506000919050565b507f0000000000000000000000000000000000000000000000000000000000000000919050565b610b586115e2565b610b62600061163c565b565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a08231906024016020604051808303816000875af1158015610bad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd191906127da565b905060008111610c185760405162461bcd60e51b8152602060048201526012602482015271139bc8151bdad95b9cc811195d1958dd195960721b6044820152606401610718565b60405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820183905283169063a9059cbb906044016020604051808303816000875af1158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab91906127bd565b610ce95760405162461bcd60e51b815260206004820152600f60248201526e2330b4b632b2102a3930b739b332b960891b6044820152606401610718565b604051631568f81560e21b81526001600160a01b0383811660048301527f000000000000000000000000000000000000000000000000000000000000000016906355a3e05490602401600060405180830381600087803b158015610d4c57600080fd5b505af11580156108fb573d6000803e3d6000fd5b6060610d97610611670de0b6b3a76400007f000000000000000000000000000000000000000000000000000000000000000061275e565b6040516020016106269190612856565b60405162461bcd60e51b815260206004820152600d60248201526c139bdd0814dd5c1c1bdc9d1959609a1b6044820152600090606401610718565b6000818152600160205260409020546060906001600160a01b031680610e0757600080fd5b600083815260026020526040908190205490516301ffc9a760e01b81526001600160a01b038316906301ffc9a790610e4a90636cdb3d1360e11b90600401612307565b602060405180830381865afa158015610e67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8b91906127bd565b15610fe9576040516303a24d0760e21b815260048101829052600090610f31906001600160a01b03851690630e89341c90602401600060405180830381865afa158015610edc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f049190810190612885565b60408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b60408051808201825260048152637b69647d60e01b60208083019182528351808501855260008082529082015283518085019094529151835290820152909150610f7b828261168c565b15610fd6576000610f8c83836116b3565b9050610f97816116d9565b610fa085611741565b610fa9856116d9565b604051602001610fbb93929190612918565b60405160208183030381529060405295505050505050919050565b610fdf826116d9565b9695505050505050565b60405163c87b56dd60e01b8152600481018290526001600160a01b0383169063c87b56dd90602401600060405180830381865afa15801561102e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110569190810190612885565b949350505050565b5050919050565b6040516301ffc9a760e01b815260009033906301ffc9a79061109290636cdb3d1360e11b90600401612307565b602060405180830381865afa1580156110af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d391906127bd565b61112b5760405162461bcd60e51b815260206004820152602360248201527f53656e646572206e6f742076616c6964204552433131353520436f6c6c65637460448201526234b7b760e91b6064820152608401610718565b6111363386866113a6565b5060408051338152602081018790529081018590527f211299555bcc377f276054ce2fdc7521661a98f166120ed0baa706d436e743799060600160405180910390a15063f23a6e6160e01b9695505050505050565b6108fb86868686610645565b61119f6115e2565b6001600160a01b0381166112045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610718565b61120d8161163c565b50565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561127957507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316145b8015611292575060008281526003602052604090205415155b61129b57600080fd5b610651838383611834565b6060816000036112cd5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156112f757806112e18161283d565b91506112f09050600a8361275e565b91506112d1565b6000816001600160401b038111156113115761131161231c565b6040519080825280601f01601f19166020018201604052801561133b576020820181803683370190505b5090505b8415611056576113506001836127f3565b915061135d600a8661295b565b61136890603061296f565b60f81b81838151811061137d5761137d612827565b60200101906001600160f81b031916908160001a90535061139f600a8661275e565b945061133f565b6001600160a01b0383166000908152600460209081526040808320858452909152812054810361143757506006805490819060006113e38361283d565b90915550506001600160a01b038416600081815260046020908152604080832087845282528083208590558483526001825280832080546001600160a01b031916909417909355600290522083905561145d565b506001600160a01b03831660009081526004602090815260408083208584529091529020545b60408051828152602081018490526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116929087169130917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4807f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b6114f38361063a565b60405161150091906121bb565b60405180910390a260405163f23a6e6160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f23a6e619061155a908790819086908890600401612987565b6020604051808303816000875af1158015611579573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159d91906129bf565b50600081815260036020526040812080548492906115bc90849061296f565b9250508190555081600560008282546115d5919061296f565b9091555090949350505050565b6000546001600160a01b03163314610b625760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610718565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60208083015183518351928401516000936116aa9291849190611a76565b14159392505050565b60408051808201909152600080825260208201526116d2838383611b87565b5092915050565b6060600082600001516001600160401b038111156116f9576116f961231c565b6040519080825280601f01601f191660200182016040528015611723576020820181803683370190505b50905060006020820190506116d28185602001518660000151611c31565b60606000611751610f0484611cab565b6040805180820182526002815261060f60f31b6020808301918252835180850185526000808252908201528351808501909452915183529082015290915061179a908290611d02565b905060006117a782611d87565b6117b29060026129dc565b6117bd9060806127f3565b6001600160401b038111156117d4576117d461231c565b6040519080825280601f01601f1916602001820160405280156117fe576020820181803683370190505b5090508061180b836116d9565b60405160200161181c9291906129fb565b60405160208183030381529060405292505050919050565b600082815260016020526040908190205490516301ffc9a760e01b81526001600160a01b03909116906301ffc9a79061187890636cdb3d1360e11b90600401612307565b602060405180830381865afa158015611895573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b991906127bd565b1561194257600082815260016020908152604080832054600290925291829020549151637921219560e11b81526001600160a01b039091169163f242432a9161190b9130918891908790600401612987565b600060405180830381600087803b15801561192557600080fd5b505af1158015611939573d6000803e3d6000fd5b505050506119d4565b6000828152600160209081526040808320546002909252808320549051635c46a7ef60e11b81523060048201526001600160a01b0387811660248301526044820192909252608060648201526084810193909352169063b88d4fde9060a401600060405180830381600087803b1580156119bb57600080fd5b505af11580156119cf573d6000803e3d6000fd5b505050505b60008281526003602052604081208054916119ee83612a2a565b909155505060058054906000611a0383612a2a565b909155505060408051838152602081018390526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169130917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4505050565b600080858411611b7d5760208411611b295760008415611ac1576001611a9d8660206127f3565b611aa89060086129dc565b611ab3906002612b25565b611abd91906127f3565b1990505b8351811685611ad0898961296f565b611ada91906127f3565b805190935082165b818114611b1457878411611afc5787945050505050611056565b83611b0681612a2a565b945050828451169050611ae2565b611b1e878561296f565b945050505050611056565b838320611b3685886127f3565b611b40908761296f565b91505b858210611b7b57848220808203611b6857611b5e868461296f565b9350505050611056565b611b736001846127f3565b925050611b43565b505b5092949350505050565b60408051808201909152600080825260208201526000611bb98560000151866020015186600001518760200151611e59565b602080870180519186019190915251909150611bd590826127f3565b835284516020860151611be8919061296f565b8103611bf75760008552610b03565b83518351611c05919061296f565b85518690611c149083906127f3565b9052508351611c23908261296f565b602086015250909392505050565b60208110611c695781518352611c4860208461296f565b9250611c5560208361296f565b9150611c626020826127f3565b9050611c31565b6000198115611c98576001611c7f8360206127f3565b611c8b90610100612b25565b611c9591906127f3565b90505b9151835183169219169190911790915250565b606081600003611cd55750506040805180820190915260048152630307830360e41b602082015290565b8160005b8115611cf85780611ce98161283d565b915050600882901c9150611cd9565b6110568482611f79565b6040805180820190915260008082526020820152815183511015611d2757508161054d565b6020808301519084015160019114611d4e5750815160208481015190840151829020919020145b8015611d7f57825184518590611d659083906127f3565b9052508251602085018051611d7b90839061296f565b9052505b509192915050565b600080601f8360200151611d9b91906127f3565b8351909150600090611dad908361296f565b9050600092505b8082101561105e57815160ff166080811015611ddc57611dd560018461296f565b9250611e46565b60e08160ff161015611df357611dd560028461296f565b60f08160ff161015611e0a57611dd560038461296f565b60f88160ff161015611e2157611dd560048461296f565b60fc8160ff161015611e3857611dd560058461296f565b611e4360068461296f565b92505b5082611e518161283d565b935050611db4565b60008381868511611f645760208511611f135760008515611ea5576001611e818760206127f3565b611e8c9060086129dc565b611e97906002612b25565b611ea191906127f3565b1990505b84518116600087611eb68b8b61296f565b611ec091906127f3565b855190915083165b828114611f0557818610611eed57611ee08b8b61296f565b9650505050505050611056565b85611ef78161283d565b965050838651169050611ec8565b859650505050505050611056565b508383206000905b611f2586896127f3565b8211611f6257858320808203611f415783945050505050611056565b611f4c60018561296f565b9350508180611f5a9061283d565b925050611f1b565b505b611f6e878761296f565b979650505050505050565b60606000611f888360026129dc565b611f9390600261296f565b6001600160401b03811115611faa57611faa61231c565b6040519080825280601f01601f191660200182016040528015611fd4576020820181803683370190505b509050600360fc1b81600081518110611fef57611fef612827565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061201e5761201e612827565b60200101906001600160f81b031916908160001a90535060006120428460026129dc565b61204d90600161296f565b90505b60018111156120c5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061208157612081612827565b1a60f81b82828151811061209757612097612827565b60200101906001600160f81b031916908160001a90535060049490941c936120be81612a2a565b9050612050565b5083156121145760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610718565b9392505050565b6001600160a01b038116811461120d57600080fd5b6000806040838503121561214357600080fd5b823561214e8161211b565b946020939093013593505050565b6001600160e01b03198116811461120d57600080fd5b60006020828403121561218457600080fd5b81356121148161215c565b60005b838110156121aa578181015183820152602001612192565b838111156106515750506000910152565b60208152600082518060208401526121da81604085016020870161218f565b601f01601f19169190910160400192915050565b60006020828403121561220057600080fd5b5035919050565b6000806000806080858703121561221d57600080fd5b84356122288161211b565b935060208501356122388161211b565b93969395505050506040820135916060013590565b60008083601f84011261225f57600080fd5b5081356001600160401b0381111561227657600080fd5b60208301915083602082850101111561228e57600080fd5b9250929050565b6000806000806000608086880312156122ad57600080fd5b85356122b88161211b565b945060208601356122c88161211b565b93506040860135925060608601356001600160401b038111156122ea57600080fd5b6122f68882890161224d565b969995985093965092949392505050565b6001600160e01b031991909116815260200190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561235a5761235a61231c565b604052919050565b600082601f83011261237357600080fd5b813560206001600160401b0382111561238e5761238e61231c565b8160051b61239d828201612332565b92835284810182019282810190878511156123b757600080fd5b83870192505b84831015611f6e578235825291830191908301906123bd565b60008060008060008060a087890312156123ef57600080fd5b86356123fa8161211b565b9550602087013561240a8161211b565b945060408701356001600160401b038082111561242657600080fd5b6124328a838b01612362565b9550606089013591508082111561244857600080fd5b6124548a838b01612362565b9450608089013591508082111561246a57600080fd5b5061247789828a0161224d565b979a9699509497509295939492505050565b60008083601f84011261249b57600080fd5b5081356001600160401b038111156124b257600080fd5b6020830191508360208260051b850101111561228e57600080fd5b6000806000604084860312156124e257600080fd5b83356001600160401b03808211156124f957600080fd5b61250587838801612489565b9095509350602086013591508082111561251e57600080fd5b5061252b86828701612362565b9150509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561256d57835183529284019291840191600101612551565b50909695505050505050565b60006020828403121561258b57600080fd5b81356121148161211b565b801515811461120d57600080fd5b600080604083850312156125b757600080fd5b82356125c28161211b565b915060208301356125d281612596565b809150509250929050565b60008060008060008060008060a0898b0312156125f957600080fd5b88356126048161211b565b975060208901356126148161211b565b965060408901356001600160401b038082111561263057600080fd5b61263c8c838d01612489565b909850965060608b013591508082111561265557600080fd5b6126618c838d01612489565b909650945060808b013591508082111561267a57600080fd5b506126878b828c0161224d565b999c989b5096995094979396929594505050565b600080604083850312156126ae57600080fd5b82356126b98161211b565b915060208301356125d28161211b565b60008060008060008060a087890312156126e257600080fd5b86356126ed8161211b565b955060208701356126fd8161211b565b9450604087013593506060870135925060808701356001600160401b0381111561272657600080fd5b61247789828a0161224d565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008261276d5761276d612732565b500490565b720263ab33a2bb930b83832b21027232a3990169606d1b8152600082516127a081601385016020870161218f565b6508091315519560d21b6013939091019283015250601901919050565b6000602082840312156127cf57600080fd5b815161211481612596565b6000602082840312156127ec57600080fd5b5051919050565b60008282101561280557612805612748565b500390565b60006020828403121561281c57600080fd5b81516121148161211b565b634e487b7160e01b600052603260045260246000fd5b60006001820161284f5761284f612748565b5060010190565b664c46545752505f60c81b81526000825161287881600785016020870161218f565b9190910160070192915050565b60006020828403121561289757600080fd5b81516001600160401b03808211156128ae57600080fd5b818401915084601f8301126128c257600080fd5b8151818111156128d4576128d461231c565b6128e7601f8201601f1916602001612332565b91508082528560208285010111156128fe57600080fd5b61290f81602084016020860161218f565b50949350505050565b6000845161292a81846020890161218f565b84519083019061293e81836020890161218f565b845191019061295181836020880161218f565b0195945050505050565b60008261296a5761296a612732565b500690565b6000821982111561298257612982612748565b500190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b6000602082840312156129d157600080fd5b81516121148161215c565b60008160001904831182151516156129f6576129f6612748565b500290565b60008351612a0d81846020880161218f565b835190830190612a2181836020880161218f565b01949350505050565b600081612a3957612a39612748565b506000190190565b600181815b80851115612a7c578160001904821115612a6257612a62612748565b80851615612a6f57918102915b93841c9390800290612a46565b509250929050565b600082612a935750600161054d565b81612aa05750600061054d565b8160018114612ab65760028114612ac057612adc565b600191505061054d565b60ff841115612ad157612ad1612748565b50506001821b61054d565b5060208310610133831016604e8410600b8410161715612aff575081810a61054d565b612b098383612a41565b8060001904821115612b1d57612b1d612748565b029392505050565b60006121148383612a8456fea2646970667358221220e7dbb5d0205fc148f19e6d1b100fcea638a95e304c2ec0404c0b76fa720d226864736f6c634300080f0033000000000000000000000000356e1363897033759181727e4bff12396c51a7e000000000000000000000000000000000000000000000001b1ae4d6e2ef500000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101ef5760003560e01c8063715018a61161010f578063c0df7333116100a2578063f242432a11610071578063f242432a14610497578063f2fde38b146104aa578063f6ecaa96146104bd578063fe99049a146104e657600080fd5b8063c0df733314610430578063c87b56dd1461045b578063e985e9c51461046e578063f23a6e611461048457600080fd5b806395d89b41116100de57806395d89b41146103e7578063a22cb465146103ef578063a3333c5a146103fd578063bc197c811461041d57600080fd5b8063715018a61461039457806371512b1f1461039c57806389448276146103c35780638da5cb5b146103d657600080fd5b8063150b7a021161018757806342a73e281161015657806342a73e281461032e57806347330f29146103415780634e1273f4146103615780636352211e1461038157600080fd5b8063150b7a02146102c157806322374b61146102e157806322c41d70146103085780632eb2c2d61461031b57600080fd5b8063081812fc116101c3578063081812fc1461025b578063095ea7b3146102875780630e89341c1461029b5780630febdd49146102ae57600080fd5b8062fdd58e146101f457806301ffc9a71461021a57806305b1d4351461023d57806306fdde0314610246575b600080fd5b610207610202366004612130565b6104f9565b6040519081526020015b60405180910390f35b61022d610228366004612172565b610553565b6040519015158152602001610211565b61020760055481565b61024e6105da565b60405161021191906121bb565b61026f6102693660046121ee565b50600090565b6040516001600160a01b039091168152602001610211565b610299610295366004612130565b5050565b005b61024e6102a93660046121ee565b61063a565b6102996102bc366004612207565b610645565b6102d46102cf366004612295565b610657565b6040516102119190612307565b6102077f00000000000000000000000000000000000000000000001b1ae4d6e2ef50000081565b610299610316366004612130565b610779565b6102996103293660046123d6565b6108c3565b61029961033c366004612130565b610903565b61020761034f3660046121ee565b60026020526000908152604090205481565b61037461036f3660046124cd565b610a7e565b6040516102119190612535565b61026f61038f3660046121ee565b610b0c565b610299610b50565b61026f7f000000000000000000000000356e1363897033759181727e4bff12396c51a7e081565b6102996103d1366004612579565b610b64565b6000546001600160a01b031661026f565b61024e610d60565b6102996102953660046125a4565b61020761040b3660046121ee565b60036020526000908152604090205481565b6102d461042b3660046125dd565b610da7565b61020761043e366004612130565b600460209081526000928352604080842090915290825290205481565b61024e6104693660046121ee565b610de2565b61022d61047c36600461269b565b600092915050565b6102d46104923660046126c9565b611065565b6102996104a53660046126c9565b61118b565b6102996104b8366004612579565b611197565b61026f6104cb3660046121ee565b6001602052600090815260409020546001600160a01b031681565b6102996104f4366004612207565b611210565b60007f000000000000000000000000356e1363897033759181727e4bff12396c51a7e06001600160a01b0316836001600160a01b031603610549575060008181526003602052604090205461054d565b5060005b92915050565b60006301ffc9a760e01b6001600160e01b03198316148061058457506001600160e01b03198216636cdb3d1360e11b145b8061059f57506001600160e01b031982166303a24d0760e21b145b806105ba57506001600160e01b03198216630271189760e51b145b8061054d57506001600160e01b03198216630a85bd0160e11b1492915050565b6060610616610611670de0b6b3a76400007f00000000000000000000000000000000000000000000001b1ae4d6e2ef50000061275e565b6112a6565b6040516020016106269190612772565b604051602081830303815290604052905090565b606061054d82610de2565b61065184848484611210565b50505050565b6040516301ffc9a760e01b815260009033906301ffc9a790610684906380ac58cd60e01b90600401612307565b602060405180830381865afa1580156106a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c591906127bd565b6107215760405162461bcd60e51b815260206004820152602260248201527f53656e646572206e6f742076616c69642045524337323120436f6c6c6563746960448201526137b760f11b60648201526084015b60405180910390fd5b61072d338560016113a6565b5060408051338152602081018690527fd8849998bc25e191ab728e8e2422e27bfb61ae02db1e46cfb7f14034ba1e8442910160405180910390a150630a85bd0160e11b95945050505050565b6001600160a01b03821660008181526004602081815260408084208685528252808420548085526003909252808420549051627eeac760e11b81523093810193909352602483018690529093909162fdd58e90604401602060405180830381865afa1580156107ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081091906127da565b61081a91906127f3565b90508115806108295750600081115b6108675760405162461bcd60e51b815260206004820152600f60248201526e04e6f7468696e6720746f205772617608c1b6044820152606401610718565b6108728484836113a6565b50604080516001600160a01b0386168152602081018590529081018290527f211299555bcc377f276054ce2fdc7521661a98f166120ed0baa706d436e743799060600160405180910390a150505050565b60405162461bcd60e51b815260206004820152600d60248201526c139bdd0814dd5c1c1bdc9d1959609a1b6044820152606401610718565b505050505050565b6001600160a01b03821660009081526004602090815260408083208484529091529020548015806109405750600081815260036020526040902054155b61097e5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4815dc985c1c1959608a1b6044820152606401610718565b6040516331a9108f60e11b81526004810183905230906001600160a01b03851690636352211e90602401602060405180830381865afa1580156109c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e9919061280a565b6001600160a01b031614610a2a5760405162461bcd60e51b81526020600482015260086024820152674e6f74204d696e6560c01b6044820152606401610718565b610a36838360016113a6565b50604080516001600160a01b0385168152602081018490527fd8849998bc25e191ab728e8e2422e27bfb61ae02db1e46cfb7f14034ba1e8442910160405180910390a1505050565b606060005b83811015610b0357610ad4858583818110610aa057610aa0612827565b9050602002016020810190610ab59190612579565b848381518110610ac757610ac7612827565b60200260200101516104f9565b838281518110610ae657610ae6612827565b602090810291909101015280610afb8161283d565b915050610a83565b50909392505050565b6000818152600360205260408120548103610b2957506000919050565b507f000000000000000000000000356e1363897033759181727e4bff12396c51a7e0919050565b610b586115e2565b610b62600061163c565b565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a08231906024016020604051808303816000875af1158015610bad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd191906127da565b905060008111610c185760405162461bcd60e51b8152602060048201526012602482015271139bc8151bdad95b9cc811195d1958dd195960721b6044820152606401610718565b60405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000356e1363897033759181727e4bff12396c51a7e0811660048301526024820183905283169063a9059cbb906044016020604051808303816000875af1158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab91906127bd565b610ce95760405162461bcd60e51b815260206004820152600f60248201526e2330b4b632b2102a3930b739b332b960891b6044820152606401610718565b604051631568f81560e21b81526001600160a01b0383811660048301527f000000000000000000000000356e1363897033759181727e4bff12396c51a7e016906355a3e05490602401600060405180830381600087803b158015610d4c57600080fd5b505af11580156108fb573d6000803e3d6000fd5b6060610d97610611670de0b6b3a76400007f00000000000000000000000000000000000000000000001b1ae4d6e2ef50000061275e565b6040516020016106269190612856565b60405162461bcd60e51b815260206004820152600d60248201526c139bdd0814dd5c1c1bdc9d1959609a1b6044820152600090606401610718565b6000818152600160205260409020546060906001600160a01b031680610e0757600080fd5b600083815260026020526040908190205490516301ffc9a760e01b81526001600160a01b038316906301ffc9a790610e4a90636cdb3d1360e11b90600401612307565b602060405180830381865afa158015610e67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8b91906127bd565b15610fe9576040516303a24d0760e21b815260048101829052600090610f31906001600160a01b03851690630e89341c90602401600060405180830381865afa158015610edc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f049190810190612885565b60408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b60408051808201825260048152637b69647d60e01b60208083019182528351808501855260008082529082015283518085019094529151835290820152909150610f7b828261168c565b15610fd6576000610f8c83836116b3565b9050610f97816116d9565b610fa085611741565b610fa9856116d9565b604051602001610fbb93929190612918565b60405160208183030381529060405295505050505050919050565b610fdf826116d9565b9695505050505050565b60405163c87b56dd60e01b8152600481018290526001600160a01b0383169063c87b56dd90602401600060405180830381865afa15801561102e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110569190810190612885565b949350505050565b5050919050565b6040516301ffc9a760e01b815260009033906301ffc9a79061109290636cdb3d1360e11b90600401612307565b602060405180830381865afa1580156110af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d391906127bd565b61112b5760405162461bcd60e51b815260206004820152602360248201527f53656e646572206e6f742076616c6964204552433131353520436f6c6c65637460448201526234b7b760e91b6064820152608401610718565b6111363386866113a6565b5060408051338152602081018790529081018590527f211299555bcc377f276054ce2fdc7521661a98f166120ed0baa706d436e743799060600160405180910390a15063f23a6e6160e01b9695505050505050565b6108fb86868686610645565b61119f6115e2565b6001600160a01b0381166112045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610718565b61120d8161163c565b50565b336001600160a01b037f000000000000000000000000356e1363897033759181727e4bff12396c51a7e01614801561127957507f000000000000000000000000356e1363897033759181727e4bff12396c51a7e06001600160a01b0316846001600160a01b0316145b8015611292575060008281526003602052604090205415155b61129b57600080fd5b610651838383611834565b6060816000036112cd5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156112f757806112e18161283d565b91506112f09050600a8361275e565b91506112d1565b6000816001600160401b038111156113115761131161231c565b6040519080825280601f01601f19166020018201604052801561133b576020820181803683370190505b5090505b8415611056576113506001836127f3565b915061135d600a8661295b565b61136890603061296f565b60f81b81838151811061137d5761137d612827565b60200101906001600160f81b031916908160001a90535061139f600a8661275e565b945061133f565b6001600160a01b0383166000908152600460209081526040808320858452909152812054810361143757506006805490819060006113e38361283d565b90915550506001600160a01b038416600081815260046020908152604080832087845282528083208590558483526001825280832080546001600160a01b031916909417909355600290522083905561145d565b506001600160a01b03831660009081526004602090815260408083208584529091529020545b60408051828152602081018490526001600160a01b037f000000000000000000000000356e1363897033759181727e4bff12396c51a7e08116929087169130917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4807f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b6114f38361063a565b60405161150091906121bb565b60405180910390a260405163f23a6e6160e01b81526001600160a01b037f000000000000000000000000356e1363897033759181727e4bff12396c51a7e0169063f23a6e619061155a908790819086908890600401612987565b6020604051808303816000875af1158015611579573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159d91906129bf565b50600081815260036020526040812080548492906115bc90849061296f565b9250508190555081600560008282546115d5919061296f565b9091555090949350505050565b6000546001600160a01b03163314610b625760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610718565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60208083015183518351928401516000936116aa9291849190611a76565b14159392505050565b60408051808201909152600080825260208201526116d2838383611b87565b5092915050565b6060600082600001516001600160401b038111156116f9576116f961231c565b6040519080825280601f01601f191660200182016040528015611723576020820181803683370190505b50905060006020820190506116d28185602001518660000151611c31565b60606000611751610f0484611cab565b6040805180820182526002815261060f60f31b6020808301918252835180850185526000808252908201528351808501909452915183529082015290915061179a908290611d02565b905060006117a782611d87565b6117b29060026129dc565b6117bd9060806127f3565b6001600160401b038111156117d4576117d461231c565b6040519080825280601f01601f1916602001820160405280156117fe576020820181803683370190505b5090508061180b836116d9565b60405160200161181c9291906129fb565b60405160208183030381529060405292505050919050565b600082815260016020526040908190205490516301ffc9a760e01b81526001600160a01b03909116906301ffc9a79061187890636cdb3d1360e11b90600401612307565b602060405180830381865afa158015611895573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b991906127bd565b1561194257600082815260016020908152604080832054600290925291829020549151637921219560e11b81526001600160a01b039091169163f242432a9161190b9130918891908790600401612987565b600060405180830381600087803b15801561192557600080fd5b505af1158015611939573d6000803e3d6000fd5b505050506119d4565b6000828152600160209081526040808320546002909252808320549051635c46a7ef60e11b81523060048201526001600160a01b0387811660248301526044820192909252608060648201526084810193909352169063b88d4fde9060a401600060405180830381600087803b1580156119bb57600080fd5b505af11580156119cf573d6000803e3d6000fd5b505050505b60008281526003602052604081208054916119ee83612a2a565b909155505060058054906000611a0383612a2a565b909155505060408051838152602081018390526000917f000000000000000000000000356e1363897033759181727e4bff12396c51a7e06001600160a01b03169130917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4505050565b600080858411611b7d5760208411611b295760008415611ac1576001611a9d8660206127f3565b611aa89060086129dc565b611ab3906002612b25565b611abd91906127f3565b1990505b8351811685611ad0898961296f565b611ada91906127f3565b805190935082165b818114611b1457878411611afc5787945050505050611056565b83611b0681612a2a565b945050828451169050611ae2565b611b1e878561296f565b945050505050611056565b838320611b3685886127f3565b611b40908761296f565b91505b858210611b7b57848220808203611b6857611b5e868461296f565b9350505050611056565b611b736001846127f3565b925050611b43565b505b5092949350505050565b60408051808201909152600080825260208201526000611bb98560000151866020015186600001518760200151611e59565b602080870180519186019190915251909150611bd590826127f3565b835284516020860151611be8919061296f565b8103611bf75760008552610b03565b83518351611c05919061296f565b85518690611c149083906127f3565b9052508351611c23908261296f565b602086015250909392505050565b60208110611c695781518352611c4860208461296f565b9250611c5560208361296f565b9150611c626020826127f3565b9050611c31565b6000198115611c98576001611c7f8360206127f3565b611c8b90610100612b25565b611c9591906127f3565b90505b9151835183169219169190911790915250565b606081600003611cd55750506040805180820190915260048152630307830360e41b602082015290565b8160005b8115611cf85780611ce98161283d565b915050600882901c9150611cd9565b6110568482611f79565b6040805180820190915260008082526020820152815183511015611d2757508161054d565b6020808301519084015160019114611d4e5750815160208481015190840151829020919020145b8015611d7f57825184518590611d659083906127f3565b9052508251602085018051611d7b90839061296f565b9052505b509192915050565b600080601f8360200151611d9b91906127f3565b8351909150600090611dad908361296f565b9050600092505b8082101561105e57815160ff166080811015611ddc57611dd560018461296f565b9250611e46565b60e08160ff161015611df357611dd560028461296f565b60f08160ff161015611e0a57611dd560038461296f565b60f88160ff161015611e2157611dd560048461296f565b60fc8160ff161015611e3857611dd560058461296f565b611e4360068461296f565b92505b5082611e518161283d565b935050611db4565b60008381868511611f645760208511611f135760008515611ea5576001611e818760206127f3565b611e8c9060086129dc565b611e97906002612b25565b611ea191906127f3565b1990505b84518116600087611eb68b8b61296f565b611ec091906127f3565b855190915083165b828114611f0557818610611eed57611ee08b8b61296f565b9650505050505050611056565b85611ef78161283d565b965050838651169050611ec8565b859650505050505050611056565b508383206000905b611f2586896127f3565b8211611f6257858320808203611f415783945050505050611056565b611f4c60018561296f565b9350508180611f5a9061283d565b925050611f1b565b505b611f6e878761296f565b979650505050505050565b60606000611f888360026129dc565b611f9390600261296f565b6001600160401b03811115611faa57611faa61231c565b6040519080825280601f01601f191660200182016040528015611fd4576020820181803683370190505b509050600360fc1b81600081518110611fef57611fef612827565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061201e5761201e612827565b60200101906001600160f81b031916908160001a90535060006120428460026129dc565b61204d90600161296f565b90505b60018111156120c5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061208157612081612827565b1a60f81b82828151811061209757612097612827565b60200101906001600160f81b031916908160001a90535060049490941c936120be81612a2a565b9050612050565b5083156121145760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610718565b9392505050565b6001600160a01b038116811461120d57600080fd5b6000806040838503121561214357600080fd5b823561214e8161211b565b946020939093013593505050565b6001600160e01b03198116811461120d57600080fd5b60006020828403121561218457600080fd5b81356121148161215c565b60005b838110156121aa578181015183820152602001612192565b838111156106515750506000910152565b60208152600082518060208401526121da81604085016020870161218f565b601f01601f19169190910160400192915050565b60006020828403121561220057600080fd5b5035919050565b6000806000806080858703121561221d57600080fd5b84356122288161211b565b935060208501356122388161211b565b93969395505050506040820135916060013590565b60008083601f84011261225f57600080fd5b5081356001600160401b0381111561227657600080fd5b60208301915083602082850101111561228e57600080fd5b9250929050565b6000806000806000608086880312156122ad57600080fd5b85356122b88161211b565b945060208601356122c88161211b565b93506040860135925060608601356001600160401b038111156122ea57600080fd5b6122f68882890161224d565b969995985093965092949392505050565b6001600160e01b031991909116815260200190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561235a5761235a61231c565b604052919050565b600082601f83011261237357600080fd5b813560206001600160401b0382111561238e5761238e61231c565b8160051b61239d828201612332565b92835284810182019282810190878511156123b757600080fd5b83870192505b84831015611f6e578235825291830191908301906123bd565b60008060008060008060a087890312156123ef57600080fd5b86356123fa8161211b565b9550602087013561240a8161211b565b945060408701356001600160401b038082111561242657600080fd5b6124328a838b01612362565b9550606089013591508082111561244857600080fd5b6124548a838b01612362565b9450608089013591508082111561246a57600080fd5b5061247789828a0161224d565b979a9699509497509295939492505050565b60008083601f84011261249b57600080fd5b5081356001600160401b038111156124b257600080fd5b6020830191508360208260051b850101111561228e57600080fd5b6000806000604084860312156124e257600080fd5b83356001600160401b03808211156124f957600080fd5b61250587838801612489565b9095509350602086013591508082111561251e57600080fd5b5061252b86828701612362565b9150509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561256d57835183529284019291840191600101612551565b50909695505050505050565b60006020828403121561258b57600080fd5b81356121148161211b565b801515811461120d57600080fd5b600080604083850312156125b757600080fd5b82356125c28161211b565b915060208301356125d281612596565b809150509250929050565b60008060008060008060008060a0898b0312156125f957600080fd5b88356126048161211b565b975060208901356126148161211b565b965060408901356001600160401b038082111561263057600080fd5b61263c8c838d01612489565b909850965060608b013591508082111561265557600080fd5b6126618c838d01612489565b909650945060808b013591508082111561267a57600080fd5b506126878b828c0161224d565b999c989b5096995094979396929594505050565b600080604083850312156126ae57600080fd5b82356126b98161211b565b915060208301356125d28161211b565b60008060008060008060a087890312156126e257600080fd5b86356126ed8161211b565b955060208701356126fd8161211b565b9450604087013593506060870135925060808701356001600160401b0381111561272657600080fd5b61247789828a0161224d565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008261276d5761276d612732565b500490565b720263ab33a2bb930b83832b21027232a3990169606d1b8152600082516127a081601385016020870161218f565b6508091315519560d21b6013939091019283015250601901919050565b6000602082840312156127cf57600080fd5b815161211481612596565b6000602082840312156127ec57600080fd5b5051919050565b60008282101561280557612805612748565b500390565b60006020828403121561281c57600080fd5b81516121148161211b565b634e487b7160e01b600052603260045260246000fd5b60006001820161284f5761284f612748565b5060010190565b664c46545752505f60c81b81526000825161287881600785016020870161218f565b9190910160070192915050565b60006020828403121561289757600080fd5b81516001600160401b03808211156128ae57600080fd5b818401915084601f8301126128c257600080fd5b8151818111156128d4576128d461231c565b6128e7601f8201601f1916602001612332565b91508082528560208285010111156128fe57600080fd5b61290f81602084016020860161218f565b50949350505050565b6000845161292a81846020890161218f565b84519083019061293e81836020890161218f565b845191019061295181836020880161218f565b0195945050505050565b60008261296a5761296a612732565b500690565b6000821982111561298257612982612748565b500190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b6000602082840312156129d157600080fd5b81516121148161215c565b60008160001904831182151516156129f6576129f6612748565b500290565b60008351612a0d81846020880161218f565b835190830190612a2181836020880161218f565b01949350505050565b600081612a3957612a39612748565b506000190190565b600181815b80851115612a7c578160001904821115612a6257612a62612748565b80851615612a6f57918102915b93841c9390800290612a46565b509250929050565b600082612a935750600161054d565b81612aa05750600061054d565b8160018114612ab65760028114612ac057612adc565b600191505061054d565b60ff841115612ad157612ad1612748565b50506001821b61054d565b5060208310610133831016604e8410600b8410161715612aff575081810a61054d565b612b098383612a41565b8060001904821115612b1d57612b1d612748565b029392505050565b60006121148383612a8456fea2646970667358221220e7dbb5d0205fc148f19e6d1b100fcea638a95e304c2ec0404c0b76fa720d226864736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000356e1363897033759181727e4bff12396c51a7e000000000000000000000000000000000000000000000001b1ae4d6e2ef500000
-----Decoded View---------------
Arg [0] : luftballons (address): 0x356E1363897033759181727e4BFf12396c51A7E0
Arg [1] : burn (uint256): 500000000000000000000
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000356e1363897033759181727e4bff12396c51a7e0
Arg [1] : 00000000000000000000000000000000000000000000001b1ae4d6e2ef500000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.