ERC-1155
Overview
Max Total Supply
610 StraymStore
Holders
14
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
NFTStoreFront
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import '@openzeppelin/contracts/interfaces/IERC2981.sol'; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./PaymentSplitter.sol"; contract NFTStoreFront is ERC1155, IERC2981, Ownable, ReentrancyGuard, EIP712 { string public name = "Straym Shared Storefront"; string public symbol = "StraymStore"; using Counters for Counters.Counter; Counters.Counter private _tokenIds; //Counter to keep track of the number of NFT we minted and make sure we dont try to mint the same twice address public marketplaceAddress; address public mintingFeeAddress; uint256 public mintingFee = 10000000000000; // 0.00001ETH IERC20 public WETH; address public commissionAddress; uint256 public commissionPercent; bool public paused = false; mapping (uint256 => string) private _tokenURIs; //We create the mapping for TokenID -> URI mapping(uint256 => address) private recipients; mapping(uint256 => uint8) private royaltyPercents; constructor( address _marketplaceAddress, address _WETH, address _commissionAddress, uint256 _commissionPercent ) ERC1155("Straym StoreFront") EIP712("Straym Marketplace", "1") { marketplaceAddress = _marketplaceAddress; WETH = IERC20(_WETH); commissionAddress = _commissionAddress; commissionPercent = _commissionPercent; mintingFeeAddress = _msgSender(); } modifier mintPriceCompliance() { require(msg.value >= mintingFee, "Insufficient funds!"); _; } modifier verifyroyaltyPercent(uint8 _royaltyPercent) { require(_royaltyPercent >= 0, "royalty percent must be from 0 to 100"); require(_royaltyPercent <= 100, "royalty percent must be from 0 to 100"); _; } function mintToken(string calldata _tokenUri, uint256 _amount, uint8 _royaltyPercent, address[] memory _payees, uint256[] memory _shares_) public payable nonReentrant mintPriceCompliance() verifyroyaltyPercent(_royaltyPercent) returns(uint256) { require(!paused, 'The contract is paused!'); uint256 newItemId = _tokenIds.current(); _mint(msg.sender, newItemId, _amount, ""); _setTokenUri(newItemId, _tokenUri); _tokenIds.increment(); setApprovalForAll(marketplaceAddress, true); if (mintingFeeAddress != address(0) && mintingFee > 0 && address(this).balance >= mintingFee) { // ============================================================================= (bool hs, ) = payable(mintingFeeAddress).call{value: mintingFee}(''); require(hs); // ============================================================================= } if(_payees.length > 0) { if(_payees.length == 1) { _setRoyalties(newItemId, _payees[0]); } else { address splitter = address(new PaymentSplitter(_payees, _shares_)); _setRoyalties(newItemId, splitter); } } royaltyPercents[newItemId] = _royaltyPercent; return newItemId; } function setCommissionAddress(address _commissionAddress) public onlyOwner { commissionAddress = _commissionAddress; } function setCommissionPercent(uint256 _commissionPercent) public onlyOwner { commissionPercent = _commissionPercent; } function uri(uint256 tokenId) override public view returns (string memory) { //We override the uri function of the EIP-1155: Multi Token Standard (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol) return(_tokenURIs[tokenId]); } function _setTokenUri(uint256 tokenId, string memory tokenUri) private { _tokenURIs[tokenId] = tokenUri; } function setPaused(bool _state) public onlyOwner { paused = _state; } function setMarketplaceAddress(address _marketplaceAddress) public onlyOwner { marketplaceAddress = _marketplaceAddress; } function setMintingFeeAddress(address _mintingFeeAddress) public onlyOwner { mintingFeeAddress = _mintingFeeAddress; } function setMintingFee(uint256 _mintingFee) public onlyOwner { mintingFee = _mintingFee; } // Maintain flexibility to modify royalties recipient (could also add basis points). function _setRoyalties(uint256 _tokenId, address newRecipient) internal { require(newRecipient != address(0), "Royalties: new recipient is the zero address"); recipients[_tokenId] = newRecipient; } function setRoyalties(uint256 _tokenId, address newRecipient) external onlyOwner { _setRoyalties(_tokenId, newRecipient); } function setRoyaltyPercent(uint256 _tokenId, uint8 _royaltyPercent) external onlyOwner { royaltyPercents[_tokenId] = _royaltyPercent; } // EIP2981 standard royalties return. function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { return (recipients[_tokenId], (_salePrice * royaltyPercents[_tokenId] * 100) / 10000); } function supportsInterface(bytes4 interfaceId) public view override(ERC1155, IERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } function setApprovalForAll(address operator, bool approved) public virtual override { if(owner() == _msgSender()) { _setApprovalForAll(_msgSender(), operator, approved); } else { _setApprovalForAll(_msgSender(), operator, true); } } function burnTokens(address account, uint256 id, uint256 amount) public onlyOwner { _burn(account, id, amount); } function burnBatchTokens(address account, uint256[] calldata ids, uint256[] calldata amounts) public onlyOwner { _burnBatch(account, ids, amounts); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (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.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * 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 _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// 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.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.8.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.openzeppelin.com/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; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _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; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _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; // Overflow not possible: amount <= accountBalance <= totalSupply. _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 v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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.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.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; // EIP-712 is Final as of 2022-08-11. This file is deprecated. import "./EIP712.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (finance/PaymentSplitter.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the * time of contract deployment and can't be updated thereafter. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. * * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you * to run tests before sending real value to this contract. */ contract PaymentSplitter is Context { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ constructor(address[] memory payees, uint256[] memory shares_) payable { require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Getter for the amount of payee's releasable Ether. */ function releasable(address account) public view returns (uint256) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } /** * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an * IERC20 contract. */ function releasable(IERC20 token, address account) public view returns (uint256) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 payment = releasable(account); require(payment != 0, "PaymentSplitter: account is not due payment"); // _totalReleased is the sum of all values in _released. // If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow. _totalReleased += payment; unchecked { _released[account] += payment; } Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 payment = releasable(token, account); require(payment != 0, "PaymentSplitter: account is not due payment"); // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token]. // If "_erc20TotalReleased[token] += payment" does not overflow, then "_erc20Released[token][account] += payment" // cannot overflow. _erc20TotalReleased[token] += payment; unchecked { _erc20Released[token][account] += payment; } SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } function withdrawTokens(IERC20 token, address payable account) public virtual { uint256 paymentETH = releasable(account); uint256 paymentWETH = releasable(token, account); require(paymentETH != 0 || paymentWETH != 0, "PaymentSplitter: account is not due payment"); if (paymentETH != 0) { release(account); } if (paymentWETH != 0) { release(token, account); } } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } function getPayeesLength() public view returns (uint256 length) { return _payees.length; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_marketplaceAddress","type":"address"},{"internalType":"address","name":"_WETH","type":"address"},{"internalType":"address","name":"_commissionAddress","type":"address"},{"internalType":"uint256","name":"_commissionPercent","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"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"burnBatchTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"commissionAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"commissionPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketplaceAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_tokenUri","type":"string"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint8","name":"_royaltyPercent","type":"uint8"},{"internalType":"address[]","name":"_payees","type":"address[]"},{"internalType":"uint256[]","name":"_shares_","type":"uint256[]"}],"name":"mintToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintingFeeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_commissionAddress","type":"address"}],"name":"setCommissionAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_commissionPercent","type":"uint256"}],"name":"setCommissionPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_marketplaceAddress","type":"address"}],"name":"setMarketplaceAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintingFee","type":"uint256"}],"name":"setMintingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_mintingFeeAddress","type":"address"}],"name":"setMintingFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"newRecipient","type":"address"}],"name":"setRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint8","name":"_royaltyPercent","type":"uint8"}],"name":"setRoyaltyPercent","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":"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"}]
Contract Creation Code
61018060405260186101408190527f53747261796d205368617265642053746f726566726f6e740000000000000000610160908152620000439160059190620002bf565b5060408051808201909152600b8082526a53747261796d53746f726560a81b60209092019182526200007891600691620002bf565b506509184e72a000600a55600e805460ff191690553480156200009a57600080fd5b506040516200418838038062004188833981016040819052620000bd9162000382565b6040518060400160405280601281526020017153747261796d204d61726b6574706c61636560701b815250604051806040016040528060018152602001603160f81b8152506040518060400160405280601181526020017014dd1c985e5b4814dd1bdc99519c9bdb9d607a1b8152506200013d816200025460201b60201c565b5062000149336200026d565b6001600455815160208084019190912082518383012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919290916080523060c052610120525050600880546001600160a01b038881166001600160a01b031992831617909255600b8054888416908316179055600c8054928716929091169190911790555050600d819055620002293390565b600980546001600160a01b0319166001600160a01b0392909216919091179055506200041192505050565b805162000269906002906020840190620002bf565b5050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620002cd90620003d4565b90600052602060002090601f016020900481019282620002f157600085556200033c565b82601f106200030c57805160ff19168380011785556200033c565b828001600101855582156200033c579182015b828111156200033c5782518255916020019190600101906200031f565b506200034a9291506200034e565b5090565b5b808211156200034a57600081556001016200034f565b80516001600160a01b03811681146200037d57600080fd5b919050565b600080600080608085870312156200039957600080fd5b620003a48562000365565b9350620003b46020860162000365565b9250620003c46040860162000365565b6060959095015193969295505050565b600181811c90821680620003e957607f821691505b602082108114156200040b57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e0516101005161012051613d396200044f600039600050506000505060005050600050506000505060005050613d396000f3fe6080604052600436106200020a5760003560e01c8063715018a61162000117578063ad5c464811620000a1578063e0aeb7c1116200006c578063e0aeb7c1146200062f578063e985e9c51462000654578063f242432a14620006a1578063f2fde38b14620006c657600080fd5b8063ad5c464814620005a1578063ae1cb38014620005c3578063b47cc55614620005e8578063daa17f49146200060d57600080fd5b80638da5cb5b11620000e25780638da5cb5b1462000522578063931742d3146200054257806395d89b411462000564578063a22cb465146200057c57600080fd5b8063715018a614620004b657806377d3550b14620004ce57806378f36db514620004e657806381c0fb75146200050b57600080fd5b8063404a9ab811620001995780635a64ad9511620001645780635a64ad9514620004225780635c975abb146200043a5780635de429851462000456578063639205c2146200047b57600080fd5b8063404a9ab8146200037f57806340fff80c14620003a45780634277070f14620003c95780634e1273f414620003ee57600080fd5b806316c38b3c11620001da57806316c38b3c14620002c9578063238a470914620002f05780632a55205a14620003155780632eb2c2d6146200035a57600080fd5b8062fdd58e146200020f57806301ffc9a7146200024757806306fdde03146200027d5780630e89341c14620002a4575b600080fd5b3480156200021c57600080fd5b50620002346200022e36600462001dcb565b620006eb565b6040519081526020015b60405180910390f35b3480156200025457600080fd5b506200026c6200026636600462001e0f565b62000782565b60405190151581526020016200023e565b3480156200028a57600080fd5b5062000295620007b0565b6040516200023e919062001e86565b348015620002b157600080fd5b5062000295620002c336600462001e9b565b62000846565b348015620002d657600080fd5b50620002ee620002e836600462001ec6565b620008f0565b005b348015620002fd57600080fd5b50620002ee6200030f36600462001e9b565b6200090d565b3480156200032257600080fd5b506200033a6200033436600462001ee4565b6200091c565b604080516001600160a01b0390931683526020830191909152016200023e565b3480156200036757600080fd5b50620002ee6200037936600462002068565b6200097a565b3480156200038c57600080fd5b50620002ee6200039e36600462001e9b565b620009ce565b348015620003b157600080fd5b50620002ee620003c336600462002120565b620009dd565b348015620003d657600080fd5b50620002ee620003e836600462002150565b62000a09565b348015620003fb57600080fd5b50620004136200040d366004620021f6565b62000a35565b6040516200023e91906200229e565b3480156200042f57600080fd5b5062000234600a5481565b3480156200044757600080fd5b50600e546200026c9060ff1681565b3480156200046357600080fd5b50620002ee62000475366004620022b3565b62000b74565b3480156200048857600080fd5b506009546200049d906001600160a01b031681565b6040516001600160a01b0390911681526020016200023e565b348015620004c357600080fd5b50620002ee62000b8e565b348015620004db57600080fd5b5062000234600d5481565b348015620004f357600080fd5b50620002ee6200050536600462002321565b62000ba6565b620002346200051c366004620023ab565b62000c20565b3480156200052f57600080fd5b506003546001600160a01b03166200049d565b3480156200054f57600080fd5b50600c546200049d906001600160a01b031681565b3480156200057157600080fd5b506200029562000f21565b3480156200058957600080fd5b50620002ee6200059b3660046200248b565b62000f30565b348015620005ae57600080fd5b50600b546200049d906001600160a01b031681565b348015620005d057600080fd5b50620002ee620005e236600462002120565b62000f5f565b348015620005f557600080fd5b50620002ee6200060736600462002120565b62000f8b565b3480156200061a57600080fd5b506008546200049d906001600160a01b031681565b3480156200063c57600080fd5b50620002ee6200064e366004620024ba565b62000fb7565b3480156200066157600080fd5b506200026c62000673366004620024f0565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b348015620006ae57600080fd5b50620002ee620006c03660046200251f565b62000fd3565b348015620006d357600080fd5b50620002ee620006e536600462002120565b62001020565b60006001600160a01b0383166200075c5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b0319821663152a902d60e11b1480620007aa5750620007aa826200109f565b92915050565b60058054620007bf906200258c565b80601f0160208091040260200160405190810160405280929190818152602001828054620007ed906200258c565b80156200083e5780601f1062000812576101008083540402835291602001916200083e565b820191906000526020600020905b8154815290600101906020018083116200082057829003601f168201915b505050505081565b6000818152600f6020526040902080546060919062000865906200258c565b80601f016020809104026020016040519081016040528092919081815260200182805462000893906200258c565b8015620008e45780601f10620008b857610100808354040283529160200191620008e4565b820191906000526020600020905b815481529060010190602001808311620008c657829003601f168201915b50505050509050919050565b620008fa620010f2565b600e805460ff1916911515919091179055565b62000917620010f2565b600a55565b600082815260106020908152604080832054601190925282205482916001600160a01b03169061271090620009559060ff1686620025df565b62000962906064620025df565b6200096e919062002601565b915091505b9250929050565b6001600160a01b03851633148062000999575062000999853362000673565b620009b85760405162461bcd60e51b8152600401620007539062002624565b620009c785858585856200114e565b5050505050565b620009d8620010f2565b600d55565b620009e7620010f2565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b62000a13620010f2565b600091825260116020526040909120805460ff191660ff909216919091179055565b6060815183511462000a9c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b606482015260840162000753565b6000835167ffffffffffffffff81111562000abb5762000abb62001f07565b60405190808252806020026020018201604052801562000ae5578160200160208202803683370190505b50905060005b845181101562000b6c5762000b3985828151811062000b0e5762000b0e62002672565b602002602001015185838151811062000b2b5762000b2b62002672565b6020026020010151620006eb565b82828151811062000b4e5762000b4e62002672565b602090810291909101015262000b648162002688565b905062000aeb565b509392505050565b62000b7e620010f2565b62000b8a828262001303565b5050565b62000b98620010f2565b62000ba460006200139e565b565b62000bb0620010f2565b620009c78585858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808902828101820190935288825290935088925087918291850190849080828437600092019190915250620013f092505050565b600062000c2c62001590565b600a5434101562000c765760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742066756e64732160681b604482015260640162000753565b8360648160ff16111562000cdb5760405162461bcd60e51b815260206004820152602560248201527f726f79616c74792070657263656e74206d7573742062652066726f6d2030207460448201526406f203130360dc1b606482015260840162000753565b600e5460ff161562000d305760405162461bcd60e51b815260206004820152601760248201527f54686520636f6e74726163742069732070617573656421000000000000000000604482015260640162000753565b600062000d3c60075490565b905062000d5b33828960405180602001604052806000815250620015ec565b62000d9d818a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506200170a92505050565b62000dac600780546001019055565b60085462000dc5906001600160a01b0316600162000f30565b6009546001600160a01b03161580159062000de257506000600a54115b801562000df15750600a544710155b1562000e5e57600954600a546040516000926001600160a01b031691908381818185875af1925050503d806000811462000e48576040519150601f19603f3d011682016040523d82523d6000602084013e62000e4d565b606091505b505090508062000e5c57600080fd5b505b84511562000eed5784516001141562000ea05762000e9a818660008151811062000e8c5762000e8c62002672565b602002602001015162001303565b62000eed565b6000858560405162000eb29062001cfa565b62000ebf929190620026a6565b604051809103906000f08015801562000edc573d6000803e3d6000fd5b50905062000eeb828262001303565b505b6000818152601160205260409020805460ff191660ff88161790556001600455915062000f179050565b9695505050505050565b60068054620007bf906200258c565b6003546001600160a01b031633141562000f515762000b8a3383836200172b565b62000b8a338360016200172b565b62000f69620010f2565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b62000f95620010f2565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b62000fc1620010f2565b62000fce8383836200180e565b505050565b6001600160a01b03851633148062000ff2575062000ff2853362000673565b620010115760405162461bcd60e51b8152600401620007539062002624565b620009c785858585856200191d565b6200102a620010f2565b6001600160a01b038116620010915760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000753565b6200109c816200139e565b50565b60006001600160e01b03198216636cdb3d1360e11b1480620010d157506001600160e01b031982166303a24d0760e21b145b80620007aa57506301ffc9a760e01b6001600160e01b0319831614620007aa565b6003546001600160a01b0316331462000ba45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000753565b8151835114620011725760405162461bcd60e51b8152600401620007539062002700565b6001600160a01b0384166200119b5760405162461bcd60e51b8152600401620007539062002748565b3360005b845181101562001291576000858281518110620011c057620011c062002672565b602002602001015190506000858381518110620011e157620011e162002672565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015620012345760405162461bcd60e51b815260040162000753906200278d565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929062001273908490620027d7565b9250508190555050505080620012899062002688565b90506200119f565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051620012e3929190620027f2565b60405180910390a4620012fb81878787878762001a55565b505050505050565b6001600160a01b038116620013705760405162461bcd60e51b815260206004820152602c60248201527f526f79616c746965733a206e657720726563697069656e74206973207468652060448201526b7a65726f206164647265737360a01b606482015260840162000753565b60009182526010602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038316620014195760405162461bcd60e51b8152600401620007539062002824565b80518251146200143d5760405162461bcd60e51b8152600401620007539062002700565b604080516020810190915260009081905233905b83518110156200152057600084828151811062001472576200147262002672565b60200260200101519050600084838151811062001493576200149362002672565b602090810291909101810151600084815280835260408082206001600160a01b038c168352909352919091205490915081811015620014e65760405162461bcd60e51b8152600401620007539062002867565b6000928352602083815260408085206001600160a01b038b1686529091529092209103905580620015178162002688565b91505062001451565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb868660405162001573929190620027f2565b60405180910390a460408051602081019091526000905250505050565b60026004541415620015e55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162000753565b6002600455565b6001600160a01b0384166200164e5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840162000753565b3360006200165c8562001bd5565b905060006200166b8562001bd5565b90506000868152602081815260408083206001600160a01b038b168452909152812080548792906200169f908490620027d7565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4620017018360008989898962001c23565b50505050505050565b6000828152600f60209081526040909120825162000fce9284019062001d08565b816001600160a01b0316836001600160a01b03161415620017a15760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b606482015260840162000753565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038316620018375760405162461bcd60e51b8152600401620007539062002824565b336000620018458462001bd5565b90506000620018548462001bd5565b60408051602080820183526000918290528882528181528282206001600160a01b038b1683529052205490915084811015620018a45760405162461bcd60e51b8152600401620007539062002867565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a460408051602081019091526000905262001701565b6001600160a01b038416620019465760405162461bcd60e51b8152600401620007539062002748565b336000620019548562001bd5565b90506000620019638562001bd5565b90506000868152602081815260408083206001600160a01b038c16845290915290205485811015620019a95760405162461bcd60e51b815260040162000753906200278d565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290620019e8908490620027d7565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a462001a4a848a8a8a8a8a62001c23565b505050505050505050565b6001600160a01b0384163b15620012fb5760405163bc197c8160e01b81526001600160a01b0385169063bc197c819062001a9c9089908990889088908890600401620028ab565b602060405180830381600087803b15801562001ab757600080fd5b505af192505050801562001aea575060408051601f3d908101601f1916820190925262001ae7918101906200290f565b60015b62001ba25762001af96200292f565b806308c379a0141562001b3a575062001b116200294c565b8062001b1e575062001b3c565b8060405162461bcd60e51b815260040162000753919062001e86565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b606482015260840162000753565b6001600160e01b0319811663bc197c8160e01b14620017015760405162461bcd60e51b81526004016200075390620029dc565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811062001c125762001c1262002672565b602090810291909101015292915050565b6001600160a01b0384163b15620012fb5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619062001c6a908990899088908890889060040162002a24565b602060405180830381600087803b15801562001c8557600080fd5b505af192505050801562001cb8575060408051601f3d908101601f1916820190925262001cb5918101906200290f565b60015b62001cc75762001af96200292f565b6001600160e01b0319811663f23a6e6160e01b14620017015760405162461bcd60e51b81526004016200075390620029dc565b6112988062002a6c83390190565b82805462001d16906200258c565b90600052602060002090601f01602090048101928262001d3a576000855562001d85565b82601f1062001d5557805160ff191683800117855562001d85565b8280016001018555821562001d85579182015b8281111562001d8557825182559160200191906001019062001d68565b5062001d9392915062001d97565b5090565b5b8082111562001d93576000815560010162001d98565b80356001600160a01b038116811462001dc657600080fd5b919050565b6000806040838503121562001ddf57600080fd5b62001dea8362001dae565b946020939093013593505050565b6001600160e01b0319811681146200109c57600080fd5b60006020828403121562001e2257600080fd5b813562001e2f8162001df8565b9392505050565b6000815180845260005b8181101562001e5e5760208185018101518683018201520162001e40565b8181111562001e71576000602083870101525b50601f01601f19169290920160200192915050565b60208152600062001e2f602083018462001e36565b60006020828403121562001eae57600080fd5b5035919050565b8035801515811462001dc657600080fd5b60006020828403121562001ed957600080fd5b62001e2f8262001eb5565b6000806040838503121562001ef857600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff8111828210171562001f465762001f4662001f07565b6040525050565b600067ffffffffffffffff82111562001f6a5762001f6a62001f07565b5060051b60200190565b600082601f83011262001f8657600080fd5b8135602062001f958262001f4d565b60405162001fa4828262001f1d565b83815260059390931b850182019282810191508684111562001fc557600080fd5b8286015b8481101562001fe2578035835291830191830162001fc9565b509695505050505050565b600082601f83011262001fff57600080fd5b813567ffffffffffffffff8111156200201c576200201c62001f07565b60405162002035601f8301601f19166020018262001f1d565b8181528460208386010111156200204b57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156200208157600080fd5b6200208c8662001dae565b94506200209c6020870162001dae565b9350604086013567ffffffffffffffff80821115620020ba57600080fd5b620020c889838a0162001f74565b94506060880135915080821115620020df57600080fd5b620020ed89838a0162001f74565b935060808801359150808211156200210457600080fd5b50620021138882890162001fed565b9150509295509295909350565b6000602082840312156200213357600080fd5b62001e2f8262001dae565b803560ff8116811462001dc657600080fd5b600080604083850312156200216457600080fd5b8235915062002176602084016200213e565b90509250929050565b600082601f8301126200219157600080fd5b81356020620021a08262001f4d565b604051620021af828262001f1d565b83815260059390931b8501820192828101915086841115620021d057600080fd5b8286015b8481101562001fe257620021e88162001dae565b8352918301918301620021d4565b600080604083850312156200220a57600080fd5b823567ffffffffffffffff808211156200222357600080fd5b62002231868387016200217f565b935060208501359150808211156200224857600080fd5b50620022578582860162001f74565b9150509250929050565b600081518084526020808501945080840160005b83811015620022935781518752958201959082019060010162002275565b509495945050505050565b60208152600062001e2f602083018462002261565b60008060408385031215620022c757600080fd5b82359150620021766020840162001dae565b60008083601f840112620022ec57600080fd5b50813567ffffffffffffffff8111156200230557600080fd5b6020830191508360208260051b85010111156200097357600080fd5b6000806000806000606086880312156200233a57600080fd5b620023458662001dae565b9450602086013567ffffffffffffffff808211156200236357600080fd5b6200237189838a01620022d9565b909650945060408801359150808211156200238b57600080fd5b506200239a88828901620022d9565b969995985093965092949392505050565b60008060008060008060a08789031215620023c557600080fd5b863567ffffffffffffffff80821115620023de57600080fd5b818901915089601f830112620023f357600080fd5b8135818111156200240357600080fd5b8a60208285010111156200241657600080fd5b6020838101995090975089013595506200243360408a016200213e565b945060608901359150808211156200244a57600080fd5b620024588a838b016200217f565b935060808901359150808211156200246f57600080fd5b506200247e89828a0162001f74565b9150509295509295509295565b600080604083850312156200249f57600080fd5b620024aa8362001dae565b9150620021766020840162001eb5565b600080600060608486031215620024d057600080fd5b620024db8462001dae565b95602085013595506040909401359392505050565b600080604083850312156200250457600080fd5b6200250f8362001dae565b9150620021766020840162001dae565b600080600080600060a086880312156200253857600080fd5b620025438662001dae565b9450620025536020870162001dae565b93506040860135925060608601359150608086013567ffffffffffffffff8111156200257e57600080fd5b620021138882890162001fed565b600181811c90821680620025a157607f821691505b60208210811415620025c357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615620025fc57620025fc620025c9565b500290565b6000826200261f57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200269f576200269f620025c9565b5060010190565b604080825283519082018190526000906020906060840190828701845b82811015620026ea5781516001600160a01b031684529284019290840190600101620026c3565b5050508381038285015262000f17818662002261565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60008219821115620027ed57620027ed620025c9565b500190565b60408152600062002807604083018562002261565b82810360208401526200281b818562002261565b95945050505050565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604082015263616e636560e01b606082015260800190565b6001600160a01b0386811682528516602082015260a060408201819052600090620028d99083018662002261565b8281036060840152620028ed818662002261565b9050828103608084015262002903818562001e36565b98975050505050505050565b6000602082840312156200292257600080fd5b815162001e2f8162001df8565b600060033d1115620029495760046000803e5060005160e01c5b90565b600060443d10156200295b5790565b6040516003193d81016004833e81513d67ffffffffffffffff81602484011181841117156200298c57505050505090565b8285019150815181811115620029a55750505050505090565b843d8701016020828501011115620029c05750505050505090565b620029d16020828601018762001f1d565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009062002a609083018462001e36565b97965050505050505056fe6080604052604051620012983803806200129883398101604081905262000026916200042e565b8051825114620000985760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b60648201526084015b60405180910390fd5b6000825111620000eb5760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e7453706c69747465723a206e6f2070617965657300000000000060448201526064016200008f565b60005b82518110156200015757620001428382815181106200011157620001116200050c565b60200260200101518383815181106200012e576200012e6200050c565b60200260200101516200016060201b60201c565b806200014e8162000538565b915050620000ee565b50505062000571565b6001600160a01b038216620001cd5760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b60648201526084016200008f565b600081116200021f5760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a2073686172657320617265203000000060448201526064016200008f565b6001600160a01b038216600090815260026020526040902054156200029b5760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b60648201526084016200008f565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b0384169081179091556000908152600260205260408120829055546200030390829062000556565b600055604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200038d576200038d6200034c565b604052919050565b60006001600160401b03821115620003b157620003b16200034c565b5060051b60200190565b600082601f830112620003cd57600080fd5b81516020620003e6620003e08362000395565b62000362565b82815260059290921b840181019181810190868411156200040657600080fd5b8286015b848110156200042357805183529183019183016200040a565b509695505050505050565b600080604083850312156200044257600080fd5b82516001600160401b03808211156200045a57600080fd5b818501915085601f8301126200046f57600080fd5b8151602062000482620003e08362000395565b82815260059290921b84018101918181019089841115620004a257600080fd5b948201945b83861015620004d95785516001600160a01b0381168114620004c95760008081fd5b82529482019490820190620004a7565b91880151919650909350505080821115620004f357600080fd5b506200050285828601620003bb565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156200054f576200054f62000522565b5060010190565b600082198211156200056c576200056c62000522565b500190565b610d1780620005816000396000f3fe6080604052600436106100c65760003560e01c80639852595c1161007f578063c45ac05011610059578063c45ac05014610283578063ce7c2ac2146102a3578063d79779b2146102d9578063e33b7de31461030f57600080fd5b80639852595c1461020d578063a3f8eace14610243578063a522ad251461026357600080fd5b806301ba5fc11461011457806319165587146101385780633a98ef391461015a578063406072a91461016f57806348b75044146101b55780638b83209b146101d557600080fd5b3661010f577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b34801561012057600080fd5b506004545b6040519081526020015b60405180910390f35b34801561014457600080fd5b50610158610153366004610a8f565b610324565b005b34801561016657600080fd5b50600054610125565b34801561017b57600080fd5b5061012561018a366004610aac565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b3480156101c157600080fd5b506101586101d0366004610aac565b610411565b3480156101e157600080fd5b506101f56101f0366004610ae5565b61051f565b6040516001600160a01b03909116815260200161012f565b34801561021957600080fd5b50610125610228366004610a8f565b6001600160a01b031660009081526003602052604090205490565b34801561024f57600080fd5b5061012561025e366004610a8f565b61054f565b34801561026f57600080fd5b5061015861027e366004610aac565b610597565b34801561028f57600080fd5b5061012561029e366004610aac565b610600565b3480156102af57600080fd5b506101256102be366004610a8f565b6001600160a01b031660009081526002602052604090205490565b3480156102e557600080fd5b506101256102f4366004610a8f565b6001600160a01b031660009081526005602052604090205490565b34801561031b57600080fd5b50600154610125565b6001600160a01b0381166000908152600260205260409020546103625760405162461bcd60e51b815260040161035990610afe565b60405180910390fd5b600061036d8261054f565b90508061038c5760405162461bcd60e51b815260040161035990610b44565b806001600082825461039e9190610ba5565b90915550506001600160a01b03821660009081526003602052604090208054820190556103cb82826106da565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15050565b6001600160a01b0381166000908152600260205260409020546104465760405162461bcd60e51b815260040161035990610afe565b60006104528383610600565b9050806104715760405162461bcd60e51b815260040161035990610b44565b6001600160a01b03831660009081526005602052604081208054839290610499908490610ba5565b90915550506001600160a01b0380841660009081526006602090815260408083209386168352929052208054820190556104d48383836107f8565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b60006004828154811061053457610534610bbd565b6000918252602090912001546001600160a01b031692915050565b60008061055b60015490565b6105659047610ba5565b9050610590838261058b866001600160a01b031660009081526003602052604090205490565b61084a565b9392505050565b60006105a28261054f565b905060006105b08484610600565b9050811515806105bf57508015155b6105db5760405162461bcd60e51b815260040161035990610b44565b81156105ea576105ea83610324565b80156105fa576105fa8484610411565b50505050565b6001600160a01b03821660009081526005602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a082319060240160206040518083038186803b15801561065a57600080fd5b505afa15801561066e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106929190610bd3565b61069c9190610ba5565b6001600160a01b038086166000908152600660209081526040808320938816835292905220549091506106d2908490839061084a565b949350505050565b8047101561072a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610359565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610777576040519150601f19603f3d011682016040523d82523d6000602084013e61077c565b606091505b50509050806107f35760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610359565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526107f3908490610885565b600080546001600160a01b0385168252600260205260408220548391906108719086610bec565b61087b9190610c0b565b6106d29190610c2d565b60006108da826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109579092919063ffffffff16565b8051909150156107f357808060200190518101906108f89190610c44565b6107f35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610359565b60606106d2848460008585600080866001600160a01b0316858760405161097e9190610c92565b60006040518083038185875af1925050503d80600081146109bb576040519150601f19603f3d011682016040523d82523d6000602084013e6109c0565b606091505b50915091506109d1878383876109dc565b979650505050505050565b60608315610a48578251610a41576001600160a01b0385163b610a415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610359565b50816106d2565b6106d28383815115610a5d5781518083602001fd5b8060405162461bcd60e51b81526004016103599190610cae565b6001600160a01b0381168114610a8c57600080fd5b50565b600060208284031215610aa157600080fd5b813561059081610a77565b60008060408385031215610abf57600080fd5b8235610aca81610a77565b91506020830135610ada81610a77565b809150509250929050565b600060208284031215610af757600080fd5b5035919050565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008219821115610bb857610bb8610b8f565b500190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610be557600080fd5b5051919050565b6000816000190483118215151615610c0657610c06610b8f565b500290565b600082610c2857634e487b7160e01b600052601260045260246000fd5b500490565b600082821015610c3f57610c3f610b8f565b500390565b600060208284031215610c5657600080fd5b8151801515811461059057600080fd5b60005b83811015610c81578181015183820152602001610c69565b838111156105fa5750506000910152565b60008251610ca4818460208701610c66565b9190910192915050565b6020815260008251806020840152610ccd816040850160208701610c66565b601f01601f1916919091016040019291505056fea2646970667358221220b077e7427e9c4f9ba9e08b44c6e0afe5cdd55a3c08d066e1941f73261058cea064736f6c63430008090033a2646970667358221220a59c1416b374aaed6cdab043efda0d48eafe8aa42296f888bb50af31f64ea99564736f6c634300080900330000000000000000000000005d93f9196a3db019cd2d019bcb5d8f65724fbb4d000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000cb0d7e7e69c3c6121c8e8cf8292a786cc073b2e0000000000000000000000000000000000000000000000000000000000000000a
Deployed Bytecode
0x6080604052600436106200020a5760003560e01c8063715018a61162000117578063ad5c464811620000a1578063e0aeb7c1116200006c578063e0aeb7c1146200062f578063e985e9c51462000654578063f242432a14620006a1578063f2fde38b14620006c657600080fd5b8063ad5c464814620005a1578063ae1cb38014620005c3578063b47cc55614620005e8578063daa17f49146200060d57600080fd5b80638da5cb5b11620000e25780638da5cb5b1462000522578063931742d3146200054257806395d89b411462000564578063a22cb465146200057c57600080fd5b8063715018a614620004b657806377d3550b14620004ce57806378f36db514620004e657806381c0fb75146200050b57600080fd5b8063404a9ab811620001995780635a64ad9511620001645780635a64ad9514620004225780635c975abb146200043a5780635de429851462000456578063639205c2146200047b57600080fd5b8063404a9ab8146200037f57806340fff80c14620003a45780634277070f14620003c95780634e1273f414620003ee57600080fd5b806316c38b3c11620001da57806316c38b3c14620002c9578063238a470914620002f05780632a55205a14620003155780632eb2c2d6146200035a57600080fd5b8062fdd58e146200020f57806301ffc9a7146200024757806306fdde03146200027d5780630e89341c14620002a4575b600080fd5b3480156200021c57600080fd5b50620002346200022e36600462001dcb565b620006eb565b6040519081526020015b60405180910390f35b3480156200025457600080fd5b506200026c6200026636600462001e0f565b62000782565b60405190151581526020016200023e565b3480156200028a57600080fd5b5062000295620007b0565b6040516200023e919062001e86565b348015620002b157600080fd5b5062000295620002c336600462001e9b565b62000846565b348015620002d657600080fd5b50620002ee620002e836600462001ec6565b620008f0565b005b348015620002fd57600080fd5b50620002ee6200030f36600462001e9b565b6200090d565b3480156200032257600080fd5b506200033a6200033436600462001ee4565b6200091c565b604080516001600160a01b0390931683526020830191909152016200023e565b3480156200036757600080fd5b50620002ee6200037936600462002068565b6200097a565b3480156200038c57600080fd5b50620002ee6200039e36600462001e9b565b620009ce565b348015620003b157600080fd5b50620002ee620003c336600462002120565b620009dd565b348015620003d657600080fd5b50620002ee620003e836600462002150565b62000a09565b348015620003fb57600080fd5b50620004136200040d366004620021f6565b62000a35565b6040516200023e91906200229e565b3480156200042f57600080fd5b5062000234600a5481565b3480156200044757600080fd5b50600e546200026c9060ff1681565b3480156200046357600080fd5b50620002ee62000475366004620022b3565b62000b74565b3480156200048857600080fd5b506009546200049d906001600160a01b031681565b6040516001600160a01b0390911681526020016200023e565b348015620004c357600080fd5b50620002ee62000b8e565b348015620004db57600080fd5b5062000234600d5481565b348015620004f357600080fd5b50620002ee6200050536600462002321565b62000ba6565b620002346200051c366004620023ab565b62000c20565b3480156200052f57600080fd5b506003546001600160a01b03166200049d565b3480156200054f57600080fd5b50600c546200049d906001600160a01b031681565b3480156200057157600080fd5b506200029562000f21565b3480156200058957600080fd5b50620002ee6200059b3660046200248b565b62000f30565b348015620005ae57600080fd5b50600b546200049d906001600160a01b031681565b348015620005d057600080fd5b50620002ee620005e236600462002120565b62000f5f565b348015620005f557600080fd5b50620002ee6200060736600462002120565b62000f8b565b3480156200061a57600080fd5b506008546200049d906001600160a01b031681565b3480156200063c57600080fd5b50620002ee6200064e366004620024ba565b62000fb7565b3480156200066157600080fd5b506200026c62000673366004620024f0565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b348015620006ae57600080fd5b50620002ee620006c03660046200251f565b62000fd3565b348015620006d357600080fd5b50620002ee620006e536600462002120565b62001020565b60006001600160a01b0383166200075c5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b0319821663152a902d60e11b1480620007aa5750620007aa826200109f565b92915050565b60058054620007bf906200258c565b80601f0160208091040260200160405190810160405280929190818152602001828054620007ed906200258c565b80156200083e5780601f1062000812576101008083540402835291602001916200083e565b820191906000526020600020905b8154815290600101906020018083116200082057829003601f168201915b505050505081565b6000818152600f6020526040902080546060919062000865906200258c565b80601f016020809104026020016040519081016040528092919081815260200182805462000893906200258c565b8015620008e45780601f10620008b857610100808354040283529160200191620008e4565b820191906000526020600020905b815481529060010190602001808311620008c657829003601f168201915b50505050509050919050565b620008fa620010f2565b600e805460ff1916911515919091179055565b62000917620010f2565b600a55565b600082815260106020908152604080832054601190925282205482916001600160a01b03169061271090620009559060ff1686620025df565b62000962906064620025df565b6200096e919062002601565b915091505b9250929050565b6001600160a01b03851633148062000999575062000999853362000673565b620009b85760405162461bcd60e51b8152600401620007539062002624565b620009c785858585856200114e565b5050505050565b620009d8620010f2565b600d55565b620009e7620010f2565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b62000a13620010f2565b600091825260116020526040909120805460ff191660ff909216919091179055565b6060815183511462000a9c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b606482015260840162000753565b6000835167ffffffffffffffff81111562000abb5762000abb62001f07565b60405190808252806020026020018201604052801562000ae5578160200160208202803683370190505b50905060005b845181101562000b6c5762000b3985828151811062000b0e5762000b0e62002672565b602002602001015185838151811062000b2b5762000b2b62002672565b6020026020010151620006eb565b82828151811062000b4e5762000b4e62002672565b602090810291909101015262000b648162002688565b905062000aeb565b509392505050565b62000b7e620010f2565b62000b8a828262001303565b5050565b62000b98620010f2565b62000ba460006200139e565b565b62000bb0620010f2565b620009c78585858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808902828101820190935288825290935088925087918291850190849080828437600092019190915250620013f092505050565b600062000c2c62001590565b600a5434101562000c765760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742066756e64732160681b604482015260640162000753565b8360648160ff16111562000cdb5760405162461bcd60e51b815260206004820152602560248201527f726f79616c74792070657263656e74206d7573742062652066726f6d2030207460448201526406f203130360dc1b606482015260840162000753565b600e5460ff161562000d305760405162461bcd60e51b815260206004820152601760248201527f54686520636f6e74726163742069732070617573656421000000000000000000604482015260640162000753565b600062000d3c60075490565b905062000d5b33828960405180602001604052806000815250620015ec565b62000d9d818a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506200170a92505050565b62000dac600780546001019055565b60085462000dc5906001600160a01b0316600162000f30565b6009546001600160a01b03161580159062000de257506000600a54115b801562000df15750600a544710155b1562000e5e57600954600a546040516000926001600160a01b031691908381818185875af1925050503d806000811462000e48576040519150601f19603f3d011682016040523d82523d6000602084013e62000e4d565b606091505b505090508062000e5c57600080fd5b505b84511562000eed5784516001141562000ea05762000e9a818660008151811062000e8c5762000e8c62002672565b602002602001015162001303565b62000eed565b6000858560405162000eb29062001cfa565b62000ebf929190620026a6565b604051809103906000f08015801562000edc573d6000803e3d6000fd5b50905062000eeb828262001303565b505b6000818152601160205260409020805460ff191660ff88161790556001600455915062000f179050565b9695505050505050565b60068054620007bf906200258c565b6003546001600160a01b031633141562000f515762000b8a3383836200172b565b62000b8a338360016200172b565b62000f69620010f2565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b62000f95620010f2565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b62000fc1620010f2565b62000fce8383836200180e565b505050565b6001600160a01b03851633148062000ff2575062000ff2853362000673565b620010115760405162461bcd60e51b8152600401620007539062002624565b620009c785858585856200191d565b6200102a620010f2565b6001600160a01b038116620010915760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000753565b6200109c816200139e565b50565b60006001600160e01b03198216636cdb3d1360e11b1480620010d157506001600160e01b031982166303a24d0760e21b145b80620007aa57506301ffc9a760e01b6001600160e01b0319831614620007aa565b6003546001600160a01b0316331462000ba45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000753565b8151835114620011725760405162461bcd60e51b8152600401620007539062002700565b6001600160a01b0384166200119b5760405162461bcd60e51b8152600401620007539062002748565b3360005b845181101562001291576000858281518110620011c057620011c062002672565b602002602001015190506000858381518110620011e157620011e162002672565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015620012345760405162461bcd60e51b815260040162000753906200278d565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929062001273908490620027d7565b9250508190555050505080620012899062002688565b90506200119f565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051620012e3929190620027f2565b60405180910390a4620012fb81878787878762001a55565b505050505050565b6001600160a01b038116620013705760405162461bcd60e51b815260206004820152602c60248201527f526f79616c746965733a206e657720726563697069656e74206973207468652060448201526b7a65726f206164647265737360a01b606482015260840162000753565b60009182526010602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038316620014195760405162461bcd60e51b8152600401620007539062002824565b80518251146200143d5760405162461bcd60e51b8152600401620007539062002700565b604080516020810190915260009081905233905b83518110156200152057600084828151811062001472576200147262002672565b60200260200101519050600084838151811062001493576200149362002672565b602090810291909101810151600084815280835260408082206001600160a01b038c168352909352919091205490915081811015620014e65760405162461bcd60e51b8152600401620007539062002867565b6000928352602083815260408085206001600160a01b038b1686529091529092209103905580620015178162002688565b91505062001451565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb868660405162001573929190620027f2565b60405180910390a460408051602081019091526000905250505050565b60026004541415620015e55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162000753565b6002600455565b6001600160a01b0384166200164e5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840162000753565b3360006200165c8562001bd5565b905060006200166b8562001bd5565b90506000868152602081815260408083206001600160a01b038b168452909152812080548792906200169f908490620027d7565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4620017018360008989898962001c23565b50505050505050565b6000828152600f60209081526040909120825162000fce9284019062001d08565b816001600160a01b0316836001600160a01b03161415620017a15760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b606482015260840162000753565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038316620018375760405162461bcd60e51b8152600401620007539062002824565b336000620018458462001bd5565b90506000620018548462001bd5565b60408051602080820183526000918290528882528181528282206001600160a01b038b1683529052205490915084811015620018a45760405162461bcd60e51b8152600401620007539062002867565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a460408051602081019091526000905262001701565b6001600160a01b038416620019465760405162461bcd60e51b8152600401620007539062002748565b336000620019548562001bd5565b90506000620019638562001bd5565b90506000868152602081815260408083206001600160a01b038c16845290915290205485811015620019a95760405162461bcd60e51b815260040162000753906200278d565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290620019e8908490620027d7565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a462001a4a848a8a8a8a8a62001c23565b505050505050505050565b6001600160a01b0384163b15620012fb5760405163bc197c8160e01b81526001600160a01b0385169063bc197c819062001a9c9089908990889088908890600401620028ab565b602060405180830381600087803b15801562001ab757600080fd5b505af192505050801562001aea575060408051601f3d908101601f1916820190925262001ae7918101906200290f565b60015b62001ba25762001af96200292f565b806308c379a0141562001b3a575062001b116200294c565b8062001b1e575062001b3c565b8060405162461bcd60e51b815260040162000753919062001e86565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b606482015260840162000753565b6001600160e01b0319811663bc197c8160e01b14620017015760405162461bcd60e51b81526004016200075390620029dc565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811062001c125762001c1262002672565b602090810291909101015292915050565b6001600160a01b0384163b15620012fb5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619062001c6a908990899088908890889060040162002a24565b602060405180830381600087803b15801562001c8557600080fd5b505af192505050801562001cb8575060408051601f3d908101601f1916820190925262001cb5918101906200290f565b60015b62001cc75762001af96200292f565b6001600160e01b0319811663f23a6e6160e01b14620017015760405162461bcd60e51b81526004016200075390620029dc565b6112988062002a6c83390190565b82805462001d16906200258c565b90600052602060002090601f01602090048101928262001d3a576000855562001d85565b82601f1062001d5557805160ff191683800117855562001d85565b8280016001018555821562001d85579182015b8281111562001d8557825182559160200191906001019062001d68565b5062001d9392915062001d97565b5090565b5b8082111562001d93576000815560010162001d98565b80356001600160a01b038116811462001dc657600080fd5b919050565b6000806040838503121562001ddf57600080fd5b62001dea8362001dae565b946020939093013593505050565b6001600160e01b0319811681146200109c57600080fd5b60006020828403121562001e2257600080fd5b813562001e2f8162001df8565b9392505050565b6000815180845260005b8181101562001e5e5760208185018101518683018201520162001e40565b8181111562001e71576000602083870101525b50601f01601f19169290920160200192915050565b60208152600062001e2f602083018462001e36565b60006020828403121562001eae57600080fd5b5035919050565b8035801515811462001dc657600080fd5b60006020828403121562001ed957600080fd5b62001e2f8262001eb5565b6000806040838503121562001ef857600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff8111828210171562001f465762001f4662001f07565b6040525050565b600067ffffffffffffffff82111562001f6a5762001f6a62001f07565b5060051b60200190565b600082601f83011262001f8657600080fd5b8135602062001f958262001f4d565b60405162001fa4828262001f1d565b83815260059390931b850182019282810191508684111562001fc557600080fd5b8286015b8481101562001fe2578035835291830191830162001fc9565b509695505050505050565b600082601f83011262001fff57600080fd5b813567ffffffffffffffff8111156200201c576200201c62001f07565b60405162002035601f8301601f19166020018262001f1d565b8181528460208386010111156200204b57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156200208157600080fd5b6200208c8662001dae565b94506200209c6020870162001dae565b9350604086013567ffffffffffffffff80821115620020ba57600080fd5b620020c889838a0162001f74565b94506060880135915080821115620020df57600080fd5b620020ed89838a0162001f74565b935060808801359150808211156200210457600080fd5b50620021138882890162001fed565b9150509295509295909350565b6000602082840312156200213357600080fd5b62001e2f8262001dae565b803560ff8116811462001dc657600080fd5b600080604083850312156200216457600080fd5b8235915062002176602084016200213e565b90509250929050565b600082601f8301126200219157600080fd5b81356020620021a08262001f4d565b604051620021af828262001f1d565b83815260059390931b8501820192828101915086841115620021d057600080fd5b8286015b8481101562001fe257620021e88162001dae565b8352918301918301620021d4565b600080604083850312156200220a57600080fd5b823567ffffffffffffffff808211156200222357600080fd5b62002231868387016200217f565b935060208501359150808211156200224857600080fd5b50620022578582860162001f74565b9150509250929050565b600081518084526020808501945080840160005b83811015620022935781518752958201959082019060010162002275565b509495945050505050565b60208152600062001e2f602083018462002261565b60008060408385031215620022c757600080fd5b82359150620021766020840162001dae565b60008083601f840112620022ec57600080fd5b50813567ffffffffffffffff8111156200230557600080fd5b6020830191508360208260051b85010111156200097357600080fd5b6000806000806000606086880312156200233a57600080fd5b620023458662001dae565b9450602086013567ffffffffffffffff808211156200236357600080fd5b6200237189838a01620022d9565b909650945060408801359150808211156200238b57600080fd5b506200239a88828901620022d9565b969995985093965092949392505050565b60008060008060008060a08789031215620023c557600080fd5b863567ffffffffffffffff80821115620023de57600080fd5b818901915089601f830112620023f357600080fd5b8135818111156200240357600080fd5b8a60208285010111156200241657600080fd5b6020838101995090975089013595506200243360408a016200213e565b945060608901359150808211156200244a57600080fd5b620024588a838b016200217f565b935060808901359150808211156200246f57600080fd5b506200247e89828a0162001f74565b9150509295509295509295565b600080604083850312156200249f57600080fd5b620024aa8362001dae565b9150620021766020840162001eb5565b600080600060608486031215620024d057600080fd5b620024db8462001dae565b95602085013595506040909401359392505050565b600080604083850312156200250457600080fd5b6200250f8362001dae565b9150620021766020840162001dae565b600080600080600060a086880312156200253857600080fd5b620025438662001dae565b9450620025536020870162001dae565b93506040860135925060608601359150608086013567ffffffffffffffff8111156200257e57600080fd5b620021138882890162001fed565b600181811c90821680620025a157607f821691505b60208210811415620025c357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615620025fc57620025fc620025c9565b500290565b6000826200261f57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200269f576200269f620025c9565b5060010190565b604080825283519082018190526000906020906060840190828701845b82811015620026ea5781516001600160a01b031684529284019290840190600101620026c3565b5050508381038285015262000f17818662002261565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60008219821115620027ed57620027ed620025c9565b500190565b60408152600062002807604083018562002261565b82810360208401526200281b818562002261565b95945050505050565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604082015263616e636560e01b606082015260800190565b6001600160a01b0386811682528516602082015260a060408201819052600090620028d99083018662002261565b8281036060840152620028ed818662002261565b9050828103608084015262002903818562001e36565b98975050505050505050565b6000602082840312156200292257600080fd5b815162001e2f8162001df8565b600060033d1115620029495760046000803e5060005160e01c5b90565b600060443d10156200295b5790565b6040516003193d81016004833e81513d67ffffffffffffffff81602484011181841117156200298c57505050505090565b8285019150815181811115620029a55750505050505090565b843d8701016020828501011115620029c05750505050505090565b620029d16020828601018762001f1d565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009062002a609083018462001e36565b97965050505050505056fe6080604052604051620012983803806200129883398101604081905262000026916200042e565b8051825114620000985760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b60648201526084015b60405180910390fd5b6000825111620000eb5760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e7453706c69747465723a206e6f2070617965657300000000000060448201526064016200008f565b60005b82518110156200015757620001428382815181106200011157620001116200050c565b60200260200101518383815181106200012e576200012e6200050c565b60200260200101516200016060201b60201c565b806200014e8162000538565b915050620000ee565b50505062000571565b6001600160a01b038216620001cd5760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b60648201526084016200008f565b600081116200021f5760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a2073686172657320617265203000000060448201526064016200008f565b6001600160a01b038216600090815260026020526040902054156200029b5760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b60648201526084016200008f565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b0384169081179091556000908152600260205260408120829055546200030390829062000556565b600055604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200038d576200038d6200034c565b604052919050565b60006001600160401b03821115620003b157620003b16200034c565b5060051b60200190565b600082601f830112620003cd57600080fd5b81516020620003e6620003e08362000395565b62000362565b82815260059290921b840181019181810190868411156200040657600080fd5b8286015b848110156200042357805183529183019183016200040a565b509695505050505050565b600080604083850312156200044257600080fd5b82516001600160401b03808211156200045a57600080fd5b818501915085601f8301126200046f57600080fd5b8151602062000482620003e08362000395565b82815260059290921b84018101918181019089841115620004a257600080fd5b948201945b83861015620004d95785516001600160a01b0381168114620004c95760008081fd5b82529482019490820190620004a7565b91880151919650909350505080821115620004f357600080fd5b506200050285828601620003bb565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156200054f576200054f62000522565b5060010190565b600082198211156200056c576200056c62000522565b500190565b610d1780620005816000396000f3fe6080604052600436106100c65760003560e01c80639852595c1161007f578063c45ac05011610059578063c45ac05014610283578063ce7c2ac2146102a3578063d79779b2146102d9578063e33b7de31461030f57600080fd5b80639852595c1461020d578063a3f8eace14610243578063a522ad251461026357600080fd5b806301ba5fc11461011457806319165587146101385780633a98ef391461015a578063406072a91461016f57806348b75044146101b55780638b83209b146101d557600080fd5b3661010f577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b34801561012057600080fd5b506004545b6040519081526020015b60405180910390f35b34801561014457600080fd5b50610158610153366004610a8f565b610324565b005b34801561016657600080fd5b50600054610125565b34801561017b57600080fd5b5061012561018a366004610aac565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b3480156101c157600080fd5b506101586101d0366004610aac565b610411565b3480156101e157600080fd5b506101f56101f0366004610ae5565b61051f565b6040516001600160a01b03909116815260200161012f565b34801561021957600080fd5b50610125610228366004610a8f565b6001600160a01b031660009081526003602052604090205490565b34801561024f57600080fd5b5061012561025e366004610a8f565b61054f565b34801561026f57600080fd5b5061015861027e366004610aac565b610597565b34801561028f57600080fd5b5061012561029e366004610aac565b610600565b3480156102af57600080fd5b506101256102be366004610a8f565b6001600160a01b031660009081526002602052604090205490565b3480156102e557600080fd5b506101256102f4366004610a8f565b6001600160a01b031660009081526005602052604090205490565b34801561031b57600080fd5b50600154610125565b6001600160a01b0381166000908152600260205260409020546103625760405162461bcd60e51b815260040161035990610afe565b60405180910390fd5b600061036d8261054f565b90508061038c5760405162461bcd60e51b815260040161035990610b44565b806001600082825461039e9190610ba5565b90915550506001600160a01b03821660009081526003602052604090208054820190556103cb82826106da565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15050565b6001600160a01b0381166000908152600260205260409020546104465760405162461bcd60e51b815260040161035990610afe565b60006104528383610600565b9050806104715760405162461bcd60e51b815260040161035990610b44565b6001600160a01b03831660009081526005602052604081208054839290610499908490610ba5565b90915550506001600160a01b0380841660009081526006602090815260408083209386168352929052208054820190556104d48383836107f8565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b60006004828154811061053457610534610bbd565b6000918252602090912001546001600160a01b031692915050565b60008061055b60015490565b6105659047610ba5565b9050610590838261058b866001600160a01b031660009081526003602052604090205490565b61084a565b9392505050565b60006105a28261054f565b905060006105b08484610600565b9050811515806105bf57508015155b6105db5760405162461bcd60e51b815260040161035990610b44565b81156105ea576105ea83610324565b80156105fa576105fa8484610411565b50505050565b6001600160a01b03821660009081526005602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a082319060240160206040518083038186803b15801561065a57600080fd5b505afa15801561066e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106929190610bd3565b61069c9190610ba5565b6001600160a01b038086166000908152600660209081526040808320938816835292905220549091506106d2908490839061084a565b949350505050565b8047101561072a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610359565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610777576040519150601f19603f3d011682016040523d82523d6000602084013e61077c565b606091505b50509050806107f35760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610359565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526107f3908490610885565b600080546001600160a01b0385168252600260205260408220548391906108719086610bec565b61087b9190610c0b565b6106d29190610c2d565b60006108da826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109579092919063ffffffff16565b8051909150156107f357808060200190518101906108f89190610c44565b6107f35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610359565b60606106d2848460008585600080866001600160a01b0316858760405161097e9190610c92565b60006040518083038185875af1925050503d80600081146109bb576040519150601f19603f3d011682016040523d82523d6000602084013e6109c0565b606091505b50915091506109d1878383876109dc565b979650505050505050565b60608315610a48578251610a41576001600160a01b0385163b610a415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610359565b50816106d2565b6106d28383815115610a5d5781518083602001fd5b8060405162461bcd60e51b81526004016103599190610cae565b6001600160a01b0381168114610a8c57600080fd5b50565b600060208284031215610aa157600080fd5b813561059081610a77565b60008060408385031215610abf57600080fd5b8235610aca81610a77565b91506020830135610ada81610a77565b809150509250929050565b600060208284031215610af757600080fd5b5035919050565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008219821115610bb857610bb8610b8f565b500190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610be557600080fd5b5051919050565b6000816000190483118215151615610c0657610c06610b8f565b500290565b600082610c2857634e487b7160e01b600052601260045260246000fd5b500490565b600082821015610c3f57610c3f610b8f565b500390565b600060208284031215610c5657600080fd5b8151801515811461059057600080fd5b60005b83811015610c81578181015183820152602001610c69565b838111156105fa5750506000910152565b60008251610ca4818460208701610c66565b9190910192915050565b6020815260008251806020840152610ccd816040850160208701610c66565b601f01601f1916919091016040019291505056fea2646970667358221220b077e7427e9c4f9ba9e08b44c6e0afe5cdd55a3c08d066e1941f73261058cea064736f6c63430008090033a2646970667358221220a59c1416b374aaed6cdab043efda0d48eafe8aa42296f888bb50af31f64ea99564736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005d93f9196a3db019cd2d019bcb5d8f65724fbb4d000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000cb0d7e7e69c3c6121c8e8cf8292a786cc073b2e0000000000000000000000000000000000000000000000000000000000000000a
-----Decoded View---------------
Arg [0] : _marketplaceAddress (address): 0x5d93F9196A3dB019Cd2D019BcB5D8f65724fbb4D
Arg [1] : _WETH (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : _commissionAddress (address): 0xCb0D7e7E69C3c6121c8E8CF8292a786CC073b2E0
Arg [3] : _commissionPercent (uint256): 10
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000005d93f9196a3db019cd2d019bcb5d8f65724fbb4d
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 000000000000000000000000cb0d7e7e69c3c6121c8e8cf8292a786cc073b2e0
Arg [3] : 000000000000000000000000000000000000000000000000000000000000000a
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.