Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 5678820 | 146 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
TokenERC721
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 20 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
/// @author thirdweb
// $$\ $$\ $$\ $$\ $$\
// $$ | $$ | \__| $$ | $$ |
// $$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$$$$$$ |$$\ $$\ $$\ $$$$$$\ $$$$$$$\
// \_$$ _| $$ __$$\ $$ |$$ __$$\ $$ __$$ |$$ | $$ | $$ |$$ __$$\ $$ __$$\
// $$ | $$ | $$ |$$ |$$ | \__|$$ / $$ |$$ | $$ | $$ |$$$$$$$$ |$$ | $$ |
// $$ |$$\ $$ | $$ |$$ |$$ | $$ | $$ |$$ | $$ | $$ |$$ ____|$$ | $$ |
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
// Interface
import { ITokenERC721 } from "../interface/token/ITokenERC721.sol";
import "../../infra/interface/IThirdwebContract.sol";
import "../../extension/interface/IPlatformFee.sol";
import "../../extension/interface/IPrimarySale.sol";
import "../../extension/interface/IRoyalty.sol";
import "../../extension/interface/IOwnable.sol";
//Extensions
import "../../extension/NFTMetadata.sol";
// Token
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
// Signature utils
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
// Access Control + security
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
// Meta transactions
import "../../external-deps/openzeppelin/metatx/ERC2771ContextUpgradeable.sol";
// Utils
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "../../extension/Multicall.sol";
import "../../lib/CurrencyTransferLib.sol";
import "../../lib/FeeType.sol";
// Helper interfaces
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
contract TokenERC721 is
Initializable,
IThirdwebContract,
IOwnable,
IRoyalty,
IPrimarySale,
IPlatformFee,
ReentrancyGuardUpgradeable,
EIP712Upgradeable,
ERC2771ContextUpgradeable,
Multicall,
AccessControlEnumerableUpgradeable,
ERC721EnumerableUpgradeable,
ITokenERC721,
NFTMetadata
{
using ECDSAUpgradeable for bytes32;
using StringsUpgradeable for uint256;
bytes32 private constant MODULE_TYPE = bytes32("TokenERC721");
uint256 private constant VERSION = 1;
address public constant DEFAULT_FEE_RECIPIENT = 0x1Af20C6B23373350aD464700B5965CE4B0D2aD94;
uint16 private constant DEFAULT_FEE_BPS = 50;
bytes32 private constant TYPEHASH =
keccak256(
"MintRequest(address to,address royaltyRecipient,uint256 royaltyBps,address primarySaleRecipient,string uri,uint256 price,address currency,uint128 validityStartTimestamp,uint128 validityEndTimestamp,bytes32 uid)"
);
/// @dev Only TRANSFER_ROLE holders can have tokens transferred from or to them, during restricted transfers.
bytes32 private constant TRANSFER_ROLE = keccak256("TRANSFER_ROLE");
/// @dev Only MINTER_ROLE holders can sign off on `MintRequest`s.
bytes32 private constant MINTER_ROLE = keccak256("MINTER_ROLE");
/// @dev Only METADATA_ROLE holders can update NFT metadata.
bytes32 private constant METADATA_ROLE = keccak256("METADATA_ROLE");
/// @dev Max bps in the thirdweb system
uint256 private constant MAX_BPS = 10_000;
/// @dev Owner of the contract (purpose: OpenSea compatibility, etc.)
address private _owner;
/// @dev The token ID of the next token to mint.
uint256 public nextTokenIdToMint;
/// @dev The adress that receives all primary sales value.
address public primarySaleRecipient;
/// @dev The adress that receives all primary sales value.
address public platformFeeRecipient;
/// @dev The recipient of who gets the royalty.
address private royaltyRecipient;
/// @dev The percentage of royalty how much royalty in basis points.
uint128 private royaltyBps;
/// @dev The % of primary sales collected by the contract as fees.
uint128 private platformFeeBps;
/// @dev Contract level metadata.
string public contractURI;
/// @dev Mapping from mint request UID => whether the mint request is processed.
mapping(bytes32 => bool) private minted;
/// @dev Token ID => royalty recipient and bps for token
mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken;
constructor() initializer {}
/// @dev Initializes the contract, like a constructor.
function initialize(
address _defaultAdmin,
string memory _name,
string memory _symbol,
string memory _contractURI,
address[] memory _trustedForwarders,
address _saleRecipient,
address _royaltyRecipient,
uint128 _royaltyBps,
uint128 _platformFeeBps,
address _platformFeeRecipient
) external initializer {
// Initialize inherited contracts, most base-like -> most derived.
__ReentrancyGuard_init();
__EIP712_init("TokenERC721", "1");
__ERC2771Context_init(_trustedForwarders);
__ERC721_init(_name, _symbol);
// Initialize this contract's state.
royaltyRecipient = _royaltyRecipient;
royaltyBps = _royaltyBps;
platformFeeRecipient = _platformFeeRecipient;
primarySaleRecipient = _saleRecipient;
contractURI = _contractURI;
require(_platformFeeBps <= MAX_BPS, "exceeds MAX_BPS");
platformFeeBps = _platformFeeBps;
_owner = _defaultAdmin;
_setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
_setupRole(MINTER_ROLE, _defaultAdmin);
_setupRole(METADATA_ROLE, _defaultAdmin);
_setRoleAdmin(METADATA_ROLE, METADATA_ROLE);
_setupRole(TRANSFER_ROLE, _defaultAdmin);
_setupRole(TRANSFER_ROLE, address(0));
emit PrimarySaleRecipientUpdated(_saleRecipient);
emit PlatformFeeInfoUpdated(_platformFeeRecipient, _platformFeeBps);
emit DefaultRoyalty(_royaltyRecipient, _royaltyBps);
}
/// ===== Public functions =====
/// @dev Returns the module type of the contract.
function contractType() external pure returns (bytes32) {
return MODULE_TYPE;
}
/// @dev Returns the version of the contract.
function contractVersion() external pure returns (uint8) {
return uint8(VERSION);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return hasRole(DEFAULT_ADMIN_ROLE, _owner) ? _owner : address(0);
}
/// @dev Verifies that a mint request is signed by an account holding MINTER_ROLE (at the time of the function call).
function verify(MintRequest calldata _req, bytes calldata _signature) public view returns (bool, address) {
address signer = recoverAddress(_req, _signature);
return (!minted[_req.uid] && hasRole(MINTER_ROLE, signer), signer);
}
/// @dev Returns the URI for a tokenId
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
return _tokenURI[_tokenId];
}
/// @dev Lets an account with MINTER_ROLE mint an NFT.
function mintTo(address _to, string calldata _uri) external nonReentrant onlyRole(MINTER_ROLE) returns (uint256) {
// `_mintTo` is re-used. `mintTo` just adds a minter role check.
return _mintTo(_to, _uri);
}
/// ===== External functions =====
/// @dev See EIP-2981
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view virtual returns (address receiver, uint256 royaltyAmount) {
(address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId);
receiver = recipient;
royaltyAmount = (salePrice * bps) / MAX_BPS;
}
/// @dev Mints an NFT according to the provided mint request.
function mintWithSignature(
MintRequest calldata _req,
bytes calldata _signature
) external payable nonReentrant returns (uint256 tokenIdMinted) {
address signer = verifyRequest(_req, _signature);
address receiver = _req.to;
tokenIdMinted = _mintTo(receiver, _req.uri);
if (_req.royaltyRecipient != address(0)) {
royaltyInfoForToken[tokenIdMinted] = RoyaltyInfo({
recipient: _req.royaltyRecipient,
bps: _req.royaltyBps
});
}
collectPrice(_req);
emit TokensMintedWithSignature(signer, receiver, tokenIdMinted, _req);
}
// ===== Setter functions =====
/// @dev Lets a module admin set the default recipient of all primary sales.
function setPrimarySaleRecipient(address _saleRecipient) external onlyRole(DEFAULT_ADMIN_ROLE) {
primarySaleRecipient = _saleRecipient;
emit PrimarySaleRecipientUpdated(_saleRecipient);
}
/// @dev Lets a module admin update the royalty bps and recipient.
function setDefaultRoyaltyInfo(
address _royaltyRecipient,
uint256 _royaltyBps
) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_royaltyBps <= MAX_BPS, "exceed royalty bps");
royaltyRecipient = _royaltyRecipient;
royaltyBps = uint128(_royaltyBps);
emit DefaultRoyalty(_royaltyRecipient, _royaltyBps);
}
/// @dev Lets a module admin set the royalty recipient for a particular token Id.
function setRoyaltyInfoForToken(
uint256 _tokenId,
address _recipient,
uint256 _bps
) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_bps <= MAX_BPS, "exceed royalty bps");
royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps });
emit RoyaltyForToken(_tokenId, _recipient, _bps);
}
/// @dev Lets a module admin update the fees on primary sales.
function setPlatformFeeInfo(
address _platformFeeRecipient,
uint256 _platformFeeBps
) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_platformFeeBps <= MAX_BPS, "exceeds MAX_BPS");
platformFeeBps = uint64(_platformFeeBps);
platformFeeRecipient = _platformFeeRecipient;
emit PlatformFeeInfoUpdated(_platformFeeRecipient, _platformFeeBps);
}
/// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin.
function setOwner(address _newOwner) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(hasRole(DEFAULT_ADMIN_ROLE, _newOwner), "new owner not module admin.");
address _prevOwner = _owner;
_owner = _newOwner;
emit OwnerUpdated(_prevOwner, _newOwner);
}
/// @dev Lets a module admin set the URI for contract-level metadata.
function setContractURI(string calldata _uri) external onlyRole(DEFAULT_ADMIN_ROLE) {
contractURI = _uri;
}
/// ===== Getter functions =====
/// @dev Returns the platform fee bps and recipient.
function getPlatformFeeInfo() external view returns (address, uint16) {
return (platformFeeRecipient, uint16(platformFeeBps));
}
/// @dev Returns the platform fee bps and recipient.
function getDefaultRoyaltyInfo() external view returns (address, uint16) {
return (royaltyRecipient, uint16(royaltyBps));
}
/// @dev Returns the royalty recipient for a particular token Id.
function getRoyaltyInfoForToken(uint256 _tokenId) public view returns (address, uint16) {
RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId];
return
royaltyForToken.recipient == address(0)
? (royaltyRecipient, uint16(royaltyBps))
: (royaltyForToken.recipient, uint16(royaltyForToken.bps));
}
/// ===== Internal functions =====
/// @dev Mints an NFT to `to`
function _mintTo(address _to, string calldata _uri) internal returns (uint256 tokenIdToMint) {
tokenIdToMint = nextTokenIdToMint;
nextTokenIdToMint += 1;
require(bytes(_uri).length > 0, "empty uri.");
_setTokenURI(tokenIdToMint, _uri);
_safeMint(_to, tokenIdToMint);
emit TokensMinted(_to, tokenIdToMint, _uri);
}
/// @dev Returns the address of the signer of the mint request.
function recoverAddress(MintRequest calldata _req, bytes calldata _signature) private view returns (address) {
return _hashTypedDataV4(keccak256(_encodeRequest(_req))).recover(_signature);
}
/// @dev Resolves 'stack too deep' error in `recoverAddress`.
function _encodeRequest(MintRequest calldata _req) private pure returns (bytes memory) {
return
abi.encode(
TYPEHASH,
_req.to,
_req.royaltyRecipient,
_req.royaltyBps,
_req.primarySaleRecipient,
keccak256(bytes(_req.uri)),
_req.price,
_req.currency,
_req.validityStartTimestamp,
_req.validityEndTimestamp,
_req.uid
);
}
/// @dev Verifies that a mint request is valid.
function verifyRequest(MintRequest calldata _req, bytes calldata _signature) internal returns (address) {
(bool success, address signer) = verify(_req, _signature);
require(success, "invalid signature");
require(
_req.validityStartTimestamp <= block.timestamp && _req.validityEndTimestamp >= block.timestamp,
"request expired"
);
require(_req.to != address(0), "recipient undefined");
minted[_req.uid] = true;
return signer;
}
/// @dev Collects and distributes the primary sale value of tokens being claimed.
function collectPrice(MintRequest calldata _req) internal {
if (_req.price == 0) {
require(msg.value == 0, "!Value");
return;
}
uint256 totalPrice = _req.price;
uint256 platformFeesTw = (totalPrice * DEFAULT_FEE_BPS) / MAX_BPS;
uint256 platformFees = (totalPrice * platformFeeBps) / MAX_BPS;
if (_req.currency == CurrencyTransferLib.NATIVE_TOKEN) {
require(msg.value == totalPrice, "must send total price.");
} else {
require(msg.value == 0, "msg value not zero");
}
address saleRecipient = _req.primarySaleRecipient == address(0)
? primarySaleRecipient
: _req.primarySaleRecipient;
CurrencyTransferLib.transferCurrency(_req.currency, _msgSender(), DEFAULT_FEE_RECIPIENT, platformFeesTw);
CurrencyTransferLib.transferCurrency(_req.currency, _msgSender(), platformFeeRecipient, platformFees);
CurrencyTransferLib.transferCurrency(
_req.currency,
_msgSender(),
saleRecipient,
totalPrice - platformFees - platformFeesTw
);
}
/// ===== Low-level overrides =====
/// @dev Burns `tokenId`. See {ERC721-_burn}.
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
/// @dev See {ERC721-_beforeTokenTransfer}.
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId,
uint256 batchSize
) internal virtual override(ERC721EnumerableUpgradeable) {
super._beforeTokenTransfer(from, to, tokenId, batchSize);
// if transfer is restricted on the contract, we still want to allow burning and minting
if (!hasRole(TRANSFER_ROLE, address(0)) && from != address(0) && to != address(0)) {
require(hasRole(TRANSFER_ROLE, from) || hasRole(TRANSFER_ROLE, to), "restricted to TRANSFER_ROLE holders");
}
}
/// @dev Returns whether metadata can be set in the given execution context.
function _canSetMetadata() internal view virtual override returns (bool) {
return hasRole(METADATA_ROLE, _msgSender());
}
/// @dev Returns whether metadata can be frozen in the given execution context.
function _canFreezeMetadata() internal view virtual override returns (bool) {
return hasRole(METADATA_ROLE, _msgSender());
}
function supportsInterface(
bytes4 interfaceId
)
public
view
virtual
override(AccessControlEnumerableUpgradeable, ERC721EnumerableUpgradeable, IERC165Upgradeable, IERC165)
returns (bool)
{
return super.supportsInterface(interfaceId) || interfaceId == type(IERC2981Upgradeable).interfaceId;
}
function _msgSender()
internal
view
virtual
override(ContextUpgradeable, ERC2771ContextUpgradeable, Multicall)
returns (address sender)
{
return ERC2771ContextUpgradeable._msgSender();
}
function _msgData()
internal
view
virtual
override(ContextUpgradeable, ERC2771ContextUpgradeable)
returns (bytes calldata)
{
return ERC2771ContextUpgradeable._msgData();
}
}// 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
* [EIP](https://eips.ethereum.org/EIPS/eip-165).
*
* 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
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
import "./IERC165.sol";
import "./IERC721.sol";
interface IERC4906 is IERC165 {
/// @dev This event emits when the metadata of a token is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFT.
event MetadataUpdate(uint256 _tokenId);
/// @dev This event emits when the metadata of a range of tokens is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFTs.
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "../lib/Address.sol";
import "./interface/IMulticall.sol";
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* _Available since v4.1._
*/
contract Multicall is IMulticall {
/**
* @notice Receives and executes a batch of function calls on this contract.
* @dev Receives and executes a batch of function calls on this contract.
*
* @param data The bytes data that makes up the batch of function calls to execute.
* @return results The bytes data that makes up the result of the batch of function calls executed.
*/
function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
results = new bytes[](data.length);
address sender = _msgSender();
bool isForwarder = msg.sender != sender;
for (uint256 i = 0; i < data.length; i++) {
if (isForwarder) {
results[i] = Address.functionDelegateCall(address(this), abi.encodePacked(data[i], sender));
} else {
results[i] = Address.functionDelegateCall(address(this), data[i]);
}
}
return results;
}
/// @notice Returns the sender in the given execution context.
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interface/INFTMetadata.sol";
abstract contract NFTMetadata is INFTMetadata {
/// @dev The sender is not authorized to perform the action
error NFTMetadataUnauthorized();
/// @dev Invalid token metadata url
error NFTMetadataInvalidUrl();
/// @dev the nft metadata is frozen
error NFTMetadataFrozen(uint256 tokenId);
bool public uriFrozen;
mapping(uint256 => string) internal _tokenURI;
/// @notice Returns the metadata URI for a given NFT.
function _getTokenURI(uint256 _tokenId) internal view virtual returns (string memory) {
return _tokenURI[_tokenId];
}
/// @notice Sets the metadata URI for a given NFT.
function _setTokenURI(uint256 _tokenId, string memory _uri) internal virtual {
if (bytes(_uri).length == 0) {
revert NFTMetadataInvalidUrl();
}
_tokenURI[_tokenId] = _uri;
emit MetadataUpdate(_tokenId);
}
/// @notice Sets the metadata URI for a given NFT.
function setTokenURI(uint256 _tokenId, string memory _uri) public virtual {
if (!_canSetMetadata()) {
revert NFTMetadataUnauthorized();
}
if (uriFrozen) {
revert NFTMetadataFrozen(_tokenId);
}
_setTokenURI(_tokenId, _uri);
}
function freezeMetadata() public virtual {
if (!_canFreezeMetadata()) {
revert NFTMetadataUnauthorized();
}
uriFrozen = true;
emit MetadataFrozen();
}
/// @dev Returns whether metadata can be set in the given execution context.
function _canSetMetadata() internal view virtual returns (bool);
function _canFreezeMetadata() internal view virtual returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* _Available since v4.1._
*/
interface IMulticall {
/**
* @dev Receives and executes a batch of function calls on this contract.
*/
function multicall(bytes[] calldata data) external returns (bytes[] memory results);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "../../eip/interface/IERC4906.sol";
interface INFTMetadata is IERC4906 {
/// @dev This event emits when the metadata of all tokens are frozen.
/// While not currently supported by marketplaces, this event allows
/// future indexing if desired.
event MetadataFrozen();
/// @notice Sets the metadata URI for a given NFT.
function setTokenURI(uint256 _tokenId, string memory _uri) external;
/// @notice Freezes the metadata URI for a given NFT.
function freezeMetadata() external;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses
* information about who the contract's owner is.
*/
interface IOwnable {
/// @dev Returns the owner of the contract.
function owner() external view returns (address);
/// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin.
function setOwner(address _newOwner) external;
/// @dev Emitted when a new Owner is set.
event OwnerUpdated(address indexed prevOwner, address indexed newOwner);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* Thirdweb's `PlatformFee` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of platform fee and the platform fee basis points, and lets the inheriting contract perform conditional logic
* that uses information about platform fees, if desired.
*/
interface IPlatformFee {
/// @dev Fee type variants: percentage fee and flat fee
enum PlatformFeeType {
Bps,
Flat
}
/// @dev Returns the platform fee bps and recipient.
function getPlatformFeeInfo() external view returns (address, uint16);
/// @dev Lets a module admin update the fees on primary sales.
function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external;
/// @dev Emitted when fee on primary sales is updated.
event PlatformFeeInfoUpdated(address indexed platformFeeRecipient, uint256 platformFeeBps);
/// @dev Emitted when the flat platform fee is updated.
event FlatPlatformFeeUpdated(address platformFeeRecipient, uint256 flatFee);
/// @dev Emitted when the platform fee type is updated.
event PlatformFeeTypeUpdated(PlatformFeeType feeType);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* Thirdweb's `Primary` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about
* primary sales, if desired.
*/
interface IPrimarySale {
/// @dev The adress that receives all primary sales value.
function primarySaleRecipient() external view returns (address);
/// @dev Lets a module admin set the default recipient of all primary sales.
function setPrimarySaleRecipient(address _saleRecipient) external;
/// @dev Emitted when a new sale recipient is set.
event PrimarySaleRecipientUpdated(address indexed recipient);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "../../eip/interface/IERC2981.sol";
/**
* Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic
* that uses information about royalty fees, if desired.
*
* The `Royalty` contract is ERC2981 compliant.
*/
interface IRoyalty is IERC2981 {
struct RoyaltyInfo {
address recipient;
uint256 bps;
}
/// @dev Returns the royalty recipient and fee bps.
function getDefaultRoyaltyInfo() external view returns (address, uint16);
/// @dev Lets a module admin update the royalty bps and recipient.
function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external;
/// @dev Lets a module admin set the royalty recipient for a particular token Id.
function setRoyaltyInfoForToken(uint256 tokenId, address recipient, uint256 bps) external;
/// @dev Returns the royalty recipient for a particular token Id.
function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16);
/// @dev Emitted when royalty info is updated.
event DefaultRoyalty(address indexed newRoyaltyRecipient, uint256 newRoyaltyBps);
/// @dev Emitted when royalty recipient for tokenId is set
event RoyaltyForToken(uint256 indexed tokenId, address indexed royaltyRecipient, uint256 royaltyBps);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (metatx/ERC2771Context.sol)
pragma solidity ^0.8.11;
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
/**
* @dev Context variant with ERC2771 support.
*/
abstract contract ERC2771ContextUpgradeable is Initializable, ContextUpgradeable {
mapping(address => bool) private _trustedForwarder;
function __ERC2771Context_init(address[] memory trustedForwarder) internal onlyInitializing {
__Context_init_unchained();
__ERC2771Context_init_unchained(trustedForwarder);
}
function __ERC2771Context_init_unchained(address[] memory trustedForwarder) internal onlyInitializing {
for (uint256 i = 0; i < trustedForwarder.length; i++) {
_trustedForwarder[trustedForwarder[i]] = true;
}
}
function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
return _trustedForwarder[forwarder];
}
function _msgSender() internal view virtual override returns (address sender) {
if (isTrustedForwarder(msg.sender)) {
// The assembly code is more direct than the Solidity version using `abi.decode`.
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
} else {
return super._msgSender();
}
}
function _msgData() internal view virtual override returns (bytes calldata) {
if (isTrustedForwarder(msg.sender)) {
return msg.data[:msg.data.length - 20];
} else {
return super._msgData();
}
}
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../../../../../eip/interface/IERC20.sol";
import { Address } from "../../../../../lib/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
interface IThirdwebContract {
/// @dev Returns the module type of the contract.
function contractType() external pure returns (bytes32);
/// @dev Returns the version of the contract.
function contractVersion() external pure returns (uint8);
/// @dev Returns the metadata URI of the contract.
function contractURI() external view returns (string memory);
/**
* @dev Sets contract URI for the storefront-level metadata of the contract.
* Only module admin can call this function.
*/
function setContractURI(string calldata _uri) external;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
interface IWETH {
function deposit() external payable;
function withdraw(uint256 amount) external;
function transfer(address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.1;
/// @author thirdweb, OpenZeppelin Contracts (v4.9.0)
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
// Helper interfaces
import { IWETH } from "../infra/interface/IWETH.sol";
import { SafeERC20, IERC20 } from "../external-deps/openzeppelin/token/ERC20/utils/SafeERC20.sol";
library CurrencyTransferLib {
using SafeERC20 for IERC20;
error CurrencyTransferLibMismatchedValue(uint256 expected, uint256 actual);
error CurrencyTransferLibFailedNativeTransfer(address recipient, uint256 value);
/// @dev The address interpreted as native token of the chain.
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/// @dev Transfers a given amount of currency.
function transferCurrency(address _currency, address _from, address _to, uint256 _amount) internal {
if (_amount == 0) {
return;
}
if (_currency == NATIVE_TOKEN) {
safeTransferNativeToken(_to, _amount);
} else {
safeTransferERC20(_currency, _from, _to, _amount);
}
}
/// @dev Transfers a given amount of currency. (With native token wrapping)
function transferCurrencyWithWrapper(
address _currency,
address _from,
address _to,
uint256 _amount,
address _nativeTokenWrapper
) internal {
if (_amount == 0) {
return;
}
if (_currency == NATIVE_TOKEN) {
if (_from == address(this)) {
// withdraw from weth then transfer withdrawn native token to recipient
IWETH(_nativeTokenWrapper).withdraw(_amount);
safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
} else if (_to == address(this)) {
// store native currency in weth
if (_amount != msg.value) {
revert CurrencyTransferLibMismatchedValue(msg.value, _amount);
}
IWETH(_nativeTokenWrapper).deposit{ value: _amount }();
} else {
safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
}
} else {
safeTransferERC20(_currency, _from, _to, _amount);
}
}
/// @dev Transfer `amount` of ERC20 token from `from` to `to`.
function safeTransferERC20(address _currency, address _from, address _to, uint256 _amount) internal {
if (_from == _to) {
return;
}
if (_from == address(this)) {
IERC20(_currency).safeTransfer(_to, _amount);
} else {
IERC20(_currency).safeTransferFrom(_from, _to, _amount);
}
}
/// @dev Transfers `amount` of native token to `to`.
function safeTransferNativeToken(address to, uint256 value) internal {
// solhint-disable avoid-low-level-calls
// slither-disable-next-line low-level-calls
(bool success, ) = to.call{ value: value }("");
if (!success) {
revert CurrencyTransferLibFailedNativeTransfer(to, value);
}
}
/// @dev Transfers `amount` of native token to `to`. (With native token wrapping)
function safeTransferNativeTokenWithWrapper(address to, uint256 value, address _nativeTokenWrapper) internal {
// solhint-disable avoid-low-level-calls
// slither-disable-next-line low-level-calls
(bool success, ) = to.call{ value: value }("");
if (!success) {
IWETH(_nativeTokenWrapper).deposit{ value: value }();
IERC20(_nativeTokenWrapper).safeTransfer(to, value);
}
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
/// @author thirdweb
library FeeType {
uint256 internal constant PRIMARY_SALE = 0;
uint256 internal constant MARKET_SALE = 1;
uint256 internal constant SPLIT = 2;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
/**
* `SignatureMint` is an ERC 721 contract. It lets anyone mint NFTs by producing a mint request
* and a signature (produced by an account with MINTER_ROLE, signing the mint request).
*/
interface ITokenERC721 is IERC721Upgradeable {
/**
* @notice The body of a request to mint NFTs.
*
* @param to The receiver of the NFTs to mint.
* @param uri The URI of the NFT to mint.
* @param price Price to pay for minting with the signature.
* @param currency The currency in which the price per token must be paid.
* @param validityStartTimestamp The unix timestamp after which the request is valid.
* @param validityEndTimestamp The unix timestamp after which the request expires.
* @param uid A unique identifier for the request.
*/
struct MintRequest {
address to;
address royaltyRecipient;
uint256 royaltyBps;
address primarySaleRecipient;
string uri;
uint256 price;
address currency;
uint128 validityStartTimestamp;
uint128 validityEndTimestamp;
bytes32 uid;
}
/// @dev Emitted when an account with MINTER_ROLE mints an NFT.
event TokensMinted(address indexed mintedTo, uint256 indexed tokenIdMinted, string uri);
/// @dev Emitted when tokens are minted.
event TokensMintedWithSignature(
address indexed signer,
address indexed mintedTo,
uint256 indexed tokenIdMinted,
MintRequest mintRequest
);
/**
* @notice Verifies that a mint request is signed by an account holding
* MINTER_ROLE (at the time of the function call).
*
* @param req The mint request.
* @param signature The signature produced by an account signing the mint request.
*
* returns (success, signer) Result of verification and the recovered address.
*/
function verify(
MintRequest calldata req,
bytes calldata signature
) external view returns (bool success, address signer);
/**
* @notice Lets an account with MINTER_ROLE mint an NFT.
*
* @param to The address to mint the NFT to.
* @param uri The URI to assign to the NFT.
*
* @return tokenId of the NFT minted.
*/
function mintTo(address to, string calldata uri) external returns (uint256);
/**
* @notice Mints an NFT according to the provided mint request.
*
* @param req The mint request.
* @param signature he signature produced by an account signing the mint request.
*/
function mintWithSignature(MintRequest calldata req, bytes calldata signature) external payable returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
function __AccessControlEnumerable_init() internal onlyInitializing {
}
function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
}
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
return _roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
return _roleMembers[role].length();
}
/**
* @dev Overload {_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override {
super._grantRole(role, account);
_roleMembers[role].add(account);
}
/**
* @dev Overload {_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981Upgradeable is IERC165Upgradeable {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)
pragma solidity ^0.8.0;
interface IERC5267Upgradeable {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
using AddressUpgradeable for address;
using StringsUpgradeable for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC721_init_unchained(name_, symbol_);
}
function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
return
interfaceId == type(IERC721Upgradeable).interfaceId ||
interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: address zero is not a valid owner");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _ownerOf(tokenId);
require(owner != address(0), "ERC721: invalid token ID");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
_requireMinted(tokenId);
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721Upgradeable.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not token owner or approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
_safeTransfer(from, to, tokenId, data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
*/
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _ownerOf(tokenId) != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
address owner = ERC721Upgradeable.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId, 1);
// Check that tokenId was not minted by `_beforeTokenTransfer` hook
require(!_exists(tokenId), "ERC721: token already minted");
unchecked {
// Will not overflow unless all 2**256 token ids are minted to the same owner.
// Given that tokens are minted one by one, it is impossible in practice that
// this ever happens. Might change if we allow batch minting.
// The ERC fails to describe this case.
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId, 1);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
* This is an internal function that does not check if the sender is authorized to operate on the token.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721Upgradeable.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
// Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
owner = ERC721Upgradeable.ownerOf(tokenId);
// Clear approvals
delete _tokenApprovals[tokenId];
unchecked {
// Cannot overflow, as that would require more tokens to be burned/transferred
// out than the owner initially received through minting and transferring in.
_balances[owner] -= 1;
}
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId, 1);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId, 1);
// Check that tokenId was not transferred by `_beforeTokenTransfer` hook
require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
// Clear approvals from the previous owner
delete _tokenApprovals[tokenId];
unchecked {
// `_balances[from]` cannot overflow for the same reason as described in `_burn`:
// `from`'s balance is the number of token held, which is at least one before the current
// transfer.
// `_balances[to]` could overflow in the conditions described in `_mint`. That would require
// all 2**256 token ids to be minted, which in practice is impossible.
_balances[from] -= 1;
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory data
) private returns (bool) {
if (to.isContract()) {
try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
* - When `from` is zero, the tokens will be minted for `to`.
* - When `to` is zero, ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
* - When `from` is zero, the tokens were minted for `to`.
* - When `to` is zero, ``from``'s tokens were burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}
/**
* @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
*
* WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
* being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
* that `ownerOf(tokenId)` is `a`.
*/
// solhint-disable-next-line func-name-mixedcase
function __unsafe_increaseBalance(address account, uint256 amount) internal {
_balances[account] += amount;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[44] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721ReceiverUpgradeable {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../ERC721Upgradeable.sol";
import "./IERC721EnumerableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {
function __ERC721Enumerable_init() internal onlyInitializing {
}
function __ERC721Enumerable_init_unchained() internal onlyInitializing {
}
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {
return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev See {ERC721-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual override {
super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
if (batchSize > 1) {
// Will only trigger during construction. Batch transferring (minting) is not available afterwards.
revert("ERC721Enumerable: consecutive transfers not supported");
}
uint256 tokenId = firstTokenId;
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721Upgradeable.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[46] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../StringsUpgradeable.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSAUpgradeable {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.8;
import "./ECDSAUpgradeable.sol";
import "../../interfaces/IERC5267Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
* separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
*
* _Available since v3.4._
*
* @custom:storage-size 52
*/
abstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {
bytes32 private constant _TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
/// @custom:oz-renamed-from _HASHED_NAME
bytes32 private _hashedName;
/// @custom:oz-renamed-from _HASHED_VERSION
bytes32 private _hashedVersion;
string private _name;
string private _version;
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
function __EIP712_init(string memory name, string memory version) internal onlyInitializing {
__EIP712_init_unchained(name, version);
}
function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {
_name = name;
_version = version;
// Reset prior values in storage if upgrading
_hashedName = 0;
_hashedVersion = 0;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
return _buildDomainSeparator();
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);
}
/**
* @dev See {EIP-5267}.
*
* _Available since v4.9._
*/
function eip712Domain()
public
view
virtual
override
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
{
// If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized
// and the EIP712 domain is not reliable, as it will be missing name and version.
require(_hashedName == 0 && _hashedVersion == 0, "EIP712: Uninitialized");
return (
hex"0f", // 01111
_EIP712Name(),
_EIP712Version(),
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}
/**
* @dev The name parameter for the EIP712 domain.
*
* NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
* are a concern.
*/
function _EIP712Name() internal virtual view returns (string memory) {
return _name;
}
/**
* @dev The version parameter for the EIP712 domain.
*
* NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
* are a concern.
*/
function _EIP712Version() internal virtual view returns (string memory) {
return _version;
}
/**
* @dev The hash of the name parameter for the EIP712 domain.
*
* NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.
*/
function _EIP712NameHash() internal view returns (bytes32) {
string memory name = _EIP712Name();
if (bytes(name).length > 0) {
return keccak256(bytes(name));
} else {
// If the name is empty, the contract may have been upgraded without initializing the new storage.
// We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.
bytes32 hashedName = _hashedName;
if (hashedName != 0) {
return hashedName;
} else {
return keccak256("");
}
}
}
/**
* @dev The hash of the version parameter for the EIP712 domain.
*
* NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.
*/
function _EIP712VersionHash() internal view returns (bytes32) {
string memory version = _EIP712Version();
if (bytes(version).length > 0) {
return keccak256(bytes(version));
} else {
// If the version is empty, the contract may have been upgraded without initializing the new storage.
// We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.
bytes32 hashedVersion = _hashedVersion;
if (hashedVersion != 0) {
return hashedVersion;
} else {
return keccak256("");
}
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[48] private __gap;
}// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; // EIP-712 is Final as of 2022-08-11. This file is deprecated. import "./EIP712Upgradeable.sol";
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// 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 IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSetUpgradeable {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}{
"optimizer": {
"enabled": true,
"runs": 20
},
"evmVersion": "london",
"remappings": [
":@chainlink/=lib/chainlink/",
":@ds-test/=lib/ds-test/src/",
":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
":@rari-capital/solmate/=lib/seaport/lib/solmate/",
":@seaport/=lib/seaport/contracts/",
":@std/=lib/forge-std/src/",
":@thirdweb-dev/dynamic-contracts/=lib/dynamic-contracts/",
":ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/",
":ERC721A/=lib/ERC721A/contracts/",
":chainlink/=lib/chainlink/contracts/",
":ds-test/=lib/ds-test/src/",
":dynamic-contracts/=lib/dynamic-contracts/src/",
":erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
":erc721a-upgradeable/=lib/ERC721A-Upgradeable/",
":erc721a/=lib/ERC721A/",
":forge-std/=lib/forge-std/src/",
":lib/sstore2/=lib/dynamic-contracts/lib/sstore2/",
":murky/=lib/murky/src/",
":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/",
":openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
":seaport-core/=lib/seaport/lib/seaport-core/",
":seaport-sol/=lib/seaport-sol/src/",
":seaport-types/=lib/seaport/lib/seaport-types/",
":seaport/=lib/seaport/",
":solady/=lib/solady/",
":solarray/=lib/seaport/lib/solarray/src/",
":solmate/=lib/seaport/lib/solmate/src/",
":sstore2/=lib/dynamic-contracts/lib/sstore2/contracts/"
],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"CurrencyTransferLibFailedNativeTransfer","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NFTMetadataFrozen","type":"error"},{"inputs":[],"name":"NFTMetadataInvalidUrl","type":"error"},{"inputs":[],"name":"NFTMetadataUnauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRoyaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"newRoyaltyBps","type":"uint256"}],"name":"DefaultRoyalty","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"platformFeeRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"flatFee","type":"uint256"}],"name":"FlatPlatformFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[],"name":"MetadataFrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"platformFeeRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"platformFeeBps","type":"uint256"}],"name":"PlatformFeeInfoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum IPlatformFee.PlatformFeeType","name":"feeType","type":"uint8"}],"name":"PlatformFeeTypeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"PrimarySaleRecipientUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"royaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"royaltyBps","type":"uint256"}],"name":"RoyaltyForToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"mintedTo","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenIdMinted","type":"uint256"},{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"TokensMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"indexed":true,"internalType":"address","name":"mintedTo","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenIdMinted","type":"uint256"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"indexed":false,"internalType":"struct ITokenERC721.MintRequest","name":"mintRequest","type":"tuple"}],"name":"TokensMintedWithSignature","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_FEE_RECIPIENT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractType","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freezeMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDefaultRoyaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPlatformFeeInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getRoyaltyInfoForToken","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_defaultAdmin","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"address[]","name":"_trustedForwarders","type":"address[]"},{"internalType":"address","name":"_saleRecipient","type":"address"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint128","name":"_royaltyBps","type":"uint128"},{"internalType":"uint128","name":"_platformFeeBps","type":"uint128"},{"internalType":"address","name":"_platformFeeRecipient","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"string","name":"_uri","type":"string"}],"name":"mintTo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ITokenERC721.MintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"mintWithSignature","outputs":[{"internalType":"uint256","name":"tokenIdMinted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenIdToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformFeeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"primarySaleRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint256","name":"_royaltyBps","type":"uint256"}],"name":"setDefaultRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_platformFeeRecipient","type":"address"},{"internalType":"uint256","name":"_platformFeeBps","type":"uint256"}],"name":"setPlatformFeeInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_saleRecipient","type":"address"}],"name":"setPrimarySaleRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_bps","type":"uint256"}],"name":"setRoyaltyInfoForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string","name":"_uri","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uriFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ITokenERC721.MintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b806200004f5750303b1580156200004f575060005460ff166001145b620000b75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000db576000805461ff0019166101001790555b801562000122576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5061501980620001336000396000f3fe6080604052600436106102695760003560e01c8063637102df1161014b578063637102df146105f95780636f4f28371461062157806370a082311461064157806384b0196e146106615780638da5cb5b146106895780639010d07c1461069e57806391d14854146106be578063938e3d7b146106de57806395d89b41146106fe5780639bcf7a1514610713578063a0a8e46014610733578063a217fddf1461074f578063a22cb46514610764578063ac9650d814610784578063b24f2d39146107b1578063b88d4fde146107e0578063c87b56dd14610800578063ca15c87314610820578063cb2ef6f714610840578063d111515d14610861578063d45573f614610876578063d547741f146108ac578063de903774146108cc578063e15916341461090b578063e8a3d4851461092b578063e985e9c514610940578063eb13554f1461096057600080fd5b806275a3171461026e57806301ffc9a7146102a157806306fdde03146102d1578063079fe40e146102f3578063081812fc1461032c578063095ea7b31461034c57806313af40351461036e578063162094c41461038e57806318160ddd146103ae5780631e7ac488146103c457806323b872dd146103e4578063248a9ca314610404578063274e4a1d146104245780632a55205a1461043f5780632c4510f81461046d5780632f2ff15d146104805780632f745c59146104a057806336568abe146104c05780633b1475a7146104e057806342842e0e146104f757806342966c68146105175780634cc157df146105375780634f6ccce714610579578063572b6c0514610599578063600dd5ea146105b95780636352211e146105d9575b600080fd5b34801561027a57600080fd5b5061028e610289366004613f8d565b610981565b6040519081526020015b60405180910390f35b3480156102ad57600080fd5b506102c16102bc366004613ff5565b6109c1565b6040519015158152602001610298565b3480156102dd57600080fd5b506102e66109ed565b6040516102989190614062565b3480156102ff57600080fd5b506101c954610314906001600160a01b031681565b6040516001600160a01b039091168152602001610298565b34801561033857600080fd5b50610314610347366004614082565b610a80565b34801561035857600080fd5b5061036c61036736600461409b565b610aa8565b005b34801561037a57600080fd5b5061036c6103893660046140c5565b610bd4565b34801561039a57600080fd5b5061036c6103a936600461419d565b610c88565b3480156103ba57600080fd5b506101955461028e565b3480156103d057600080fd5b5061036c6103df36600461409b565b610ce3565b3480156103f057600080fd5b5061036c6103ff3660046141e3565b610d89565b34801561041057600080fd5b5061028e61041f366004614082565b610dc1565b34801561043057600080fd5b506101c5546102c19060ff1681565b34801561044b57600080fd5b5061045f61045a36600461421f565b610dd6565b604051610298929190614241565b61028e61047b36600461425a565b610e13565b34801561048c57600080fd5b5061036c61049b3660046142be565b610f37565b3480156104ac57600080fd5b5061028e6104bb36600461409b565b610f53565b3480156104cc57600080fd5b5061036c6104db3660046142be565b610fea565b3480156104ec57600080fd5b5061028e6101c85481565b34801561050357600080fd5b5061036c6105123660046141e3565b611074565b34801561052357600080fd5b5061036c610532366004614082565b61108f565b34801561054357600080fd5b50610557610552366004614082565b61110b565b604080516001600160a01b03909316835261ffff909116602083015201610298565b34801561058557600080fd5b5061028e610594366004614082565b61117b565b3480156105a557600080fd5b506102c16105b43660046140c5565b611210565b3480156105c557600080fd5b5061036c6105d436600461409b565b61122e565b3480156105e557600080fd5b506103146105f4366004614082565b6112c6565b34801561060557600080fd5b50610314731af20c6b23373350ad464700b5965ce4b0d2ad9481565b34801561062d57600080fd5b5061036c61063c3660046140c5565b6112fa565b34801561064d57600080fd5b5061028e61065c3660046140c5565b611351565b34801561066d57600080fd5b506106766113d8565b60405161029897969594939291906142ea565b34801561069557600080fd5b50610314611476565b3480156106aa57600080fd5b506103146106b936600461421f565b6114ae565b3480156106ca57600080fd5b506102c16106d93660046142be565b6114c7565b3480156106ea57600080fd5b5061036c6106f9366004614383565b6114f2565b34801561070a57600080fd5b506102e6611511565b34801561071f57600080fd5b5061036c61072e3660046143c4565b611521565b34801561073f57600080fd5b5060405160018152602001610298565b34801561075b57600080fd5b5061028e600081565b34801561077057600080fd5b5061036c61077f3660046143f7565b6115d5565b34801561079057600080fd5b506107a461079f36600461442e565b6115e7565b60405161029891906144a2565b3480156107bd57600080fd5b506101cb546101cc546001600160a01b03909116906001600160801b0316610557565b3480156107ec57600080fd5b5061036c6107fb366004614506565b611763565b34801561080c57600080fd5b506102e661081b366004614082565b61179c565b34801561082c57600080fd5b5061028e61083b366004614082565b61183f565b34801561084c57600080fd5b506a546f6b656e45524337323160a81b61028e565b34801561086d57600080fd5b5061036c611857565b34801561088257600080fd5b506101ca546101cc546001600160a01b0390911690600160801b90046001600160801b0316610557565b3480156108b857600080fd5b5061036c6108c73660046142be565b6118b5565b3480156108d857600080fd5b506108ec6108e736600461425a565b6118d1565b6040805192151583526001600160a01b03909116602083015201610298565b34801561091757600080fd5b5061036c610926366004614613565b611928565b34801561093757600080fd5b506102e6611cac565b34801561094c57600080fd5b506102c161095b366004614725565b611d3b565b34801561096c57600080fd5b506101ca54610314906001600160a01b031681565b600061098b611d6a565b600080516020614fa48339815191526109a381611dc3565b6109ae858585611dd4565b9150506109ba60018055565b9392505050565b60006109cc82611ec3565b806109e757506001600160e01b0319821663152a902d60e11b145b92915050565b606061016180546109fd9061474f565b80601f0160208091040260200160405190810160405280929190818152602001828054610a299061474f565b8015610a765780601f10610a4b57610100808354040283529160200191610a76565b820191906000526020600020905b815481529060010190602001808311610a5957829003601f168201915b5050505050905090565b6000610a8b82611ee8565b50600090815261016560205260409020546001600160a01b031690565b6000610ab3826112c6565b9050806001600160a01b0316836001600160a01b031603610b255760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b806001600160a01b0316610b37611f0d565b6001600160a01b03161480610b535750610b538161095b611f0d565b610bc55760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610b1c565b610bcf8383611f17565b505050565b6000610bdf81611dc3565b610bea6000836114c7565b610c345760405162461bcd60e51b815260206004820152601b60248201527a3732bb9037bbb732b9103737ba1036b7b23ab6329030b236b4b71760291b6044820152606401610b1c565b6101c780546001600160a01b038481166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a3505050565b610c90611f86565b610cad576040516318c4c13760e21b815260040160405180910390fd5b6101c55460ff1615610cd5576040516393dafeb760e01b815260048101839052602401610b1c565b610cdf8282611fa2565b5050565b6000610cee81611dc3565b612710821115610d105760405162461bcd60e51b8152600401610b1c90614789565b6101cc80546001600160801b03166001600160401b038416600160801b021790556101ca80546001600160a01b0319166001600160a01b0385169081179091556040518381527fe2497bd806ec41a6e0dd992c29a72efc0ef8fec9092d1978fd4a1e00b2f18304906020015b60405180910390a2505050565b610d9a610d94611f0d565b82612015565b610db65760405162461bcd60e51b8152600401610b1c906147b2565b610bcf838383612074565b600090815260fd602052604090206001015490565b600080600080610de58661110b565b90945084925061ffff169050612710610dfe8287614815565b610e08919061482c565b925050509250929050565b6000610e1d611d6a565b6000610e2a8585856121d6565b90506000610e3b60208701876140c5565b9050610e5381610e4e608089018961484e565b611dd4565b92506000610e6760408801602089016140c5565b6001600160a01b031614610ed7576040518060400160405280876020016020810190610e9391906140c5565b6001600160a01b03908116825260408981013560209384015260008781526101cf845220835181546001600160a01b03191692169190911781559101516001909101555b610ee086612331565b82816001600160a01b0316836001600160a01b03167f110d160a1bedeea919a88fbc4b2a9fb61b7e664084391b6ca2740db66fef80fe89604051610f249190614902565b60405180910390a450506109ba60018055565b610f4082610dc1565b610f4981611dc3565b610bcf8383612571565b6000610f5e83611351565b8210610fc05760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610b1c565b506001600160a01b0391909116600090815261019360209081526040808320938352929052205490565b610ff2611f0d565b6001600160a01b0316816001600160a01b03161461106a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b1c565b610cdf8282612594565b610bcf83838360405180602001604052806000815250611763565b61109a610d94611f0d565b6110ff5760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b6064820152608401610b1c565b611108816125b7565b50565b60008181526101cf60209081526040808320815180830190925280546001600160a01b0316808352600190910154928201929092528291156111535780516020820151611171565b6101cb546101cc546001600160a01b03909116906001600160801b03165b9250925050915091565b60006111876101955490565b82106111ea5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610b1c565b61019582815481106111fe576111fe614a04565b90600052602060002001549050919050565b6001600160a01b031660009081526099602052604090205460ff1690565b600061123981611dc3565b61271082111561125b5760405162461bcd60e51b8152600401610b1c90614a1a565b6101cb80546001600160a01b0319166001600160a01b0385169081179091556101cc80546001600160801b0319166001600160801b0385161790556040518381527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb90602001610d7c565b6000806112d28361264b565b90506001600160a01b0381166109e75760405162461bcd60e51b8152600401610b1c90614a46565b600061130581611dc3565b6101c980546001600160a01b0319166001600160a01b0384169081179091556040517f299d17e95023f496e0ffc4909cff1a61f74bb5eb18de6f900f4155bfa1b3b33390600090a25050565b60006001600160a01b0382166113bb5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610b1c565b506001600160a01b03166000908152610164602052604090205490565b6000606080600080600060606033546000801b1480156113f85750603454155b61143c5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606401610b1c565b611444612667565b61144c612676565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6101c7546000906114919082906001600160a01b03166114c7565b61149b5750600090565b6101c7546001600160a01b03165b905090565b600082815261012f602052604081206109ba9083612685565b600091825260fd602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006114fd81611dc3565b6101cd61150b838583614add565b50505050565b606061016280546109fd9061474f565b600061152c81611dc3565b61271082111561154e5760405162461bcd60e51b8152600401610b1c90614a1a565b6040805180820182526001600160a01b03858116808352602080840187815260008a81526101cf8352869020945185546001600160a01b031916941693909317845591516001909301929092559151848152909186917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d910160405180910390a350505050565b610cdf6115e0611f0d565b8383612691565b6060816001600160401b03811115611601576116016140e0565b60405190808252806020026020018201604052801561163457816020015b606081526020019060019003908161161f5790505b5090506000611641611f0d565b9050336001600160a01b038216141560005b8481101561175a5781156116d2576116b03087878481811061167757611677614a04565b9050602002810190611689919061484e565b8660405160200161169c93929190614b96565b60405160208183030381529060405261275c565b8482815181106116c2576116c2614a04565b6020026020010181905250611752565b611734308787848181106116e8576116e8614a04565b90506020028101906116fa919061484e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061275c92505050565b84828151811061174657611746614a04565b60200260200101819052505b600101611653565b50505092915050565b61177461176e611f0d565b83612015565b6117905760405162461bcd60e51b8152600401610b1c906147b2565b61150b84848484612781565b60008181526101c6602052604090208054606091906117ba9061474f565b80601f01602080910402602001604051908101604052809291908181526020018280546117e69061474f565b80156118335780601f1061180857610100808354040283529160200191611833565b820191906000526020600020905b81548152906001019060200180831161181657829003601f168201915b50505050509050919050565b600081815261012f602052604081206109e7906127b4565b61185f611f86565b61187c576040516318c4c13760e21b815260040160405180910390fd5b6101c5805460ff191660011790556040517feef043febddf4e1d1cf1f72ff1407b84e036e805aa0934418cb82095da8d716490600090a1565b6118be82610dc1565b6118c781611dc3565b610bcf8383612594565b60008060006118e18686866127be565b61012087013560009081526101ce602052604090205490915060ff1615801561191d575061191d600080516020614fa4833981519152826114c7565b969095509350505050565b600054610100900460ff16158080156119485750600054600160ff909116105b8061196957506119573061281a565b158015611969575060005460ff166001145b6119cc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610b1c565b6000805460ff1916600117905580156119ef576000805461ff0019166101001790555b6119f7612829565b611a3d6040518060400160405280600b81526020016a546f6b656e45524337323160a81b815250604051806040016040528060018152602001603160f81b81525061285a565b611a468761288b565b611a508a8a6128c3565b6101cb80546001600160a01b03199081166001600160a01b03888116919091179092556101cc80546001600160801b0319166001600160801b0388161790556101ca805482168584161790556101c980549091169188169190911790556101cd611aba8982614bb7565b50612710836001600160801b03161115611ae65760405162461bcd60e51b8152600401610b1c90614789565b6101cc80546001600160801b03808616600160801b0291161790556101c780546001600160a01b038d166001600160a01b0319909116179055611b2a60008c6128f4565b611b42600080516020614fa48339815191528c6128f4565b611b5a600080516020614f5d8339815191528c6128f4565b611b72600080516020614f5d833981519152806128fe565b611b8a600080516020614f3d8339815191528c6128f4565b611ba3600080516020614f3d83398151915260006128f4565b6040516001600160a01b038716907f299d17e95023f496e0ffc4909cff1a61f74bb5eb18de6f900f4155bfa1b3b33390600090a2816001600160a01b03167fe2497bd806ec41a6e0dd992c29a72efc0ef8fec9092d1978fd4a1e00b2f1830484604051611c109190614c70565b60405180910390a2846001600160a01b03167f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb85604051611c519190614c70565b60405180910390a28015611c9f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b6101cd8054611cba9061474f565b80601f0160208091040260200160405190810160405280929190818152602001828054611ce69061474f565b8015611d335780601f10611d0857610100808354040283529160200191611d33565b820191906000526020600020905b815481529060010190602001808311611d1657829003601f168201915b505050505081565b6001600160a01b0391821660009081526101666020908152604080832093909416825291909152205460ff1690565b600260015403611dbc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b1c565b6002600155565b61110881611dcf611f0d565b612951565b6101c88054906001906000611de98385614c84565b909155505081611e285760405162461bcd60e51b815260206004820152600a60248201526932b6b83a3c903ab9349760b11b6044820152606401610b1c565b611e688184848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611fa292505050565b611e7284826129aa565b80846001600160a01b03167f9d89e36eadf856db0ad9ffb5a569e07f95634dddd9501141ecf04820484ad0dc8585604051611eae929190614c97565b60405180910390a39392505050565b60018055565b60006001600160e01b0319821663780e9d6360e01b14806109e757506109e7826129c4565b611ef181612a04565b6111085760405162461bcd60e51b8152600401610b1c90614a46565b60006114a9612a21565b60008181526101656020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f4d826112c6565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006114a9600080516020614f5d8339815191526106d9611f0d565b8051600003611fc45760405163a094836b60e01b815260040160405180910390fd5b60008281526101c660205260409020611fdd8282614bb7565b506040518281527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b600080612021836112c6565b9050806001600160a01b0316846001600160a01b0316148061204857506120488185611d3b565b8061206c5750836001600160a01b031661206184610a80565b6001600160a01b0316145b949350505050565b826001600160a01b0316612087826112c6565b6001600160a01b0316146120ad5760405162461bcd60e51b8152600401610b1c90614cab565b6001600160a01b03821661210f5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610b1c565b61211c8383836001612a43565b826001600160a01b031661212f826112c6565b6001600160a01b0316146121555760405162461bcd60e51b8152600401610b1c90614cab565b60008181526101656020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865261016485528386208054600019019055908716808652838620805460010190558686526101639094528285208054909216841790915590518493600080516020614fc483398151915291a4505050565b60008060006121e68686866118d1565b915091508161222b5760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606401610b1c565b4261223d610100880160e08901614cf0565b6001600160801b03161115801561226e57504261226261012088016101008901614cf0565b6001600160801b031610155b6122ac5760405162461bcd60e51b815260206004820152600f60248201526e1c995c5d595cdd08195e1c1a5c9959608a1b6044820152606401610b1c565b60006122bb60208801886140c5565b6001600160a01b0316036123075760405162461bcd60e51b81526020600482015260136024820152721c9958da5c1a595b9d081d5b9919599a5b9959606a1b6044820152606401610b1c565b61012086013560009081526101ce60205260409020805460ff191660011790559150509392505050565b8060a001356000036123745734156111085760405162461bcd60e51b81526020600482015260066024820152652156616c756560d01b6044820152606401610b1c565b60a08101356000612710612389603284614815565b612393919061482c565b6101cc54909150600090612710906123bb90600160801b90046001600160801b031685614815565b6123c5919061482c565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6123ec60e0860160c087016140c5565b6001600160a01b031603612447578234146124425760405162461bcd60e51b815260206004820152601660248201527536bab9ba1039b2b732103a37ba30b610383934b1b29760511b6044820152606401610b1c565b61248a565b341561248a5760405162461bcd60e51b81526020600482015260126024820152716d73672076616c7565206e6f74207a65726f60701b6044820152606401610b1c565b60008061249d60808701606088016140c5565b6001600160a01b0316146124c0576124bb60808601606087016140c5565b6124ce565b6101c9546001600160a01b03165b90506125066124e360e0870160c088016140c5565b6124eb611f0d565b731af20c6b23373350ad464700b5965ce4b0d2ad9486612b24565b61253461251960e0870160c088016140c5565b612521611f0d565b6101ca546001600160a01b031685612b24565b61256a61254760e0870160c088016140c5565b61254f611f0d565b838661255b878a614d0b565b6125659190614d0b565b612b24565b5050505050565b61257b8282612b6a565b600082815261012f60205260409020610bcf9082612bf1565b61259e8282612c06565b600082815261012f60205260409020610bcf9082612c8b565b60006125c2826112c6565b90506125d2816000846001612a43565b6125db826112c6565b60008381526101656020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526101648452828520805460001901905587855261016390935281842080549091169055519293508492600080516020614fc4833981519152908390a45050565b600090815261016360205260409020546001600160a01b031690565b6060603580546109fd9061474f565b6060603680546109fd9061474f565b60006109ba8383612ca0565b816001600160a01b0316836001600160a01b0316036126ee5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610b1c565b6001600160a01b0383811660008181526101666020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60606109ba8383604051806060016040528060278152602001614f7d60279139612cca565b61278c848484612074565b61279884848484612d42565b61150b5760405162461bcd60e51b8152600401610b1c90614d1e565b60006109e7825490565b600061206c83838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061281492506128089150889050612e51565b80519060200120612f8b565b90612fb8565b6001600160a01b03163b151590565b600054610100900460ff166128505760405162461bcd60e51b8152600401610b1c90614d70565b612858612fdc565b565b600054610100900460ff166128815760405162461bcd60e51b8152600401610b1c90614d70565b610cdf8282613003565b600054610100900460ff166128b25760405162461bcd60e51b8152600401610b1c90614d70565b6128ba613052565b61110881613079565b600054610100900460ff166128ea5760405162461bcd60e51b8152600401610b1c90614d70565b610cdf82826130fe565b610cdf8282612571565b600061290983610dc1565b600084815260fd6020526040808220600101859055519192508391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b61295b82826114c7565b610cdf5761296881613140565b612973836020613152565b604051602001612984929190614dbb565b60408051601f198184030181529082905262461bcd60e51b8252610b1c91600401614062565b610cdf8282604051806020016040528060008152506132ed565b60006001600160e01b031982166380ac58cd60e01b14806129f557506001600160e01b03198216635b5e139f60e01b145b806109e757506109e782613320565b600080612a108361264b565b6001600160a01b0316141592915050565b6000612a2c33611210565b15612a3e575060131936013560601c90565b503390565b612a4f84848484613345565b612a68600080516020614f3d83398151915260006114c7565b158015612a7d57506001600160a01b03841615155b8015612a9157506001600160a01b03831615155b1561150b57612aae600080516020614f3d833981519152856114c7565b80612acc5750612acc600080516020614f3d833981519152846114c7565b61150b5760405162461bcd60e51b815260206004820152602360248201527f7265737472696374656420746f205452414e534645525f524f4c4520686f6c6460448201526265727360e81b6064820152608401610b1c565b801561150b5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03851601612b5e57612b598282613474565b61150b565b61150b848484846134ec565b612b7482826114c7565b610cdf57600082815260fd602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612bad611f0d565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006109ba836001600160a01b03841661353f565b612c1082826114c7565b15610cdf57600082815260fd602090815260408083206001600160a01b03851684529091529020805460ff19169055612c47611f0d565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60006109ba836001600160a01b03841661358e565b6000826000018281548110612cb757612cb7614a04565b9060005260206000200154905092915050565b6060600080856001600160a01b031685604051612ce79190614e2a565b600060405180830381855af49150503d8060008114612d22576040519150601f19603f3d011682016040523d82523d6000602084013e612d27565b606091505b5091509150612d3886838387613681565b9695505050505050565b6000612d56846001600160a01b031661281a565b15612e4657836001600160a01b031663150b7a02612d72611f0d565b8786866040518563ffffffff1660e01b8152600401612d949493929190614e46565b6020604051808303816000875af1925050508015612dcf575060408051601f3d908101601f19168201909252612dcc91810190614e79565b60015b612e2c573d808015612dfd576040519150601f19603f3d011682016040523d82523d6000602084013e612e02565b606091505b508051600003612e245760405162461bcd60e51b8152600401610b1c90614d1e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061206c565b506001949350505050565b60607f86633b4ffa94b7c3d316ca70d7d2700f3fdfa7a7806efd31499b513d9176692e612e8160208401846140c5565b612e9160408501602086016140c5565b6040850135612ea660808701606088016140c5565b612eb3608088018861484e565b604051612ec1929190614e96565b60405190819003902060a0880135612edf60e08a0160c08b016140c5565b612ef06101008b0160e08c01614cf0565b612f026101208c016101008d01614cf0565b60408051602081019b909b526001600160a01b03998a16908b015296881660608a0152608089019590955292861660a088015260c087019190915260e08601529092166101008401526001600160801b03918216610120808501919091529116610140830152830135610160820152610180016040516020818303038152906040529050919050565b60006109e7612f986136f8565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000612fc78585613702565b91509150612fd481613747565b509392505050565b600054610100900460ff16611ebd5760405162461bcd60e51b8152600401610b1c90614d70565b600054610100900460ff1661302a5760405162461bcd60e51b8152600401610b1c90614d70565b60356130368382614bb7565b5060366130438282614bb7565b50506000603381905560345550565b600054610100900460ff166128585760405162461bcd60e51b8152600401610b1c90614d70565b600054610100900460ff166130a05760405162461bcd60e51b8152600401610b1c90614d70565b60005b8151811015610cdf576001609960008484815181106130c4576130c4614a04565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016130a3565b600054610100900460ff166131255760405162461bcd60e51b8152600401610b1c90614d70565b6101616131328382614bb7565b50610162610bcf8282614bb7565b60606109e76001600160a01b03831660145b60606000613161836002614815565b61316c906002614c84565b6001600160401b03811115613183576131836140e0565b6040519080825280601f01601f1916602001820160405280156131ad576020820181803683370190505b509050600360fc1b816000815181106131c8576131c8614a04565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106131f7576131f7614a04565b60200101906001600160f81b031916908160001a905350600061321b846002614815565b613226906001614c84565b90505b600181111561329e576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061325a5761325a614a04565b1a60f81b82828151811061327057613270614a04565b60200101906001600160f81b031916908160001a90535060049490941c9361329781614ea6565b9050613229565b5083156109ba5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b1c565b6132f7838361388c565b6133046000848484612d42565b610bcf5760405162461bcd60e51b8152600401610b1c90614d1e565b60006001600160e01b03198216635a05180f60e01b14806109e757506109e782613997565b60018111156133b45760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610b1c565b816001600160a01b0385166134125761340d816101958054600083815261019660205260408120829055600182018355919091527f54034dca961b61bc2a3147cc0c1986762915b42723ed64155364f17a2e2967700155565b613435565b836001600160a01b0316856001600160a01b0316146134355761343585826139cc565b6001600160a01b0384166134515761344c81613a6e565b61256a565b846001600160a01b0316846001600160a01b03161461256a5761256a8482613b23565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146134c1576040519150601f19603f3d011682016040523d82523d6000602084013e6134c6565b606091505b5050905080610bcf578282604051635fdc4ec160e11b8152600401610b1c929190614241565b816001600160a01b0316836001600160a01b0316031561150b57306001600160a01b0384160361352a57612b596001600160a01b0385168383613b69565b61150b6001600160a01b038516848484613bbf565b6000818152600183016020526040812054613586575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556109e7565b5060006109e7565b600081815260018301602052604081205480156136775760006135b2600183614d0b565b85549091506000906135c690600190614d0b565b905081811461362b5760008660000182815481106135e6576135e6614a04565b906000526020600020015490508087600001848154811061360957613609614a04565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061363c5761363c614ebd565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506109e7565b60009150506109e7565b606083156136ee5782516000036136e75761369b8561281a565b6136e75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b1c565b508161206c565b61206c8383613bf7565b60006114a9613c21565b60008082516041036137385760208301516040840151606085015160001a61372c87828585613c95565b94509450505050613740565b506000905060025b9250929050565b600081600481111561375b5761375b614ed3565b036137635750565b600181600481111561377757613777614ed3565b036137bf5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610b1c565b60028160048111156137d3576137d3614ed3565b036138205760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b1c565b600381600481111561383457613834614ed3565b036111085760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610b1c565b6001600160a01b0382166138e25760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b1c565b6138eb81612a04565b156139085760405162461bcd60e51b8152600401610b1c90614ee9565b613916600083836001612a43565b61391f81612a04565b1561393c5760405162461bcd60e51b8152600401610b1c90614ee9565b6001600160a01b0382166000818152610164602090815260408083208054600101905584835261016390915280822080546001600160a01b031916841790555183929190600080516020614fc4833981519152908290a45050565b60006001600160e01b03198216637965db0b60e01b14806109e757506301ffc9a760e01b6001600160e01b03198316146109e7565b600060016139d984611351565b6139e39190614d0b565b60008381526101946020526040902054909150808214613a39576001600160a01b038416600090815261019360209081526040808320858452825280832054848452818420819055835261019490915290208190555b506000918252610194602090815260408084208490556001600160a01b03909416835261019381528383209183525290812055565b61019554600090613a8190600190614d0b565b600083815261019660205260408120546101958054939450909284908110613aab57613aab614a04565b90600052602060002001549050806101958381548110613acd57613acd614a04565b60009182526020808320909101929092558281526101969091526040808220849055858252812055610195805480613b0757613b07614ebd565b6001900381819060005260206000200160009055905550505050565b6000613b2e83611351565b6001600160a01b0390931660009081526101936020908152604080832086845282528083208590559382526101949052919091209190915550565b610bcf8363a9059cbb60e01b8484604051602401613b88929190614241565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613d4f565b6040516001600160a01b038085166024830152831660448201526064810182905261150b9085906323b872dd60e01b90608401613b88565b815115613c075781518083602001fd5b8060405162461bcd60e51b8152600401610b1c9190614062565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613c4c613e21565b613c54613e7a565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613cc25750600090506003613d46565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613d16573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613d3f57600060019250925050613d46565b9150600090505b94509492505050565b6000613da4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613eab9092919063ffffffff16565b805190915015610bcf5780806020019051810190613dc29190614f1f565b610bcf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b1c565b600080613e2c612667565b805190915015613e43578051602090910120919050565b6033548015613e525792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b600080613e85612676565b805190915015613e9c578051602090910120919050565b6034548015613e525792915050565b606061206c848460008585600080866001600160a01b03168587604051613ed29190614e2a565b60006040518083038185875af1925050503d8060008114613f0f576040519150601f19603f3d011682016040523d82523d6000602084013e613f14565b606091505b5091509150613f2587838387613681565b979650505050505050565b80356001600160a01b0381168114613f4757600080fd5b919050565b60008083601f840112613f5e57600080fd5b5081356001600160401b03811115613f7557600080fd5b60208301915083602082850101111561374057600080fd5b600080600060408486031215613fa257600080fd5b613fab84613f30565b925060208401356001600160401b03811115613fc657600080fd5b613fd286828701613f4c565b9497909650939450505050565b6001600160e01b03198116811461110857600080fd5b60006020828403121561400757600080fd5b81356109ba81613fdf565b60005b8381101561402d578181015183820152602001614015565b50506000910152565b6000815180845261404e816020860160208601614012565b601f01601f19169290920160200192915050565b6020815260006109ba6020830184614036565b6001600160a01b03169052565b60006020828403121561409457600080fd5b5035919050565b600080604083850312156140ae57600080fd5b6140b783613f30565b946020939093013593505050565b6000602082840312156140d757600080fd5b6109ba82613f30565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561411e5761411e6140e0565b604052919050565b60006001600160401b0383111561413f5761413f6140e0565b614152601f8401601f19166020016140f6565b905082815283838301111561416657600080fd5b828260208301376000602084830101529392505050565b600082601f83011261418e57600080fd5b6109ba83833560208501614126565b600080604083850312156141b057600080fd5b8235915060208301356001600160401b038111156141cd57600080fd5b6141d98582860161417d565b9150509250929050565b6000806000606084860312156141f857600080fd5b61420184613f30565b925061420f60208501613f30565b9150604084013590509250925092565b6000806040838503121561423257600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060006040848603121561426f57600080fd5b83356001600160401b038082111561428657600080fd5b90850190610140828803121561429b57600080fd5b909350602085013590808211156142b157600080fd5b50613fd286828701613f4c565b600080604083850312156142d157600080fd5b823591506142e160208401613f30565b90509250929050565b60ff60f81b881681526000602060e0602084015261430b60e084018a614036565b838103604085015261431d818a614036565b606085018990526001600160a01b038816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b8181101561437157835183529284019291840191600101614355565b50909c9b505050505050505050505050565b6000806020838503121561439657600080fd5b82356001600160401b038111156143ac57600080fd5b6143b885828601613f4c565b90969095509350505050565b6000806000606084860312156143d957600080fd5b8335925061420f60208501613f30565b801515811461110857600080fd5b6000806040838503121561440a57600080fd5b61441383613f30565b91506020830135614423816143e9565b809150509250929050565b6000806020838503121561444157600080fd5b82356001600160401b038082111561445857600080fd5b818501915085601f83011261446c57600080fd5b81358181111561447b57600080fd5b8660208260051b850101111561449057600080fd5b60209290920196919550909350505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b828110156144f957603f198886030184526144e7858351614036565b945092850192908501906001016144cb565b5092979650505050505050565b6000806000806080858703121561451c57600080fd5b61452585613f30565b935061453360208601613f30565b92506040850135915060608501356001600160401b0381111561455557600080fd5b8501601f8101871361456657600080fd5b61457587823560208401614126565b91505092959194509250565b600082601f83011261459257600080fd5b813560206001600160401b038211156145ad576145ad6140e0565b8160051b6145bc8282016140f6565b92835284810182019282810190878511156145d657600080fd5b83870192505b84831015613f25576145ed83613f30565b825291830191908301906145dc565b80356001600160801b0381168114613f4757600080fd5b6000806000806000806000806000806101408b8d03121561463357600080fd5b61463c8b613f30565b995060208b01356001600160401b038082111561465857600080fd5b6146648e838f0161417d565b9a5060408d013591508082111561467a57600080fd5b6146868e838f0161417d565b995060608d013591508082111561469c57600080fd5b6146a88e838f0161417d565b985060808d01359150808211156146be57600080fd5b506146cb8d828e01614581565b9650506146da60a08c01613f30565b94506146e860c08c01613f30565b93506146f660e08c016145fc565b92506147056101008c016145fc565b91506147146101208c01613f30565b90509295989b9194979a5092959850565b6000806040838503121561473857600080fd5b61474183613f30565b91506142e160208401613f30565b600181811c9082168061476357607f821691505b60208210810361478357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600f908201526e65786365656473204d41585f42505360881b604082015260600190565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109e7576109e76147ff565b60008261484957634e487b7160e01b600052601260045260246000fd5b500490565b6000808335601e1984360301811261486557600080fd5b8301803591506001600160401b0382111561487f57600080fd5b60200191503681900382131561374057600080fd5b6000808335601e198436030181126148ab57600080fd5b83016020810192503590506001600160401b038111156148ca57600080fd5b80360382131561374057600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815261491b6020820161491684613f30565b614075565b600061492960208401613f30565b6149366040840182614075565b506040830135606083015261494d60608401613f30565b61495a6080840182614075565b506149686080840184614894565b6101408060a0860152614980610160860183856148d9565b925060a086013560c086015261499860c08701613f30565b91506149a760e0860183614075565b6149b360e087016145fc565b91506101006149cc818701846001600160801b03169052565b6149d78188016145fc565b9250506101206149f1818701846001600160801b03169052565b9590950135939094019290925250919050565b634e487b7160e01b600052603260045260246000fd5b60208082526012908201527165786365656420726f79616c74792062707360701b604082015260600190565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b601f821115610bcf576000816000526020600020601f850160051c81016020861015614aa15750805b601f850160051c820191505b81811015614ac057828155600101614aad565b505050505050565b600019600383901b1c191660019190911b1790565b6001600160401b03831115614af457614af46140e0565b614b0883614b02835461474f565b83614a78565b6000601f841160018114614b365760008515614b245750838201355b614b2e8682614ac8565b84555061256a565b600083815260209020601f19861690835b82811015614b675786850135825560209485019460019092019101614b47565b5086821015614b845760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8284823760609190911b6001600160601b0319169101908152601401919050565b81516001600160401b03811115614bd057614bd06140e0565b614be481614bde845461474f565b84614a78565b602080601f831160018114614c135760008415614c015750858301515b614c0b8582614ac8565b865550614ac0565b600085815260208120601f198616915b82811015614c4257888601518255948401946001909101908401614c23565b5085821015614c605787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160801b0391909116815260200190565b808201808211156109e7576109e76147ff565b60208152600061206c6020830184866148d9565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b600060208284031215614d0257600080fd5b6109ba826145fc565b818103818111156109e7576109e76147ff565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351614ded816017850160208801614012565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614e1e816028840160208801614012565b01602801949350505050565b60008251614e3c818460208701614012565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612d3890830184614036565b600060208284031215614e8b57600080fd5b81516109ba81613fdf565b8183823760009101908152919050565b600081614eb557614eb56147ff565b506000190190565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b6020808252601c908201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b604082015260600190565b600060208284031215614f3157600080fd5b81516109ba816143e956fe8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c6bd6b5318a46e5fff572d5e4258a20774aab40cc35ac7680654b9081fcc82f80416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65649f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203c19ed6da10cc18d20f353ffe9ddd0e33d7dac3a3e47c0a8e28bd80bb2b5fc8364736f6c63430008170033
Deployed Bytecode
0x6080604052600436106102695760003560e01c8063637102df1161014b578063637102df146105f95780636f4f28371461062157806370a082311461064157806384b0196e146106615780638da5cb5b146106895780639010d07c1461069e57806391d14854146106be578063938e3d7b146106de57806395d89b41146106fe5780639bcf7a1514610713578063a0a8e46014610733578063a217fddf1461074f578063a22cb46514610764578063ac9650d814610784578063b24f2d39146107b1578063b88d4fde146107e0578063c87b56dd14610800578063ca15c87314610820578063cb2ef6f714610840578063d111515d14610861578063d45573f614610876578063d547741f146108ac578063de903774146108cc578063e15916341461090b578063e8a3d4851461092b578063e985e9c514610940578063eb13554f1461096057600080fd5b806275a3171461026e57806301ffc9a7146102a157806306fdde03146102d1578063079fe40e146102f3578063081812fc1461032c578063095ea7b31461034c57806313af40351461036e578063162094c41461038e57806318160ddd146103ae5780631e7ac488146103c457806323b872dd146103e4578063248a9ca314610404578063274e4a1d146104245780632a55205a1461043f5780632c4510f81461046d5780632f2ff15d146104805780632f745c59146104a057806336568abe146104c05780633b1475a7146104e057806342842e0e146104f757806342966c68146105175780634cc157df146105375780634f6ccce714610579578063572b6c0514610599578063600dd5ea146105b95780636352211e146105d9575b600080fd5b34801561027a57600080fd5b5061028e610289366004613f8d565b610981565b6040519081526020015b60405180910390f35b3480156102ad57600080fd5b506102c16102bc366004613ff5565b6109c1565b6040519015158152602001610298565b3480156102dd57600080fd5b506102e66109ed565b6040516102989190614062565b3480156102ff57600080fd5b506101c954610314906001600160a01b031681565b6040516001600160a01b039091168152602001610298565b34801561033857600080fd5b50610314610347366004614082565b610a80565b34801561035857600080fd5b5061036c61036736600461409b565b610aa8565b005b34801561037a57600080fd5b5061036c6103893660046140c5565b610bd4565b34801561039a57600080fd5b5061036c6103a936600461419d565b610c88565b3480156103ba57600080fd5b506101955461028e565b3480156103d057600080fd5b5061036c6103df36600461409b565b610ce3565b3480156103f057600080fd5b5061036c6103ff3660046141e3565b610d89565b34801561041057600080fd5b5061028e61041f366004614082565b610dc1565b34801561043057600080fd5b506101c5546102c19060ff1681565b34801561044b57600080fd5b5061045f61045a36600461421f565b610dd6565b604051610298929190614241565b61028e61047b36600461425a565b610e13565b34801561048c57600080fd5b5061036c61049b3660046142be565b610f37565b3480156104ac57600080fd5b5061028e6104bb36600461409b565b610f53565b3480156104cc57600080fd5b5061036c6104db3660046142be565b610fea565b3480156104ec57600080fd5b5061028e6101c85481565b34801561050357600080fd5b5061036c6105123660046141e3565b611074565b34801561052357600080fd5b5061036c610532366004614082565b61108f565b34801561054357600080fd5b50610557610552366004614082565b61110b565b604080516001600160a01b03909316835261ffff909116602083015201610298565b34801561058557600080fd5b5061028e610594366004614082565b61117b565b3480156105a557600080fd5b506102c16105b43660046140c5565b611210565b3480156105c557600080fd5b5061036c6105d436600461409b565b61122e565b3480156105e557600080fd5b506103146105f4366004614082565b6112c6565b34801561060557600080fd5b50610314731af20c6b23373350ad464700b5965ce4b0d2ad9481565b34801561062d57600080fd5b5061036c61063c3660046140c5565b6112fa565b34801561064d57600080fd5b5061028e61065c3660046140c5565b611351565b34801561066d57600080fd5b506106766113d8565b60405161029897969594939291906142ea565b34801561069557600080fd5b50610314611476565b3480156106aa57600080fd5b506103146106b936600461421f565b6114ae565b3480156106ca57600080fd5b506102c16106d93660046142be565b6114c7565b3480156106ea57600080fd5b5061036c6106f9366004614383565b6114f2565b34801561070a57600080fd5b506102e6611511565b34801561071f57600080fd5b5061036c61072e3660046143c4565b611521565b34801561073f57600080fd5b5060405160018152602001610298565b34801561075b57600080fd5b5061028e600081565b34801561077057600080fd5b5061036c61077f3660046143f7565b6115d5565b34801561079057600080fd5b506107a461079f36600461442e565b6115e7565b60405161029891906144a2565b3480156107bd57600080fd5b506101cb546101cc546001600160a01b03909116906001600160801b0316610557565b3480156107ec57600080fd5b5061036c6107fb366004614506565b611763565b34801561080c57600080fd5b506102e661081b366004614082565b61179c565b34801561082c57600080fd5b5061028e61083b366004614082565b61183f565b34801561084c57600080fd5b506a546f6b656e45524337323160a81b61028e565b34801561086d57600080fd5b5061036c611857565b34801561088257600080fd5b506101ca546101cc546001600160a01b0390911690600160801b90046001600160801b0316610557565b3480156108b857600080fd5b5061036c6108c73660046142be565b6118b5565b3480156108d857600080fd5b506108ec6108e736600461425a565b6118d1565b6040805192151583526001600160a01b03909116602083015201610298565b34801561091757600080fd5b5061036c610926366004614613565b611928565b34801561093757600080fd5b506102e6611cac565b34801561094c57600080fd5b506102c161095b366004614725565b611d3b565b34801561096c57600080fd5b506101ca54610314906001600160a01b031681565b600061098b611d6a565b600080516020614fa48339815191526109a381611dc3565b6109ae858585611dd4565b9150506109ba60018055565b9392505050565b60006109cc82611ec3565b806109e757506001600160e01b0319821663152a902d60e11b145b92915050565b606061016180546109fd9061474f565b80601f0160208091040260200160405190810160405280929190818152602001828054610a299061474f565b8015610a765780601f10610a4b57610100808354040283529160200191610a76565b820191906000526020600020905b815481529060010190602001808311610a5957829003601f168201915b5050505050905090565b6000610a8b82611ee8565b50600090815261016560205260409020546001600160a01b031690565b6000610ab3826112c6565b9050806001600160a01b0316836001600160a01b031603610b255760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b806001600160a01b0316610b37611f0d565b6001600160a01b03161480610b535750610b538161095b611f0d565b610bc55760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610b1c565b610bcf8383611f17565b505050565b6000610bdf81611dc3565b610bea6000836114c7565b610c345760405162461bcd60e51b815260206004820152601b60248201527a3732bb9037bbb732b9103737ba1036b7b23ab6329030b236b4b71760291b6044820152606401610b1c565b6101c780546001600160a01b038481166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a3505050565b610c90611f86565b610cad576040516318c4c13760e21b815260040160405180910390fd5b6101c55460ff1615610cd5576040516393dafeb760e01b815260048101839052602401610b1c565b610cdf8282611fa2565b5050565b6000610cee81611dc3565b612710821115610d105760405162461bcd60e51b8152600401610b1c90614789565b6101cc80546001600160801b03166001600160401b038416600160801b021790556101ca80546001600160a01b0319166001600160a01b0385169081179091556040518381527fe2497bd806ec41a6e0dd992c29a72efc0ef8fec9092d1978fd4a1e00b2f18304906020015b60405180910390a2505050565b610d9a610d94611f0d565b82612015565b610db65760405162461bcd60e51b8152600401610b1c906147b2565b610bcf838383612074565b600090815260fd602052604090206001015490565b600080600080610de58661110b565b90945084925061ffff169050612710610dfe8287614815565b610e08919061482c565b925050509250929050565b6000610e1d611d6a565b6000610e2a8585856121d6565b90506000610e3b60208701876140c5565b9050610e5381610e4e608089018961484e565b611dd4565b92506000610e6760408801602089016140c5565b6001600160a01b031614610ed7576040518060400160405280876020016020810190610e9391906140c5565b6001600160a01b03908116825260408981013560209384015260008781526101cf845220835181546001600160a01b03191692169190911781559101516001909101555b610ee086612331565b82816001600160a01b0316836001600160a01b03167f110d160a1bedeea919a88fbc4b2a9fb61b7e664084391b6ca2740db66fef80fe89604051610f249190614902565b60405180910390a450506109ba60018055565b610f4082610dc1565b610f4981611dc3565b610bcf8383612571565b6000610f5e83611351565b8210610fc05760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610b1c565b506001600160a01b0391909116600090815261019360209081526040808320938352929052205490565b610ff2611f0d565b6001600160a01b0316816001600160a01b03161461106a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b1c565b610cdf8282612594565b610bcf83838360405180602001604052806000815250611763565b61109a610d94611f0d565b6110ff5760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b6064820152608401610b1c565b611108816125b7565b50565b60008181526101cf60209081526040808320815180830190925280546001600160a01b0316808352600190910154928201929092528291156111535780516020820151611171565b6101cb546101cc546001600160a01b03909116906001600160801b03165b9250925050915091565b60006111876101955490565b82106111ea5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610b1c565b61019582815481106111fe576111fe614a04565b90600052602060002001549050919050565b6001600160a01b031660009081526099602052604090205460ff1690565b600061123981611dc3565b61271082111561125b5760405162461bcd60e51b8152600401610b1c90614a1a565b6101cb80546001600160a01b0319166001600160a01b0385169081179091556101cc80546001600160801b0319166001600160801b0385161790556040518381527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb90602001610d7c565b6000806112d28361264b565b90506001600160a01b0381166109e75760405162461bcd60e51b8152600401610b1c90614a46565b600061130581611dc3565b6101c980546001600160a01b0319166001600160a01b0384169081179091556040517f299d17e95023f496e0ffc4909cff1a61f74bb5eb18de6f900f4155bfa1b3b33390600090a25050565b60006001600160a01b0382166113bb5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610b1c565b506001600160a01b03166000908152610164602052604090205490565b6000606080600080600060606033546000801b1480156113f85750603454155b61143c5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606401610b1c565b611444612667565b61144c612676565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6101c7546000906114919082906001600160a01b03166114c7565b61149b5750600090565b6101c7546001600160a01b03165b905090565b600082815261012f602052604081206109ba9083612685565b600091825260fd602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006114fd81611dc3565b6101cd61150b838583614add565b50505050565b606061016280546109fd9061474f565b600061152c81611dc3565b61271082111561154e5760405162461bcd60e51b8152600401610b1c90614a1a565b6040805180820182526001600160a01b03858116808352602080840187815260008a81526101cf8352869020945185546001600160a01b031916941693909317845591516001909301929092559151848152909186917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d910160405180910390a350505050565b610cdf6115e0611f0d565b8383612691565b6060816001600160401b03811115611601576116016140e0565b60405190808252806020026020018201604052801561163457816020015b606081526020019060019003908161161f5790505b5090506000611641611f0d565b9050336001600160a01b038216141560005b8481101561175a5781156116d2576116b03087878481811061167757611677614a04565b9050602002810190611689919061484e565b8660405160200161169c93929190614b96565b60405160208183030381529060405261275c565b8482815181106116c2576116c2614a04565b6020026020010181905250611752565b611734308787848181106116e8576116e8614a04565b90506020028101906116fa919061484e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061275c92505050565b84828151811061174657611746614a04565b60200260200101819052505b600101611653565b50505092915050565b61177461176e611f0d565b83612015565b6117905760405162461bcd60e51b8152600401610b1c906147b2565b61150b84848484612781565b60008181526101c6602052604090208054606091906117ba9061474f565b80601f01602080910402602001604051908101604052809291908181526020018280546117e69061474f565b80156118335780601f1061180857610100808354040283529160200191611833565b820191906000526020600020905b81548152906001019060200180831161181657829003601f168201915b50505050509050919050565b600081815261012f602052604081206109e7906127b4565b61185f611f86565b61187c576040516318c4c13760e21b815260040160405180910390fd5b6101c5805460ff191660011790556040517feef043febddf4e1d1cf1f72ff1407b84e036e805aa0934418cb82095da8d716490600090a1565b6118be82610dc1565b6118c781611dc3565b610bcf8383612594565b60008060006118e18686866127be565b61012087013560009081526101ce602052604090205490915060ff1615801561191d575061191d600080516020614fa4833981519152826114c7565b969095509350505050565b600054610100900460ff16158080156119485750600054600160ff909116105b8061196957506119573061281a565b158015611969575060005460ff166001145b6119cc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610b1c565b6000805460ff1916600117905580156119ef576000805461ff0019166101001790555b6119f7612829565b611a3d6040518060400160405280600b81526020016a546f6b656e45524337323160a81b815250604051806040016040528060018152602001603160f81b81525061285a565b611a468761288b565b611a508a8a6128c3565b6101cb80546001600160a01b03199081166001600160a01b03888116919091179092556101cc80546001600160801b0319166001600160801b0388161790556101ca805482168584161790556101c980549091169188169190911790556101cd611aba8982614bb7565b50612710836001600160801b03161115611ae65760405162461bcd60e51b8152600401610b1c90614789565b6101cc80546001600160801b03808616600160801b0291161790556101c780546001600160a01b038d166001600160a01b0319909116179055611b2a60008c6128f4565b611b42600080516020614fa48339815191528c6128f4565b611b5a600080516020614f5d8339815191528c6128f4565b611b72600080516020614f5d833981519152806128fe565b611b8a600080516020614f3d8339815191528c6128f4565b611ba3600080516020614f3d83398151915260006128f4565b6040516001600160a01b038716907f299d17e95023f496e0ffc4909cff1a61f74bb5eb18de6f900f4155bfa1b3b33390600090a2816001600160a01b03167fe2497bd806ec41a6e0dd992c29a72efc0ef8fec9092d1978fd4a1e00b2f1830484604051611c109190614c70565b60405180910390a2846001600160a01b03167f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb85604051611c519190614c70565b60405180910390a28015611c9f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b6101cd8054611cba9061474f565b80601f0160208091040260200160405190810160405280929190818152602001828054611ce69061474f565b8015611d335780601f10611d0857610100808354040283529160200191611d33565b820191906000526020600020905b815481529060010190602001808311611d1657829003601f168201915b505050505081565b6001600160a01b0391821660009081526101666020908152604080832093909416825291909152205460ff1690565b600260015403611dbc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b1c565b6002600155565b61110881611dcf611f0d565b612951565b6101c88054906001906000611de98385614c84565b909155505081611e285760405162461bcd60e51b815260206004820152600a60248201526932b6b83a3c903ab9349760b11b6044820152606401610b1c565b611e688184848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611fa292505050565b611e7284826129aa565b80846001600160a01b03167f9d89e36eadf856db0ad9ffb5a569e07f95634dddd9501141ecf04820484ad0dc8585604051611eae929190614c97565b60405180910390a39392505050565b60018055565b60006001600160e01b0319821663780e9d6360e01b14806109e757506109e7826129c4565b611ef181612a04565b6111085760405162461bcd60e51b8152600401610b1c90614a46565b60006114a9612a21565b60008181526101656020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f4d826112c6565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006114a9600080516020614f5d8339815191526106d9611f0d565b8051600003611fc45760405163a094836b60e01b815260040160405180910390fd5b60008281526101c660205260409020611fdd8282614bb7565b506040518281527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b600080612021836112c6565b9050806001600160a01b0316846001600160a01b0316148061204857506120488185611d3b565b8061206c5750836001600160a01b031661206184610a80565b6001600160a01b0316145b949350505050565b826001600160a01b0316612087826112c6565b6001600160a01b0316146120ad5760405162461bcd60e51b8152600401610b1c90614cab565b6001600160a01b03821661210f5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610b1c565b61211c8383836001612a43565b826001600160a01b031661212f826112c6565b6001600160a01b0316146121555760405162461bcd60e51b8152600401610b1c90614cab565b60008181526101656020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865261016485528386208054600019019055908716808652838620805460010190558686526101639094528285208054909216841790915590518493600080516020614fc483398151915291a4505050565b60008060006121e68686866118d1565b915091508161222b5760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606401610b1c565b4261223d610100880160e08901614cf0565b6001600160801b03161115801561226e57504261226261012088016101008901614cf0565b6001600160801b031610155b6122ac5760405162461bcd60e51b815260206004820152600f60248201526e1c995c5d595cdd08195e1c1a5c9959608a1b6044820152606401610b1c565b60006122bb60208801886140c5565b6001600160a01b0316036123075760405162461bcd60e51b81526020600482015260136024820152721c9958da5c1a595b9d081d5b9919599a5b9959606a1b6044820152606401610b1c565b61012086013560009081526101ce60205260409020805460ff191660011790559150509392505050565b8060a001356000036123745734156111085760405162461bcd60e51b81526020600482015260066024820152652156616c756560d01b6044820152606401610b1c565b60a08101356000612710612389603284614815565b612393919061482c565b6101cc54909150600090612710906123bb90600160801b90046001600160801b031685614815565b6123c5919061482c565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6123ec60e0860160c087016140c5565b6001600160a01b031603612447578234146124425760405162461bcd60e51b815260206004820152601660248201527536bab9ba1039b2b732103a37ba30b610383934b1b29760511b6044820152606401610b1c565b61248a565b341561248a5760405162461bcd60e51b81526020600482015260126024820152716d73672076616c7565206e6f74207a65726f60701b6044820152606401610b1c565b60008061249d60808701606088016140c5565b6001600160a01b0316146124c0576124bb60808601606087016140c5565b6124ce565b6101c9546001600160a01b03165b90506125066124e360e0870160c088016140c5565b6124eb611f0d565b731af20c6b23373350ad464700b5965ce4b0d2ad9486612b24565b61253461251960e0870160c088016140c5565b612521611f0d565b6101ca546001600160a01b031685612b24565b61256a61254760e0870160c088016140c5565b61254f611f0d565b838661255b878a614d0b565b6125659190614d0b565b612b24565b5050505050565b61257b8282612b6a565b600082815261012f60205260409020610bcf9082612bf1565b61259e8282612c06565b600082815261012f60205260409020610bcf9082612c8b565b60006125c2826112c6565b90506125d2816000846001612a43565b6125db826112c6565b60008381526101656020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526101648452828520805460001901905587855261016390935281842080549091169055519293508492600080516020614fc4833981519152908390a45050565b600090815261016360205260409020546001600160a01b031690565b6060603580546109fd9061474f565b6060603680546109fd9061474f565b60006109ba8383612ca0565b816001600160a01b0316836001600160a01b0316036126ee5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610b1c565b6001600160a01b0383811660008181526101666020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60606109ba8383604051806060016040528060278152602001614f7d60279139612cca565b61278c848484612074565b61279884848484612d42565b61150b5760405162461bcd60e51b8152600401610b1c90614d1e565b60006109e7825490565b600061206c83838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061281492506128089150889050612e51565b80519060200120612f8b565b90612fb8565b6001600160a01b03163b151590565b600054610100900460ff166128505760405162461bcd60e51b8152600401610b1c90614d70565b612858612fdc565b565b600054610100900460ff166128815760405162461bcd60e51b8152600401610b1c90614d70565b610cdf8282613003565b600054610100900460ff166128b25760405162461bcd60e51b8152600401610b1c90614d70565b6128ba613052565b61110881613079565b600054610100900460ff166128ea5760405162461bcd60e51b8152600401610b1c90614d70565b610cdf82826130fe565b610cdf8282612571565b600061290983610dc1565b600084815260fd6020526040808220600101859055519192508391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b61295b82826114c7565b610cdf5761296881613140565b612973836020613152565b604051602001612984929190614dbb565b60408051601f198184030181529082905262461bcd60e51b8252610b1c91600401614062565b610cdf8282604051806020016040528060008152506132ed565b60006001600160e01b031982166380ac58cd60e01b14806129f557506001600160e01b03198216635b5e139f60e01b145b806109e757506109e782613320565b600080612a108361264b565b6001600160a01b0316141592915050565b6000612a2c33611210565b15612a3e575060131936013560601c90565b503390565b612a4f84848484613345565b612a68600080516020614f3d83398151915260006114c7565b158015612a7d57506001600160a01b03841615155b8015612a9157506001600160a01b03831615155b1561150b57612aae600080516020614f3d833981519152856114c7565b80612acc5750612acc600080516020614f3d833981519152846114c7565b61150b5760405162461bcd60e51b815260206004820152602360248201527f7265737472696374656420746f205452414e534645525f524f4c4520686f6c6460448201526265727360e81b6064820152608401610b1c565b801561150b5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03851601612b5e57612b598282613474565b61150b565b61150b848484846134ec565b612b7482826114c7565b610cdf57600082815260fd602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612bad611f0d565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006109ba836001600160a01b03841661353f565b612c1082826114c7565b15610cdf57600082815260fd602090815260408083206001600160a01b03851684529091529020805460ff19169055612c47611f0d565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60006109ba836001600160a01b03841661358e565b6000826000018281548110612cb757612cb7614a04565b9060005260206000200154905092915050565b6060600080856001600160a01b031685604051612ce79190614e2a565b600060405180830381855af49150503d8060008114612d22576040519150601f19603f3d011682016040523d82523d6000602084013e612d27565b606091505b5091509150612d3886838387613681565b9695505050505050565b6000612d56846001600160a01b031661281a565b15612e4657836001600160a01b031663150b7a02612d72611f0d565b8786866040518563ffffffff1660e01b8152600401612d949493929190614e46565b6020604051808303816000875af1925050508015612dcf575060408051601f3d908101601f19168201909252612dcc91810190614e79565b60015b612e2c573d808015612dfd576040519150601f19603f3d011682016040523d82523d6000602084013e612e02565b606091505b508051600003612e245760405162461bcd60e51b8152600401610b1c90614d1e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061206c565b506001949350505050565b60607f86633b4ffa94b7c3d316ca70d7d2700f3fdfa7a7806efd31499b513d9176692e612e8160208401846140c5565b612e9160408501602086016140c5565b6040850135612ea660808701606088016140c5565b612eb3608088018861484e565b604051612ec1929190614e96565b60405190819003902060a0880135612edf60e08a0160c08b016140c5565b612ef06101008b0160e08c01614cf0565b612f026101208c016101008d01614cf0565b60408051602081019b909b526001600160a01b03998a16908b015296881660608a0152608089019590955292861660a088015260c087019190915260e08601529092166101008401526001600160801b03918216610120808501919091529116610140830152830135610160820152610180016040516020818303038152906040529050919050565b60006109e7612f986136f8565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000612fc78585613702565b91509150612fd481613747565b509392505050565b600054610100900460ff16611ebd5760405162461bcd60e51b8152600401610b1c90614d70565b600054610100900460ff1661302a5760405162461bcd60e51b8152600401610b1c90614d70565b60356130368382614bb7565b5060366130438282614bb7565b50506000603381905560345550565b600054610100900460ff166128585760405162461bcd60e51b8152600401610b1c90614d70565b600054610100900460ff166130a05760405162461bcd60e51b8152600401610b1c90614d70565b60005b8151811015610cdf576001609960008484815181106130c4576130c4614a04565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016130a3565b600054610100900460ff166131255760405162461bcd60e51b8152600401610b1c90614d70565b6101616131328382614bb7565b50610162610bcf8282614bb7565b60606109e76001600160a01b03831660145b60606000613161836002614815565b61316c906002614c84565b6001600160401b03811115613183576131836140e0565b6040519080825280601f01601f1916602001820160405280156131ad576020820181803683370190505b509050600360fc1b816000815181106131c8576131c8614a04565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106131f7576131f7614a04565b60200101906001600160f81b031916908160001a905350600061321b846002614815565b613226906001614c84565b90505b600181111561329e576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061325a5761325a614a04565b1a60f81b82828151811061327057613270614a04565b60200101906001600160f81b031916908160001a90535060049490941c9361329781614ea6565b9050613229565b5083156109ba5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b1c565b6132f7838361388c565b6133046000848484612d42565b610bcf5760405162461bcd60e51b8152600401610b1c90614d1e565b60006001600160e01b03198216635a05180f60e01b14806109e757506109e782613997565b60018111156133b45760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610b1c565b816001600160a01b0385166134125761340d816101958054600083815261019660205260408120829055600182018355919091527f54034dca961b61bc2a3147cc0c1986762915b42723ed64155364f17a2e2967700155565b613435565b836001600160a01b0316856001600160a01b0316146134355761343585826139cc565b6001600160a01b0384166134515761344c81613a6e565b61256a565b846001600160a01b0316846001600160a01b03161461256a5761256a8482613b23565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146134c1576040519150601f19603f3d011682016040523d82523d6000602084013e6134c6565b606091505b5050905080610bcf578282604051635fdc4ec160e11b8152600401610b1c929190614241565b816001600160a01b0316836001600160a01b0316031561150b57306001600160a01b0384160361352a57612b596001600160a01b0385168383613b69565b61150b6001600160a01b038516848484613bbf565b6000818152600183016020526040812054613586575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556109e7565b5060006109e7565b600081815260018301602052604081205480156136775760006135b2600183614d0b565b85549091506000906135c690600190614d0b565b905081811461362b5760008660000182815481106135e6576135e6614a04565b906000526020600020015490508087600001848154811061360957613609614a04565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061363c5761363c614ebd565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506109e7565b60009150506109e7565b606083156136ee5782516000036136e75761369b8561281a565b6136e75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b1c565b508161206c565b61206c8383613bf7565b60006114a9613c21565b60008082516041036137385760208301516040840151606085015160001a61372c87828585613c95565b94509450505050613740565b506000905060025b9250929050565b600081600481111561375b5761375b614ed3565b036137635750565b600181600481111561377757613777614ed3565b036137bf5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610b1c565b60028160048111156137d3576137d3614ed3565b036138205760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b1c565b600381600481111561383457613834614ed3565b036111085760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610b1c565b6001600160a01b0382166138e25760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b1c565b6138eb81612a04565b156139085760405162461bcd60e51b8152600401610b1c90614ee9565b613916600083836001612a43565b61391f81612a04565b1561393c5760405162461bcd60e51b8152600401610b1c90614ee9565b6001600160a01b0382166000818152610164602090815260408083208054600101905584835261016390915280822080546001600160a01b031916841790555183929190600080516020614fc4833981519152908290a45050565b60006001600160e01b03198216637965db0b60e01b14806109e757506301ffc9a760e01b6001600160e01b03198316146109e7565b600060016139d984611351565b6139e39190614d0b565b60008381526101946020526040902054909150808214613a39576001600160a01b038416600090815261019360209081526040808320858452825280832054848452818420819055835261019490915290208190555b506000918252610194602090815260408084208490556001600160a01b03909416835261019381528383209183525290812055565b61019554600090613a8190600190614d0b565b600083815261019660205260408120546101958054939450909284908110613aab57613aab614a04565b90600052602060002001549050806101958381548110613acd57613acd614a04565b60009182526020808320909101929092558281526101969091526040808220849055858252812055610195805480613b0757613b07614ebd565b6001900381819060005260206000200160009055905550505050565b6000613b2e83611351565b6001600160a01b0390931660009081526101936020908152604080832086845282528083208590559382526101949052919091209190915550565b610bcf8363a9059cbb60e01b8484604051602401613b88929190614241565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613d4f565b6040516001600160a01b038085166024830152831660448201526064810182905261150b9085906323b872dd60e01b90608401613b88565b815115613c075781518083602001fd5b8060405162461bcd60e51b8152600401610b1c9190614062565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613c4c613e21565b613c54613e7a565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613cc25750600090506003613d46565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613d16573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613d3f57600060019250925050613d46565b9150600090505b94509492505050565b6000613da4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613eab9092919063ffffffff16565b805190915015610bcf5780806020019051810190613dc29190614f1f565b610bcf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b1c565b600080613e2c612667565b805190915015613e43578051602090910120919050565b6033548015613e525792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b600080613e85612676565b805190915015613e9c578051602090910120919050565b6034548015613e525792915050565b606061206c848460008585600080866001600160a01b03168587604051613ed29190614e2a565b60006040518083038185875af1925050503d8060008114613f0f576040519150601f19603f3d011682016040523d82523d6000602084013e613f14565b606091505b5091509150613f2587838387613681565b979650505050505050565b80356001600160a01b0381168114613f4757600080fd5b919050565b60008083601f840112613f5e57600080fd5b5081356001600160401b03811115613f7557600080fd5b60208301915083602082850101111561374057600080fd5b600080600060408486031215613fa257600080fd5b613fab84613f30565b925060208401356001600160401b03811115613fc657600080fd5b613fd286828701613f4c565b9497909650939450505050565b6001600160e01b03198116811461110857600080fd5b60006020828403121561400757600080fd5b81356109ba81613fdf565b60005b8381101561402d578181015183820152602001614015565b50506000910152565b6000815180845261404e816020860160208601614012565b601f01601f19169290920160200192915050565b6020815260006109ba6020830184614036565b6001600160a01b03169052565b60006020828403121561409457600080fd5b5035919050565b600080604083850312156140ae57600080fd5b6140b783613f30565b946020939093013593505050565b6000602082840312156140d757600080fd5b6109ba82613f30565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561411e5761411e6140e0565b604052919050565b60006001600160401b0383111561413f5761413f6140e0565b614152601f8401601f19166020016140f6565b905082815283838301111561416657600080fd5b828260208301376000602084830101529392505050565b600082601f83011261418e57600080fd5b6109ba83833560208501614126565b600080604083850312156141b057600080fd5b8235915060208301356001600160401b038111156141cd57600080fd5b6141d98582860161417d565b9150509250929050565b6000806000606084860312156141f857600080fd5b61420184613f30565b925061420f60208501613f30565b9150604084013590509250925092565b6000806040838503121561423257600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060006040848603121561426f57600080fd5b83356001600160401b038082111561428657600080fd5b90850190610140828803121561429b57600080fd5b909350602085013590808211156142b157600080fd5b50613fd286828701613f4c565b600080604083850312156142d157600080fd5b823591506142e160208401613f30565b90509250929050565b60ff60f81b881681526000602060e0602084015261430b60e084018a614036565b838103604085015261431d818a614036565b606085018990526001600160a01b038816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b8181101561437157835183529284019291840191600101614355565b50909c9b505050505050505050505050565b6000806020838503121561439657600080fd5b82356001600160401b038111156143ac57600080fd5b6143b885828601613f4c565b90969095509350505050565b6000806000606084860312156143d957600080fd5b8335925061420f60208501613f30565b801515811461110857600080fd5b6000806040838503121561440a57600080fd5b61441383613f30565b91506020830135614423816143e9565b809150509250929050565b6000806020838503121561444157600080fd5b82356001600160401b038082111561445857600080fd5b818501915085601f83011261446c57600080fd5b81358181111561447b57600080fd5b8660208260051b850101111561449057600080fd5b60209290920196919550909350505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b828110156144f957603f198886030184526144e7858351614036565b945092850192908501906001016144cb565b5092979650505050505050565b6000806000806080858703121561451c57600080fd5b61452585613f30565b935061453360208601613f30565b92506040850135915060608501356001600160401b0381111561455557600080fd5b8501601f8101871361456657600080fd5b61457587823560208401614126565b91505092959194509250565b600082601f83011261459257600080fd5b813560206001600160401b038211156145ad576145ad6140e0565b8160051b6145bc8282016140f6565b92835284810182019282810190878511156145d657600080fd5b83870192505b84831015613f25576145ed83613f30565b825291830191908301906145dc565b80356001600160801b0381168114613f4757600080fd5b6000806000806000806000806000806101408b8d03121561463357600080fd5b61463c8b613f30565b995060208b01356001600160401b038082111561465857600080fd5b6146648e838f0161417d565b9a5060408d013591508082111561467a57600080fd5b6146868e838f0161417d565b995060608d013591508082111561469c57600080fd5b6146a88e838f0161417d565b985060808d01359150808211156146be57600080fd5b506146cb8d828e01614581565b9650506146da60a08c01613f30565b94506146e860c08c01613f30565b93506146f660e08c016145fc565b92506147056101008c016145fc565b91506147146101208c01613f30565b90509295989b9194979a5092959850565b6000806040838503121561473857600080fd5b61474183613f30565b91506142e160208401613f30565b600181811c9082168061476357607f821691505b60208210810361478357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600f908201526e65786365656473204d41585f42505360881b604082015260600190565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109e7576109e76147ff565b60008261484957634e487b7160e01b600052601260045260246000fd5b500490565b6000808335601e1984360301811261486557600080fd5b8301803591506001600160401b0382111561487f57600080fd5b60200191503681900382131561374057600080fd5b6000808335601e198436030181126148ab57600080fd5b83016020810192503590506001600160401b038111156148ca57600080fd5b80360382131561374057600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815261491b6020820161491684613f30565b614075565b600061492960208401613f30565b6149366040840182614075565b506040830135606083015261494d60608401613f30565b61495a6080840182614075565b506149686080840184614894565b6101408060a0860152614980610160860183856148d9565b925060a086013560c086015261499860c08701613f30565b91506149a760e0860183614075565b6149b360e087016145fc565b91506101006149cc818701846001600160801b03169052565b6149d78188016145fc565b9250506101206149f1818701846001600160801b03169052565b9590950135939094019290925250919050565b634e487b7160e01b600052603260045260246000fd5b60208082526012908201527165786365656420726f79616c74792062707360701b604082015260600190565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b601f821115610bcf576000816000526020600020601f850160051c81016020861015614aa15750805b601f850160051c820191505b81811015614ac057828155600101614aad565b505050505050565b600019600383901b1c191660019190911b1790565b6001600160401b03831115614af457614af46140e0565b614b0883614b02835461474f565b83614a78565b6000601f841160018114614b365760008515614b245750838201355b614b2e8682614ac8565b84555061256a565b600083815260209020601f19861690835b82811015614b675786850135825560209485019460019092019101614b47565b5086821015614b845760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8284823760609190911b6001600160601b0319169101908152601401919050565b81516001600160401b03811115614bd057614bd06140e0565b614be481614bde845461474f565b84614a78565b602080601f831160018114614c135760008415614c015750858301515b614c0b8582614ac8565b865550614ac0565b600085815260208120601f198616915b82811015614c4257888601518255948401946001909101908401614c23565b5085821015614c605787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160801b0391909116815260200190565b808201808211156109e7576109e76147ff565b60208152600061206c6020830184866148d9565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b600060208284031215614d0257600080fd5b6109ba826145fc565b818103818111156109e7576109e76147ff565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351614ded816017850160208801614012565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614e1e816028840160208801614012565b01602801949350505050565b60008251614e3c818460208701614012565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612d3890830184614036565b600060208284031215614e8b57600080fd5b81516109ba81613fdf565b8183823760009101908152919050565b600081614eb557614eb56147ff565b506000190190565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b6020808252601c908201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b604082015260600190565b600060208284031215614f3157600080fd5b81516109ba816143e956fe8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c6bd6b5318a46e5fff572d5e4258a20774aab40cc35ac7680654b9081fcc82f80416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65649f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203c19ed6da10cc18d20f353ffe9ddd0e33d7dac3a3e47c0a8e28bd80bb2b5fc8364736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.