Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
104 GCAT
Holders
39
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 GCATLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
GrittyCats
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./BBPCCreator.sol"; import "./RoyaltySplits.sol"; /** * * ██████╗ ██████╗ ██╗████████╗████████╗██╗ ██╗ * ██╔════╝ ██╔══██╗██║╚══██╔══╝╚══██╔══╝╚██╗ ██╔╝ * ██║ ███╗██████╔╝██║ ██║ ██║ ╚████╔╝ * ██║ ██║██╔══██╗██║ ██║ ██║ ╚██╔╝ * ╚██████╔╝██║ ██║██║ ██║ ██║ ██║ * ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ * ██████╗ █████╗ ████████╗███████╗ * ██╔════╝██╔══██╗╚══██╔══╝██╔════╝ * ██║ ███████║ ██║ ███████╗ * ██║ ██╔══██║ ██║ ╚════██║ * ╚██████╗██║ ██║ ██║ ███████║ * ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ * * Block Block Punch Click * https://www.grittycats.com * */ contract GrittyCats is RoyaltySplits, BBPCCreator { constructor( string memory _baseURI, uint256 _maxPresaleMint, uint256 _maxPublicMint, uint256 _maxSupply, uint256 _reserveAmount ) BBPCCreator( "GrittyCats", "GCAT", _baseURI, _maxPresaleMint, _maxPublicMint, _maxSupply, _reserveAmount, addresses, splits ) {} }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; /// @author Block Block Punch Click (blockblockpunchclick.com) import "erc721a/contracts/ERC721A.sol"; import "./libs/BetterBoolean.sol"; import "./libs/SafeAddress.sol"; import "./libs/ABDKMath64x64.sol"; import "./security/ContractGuardian.sol"; import "./finance/LockedPaymentSplitter.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; /// @dev Errors /** * @notice Insufficient balance for transfer. Needed `required` but only `available` available. * @param available balance available. * @param required requested amount to transfer. */ error InsufficientBalance(uint256 available, uint256 required); /** * @notice Maximum mints exceeded. Allowed `allowed` but trying to mint `trying`. * @param trying total trying to mint. * @param allowed allowed amount to mint per wallet. */ error MaxPerWalletCap(uint256 trying, uint256 allowed); /** * @notice Maximum supply exceeded. Allowed `allowed` but trying to mint `trying`. * @param trying total trying to mint. * @param allowed allowed amount to mint per wallet. */ error MaxSupplyExceeded(uint256 trying, uint256 allowed); /** * @notice Not allowed. Address is not allowed. * @param _address wallet address checked. */ error NotAllowed(address _address); /** * @notice Token does not exist. * @param tokenId token id checked. */ error DoesNotExist(uint256 tokenId); /** * @title BBPCCreator * @author Block Block Punch Click (blockblockpunchclick.com) * @dev Standard ERC721A implementation * * ERC721A NFT contract, with a presale phase (paid tokens). * * In addition to using ERC721A, gas is optimized via Merkle Trees, boolean packing * and use of constants where possible. */ abstract contract BBPCCreator is Context, Ownable, ContractGuardian, ReentrancyGuard, LockedPaymentSplitter, ERC721A { enum Status { Pending, PreSale, PublicSale, Finished } using SafeAddress for address; using ABDKMath64x64 for uint; using BetterBoolean for uint256; using SafeMath for uint256; using Strings for uint256; using ECDSA for bytes32; Status public status; uint256 public constant MAX_PER_TRANSACTION = 9; uint256 public constant MAX_PER_WALLET_LIMIT = 500; string public baseURI; string public provenanceHash; uint256 public tokensReserved; uint256 public mintCost = 0.07 ether; uint256 public immutable reserveAmount; uint256 public immutable maxPresaleMint; uint256 public immutable maxPublicMint; uint256 public immutable maxBatchSize; uint256 public immutable maxSupply; bool public metadataRevealed; bool public metadataFinalised; mapping(address => uint256) private _mintedPerAddress; /// @dev Merkle root bytes32 internal rootHash; /// @dev Events event PermanentURI(string _value, uint256 indexed _id); event TokensMinted(address indexed mintedBy, uint256 indexed tokensNumber); event BaseUriUpdated(string oldBaseUri, string newBaseUri); event CostUpdated(uint256 oldCost, uint256 newCost); event PresaleListInitialized(address indexed admin, bytes32 rootHash); event ReservedToken(address minter, address recipient, uint256 amount); event StatusChanged(Status status); constructor( string memory __name, string memory __symbol, string memory __baseURI, uint256 _maxPresaleMint, uint256 _maxPublicMint, uint256 _maxSupply, uint256 _reserveAmount, address[] memory __addresses, uint256[] memory __splits ) ERC721A(__name, __symbol) SlimPaymentSplitter(__addresses, __splits) { baseURI = __baseURI; maxPresaleMint = _maxPresaleMint; maxPublicMint = _maxPublicMint; maxSupply = _maxSupply; maxBatchSize = _maxPresaleMint > _maxPublicMint ? _maxPresaleMint : _maxPublicMint; reserveAmount = _reserveAmount; } /** * @dev Throws if presale is NOT active. */ function _isPresaleActive() internal view { if (_msgSender() != owner()) { require(status == Status.PreSale, "Presale is not active."); } } /** * @dev Throws if public sale is NOT active. */ function _isPublicSaleActive() internal view { if (_msgSender() != owner()) { require(status == Status.PublicSale, "Public sale is not active."); } } /** * @dev Throws if the sender is not on the presale list */ function _isOnPresaleList(bytes32[] memory proof) internal view { bool isOnList = MerkleProof.verify( proof, rootHash, keccak256(abi.encodePacked(_msgSender())) ); if ( status != Status.PreSale || !(isOnList || _msgSender() == owner()) ) { revert NotAllowed(_msgSender()); } } /** * @dev Throws if max tokens per wallet */ function _isMaxTokensPerWallet(uint256 quantity) internal view { if (_msgSender() != owner()) { uint256 mintedBalance = _mintedPerAddress[_msgSender()]; uint256 currentMintingAmount = mintedBalance + quantity; if (currentMintingAmount > MAX_PER_WALLET_LIMIT) { revert MaxPerWalletCap( currentMintingAmount, MAX_PER_WALLET_LIMIT ); } } } /** * @dev Throws if the amount sent is not equal to the total cost. */ function _isCorrectAmountProvided(uint256 quantity) internal view { uint256 totalCost = quantity * mintCost; if (msg.value < totalCost && _msgSender() != owner()) { revert InsufficientBalance(msg.value, totalCost); } } /** * @dev Throws if the claim size is not valid */ function _isValidBatchSize(uint256 count) internal view { require( 0 < count && count <= maxBatchSize, "Max tokens per batch exceeded" ); } /** * @dev Throws if the total token number being minted is zero */ function _isMintingOne(uint256 quantity) internal pure { require(quantity > 0, "Must mint at least 1 token"); } /** * @dev Throws if the total token number being minted is zero */ function _isNotRevealed() internal view { require(!metadataRevealed, "Must not be revealed"); } /** * @dev Throws if the total being minted is greater than the max supply */ function _isLessThanMaxSupply(uint256 quantity) internal view { if (totalSupply() + quantity > maxSupply) { revert MaxSupplyExceeded(totalSupply() + quantity, maxSupply); } } /** * @dev Handles refunding the buter if the value is greater than the mint cost */ function _refundIfOver(uint256 price) private { require(msg.value >= price, "Need to send more ETH."); if (msg.value > price) { payable(msg.sender).transfer(msg.value - price); } } /** * @dev Mint function for reserved tokens. */ function _internalMintTokens(address minter, uint256 quantity) internal { _isLessThanMaxSupply(quantity); _safeMint(minter, quantity); } /** * @notice Reserve token(s) to multiple team members. * * @param frens addresses to send tokens to * @param quantity the number of tokens to mint. */ function reserve(address[] memory frens, uint256 quantity) external onlyOwner { _isMintingOne(quantity); _isValidBatchSize(quantity); _isLessThanMaxSupply(quantity); uint256 idx; for (idx = 0; idx < frens.length; idx++) { require(frens[idx] != address(0), "Zero address"); _internalMintTokens(frens[idx], quantity); tokensReserved += quantity; emit ReservedToken(msg.sender, frens[idx], quantity); } } /** * @notice Reserve multiple tokens to a single team member. * * @param fren address to send tokens to * @param quantity the number of tokens to mint. */ function reserveSingle(address fren, uint256 quantity) external onlyOwner { _isMintingOne(quantity); _isValidBatchSize(quantity); _isLessThanMaxSupply(quantity); uint256 multiple = quantity / maxBatchSize; for (uint256 i = 0; i < multiple; i++) { _internalMintTokens(fren, maxBatchSize); } uint256 remainder = quantity % maxBatchSize; if (remainder != 0) { _internalMintTokens(fren, remainder); } tokensReserved += quantity; emit ReservedToken(msg.sender, fren, quantity); } /** * @dev The presale mint function. * @param quantity Total number of tokens to mint. * @param proof Cryptographic proof checked to see if the wallet address is allowed. */ function mintPresale(uint256 quantity, bytes32[] memory proof) public payable nonReentrant onlyUsers { _isMintingOne(quantity); _isOnPresaleList(proof); _isMaxTokensPerWallet(quantity); _isCorrectAmountProvided(quantity); _isLessThanMaxSupply(quantity); if (_msgSender() != owner()) { _mintedPerAddress[_msgSender()] += quantity; } // _safeMint's second argument now takes in a quantity, not a tokenId. _safeMint(msg.sender, quantity); if (_msgSender() != owner()) { _refundIfOver(mintCost * quantity); } emit TokensMinted(_msgSender(), quantity); } /** * @dev The public mint function. * @param quantity Total number of tokens to mint. */ function mint(uint256 quantity) public payable nonReentrant onlyUsers { _isPublicSaleActive(); _isMaxTokensPerWallet(quantity); _isCorrectAmountProvided(quantity); _isMintingOne(quantity); _isLessThanMaxSupply(quantity); if (_msgSender() != owner()) { _mintedPerAddress[_msgSender()] += quantity; } // _safeMint's second argument now takes in a quantity, not a tokenId. _safeMint(msg.sender, quantity); if (_msgSender() != owner()) { _refundIfOver(mintCost * quantity); } emit TokensMinted(_msgSender(), quantity); } /** * @dev Proves fair generation and distribution. * @param _provenanceHash hash composed from all the hashes of all the NFTs, in order, with * which you can verify that the set is the exact same as the ones that we’ve generated. */ function setProvenanceHash(string memory _provenanceHash) public onlyOwner { _isNotRevealed(); require( bytes(provenanceHash).length == 0, "Provenance hash already set" ); provenanceHash = _provenanceHash; } /** * @dev Set the presale list * @param _rootHash Root hash of the Merkle tree */ function setPresaleList(bytes32 _rootHash) public onlyOwner { rootHash = _rootHash; emit PresaleListInitialized(_msgSender(), rootHash); } /** * @dev Check to see if the address is on the presale list. * @param claimer The address trying to claim the tokens. * @param proof Merkle proof of the claimer. */ function onPresaleList(address claimer, bytes32[] memory proof) external view returns (bool) { return MerkleProof.verify( proof, rootHash, keccak256(abi.encodePacked(claimer)) ); } /** * @dev Set the base URI for the tokens * @param baseURI_ Base URI for the token */ function setBaseURI(string memory baseURI_) external onlyOwner { require(!metadataFinalised, "Metadata already revealed"); string memory _currentURI = baseURI; baseURI = baseURI_; emit BaseUriUpdated(_currentURI, baseURI_); } /** * @notice This is a mint cost override * @dev Handles setting the mint cost * @param _newCost is the new cost to associate with minting */ function setMintCost(uint256 _newCost) public onlyOwner { uint256 currentCost = mintCost; mintCost = _newCost; emit CostUpdated(currentCost, _newCost); } /** * @dev Retrieves the token information * @param tokenId is the token id to retrieve data for */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "No token"); string memory baseURI_ = _baseURI(); require(bytes(baseURI_).length > 0, "Base unset"); return metadataRevealed && bytes(baseURI_).length != 0 ? string(abi.encodePacked(baseURI_, tokenId.toString())) : baseURI_; } /** * @dev Handles hiding the pre-reveal metadata and revealing the final metadata. */ function revealMetadata() public onlyOwner { require(bytes(provenanceHash).length > 0, "Provenance hash not set"); require(!metadataRevealed, "Metadata already revealed"); metadataRevealed = true; } /** * @dev Handles updating the status */ function setStatus(Status _status) external onlyOwner { status = _status; emit StatusChanged(_status); } /** * @dev Ensures the baseURI can no longer be set */ function finalizeMetadata() public onlyOwner { require(!metadataFinalised, "Metadata already finalised"); metadataFinalised = true; } /** * @dev Fetches the baseURI */ function _baseURI() internal view override returns (string memory) { return baseURI; } function getOwnershipData(uint256 tokenId) external view returns (TokenOwnership memory) { return _ownershipOf(tokenId); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; /// @author Block Block Punch Click (blockblockpunchclick.com) contract RoyaltySplits { address[] internal addresses = [ 0x39fe417823d976AD135CdbDC5881b75A7cEA0c24, // founder 0x9262890D8f137501AAC2bEe8720D4177F2d1543b, // production 0xB03dD45C61ABE74b10148F049C2Cca3098Ef50BF // developer ]; uint256[] internal splits = [58, 21, 21]; }
// SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Context.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error ApproveToCaller(); error ApprovalToCurrentOwner(); error BalanceQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerQueryForNonexistentToken(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } // The tokenId of the next token to be minted. uint256 internal _currentIndex; // The number of tokens burned. uint256 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * To change the starting tokenId, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. */ function totalSupply() public view returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to _startTokenId() unchecked { return _currentIndex - _startTokenId(); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberBurned); } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return _addressData[owner].aux; } /** * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { _addressData[owner].aux = aux; } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr && curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721A.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { _transfer(from, to, tokenId); if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (safe && to.isContract()) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex != end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex != end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = to; currSlot.startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev This is equivalent to _burn(tokenId, false) */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; if (approvalCheck) { bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { AddressData storage addressData = _addressData[from]; addressData.balance -= 1; addressData.numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = from; currSlot.startTimestamp = uint64(block.timestamp); currSlot.burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @title BetterBoolean * @author Block Block Punch Click (blockblockpunchclick.com) * @dev Credit to Zimri Leijen * See https://ethereum.stackexchange.com/a/92235 */ library BetterBoolean { function getBoolean(uint256 _packedBools, uint256 _columnNumber) internal pure returns (bool) { uint256 flag = (_packedBools >> _columnNumber) & uint256(1); return (flag == 1 ? true : false); } function setBoolean( uint256 _packedBools, uint256 _columnNumber, bool _value ) internal pure returns (uint256) { if (_value) { _packedBools = _packedBools | (uint256(1) << _columnNumber); return _packedBools; } else { _packedBools = _packedBools & ~(uint256(1) << _columnNumber); return _packedBools; } } }
// SPDX-License-Identifier: BSD-4-Clause /* * Handles ensuring that the contract is being called by a user and not a contract. */ pragma solidity 0.8.4; library SafeAddress { function isContract(address account) internal view returns (bool) { uint size; assembly { size := extcodesize(account) } return size > 0; } }
// SPDX-License-Identifier: BSD-4-Clause /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <[email protected]> */ pragma solidity 0.8.4; /** * Smart contract library of mathematical functions operating with signed * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is * basically a simple fraction whose numerator is signed 128-bit integer and * denominator is 2^64. As long as denominator is always the same, there is no * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are * represented by int128 type holding only the numerator. */ library ABDKMath64x64 { /* * Minimum value signed 64.64-bit fixed point number may have. */ int128 private constant MIN_64x64 = -0x80000000000000000000000000000000; /* * Maximum value signed 64.64-bit fixed point number may have. */ int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Convert signed 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromInt(int256 x) internal pure returns (int128) { unchecked { require(x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF); return int128(x << 64); } } /** * Convert signed 64.64 fixed point number into signed 64-bit integer number * rounding down. * * @param x signed 64.64-bit fixed point number * @return signed 64-bit integer number */ function toInt(int128 x) internal pure returns (int64) { unchecked { return int64(x >> 64); } } /** * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromUInt(uint256 x) internal pure returns (int128) { unchecked { require(x <= 0x7FFFFFFFFFFFFFFF); return int128(int256(x << 64)); } } /** * Convert signed 64.64 fixed point number into unsigned 64-bit integer * number rounding down. Revert on underflow. * * @param x signed 64.64-bit fixed point number * @return unsigned 64-bit integer number */ function toUInt(int128 x) internal pure returns (uint64) { unchecked { require(x >= 0); return uint64(uint128(x >> 64)); } } /** * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point * number rounding down. Revert on overflow. * * @param x signed 128.128-bin fixed point number * @return signed 64.64-bit fixed point number */ function from128x128(int256 x) internal pure returns (int128) { unchecked { int256 result = x >> 64; require(result >= MIN_64x64 && result <= MAX_64x64); return int128(result); } } /** * Convert signed 64.64 fixed point number into signed 128.128 fixed point * number. * * @param x signed 64.64-bit fixed point number * @return signed 128.128 fixed point number */ function to128x128(int128 x) internal pure returns (int256) { unchecked { return int256(x) << 64; } } /** * Calculate x + y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function add(int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) + y; require(result >= MIN_64x64 && result <= MAX_64x64); return int128(result); } } /** * Calculate x - y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sub(int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) - y; require(result >= MIN_64x64 && result <= MAX_64x64); return int128(result); } } /** * Calculate x * y rounding down. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function mul(int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = (int256(x) * y) >> 64; require(result >= MIN_64x64 && result <= MAX_64x64); return int128(result); } } /** * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point * number and y is signed 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y signed 256-bit integer number * @return signed 256-bit integer number */ function muli(int128 x, int256 y) internal pure returns (int256) { unchecked { if (x == MIN_64x64) { require( y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && y <= 0x1000000000000000000000000000000000000000000000000 ); return -y << 63; } else { bool negativeResult = false; if (x < 0) { x = -x; negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint256 absoluteResult = mulu(x, uint256(y)); if (negativeResult) { require( absoluteResult <= 0x8000000000000000000000000000000000000000000000000000000000000000 ); return -int256(absoluteResult); // We rely on overflow behavior here } else { require( absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ); return int256(absoluteResult); } } } } /** * Calculate x * y rounding down, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y unsigned 256-bit integer number * @return unsigned 256-bit integer number */ function mulu(int128 x, uint256 y) internal pure returns (uint256) { unchecked { if (y == 0) return 0; require(x >= 0); uint256 lo = (uint256(int256(x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256(int256(x)) * (y >> 128); require(hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); hi <<= 64; require( hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo ); return hi + lo; } } /** * Calculate x / y rounding towards zero. Revert on overflow or when y is * zero. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function div(int128 x, int128 y) internal pure returns (int128) { unchecked { require(y != 0); int256 result = (int256(x) << 64) / y; require(result >= MIN_64x64 && result <= MAX_64x64); return int128(result); } } /** * Calculate x / y rounding towards zero, where x and y are signed 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x signed 256-bit integer number * @param y signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function divi(int256 x, int256 y) internal pure returns (int128) { unchecked { require(y != 0); bool negativeResult = false; if (x < 0) { x = -x; // We rely on overflow behavior here negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint128 absoluteResult = divuu(uint256(x), uint256(y)); if (negativeResult) { require(absoluteResult <= 0x80000000000000000000000000000000); return -int128(absoluteResult); // We rely on overflow behavior here } else { require(absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int128(absoluteResult); // We rely on overflow behavior here } } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function divu(uint256 x, uint256 y) internal pure returns (int128) { unchecked { require(y != 0); uint128 result = divuu(x, y); require(result <= uint128(MAX_64x64)); return int128(result); } } /** * Calculate -x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function neg(int128 x) internal pure returns (int128) { unchecked { require(x != MIN_64x64); return -x; } } /** * Calculate |x|. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function abs(int128 x) internal pure returns (int128) { unchecked { require(x != MIN_64x64); return x < 0 ? -x : x; } } /** * Calculate 1 / x rounding towards zero. Revert on overflow or when x is * zero. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function inv(int128 x) internal pure returns (int128) { unchecked { require(x != 0); int256 result = int256(0x100000000000000000000000000000000) / x; require(result >= MIN_64x64 && result <= MAX_64x64); return int128(result); } } /** * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function avg(int128 x, int128 y) internal pure returns (int128) { unchecked { return int128((int256(x) + int256(y)) >> 1); } } /** * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down. * Revert on overflow or in case x * y is negative. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function gavg(int128 x, int128 y) internal pure returns (int128) { unchecked { int256 m = int256(x) * int256(y); require(m >= 0); require( m < 0x4000000000000000000000000000000000000000000000000000000000000000 ); return int128(sqrtu(uint256(m))); } } /** * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y uint256 value * @return signed 64.64-bit fixed point number */ function pow(int128 x, uint256 y) internal pure returns (int128) { unchecked { bool negative = x < 0 && y & 1 == 1; uint256 absX = uint128(x < 0 ? -x : x); uint256 absResult; absResult = 0x100000000000000000000000000000000; if (absX <= 0x10000000000000000) { absX <<= 63; while (y != 0) { if (y & 0x1 != 0) { absResult = (absResult * absX) >> 127; } absX = (absX * absX) >> 127; if (y & 0x2 != 0) { absResult = (absResult * absX) >> 127; } absX = (absX * absX) >> 127; if (y & 0x4 != 0) { absResult = (absResult * absX) >> 127; } absX = (absX * absX) >> 127; if (y & 0x8 != 0) { absResult = (absResult * absX) >> 127; } absX = (absX * absX) >> 127; y >>= 4; } absResult >>= 64; } else { uint256 absXShift = 63; if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; } if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; } if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; } if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; } if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; } if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; } uint256 resultShift = 0; while (y != 0) { require(absXShift < 64); if (y & 0x1 != 0) { absResult = (absResult * absX) >> 127; resultShift += absXShift; if (absResult > 0x100000000000000000000000000000000) { absResult >>= 1; resultShift += 1; } } absX = (absX * absX) >> 127; absXShift <<= 1; if (absX >= 0x100000000000000000000000000000000) { absX >>= 1; absXShift += 1; } y >>= 1; } require(resultShift < 64); absResult >>= 64 - resultShift; } int256 result = negative ? -int256(absResult) : int256(absResult); require(result >= MIN_64x64 && result <= MAX_64x64); return int128(result); } } /** * Calculate sqrt (x) rounding down. Revert if x < 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sqrt(int128 x) internal pure returns (int128) { unchecked { require(x >= 0); return int128(sqrtu(uint256(int256(x)) << 64)); } } /** * Calculate binary logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function log_2(int128 x) internal pure returns (int128) { unchecked { require(x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 result = (msb - 64) << 64; uint256 ux = uint256(int256(x)) << uint256(127 - msb); for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) { ux *= ux; uint256 b = ux >> 255; ux >>= 127 + b; result += bit * int256(b); } return int128(result); } } /** * Calculate natural logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function ln(int128 x) internal pure returns (int128) { unchecked { require(x > 0); return int128( int256( (uint256(int256(log_2(x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF) >> 128 ) ); } } /** * Calculate binary exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp_2(int128 x) internal pure returns (int128) { unchecked { require(x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = (result * 0x16A09E667F3BCC908B2FB1366EA957D3E) >> 128; if (x & 0x4000000000000000 > 0) result = (result * 0x1306FE0A31B7152DE8D5A46305C85EDEC) >> 128; if (x & 0x2000000000000000 > 0) result = (result * 0x1172B83C7D517ADCDF7C8C50EB14A791F) >> 128; if (x & 0x1000000000000000 > 0) result = (result * 0x10B5586CF9890F6298B92B71842A98363) >> 128; if (x & 0x800000000000000 > 0) result = (result * 0x1059B0D31585743AE7C548EB68CA417FD) >> 128; if (x & 0x400000000000000 > 0) result = (result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8) >> 128; if (x & 0x200000000000000 > 0) result = (result * 0x10163DA9FB33356D84A66AE336DCDFA3F) >> 128; if (x & 0x100000000000000 > 0) result = (result * 0x100B1AFA5ABCBED6129AB13EC11DC9543) >> 128; if (x & 0x80000000000000 > 0) result = (result * 0x10058C86DA1C09EA1FF19D294CF2F679B) >> 128; if (x & 0x40000000000000 > 0) result = (result * 0x1002C605E2E8CEC506D21BFC89A23A00F) >> 128; if (x & 0x20000000000000 > 0) result = (result * 0x100162F3904051FA128BCA9C55C31E5DF) >> 128; if (x & 0x10000000000000 > 0) result = (result * 0x1000B175EFFDC76BA38E31671CA939725) >> 128; if (x & 0x8000000000000 > 0) result = (result * 0x100058BA01FB9F96D6CACD4B180917C3D) >> 128; if (x & 0x4000000000000 > 0) result = (result * 0x10002C5CC37DA9491D0985C348C68E7B3) >> 128; if (x & 0x2000000000000 > 0) result = (result * 0x1000162E525EE054754457D5995292026) >> 128; if (x & 0x1000000000000 > 0) result = (result * 0x10000B17255775C040618BF4A4ADE83FC) >> 128; if (x & 0x800000000000 > 0) result = (result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB) >> 128; if (x & 0x400000000000 > 0) result = (result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9) >> 128; if (x & 0x200000000000 > 0) result = (result * 0x10000162E43F4F831060E02D839A9D16D) >> 128; if (x & 0x100000000000 > 0) result = (result * 0x100000B1721BCFC99D9F890EA06911763) >> 128; if (x & 0x80000000000 > 0) result = (result * 0x10000058B90CF1E6D97F9CA14DBCC1628) >> 128; if (x & 0x40000000000 > 0) result = (result * 0x1000002C5C863B73F016468F6BAC5CA2B) >> 128; if (x & 0x20000000000 > 0) result = (result * 0x100000162E430E5A18F6119E3C02282A5) >> 128; if (x & 0x10000000000 > 0) result = (result * 0x1000000B1721835514B86E6D96EFD1BFE) >> 128; if (x & 0x8000000000 > 0) result = (result * 0x100000058B90C0B48C6BE5DF846C5B2EF) >> 128; if (x & 0x4000000000 > 0) result = (result * 0x10000002C5C8601CC6B9E94213C72737A) >> 128; if (x & 0x2000000000 > 0) result = (result * 0x1000000162E42FFF037DF38AA2B219F06) >> 128; if (x & 0x1000000000 > 0) result = (result * 0x10000000B17217FBA9C739AA5819F44F9) >> 128; if (x & 0x800000000 > 0) result = (result * 0x1000000058B90BFCDEE5ACD3C1CEDC823) >> 128; if (x & 0x400000000 > 0) result = (result * 0x100000002C5C85FE31F35A6A30DA1BE50) >> 128; if (x & 0x200000000 > 0) result = (result * 0x10000000162E42FF0999CE3541B9FFFCF) >> 128; if (x & 0x100000000 > 0) result = (result * 0x100000000B17217F80F4EF5AADDA45554) >> 128; if (x & 0x80000000 > 0) result = (result * 0x10000000058B90BFBF8479BD5A81B51AD) >> 128; if (x & 0x40000000 > 0) result = (result * 0x1000000002C5C85FDF84BD62AE30A74CC) >> 128; if (x & 0x20000000 > 0) result = (result * 0x100000000162E42FEFB2FED257559BDAA) >> 128; if (x & 0x10000000 > 0) result = (result * 0x1000000000B17217F7D5A7716BBA4A9AE) >> 128; if (x & 0x8000000 > 0) result = (result * 0x100000000058B90BFBE9DDBAC5E109CCE) >> 128; if (x & 0x4000000 > 0) result = (result * 0x10000000002C5C85FDF4B15DE6F17EB0D) >> 128; if (x & 0x2000000 > 0) result = (result * 0x1000000000162E42FEFA494F1478FDE05) >> 128; if (x & 0x1000000 > 0) result = (result * 0x10000000000B17217F7D20CF927C8E94C) >> 128; if (x & 0x800000 > 0) result = (result * 0x1000000000058B90BFBE8F71CB4E4B33D) >> 128; if (x & 0x400000 > 0) result = (result * 0x100000000002C5C85FDF477B662B26945) >> 128; if (x & 0x200000 > 0) result = (result * 0x10000000000162E42FEFA3AE53369388C) >> 128; if (x & 0x100000 > 0) result = (result * 0x100000000000B17217F7D1D351A389D40) >> 128; if (x & 0x80000 > 0) result = (result * 0x10000000000058B90BFBE8E8B2D3D4EDE) >> 128; if (x & 0x40000 > 0) result = (result * 0x1000000000002C5C85FDF4741BEA6E77E) >> 128; if (x & 0x20000 > 0) result = (result * 0x100000000000162E42FEFA39FE95583C2) >> 128; if (x & 0x10000 > 0) result = (result * 0x1000000000000B17217F7D1CFB72B45E1) >> 128; if (x & 0x8000 > 0) result = (result * 0x100000000000058B90BFBE8E7CC35C3F0) >> 128; if (x & 0x4000 > 0) result = (result * 0x10000000000002C5C85FDF473E242EA38) >> 128; if (x & 0x2000 > 0) result = (result * 0x1000000000000162E42FEFA39F02B772C) >> 128; if (x & 0x1000 > 0) result = (result * 0x10000000000000B17217F7D1CF7D83C1A) >> 128; if (x & 0x800 > 0) result = (result * 0x1000000000000058B90BFBE8E7BDCBE2E) >> 128; if (x & 0x400 > 0) result = (result * 0x100000000000002C5C85FDF473DEA871F) >> 128; if (x & 0x200 > 0) result = (result * 0x10000000000000162E42FEFA39EF44D91) >> 128; if (x & 0x100 > 0) result = (result * 0x100000000000000B17217F7D1CF79E949) >> 128; if (x & 0x80 > 0) result = (result * 0x10000000000000058B90BFBE8E7BCE544) >> 128; if (x & 0x40 > 0) result = (result * 0x1000000000000002C5C85FDF473DE6ECA) >> 128; if (x & 0x20 > 0) result = (result * 0x100000000000000162E42FEFA39EF366F) >> 128; if (x & 0x10 > 0) result = (result * 0x1000000000000000B17217F7D1CF79AFA) >> 128; if (x & 0x8 > 0) result = (result * 0x100000000000000058B90BFBE8E7BCD6D) >> 128; if (x & 0x4 > 0) result = (result * 0x10000000000000002C5C85FDF473DE6B2) >> 128; if (x & 0x2 > 0) result = (result * 0x1000000000000000162E42FEFA39EF358) >> 128; if (x & 0x1 > 0) result = (result * 0x10000000000000000B17217F7D1CF79AB) >> 128; result >>= uint256(int256(63 - (x >> 64))); require(result <= uint256(int256(MAX_64x64))); return int128(int256(result)); } } /** * Calculate natural exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp(int128 x) internal pure returns (int128) { unchecked { require(x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow return exp_2( int128( (int256(x) * 0x171547652B82FE1777D0FFDA0D23A7D12) >> 128 ) ); } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return unsigned 64.64-bit fixed point number */ function divuu(uint256 x, uint256 y) private pure returns (uint128) { unchecked { require(y != 0); uint256 result; if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) result = (x << 64) / y; else { uint256 msb = 192; uint256 xc = x >> 192; if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore result = (x << (255 - msb)) / (((y - 1) >> (msb - 191)) + 1); require(result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 hi = result * (y >> 128); uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 xh = x >> 192; uint256 xl = x << 64; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here lo = hi << 128; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here assert(xh == hi >> 128); result += xl / y; } require(result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return uint128(result); } } /** * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer * number. * * @param x unsigned 256-bit integer number * @return unsigned 128-bit integer number */ function sqrtu(uint256 x) private pure returns (uint128) { unchecked { if (x == 0) return 0; else { uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x8) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return uint128(r < r1 ? r : r1); } } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @title ContractGuardian * @dev Helper contract to help protect against contract based mint spamming attacks. */ abstract contract ContractGuardian { modifier onlyUsers() { require(tx.origin == msg.sender, "Must be user"); _; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./SlimPaymentSplitter.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @title LockedPaymentSplitter * @author @NiftyMike, NFT Culture * @dev A wrapper around SlimPaymentSplitter which adds on security elements. * * Based on OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol) */ abstract contract LockedPaymentSplitter is SlimPaymentSplitter, Ownable { /** * @dev Overrides release() method, so that it can only be called by owner. * @notice Owner: Release funds to a specific address. * * @param account Payable address that will receive funds. */ function release(address payable account) public override onlyOwner { super.release(account); } /** * @dev Triggers a transfer to caller's address of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. * @notice Sender: request payment. */ function releaseToSelf() public { super.release(payable(msg.sender)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { 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 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/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 } 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"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' 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) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ 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. 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 if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } 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; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 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 (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // 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 v4.4.1 (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } return computedHash; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly 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/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// 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 pragma solidity 0.8.4; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; /** * @title SlimPaymentSplitter * @author @NiftyMike, NFT Culture (original) * @author Block Block Punch Click (blockblockpunchclick.com) (revised) minimized gas costs via shorter errors * @dev A drop-in slim replacement version of OZ's Payment Splitter. All ERC-20 token functionality removed. * * Based on OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol) */ contract SlimPaymentSplitter is Context { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event AllPaymentsReleased(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; /** * @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, "payees and shares mismatch"); require(payees.length > 0, "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 number of payees. */ function totalPayees() public view returns (uint256) { return _payees.length; } /** * @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 address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @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, "account has no shares"); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, "account is not due payment"); _released[account] += payment; _totalReleased += payment; Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a release for all of the accounts in the royalty pool. */ function releaseAll() public { uint256 total = totalPayees(); address[] memory _tos = new address[](total); uint256[] memory _amounts = new uint256[](total); for (uint256 i = 0; i < total; i++) { address payable to = payable(_payees[i]); uint256 amount = _shares[to]; require(amount != uint256(0), "Share amount is zero"); _amounts[i] = amount; _tos[i] = to; release(to); } emit AllPaymentsReleased(_tos, _amounts); } /** * @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), "account is the zero address"); require(shares_ > 0, "shares are 0"); require(_shares[account] == 0, "account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"},{"internalType":"uint256","name":"_maxPresaleMint","type":"uint256"},{"internalType":"uint256","name":"_maxPublicMint","type":"uint256"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_reserveAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"required","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"trying","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"MaxPerWalletCap","type":"error"},{"inputs":[{"internalType":"uint256","name":"trying","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"NotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"to","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amount","type":"uint256[]"}],"name":"AllPaymentsReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"oldBaseUri","type":"string"},{"indexed":false,"internalType":"string","name":"newBaseUri","type":"string"}],"name":"BaseUriUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCost","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCost","type":"uint256"}],"name":"CostUpdated","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":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_value","type":"string"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"PermanentURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes32","name":"rootHash","type":"bytes32"}],"name":"PresaleListInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReservedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum BBPCCreator.Status","name":"status","type":"uint8"}],"name":"StatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"mintedBy","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokensNumber","type":"uint256"}],"name":"TokensMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_PER_TRANSACTION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PER_WALLET_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalizeMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getOwnershipData","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"}],"internalType":"struct ERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPresaleMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPublicMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataFinalised","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataRevealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mintPresale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"claimer","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"onPresaleList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"releaseAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"releaseToSelf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"frens","type":"address[]"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"reserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"fren","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"reserveSingle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newCost","type":"uint256"}],"name":"setMintCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_rootHash","type":"bytes32"}],"name":"setPresaleList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_provenanceHash","type":"string"}],"name":"setProvenanceHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum BBPCCreator.Status","name":"_status","type":"uint8"}],"name":"setStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"status","outputs":[{"internalType":"enum BBPCCreator.Status","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensReserved","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPayees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6101806040527339fe417823d976ad135cdbdc5881b75a7cea0c24610120908152739262890d8f137501aac2bee8720d4177f2d1543b6101405273b03dd45c61abe74b10148f049c2cca3098ef50bf610160526200006290600090600362000590565b5060408051606081018252603a81526015602082018190529181019190915262000091906001906003620005fa565b5066f8b0a10e470000601555348015620000aa57600080fd5b506040516200429638038062004296833981016040819052620000cd91620006d1565b6040518060400160405280600a8152602001694772697474794361747360b01b8152506040518060400160405280600481526020016311d0d05560e21b815250868686868660008054806020026020016040519081016040528092919081815260200182805480156200016a57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116200014b575b50505050506001805480602002602001604051908101604052809291908181526020018280548015620001bd57602002820191906000526020600020905b815481526020019060010190808311620001a8575b50505050508888838380518251146200021d5760405162461bcd60e51b815260206004820152601a60248201527f70617965657320616e6420736861726573206d69736d6174636800000000000060448201526064015b60405180910390fd5b60008251116200025c5760405162461bcd60e51b81526020600482015260096024820152686e6f2070617965657360b81b604482015260640162000214565b60005b8251811015620002e057620002cb8382815181106200028e57634e487b7160e01b600052603260045260246000fd5b6020026020010151838381518110620002b757634e487b7160e01b600052603260045260246000fd5b60200260200101516200038660201b60201c565b80620002d78162000825565b9150506200025f565b505050620002fd620002f76200053a60201b60201c565b6200053e565b600160085581516200031790600b9060208501906200063d565b5080516200032d90600c9060208401906200063d565b506000600955505086516200034a9060129060208a01906200063d565b5060a086905260c08590526101008490528486116200036a57846200036c565b855b60e0525050608052506200086f9950505050505050505050565b6001600160a01b038216620003de5760405162461bcd60e51b815260206004820152601b60248201527f6163636f756e7420697320746865207a65726f20616464726573730000000000604482015260640162000214565b600081116200041f5760405162461bcd60e51b815260206004820152600c60248201526b07368617265732061726520360a41b604482015260640162000214565b6001600160a01b03821660009081526004602052604090205415620004875760405162461bcd60e51b815260206004820152601a60248201527f6163636f756e7420616c72656164792068617320736861726573000000000000604482015260640162000214565b60068054600181019091557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b0319166001600160a01b0384169081179091556000908152600460205260409020819055600254620004f1908290620007cd565b600255604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b3390565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054828255906000526020600020908101928215620005e8579160200282015b82811115620005e857825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620005b1565b50620005f6929150620006ba565b5090565b828054828255906000526020600020908101928215620005e8579160200282015b82811115620005e8578251829060ff169055916020019190600101906200061b565b8280546200064b90620007e8565b90600052602060002090601f0160209004810192826200066f5760008555620005e8565b82601f106200068a57805160ff1916838001178555620005e8565b82800160010185558215620005e8579182015b82811115620005e85782518255916020019190600101906200069d565b5b80821115620005f65760008155600101620006bb565b600080600080600060a08688031215620006e9578081fd5b85516001600160401b038082111562000700578283fd5b818801915088601f83011262000714578283fd5b81518181111562000729576200072962000859565b604051601f8201601f19908116603f0116810190838211818310171562000754576200075462000859565b81604052828152602093508b8484870101111562000770578586fd5b8591505b8282101562000793578482018401518183018501529083019062000774565b82821115620007a457858484830101525b928a015160408b015160608c01516080909c0151949d919c509a99509297509195505050505050565b60008219821115620007e357620007e362000843565b500190565b600181811c90821680620007fd57607f821691505b602082108114156200081f57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156200083c576200083c62000843565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60805160a05160c05160e051610100516139b8620008de6000396000818161099e015281816122de015261236301526000818161051c015281816110b0015281816110e80152818161112601526128590152600061091f01526000610860015260006105db01526139b86000f3fe60806040526004361061034e5760003560e01c80637c86bcb8116101bb578063bdb4b848116100f7578063dcc7ba2411610095578063e33b7de31161006f578063e33b7de314610a0f578063e985e9c514610a24578063f2fde38b14610a6d578063f4a560a514610a8d57600080fd5b8063dcc7ba24146109c0578063df689cbe146109da578063e228c6fe146109fa57600080fd5b8063cabadaa0116100d1578063cabadaa01461090d578063cb14eb8714610941578063ce7c2ac214610956578063d5abeb011461098c57600080fd5b8063bdb4b848146108c2578063c6ab67a3146108d8578063c87b56dd146108ed57600080fd5b806395d89b4111610164578063a22cb4651161013e578063a22cb4651461082e578063b45762781461084e578063b88d4fde14610882578063bd1be050146108a257600080fd5b806395d89b41146107d05780639852595c146107e5578063a0712d681461081b57600080fd5b80638da5cb5b116101955780638da5cb5b146107465780639182a9df146107645780639231ab2a1461077957600080fd5b80637c86bcb8146106e75780638545f4ea146107065780638b83209b1461072657600080fd5b806342842e0e1161028a578063586a894d116102335780636c0360eb1161020d5780636c0360eb1461068857806370a082311461069d578063715018a6146106bd57806371b5bba6146106d257600080fd5b8063586a894d146106335780635be7fde8146106535780636352211e1461066857600080fd5b80634b09b72a116102645780634b09b72a146105c9578063537d3e0e146105fd57806355f804b31461061357600080fd5b806342842e0e14610573578063433adb0514610593578063452c5f7e146105a957600080fd5b806318160ddd116102f757806323b872dd116102d157806323b872dd146104ea5780632913daa01461050a5780632e49d78b1461053e5780633a98ef391461055e57600080fd5b806318160ddd1461048057806319165587146104a3578063200d2ed2146104c357600080fd5b8063095ea7b311610328578063095ea7b31461042b5780630c0a6b5e1461044d578063109695231461046057600080fd5b806301ffc9a71461039c57806306fdde03146103d1578063081812fc146103f357600080fd5b36610397577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156103a857600080fd5b506103bc6103b7366004613566565b610aa2565b60405190151581526020015b60405180910390f35b3480156103dd57600080fd5b506103e6610b3f565b6040516103c89190613767565b3480156103ff57600080fd5b5061041361040e36600461354e565b610bd1565b6040516001600160a01b0390911681526020016103c8565b34801561043757600080fd5b5061044b610446366004613481565b610c2e565b005b61044b61045b366004613603565b610cee565b34801561046c57600080fd5b5061044b61047b3660046135bd565b610e55565b34801561048c57600080fd5b50600a54600954035b6040519081526020016103c8565b3480156104af57600080fd5b5061044b6104be3660046132f1565b610f18565b3480156104cf57600080fd5b506011546104dd9060ff1681565b6040516103c8919061373f565b3480156104f657600080fd5b5061044b610505366004613345565b610f6c565b34801561051657600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000000081565b34801561054a57600080fd5b5061044b61055936600461359e565b610f77565b34801561056a57600080fd5b50600254610495565b34801561057f57600080fd5b5061044b61058e366004613345565b61102b565b34801561059f57600080fd5b5061049560145481565b3480156105b557600080fd5b5061044b6105c4366004613481565b611046565b3480156105d557600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000000081565b34801561060957600080fd5b506104956101f481565b34801561061f57600080fd5b5061044b61062e3660046135bd565b6111c3565b34801561063f57600080fd5b5061044b61064e36600461354e565b611345565b34801561065f57600080fd5b5061044b6113ca565b34801561067457600080fd5b5061041361068336600461354e565b6115ef565b34801561069457600080fd5b506103e6611601565b3480156106a957600080fd5b506104956106b83660046132f1565b61168f565b3480156106c957600080fd5b5061044b6116f7565b3480156106de57600080fd5b50600654610495565b3480156106f357600080fd5b506016546103bc90610100900460ff1681565b34801561071257600080fd5b5061044b61072136600461354e565b61174b565b34801561073257600080fd5b5061041361074136600461354e565b6117d1565b34801561075257600080fd5b506007546001600160a01b0316610413565b34801561077057600080fd5b5061044b61180f565b34801561078557600080fd5b5061079961079436600461354e565b611917565b6040805182516001600160a01b0316815260208084015167ffffffffffffffff1690820152918101511515908201526060016103c8565b3480156107dc57600080fd5b506103e661193d565b3480156107f157600080fd5b506104956108003660046132f1565b6001600160a01b031660009081526005602052604090205490565b61044b61082936600461354e565b61194c565b34801561083a57600080fd5b5061044b610849366004613450565b611aa7565b34801561085a57600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000000081565b34801561088e57600080fd5b5061044b61089d366004613385565b611b56565b3480156108ae57600080fd5b5061044b6108bd3660046134ac565b611ba7565b3480156108ce57600080fd5b5061049560155481565b3480156108e457600080fd5b506103e6611d7d565b3480156108f957600080fd5b506103e661090836600461354e565b611d8a565b34801561091957600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000000081565b34801561094d57600080fd5b50610495600981565b34801561096257600080fd5b506104956109713660046132f1565b6001600160a01b031660009081526004602052604090205490565b34801561099857600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000000081565b3480156109cc57600080fd5b506016546103bc9060ff1681565b3480156109e657600080fd5b506103bc6109f5366004613402565b611e8c565b348015610a0657600080fd5b5061044b611ed4565b348015610a1b57600080fd5b50600354610495565b348015610a3057600080fd5b506103bc610a3f36600461330d565b6001600160a01b03918216600090815260106020908152604080832093909416825291909152205460ff1690565b348015610a7957600080fd5b5061044b610a883660046132f1565b611edd565b348015610a9957600080fd5b5061044b611faa565b60006001600160e01b031982167f80ac58cd000000000000000000000000000000000000000000000000000000001480610b0557506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610b3957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6060600b8054610b4e9061388b565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7a9061388b565b8015610bc75780601f10610b9c57610100808354040283529160200191610bc7565b820191906000526020600020905b815481529060010190602001808311610baa57829003601f168201915b5050505050905090565b6000610bdc8261205b565b610c12576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600f60205260409020546001600160a01b031690565b6000610c39826115ef565b9050806001600160a01b0316836001600160a01b03161415610c87576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b03821614801590610ca75750610ca58133610a3f565b155b15610cde576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ce9838383612087565b505050565b60026008541415610d465760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600855323314610d895760405162461bcd60e51b815260206004820152600c60248201526b26bab9ba103132903ab9b2b960a11b6044820152606401610d3d565b610d92826120f0565b610d9b81612140565b610da4826121fa565b610dad82612270565b610db6826122dc565b6007546001600160a01b03163314610ded573360009081526017602052604081208054849290610de79084906137fd565b90915550505b610df7338361238f565b6007546001600160a01b03163314610e1f57610e1f82601554610e1a9190613829565b6123a9565b604051829033907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427390600090a350506001600855565b6007546001600160a01b03163314610e9d5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b610ea5612437565b60138054610eb29061388b565b159050610f015760405162461bcd60e51b815260206004820152601b60248201527f50726f76656e616e6365206861736820616c72656164792073657400000000006044820152606401610d3d565b8051610f14906013906020840190613191565b5050565b6007546001600160a01b03163314610f605760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b610f698161248a565b50565b610ce9838383612610565b6007546001600160a01b03163314610fbf5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b6011805482919060ff19166001836003811115610fec57634e487b7160e01b600052602160045260246000fd5b02179055507fafa725e7f44cadb687a7043853fa1a7e7b8f0da74ce87ec546e9420f04da8c1e81604051611020919061373f565b60405180910390a150565b610ce983838360405180602001604052806000815250611b56565b6007546001600160a01b0316331461108e5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b611097816120f0565b6110a08161284c565b6110a9816122dc565b60006110d57f000000000000000000000000000000000000000000000000000000000000000083613815565b905060005b8181101561111e5761110c847f00000000000000000000000000000000000000000000000000000000000000006128c8565b80611116816138c6565b9150506110da565b50600061114b7f0000000000000000000000000000000000000000000000000000000000000000846138e1565b9050801561115d5761115d84826128c8565b826014600082825461116f91906137fd565b9091555050604080513381526001600160a01b03861660208201529081018490527fd729ebd340be850113adba35e3218ac6bd77c375ce35c256e3493fdf30b99f3e9060600160405180910390a150505050565b6007546001600160a01b0316331461120b5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b601654610100900460ff16156112635760405162461bcd60e51b815260206004820152601960248201527f4d6574616461746120616c72656164792072657665616c6564000000000000006044820152606401610d3d565b6000601280546112729061388b565b80601f016020809104026020016040519081016040528092919081815260200182805461129e9061388b565b80156112eb5780601f106112c0576101008083540402835291602001916112eb565b820191906000526020600020905b8154815290600101906020018083116112ce57829003601f168201915b5050855193945061130793601293506020870192509050613191565b507f99562a81a2bc5868cd8c30b7b2964f5e52ec358ace402063ecd18a505f5d0800818360405161133992919061377a565b60405180910390a15050565b6007546001600160a01b0316331461138d5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b601881905560405181815233907f5a5b87d9dc4db34438b825f62ef32c4c02999eb5ecce6640eabba90e0ff7bfe99060200160405180910390a250565b60006113d560065490565b905060008167ffffffffffffffff81111561140057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611429578160200160208202803683370190505b50905060008267ffffffffffffffff81111561145557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561147e578160200160208202803683370190505b50905060005b838110156115b0576000600682815481106114af57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168083526004909152604090912054909150806115245760405162461bcd60e51b815260206004820152601460248201527f536861726520616d6f756e74206973207a65726f0000000000000000000000006044820152606401610d3d565b8084848151811061154557634e487b7160e01b600052603260045260246000fd5b6020026020010181815250508185848151811061157257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505061159b82610f18565b505080806115a8906138c6565b915050611484565b507f7e6ea35d693233e59d454de0669d56220324db428f2609d801a47a1329f46bbb82826040516115e29291906136c9565b60405180910390a1505050565b60006115fa826128db565b5192915050565b6012805461160e9061388b565b80601f016020809104026020016040519081016040528092919081815260200182805461163a9061388b565b80156116875780601f1061165c57610100808354040283529160200191611687565b820191906000526020600020905b81548152906001019060200180831161166a57829003601f168201915b505050505081565b60006001600160a01b0382166116d1576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b03166000908152600e602052604090205467ffffffffffffffff1690565b6007546001600160a01b0316331461173f5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b6117496000612a10565b565b6007546001600160a01b031633146117935760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b601580549082905560408051828152602081018490527f09dec0a03ec247fc6eb57462f0c95194f19a7126f4a1dcd0468afc039dd629c79101611339565b6000600682815481106117f457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031692915050565b6007546001600160a01b031633146118575760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b6000601380546118669061388b565b9050116118b55760405162461bcd60e51b815260206004820152601760248201527f50726f76656e616e63652068617368206e6f74207365740000000000000000006044820152606401610d3d565b60165460ff16156119085760405162461bcd60e51b815260206004820152601960248201527f4d6574616461746120616c72656164792072657665616c6564000000000000006044820152606401610d3d565b6016805460ff19166001179055565b6040805160608101825260008082526020820181905291810191909152610b39826128db565b6060600c8054610b4e9061388b565b6002600854141561199f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d3d565b60026008553233146119e25760405162461bcd60e51b815260206004820152600c60248201526b26bab9ba103132903ab9b2b960a11b6044820152606401610d3d565b6119ea612a6f565b6119f3816121fa565b6119fc81612270565b611a05816120f0565b611a0e816122dc565b6007546001600160a01b03163314611a45573360009081526017602052604081208054839290611a3f9084906137fd565b90915550505b611a4f338261238f565b6007546001600160a01b03163314611a7257611a7281601554610e1a9190613829565b604051819033907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427390600090a3506001600855565b6001600160a01b038216331415611aea576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526010602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611b61848484612610565b6001600160a01b0383163b15158015611b835750611b8184848484612af5565b155b15611ba1576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6007546001600160a01b03163314611bef5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b611bf8816120f0565b611c018161284c565b611c0a816122dc565b60005b8251811015610ce95760006001600160a01b0316838281518110611c4157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415611ca05760405162461bcd60e51b815260206004820152600c60248201527f5a65726f206164647265737300000000000000000000000000000000000000006044820152606401610d3d565b611cd1838281518110611cc357634e487b7160e01b600052603260045260246000fd5b6020026020010151836128c8565b8160146000828254611ce391906137fd565b925050819055507fd729ebd340be850113adba35e3218ac6bd77c375ce35c256e3493fdf30b99f3e33848381518110611d2c57634e487b7160e01b600052603260045260246000fd5b602002602001015184604051611d63939291906001600160a01b039384168152919092166020820152604081019190915260600190565b60405180910390a180611d75816138c6565b915050611c0d565b6013805461160e9061388b565b6060611d958261205b565b611de15760405162461bcd60e51b815260206004820152600860248201527f4e6f20746f6b656e0000000000000000000000000000000000000000000000006044820152606401610d3d565b6000611deb612bed565b90506000815111611e3e5760405162461bcd60e51b815260206004820152600a60248201527f4261736520756e736574000000000000000000000000000000000000000000006044820152606401610d3d565b60165460ff168015611e505750805115155b611e5a5780611e85565b80611e6484612bfc565b604051602001611e7592919061365e565b6040516020818303038152906040525b9392505050565b6018546040516bffffffffffffffffffffffff19606085901b166020820152600091611e85918491906034015b60405160208183030381529060405280519060200120612d4a565b6117493361248a565b6007546001600160a01b03163314611f255760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b6001600160a01b038116611fa15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610d3d565b610f6981612a10565b6007546001600160a01b03163314611ff25760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b601654610100900460ff161561204a5760405162461bcd60e51b815260206004820152601a60248201527f4d6574616461746120616c72656164792066696e616c697365640000000000006044820152606401610d3d565b6016805461ff001916610100179055565b600060095482108015610b395750506000908152600d6020526040902054600160e01b900460ff161590565b6000828152600f6020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60008111610f695760405162461bcd60e51b815260206004820152601a60248201527f4d757374206d696e74206174206c65617374203120746f6b656e0000000000006044820152606401610d3d565b6000612178826018546121503390565b604051602001611eb9919060609190911b6bffffffffffffffffffffffff1916815260140190565b9050600160115460ff1660038111156121a157634e487b7160e01b600052602160045260246000fd5b1415806121c1575080806121bf57506007546001600160a01b031633145b155b15610f14576040517ffa5cd00f000000000000000000000000000000000000000000000000000000008152336004820152602401610d3d565b6007546001600160a01b03163314610f6957336000908152601760205260408120549061222783836137fd565b90506101f4811115610ce9576040517f1a9bb254000000000000000000000000000000000000000000000000000000008152600481018290526101f46024820152604401610d3d565b6000601554826122809190613829565b9050803410801561229c57506007546001600160a01b03163314155b15610f14576040517fcf47918100000000000000000000000000000000000000000000000000000000815234600482015260248101829052604401610d3d565b7f00000000000000000000000000000000000000000000000000000000000000008161230b600a546009540390565b61231591906137fd565b1115610f695780612329600a546009540390565b61233391906137fd565b6040517fea05824600000000000000000000000000000000000000000000000000000000815260048101919091527f00000000000000000000000000000000000000000000000000000000000000006024820152604401610d3d565b610f14828260405180602001604052806000815250612d60565b803410156123f95760405162461bcd60e51b815260206004820152601660248201527f4e65656420746f2073656e64206d6f7265204554482e000000000000000000006044820152606401610d3d565b80341115610f6957336108fc61240f8334613848565b6040518115909202916000818181858888f19350505050158015610f14573d6000803e3d6000fd5b60165460ff16156117495760405162461bcd60e51b815260206004820152601460248201527f4d757374206e6f742062652072657665616c65640000000000000000000000006044820152606401610d3d565b6001600160a01b0381166000908152600460205260409020546124ef5760405162461bcd60e51b815260206004820152601560248201527f6163636f756e7420686173206e6f2073686172657300000000000000000000006044820152606401610d3d565b60006124fa60035490565b61250490476137fd565b90506000612531838361252c866001600160a01b031660009081526005602052604090205490565b612d6d565b9050806125805760405162461bcd60e51b815260206004820152601a60248201527f6163636f756e74206973206e6f7420647565207061796d656e740000000000006044820152606401610d3d565b6001600160a01b038316600090815260056020526040812080548392906125a89084906137fd565b9250508190555080600360008282546125c191906137fd565b909155506125d190508382612dab565b604080516001600160a01b0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b05691016115e2565b600061261b826128db565b9050836001600160a01b031681600001516001600160a01b03161461266c576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000336001600160a01b038616148061268a575061268a8533610a3f565b806126a557503361269a84610bd1565b6001600160a01b0316145b9050806126de576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841661271e576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61272a60008487612087565b6001600160a01b038581166000908152600e60209081526040808320805467ffffffffffffffff1980821667ffffffffffffffff92831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600d90945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116612800576009548214612800578054602086015167ffffffffffffffff16600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b80600010801561287c57507f00000000000000000000000000000000000000000000000000000000000000008111155b610f695760405162461bcd60e51b815260206004820152601d60248201527f4d617820746f6b656e73207065722062617463682065786365656465640000006044820152606401610d3d565b6128d1816122dc565b610f14828261238f565b6040805160608101825260008082526020820181905291810191909152816009548110156129de576000818152600d6020908152604091829020825160608101845290546001600160a01b0381168252600160a01b810467ffffffffffffffff1692820192909252600160e01b90910460ff161515918101829052906129dc5780516001600160a01b031615612972579392505050565b50600019016000818152600d6020908152604091829020825160608101845290546001600160a01b038116808352600160a01b820467ffffffffffffffff1693830193909352600160e01b900460ff16151592810192909252156129d7579392505050565b612972565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6007546001600160a01b0316331461174957600260115460ff166003811115612aa857634e487b7160e01b600052602160045260246000fd5b146117495760405162461bcd60e51b815260206004820152601a60248201527f5075626c69632073616c65206973206e6f74206163746976652e0000000000006044820152606401610d3d565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612b2a90339089908890889060040161368d565b602060405180830381600087803b158015612b4457600080fd5b505af1925050508015612b74575060408051601f3d908101601f19168201909252612b7191810190613582565b60015b612bcf573d808015612ba2576040519150601f19603f3d011682016040523d82523d6000602084013e612ba7565b606091505b508051612bc7576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b606060128054610b4e9061388b565b606081612c3c57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612c665780612c50816138c6565b9150612c5f9050600a83613815565b9150612c40565b60008167ffffffffffffffff811115612c8f57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612cb9576020820181803683370190505b5090505b8415612be557612cce600183613848565b9150612cdb600a866138e1565b612ce69060306137fd565b60f81b818381518110612d0957634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612d43600a86613815565b9450612cbd565b600082612d578584612ec4565b14949350505050565b610ce98383836001612f7e565b6002546001600160a01b03841660009081526004602052604081205490918391612d979086613829565b612da19190613815565b612be59190613848565b80471015612dfb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d3d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612e48576040519150601f19603f3d011682016040523d82523d6000602084013e612e4d565b606091505b5050905080610ce95760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d3d565b600081815b8451811015612f76576000858281518110612ef457634e487b7160e01b600052603260045260246000fd5b60200260200101519050808311612f36576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250612f63565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080612f6e816138c6565b915050612ec9565b509392505050565b6009546001600160a01b038516612fc1576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83612ff8576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0385166000818152600e6020908152604080832080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000811667ffffffffffffffff8083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c01811690920217909155858452600d90925290912080546001600160e01b031916909217600160a01b4290921691909102179055808085018380156130b957506001600160a01b0387163b15155b15613142575b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a461310a6000888480600101955088612af5565b613127576040516368d2bf6b60e11b815260040160405180910390fd5b808214156130bf57826009541461313d57600080fd5b613188565b5b6040516001830192906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480821415613143575b50600955612845565b82805461319d9061388b565b90600052602060002090601f0160209004810192826131bf5760008555613205565b82601f106131d857805160ff1916838001178555613205565b82800160010185558215613205579182015b828111156132055782518255916020019190600101906131ea565b50613211929150613215565b5090565b5b808211156132115760008155600101613216565b600067ffffffffffffffff83111561324457613244613921565b613257601f8401601f19166020016137a8565b905082815283838301111561326b57600080fd5b828260208301376000602084830101529392505050565b600082601f830112613292578081fd5b813560206132a76132a2836137d9565b6137a8565b80838252828201915082860187848660051b89010111156132c6578586fd5b855b858110156132e4578135845292840192908401906001016132c8565b5090979650505050505050565b600060208284031215613302578081fd5b8135611e8581613937565b6000806040838503121561331f578081fd5b823561332a81613937565b9150602083013561333a81613937565b809150509250929050565b600080600060608486031215613359578081fd5b833561336481613937565b9250602084013561337481613937565b929592945050506040919091013590565b6000806000806080858703121561339a578081fd5b84356133a581613937565b935060208501356133b581613937565b925060408501359150606085013567ffffffffffffffff8111156133d7578182fd5b8501601f810187136133e7578182fd5b6133f68782356020840161322a565b91505092959194509250565b60008060408385031215613414578182fd5b823561341f81613937565b9150602083013567ffffffffffffffff81111561343a578182fd5b61344685828601613282565b9150509250929050565b60008060408385031215613462578182fd5b823561346d81613937565b91506020830135801515811461333a578182fd5b60008060408385031215613493578182fd5b823561349e81613937565b946020939093013593505050565b600080604083850312156134be578182fd5b823567ffffffffffffffff8111156134d4578283fd5b8301601f810185136134e4578283fd5b803560206134f46132a2836137d9565b80838252828201915082850189848660051b8801011115613513578788fd5b8795505b8486101561353e57803561352a81613937565b835260019590950194918301918301613517565b5098969091013596505050505050565b60006020828403121561355f578081fd5b5035919050565b600060208284031215613577578081fd5b8135611e858161394c565b600060208284031215613593578081fd5b8151611e858161394c565b6000602082840312156135af578081fd5b813560048110611e85578182fd5b6000602082840312156135ce578081fd5b813567ffffffffffffffff8111156135e4578182fd5b8201601f810184136135f4578182fd5b612be58482356020840161322a565b60008060408385031215613615578182fd5b82359150602083013567ffffffffffffffff81111561343a578182fd5b6000815180845261364a81602086016020860161385f565b601f01601f19169290920160200192915050565b6000835161367081846020880161385f565b83519083019061368481836020880161385f565b01949350505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526136bf6080830184613632565b9695505050505050565b604080825283519082018190526000906020906060840190828701845b8281101561370b5781516001600160a01b0316845292840192908401906001016136e6565b50505083810382850152845180825285830191830190845b818110156132e457835183529284019291840191600101613723565b602081016004831061376157634e487b7160e01b600052602160045260246000fd5b91905290565b602081526000611e856020830184613632565b60408152600061378d6040830185613632565b828103602084015261379f8185613632565b95945050505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137d1576137d1613921565b604052919050565b600067ffffffffffffffff8211156137f3576137f3613921565b5060051b60200190565b60008219821115613810576138106138f5565b500190565b6000826138245761382461390b565b500490565b6000816000190483118215151615613843576138436138f5565b500290565b60008282101561385a5761385a6138f5565b500390565b60005b8381101561387a578181015183820152602001613862565b83811115611ba15750506000910152565b600181811c9082168061389f57607f821691505b602082108114156138c057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138da576138da6138f5565b5060010190565b6000826138f0576138f061390b565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610f6957600080fd5b6001600160e01b031981168114610f6957600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220713947b49ea6d91be13079b769dea0fbd8b5c4f3e0c91a8efcd69c8992f0881d64736f6c6343000804003300000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000003b0000000000000000000000000000000000000000000000000000000000000cca0000000000000000000000000000000000000000000000000000000000000d050000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000005068747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d597161536343316f6f684c724862387173595062666d533252576a57375a66774346593346576770345a667000000000000000000000000000000000
Deployed Bytecode
0x60806040526004361061034e5760003560e01c80637c86bcb8116101bb578063bdb4b848116100f7578063dcc7ba2411610095578063e33b7de31161006f578063e33b7de314610a0f578063e985e9c514610a24578063f2fde38b14610a6d578063f4a560a514610a8d57600080fd5b8063dcc7ba24146109c0578063df689cbe146109da578063e228c6fe146109fa57600080fd5b8063cabadaa0116100d1578063cabadaa01461090d578063cb14eb8714610941578063ce7c2ac214610956578063d5abeb011461098c57600080fd5b8063bdb4b848146108c2578063c6ab67a3146108d8578063c87b56dd146108ed57600080fd5b806395d89b4111610164578063a22cb4651161013e578063a22cb4651461082e578063b45762781461084e578063b88d4fde14610882578063bd1be050146108a257600080fd5b806395d89b41146107d05780639852595c146107e5578063a0712d681461081b57600080fd5b80638da5cb5b116101955780638da5cb5b146107465780639182a9df146107645780639231ab2a1461077957600080fd5b80637c86bcb8146106e75780638545f4ea146107065780638b83209b1461072657600080fd5b806342842e0e1161028a578063586a894d116102335780636c0360eb1161020d5780636c0360eb1461068857806370a082311461069d578063715018a6146106bd57806371b5bba6146106d257600080fd5b8063586a894d146106335780635be7fde8146106535780636352211e1461066857600080fd5b80634b09b72a116102645780634b09b72a146105c9578063537d3e0e146105fd57806355f804b31461061357600080fd5b806342842e0e14610573578063433adb0514610593578063452c5f7e146105a957600080fd5b806318160ddd116102f757806323b872dd116102d157806323b872dd146104ea5780632913daa01461050a5780632e49d78b1461053e5780633a98ef391461055e57600080fd5b806318160ddd1461048057806319165587146104a3578063200d2ed2146104c357600080fd5b8063095ea7b311610328578063095ea7b31461042b5780630c0a6b5e1461044d578063109695231461046057600080fd5b806301ffc9a71461039c57806306fdde03146103d1578063081812fc146103f357600080fd5b36610397577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156103a857600080fd5b506103bc6103b7366004613566565b610aa2565b60405190151581526020015b60405180910390f35b3480156103dd57600080fd5b506103e6610b3f565b6040516103c89190613767565b3480156103ff57600080fd5b5061041361040e36600461354e565b610bd1565b6040516001600160a01b0390911681526020016103c8565b34801561043757600080fd5b5061044b610446366004613481565b610c2e565b005b61044b61045b366004613603565b610cee565b34801561046c57600080fd5b5061044b61047b3660046135bd565b610e55565b34801561048c57600080fd5b50600a54600954035b6040519081526020016103c8565b3480156104af57600080fd5b5061044b6104be3660046132f1565b610f18565b3480156104cf57600080fd5b506011546104dd9060ff1681565b6040516103c8919061373f565b3480156104f657600080fd5b5061044b610505366004613345565b610f6c565b34801561051657600080fd5b506104957f0000000000000000000000000000000000000000000000000000000000000cca81565b34801561054a57600080fd5b5061044b61055936600461359e565b610f77565b34801561056a57600080fd5b50600254610495565b34801561057f57600080fd5b5061044b61058e366004613345565b61102b565b34801561059f57600080fd5b5061049560145481565b3480156105b557600080fd5b5061044b6105c4366004613481565b611046565b3480156105d557600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000006481565b34801561060957600080fd5b506104956101f481565b34801561061f57600080fd5b5061044b61062e3660046135bd565b6111c3565b34801561063f57600080fd5b5061044b61064e36600461354e565b611345565b34801561065f57600080fd5b5061044b6113ca565b34801561067457600080fd5b5061041361068336600461354e565b6115ef565b34801561069457600080fd5b506103e6611601565b3480156106a957600080fd5b506104956106b83660046132f1565b61168f565b3480156106c957600080fd5b5061044b6116f7565b3480156106de57600080fd5b50600654610495565b3480156106f357600080fd5b506016546103bc90610100900460ff1681565b34801561071257600080fd5b5061044b61072136600461354e565b61174b565b34801561073257600080fd5b5061041361074136600461354e565b6117d1565b34801561075257600080fd5b506007546001600160a01b0316610413565b34801561077057600080fd5b5061044b61180f565b34801561078557600080fd5b5061079961079436600461354e565b611917565b6040805182516001600160a01b0316815260208084015167ffffffffffffffff1690820152918101511515908201526060016103c8565b3480156107dc57600080fd5b506103e661193d565b3480156107f157600080fd5b506104956108003660046132f1565b6001600160a01b031660009081526005602052604090205490565b61044b61082936600461354e565b61194c565b34801561083a57600080fd5b5061044b610849366004613450565b611aa7565b34801561085a57600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000003b81565b34801561088e57600080fd5b5061044b61089d366004613385565b611b56565b3480156108ae57600080fd5b5061044b6108bd3660046134ac565b611ba7565b3480156108ce57600080fd5b5061049560155481565b3480156108e457600080fd5b506103e6611d7d565b3480156108f957600080fd5b506103e661090836600461354e565b611d8a565b34801561091957600080fd5b506104957f0000000000000000000000000000000000000000000000000000000000000cca81565b34801561094d57600080fd5b50610495600981565b34801561096257600080fd5b506104956109713660046132f1565b6001600160a01b031660009081526004602052604090205490565b34801561099857600080fd5b506104957f0000000000000000000000000000000000000000000000000000000000000d0581565b3480156109cc57600080fd5b506016546103bc9060ff1681565b3480156109e657600080fd5b506103bc6109f5366004613402565b611e8c565b348015610a0657600080fd5b5061044b611ed4565b348015610a1b57600080fd5b50600354610495565b348015610a3057600080fd5b506103bc610a3f36600461330d565b6001600160a01b03918216600090815260106020908152604080832093909416825291909152205460ff1690565b348015610a7957600080fd5b5061044b610a883660046132f1565b611edd565b348015610a9957600080fd5b5061044b611faa565b60006001600160e01b031982167f80ac58cd000000000000000000000000000000000000000000000000000000001480610b0557506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610b3957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6060600b8054610b4e9061388b565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7a9061388b565b8015610bc75780601f10610b9c57610100808354040283529160200191610bc7565b820191906000526020600020905b815481529060010190602001808311610baa57829003601f168201915b5050505050905090565b6000610bdc8261205b565b610c12576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600f60205260409020546001600160a01b031690565b6000610c39826115ef565b9050806001600160a01b0316836001600160a01b03161415610c87576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b03821614801590610ca75750610ca58133610a3f565b155b15610cde576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ce9838383612087565b505050565b60026008541415610d465760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600855323314610d895760405162461bcd60e51b815260206004820152600c60248201526b26bab9ba103132903ab9b2b960a11b6044820152606401610d3d565b610d92826120f0565b610d9b81612140565b610da4826121fa565b610dad82612270565b610db6826122dc565b6007546001600160a01b03163314610ded573360009081526017602052604081208054849290610de79084906137fd565b90915550505b610df7338361238f565b6007546001600160a01b03163314610e1f57610e1f82601554610e1a9190613829565b6123a9565b604051829033907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427390600090a350506001600855565b6007546001600160a01b03163314610e9d5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b610ea5612437565b60138054610eb29061388b565b159050610f015760405162461bcd60e51b815260206004820152601b60248201527f50726f76656e616e6365206861736820616c72656164792073657400000000006044820152606401610d3d565b8051610f14906013906020840190613191565b5050565b6007546001600160a01b03163314610f605760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b610f698161248a565b50565b610ce9838383612610565b6007546001600160a01b03163314610fbf5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b6011805482919060ff19166001836003811115610fec57634e487b7160e01b600052602160045260246000fd5b02179055507fafa725e7f44cadb687a7043853fa1a7e7b8f0da74ce87ec546e9420f04da8c1e81604051611020919061373f565b60405180910390a150565b610ce983838360405180602001604052806000815250611b56565b6007546001600160a01b0316331461108e5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b611097816120f0565b6110a08161284c565b6110a9816122dc565b60006110d57f0000000000000000000000000000000000000000000000000000000000000cca83613815565b905060005b8181101561111e5761110c847f0000000000000000000000000000000000000000000000000000000000000cca6128c8565b80611116816138c6565b9150506110da565b50600061114b7f0000000000000000000000000000000000000000000000000000000000000cca846138e1565b9050801561115d5761115d84826128c8565b826014600082825461116f91906137fd565b9091555050604080513381526001600160a01b03861660208201529081018490527fd729ebd340be850113adba35e3218ac6bd77c375ce35c256e3493fdf30b99f3e9060600160405180910390a150505050565b6007546001600160a01b0316331461120b5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b601654610100900460ff16156112635760405162461bcd60e51b815260206004820152601960248201527f4d6574616461746120616c72656164792072657665616c6564000000000000006044820152606401610d3d565b6000601280546112729061388b565b80601f016020809104026020016040519081016040528092919081815260200182805461129e9061388b565b80156112eb5780601f106112c0576101008083540402835291602001916112eb565b820191906000526020600020905b8154815290600101906020018083116112ce57829003601f168201915b5050855193945061130793601293506020870192509050613191565b507f99562a81a2bc5868cd8c30b7b2964f5e52ec358ace402063ecd18a505f5d0800818360405161133992919061377a565b60405180910390a15050565b6007546001600160a01b0316331461138d5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b601881905560405181815233907f5a5b87d9dc4db34438b825f62ef32c4c02999eb5ecce6640eabba90e0ff7bfe99060200160405180910390a250565b60006113d560065490565b905060008167ffffffffffffffff81111561140057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611429578160200160208202803683370190505b50905060008267ffffffffffffffff81111561145557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561147e578160200160208202803683370190505b50905060005b838110156115b0576000600682815481106114af57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168083526004909152604090912054909150806115245760405162461bcd60e51b815260206004820152601460248201527f536861726520616d6f756e74206973207a65726f0000000000000000000000006044820152606401610d3d565b8084848151811061154557634e487b7160e01b600052603260045260246000fd5b6020026020010181815250508185848151811061157257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505061159b82610f18565b505080806115a8906138c6565b915050611484565b507f7e6ea35d693233e59d454de0669d56220324db428f2609d801a47a1329f46bbb82826040516115e29291906136c9565b60405180910390a1505050565b60006115fa826128db565b5192915050565b6012805461160e9061388b565b80601f016020809104026020016040519081016040528092919081815260200182805461163a9061388b565b80156116875780601f1061165c57610100808354040283529160200191611687565b820191906000526020600020905b81548152906001019060200180831161166a57829003601f168201915b505050505081565b60006001600160a01b0382166116d1576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b03166000908152600e602052604090205467ffffffffffffffff1690565b6007546001600160a01b0316331461173f5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b6117496000612a10565b565b6007546001600160a01b031633146117935760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b601580549082905560408051828152602081018490527f09dec0a03ec247fc6eb57462f0c95194f19a7126f4a1dcd0468afc039dd629c79101611339565b6000600682815481106117f457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031692915050565b6007546001600160a01b031633146118575760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b6000601380546118669061388b565b9050116118b55760405162461bcd60e51b815260206004820152601760248201527f50726f76656e616e63652068617368206e6f74207365740000000000000000006044820152606401610d3d565b60165460ff16156119085760405162461bcd60e51b815260206004820152601960248201527f4d6574616461746120616c72656164792072657665616c6564000000000000006044820152606401610d3d565b6016805460ff19166001179055565b6040805160608101825260008082526020820181905291810191909152610b39826128db565b6060600c8054610b4e9061388b565b6002600854141561199f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d3d565b60026008553233146119e25760405162461bcd60e51b815260206004820152600c60248201526b26bab9ba103132903ab9b2b960a11b6044820152606401610d3d565b6119ea612a6f565b6119f3816121fa565b6119fc81612270565b611a05816120f0565b611a0e816122dc565b6007546001600160a01b03163314611a45573360009081526017602052604081208054839290611a3f9084906137fd565b90915550505b611a4f338261238f565b6007546001600160a01b03163314611a7257611a7281601554610e1a9190613829565b604051819033907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427390600090a3506001600855565b6001600160a01b038216331415611aea576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526010602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611b61848484612610565b6001600160a01b0383163b15158015611b835750611b8184848484612af5565b155b15611ba1576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6007546001600160a01b03163314611bef5760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b611bf8816120f0565b611c018161284c565b611c0a816122dc565b60005b8251811015610ce95760006001600160a01b0316838281518110611c4157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415611ca05760405162461bcd60e51b815260206004820152600c60248201527f5a65726f206164647265737300000000000000000000000000000000000000006044820152606401610d3d565b611cd1838281518110611cc357634e487b7160e01b600052603260045260246000fd5b6020026020010151836128c8565b8160146000828254611ce391906137fd565b925050819055507fd729ebd340be850113adba35e3218ac6bd77c375ce35c256e3493fdf30b99f3e33848381518110611d2c57634e487b7160e01b600052603260045260246000fd5b602002602001015184604051611d63939291906001600160a01b039384168152919092166020820152604081019190915260600190565b60405180910390a180611d75816138c6565b915050611c0d565b6013805461160e9061388b565b6060611d958261205b565b611de15760405162461bcd60e51b815260206004820152600860248201527f4e6f20746f6b656e0000000000000000000000000000000000000000000000006044820152606401610d3d565b6000611deb612bed565b90506000815111611e3e5760405162461bcd60e51b815260206004820152600a60248201527f4261736520756e736574000000000000000000000000000000000000000000006044820152606401610d3d565b60165460ff168015611e505750805115155b611e5a5780611e85565b80611e6484612bfc565b604051602001611e7592919061365e565b6040516020818303038152906040525b9392505050565b6018546040516bffffffffffffffffffffffff19606085901b166020820152600091611e85918491906034015b60405160208183030381529060405280519060200120612d4a565b6117493361248a565b6007546001600160a01b03163314611f255760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b6001600160a01b038116611fa15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610d3d565b610f6981612a10565b6007546001600160a01b03163314611ff25760405162461bcd60e51b815260206004820181905260248201526000805160206139638339815191526044820152606401610d3d565b601654610100900460ff161561204a5760405162461bcd60e51b815260206004820152601a60248201527f4d6574616461746120616c72656164792066696e616c697365640000000000006044820152606401610d3d565b6016805461ff001916610100179055565b600060095482108015610b395750506000908152600d6020526040902054600160e01b900460ff161590565b6000828152600f6020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60008111610f695760405162461bcd60e51b815260206004820152601a60248201527f4d757374206d696e74206174206c65617374203120746f6b656e0000000000006044820152606401610d3d565b6000612178826018546121503390565b604051602001611eb9919060609190911b6bffffffffffffffffffffffff1916815260140190565b9050600160115460ff1660038111156121a157634e487b7160e01b600052602160045260246000fd5b1415806121c1575080806121bf57506007546001600160a01b031633145b155b15610f14576040517ffa5cd00f000000000000000000000000000000000000000000000000000000008152336004820152602401610d3d565b6007546001600160a01b03163314610f6957336000908152601760205260408120549061222783836137fd565b90506101f4811115610ce9576040517f1a9bb254000000000000000000000000000000000000000000000000000000008152600481018290526101f46024820152604401610d3d565b6000601554826122809190613829565b9050803410801561229c57506007546001600160a01b03163314155b15610f14576040517fcf47918100000000000000000000000000000000000000000000000000000000815234600482015260248101829052604401610d3d565b7f0000000000000000000000000000000000000000000000000000000000000d058161230b600a546009540390565b61231591906137fd565b1115610f695780612329600a546009540390565b61233391906137fd565b6040517fea05824600000000000000000000000000000000000000000000000000000000815260048101919091527f0000000000000000000000000000000000000000000000000000000000000d056024820152604401610d3d565b610f14828260405180602001604052806000815250612d60565b803410156123f95760405162461bcd60e51b815260206004820152601660248201527f4e65656420746f2073656e64206d6f7265204554482e000000000000000000006044820152606401610d3d565b80341115610f6957336108fc61240f8334613848565b6040518115909202916000818181858888f19350505050158015610f14573d6000803e3d6000fd5b60165460ff16156117495760405162461bcd60e51b815260206004820152601460248201527f4d757374206e6f742062652072657665616c65640000000000000000000000006044820152606401610d3d565b6001600160a01b0381166000908152600460205260409020546124ef5760405162461bcd60e51b815260206004820152601560248201527f6163636f756e7420686173206e6f2073686172657300000000000000000000006044820152606401610d3d565b60006124fa60035490565b61250490476137fd565b90506000612531838361252c866001600160a01b031660009081526005602052604090205490565b612d6d565b9050806125805760405162461bcd60e51b815260206004820152601a60248201527f6163636f756e74206973206e6f7420647565207061796d656e740000000000006044820152606401610d3d565b6001600160a01b038316600090815260056020526040812080548392906125a89084906137fd565b9250508190555080600360008282546125c191906137fd565b909155506125d190508382612dab565b604080516001600160a01b0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b05691016115e2565b600061261b826128db565b9050836001600160a01b031681600001516001600160a01b03161461266c576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000336001600160a01b038616148061268a575061268a8533610a3f565b806126a557503361269a84610bd1565b6001600160a01b0316145b9050806126de576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841661271e576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61272a60008487612087565b6001600160a01b038581166000908152600e60209081526040808320805467ffffffffffffffff1980821667ffffffffffffffff92831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600d90945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116612800576009548214612800578054602086015167ffffffffffffffff16600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b80600010801561287c57507f0000000000000000000000000000000000000000000000000000000000000cca8111155b610f695760405162461bcd60e51b815260206004820152601d60248201527f4d617820746f6b656e73207065722062617463682065786365656465640000006044820152606401610d3d565b6128d1816122dc565b610f14828261238f565b6040805160608101825260008082526020820181905291810191909152816009548110156129de576000818152600d6020908152604091829020825160608101845290546001600160a01b0381168252600160a01b810467ffffffffffffffff1692820192909252600160e01b90910460ff161515918101829052906129dc5780516001600160a01b031615612972579392505050565b50600019016000818152600d6020908152604091829020825160608101845290546001600160a01b038116808352600160a01b820467ffffffffffffffff1693830193909352600160e01b900460ff16151592810192909252156129d7579392505050565b612972565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6007546001600160a01b0316331461174957600260115460ff166003811115612aa857634e487b7160e01b600052602160045260246000fd5b146117495760405162461bcd60e51b815260206004820152601a60248201527f5075626c69632073616c65206973206e6f74206163746976652e0000000000006044820152606401610d3d565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612b2a90339089908890889060040161368d565b602060405180830381600087803b158015612b4457600080fd5b505af1925050508015612b74575060408051601f3d908101601f19168201909252612b7191810190613582565b60015b612bcf573d808015612ba2576040519150601f19603f3d011682016040523d82523d6000602084013e612ba7565b606091505b508051612bc7576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b606060128054610b4e9061388b565b606081612c3c57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612c665780612c50816138c6565b9150612c5f9050600a83613815565b9150612c40565b60008167ffffffffffffffff811115612c8f57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612cb9576020820181803683370190505b5090505b8415612be557612cce600183613848565b9150612cdb600a866138e1565b612ce69060306137fd565b60f81b818381518110612d0957634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612d43600a86613815565b9450612cbd565b600082612d578584612ec4565b14949350505050565b610ce98383836001612f7e565b6002546001600160a01b03841660009081526004602052604081205490918391612d979086613829565b612da19190613815565b612be59190613848565b80471015612dfb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d3d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612e48576040519150601f19603f3d011682016040523d82523d6000602084013e612e4d565b606091505b5050905080610ce95760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d3d565b600081815b8451811015612f76576000858281518110612ef457634e487b7160e01b600052603260045260246000fd5b60200260200101519050808311612f36576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250612f63565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080612f6e816138c6565b915050612ec9565b509392505050565b6009546001600160a01b038516612fc1576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83612ff8576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0385166000818152600e6020908152604080832080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000811667ffffffffffffffff8083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c01811690920217909155858452600d90925290912080546001600160e01b031916909217600160a01b4290921691909102179055808085018380156130b957506001600160a01b0387163b15155b15613142575b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a461310a6000888480600101955088612af5565b613127576040516368d2bf6b60e11b815260040160405180910390fd5b808214156130bf57826009541461313d57600080fd5b613188565b5b6040516001830192906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480821415613143575b50600955612845565b82805461319d9061388b565b90600052602060002090601f0160209004810192826131bf5760008555613205565b82601f106131d857805160ff1916838001178555613205565b82800160010185558215613205579182015b828111156132055782518255916020019190600101906131ea565b50613211929150613215565b5090565b5b808211156132115760008155600101613216565b600067ffffffffffffffff83111561324457613244613921565b613257601f8401601f19166020016137a8565b905082815283838301111561326b57600080fd5b828260208301376000602084830101529392505050565b600082601f830112613292578081fd5b813560206132a76132a2836137d9565b6137a8565b80838252828201915082860187848660051b89010111156132c6578586fd5b855b858110156132e4578135845292840192908401906001016132c8565b5090979650505050505050565b600060208284031215613302578081fd5b8135611e8581613937565b6000806040838503121561331f578081fd5b823561332a81613937565b9150602083013561333a81613937565b809150509250929050565b600080600060608486031215613359578081fd5b833561336481613937565b9250602084013561337481613937565b929592945050506040919091013590565b6000806000806080858703121561339a578081fd5b84356133a581613937565b935060208501356133b581613937565b925060408501359150606085013567ffffffffffffffff8111156133d7578182fd5b8501601f810187136133e7578182fd5b6133f68782356020840161322a565b91505092959194509250565b60008060408385031215613414578182fd5b823561341f81613937565b9150602083013567ffffffffffffffff81111561343a578182fd5b61344685828601613282565b9150509250929050565b60008060408385031215613462578182fd5b823561346d81613937565b91506020830135801515811461333a578182fd5b60008060408385031215613493578182fd5b823561349e81613937565b946020939093013593505050565b600080604083850312156134be578182fd5b823567ffffffffffffffff8111156134d4578283fd5b8301601f810185136134e4578283fd5b803560206134f46132a2836137d9565b80838252828201915082850189848660051b8801011115613513578788fd5b8795505b8486101561353e57803561352a81613937565b835260019590950194918301918301613517565b5098969091013596505050505050565b60006020828403121561355f578081fd5b5035919050565b600060208284031215613577578081fd5b8135611e858161394c565b600060208284031215613593578081fd5b8151611e858161394c565b6000602082840312156135af578081fd5b813560048110611e85578182fd5b6000602082840312156135ce578081fd5b813567ffffffffffffffff8111156135e4578182fd5b8201601f810184136135f4578182fd5b612be58482356020840161322a565b60008060408385031215613615578182fd5b82359150602083013567ffffffffffffffff81111561343a578182fd5b6000815180845261364a81602086016020860161385f565b601f01601f19169290920160200192915050565b6000835161367081846020880161385f565b83519083019061368481836020880161385f565b01949350505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526136bf6080830184613632565b9695505050505050565b604080825283519082018190526000906020906060840190828701845b8281101561370b5781516001600160a01b0316845292840192908401906001016136e6565b50505083810382850152845180825285830191830190845b818110156132e457835183529284019291840191600101613723565b602081016004831061376157634e487b7160e01b600052602160045260246000fd5b91905290565b602081526000611e856020830184613632565b60408152600061378d6040830185613632565b828103602084015261379f8185613632565b95945050505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137d1576137d1613921565b604052919050565b600067ffffffffffffffff8211156137f3576137f3613921565b5060051b60200190565b60008219821115613810576138106138f5565b500190565b6000826138245761382461390b565b500490565b6000816000190483118215151615613843576138436138f5565b500290565b60008282101561385a5761385a6138f5565b500390565b60005b8381101561387a578181015183820152602001613862565b83811115611ba15750506000910152565b600181811c9082168061389f57607f821691505b602082108114156138c057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138da576138da6138f5565b5060010190565b6000826138f0576138f061390b565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610f6957600080fd5b6001600160e01b031981168114610f6957600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220713947b49ea6d91be13079b769dea0fbd8b5c4f3e0c91a8efcd69c8992f0881d64736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000003b0000000000000000000000000000000000000000000000000000000000000cca0000000000000000000000000000000000000000000000000000000000000d050000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000005068747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d597161536343316f6f684c724862387173595062666d533252576a57375a66774346593346576770345a667000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _baseURI (string): https://gateway.pinata.cloud/ipfs/QmYqaScC1oohLrHb8qsYPbfmS2RWjW7ZfwCFY3FWgp4Zfp
Arg [1] : _maxPresaleMint (uint256): 59
Arg [2] : _maxPublicMint (uint256): 3274
Arg [3] : _maxSupply (uint256): 3333
Arg [4] : _reserveAmount (uint256): 100
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 000000000000000000000000000000000000000000000000000000000000003b
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000cca
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000d05
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000050
Arg [6] : 68747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066
Arg [7] : 732f516d597161536343316f6f684c724862387173595062666d533252576a57
Arg [8] : 375a66774346593346576770345a667000000000000000000000000000000000
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.