Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 16972476 | 476 days ago | IN | Create: ReserveManagerFacet | 0 ETH | 0.03972162 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
ReserveManagerFacet
Compiler Version
v0.8.1+commit.df193b15
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "../../../diamond/IDiamondFacet.sol"; import "./ReserveManagerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk contract ReserveManagerFacet is IDiamondFacet { function getFacetName() external pure override returns (string memory) { return "reserve-manager"; } // CAUTION: Don't forget to update the version when adding new functionality function getFacetVersion() external pure override returns (string memory) { return "3.1.0"; } function getFacetPI() external pure override returns (string[] memory) { string[] memory pi = new string[](4); pi[0] = "getReservationSettings()"; pi[1] = "setReservationSettings(bool,bool,uint256,uint256)"; pi[2] = "reserveForMe(uint256,string)"; pi[3] = "reserveForAccounts(address[],uint256[])"; return pi; } function getFacetProtectedPI() external pure override returns (string[] memory) { string[] memory pi = new string[](2); pi[0] = "setReservationSettings(bool,bool,uint256,uint256)"; pi[1] = "reserveForAccounts(address[],uint256[])"; return pi; } function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { return interfaceId == type(IDiamondFacet).interfaceId; } function getReservationSettings() external view returns (bool, bool, uint256, uint256, uint256) { return ReserveManagerInternal._getReservationSettings(); } function setReservationSettings( bool reservationAllowed, bool reservationAllowedWithoutWhitelisting, uint256 reservationFeeWei, uint256 reservePriceWeiPerToken ) external { ReserveManagerInternal._setReservationSettings( reservationAllowed, reservationAllowedWithoutWhitelisting, reservationFeeWei, reservePriceWeiPerToken ); } function reserveForMe( uint256 nrOfTokens, string memory paymentMethodName ) external payable { ReserveManagerInternal._reserveForAccount( msg.sender, nrOfTokens, paymentMethodName ); } // This is always allowed function reserveForAccounts( address[] memory accounts, uint256[] memory nrOfTokensArray ) external { ReserveManagerInternal._reserveForAccounts( accounts, nrOfTokensArray ); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "@openzeppelin/contracts/interfaces/IERC165.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk interface IDiamondFacet is IERC165 { // NOTE: The override MUST remain 'pure'. function getFacetName() external pure returns (string memory); // NOTE: The override MUST remain 'pure'. function getFacetVersion() external pure returns (string memory); // NOTE: The override MUST remain 'pure'. function getFacetPI() external pure returns (string[] memory); // NOTE: The override MUST remain 'pure'. function getFacetProtectedPI() external pure returns (string[] memory); }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "../erc721/ERC721Lib.sol"; import "../minter/MinterLib.sol"; import "../whitelist-manager/WhitelistManagerLib.sol"; import "../payment-handler/PaymentHandlerLib.sol"; import "./ReserveManagerStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library ReserveManagerInternal { event ReserveToken(address account, uint256 tokenId); function _initReserveManager() internal { // We always keep the token #0 reserved for the contract __s().reservedTokenIdCounter = 1; __s().totalNrOfReservedTokens = 0; } function _getReservationSettings() internal view returns (bool, bool, uint256, uint256, uint256) { return ( __s().reservationAllowed, __s().reservationAllowedWithoutWhitelisting, __s().reservationFeeWei, __s().reservePriceWeiPerToken, __s().totalNrOfReservedTokens ); } function _setReservationSettings( bool reservationAllowed, bool reservationAllowedWithoutWhitelisting, uint256 reservationFeeWei, uint256 reservePriceWeiPerToken ) internal { __s().reservationAllowed = reservationAllowed; __s().reservationAllowedWithoutWhitelisting = reservationAllowedWithoutWhitelisting; __s().reservationFeeWei = reservationFeeWei; __s().reservePriceWeiPerToken = reservePriceWeiPerToken; } function _reserveForAccount( address account, uint256 nrOfTokens, string memory paymentMethodName ) internal { require(__s().reservationAllowed, "RM:NA"); if (!__s().reservationAllowedWithoutWhitelisting) { uint256 nrOfWhitelistedTokens = WhitelistManagerLib._getWhitelistEntry(account); uint256 nrOfReservedTokens = __s().nrOfReservedTokens[account]; require(nrOfReservedTokens < nrOfWhitelistedTokens, "RM:EMAX"); require(nrOfTokens <= (nrOfWhitelistedTokens - nrOfReservedTokens), "RM:EMAX2"); } PaymentHandlerLib._handlePayment( 1, __s().reservationFeeWei, nrOfTokens, __s().reservePriceWeiPerToken, paymentMethodName ); _reserve(account, nrOfTokens); } // NOTE: This is always allowed function _reserveForAccounts( address[] memory accounts, uint256[] memory nrOfTokensArray ) internal { require(accounts.length == nrOfTokensArray.length, "RM:II"); for (uint256 i = 0; i < accounts.length; i++) { _reserve(accounts[i], nrOfTokensArray[i]); } } function _reserve( address account, uint256 nrOfTokens ) private { require(account != address(this), "RM:IA"); for (uint256 i = 0; i < nrOfTokens; i++) { bool found = false; while (__s().reservedTokenIdCounter < MinterLib._getTokenIdCounter()) { if (ERC721Lib._ownerOf(__s().reservedTokenIdCounter) == address(this)) { found = true; break; } __s().reservedTokenIdCounter += 1; } if (found) { ERC721Lib._transfer(address(this), account, __s().reservedTokenIdCounter); emit ReserveToken(account, __s().reservedTokenIdCounter); } else { MinterLib._justMintTo(account); emit ReserveToken(account, MinterLib._getTokenIdCounter() - 1); } __s().reservedTokenIdCounter += 1; } __s().nrOfReservedTokens[account] += nrOfTokens; __s().totalNrOfReservedTokens += nrOfTokens; } function __s() private pure returns (ReserveManagerStorage.Layout storage) { return ReserveManagerStorage.layout(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
// 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); }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./ERC721Internal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library ERC721Lib { function _setName(string memory name) internal { ERC721Internal._setName(name); } function _setSymbol(string memory symbol) internal { ERC721Internal._setSymbol(symbol); } function _exists(uint256 tokenId) internal view returns (bool) { return ERC721Internal._exists(tokenId); } function _ownerOf(uint256 tokenId) internal view returns (address) { return ERC721Internal._ownerOf(tokenId); } function _burn(uint256 tokenId) internal { ERC721Internal._burn(tokenId); } function _safeMint(address account, uint256 tokenId) internal { // TODO(kam): We don't have any safe mint in ERC721Internal ERC721Internal._mint(account, tokenId); } function _transfer(address from, address to, uint256 tokenId) internal { ERC721Internal._transfer(from, to, tokenId); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./MinterInternal.sol"; library MinterLib { function _justMintTo( address owner ) internal returns (uint256) { return MinterInternal._justMintTo(owner); } function _getTokenIdCounter() internal view returns (uint256) { return MinterInternal._getTokenIdCounter(); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./WhitelistManagerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library WhitelistManagerLib { function _getWhitelistEntry(address account) internal view returns (uint256) { return WhitelistManagerInternal._getWhitelistEntry(account); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./PaymentHandlerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library PaymentHandlerLib { function _handlePayment( uint256 nrOfItems1, uint256 priceWeiPerItem1, uint256 nrOfItems2, uint256 priceWeiPerItem2, string memory paymentMethodName ) internal { PaymentHandlerInternal._handlePayment( nrOfItems1, priceWeiPerItem1, nrOfItems2, priceWeiPerItem2, paymentMethodName ); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library ReserveManagerStorage { struct Layout { bool reservationAllowed; bool reservationAllowedWithoutWhitelisting; uint256 reservationFeeWei; uint256 reservePriceWeiPerToken; uint256 reservedTokenIdCounter; mapping(address => uint256) nrOfReservedTokens; uint256 totalNrOfReservedTokens; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.reserve-manager.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "../token-store/TokenStoreLib.sol"; import "../minter/MinterLib.sol"; import "../reserve-manager/ReserveManagerLib.sol"; import "./ERC721Storage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library ERC721Internal { event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); event Approval( address indexed owner, address indexed approved, uint256 indexed tokenId ); event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); function _setERC721Settings( string memory name_, string memory symbol_, bool reserveZeroToken ) internal { _setName(name_); _setSymbol(symbol_); if (reserveZeroToken && !_exists(0)) { MinterLib._justMintTo(address(this)); ReserveManagerLib._initReserveManager(); } } function _getName() internal view returns (string memory) { return __s().name; } function _setName(string memory name) internal { __s().name = name; } function _getSymbol() internal view returns (string memory) { return __s().symbol; } function _setSymbol(string memory symbol) internal { __s().symbol = symbol; } function _balanceOf(address owner) internal view returns (uint256) { require(owner != address(0), "ERC721I:ZA"); return __s().balances[owner]; } function _ownerOf(uint256 tokenId) internal view returns (address) { address owner = __s().owners[tokenId]; require(owner != address(0), "ERC721I:NET"); return owner; } function _exists(uint256 tokenId) internal view returns (bool) { return __s().owners[tokenId] != address(0); } function _mint(address to, uint256 tokenId) internal { require(to != address(0), "ERC721I:MZA"); require(!_exists(tokenId), "ERC721I:TAM"); __s().balances[to] += 1; __s().owners[tokenId] = to; emit Transfer(address(0), to, tokenId); TokenStoreLib._addToRelatedTokens(to, tokenId); } function _burn(uint256 tokenId) internal { address owner = _ownerOf(tokenId); // Clear approvals delete __s().tokenApprovals[tokenId]; __s().balances[owner] -= 1; delete __s().owners[tokenId]; emit Transfer(owner, address(0), tokenId); } function _transfer( address from, address to, uint256 tokenId ) internal { require(_ownerOf(tokenId) == from, "ERC721I:IO"); require(to != address(0), "ERC721I:ZA"); _unsafeTransfer(from, to, tokenId); } function _transferFromMe( address to, uint256 tokenId ) internal { require(_ownerOf(tokenId) == address(this), "ERC721I:IO"); require(to != address(0), "ERC721I:ZA"); _unsafeTransfer(address(this), to, tokenId); } function _unsafeTransfer( address from, address to, uint256 tokenId ) internal { // Clear approvals from the previous owner delete __s().tokenApprovals[tokenId]; __s().balances[from] -= 1; __s().balances[to] += 1; __s().owners[tokenId] = to; emit Transfer(from, to, tokenId); TokenStoreLib._addToRelatedTokens(to, tokenId); } function _getApproved(uint256 tokenId) internal view returns (address) { require(_ownerOf(tokenId) != address(0), "ERC721I:NET"); return __s().tokenApprovals[tokenId]; } function _isApprovedForAll(address owner, address operator) internal view returns (bool) { return __s().operatorApprovals[owner][operator]; } function _isApprovedOrOwner( address spender, uint256 tokenId ) internal view returns (bool) { address owner = _ownerOf(tokenId); return ( spender == owner || __s().operatorApprovals[owner][spender] || __s().tokenApprovals[tokenId] == spender ); } function _approve(address to, uint256 tokenId) internal { __s().tokenApprovals[tokenId] = to; emit Approval(_ownerOf(tokenId), to, tokenId); } function _setApprovalForAll( address owner, address operator, bool approved ) internal { require(owner != operator, "ERC721I:ATC"); __s().operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } function __s() private pure returns (ERC721Storage.Layout storage) { return ERC721Storage.layout(); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./TokenStoreInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library TokenStoreLib { function _getTokenURI(uint256 tokenId) internal view returns (string memory) { return TokenStoreInternal._getTokenURI(tokenId); } function _setTokenURI( uint256 tokenId, string memory tokenURI_ ) internal { TokenStoreInternal._setTokenURI(tokenId, tokenURI_); } function _setTokenData(uint256 tokenId, string memory data) internal { TokenStoreInternal._setTokenData(tokenId, data); } function _addToRelatedTokens(address account, uint256 tokenId) internal { TokenStoreInternal._addToRelatedTokens(account, tokenId); } function _deleteTokenInfo( uint256 tokenId ) internal { TokenStoreInternal._deleteTokenInfo(tokenId); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./ReserveManagerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library ReserveManagerLib { function _initReserveManager() internal { ReserveManagerInternal._initReserveManager(); } function _reserveForAccount( address account, uint256 nrOfTokens, string memory paymentMethodName ) internal { ReserveManagerInternal._reserveForAccount( account, nrOfTokens, paymentMethodName ); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library ERC721Storage { // Members are copied from: // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol struct Layout { // Token name string name; // Token symbol string symbol; // Mapping from token ID to owner address mapping(uint256 => address) owners; // Mapping owner address to token count mapping(address => uint256) balances; // Mapping from token ID to approved address mapping(uint256 => address) tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) operatorApprovals; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.erc721.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "@openzeppelin/contracts/utils/Strings.sol"; import "../erc721/ERC721Lib.sol"; import "./TokenStoreStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library TokenStoreInternal { event TokenURIChange(uint256 tokenId, string tokenURI); event TokenDataChange(uint256 tokenId, string data); function _getTokenStoreSettings() internal view returns ( string memory, string memory, bool, string memory, string memory ) { return ( __s().baseTokenURI, __s().defaultTokenURI, __s().useIdempotentTokenURIs, __s().idempotentTokenURIBase, __s().idempotentTokenURIExtension ); } function _setTokenStoreSettings( string memory baseTokenURI, string memory defaultTokenURI, bool useIdempotentTokenURIs, string memory idempotentTokenURIBase, string memory idempotentTokenURIExtension ) internal { __s().baseTokenURI = baseTokenURI; __s().defaultTokenURI = defaultTokenURI; __s().useIdempotentTokenURIs = useIdempotentTokenURIs; __s().idempotentTokenURIBase = idempotentTokenURIBase; __s().idempotentTokenURIExtension = idempotentTokenURIExtension; } function _getTokenURI(uint256 tokenId) internal view returns (string memory) { require(ERC721Lib._exists(tokenId), "TSI:NET"); if (__s().useIdempotentTokenURIs) { return string( abi.encodePacked( __s().idempotentTokenURIBase, Strings.toString(tokenId), __s().idempotentTokenURIExtension ) ); } string memory vTokenURI = __s().tokenInfos[tokenId].uri; if (bytes(vTokenURI).length == 0) { return __s().defaultTokenURI; } if (bytes(__s().baseTokenURI).length == 0) { return vTokenURI; } return string(abi.encodePacked(__s().baseTokenURI, vTokenURI)); } function _setTokenURI( uint256 tokenId, string memory tokenURI_ ) internal { require(ERC721Lib._exists(tokenId), "TSI:NET"); __s().tokenInfos[tokenId].uri = tokenURI_; emit TokenURIChange(tokenId, tokenURI_); // WARN: This will override the previous token if the same // uri is being used twice. __s().tokenIndex[keccak256(bytes(tokenURI_))] = tokenId; } function _getTokenData(uint256 tokenId) internal view returns (string memory) { require(ERC721Lib._exists(tokenId), "TSI:NET"); return __s().tokenInfos[tokenId].data; } function _setTokenData( uint256 tokenId, string memory data ) internal { require(ERC721Lib._exists(tokenId), "TSF:NET"); __s().tokenInfos[tokenId].data = data; emit TokenDataChange(tokenId, data); // WARN: This will override the previous token if the same // data is being used twice. __s().tokenIndex[keccak256(bytes(data))] = tokenId; } function _updateTokens( uint256[] memory tokenIds, string[] memory uris, string[] memory datas ) internal { require(tokenIds.length > 0, "M:NTU"); require(tokenIds.length == uris.length, "M:IL"); require(tokenIds.length == datas.length, "M:IL2"); for (uint256 i = 0; i < uris.length; i++) { _setTokenURI(tokenIds[i], uris[i]); _setTokenData(tokenIds[i], datas[i]); } } function _getRelatedTokens(address account) internal view returns (uint256[] memory) { return __s().relatedTokens[account]; } function _addToRelatedTokens(address account, uint256 tokenId) internal { __s().relatedTokens[account].push(tokenId); } function _ownedTokens(address account) internal view returns (uint256[] memory) { uint256 length = 0; if (account != address(0)) { for (uint256 i = 0; i < _getRelatedTokens(account).length; i++) { uint256 tokenId = _getRelatedTokens(account)[i]; if (ERC721Lib._exists(tokenId) && ERC721Lib._ownerOf(tokenId) == account) { length += 1; } } } uint256[] memory tokens = new uint256[](length); if (account != address(0)) { uint256 index = 0; for (uint256 i = 0; i < _getRelatedTokens(account).length; i++) { uint256 tokenId = _getRelatedTokens(account)[i]; if (ERC721Lib._exists(tokenId) && ERC721Lib._ownerOf(tokenId) == account) { tokens[index] = tokenId; index += 1; } } } return tokens; } function _deleteTokenInfo( uint256 tokenId ) internal { if (bytes(__s().tokenInfos[tokenId].uri).length != 0) { delete __s().tokenInfos[tokenId]; } } function _findToken(string memory evidence) internal view returns (uint256) { return __s().tokenIndex[keccak256(bytes(evidence))]; } function __s() private pure returns (TokenStoreStorage.Layout storage) { return TokenStoreStorage.layout(); } }
// 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); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library TokenStoreStorage { struct TokenInfo { string uri; string data; } struct Layout { string baseTokenURI; string defaultTokenURI; bool useIdempotentTokenURIs; string idempotentTokenURIBase; string idempotentTokenURIExtension; mapping(uint256 => TokenInfo) tokenInfos; mapping(address => uint256[]) relatedTokens; // Mapping from hash(uri) and hash(data) to token ID mapping(bytes32 => uint256) tokenIndex; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.token-store.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "../token-store/TokenStoreLib.sol"; import "../royalty-manager/RoyaltyManagerLib.sol"; import "../payment-handler/PaymentHandlerLib.sol"; import "./MinterStorage.sol"; library MinterInternal { event PreMint(uint256 nrOfTokens); function _getMintSettings() internal view returns (bool, bool, uint256, uint256, uint256, uint256, uint256) { return ( __s().publicMinting, __s().directMintingAllowed, __s().mintFeeWei, __s().mintPriceWeiPerToken, __s().maxTokenId, __s().nrOfMints, __s().nrOfBurns ); } function _setMintSettings( bool publicMinting, bool directMintingAllowed, uint256 mintFeeWei, uint256 mintPriceWeiPerToken, uint256 maxTokenId ) internal { __s().publicMinting = publicMinting; __s().directMintingAllowed = directMintingAllowed; __s().mintFeeWei = mintFeeWei; __s().mintPriceWeiPerToken = mintPriceWeiPerToken; __s().maxTokenId = maxTokenId; } function _burn(uint256 tokenId) internal { ERC721Lib._burn(tokenId); TokenStoreLib._deleteTokenInfo(tokenId); __s().nrOfBurns += 1; } function _getTokenIdCounter() internal view returns (uint256) { return __s().tokenIdCounter; } function _justMintTo( address owner ) internal returns (uint256) { uint256 tokenId = __s().tokenIdCounter; require(__s().maxTokenId == 0 || tokenId <= __s().maxTokenId, "MI:MAX"); __s().tokenIdCounter += 1; if (owner == address(this)) { ERC721Lib._safeMint(msg.sender, tokenId); ERC721Lib._transfer(msg.sender, address(this), tokenId); } else { ERC721Lib._safeMint(address(this), tokenId); ERC721Lib._transfer(address(this), owner, tokenId); } __s().nrOfMints += 1; return tokenId; } function _preMint(uint256 nrOfTokens) internal { require(nrOfTokens > 0, "MI:ZT"); for (uint256 i = 1; i <= nrOfTokens; i++) { _justMintTo(address(this)); } emit PreMint(nrOfTokens); } function _mint( address[] memory owners, string[] memory uris, string[] memory datas, address[] memory royaltyWallets, uint256[] memory royaltyPercentages, bool handlePayment, string memory paymentMethodName ) internal { require(__s().directMintingAllowed, "MI:DMNA"); require(uris.length > 0, "MI:NTM"); require(datas.length == 0 || uris.length == datas.length, "MI:IL"); require(royaltyWallets.length == 0 || uris.length == royaltyWallets.length, "MI:IL2"); require(royaltyPercentages.length == 0 || uris.length == royaltyPercentages.length, "MI:IL3"); require(uris.length == owners.length, "MI:IL4"); if (handlePayment) { PaymentHandlerLib._handlePayment( 1, __s().mintFeeWei, uris.length, __s().mintPriceWeiPerToken, paymentMethodName ); } for (uint256 i = 0; i < uris.length; i++) { uint256 tokenId = __mintTo(owners[i], uris[i]); // Both royalty wallet and percentage must have sane values otherwise // the operator can always call other methods to set them. if ( royaltyWallets.length > 0 && royaltyPercentages.length > 0 && royaltyWallets[i] != address(0) && royaltyPercentages[i] > 0 ) { RoyaltyManagerLib._setTokenRoyaltyInfo( tokenId, royaltyWallets[i], royaltyPercentages[i]); } if (datas.length > 0) { TokenStoreLib._setTokenData(tokenId, datas[i]); } } } function __mintTo( address owner, string memory uri ) private returns (uint256) { uint256 tokenId = _justMintTo(owner); TokenStoreLib._setTokenURI(tokenId, uri); return tokenId; } function __s() private pure returns (MinterStorage.Layout storage) { return MinterStorage.layout(); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./RoyaltyManagerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library RoyaltyManagerLib { function _setTokenRoyaltyInfo( uint256 tokenId, address royaltyWallet, uint256 royaltyPercentage ) internal { RoyaltyManagerInternal._setTokenRoyaltyInfo( tokenId, royaltyWallet, royaltyPercentage ); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library MinterStorage { struct Layout { uint256 tokenIdCounter; bool publicMinting; bool directMintingAllowed; uint256 mintFeeWei; uint256 mintPriceWeiPerToken; uint256 maxTokenId; uint256 nrOfMints; uint256 nrOfBurns; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.minter.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "../erc721/ERC721Lib.sol"; import "./RoyaltyManagerStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library RoyaltyManagerInternal { event TokenRoyaltyInfoChanged( uint256 tokenId, address royaltyWallet, uint256 royaltyPercentage ); event TokenRoyaltyExempt( uint256 tokenId, bool exempt ); function _getDefaultRoyaltySettings() internal view returns (address, uint256) { return (__s().defaultRoyaltyWallet, __s().defaultRoyaltyPercentage); } // Either set address to zero or set percentage to zero to disable // default royalties. Still, royalties set per token work. function _setDefaultRoyaltySettings( address newDefaultRoyaltyWallet, uint256 newDefaultRoyaltyPercentage ) internal { __s().defaultRoyaltyWallet = newDefaultRoyaltyWallet; require( newDefaultRoyaltyPercentage >= 0 && newDefaultRoyaltyPercentage <= 100, "ROMI:WP" ); __s().defaultRoyaltyPercentage = newDefaultRoyaltyPercentage; } function _getTokenRoyaltyInfo(uint256 tokenId) internal view returns (address, uint256, bool) { require(ERC721Lib._exists(tokenId), "ROMI:NET"); return ( __s().tokenRoyalties[tokenId].royaltyWallet, __s().tokenRoyalties[tokenId].royaltyPercentage, __s().tokenRoyalties[tokenId].exempt ); } function _setTokenRoyaltyInfo( uint256 tokenId, address royaltyWallet, uint256 royaltyPercentage ) internal { require(ERC721Lib._exists(tokenId), "ROMI:NET"); require(royaltyPercentage >= 0 && royaltyPercentage <= 100, "ROMI:WP"); __s().tokenRoyalties[tokenId].royaltyWallet = royaltyWallet; __s().tokenRoyalties[tokenId].royaltyPercentage = royaltyPercentage; __s().tokenRoyalties[tokenId].exempt = false; emit TokenRoyaltyInfoChanged(tokenId, royaltyWallet, royaltyPercentage); } function _exemptTokenRoyalty(uint256 tokenId, bool exempt) internal { require(ERC721Lib._exists(tokenId), "ROMI:NET"); __s().tokenRoyalties[tokenId].exempt = exempt; emit TokenRoyaltyExempt(tokenId, exempt); } function _getRoyaltyInfo( uint256 tokenId, uint256 salePrice ) internal view returns (address, uint256) { require(ERC721Lib._exists(tokenId), "ROMI:NET"); RoyaltyManagerStorage.TokenRoyaltyInfo memory tokenRoyaltyInfo = __s().tokenRoyalties[tokenId]; if (tokenRoyaltyInfo.exempt) { return (address(0), 0); } address royaltyWallet = tokenRoyaltyInfo.royaltyWallet; uint256 royaltyPercentage = tokenRoyaltyInfo.royaltyPercentage; if (royaltyWallet == address(0) || royaltyPercentage == 0) { royaltyWallet = __s().defaultRoyaltyWallet; royaltyPercentage = __s().defaultRoyaltyPercentage; } if (royaltyWallet == address(0) || royaltyPercentage == 0) { return (address(0), 0); } uint256 royalty = (salePrice * royaltyPercentage) / 100; return (royaltyWallet, royalty); } function __s() private pure returns (RoyaltyManagerStorage.Layout storage) { return RoyaltyManagerStorage.layout(); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library RoyaltyManagerStorage { struct TokenRoyaltyInfo { address royaltyWallet; uint256 royaltyPercentage; bool exempt; } struct Layout { address defaultRoyaltyWallet; uint256 defaultRoyaltyPercentage; mapping(uint256 => TokenRoyaltyInfo) tokenRoyalties; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.royalty-manager.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "../../IUniswapV2Pair.sol"; import "../payment-method-manager/PaymentMethodManagerLib.sol"; import "./PaymentHandlerStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library PaymentHandlerInternal { bytes32 constant public WEI_PAYMENT_METHOD_HASH = keccak256(abi.encode("WEI")); event TransferTo( address to, uint256 amount, string data ); event TransferETH20To( string paymentMethodName, address to, uint256 amount, string data ); function _getPaymentHandlerSettings() internal view returns (address) { return __s().payoutAddress; } function _setPaymentHandlerSettings( address payoutAddress ) internal { __s().payoutAddress = payoutAddress; } function _transferTo( string memory paymentMethodName, address to, uint256 amount, string memory data ) internal { require(to != address(0), "PH:TTZ"); require(amount > 0, "PH:ZAM"); bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(nameHash == WEI_PAYMENT_METHOD_HASH || PaymentMethodManagerLib._paymentMethodExists(nameHash), "PH:MNS"); if (nameHash == WEI_PAYMENT_METHOD_HASH) { require(amount <= address(this).balance, "PH:MTB"); /* solhint-disable avoid-low-level-calls */ (bool success, ) = to.call{value: amount}(new bytes(0)); /* solhint-enable avoid-low-level-calls */ require(success, "PH:TF"); emit TransferTo(to, amount, data); } else { address erc20 = PaymentMethodManagerLib._getERC20PaymentMethodAddress(nameHash); require(amount <= IERC20(erc20).balanceOf(address(this)), "PH:MTB"); IERC20(erc20).transfer(to, amount); emit TransferETH20To(paymentMethodName, to, amount, data); } } function _handlePayment( uint256 nrOfItems1, uint256 priceWeiPerItem1, uint256 nrOfItems2, uint256 priceWeiPerItem2, string memory paymentMethodName ) internal { uint256 totalWei = nrOfItems1 * priceWeiPerItem1 + nrOfItems2 * priceWeiPerItem2; if (totalWei == 0) { return; } bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(nameHash == WEI_PAYMENT_METHOD_HASH || PaymentMethodManagerLib._paymentMethodExists(nameHash), "PH:MNS"); if (nameHash == WEI_PAYMENT_METHOD_HASH) { PaymentMethodManagerLib._handleWeiPayment( msg.sender, __s().payoutAddress, msg.value, totalWei, ""); } else { PaymentMethodManagerLib. _handleERC20Payment( paymentMethodName, msg.sender, __s().payoutAddress, totalWei, ""); } } function __s() private pure returns (PaymentHandlerStorage.Layout storage) { return PaymentHandlerStorage.layout(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./PaymentMethodManagerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library PaymentMethodManagerLib { function _handleWeiPayment( address payer, address dest, uint256 paidPriceWei, // could be the msg.value uint256 priceWeiToPay, string memory data ) internal { PaymentMethodManagerInternal._handleWeiPayment( payer, dest, paidPriceWei, priceWeiToPay, data ); } function _handleERC20Payment( string memory paymentMethodName, address payer, address dest, uint256 priceWeiToPay, string memory data ) internal { PaymentMethodManagerInternal._handleERC20Payment( paymentMethodName, payer, dest, priceWeiToPay, data ); } function _paymentMethodExists( bytes32 paymentMethodNameHash ) internal view returns (bool) { return PaymentMethodManagerLib._paymentMethodExists(paymentMethodNameHash); } function _paymentMethodEnabled( bytes32 paymentMethodNameHash ) internal view returns (bool) { return PaymentMethodManagerLib._paymentMethodEnabled(paymentMethodNameHash); } function _getERC20PaymentMethodAddress( bytes32 paymentMethodNameHash ) internal view returns (address) { return PaymentMethodManagerLib._getERC20PaymentMethodAddress(paymentMethodNameHash); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library PaymentHandlerStorage { struct Layout { address payoutAddress; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.payment-handler.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "../../IUniswapV2Pair.sol"; import "./PaymentMethodManagerStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library PaymentMethodManagerInternal { event ERC20PaymentMethodUpdate( string paymentMethodName, address erc20, address wethPair, bool enabled, string data ); event WeiPayment( address payer, address dest, uint256 paidPriceWei, uint256 priceWeiToPay, string data ); event ERC20Payment( string paymentMethodName, address payer, address dest, uint256 amountWei, uint256 amountTokens, string data ); function _getPaymentMethodManagerSettings() internal view returns (address) { return __s().wethAddress; } function _setPaymentMethodManagerSettings( address wethAddress ) internal { __s().wethAddress = wethAddress; } function _getERC20PaymentMethods() internal view returns (string[] memory) { return __s().erc20PaymentMethodNames; } function _getERC20PaymentMethod( string memory paymentMethodName ) internal view returns (address, address, bool) { bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(_paymentMethodExists(nameHash), "PMM:NEM"); return ( __s().erc20PaymentMethods[nameHash].erc20, __s().erc20PaymentMethods[nameHash].wethPair, __s().erc20PaymentMethods[nameHash].enabled ); } function _addOrUpdateERC20PaymentMethod( string memory paymentMethodName, address erc20, address wethPair, bool enabled, string memory data ) internal { bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); __s().erc20PaymentMethods[nameHash].erc20 = erc20; __s().erc20PaymentMethods[nameHash].wethPair = wethPair; __s().erc20PaymentMethods[nameHash].enabled = enabled; address token0 = IUniswapV2Pair(wethPair).token0(); address token1 = IUniswapV2Pair(wethPair).token1(); require(token0 == __s().wethAddress || token1 == __s().wethAddress, "PMM:IPC"); bool reverseIndices = (token1 == __s().wethAddress); __s().erc20PaymentMethods[nameHash].reverseIndices = reverseIndices; if (__s().erc20PaymentMethodNamesIndex[paymentMethodName] == 0) { __s().erc20PaymentMethodNames.push(paymentMethodName); __s().erc20PaymentMethodNamesIndex[paymentMethodName] = __s().erc20PaymentMethodNames.length; } emit ERC20PaymentMethodUpdate( paymentMethodName, erc20, wethPair, enabled, data); } function _enableERC20TokenPayment( string memory paymentMethodName, bool enabled ) internal { bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(_paymentMethodExists(nameHash), "PMM:NEM"); __s().erc20PaymentMethods[nameHash].enabled = enabled; emit ERC20PaymentMethodUpdate( paymentMethodName, __s().erc20PaymentMethods[nameHash].erc20, __s().erc20PaymentMethods[nameHash].wethPair, enabled, "" ); } function _handleWeiPayment( address payer, address dest, uint256 paidPriceWei, // could be the msg.value uint256 priceWeiToPay, string memory data ) internal { require(paidPriceWei >= priceWeiToPay, "PMM:IF"); uint256 remainder = paidPriceWei - priceWeiToPay; if (dest != address(0)) { /* solhint-disable avoid-low-level-calls */ (bool success, ) = dest.call{value: priceWeiToPay}(new bytes(0)); /* solhint-enable avoid-low-level-calls */ require(success, "PMM:TF"); emit WeiPayment(payer, dest, paidPriceWei, priceWeiToPay, data); } else { emit WeiPayment( payer, address(this), paidPriceWei, priceWeiToPay, data); } if (remainder > 0) { /* solhint-disable avoid-low-level-calls */ (bool success, ) = payer.call{value: remainder}(new bytes(0)); /* solhint-enable avoid-low-level-calls */ require(success, "PMM:RTF"); } } function _handleERC20Payment( string memory paymentMethodName, address payer, address dest, uint256 priceWeiToPay, string memory data ) internal { bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(_paymentMethodExists(nameHash), "PMM:NEM"); require(_paymentMethodEnabled(nameHash), "PMM:NENM"); PaymentMethodManagerStorage.ERC20PaymentMethod memory paymentMethod = __s().erc20PaymentMethods[nameHash]; (uint112 amount0, uint112 amount1,) = IUniswapV2Pair(paymentMethod.wethPair).getReserves(); uint256 reserveWei = amount0; uint256 reserveTokens = amount1; if (paymentMethod.reverseIndices) { reserveWei = amount1; reserveTokens = amount0; } require(reserveWei > 0, "PMM:NWR"); // TODO(kam): check if this is OK uint256 amountTokens = (priceWeiToPay * reserveTokens) / reserveWei; if (dest == address(0)) { dest = address(this); } // this contract must have already been approved by the msg.sender IERC20(paymentMethod.erc20).transferFrom(payer, dest, amountTokens); emit ERC20Payment( paymentMethodName, payer, dest, priceWeiToPay, amountTokens, data); } function _paymentMethodExists( bytes32 paymentMethodNameHash ) internal view returns (bool) { return __s().erc20PaymentMethods[paymentMethodNameHash].erc20 != address(0) && __s().erc20PaymentMethods[paymentMethodNameHash].wethPair != address(0); } function _paymentMethodEnabled( bytes32 paymentMethodNameHash ) internal view returns (bool) { return __s().erc20PaymentMethods[paymentMethodNameHash].enabled; } function _getERC20PaymentMethodAddress( bytes32 paymentMethodNameHash ) internal view returns (address) { require(_paymentMethodExists(paymentMethodNameHash), "PMM:NEM"); return __s().erc20PaymentMethods[paymentMethodNameHash].erc20; } function __s() private pure returns (PaymentMethodManagerStorage.Layout storage) { return PaymentMethodManagerStorage.layout(); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library PaymentMethodManagerStorage { struct ERC20PaymentMethod { // The internal unique name of the ERC-20 payment method string name; // The ERC-20 contract address erc20; // Uniswap V2 Pair with WETH address wethPair; // True if the read pair from Uniswap has a reverse ordering // for contract addresses bool reverseIndices; // If the payment method is enabled bool enabled; } struct Layout { // The WETH ERC-20 contract address. // On mainnet, it is: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 address wethAddress; // The list of the existing ERC20 payment method names string[] erc20PaymentMethodNames; mapping(string => uint256) erc20PaymentMethodNamesIndex; // name > erc20 payment method mapping(bytes32 => ERC20PaymentMethod) erc20PaymentMethods; // Reserved for future upgrades mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.payment-method-manager.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "../payment-handler/PaymentHandlerLib.sol"; import "./WhitelistManagerStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library WhitelistManagerInternal { event Whitelist(address account, uint256 nrOfTokens); function _getWhitelistingSettings() internal view returns (bool, uint256, uint256, uint256, uint256) { return ( __s().whitelistingAllowed, __s().whitelistingFeeWei, __s().whitelistingPriceWeiPerToken, __s().maxNrOfWhitelistedTokensPerAccount, __s().totalNrOfWhitelists ); } function _setWhitelistingSettings( bool whitelistingAllowed, uint256 whitelistingFeeWei, uint256 whitelistingPriceWeiPerToken, uint256 maxNrOfWhitelistedTokensPerAccount ) internal { __s().whitelistingAllowed = whitelistingAllowed; __s().whitelistingFeeWei = whitelistingFeeWei; __s().whitelistingPriceWeiPerToken = whitelistingPriceWeiPerToken; __s().maxNrOfWhitelistedTokensPerAccount = maxNrOfWhitelistedTokensPerAccount; } // NOTE: Send 0 for nrOfTokens to de-list the address function _whitelistAccount( address account, uint256 nrOfTokens, string memory paymentMethodName ) internal { require(__s().whitelistingAllowed, "WM:NA"); PaymentHandlerLib._handlePayment( 1, __s().whitelistingFeeWei, nrOfTokens, __s().whitelistingPriceWeiPerToken, paymentMethodName ); _whitelist(account, nrOfTokens); } // NOTE: Send 0 for nrOfTokens to de-list an address // NOTE: This is always allowed function _whitelistAccounts( address[] memory accounts, uint256[] memory nrOfTokensArray ) internal { require(accounts.length == nrOfTokensArray.length, "WM:IL"); for (uint256 i = 0; i < accounts.length; i++) { _whitelist(accounts[i], nrOfTokensArray[i]); } } function _getWhitelistEntry(address account) internal view returns (uint256) { return __s().whitelistEntries[account]; } function _whitelist( address account, uint256 nrOfTokens ) private { require(__s().maxNrOfWhitelistedTokensPerAccount == 0 || nrOfTokens <= __s().maxNrOfWhitelistedTokensPerAccount, "WM:EMAX"); if (nrOfTokens == 0){ // de-list the account uint256 nrOfTokensToBeRemoved = __s().whitelistEntries[account]; __s().whitelistEntries[account] = 0; __s().totalNrOfWhitelists -= nrOfTokensToBeRemoved; } else{ __s().whitelistEntries[account] = nrOfTokens; __s().totalNrOfWhitelists += nrOfTokens; } emit Whitelist(account, nrOfTokens); } function __s() private pure returns (WhitelistManagerStorage.Layout storage) { return WhitelistManagerStorage.layout(); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library WhitelistManagerStorage { struct Layout { bool whitelistingAllowed; uint256 whitelistingFeeWei; uint256 whitelistingPriceWeiPerToken; uint256 maxNrOfWhitelistedTokensPerAccount; mapping(address => uint256) whitelistEntries; uint256 totalNrOfWhitelists; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.whitelist-manager.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"getFacetName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFacetPI","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFacetProtectedPI","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFacetVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReservationSettings","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"nrOfTokensArray","type":"uint256[]"}],"name":"reserveForAccounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nrOfTokens","type":"uint256"},{"internalType":"string","name":"paymentMethodName","type":"string"}],"name":"reserveForMe","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bool","name":"reservationAllowed","type":"bool"},{"internalType":"bool","name":"reservationAllowedWithoutWhitelisting","type":"bool"},{"internalType":"uint256","name":"reservationFeeWei","type":"uint256"},{"internalType":"uint256","name":"reservePriceWeiPerToken","type":"uint256"}],"name":"setReservationSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50611ef9806100206000396000f3fe6080604052600436106100865760003560e01c806368498a331161005957806368498a331461011a5780638887005d1461012f578063eb15dd2714610155578063f2278f8714610175578063f8c2be4f1461019557610086565b806301ffc9a71461008b5780631078fade146100c1578063320dcd97146100e35780636239d4b414610105575b600080fd5b34801561009757600080fd5b506100ab6100a636600461179d565b6101aa565b6040516100b891906119d6565b60405180910390f35b3480156100cd57600080fd5b506100d66101c4565b6040516100b89190611976565b3480156100ef57600080fd5b506100f861034a565b6040516100b89190611a06565b610118610113366004611813565b610373565b005b34801561012657600080fd5b506100d6610382565b34801561013b57600080fd5b50610144610432565b6040516100b89594939291906119e1565b34801561016157600080fd5b5061011861017036600461166a565b610453565b34801561018157600080fd5b50610118610190366004611758565b61045d565b3480156101a157600080fd5b506100f861046f565b6001600160e01b0319811663b2fe033560e01b145b919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816101e05790505090506040518060400160405280601881526020017f6765745265736572766174696f6e53657474696e6773282900000000000000008152508160008151811061024e57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250604051806060016040528060318152602001611e93603191398160018151811061029357634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280601c81526020017f72657365727665466f724d652875696e743235362c737472696e672900000000815250816002815181106102f557634e487b7160e01b600052603260045260246000fd5b6020026020010181905250604051806060016040528060278152602001611e6c602791398160038151811061033a57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152905090565b60408051808201909152600f81526e3932b9b2b93b3296b6b0b730b3b2b960891b602082015290565b61037e33838361048e565b5050565b604080516002808252606082810190935260009190816020015b606081526020019060019003908161039c579050509050604051806060016040528060318152602001611e9360319139816000815181106103ed57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250604051806060016040528060278152602001611e6c602791398160018151811061033a57634e487b7160e01b600052603260045260246000fd5b6000806000806000610442610588565b945094509450945094509091929394565b61037e82826105e2565b61046984848484610679565b50505050565b6040805180820190915260058152640332e312e360dc1b602082015290565b6104966106d0565b5460ff166104bf5760405162461bcd60e51b81526004016104b690611c2d565b60405180910390fd5b6104c76106d0565b54610100900460ff166105555760006104df846106df565b905060006104eb6106d0565b6001600160a01b0386166000908152600491909101602052604090205490508181106105295760405162461bcd60e51b81526004016104b690611c6c565b6105338183611d95565b8411156105525760405162461bcd60e51b81526004016104b690611b20565b50505b61057960016105626106d0565b600101548461056f6106d0565b60020154856106f0565b6105838383610704565b505050565b60008060008060006105986106d0565b5460ff166105a46106d0565b54610100900460ff166105b56106d0565b600101546105c16106d0565b600201546105cd6106d0565b60050154945094509450945094509091929394565b80518251146106035760405162461bcd60e51b81526004016104b690611ba8565b60005b82518110156105835761066783828151811061063257634e487b7160e01b600052603260045260246000fd5b602002602001015183838151811061065a57634e487b7160e01b600052603260045260246000fd5b6020026020010151610704565b8061067181611e13565b915050610606565b836106826106d0565b805460ff19169115159190911790558261069a6106d0565b80549115156101000261ff0019909216919091179055816106b96106d0565b60010155806106c66106d0565b6002015550505050565b60006106da610903565b905090565b60006106ea82610927565b92915050565b6106fd8585858585610953565b5050505050565b6001600160a01b03821630141561072d5760405162461bcd60e51b81526004016104b690611c8d565b60005b8181101561089a5760005b610743610a98565b61074b6106d0565b6003015410156107a8573061076a6107616106d0565b60030154610aa2565b6001600160a01b03161415610781575060016107a8565b600161078b6106d0565b600301600082825461079d9190611d3e565b9091555061073b9050565b801561080d576107c430856107bb6106d0565b60030154610aad565b7f736a5106267f2aefa6876d34eb936754ab687cab83a8314017fd327eb7cf0c38846107ee6106d0565b6003015460405161080092919061195d565b60405180910390a1610864565b61081684610ab8565b507f736a5106267f2aefa6876d34eb936754ab687cab83a8314017fd327eb7cf0c38846001610843610a98565b61084d9190611d95565b60405161085b92919061195d565b60405180910390a15b600161086e6106d0565b60030160008282546108809190611d3e565b90915550829150610892905081611e13565b915050610730565b50806108a46106d0565b6004016000846001600160a01b03166001600160a01b0316815260200190815260200160002060008282546108d99190611d3e565b909155508190506108e86106d0565b60050160008282546108fa9190611d3e565b90915550505050565b7f1112f5cf60fb4141783e19a055147d95474ef924bfa04c648816921afcffeb7490565b6000610931610ac3565b6001600160a01b03929092166000908152600490920160205250604090205490565b600061095f8385611d76565b6109698688611d76565b6109739190611d3e565b90508061098057506106fd565b6000826040516020016109939190611a06565b6040516020818303038152906040528051906020012090506040516020016109ba90611ccc565b604051602081830303815290604052805190602001208114806109e157506109e181610acd565b6109fd5760405162461bcd60e51b81526004016104b690611b67565b604051602001610a0c90611ccc565b60405160208183030381529060405280519060200120811415610a5f57610a5a33610a35610ad8565b546040805160208101909152600081526001600160a01b039091169034908690610ae2565b610a8f565b610a8f8333610a6c610ad8565b546040805160208101909152600081526001600160a01b03909116908690610aef565b50505050505050565b60006106da610afc565b60006106ea82610b0c565b610583838383610b52565b60006106ea82610bbc565b60006106da610c90565b60006106ea82610acd565b60006106da610cb4565b6106fd8585858585610cd8565b6106fd8585858585610ec2565b6000610b0661120d565b54905090565b600080610b17611217565b600084815260029190910160205260409020546001600160a01b03169050806106ea5760405162461bcd60e51b81526004016104b690611be7565b826001600160a01b0316610b6582610b0c565b6001600160a01b031614610b8b5760405162461bcd60e51b81526004016104b690611afc565b6001600160a01b038216610bb15760405162461bcd60e51b81526004016104b690611a70565b610583838383611221565b600080610bc761120d565b549050610bd261120d565b600401541580610bed5750610be561120d565b600401548111155b610c095760405162461bcd60e51b81526004016104b690611cac565b6001610c1361120d565b8054600090610c23908490611d3e565b90915550506001600160a01b038316301415610c5357610c433382611342565b610c4e333083610aad565b610c68565b610c5d3082611342565b610c68308483610aad565b6001610c7261120d565b6005016000828254610c849190611d3e565b90915550909392505050565b7f6a750c3f0170e00826e45980ae09840984f615da7bb80c8479ebe8542325a0d590565b7fbbdc48a4c38ee68aae7b7a4d695913f62d41dea3b689e93b0a6ca9163997770990565b81831015610cf85760405162461bcd60e51b81526004016104b690611c4c565b6000610d048385611d95565b90506001600160a01b03851615610de757604080516000808252602082019092526001600160a01b038716908590604051610d3f91906118d8565b60006040518083038185875af1925050503d8060008114610d7c576040519150601f19603f3d011682016040523d82523d6000602084013e610d81565b606091505b5050905080610da25760405162461bcd60e51b81526004016104b690611bc7565b7fae01f7fdfbf70980d6561b6b989d6c37709c4beec3fdbbf489e2644ed0e9e01d8787878787604051610dd9959493929190611918565b60405180910390a150610e27565b7fae01f7fdfbf70980d6561b6b989d6c37709c4beec3fdbbf489e2644ed0e9e01d8630868686604051610e1e959493929190611918565b60405180910390a15b8015610eba57604080516000808252602082019092526001600160a01b038816908390604051610e5791906118d8565b60006040518083038185875af1925050503d8060008114610e94576040519150601f19603f3d011682016040523d82523d6000602084013e610e99565b606091505b5050905080610a8f5760405162461bcd60e51b81526004016104b690611adb565b505050505050565b600085604051602001610ed59190611a06565b604051602081830303815290604052805190602001209050610ef68161134c565b610f125760405162461bcd60e51b81526004016104b690611c0c565b610f1b816113af565b610f375760405162461bcd60e51b81526004016104b690611a94565b6000610f416113da565b60030160008381526020019081526020016000206040518060a0016040529081600082018054610f7090611dd8565b80601f0160208091040260200160405190810160405280929190818152602001828054610f9c90611dd8565b8015610fe95780601f10610fbe57610100808354040283529160200191610fe9565b820191906000526020600020905b815481529060010190602001808311610fcc57829003601f168201915b505050918352505060018201546001600160a01b03908116602083015260029092015480831660408084019190915260ff600160a01b830481161515606080860191909152600160a81b909304161515608090930192909252838201518251630240bc6b60e21b8152925194955060009485949190911692630902f1ac926004808301939192829003018186803b15801561108357600080fd5b505afa158015611097573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bb91906117c5565b50606085015191935091506001600160701b038084169190831690156110ec5750506001600160701b038082169083165b6000821161110c5760405162461bcd60e51b81526004016104b690611b87565b600082611119838b611d76565b6111239190611d56565b90506001600160a01b038a16611137573099505b85602001516001600160a01b03166323b872dd8c8c846040518463ffffffff1660e01b815260040161116b939291906118f4565b602060405180830381600087803b15801561118557600080fd5b505af1158015611199573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bd9190611735565b507f1037c144de58762bd1228de78600efc4417a4454b1c3bd22079d10505b6c7deb8c8c8c8c858d6040516111f796959493929190611a19565b60405180910390a1505050505050505050505050565b60006106da6113e4565b60006106da611408565b611229611217565b60008281526004919091016020526040902080546001600160a01b03191690556001611253611217565b6003016000856001600160a01b03166001600160a01b0316815260200190815260200160002060008282546112889190611d95565b9091555060019050611298611217565b6003016000846001600160a01b03166001600160a01b0316815260200190815260200160002060008282546112cd9190611d3e565b909155508290506112dc611217565b6000838152600291909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4610583828261142c565b61037e8282611436565b6000806113576113da565b600084815260039190910160205260409020600101546001600160a01b0316148015906106ea575060006113896113da565b60009384526003016020526040909220600201546001600160a01b031690911415919050565b60006113b96113da565b6000928352600301602052506040902060020154600160a81b900460ff1690565b60006106da611533565b7f03cd5238ba7b5bfbba66bfdb519abdd9e7b08e4c8df3a518a3d0d7ab9a5c495a90565b7fd7aeb8e4f0c59b8cd9990692700804773e94b3a69feac86b7147c9c8edad330c90565b61037e8282611557565b6001600160a01b03821661145c5760405162461bcd60e51b81526004016104b690611b42565b61146581611591565b156114825760405162461bcd60e51b81526004016104b690611ab6565b600161148c611217565b6003016000846001600160a01b03166001600160a01b0316815260200190815260200160002060008282546114c19190611d3e565b909155508290506114d0611217565b6000838152600291909101602052604080822080546001600160a01b0319166001600160a01b03948516179055518392851691907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a461037e828261142c565b7feab495bca05def827c8b418094a353de6fa10ca0186c78b0e150e44e21830d8c90565b61155f6115bf565b6001600160a01b0390921660009081526006929092016020908152604083208054600181018255908452922090910155565b60008061159c611217565b60009384526002016020526040909220546001600160a01b031690911415919050565b60007f73fe048652e51f080002cab7173201110a5a7526ce7d7ec1a97184a03368b94f6106da565b600082601f8301126115f7578081fd5b8135602061160c61160783611d1a565b611ce9565b8281528181019085830183850287018401881015611628578586fd5b855b858110156116465781358452928401929084019060010161162a565b5090979650505050505050565b80516001600160701b03811681146101bf57600080fd5b6000806040838503121561167c578182fd5b823567ffffffffffffffff80821115611693578384fd5b818501915085601f8301126116a6578384fd5b813560206116b661160783611d1a565b82815281810190858301838502870184018b10156116d2578889fd5b8896505b848710156117085780356001600160a01b03811681146116f457898afd5b8352600196909601959183019183016116d6565b509650508601359250508082111561171e578283fd5b5061172b858286016115e7565b9150509250929050565b600060208284031215611746578081fd5b815161175181611e5a565b9392505050565b6000806000806080858703121561176d578182fd5b843561177881611e5a565b9350602085013561178881611e5a565b93969395505050506040820135916060013590565b6000602082840312156117ae578081fd5b81356001600160e01b031981168114611751578182fd5b6000806000606084860312156117d9578283fd5b6117e284611653565b92506117f060208501611653565b9150604084015163ffffffff81168114611808578182fd5b809150509250925092565b60008060408385031215611825578182fd5b8235915060208084013567ffffffffffffffff80821115611844578384fd5b818601915086601f830112611857578384fd5b81358181111561186957611869611e44565b61187b601f8201601f19168501611ce9565b91508082528784828501011115611890578485fd5b8084840185840137810190920192909252919491935090915050565b600081518084526118c4816020860160208601611dac565b601f01601f19169290920160200192915050565b600082516118ea818460208701611dac565b9190910192915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611952908301846118ac565b979650505050505050565b6001600160a01b03929092168252602082015260400190565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156119c957603f198886030184526119b78583516118ac565b9450928501929085019060010161199b565b5092979650505050505050565b901515815260200190565b9415158552921515602085015260408401919091526060830152608082015260a00190565b60006020825261175160208301846118ac565b600060c08252611a2c60c08301896118ac565b6001600160a01b03888116602085015287166040840152606083018690526080830185905282810360a0840152611a6381856118ac565b9998505050505050505050565b6020808252600a9082015269455243373231493a5a4160b01b604082015260600190565b602080825260089082015267504d4d3a4e454e4d60c01b604082015260600190565b6020808252600b908201526a455243373231493a54414d60a81b604082015260600190565b6020808252600790820152662826a69d292a2360c91b604082015260600190565b6020808252600a9082015269455243373231493a494f60b01b604082015260600190565b60208082526008908201526729269d22a6a0ac1960c11b604082015260600190565b6020808252600b908201526a455243373231493a4d5a4160a81b604082015260600190565b60208082526006908201526550483a4d4e5360d01b604082015260600190565b6020808252600790820152662826a69d272ba960c91b604082015260600190565b602080825260059082015264524d3a494960d81b604082015260600190565b6020808252600690820152652826a69d2a2360d11b604082015260600190565b6020808252600b908201526a115490cdcc8c524e93915560aa1b604082015260600190565b602080825260079082015266504d4d3a4e454d60c81b604082015260600190565b602080825260059082015264524d3a4e4160d81b604082015260600190565b6020808252600690820152652826a69d24a360d11b604082015260600190565b6020808252600790820152660a49a748a9a82b60cb1b604082015260600190565b602080825260059082015264524d3a494160d81b604082015260600190565b60208082526006908201526509a92749a82b60d31b604082015260600190565b60208082526003908201526257454960e81b604082015260600190565b604051601f8201601f1916810167ffffffffffffffff81118282101715611d1257611d12611e44565b604052919050565b600067ffffffffffffffff821115611d3457611d34611e44565b5060209081020190565b60008219821115611d5157611d51611e2e565b500190565b600082611d7157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d9057611d90611e2e565b500290565b600082821015611da757611da7611e2e565b500390565b60005b83811015611dc7578181015183820152602001611daf565b838111156104695750506000910152565b600281046001821680611dec57607f821691505b60208210811415611e0d57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611e2757611e27611e2e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114611e6857600080fd5b5056fe72657365727665466f724163636f756e747328616464726573735b5d2c75696e743235365b5d297365745265736572766174696f6e53657474696e677328626f6f6c2c626f6f6c2c75696e743235362c75696e7432353629a264697066735822122097f41666f8519f178fb75dcedc6e748d3f08066cfbb50bd8e4362c46f3cc494464736f6c63430008010033
Deployed Bytecode
0x6080604052600436106100865760003560e01c806368498a331161005957806368498a331461011a5780638887005d1461012f578063eb15dd2714610155578063f2278f8714610175578063f8c2be4f1461019557610086565b806301ffc9a71461008b5780631078fade146100c1578063320dcd97146100e35780636239d4b414610105575b600080fd5b34801561009757600080fd5b506100ab6100a636600461179d565b6101aa565b6040516100b891906119d6565b60405180910390f35b3480156100cd57600080fd5b506100d66101c4565b6040516100b89190611976565b3480156100ef57600080fd5b506100f861034a565b6040516100b89190611a06565b610118610113366004611813565b610373565b005b34801561012657600080fd5b506100d6610382565b34801561013b57600080fd5b50610144610432565b6040516100b89594939291906119e1565b34801561016157600080fd5b5061011861017036600461166a565b610453565b34801561018157600080fd5b50610118610190366004611758565b61045d565b3480156101a157600080fd5b506100f861046f565b6001600160e01b0319811663b2fe033560e01b145b919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816101e05790505090506040518060400160405280601881526020017f6765745265736572766174696f6e53657474696e6773282900000000000000008152508160008151811061024e57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250604051806060016040528060318152602001611e93603191398160018151811061029357634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280601c81526020017f72657365727665466f724d652875696e743235362c737472696e672900000000815250816002815181106102f557634e487b7160e01b600052603260045260246000fd5b6020026020010181905250604051806060016040528060278152602001611e6c602791398160038151811061033a57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152905090565b60408051808201909152600f81526e3932b9b2b93b3296b6b0b730b3b2b960891b602082015290565b61037e33838361048e565b5050565b604080516002808252606082810190935260009190816020015b606081526020019060019003908161039c579050509050604051806060016040528060318152602001611e9360319139816000815181106103ed57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250604051806060016040528060278152602001611e6c602791398160018151811061033a57634e487b7160e01b600052603260045260246000fd5b6000806000806000610442610588565b945094509450945094509091929394565b61037e82826105e2565b61046984848484610679565b50505050565b6040805180820190915260058152640332e312e360dc1b602082015290565b6104966106d0565b5460ff166104bf5760405162461bcd60e51b81526004016104b690611c2d565b60405180910390fd5b6104c76106d0565b54610100900460ff166105555760006104df846106df565b905060006104eb6106d0565b6001600160a01b0386166000908152600491909101602052604090205490508181106105295760405162461bcd60e51b81526004016104b690611c6c565b6105338183611d95565b8411156105525760405162461bcd60e51b81526004016104b690611b20565b50505b61057960016105626106d0565b600101548461056f6106d0565b60020154856106f0565b6105838383610704565b505050565b60008060008060006105986106d0565b5460ff166105a46106d0565b54610100900460ff166105b56106d0565b600101546105c16106d0565b600201546105cd6106d0565b60050154945094509450945094509091929394565b80518251146106035760405162461bcd60e51b81526004016104b690611ba8565b60005b82518110156105835761066783828151811061063257634e487b7160e01b600052603260045260246000fd5b602002602001015183838151811061065a57634e487b7160e01b600052603260045260246000fd5b6020026020010151610704565b8061067181611e13565b915050610606565b836106826106d0565b805460ff19169115159190911790558261069a6106d0565b80549115156101000261ff0019909216919091179055816106b96106d0565b60010155806106c66106d0565b6002015550505050565b60006106da610903565b905090565b60006106ea82610927565b92915050565b6106fd8585858585610953565b5050505050565b6001600160a01b03821630141561072d5760405162461bcd60e51b81526004016104b690611c8d565b60005b8181101561089a5760005b610743610a98565b61074b6106d0565b6003015410156107a8573061076a6107616106d0565b60030154610aa2565b6001600160a01b03161415610781575060016107a8565b600161078b6106d0565b600301600082825461079d9190611d3e565b9091555061073b9050565b801561080d576107c430856107bb6106d0565b60030154610aad565b7f736a5106267f2aefa6876d34eb936754ab687cab83a8314017fd327eb7cf0c38846107ee6106d0565b6003015460405161080092919061195d565b60405180910390a1610864565b61081684610ab8565b507f736a5106267f2aefa6876d34eb936754ab687cab83a8314017fd327eb7cf0c38846001610843610a98565b61084d9190611d95565b60405161085b92919061195d565b60405180910390a15b600161086e6106d0565b60030160008282546108809190611d3e565b90915550829150610892905081611e13565b915050610730565b50806108a46106d0565b6004016000846001600160a01b03166001600160a01b0316815260200190815260200160002060008282546108d99190611d3e565b909155508190506108e86106d0565b60050160008282546108fa9190611d3e565b90915550505050565b7f1112f5cf60fb4141783e19a055147d95474ef924bfa04c648816921afcffeb7490565b6000610931610ac3565b6001600160a01b03929092166000908152600490920160205250604090205490565b600061095f8385611d76565b6109698688611d76565b6109739190611d3e565b90508061098057506106fd565b6000826040516020016109939190611a06565b6040516020818303038152906040528051906020012090506040516020016109ba90611ccc565b604051602081830303815290604052805190602001208114806109e157506109e181610acd565b6109fd5760405162461bcd60e51b81526004016104b690611b67565b604051602001610a0c90611ccc565b60405160208183030381529060405280519060200120811415610a5f57610a5a33610a35610ad8565b546040805160208101909152600081526001600160a01b039091169034908690610ae2565b610a8f565b610a8f8333610a6c610ad8565b546040805160208101909152600081526001600160a01b03909116908690610aef565b50505050505050565b60006106da610afc565b60006106ea82610b0c565b610583838383610b52565b60006106ea82610bbc565b60006106da610c90565b60006106ea82610acd565b60006106da610cb4565b6106fd8585858585610cd8565b6106fd8585858585610ec2565b6000610b0661120d565b54905090565b600080610b17611217565b600084815260029190910160205260409020546001600160a01b03169050806106ea5760405162461bcd60e51b81526004016104b690611be7565b826001600160a01b0316610b6582610b0c565b6001600160a01b031614610b8b5760405162461bcd60e51b81526004016104b690611afc565b6001600160a01b038216610bb15760405162461bcd60e51b81526004016104b690611a70565b610583838383611221565b600080610bc761120d565b549050610bd261120d565b600401541580610bed5750610be561120d565b600401548111155b610c095760405162461bcd60e51b81526004016104b690611cac565b6001610c1361120d565b8054600090610c23908490611d3e565b90915550506001600160a01b038316301415610c5357610c433382611342565b610c4e333083610aad565b610c68565b610c5d3082611342565b610c68308483610aad565b6001610c7261120d565b6005016000828254610c849190611d3e565b90915550909392505050565b7f6a750c3f0170e00826e45980ae09840984f615da7bb80c8479ebe8542325a0d590565b7fbbdc48a4c38ee68aae7b7a4d695913f62d41dea3b689e93b0a6ca9163997770990565b81831015610cf85760405162461bcd60e51b81526004016104b690611c4c565b6000610d048385611d95565b90506001600160a01b03851615610de757604080516000808252602082019092526001600160a01b038716908590604051610d3f91906118d8565b60006040518083038185875af1925050503d8060008114610d7c576040519150601f19603f3d011682016040523d82523d6000602084013e610d81565b606091505b5050905080610da25760405162461bcd60e51b81526004016104b690611bc7565b7fae01f7fdfbf70980d6561b6b989d6c37709c4beec3fdbbf489e2644ed0e9e01d8787878787604051610dd9959493929190611918565b60405180910390a150610e27565b7fae01f7fdfbf70980d6561b6b989d6c37709c4beec3fdbbf489e2644ed0e9e01d8630868686604051610e1e959493929190611918565b60405180910390a15b8015610eba57604080516000808252602082019092526001600160a01b038816908390604051610e5791906118d8565b60006040518083038185875af1925050503d8060008114610e94576040519150601f19603f3d011682016040523d82523d6000602084013e610e99565b606091505b5050905080610a8f5760405162461bcd60e51b81526004016104b690611adb565b505050505050565b600085604051602001610ed59190611a06565b604051602081830303815290604052805190602001209050610ef68161134c565b610f125760405162461bcd60e51b81526004016104b690611c0c565b610f1b816113af565b610f375760405162461bcd60e51b81526004016104b690611a94565b6000610f416113da565b60030160008381526020019081526020016000206040518060a0016040529081600082018054610f7090611dd8565b80601f0160208091040260200160405190810160405280929190818152602001828054610f9c90611dd8565b8015610fe95780601f10610fbe57610100808354040283529160200191610fe9565b820191906000526020600020905b815481529060010190602001808311610fcc57829003601f168201915b505050918352505060018201546001600160a01b03908116602083015260029092015480831660408084019190915260ff600160a01b830481161515606080860191909152600160a81b909304161515608090930192909252838201518251630240bc6b60e21b8152925194955060009485949190911692630902f1ac926004808301939192829003018186803b15801561108357600080fd5b505afa158015611097573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bb91906117c5565b50606085015191935091506001600160701b038084169190831690156110ec5750506001600160701b038082169083165b6000821161110c5760405162461bcd60e51b81526004016104b690611b87565b600082611119838b611d76565b6111239190611d56565b90506001600160a01b038a16611137573099505b85602001516001600160a01b03166323b872dd8c8c846040518463ffffffff1660e01b815260040161116b939291906118f4565b602060405180830381600087803b15801561118557600080fd5b505af1158015611199573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bd9190611735565b507f1037c144de58762bd1228de78600efc4417a4454b1c3bd22079d10505b6c7deb8c8c8c8c858d6040516111f796959493929190611a19565b60405180910390a1505050505050505050505050565b60006106da6113e4565b60006106da611408565b611229611217565b60008281526004919091016020526040902080546001600160a01b03191690556001611253611217565b6003016000856001600160a01b03166001600160a01b0316815260200190815260200160002060008282546112889190611d95565b9091555060019050611298611217565b6003016000846001600160a01b03166001600160a01b0316815260200190815260200160002060008282546112cd9190611d3e565b909155508290506112dc611217565b6000838152600291909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4610583828261142c565b61037e8282611436565b6000806113576113da565b600084815260039190910160205260409020600101546001600160a01b0316148015906106ea575060006113896113da565b60009384526003016020526040909220600201546001600160a01b031690911415919050565b60006113b96113da565b6000928352600301602052506040902060020154600160a81b900460ff1690565b60006106da611533565b7f03cd5238ba7b5bfbba66bfdb519abdd9e7b08e4c8df3a518a3d0d7ab9a5c495a90565b7fd7aeb8e4f0c59b8cd9990692700804773e94b3a69feac86b7147c9c8edad330c90565b61037e8282611557565b6001600160a01b03821661145c5760405162461bcd60e51b81526004016104b690611b42565b61146581611591565b156114825760405162461bcd60e51b81526004016104b690611ab6565b600161148c611217565b6003016000846001600160a01b03166001600160a01b0316815260200190815260200160002060008282546114c19190611d3e565b909155508290506114d0611217565b6000838152600291909101602052604080822080546001600160a01b0319166001600160a01b03948516179055518392851691907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a461037e828261142c565b7feab495bca05def827c8b418094a353de6fa10ca0186c78b0e150e44e21830d8c90565b61155f6115bf565b6001600160a01b0390921660009081526006929092016020908152604083208054600181018255908452922090910155565b60008061159c611217565b60009384526002016020526040909220546001600160a01b031690911415919050565b60007f73fe048652e51f080002cab7173201110a5a7526ce7d7ec1a97184a03368b94f6106da565b600082601f8301126115f7578081fd5b8135602061160c61160783611d1a565b611ce9565b8281528181019085830183850287018401881015611628578586fd5b855b858110156116465781358452928401929084019060010161162a565b5090979650505050505050565b80516001600160701b03811681146101bf57600080fd5b6000806040838503121561167c578182fd5b823567ffffffffffffffff80821115611693578384fd5b818501915085601f8301126116a6578384fd5b813560206116b661160783611d1a565b82815281810190858301838502870184018b10156116d2578889fd5b8896505b848710156117085780356001600160a01b03811681146116f457898afd5b8352600196909601959183019183016116d6565b509650508601359250508082111561171e578283fd5b5061172b858286016115e7565b9150509250929050565b600060208284031215611746578081fd5b815161175181611e5a565b9392505050565b6000806000806080858703121561176d578182fd5b843561177881611e5a565b9350602085013561178881611e5a565b93969395505050506040820135916060013590565b6000602082840312156117ae578081fd5b81356001600160e01b031981168114611751578182fd5b6000806000606084860312156117d9578283fd5b6117e284611653565b92506117f060208501611653565b9150604084015163ffffffff81168114611808578182fd5b809150509250925092565b60008060408385031215611825578182fd5b8235915060208084013567ffffffffffffffff80821115611844578384fd5b818601915086601f830112611857578384fd5b81358181111561186957611869611e44565b61187b601f8201601f19168501611ce9565b91508082528784828501011115611890578485fd5b8084840185840137810190920192909252919491935090915050565b600081518084526118c4816020860160208601611dac565b601f01601f19169290920160200192915050565b600082516118ea818460208701611dac565b9190910192915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611952908301846118ac565b979650505050505050565b6001600160a01b03929092168252602082015260400190565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156119c957603f198886030184526119b78583516118ac565b9450928501929085019060010161199b565b5092979650505050505050565b901515815260200190565b9415158552921515602085015260408401919091526060830152608082015260a00190565b60006020825261175160208301846118ac565b600060c08252611a2c60c08301896118ac565b6001600160a01b03888116602085015287166040840152606083018690526080830185905282810360a0840152611a6381856118ac565b9998505050505050505050565b6020808252600a9082015269455243373231493a5a4160b01b604082015260600190565b602080825260089082015267504d4d3a4e454e4d60c01b604082015260600190565b6020808252600b908201526a455243373231493a54414d60a81b604082015260600190565b6020808252600790820152662826a69d292a2360c91b604082015260600190565b6020808252600a9082015269455243373231493a494f60b01b604082015260600190565b60208082526008908201526729269d22a6a0ac1960c11b604082015260600190565b6020808252600b908201526a455243373231493a4d5a4160a81b604082015260600190565b60208082526006908201526550483a4d4e5360d01b604082015260600190565b6020808252600790820152662826a69d272ba960c91b604082015260600190565b602080825260059082015264524d3a494960d81b604082015260600190565b6020808252600690820152652826a69d2a2360d11b604082015260600190565b6020808252600b908201526a115490cdcc8c524e93915560aa1b604082015260600190565b602080825260079082015266504d4d3a4e454d60c81b604082015260600190565b602080825260059082015264524d3a4e4160d81b604082015260600190565b6020808252600690820152652826a69d24a360d11b604082015260600190565b6020808252600790820152660a49a748a9a82b60cb1b604082015260600190565b602080825260059082015264524d3a494160d81b604082015260600190565b60208082526006908201526509a92749a82b60d31b604082015260600190565b60208082526003908201526257454960e81b604082015260600190565b604051601f8201601f1916810167ffffffffffffffff81118282101715611d1257611d12611e44565b604052919050565b600067ffffffffffffffff821115611d3457611d34611e44565b5060209081020190565b60008219821115611d5157611d51611e2e565b500190565b600082611d7157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d9057611d90611e2e565b500290565b600082821015611da757611da7611e2e565b500390565b60005b83811015611dc7578181015183820152602001611daf565b838111156104695750506000910152565b600281046001821680611dec57607f821691505b60208210811415611e0d57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611e2757611e27611e2e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114611e6857600080fd5b5056fe72657365727665466f724163636f756e747328616464726573735b5d2c75696e743235365b5d297365745265736572766174696f6e53657474696e677328626f6f6c2c626f6f6c2c75696e743235362c75696e7432353629a264697066735822122097f41666f8519f178fb75dcedc6e748d3f08066cfbb50bd8e4362c46f3cc494464736f6c63430008010033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.