Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Sponsored
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60a06040 | 247449 | 224 days ago | IN | 0 ETH | 0.01148185 |
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 Name:
CUBE
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 10000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 /* .____ ________ | | _____ ___.__. __________\_____ \ | | \__ \< | |/ __ \_ __ \_(__ < | |___ / __ \\___ \ ___/| | \/ \ |_______ (____ / ____|\___ >__| /______ / \/ \/\/ \/ \/ */ pragma solidity 0.8.20; import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; /// @title CUBE /// @dev Implementation of an NFT smart contract with EIP712 signatures. /// The contract is upgradeable using OpenZeppelin's UUPSUpgradeable pattern. contract CUBE is Initializable, ERC721Upgradeable, AccessControlUpgradeable, UUPSUpgradeable, EIP712Upgradeable, ReentrancyGuardUpgradeable { using ECDSA for bytes32; error CUBE__IsNotSigner(); error CUBE__MintingIsNotActive(); error CUBE__FeeNotEnough(); error CUBE__SignatureAndCubesInputMismatch(); error CUBE__WithdrawFailed(); error CUBE__NonceAlreadyUsed(); error CUBE__TransferFailed(); error CUBE__BPSTooHigh(); error CUBE__ExcessiveFeePayout(); error CUBE__ExceedsContractBalance(); uint256 internal s_nextTokenId; bool public s_isMintingActive; bytes32 public constant SIGNER_ROLE = keccak256("SIGNER"); bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER"); bytes32 internal constant TX_DATA_HASH = keccak256("TransactionData(string txHash,string networkChainId)"); bytes32 internal constant RECIPIENT_DATA_HASH = keccak256("FeeRecipient(address recipient,uint16 BPS)"); bytes32 internal constant REWARD_DATA_HASH = keccak256( "RewardData(address tokenAddress,uint256 chainId,uint256 amount,uint256 tokenId,uint8 tokenType)" ); bytes32 internal constant CUBE_DATA_HASH = keccak256( "CubeData(uint256 questId,uint256 nonce,uint256 price,address toAddress,string walletProvider,string tokenURI,string embedOrigin,TransactionData[] transactions,FeeRecipient[] recipients,RewardData reward)FeeRecipient(address recipient,uint16 BPS)RewardData(address tokenAddress,uint256 chainId,uint256 amount,uint256 tokenId,uint8 tokenType)TransactionData(string txHash,string networkChainId)" ); mapping(uint256 => uint256) internal s_questIssueNumbers; mapping(uint256 => string) internal s_tokenURIs; mapping(uint256 nonce => bool isConsumed) internal s_nonces; enum QuestType { QUEST, STREAK } enum Difficulty { BEGINNER, INTERMEDIATE, ADVANCED } enum TokenType { ERC20, ERC721, ERC1155, NATIVE } /// @notice Emitted when a new quest is initialized /// @param questId The unique identifier of the quest /// @param questType The type of the quest (QUEST, STREAK) /// @param difficulty The difficulty level of the quest (BEGINNER, INTERMEDIATE, ADVANCED) /// @param title The title of the quest /// @param tags An array of tags associated with the quest /// @param communities An array of communities associated with the quest event QuestMetadata( uint256 indexed questId, QuestType questType, Difficulty difficulty, string title, string[] tags, string[] communities ); /// @notice Emitted when a CUBE is claimed /// @param questId The quest ID associated with the CUBE /// @param tokenId The token ID of the minted CUBE /// @param claimer Address of the CUBE claimer /// @param issueNumber The issue number of the CUBE /// @param walletProvider The name of the wallet provider used for claiming /// @param embedOrigin The origin of the embed associated with the CUBE event CubeClaim( uint256 indexed questId, uint256 indexed tokenId, address indexed claimer, uint256 issueNumber, string walletProvider, string embedOrigin ); /// @notice Emitted for each transaction associated with a CUBE claim /// This event is designed to support both EVM and non-EVM blockchains /// @param cubeTokenId The token ID of the Cube /// @param txHash The hash of the transaction /// @param networkChainId The network and chain ID of the transaction in the format <network>:<chain-id> event CubeTransaction(uint256 indexed cubeTokenId, string txHash, string networkChainId); /// @notice Emitted when there is a reward associated with a CUBE /// @param cubeTokenId The token ID of the CUBE giving the reward /// @param tokenAddress The token address of the reward /// @param chainId The blockchain chain ID where the transaction occurred /// @param amount The amount of the reward /// @param tokenId Token ID of the reward (only applicable for ERC721 and ERC1155) /// @param tokenType The type of reward token event TokenReward( uint256 indexed cubeTokenId, address indexed tokenAddress, uint256 indexed chainId, uint256 amount, uint256 tokenId, TokenType tokenType ); /// @notice Emitted when a fee payout is made /// @param recipient The address of the payout recipient /// @param amount The amount of the payout event FeePayout(address indexed recipient, uint256 amount); /// @notice Emitted when the minting switch is turned on/off /// @param isActive The boolean showing if the minting is active or not event MintingSwitch(bool isActive); /// @notice Emitted when the contract balance is withdrawn by an admin /// @param amount The contract's balance that was withdrawn event ContractWithdrawal(uint256 amount); /// @dev Represents the data needed for minting a CUBE. /// @param questId The ID of the quest associated with the CUBE /// @param nonce A unique number to prevent replay attacks /// @param price The price paid for minting the CUBE /// @param toAddress The address where the CUBE will be minted /// @param walletProvider The wallet provider used for the transaction /// @param tokenURI The URI pointing to the CUBE's metadata /// @param embedOrigin The origin source of the CUBE's embed content /// @param transactions An array of transactions related to the CUBE /// @param recipients An array of recipients for fee payouts /// @param reward Data about the reward associated with the CUBE struct CubeData { uint256 questId; uint256 nonce; uint256 price; address toAddress; string walletProvider; string tokenURI; string embedOrigin; TransactionData[] transactions; FeeRecipient[] recipients; RewardData reward; } /// @dev Represents a recipient for fee distribution. /// @param recipient The address of the fee recipient /// @param BPS The basis points representing the fee percentage for the recipient struct FeeRecipient { address recipient; uint16 BPS; } /// @dev Contains data about the token rewards associated with a CUBE. /// @param tokenAddress The token address of the reward /// @param chainId The blockchain chain ID where the transaction occurred /// @param amount The amount of the reward /// @param tokenId The token ID /// @param tokenType The token type struct RewardData { address tokenAddress; uint256 chainId; uint256 amount; uint256 tokenId; TokenType tokenType; } /// @dev Contains data about a specific transaction related to a CUBE /// and is designed to support both EVM and non-EVM data. /// @param txHash The hash of the transaction /// @param networkChainId The network and chain ID of the transaction in the format <network>:<chain-id> struct TransactionData { string txHash; string networkChainId; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @notice Initializes the CUBE contract with necessary parameters /// @dev Sets up the ERC721 token with given name and symbol, and grants initial roles. /// @param _tokenName Name of the NFT collection /// @param _tokenSymbol Symbol of the NFT collection /// @param _signingDomain Domain used for EIP712 signing /// @param _signatureVersion Version of the EIP712 signature /// @param _admin Address to be granted the admin roles function initialize( string memory _tokenName, string memory _tokenSymbol, string memory _signingDomain, string memory _signatureVersion, address _admin ) external initializer { __ERC721_init(_tokenName, _tokenSymbol); __EIP712_init(_signingDomain, _signatureVersion); __AccessControl_init(); __UUPSUpgradeable_init(); __ReentrancyGuard_init(); s_isMintingActive = true; address blast = 0x4300000000000000000000000000000000000002; (bool ccgSuccess,) = blast.call(abi.encodeWithSignature("configureClaimableGas()")); require(ccgSuccess, "failed to register ccg"); (bool cgSuccess,) = blast.call(abi.encodeWithSignature("configureGovernor(address)", _admin)); require(cgSuccess, "failed to register cg"); _grantRole(DEFAULT_ADMIN_ROLE, _admin); } /// @notice Authorizes an upgrade to a new contract implementation /// @dev Overrides the UUPSUpgradeable internal function with access control. /// @param newImplementation Address of the new contract implementation function _authorizeUpgrade(address newImplementation) internal override onlyRole(UPGRADER_ROLE) {} /// @notice Retrieves the URI for a given token /// @dev Overrides the ERC721Upgradeable's tokenURI method. /// @param _tokenId The ID of the token /// @return _tokenURI The URI of the specified token function tokenURI(uint256 _tokenId) public view override returns (string memory _tokenURI) { return s_tokenURIs[_tokenId]; } /// @notice Mints multiple cubes based on provided data and signatures /// @dev Checks if minting is active, matches cube data with signatures, and processes each mint. /// @param cubeData Array of CubeData structures containing minting information /// @param signatures Array of signatures corresponding to each CubeData function mintCubes(CubeData[] calldata cubeData, bytes[] calldata signatures) external payable nonReentrant { // Check if the minting function is currently active. If not, revert the transaction if (!s_isMintingActive) { revert CUBE__MintingIsNotActive(); } // Ensure that each CubeData entry has a corresponding signature if (cubeData.length != signatures.length) { revert CUBE__SignatureAndCubesInputMismatch(); } // Calculate the total fee required for all the minting requests uint256 totalFee; for (uint256 i = 0; i < cubeData.length;) { totalFee = totalFee + cubeData[i].price; unchecked { ++i; } } // Check if the sent value is at least equal to the calculated total fee if (msg.value < totalFee) { revert CUBE__FeeNotEnough(); } // Loop through each CubeData entry and mint a CUBE for (uint256 i = 0; i < cubeData.length;) { _mintCube(cubeData[i], signatures[i]); unchecked { ++i; } } } /// @notice Internal function to handle the logic of minting a single cube /// @dev Verifies the signer, handles nonce, transactions, referral payments, and minting. /// @param data The CubeData containing details of the minting /// @param signature The signature for verification function _mintCube(CubeData calldata data, bytes calldata signature) internal { // Cache the tokenId uint256 tokenId = s_nextTokenId; // Validate the signature to ensure the mint request is authorized _validateSignature(data, signature); // Iterate over all the transactions in the mint request and emit events for (uint256 i = 0; i < data.transactions.length;) { emit CubeTransaction( tokenId, data.transactions[i].txHash, data.transactions[i].networkChainId ); unchecked { ++i; } } // Set the token URI for the CUBE s_tokenURIs[tokenId] = data.tokenURI; // Increment the counters for quest completion, issue numbers, and token IDs unchecked { ++s_questIssueNumbers[data.questId]; ++s_nextTokenId; } // Process any payouts to fee recipients if applicable if (data.recipients.length > 0) { _processPayouts(data); } // Perform the actual minting of the CUBE _safeMint(data.toAddress, tokenId); // Emit an event indicating a CUBE has been claimed emit CubeClaim( data.questId, tokenId, data.toAddress, s_questIssueNumbers[data.questId], data.walletProvider, data.embedOrigin ); if (data.reward.chainId != 0) { emit TokenReward( tokenId, data.reward.tokenAddress, data.reward.chainId, data.reward.amount, data.reward.tokenId, data.reward.tokenType ); } } /// @notice Validates the signature for a Cube minting request /// @dev Ensures that the signature is from a valid signer and the nonce hasn't been used before /// @param data The CubeData struct containing minting details /// @param signature The signature to be validated function _validateSignature(CubeData calldata data, bytes calldata signature) internal { address signer = _getSigner(data, signature); if (!hasRole(SIGNER_ROLE, signer)) { revert CUBE__IsNotSigner(); } if (s_nonces[data.nonce]) { revert CUBE__NonceAlreadyUsed(); } s_nonces[data.nonce] = true; } /// @notice Processes fee payouts to specified recipients /// @dev Distributes a portion of the minting fee to designated addresses based on their Basis Points (BPS) /// @param data The CubeData struct containing payout details function _processPayouts(CubeData calldata data) internal { uint256 totalAmount; // max basis points is 10k (100%) uint16 maxBps = 10_000; uint256 contractBalance = address(this).balance; for (uint256 i = 0; i < data.recipients.length;) { if (data.recipients[i].BPS > maxBps) { revert CUBE__BPSTooHigh(); } // Calculate the referral amount for each recipient uint256 referralAmount = (data.price * data.recipients[i].BPS) / maxBps; totalAmount = totalAmount + referralAmount; // Ensure the total payout does not exceed the cube price or contract balance if (totalAmount > data.price) { revert CUBE__ExcessiveFeePayout(); } if (totalAmount > contractBalance) { revert CUBE__ExceedsContractBalance(); } // Transfer the referral amount to the recipient address recipient = data.recipients[i].recipient; if (recipient != address(0)) { (bool success,) = recipient.call{value: referralAmount}(""); if (!success) { revert CUBE__TransferFailed(); } emit FeePayout(recipient, referralAmount); } unchecked { ++i; } } } /// @notice Recovers the signer's address from the CubeData and its associated signature /// @dev Utilizes EIP-712 typed data hashing and ECDSA signature recovery /// @param data The CubeData struct containing the details of the minting request /// @param sig The signature associated with the CubeData /// @return The address of the signer who signed the CubeData function _getSigner(CubeData calldata data, bytes calldata sig) internal view returns (address) { bytes32 digest = _computeDigest(data); return digest.recover(sig); } /// @notice Internal function to compute the EIP712 digest for CubeData /// @dev Generates the digest that must be signed by the signer. /// @param data The CubeData to generate a digest for /// @return The computed EIP712 digest function _computeDigest(CubeData calldata data) internal view returns (bytes32) { return _hashTypedDataV4(keccak256(_getStructHash(data))); } /// @notice Internal function to generate the struct hash for CubeData /// @dev Encodes the CubeData struct into a hash as per EIP712 standard. /// @param data The CubeData struct to hash /// @return A hash representing the encoded CubeData function _getStructHash(CubeData calldata data) internal pure returns (bytes memory) { return abi.encode( CUBE_DATA_HASH, data.questId, data.nonce, data.price, data.toAddress, _encodeString(data.walletProvider), _encodeString(data.tokenURI), _encodeString(data.embedOrigin), _encodeCompletedTxs(data.transactions), _encodeRecipients(data.recipients), _encodeReward(data.reward) ); } /// @notice Encodes a string into a bytes32 hash /// @dev Used for converting strings into a consistent format for EIP712 encoding /// @param _string The string to be encoded /// @return The keccak256 hash of the encoded string function _encodeString(string calldata _string) internal pure returns (bytes32) { return keccak256(bytes(_string)); } /// @notice Encodes a transaction data into a byte array /// @dev Used for converting transaction data into a consistent format for EIP712 encoding /// @param transaction The TransactionData struct to be encoded /// @return A byte array representing the encoded transaction data function _encodeTx(TransactionData calldata transaction) internal pure returns (bytes memory) { return abi.encode( TX_DATA_HASH, _encodeString(transaction.txHash), _encodeString(transaction.networkChainId) ); } /// @notice Encodes an array of transaction data into a single bytes32 hash /// @dev Used to aggregate multiple transactions into a single hash for EIP712 encoding /// @param txData An array of TransactionData structs to be encoded /// @return A bytes32 hash representing the aggregated and encoded transaction data function _encodeCompletedTxs(TransactionData[] calldata txData) internal pure returns (bytes32) { bytes32[] memory encodedTxs = new bytes32[](txData.length); for (uint256 i = 0; i < txData.length;) { encodedTxs[i] = keccak256(_encodeTx(txData[i])); unchecked { ++i; } } return keccak256(abi.encodePacked(encodedTxs)); } /// @notice Encodes a fee recipient data into a byte array /// @dev Used for converting fee recipient information into a consistent format for EIP712 encoding /// @param data The FeeRecipient struct to be encoded /// @return A byte array representing the encoded fee recipient data function _encodeRecipient(FeeRecipient calldata data) internal pure returns (bytes memory) { return abi.encode(RECIPIENT_DATA_HASH, data.recipient, data.BPS); } /// @notice Encodes an array of fee recipient data into a single bytes32 hash /// @dev Used to aggregate multiple fee recipient entries into a single hash for EIP712 encoding /// @param data An array of FeeRecipient structs to be encoded /// @return A bytes32 hash representing the aggregated and encoded fee recipient data function _encodeRecipients(FeeRecipient[] calldata data) internal pure returns (bytes32) { bytes32[] memory encodedRecipients = new bytes32[](data.length); for (uint256 i = 0; i < data.length;) { encodedRecipients[i] = keccak256(_encodeRecipient(data[i])); unchecked { ++i; } } return keccak256(abi.encodePacked(encodedRecipients)); } /// @notice Encodes the reward data for a CUBE mint /// @param data An array of FeeRecipient structs to be encoded /// @return A bytes32 hash representing the encoded reward data function _encodeReward(RewardData calldata data) internal pure returns (bytes32) { return keccak256( abi.encode( REWARD_DATA_HASH, data.tokenAddress, data.chainId, data.amount, data.tokenId, data.tokenType ) ); } /// @notice Enables or disables the minting process /// @dev Can only be called by an account with the default admin role. /// @param _isMintingActive Boolean indicating whether minting should be active function setIsMintingActive(bool _isMintingActive) external onlyRole(DEFAULT_ADMIN_ROLE) { s_isMintingActive = _isMintingActive; emit MintingSwitch(_isMintingActive); } /// @notice Withdraws the contract's balance to the message sender /// @dev Can only be called by an account with the default admin role. function withdraw() external onlyRole(DEFAULT_ADMIN_ROLE) { (bool success,) = msg.sender.call{value: address(this).balance}(""); if (!success) { revert CUBE__WithdrawFailed(); } emit ContractWithdrawal(address(this).balance); } /// @notice Initializes a new quest with given parameters /// @dev Can only be called by an account with the signer role. /// @param questId Unique identifier for the quest /// @param communities Array of community names associated with the quest /// @param title Title of the quest /// @param difficulty Difficulty level of the quest /// @param questType Type of the quest function initializeQuest( uint256 questId, string[] memory communities, string memory title, Difficulty difficulty, QuestType questType, string[] memory tags ) external onlyRole(SIGNER_ROLE) { emit QuestMetadata(questId, questType, difficulty, title, tags, communities); } /// @notice Checks if the contract implements an interface /// @dev Overrides the supportsInterface function of ERC721Upgradeable and AccessControlUpgradeable. /// @param interfaceId The interface identifier, as specified in ERC-165 /// @return True if the contract implements the interface, false otherwise function supportsInterface(bytes4 interfaceId) public view override(ERC721Upgradeable, AccessControlUpgradeable) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {IERC5267} from "@openzeppelin/contracts/interfaces/IERC5267.sol"; import {Initializable} from "../../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 scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its 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 order to * produce the hash of their typed data 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. */ abstract contract EIP712Upgradeable is Initializable, IERC5267 { bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /// @custom:storage-location erc7201:openzeppelin.storage.EIP712 struct EIP712Storage { /// @custom:oz-renamed-from _HASHED_NAME bytes32 _hashedName; /// @custom:oz-renamed-from _HASHED_VERSION bytes32 _hashedVersion; string _name; string _version; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.EIP712")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100; function _getEIP712Storage() private pure returns (EIP712Storage storage $) { assembly { $.slot := EIP712StorageLocation } } /** * @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 { EIP712Storage storage $ = _getEIP712Storage(); $._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 MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { EIP712Storage storage $ = _getEIP712Storage(); // 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 view virtual returns (string memory) { EIP712Storage storage $ = _getEIP712Storage(); 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 view virtual returns (string memory) { EIP712Storage storage $ = _getEIP712Storage(); 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) { EIP712Storage storage $ = _getEIP712Storage(); 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) { EIP712Storage storage $ = _getEIP712Storage(); 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(""); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile 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 {MessageHashUtils-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] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { 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, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile 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 {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); 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] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. 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. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // 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, s); } // 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, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @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, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.20; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {ERC165Upgradeable} from "../../utils/introspection/ERC165Upgradeable.sol"; import {IERC721Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import {Initializable} from "../../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}. */ abstract contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721, IERC721Metadata, IERC721Errors { using Strings for uint256; /// @custom:storage-location erc7201:openzeppelin.storage.ERC721 struct ERC721Storage { // Token name string _name; // Token symbol string _symbol; mapping(uint256 tokenId => address) _owners; mapping(address owner => uint256) _balances; mapping(uint256 tokenId => address) _tokenApprovals; mapping(address owner => mapping(address operator => bool)) _operatorApprovals; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC721")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC721StorageLocation = 0x80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300; function _getERC721Storage() private pure returns (ERC721Storage storage $) { assembly { $.slot := ERC721StorageLocation } } /** * @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 { ERC721Storage storage $ = _getERC721Storage(); $._name = name_; $._symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual returns (uint256) { ERC721Storage storage $ = _getERC721Storage(); if (owner == address(0)) { revert ERC721InvalidOwner(address(0)); } return $._balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual returns (address) { return _requireOwned(tokenId); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual returns (string memory) { ERC721Storage storage $ = _getERC721Storage(); return $._name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual returns (string memory) { ERC721Storage storage $ = _getERC721Storage(); return $._symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual returns (string memory) { _requireOwned(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string.concat(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 { _approve(to, tokenId, _msgSender()); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual returns (address) { _requireOwned(tokenId); return _getApproved(tokenId); } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual returns (bool) { ERC721Storage storage $ = _getERC721Storage(); return $._operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. address previousOwner = _update(to, tokenId, _msgSender()); if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual { transferFrom(from, to, tokenId); _checkOnERC721Received(from, to, tokenId, data); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist * * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances * consistent with ownership. The invariant to preserve is 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`. */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { ERC721Storage storage $ = _getERC721Storage(); return $._owners[tokenId]; } /** * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted. */ function _getApproved(uint256 tokenId) internal view virtual returns (address) { ERC721Storage storage $ = _getERC721Storage(); return $._tokenApprovals[tokenId]; } /** * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in * particular (ignoring whether it is owned by `owner`). * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) { return spender != address(0) && (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender); } /** * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner. * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets * the `spender` for the specific `tokenId`. * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual { if (!_isAuthorized(owner, spender, tokenId)) { if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } else { revert ERC721InsufficientApproval(spender, tokenId); } } } /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that * a uint256 would ever overflow from increments when these increments are bounded to uint128 values. * * WARNING: Increasing an account's balance using this function tends to be paired with an override of the * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership * remain consistent with one another. */ function _increaseBalance(address account, uint128 value) internal virtual { ERC721Storage storage $ = _getERC721Storage(); unchecked { $._balances[account] += value; } } /** * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update. * * The `auth` argument is optional. If the value passed is non 0, then this function will check that * `auth` is either the owner of the token, or approved to operate on the token (by the owner). * * Emits a {Transfer} event. * * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}. */ function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) { ERC721Storage storage $ = _getERC721Storage(); address from = _ownerOf(tokenId); // Perform (optional) operator check if (auth != address(0)) { _checkAuthorized(from, auth, tokenId); } // Execute the update if (from != address(0)) { // Clear approval. No need to re-authorize or emit the Approval event _approve(address(0), tokenId, address(0), false); unchecked { $._balances[from] -= 1; } } if (to != address(0)) { unchecked { $._balances[to] += 1; } } $._owners[tokenId] = to; emit Transfer(from, to, tokenId); return from; } /** * @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 { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner != address(0)) { revert ERC721InvalidSender(address(0)); } } /** * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance. * * 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 { _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); _checkOnERC721Received(address(0), to, tokenId, data); } /** * @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 { address previousOwner = _update(address(0), tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } } /** * @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 { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } else if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients * are aware of the ERC721 standard 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 like {safeTransferFrom} in the sense that it invokes * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `tokenId` token must exist and be owned by `from`. * - `to` cannot be the zero address. * - `from` cannot be the zero address. * - 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) internal { _safeTransfer(from, to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); _checkOnERC721Received(from, to, tokenId, data); } /** * @dev Approve `to` to operate on `tokenId` * * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is * either the owner of the token, or approved to operate on all tokens held by this owner. * * Emits an {Approval} event. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address to, uint256 tokenId, address auth) internal { _approve(to, tokenId, auth, true); } /** * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not * emitted in the context of transfers. */ function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual { ERC721Storage storage $ = _getERC721Storage(); // Avoid reading the owner unless necessary if (emitEvent || auth != address(0)) { address owner = _requireOwned(tokenId); // We do not use _isAuthorized because single-token approvals should not be able to call approve if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) { revert ERC721InvalidApprover(auth); } if (emitEvent) { emit Approval(owner, to, tokenId); } } $._tokenApprovals[tokenId] = to; } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Requirements: * - operator can't be the address zero. * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { ERC721Storage storage $ = _getERC721Storage(); if (operator == address(0)) { revert ERC721InvalidOperator(operator); } $._operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned). * Returns the owner. * * Overrides to ownership logic should be done to {_ownerOf}. */ function _requireOwned(uint256 tokenId) internal view returns (address) { address owner = _ownerOf(tokenId); if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } return owner; } /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the * recipient doesn't accept the token transfer. 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 */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private { if (to.code.length > 0) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { if (retval != IERC721Receiver.onERC721Received.selector) { revert ERC721InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { revert ERC721InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../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, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @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 returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); 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 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 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 `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../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; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._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 { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // 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) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.20; interface IERC5267 { /** * @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 v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.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, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } 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 bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or * {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: 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 address zero. * * 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 v5.0.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.20; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be * reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.20; import {IERC721} from "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../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); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @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. */ 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 `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the 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 towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (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 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) 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. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 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. uint256 twos = denominator & (0 - denominator); 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 (unsignedRoundsUp(rounding) && 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 * towards zero. * * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @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 v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
{ "remappings": [ "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "foundry-devops/=lib/foundry-devops/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/", "solady/=lib/solady/", "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/" ], "optimizer": { "enabled": true, "runs": 10000 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"CUBE__BPSTooHigh","type":"error"},{"inputs":[],"name":"CUBE__ExceedsContractBalance","type":"error"},{"inputs":[],"name":"CUBE__ExcessiveFeePayout","type":"error"},{"inputs":[],"name":"CUBE__FeeNotEnough","type":"error"},{"inputs":[],"name":"CUBE__IsNotSigner","type":"error"},{"inputs":[],"name":"CUBE__MintingIsNotActive","type":"error"},{"inputs":[],"name":"CUBE__NonceAlreadyUsed","type":"error"},{"inputs":[],"name":"CUBE__SignatureAndCubesInputMismatch","type":"error"},{"inputs":[],"name":"CUBE__TransferFailed","type":"error"},{"inputs":[],"name":"CUBE__WithdrawFailed","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","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":"amount","type":"uint256"}],"name":"ContractWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"questId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"uint256","name":"issueNumber","type":"uint256"},{"indexed":false,"internalType":"string","name":"walletProvider","type":"string"},{"indexed":false,"internalType":"string","name":"embedOrigin","type":"string"}],"name":"CubeClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"cubeTokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"txHash","type":"string"},{"indexed":false,"internalType":"string","name":"networkChainId","type":"string"}],"name":"CubeTransaction","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeePayout","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"MintingSwitch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"questId","type":"uint256"},{"indexed":false,"internalType":"enum CUBE.QuestType","name":"questType","type":"uint8"},{"indexed":false,"internalType":"enum CUBE.Difficulty","name":"difficulty","type":"uint8"},{"indexed":false,"internalType":"string","name":"title","type":"string"},{"indexed":false,"internalType":"string[]","name":"tags","type":"string[]"},{"indexed":false,"internalType":"string[]","name":"communities","type":"string[]"}],"name":"QuestMetadata","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":"cubeTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"chainId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"enum CUBE.TokenType","name":"tokenType","type":"uint8"}],"name":"TokenReward","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SIGNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"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":"string","name":"_tokenName","type":"string"},{"internalType":"string","name":"_tokenSymbol","type":"string"},{"internalType":"string","name":"_signingDomain","type":"string"},{"internalType":"string","name":"_signatureVersion","type":"string"},{"internalType":"address","name":"_admin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"questId","type":"uint256"},{"internalType":"string[]","name":"communities","type":"string[]"},{"internalType":"string","name":"title","type":"string"},{"internalType":"enum CUBE.Difficulty","name":"difficulty","type":"uint8"},{"internalType":"enum CUBE.QuestType","name":"questType","type":"uint8"},{"internalType":"string[]","name":"tags","type":"string[]"}],"name":"initializeQuest","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":[{"components":[{"internalType":"uint256","name":"questId","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"string","name":"walletProvider","type":"string"},{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"string","name":"embedOrigin","type":"string"},{"components":[{"internalType":"string","name":"txHash","type":"string"},{"internalType":"string","name":"networkChainId","type":"string"}],"internalType":"struct CUBE.TransactionData[]","name":"transactions","type":"tuple[]"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"BPS","type":"uint16"}],"internalType":"struct CUBE.FeeRecipient[]","name":"recipients","type":"tuple[]"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum CUBE.TokenType","name":"tokenType","type":"uint8"}],"internalType":"struct CUBE.RewardData","name":"reward","type":"tuple"}],"internalType":"struct CUBE.CubeData[]","name":"cubeData","type":"tuple[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"}],"name":"mintCubes","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","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":[],"name":"s_isMintingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"bool","name":"_isMintingActive","type":"bool"}],"name":"setIsMintingActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"_tokenURI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b506200002062000026565b620000da565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000775760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d75780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516144316200010460003960008181611adb01528181611b040152611cd601526144316000f3fe6080604052600436106101d85760003560e01c806370a0823111610102578063aab4160111610095578063d547741f11610064578063d547741f146105e9578063e985e9c514610609578063f72c0d8b14610671578063f907497c146106a557600080fd5b8063aab4160114610546578063ad3cb1cc14610560578063b88d4fde146105a9578063c87b56dd146105c957600080fd5b8063a1ebf35d116100d1578063a1ebf35d146104bd578063a217fddf146104f1578063a22cb46514610506578063a35d3d861461052657600080fd5b806370a08231146103fb57806384b0196e1461041b57806391d148541461044357806395d89b41146104a857600080fd5b80632e6400241161017a57806342842e0e1161014957806342842e0e146103935780634f1ef286146103b357806352d1902d146103c65780636352211e146103db57600080fd5b80632e6400241461031e5780632f2ff15d1461033e57806336568abe1461035e5780633ccfd60b1461037e57600080fd5b8063095ea7b3116101b6578063095ea7b31461026c5780630bdd68751461028e57806323b872dd146102a1578063248a9ca3146102c157600080fd5b806301ffc9a7146101dd57806306fdde0314610212578063081812fc14610234575b600080fd5b3480156101e957600080fd5b506101fd6101f8366004613516565b6106c5565b60405190151581526020015b60405180910390f35b34801561021e57600080fd5b506102276106d6565b6040516102099190613583565b34801561024057600080fd5b5061025461024f366004613596565b61078c565b6040516001600160a01b039091168152602001610209565b34801561027857600080fd5b5061028c6102873660046135cb565b6107d4565b005b61028c61029c366004613641565b6107e3565b3480156102ad57600080fd5b5061028c6102bc3660046136ad565b610977565b3480156102cd57600080fd5b506103106102dc366004613596565b60009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b604051908152602001610209565b34801561032a57600080fd5b5061028c6103393660046137b9565b610a33565b34801561034a57600080fd5b5061028c610359366004613877565b610e4b565b34801561036a57600080fd5b5061028c610379366004613877565b610e8f565b34801561038a57600080fd5b5061028c610ee0565b34801561039f57600080fd5b5061028c6103ae3660046136ad565b610fa5565b61028c6103c13660046138a3565b610fc0565b3480156103d257600080fd5b50610310610fdb565b3480156103e757600080fd5b506102546103f6366004613596565b61100a565b34801561040757600080fd5b506103106104163660046138f1565b611015565b34801561042757600080fd5b5061043061109c565b604051610209979695949392919061390c565b34801561044f57600080fd5b506101fd61045e366004613877565b60009182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156104b457600080fd5b50610227611198565b3480156104c957600080fd5b506103107f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4081565b3480156104fd57600080fd5b50610310600081565b34801561051257600080fd5b5061028c6105213660046139ce565b6111e9565b34801561053257600080fd5b5061028c6105413660046139f8565b6111f4565b34801561055257600080fd5b506001546101fd9060ff1681565b34801561056c57600080fd5b506102276040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b3480156105b557600080fd5b5061028c6105c4366004613a13565b611240565b3480156105d557600080fd5b506102276105e4366004613596565b611257565b3480156105f557600080fd5b5061028c610604366004613877565b6112f9565b34801561061557600080fd5b506101fd610624366004613a7b565b6001600160a01b0391821660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020908152604080832093909416825291909152205460ff1690565b34801561067d57600080fd5b506103107fa615a8afb6fffcb8c6809ac0997b5c9c12b8cc97651150f14c8f6203168cff4c81565b3480156106b157600080fd5b5061028c6106c0366004613b53565b61133d565b60006106d0826113b0565b92915050565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300805460609190819061070890613c0e565b80601f016020809104026020016040519081016040528092919081815260200182805461073490613c0e565b80156107815780601f1061075657610100808354040283529160200191610781565b820191906000526020600020905b81548152906001019060200180831161076457829003601f168201915b505050505091505090565b600061079782611406565b5060008281527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b03166106d0565b6107df828233611477565b5050565b6107eb611484565b60015460ff16610827576040517f9d2c8e7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b828114610860576040517fc70ea82800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805b848110156108a85785858281811061087e5761087e613c61565b90506020028101906108909190613c90565b61089e906040013583613cfd565b9150600101610864565b50803410156108e3576040517fea259f9100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b848110156109465761093e86868381811061090357610903613c61565b90506020028101906109159190613c90565b85858481811061092757610927613c61565b90506020028101906109399190613d10565b611505565b6001016108e6565b505061097160017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50505050565b6001600160a01b0382166109bf576040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b60006109cc838333611797565b9050836001600160a01b0316816001600160a01b031614610971576040517f64283d7b0000000000000000000000000000000000000000000000000000000081526001600160a01b03808616600483015260248201849052821660448201526064016109b6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff16600081158015610a7e5750825b905060008267ffffffffffffffff166001148015610a9b5750303b155b905081158015610aa9575080155b15610ae0576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001660011785558315610b415784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b610b4b8a8a611910565b610b558888611922565b610b5d611934565b610b65611934565b610b6d61193e565b6001805460ff19168117905560408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f4e606c47000000000000000000000000000000000000000000000000000000001790529051734300000000000000000000000000000000000002916000918391610bf591613d75565b6000604051808303816000865af19150503d8060008114610c32576040519150601f19603f3d011682016040523d82523d6000602084013e610c37565b606091505b5050905080610ca2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6661696c656420746f207265676973746572206363670000000000000000000060448201526064016109b6565b6040516001600160a01b0389811660248301526000919084169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167feb8646980000000000000000000000000000000000000000000000000000000017905251610d229190613d75565b6000604051808303816000865af19150503d8060008114610d5f576040519150601f19603f3d011682016040523d82523d6000602084013e610d64565b606091505b5050905080610dcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f6661696c656420746f207265676973746572206367000000000000000000000060448201526064016109b6565b610dda60008a61194e565b505050508315610e3f5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610e8581611a1d565b610971838361194e565b6001600160a01b0381163314610ed1576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610edb8282611a2a565b505050565b6000610eeb81611a1d565b604051600090339047908381818185875af1925050503d8060008114610f2d576040519150601f19603f3d011682016040523d82523d6000602084013e610f32565b606091505b5050905080610f6d576040517f2baafbf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040514781527f6c9cf7ce96a10a51ae8b3fc5aca25e4754a77b3e821c133c5cebb1d30abe7e8e906020015b60405180910390a15050565b610edb83838360405180602001604052806000815250611240565b610fc8611ad0565b610fd182611ba0565b6107df8282611bca565b6000610fe5611ccb565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b60006106d082611406565b60007f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793006001600160a01b03831661107b576040517f89c62b64000000000000000000000000000000000000000000000000000000008152600060048201526024016109b6565b6001600160a01b039092166000908152600390920160205250604090205490565b600060608082808083817fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10080549091501580156110db57506001810154155b611141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4549503731323a20556e696e697469616c697a6564000000000000000000000060448201526064016109b6565b611149611d2d565b611151611d7e565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009c939b5091995046985030975095509350915050565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930180546060917f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793009161070890613c0e565b6107df338383611dcf565b60006111ff81611a1d565b6001805460ff19168315159081179091556040519081527f7d16763644b2f7d5a11e2b05fe3a9cc4edb4568049295f4e62024269ae2f6eab90602001610f99565b61124b848484610977565b61097184848484611eab565b600081815260036020526040902080546060919061127490613c0e565b80601f01602080910402602001604051908101604052809291908181526020018280546112a090613c0e565b80156112ed5780601f106112c2576101008083540402835291602001916112ed565b820191906000526020600020905b8154815290600101906020018083116112d057829003601f168201915b50505050509050919050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015461133381611a1d565b6109718383611a2a565b7f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4061136781611a1d565b867f8a2c815542d43af541960cd9124f5ec6a55c4b8c69f0dda02ed413b401e309cd848688868b60405161139f959493929190613e0b565b60405180910390a250505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806106d057506106d082612050565b60008181527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260408120546001600160a01b0316806106d0576040517f7e273289000000000000000000000000000000000000000000000000000000008152600481018490526024016109b6565b610edb8383836001612133565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0080547ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016114ff576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60029055565b6000546115138484846122ca565b60005b61152360e0860186613e70565b90508110156115e457817fabd48d213cb20ec6f191e95c191131c8fc3832f194f53febcb53d4834baae50761155b60e0880188613e70565b8481811061156b5761156b613c61565b905060200281019061157d9190613ed8565b6115879080613d10565b61159460e08a018a613e70565b868181106115a4576115a4613c61565b90506020028101906115b69190613ed8565b6115c4906020810190613d10565b6040516115d49493929190613f37565b60405180910390a2600101611516565b506115f260a0850185613d10565b60008381526003602052604090209161160c919083613fb7565b508335600090815260026020526040812080546001908101909155815401815561163a6101008601866140b3565b9050111561164b5761164b846123be565b61166461165e60808601606087016138f1565b82612656565b61167460808501606086016138f1565b84356000818152600260205260409020546001600160a01b0392909216918391907ffe94555d033bd3fc0f75671674d030640f03095d8345426fcab3a9a0bffdc4fb906116c460808a018a613d10565b6116d160c08c018c613d10565b6040516116e295949392919061411b565b60405180910390a46101408401351561097157610140840180359061170b9061012087016138f1565b6001600160a01b0316827f6d6039156ec873b5c217b996d727775a9eea208e1329e87aaa4b617c76d2bb946101608801356101808901356117546101c08b016101a08c01614148565b6040516117639392919061417d565b60405180910390a450505050565b60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b60008281527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260408120547f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300906001600160a01b039081169084161561180557611805818587612670565b6001600160a01b0381161561186357611822600086600080612133565b6001600160a01b0381166000908152600383016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190555b6001600160a01b03861615611894576001600160a01b03861660009081526003830160205260409020805460010190555b600085815260028301602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038a811691821790925591518893918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a49150505b9392505050565b611918612706565b6107df828261276d565b61192a612706565b6107df82826127b0565b61193c612706565b565b611946612706565b61193c612823565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602081815260408084206001600160a01b038616855290915282205460ff16611a13576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556119c93390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506106d0565b60009150506106d0565b611a27813361282b565b50565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602081815260408084206001600160a01b038616855290915282205460ff1615611a13576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506106d0565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480611b6957507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611b5d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614155b1561193c576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fa615a8afb6fffcb8c6809ac0997b5c9c12b8cc97651150f14c8f6203168cff4c6107df81611a1d565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611c24575060408051601f3d908101601f19168201909252611c2191810190614198565b60015b611c65576040517f4c9c8ce30000000000000000000000000000000000000000000000000000000081526001600160a01b03831660048201526024016109b6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114611cc1576040517faa1d49a4000000000000000000000000000000000000000000000000000000008152600481018290526024016109b6565b610edb83836128b8565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461193c576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10280546060917fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1009161070890613c0e565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10380546060917fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1009161070890613c0e565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793006001600160a01b038316611e3b576040517f5b08ba180000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016109b6565b6001600160a01b038481166000818152600584016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b0383163b15610971576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063150b7a0290611f069033908890879087906004016141b1565b6020604051808303816000875af1925050508015611f41575060408051601f3d908101601f19168201909252611f3e918101906141ed565b60015b611fc3573d808015611f6f576040519150601f19603f3d011682016040523d82523d6000602084013e611f74565b606091505b508051600003611fbb576040517f64a0ae920000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016109b6565b805181602001fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081167f150b7a020000000000000000000000000000000000000000000000000000000014612049576040517f64a0ae920000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016109b6565b5050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806120e357507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806106d057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146106d0565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300818061216857506001600160a01b03831615155b1561228157600061217885611406565b90506001600160a01b038416158015906121a45750836001600160a01b0316816001600160a01b031614155b80156121f557506001600160a01b0380821660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079305602090815260408083209388168352929052205460ff16155b15612237576040517fa9fbf51f0000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016109b6565b821561227f5784866001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b600093845260040160205250506040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b60006122d784848461290e565b6001600160a01b03811660009081527fbc6704768de17ac743a4c41122099f7a3464fc20363467b8527e22c7572f5d3a602052604090205490915060ff1661234b576040517f0f3c13fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208085013560009081526004909152604090205460ff161561239a576040517f76abf21400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050506020908101356000908152600490915260409020805460ff19166001179055565b600061271047825b6123d46101008601866140b3565b90508110156120495761ffff83166123f06101008701876140b3565b8381811061240057612400613c61565b9050604002016020016020810190612418919061420a565b61ffff161115612454576040517f635015ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061ffff84166124696101008801886140b3565b8481811061247957612479613c61565b9050604002016020016020810190612491919061420a565b6124a39061ffff16604089013561422e565b6124ad9190614245565b90506124b98186613cfd565b945085604001358511156124f9576040517fcc3b3ebc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82851115612533576040517f2c2cae9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006125436101008801886140b3565b8481811061255357612553613c61565b61256992602060409092020190810191506138f1565b90506001600160a01b0381161561264c576000816001600160a01b03168360405160006040518083038185875af1925050503d80600081146125c7576040519150601f19603f3d011682016040523d82523d6000602084013e6125cc565b606091505b5050905080612607576040517f7327470c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b03167fc9a9861643a061bfa3739f3b26e5d64578cd78bb863dbd5dac0aca396728d9a78460405161264291815260200190565b60405180910390a2505b50506001016123c6565b6107df828260405180602001604052806000815250612967565b61267b83838361297e565b610edb576001600160a01b0383166126c2576040517f7e273289000000000000000000000000000000000000000000000000000000008152600481018290526024016109b6565b6040517f177e802f0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602481018290526044016109b6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661193c576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612775612706565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300806127a18482614280565b50600181016109718382614280565b6127b8612706565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1007fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1026128048482614280565b50600381016128138382614280565b5060008082556001909101555050565b611771612706565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602090815260408083206001600160a01b038516845290915290205460ff166107df576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016109b6565b6128c182612a42565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a280511561290657610edb8282612aea565b6107df612b57565b60008061291a85612b8f565b905061295e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508593925050612ba99050565b95945050505050565b6129718383612bd3565b610edb6000848484611eab565b60006001600160a01b03831615801590612a3a5750826001600160a01b0316846001600160a01b031614806129f757506001600160a01b0380851660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079305602090815260408083209387168352929052205460ff165b80612a3a575060008281527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b038481169116145b949350505050565b806001600160a01b03163b600003612a91576040517f4c9c8ce30000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016109b6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051612b079190613d75565b600060405180830381855af49150503d8060008114612b42576040519150601f19603f3d011682016040523d82523d6000602084013e612b47565b606091505b509150915061295e858383612c6a565b341561193c576040517fb398979f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006106d0612b9d83612cdf565b80519060200120612dfc565b600080600080612bb98686612e44565b925092509250612bc98282612e91565b5090949350505050565b6001600160a01b038216612c16576040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600060048201526024016109b6565b6000612c2483836000611797565b90506001600160a01b03811615610edb576040517f73c6ac6e000000000000000000000000000000000000000000000000000000008152600060048201526024016109b6565b606082612c7f57612c7a82612f95565b611909565b8151158015612c9657506001600160a01b0384163b155b15612cd8576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016109b6565b5080611909565b60607f7b49e75f5dee25184e7fc560a05a02fa4311f0290980e85c2f8d7733b7fd3aba823560208401356040850135612d1d608087018787016138f1565b612d32612d2d6080890189613d10565b612fd7565b612d42612d2d60a08a018a613d10565b612d52612d2d60c08b018b613d10565b612d67612d6260e08c018c613e70565b612ff9565b612d7d612d786101008d018d6140b3565b6130d5565b612d8a8c61012001613174565b60408051602081019c909c528b019990995260608a019790975260808901959095526001600160a01b0390931660a088015260c087019190915260e0860152610100850152610120840152610140830152610160820152610180015b6040516020818303038152906040529050919050565b60006106d0612e096131f5565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60008060008351604103612e7e5760208401516040850151606086015160001a612e7088828585613204565b955095509550505050612e8a565b50508151600091506002905b9250925092565b6000826003811115612ea557612ea5613d87565b03612eae575050565b6001826003811115612ec257612ec2613d87565b03612ef9576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002826003811115612f0d57612f0d613d87565b03612f47576040517ffce698f7000000000000000000000000000000000000000000000000000000008152600481018290526024016109b6565b6003826003811115612f5b57612f5b613d87565b036107df576040517fd78bce0c000000000000000000000000000000000000000000000000000000008152600481018290526024016109b6565b805115612fa55780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008282604051612fe992919061437c565b6040518091039020905092915050565b6000808267ffffffffffffffff811115613015576130156136e9565b60405190808252806020026020018201604052801561303e578160200160208202803683370190505b50905060005b838110156130a45761307885858381811061306157613061613c61565b90506020028101906130739190613ed8565b6132d3565b8051906020012082828151811061309157613091613c61565b6020908102919091010152600101613044565b50806040516020016130b6919061438c565b6040516020818303038152906040528051906020012091505092915050565b6000808267ffffffffffffffff8111156130f1576130f16136e9565b60405190808252806020026020018201604052801561311a578160200160208202803683370190505b50905060005b838110156130a45761314885858381811061313d5761313d613c61565b905060400201613332565b8051906020012082828151811061316157613161613c61565b6020908102919091010152600101613120565b60007fbb5588251ed87f59437bd9a89dd0ef74f88c736ab95bdcd74955ff21bcf35e796131a460208401846138f1565b6020840135604085013560608601356131c360a0880160808901614148565b6040516020016131d8969594939291906143c2565b604051602081830303815290604052805190602001209050919050565b60006131ff6133a2565b905090565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561323f57506000915060039050826132c9565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015613293573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166132bf575060009250600191508290506132c9565b9250600091508190505b9450945094915050565b60607f93dc1bac6b117acdbb889b9a825b9bc731449f703cc02b69049722fcba5dbe34613303612d2d8480613d10565b613313612d2d6020860186613d10565b6040805160208101949094528301919091526060820152608001612de6565b60607fdf3d1189f68f42c28f9fad9d69ff7a974d0a800a2e4420ed400e45a46d2fac2f61336260208401846138f1565b613372604085016020860161420a565b604051602001612de6939291909283526001600160a01b0391909116602083015261ffff16604082015260600190565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6133cd613416565b6133d5613492565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60007fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10081613442611d2d565b80519091501561345a57805160209091012092915050565b81548015613469579392505050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470935050505090565b60007fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100816134be611d7e565b8051909150156134d657805160209091012092915050565b60018201548015613469579392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114611a2757600080fd5b60006020828403121561352857600080fd5b8135611909816134e8565b60005b8381101561354e578181015183820152602001613536565b50506000910152565b6000815180845261356f816020860160208601613533565b601f01601f19169290920160200192915050565b6020815260006119096020830184613557565b6000602082840312156135a857600080fd5b5035919050565b80356001600160a01b03811681146135c657600080fd5b919050565b600080604083850312156135de57600080fd5b6135e7836135af565b946020939093013593505050565b60008083601f84011261360757600080fd5b50813567ffffffffffffffff81111561361f57600080fd5b6020830191508360208260051b850101111561363a57600080fd5b9250929050565b6000806000806040858703121561365757600080fd5b843567ffffffffffffffff8082111561366f57600080fd5b61367b888389016135f5565b9096509450602087013591508082111561369457600080fd5b506136a1878288016135f5565b95989497509550505050565b6000806000606084860312156136c257600080fd5b6136cb846135af565b92506136d9602085016135af565b9150604084013590509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613741576137416136e9565b604052919050565b600082601f83011261375a57600080fd5b813567ffffffffffffffff811115613774576137746136e9565b6137876020601f19601f84011601613718565b81815284602083860101111561379c57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156137d157600080fd5b853567ffffffffffffffff808211156137e957600080fd5b6137f589838a01613749565b9650602088013591508082111561380b57600080fd5b61381789838a01613749565b9550604088013591508082111561382d57600080fd5b61383989838a01613749565b9450606088013591508082111561384f57600080fd5b5061385c88828901613749565b92505061386b608087016135af565b90509295509295909350565b6000806040838503121561388a57600080fd5b8235915061389a602084016135af565b90509250929050565b600080604083850312156138b657600080fd5b6138bf836135af565b9150602083013567ffffffffffffffff8111156138db57600080fd5b6138e785828601613749565b9150509250929050565b60006020828403121561390357600080fd5b611909826135af565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e08184015261394860e084018a613557565b838103604085015261395a818a613557565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156139ac57835183529284019291840191600101613990565b50909c9b505050505050505050505050565b803580151581146135c657600080fd5b600080604083850312156139e157600080fd5b6139ea836135af565b915061389a602084016139be565b600060208284031215613a0a57600080fd5b611909826139be565b60008060008060808587031215613a2957600080fd5b613a32856135af565b9350613a40602086016135af565b925060408501359150606085013567ffffffffffffffff811115613a6357600080fd5b613a6f87828801613749565b91505092959194509250565b60008060408385031215613a8e57600080fd5b613a97836135af565b915061389a602084016135af565b600082601f830112613ab657600080fd5b8135602067ffffffffffffffff80831115613ad357613ad36136e9565b8260051b613ae2838201613718565b9384528581018301938381019088861115613afc57600080fd5b84880192505b85831015613b3857823584811115613b1a5760008081fd5b613b288a87838c0101613749565b8352509184019190840190613b02565b98975050505050505050565b8035600281106135c657600080fd5b60008060008060008060c08789031215613b6c57600080fd5b86359550602087013567ffffffffffffffff80821115613b8b57600080fd5b613b978a838b01613aa5565b96506040890135915080821115613bad57600080fd5b613bb98a838b01613749565b95506060890135915060038210613bcf57600080fd5b819450613bde60808a01613b44565b935060a0890135915080821115613bf457600080fd5b50613c0189828a01613aa5565b9150509295509295509295565b600181811c90821680613c2257607f821691505b602082108103613c5b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe41833603018112613cc457600080fd5b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156106d0576106d0613cce565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613d4557600080fd5b83018035915067ffffffffffffffff821115613d6057600080fd5b60200191503681900382131561363a57600080fd5b60008251613cc4818460208701613533565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600081518084526020808501808196508360051b8101915082860160005b85811015613dfe578284038952613dec848351613557565b98850198935090840190600101613dd4565b5091979650505050505050565b600060028710613e1d57613e1d613d87565b86825260038610613e3057613e30613d87565b85602083015260a06040830152613e4a60a0830186613557565b8281036060840152613e5c8186613db6565b90508281036080840152613b388185613db6565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613ea557600080fd5b83018035915067ffffffffffffffff821115613ec057600080fd5b6020019150600581901b360382131561363a57600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112613cc457600080fd5b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b604081526000613f4b604083018688613f0c565b8281036020840152613f5e818587613f0c565b979650505050505050565b601f821115610edb57600081815260208120601f850160051c81016020861015613f905750805b601f850160051c820191505b81811015613faf57828155600101613f9c565b505050505050565b67ffffffffffffffff831115613fcf57613fcf6136e9565b613fe383613fdd8354613c0e565b83613f69565b6000601f8411600181146140355760008515613fff5750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355612049565b600083815260209020601f19861690835b828110156140665786850135825560209485019460019092019101614046565b50868210156140a1577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126140e857600080fd5b83018035915067ffffffffffffffff82111561410357600080fd5b6020019150600681901b360382131561363a57600080fd5b858152606060208201526000614135606083018688613f0c565b8281036040840152613b38818587613f0c565b60006020828403121561415a57600080fd5b81356004811061190957600080fd5b6004811061417957614179613d87565b9052565b8381526020810183905260608101612a3a6040830184614169565b6000602082840312156141aa57600080fd5b5051919050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526141e36080830184613557565b9695505050505050565b6000602082840312156141ff57600080fd5b8151611909816134e8565b60006020828403121561421c57600080fd5b813561ffff8116811461190957600080fd5b80820281158282048414176106d0576106d0613cce565b60008261427b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b815167ffffffffffffffff81111561429a5761429a6136e9565b6142ae816142a88454613c0e565b84613f69565b602080601f83116001811461430157600084156142cb5750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555613faf565b600085815260208120601f198616915b8281101561433057888601518255948401946001909101908401614311565b508582101561436c57878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8183823760009101908152919050565b815160009082906020808601845b838110156143b65781518552938201939082019060010161439a565b50929695505050505050565b600060c0820190508782526001600160a01b0387166020830152856040830152846060830152836080830152613f5e60a083018461416956fea264697066735822122050f641170bcadb20f92227e3bf79fc7af39a92312fb3615550db581ff0e20f1564736f6c63430008140033
Deployed Bytecode
0x6080604052600436106101d85760003560e01c806370a0823111610102578063aab4160111610095578063d547741f11610064578063d547741f146105e9578063e985e9c514610609578063f72c0d8b14610671578063f907497c146106a557600080fd5b8063aab4160114610546578063ad3cb1cc14610560578063b88d4fde146105a9578063c87b56dd146105c957600080fd5b8063a1ebf35d116100d1578063a1ebf35d146104bd578063a217fddf146104f1578063a22cb46514610506578063a35d3d861461052657600080fd5b806370a08231146103fb57806384b0196e1461041b57806391d148541461044357806395d89b41146104a857600080fd5b80632e6400241161017a57806342842e0e1161014957806342842e0e146103935780634f1ef286146103b357806352d1902d146103c65780636352211e146103db57600080fd5b80632e6400241461031e5780632f2ff15d1461033e57806336568abe1461035e5780633ccfd60b1461037e57600080fd5b8063095ea7b3116101b6578063095ea7b31461026c5780630bdd68751461028e57806323b872dd146102a1578063248a9ca3146102c157600080fd5b806301ffc9a7146101dd57806306fdde0314610212578063081812fc14610234575b600080fd5b3480156101e957600080fd5b506101fd6101f8366004613516565b6106c5565b60405190151581526020015b60405180910390f35b34801561021e57600080fd5b506102276106d6565b6040516102099190613583565b34801561024057600080fd5b5061025461024f366004613596565b61078c565b6040516001600160a01b039091168152602001610209565b34801561027857600080fd5b5061028c6102873660046135cb565b6107d4565b005b61028c61029c366004613641565b6107e3565b3480156102ad57600080fd5b5061028c6102bc3660046136ad565b610977565b3480156102cd57600080fd5b506103106102dc366004613596565b60009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b604051908152602001610209565b34801561032a57600080fd5b5061028c6103393660046137b9565b610a33565b34801561034a57600080fd5b5061028c610359366004613877565b610e4b565b34801561036a57600080fd5b5061028c610379366004613877565b610e8f565b34801561038a57600080fd5b5061028c610ee0565b34801561039f57600080fd5b5061028c6103ae3660046136ad565b610fa5565b61028c6103c13660046138a3565b610fc0565b3480156103d257600080fd5b50610310610fdb565b3480156103e757600080fd5b506102546103f6366004613596565b61100a565b34801561040757600080fd5b506103106104163660046138f1565b611015565b34801561042757600080fd5b5061043061109c565b604051610209979695949392919061390c565b34801561044f57600080fd5b506101fd61045e366004613877565b60009182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156104b457600080fd5b50610227611198565b3480156104c957600080fd5b506103107f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4081565b3480156104fd57600080fd5b50610310600081565b34801561051257600080fd5b5061028c6105213660046139ce565b6111e9565b34801561053257600080fd5b5061028c6105413660046139f8565b6111f4565b34801561055257600080fd5b506001546101fd9060ff1681565b34801561056c57600080fd5b506102276040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b3480156105b557600080fd5b5061028c6105c4366004613a13565b611240565b3480156105d557600080fd5b506102276105e4366004613596565b611257565b3480156105f557600080fd5b5061028c610604366004613877565b6112f9565b34801561061557600080fd5b506101fd610624366004613a7b565b6001600160a01b0391821660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020908152604080832093909416825291909152205460ff1690565b34801561067d57600080fd5b506103107fa615a8afb6fffcb8c6809ac0997b5c9c12b8cc97651150f14c8f6203168cff4c81565b3480156106b157600080fd5b5061028c6106c0366004613b53565b61133d565b60006106d0826113b0565b92915050565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300805460609190819061070890613c0e565b80601f016020809104026020016040519081016040528092919081815260200182805461073490613c0e565b80156107815780601f1061075657610100808354040283529160200191610781565b820191906000526020600020905b81548152906001019060200180831161076457829003601f168201915b505050505091505090565b600061079782611406565b5060008281527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b03166106d0565b6107df828233611477565b5050565b6107eb611484565b60015460ff16610827576040517f9d2c8e7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b828114610860576040517fc70ea82800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805b848110156108a85785858281811061087e5761087e613c61565b90506020028101906108909190613c90565b61089e906040013583613cfd565b9150600101610864565b50803410156108e3576040517fea259f9100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b848110156109465761093e86868381811061090357610903613c61565b90506020028101906109159190613c90565b85858481811061092757610927613c61565b90506020028101906109399190613d10565b611505565b6001016108e6565b505061097160017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50505050565b6001600160a01b0382166109bf576040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b60006109cc838333611797565b9050836001600160a01b0316816001600160a01b031614610971576040517f64283d7b0000000000000000000000000000000000000000000000000000000081526001600160a01b03808616600483015260248201849052821660448201526064016109b6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff16600081158015610a7e5750825b905060008267ffffffffffffffff166001148015610a9b5750303b155b905081158015610aa9575080155b15610ae0576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001660011785558315610b415784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b610b4b8a8a611910565b610b558888611922565b610b5d611934565b610b65611934565b610b6d61193e565b6001805460ff19168117905560408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f4e606c47000000000000000000000000000000000000000000000000000000001790529051734300000000000000000000000000000000000002916000918391610bf591613d75565b6000604051808303816000865af19150503d8060008114610c32576040519150601f19603f3d011682016040523d82523d6000602084013e610c37565b606091505b5050905080610ca2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6661696c656420746f207265676973746572206363670000000000000000000060448201526064016109b6565b6040516001600160a01b0389811660248301526000919084169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167feb8646980000000000000000000000000000000000000000000000000000000017905251610d229190613d75565b6000604051808303816000865af19150503d8060008114610d5f576040519150601f19603f3d011682016040523d82523d6000602084013e610d64565b606091505b5050905080610dcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f6661696c656420746f207265676973746572206367000000000000000000000060448201526064016109b6565b610dda60008a61194e565b505050508315610e3f5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610e8581611a1d565b610971838361194e565b6001600160a01b0381163314610ed1576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610edb8282611a2a565b505050565b6000610eeb81611a1d565b604051600090339047908381818185875af1925050503d8060008114610f2d576040519150601f19603f3d011682016040523d82523d6000602084013e610f32565b606091505b5050905080610f6d576040517f2baafbf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040514781527f6c9cf7ce96a10a51ae8b3fc5aca25e4754a77b3e821c133c5cebb1d30abe7e8e906020015b60405180910390a15050565b610edb83838360405180602001604052806000815250611240565b610fc8611ad0565b610fd182611ba0565b6107df8282611bca565b6000610fe5611ccb565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b60006106d082611406565b60007f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793006001600160a01b03831661107b576040517f89c62b64000000000000000000000000000000000000000000000000000000008152600060048201526024016109b6565b6001600160a01b039092166000908152600390920160205250604090205490565b600060608082808083817fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10080549091501580156110db57506001810154155b611141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4549503731323a20556e696e697469616c697a6564000000000000000000000060448201526064016109b6565b611149611d2d565b611151611d7e565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009c939b5091995046985030975095509350915050565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930180546060917f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793009161070890613c0e565b6107df338383611dcf565b60006111ff81611a1d565b6001805460ff19168315159081179091556040519081527f7d16763644b2f7d5a11e2b05fe3a9cc4edb4568049295f4e62024269ae2f6eab90602001610f99565b61124b848484610977565b61097184848484611eab565b600081815260036020526040902080546060919061127490613c0e565b80601f01602080910402602001604051908101604052809291908181526020018280546112a090613c0e565b80156112ed5780601f106112c2576101008083540402835291602001916112ed565b820191906000526020600020905b8154815290600101906020018083116112d057829003601f168201915b50505050509050919050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015461133381611a1d565b6109718383611a2a565b7f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4061136781611a1d565b867f8a2c815542d43af541960cd9124f5ec6a55c4b8c69f0dda02ed413b401e309cd848688868b60405161139f959493929190613e0b565b60405180910390a250505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806106d057506106d082612050565b60008181527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260408120546001600160a01b0316806106d0576040517f7e273289000000000000000000000000000000000000000000000000000000008152600481018490526024016109b6565b610edb8383836001612133565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0080547ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016114ff576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60029055565b6000546115138484846122ca565b60005b61152360e0860186613e70565b90508110156115e457817fabd48d213cb20ec6f191e95c191131c8fc3832f194f53febcb53d4834baae50761155b60e0880188613e70565b8481811061156b5761156b613c61565b905060200281019061157d9190613ed8565b6115879080613d10565b61159460e08a018a613e70565b868181106115a4576115a4613c61565b90506020028101906115b69190613ed8565b6115c4906020810190613d10565b6040516115d49493929190613f37565b60405180910390a2600101611516565b506115f260a0850185613d10565b60008381526003602052604090209161160c919083613fb7565b508335600090815260026020526040812080546001908101909155815401815561163a6101008601866140b3565b9050111561164b5761164b846123be565b61166461165e60808601606087016138f1565b82612656565b61167460808501606086016138f1565b84356000818152600260205260409020546001600160a01b0392909216918391907ffe94555d033bd3fc0f75671674d030640f03095d8345426fcab3a9a0bffdc4fb906116c460808a018a613d10565b6116d160c08c018c613d10565b6040516116e295949392919061411b565b60405180910390a46101408401351561097157610140840180359061170b9061012087016138f1565b6001600160a01b0316827f6d6039156ec873b5c217b996d727775a9eea208e1329e87aaa4b617c76d2bb946101608801356101808901356117546101c08b016101a08c01614148565b6040516117639392919061417d565b60405180910390a450505050565b60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b60008281527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260408120547f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300906001600160a01b039081169084161561180557611805818587612670565b6001600160a01b0381161561186357611822600086600080612133565b6001600160a01b0381166000908152600383016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190555b6001600160a01b03861615611894576001600160a01b03861660009081526003830160205260409020805460010190555b600085815260028301602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038a811691821790925591518893918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a49150505b9392505050565b611918612706565b6107df828261276d565b61192a612706565b6107df82826127b0565b61193c612706565b565b611946612706565b61193c612823565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602081815260408084206001600160a01b038616855290915282205460ff16611a13576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556119c93390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506106d0565b60009150506106d0565b611a27813361282b565b50565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602081815260408084206001600160a01b038616855290915282205460ff1615611a13576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506106d0565b306001600160a01b037f000000000000000000000000d0ab2d3621dc8a862389f89f52f08c097e3fe8b5161480611b6957507f000000000000000000000000d0ab2d3621dc8a862389f89f52f08c097e3fe8b56001600160a01b0316611b5d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614155b1561193c576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fa615a8afb6fffcb8c6809ac0997b5c9c12b8cc97651150f14c8f6203168cff4c6107df81611a1d565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611c24575060408051601f3d908101601f19168201909252611c2191810190614198565b60015b611c65576040517f4c9c8ce30000000000000000000000000000000000000000000000000000000081526001600160a01b03831660048201526024016109b6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114611cc1576040517faa1d49a4000000000000000000000000000000000000000000000000000000008152600481018290526024016109b6565b610edb83836128b8565b306001600160a01b037f000000000000000000000000d0ab2d3621dc8a862389f89f52f08c097e3fe8b5161461193c576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10280546060917fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1009161070890613c0e565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10380546060917fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1009161070890613c0e565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793006001600160a01b038316611e3b576040517f5b08ba180000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016109b6565b6001600160a01b038481166000818152600584016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b0383163b15610971576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063150b7a0290611f069033908890879087906004016141b1565b6020604051808303816000875af1925050508015611f41575060408051601f3d908101601f19168201909252611f3e918101906141ed565b60015b611fc3573d808015611f6f576040519150601f19603f3d011682016040523d82523d6000602084013e611f74565b606091505b508051600003611fbb576040517f64a0ae920000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016109b6565b805181602001fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081167f150b7a020000000000000000000000000000000000000000000000000000000014612049576040517f64a0ae920000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016109b6565b5050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806120e357507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806106d057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146106d0565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300818061216857506001600160a01b03831615155b1561228157600061217885611406565b90506001600160a01b038416158015906121a45750836001600160a01b0316816001600160a01b031614155b80156121f557506001600160a01b0380821660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079305602090815260408083209388168352929052205460ff16155b15612237576040517fa9fbf51f0000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016109b6565b821561227f5784866001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b600093845260040160205250506040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b60006122d784848461290e565b6001600160a01b03811660009081527fbc6704768de17ac743a4c41122099f7a3464fc20363467b8527e22c7572f5d3a602052604090205490915060ff1661234b576040517f0f3c13fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208085013560009081526004909152604090205460ff161561239a576040517f76abf21400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050506020908101356000908152600490915260409020805460ff19166001179055565b600061271047825b6123d46101008601866140b3565b90508110156120495761ffff83166123f06101008701876140b3565b8381811061240057612400613c61565b9050604002016020016020810190612418919061420a565b61ffff161115612454576040517f635015ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061ffff84166124696101008801886140b3565b8481811061247957612479613c61565b9050604002016020016020810190612491919061420a565b6124a39061ffff16604089013561422e565b6124ad9190614245565b90506124b98186613cfd565b945085604001358511156124f9576040517fcc3b3ebc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82851115612533576040517f2c2cae9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006125436101008801886140b3565b8481811061255357612553613c61565b61256992602060409092020190810191506138f1565b90506001600160a01b0381161561264c576000816001600160a01b03168360405160006040518083038185875af1925050503d80600081146125c7576040519150601f19603f3d011682016040523d82523d6000602084013e6125cc565b606091505b5050905080612607576040517f7327470c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b03167fc9a9861643a061bfa3739f3b26e5d64578cd78bb863dbd5dac0aca396728d9a78460405161264291815260200190565b60405180910390a2505b50506001016123c6565b6107df828260405180602001604052806000815250612967565b61267b83838361297e565b610edb576001600160a01b0383166126c2576040517f7e273289000000000000000000000000000000000000000000000000000000008152600481018290526024016109b6565b6040517f177e802f0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602481018290526044016109b6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661193c576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612775612706565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300806127a18482614280565b50600181016109718382614280565b6127b8612706565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1007fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1026128048482614280565b50600381016128138382614280565b5060008082556001909101555050565b611771612706565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602090815260408083206001600160a01b038516845290915290205460ff166107df576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016109b6565b6128c182612a42565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a280511561290657610edb8282612aea565b6107df612b57565b60008061291a85612b8f565b905061295e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508593925050612ba99050565b95945050505050565b6129718383612bd3565b610edb6000848484611eab565b60006001600160a01b03831615801590612a3a5750826001600160a01b0316846001600160a01b031614806129f757506001600160a01b0380851660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079305602090815260408083209387168352929052205460ff165b80612a3a575060008281527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b038481169116145b949350505050565b806001600160a01b03163b600003612a91576040517f4c9c8ce30000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016109b6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051612b079190613d75565b600060405180830381855af49150503d8060008114612b42576040519150601f19603f3d011682016040523d82523d6000602084013e612b47565b606091505b509150915061295e858383612c6a565b341561193c576040517fb398979f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006106d0612b9d83612cdf565b80519060200120612dfc565b600080600080612bb98686612e44565b925092509250612bc98282612e91565b5090949350505050565b6001600160a01b038216612c16576040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600060048201526024016109b6565b6000612c2483836000611797565b90506001600160a01b03811615610edb576040517f73c6ac6e000000000000000000000000000000000000000000000000000000008152600060048201526024016109b6565b606082612c7f57612c7a82612f95565b611909565b8151158015612c9657506001600160a01b0384163b155b15612cd8576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016109b6565b5080611909565b60607f7b49e75f5dee25184e7fc560a05a02fa4311f0290980e85c2f8d7733b7fd3aba823560208401356040850135612d1d608087018787016138f1565b612d32612d2d6080890189613d10565b612fd7565b612d42612d2d60a08a018a613d10565b612d52612d2d60c08b018b613d10565b612d67612d6260e08c018c613e70565b612ff9565b612d7d612d786101008d018d6140b3565b6130d5565b612d8a8c61012001613174565b60408051602081019c909c528b019990995260608a019790975260808901959095526001600160a01b0390931660a088015260c087019190915260e0860152610100850152610120840152610140830152610160820152610180015b6040516020818303038152906040529050919050565b60006106d0612e096131f5565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60008060008351604103612e7e5760208401516040850151606086015160001a612e7088828585613204565b955095509550505050612e8a565b50508151600091506002905b9250925092565b6000826003811115612ea557612ea5613d87565b03612eae575050565b6001826003811115612ec257612ec2613d87565b03612ef9576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002826003811115612f0d57612f0d613d87565b03612f47576040517ffce698f7000000000000000000000000000000000000000000000000000000008152600481018290526024016109b6565b6003826003811115612f5b57612f5b613d87565b036107df576040517fd78bce0c000000000000000000000000000000000000000000000000000000008152600481018290526024016109b6565b805115612fa55780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008282604051612fe992919061437c565b6040518091039020905092915050565b6000808267ffffffffffffffff811115613015576130156136e9565b60405190808252806020026020018201604052801561303e578160200160208202803683370190505b50905060005b838110156130a45761307885858381811061306157613061613c61565b90506020028101906130739190613ed8565b6132d3565b8051906020012082828151811061309157613091613c61565b6020908102919091010152600101613044565b50806040516020016130b6919061438c565b6040516020818303038152906040528051906020012091505092915050565b6000808267ffffffffffffffff8111156130f1576130f16136e9565b60405190808252806020026020018201604052801561311a578160200160208202803683370190505b50905060005b838110156130a45761314885858381811061313d5761313d613c61565b905060400201613332565b8051906020012082828151811061316157613161613c61565b6020908102919091010152600101613120565b60007fbb5588251ed87f59437bd9a89dd0ef74f88c736ab95bdcd74955ff21bcf35e796131a460208401846138f1565b6020840135604085013560608601356131c360a0880160808901614148565b6040516020016131d8969594939291906143c2565b604051602081830303815290604052805190602001209050919050565b60006131ff6133a2565b905090565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561323f57506000915060039050826132c9565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015613293573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166132bf575060009250600191508290506132c9565b9250600091508190505b9450945094915050565b60607f93dc1bac6b117acdbb889b9a825b9bc731449f703cc02b69049722fcba5dbe34613303612d2d8480613d10565b613313612d2d6020860186613d10565b6040805160208101949094528301919091526060820152608001612de6565b60607fdf3d1189f68f42c28f9fad9d69ff7a974d0a800a2e4420ed400e45a46d2fac2f61336260208401846138f1565b613372604085016020860161420a565b604051602001612de6939291909283526001600160a01b0391909116602083015261ffff16604082015260600190565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6133cd613416565b6133d5613492565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60007fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10081613442611d2d565b80519091501561345a57805160209091012092915050565b81548015613469579392505050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470935050505090565b60007fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100816134be611d7e565b8051909150156134d657805160209091012092915050565b60018201548015613469579392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114611a2757600080fd5b60006020828403121561352857600080fd5b8135611909816134e8565b60005b8381101561354e578181015183820152602001613536565b50506000910152565b6000815180845261356f816020860160208601613533565b601f01601f19169290920160200192915050565b6020815260006119096020830184613557565b6000602082840312156135a857600080fd5b5035919050565b80356001600160a01b03811681146135c657600080fd5b919050565b600080604083850312156135de57600080fd5b6135e7836135af565b946020939093013593505050565b60008083601f84011261360757600080fd5b50813567ffffffffffffffff81111561361f57600080fd5b6020830191508360208260051b850101111561363a57600080fd5b9250929050565b6000806000806040858703121561365757600080fd5b843567ffffffffffffffff8082111561366f57600080fd5b61367b888389016135f5565b9096509450602087013591508082111561369457600080fd5b506136a1878288016135f5565b95989497509550505050565b6000806000606084860312156136c257600080fd5b6136cb846135af565b92506136d9602085016135af565b9150604084013590509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613741576137416136e9565b604052919050565b600082601f83011261375a57600080fd5b813567ffffffffffffffff811115613774576137746136e9565b6137876020601f19601f84011601613718565b81815284602083860101111561379c57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156137d157600080fd5b853567ffffffffffffffff808211156137e957600080fd5b6137f589838a01613749565b9650602088013591508082111561380b57600080fd5b61381789838a01613749565b9550604088013591508082111561382d57600080fd5b61383989838a01613749565b9450606088013591508082111561384f57600080fd5b5061385c88828901613749565b92505061386b608087016135af565b90509295509295909350565b6000806040838503121561388a57600080fd5b8235915061389a602084016135af565b90509250929050565b600080604083850312156138b657600080fd5b6138bf836135af565b9150602083013567ffffffffffffffff8111156138db57600080fd5b6138e785828601613749565b9150509250929050565b60006020828403121561390357600080fd5b611909826135af565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e08184015261394860e084018a613557565b838103604085015261395a818a613557565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156139ac57835183529284019291840191600101613990565b50909c9b505050505050505050505050565b803580151581146135c657600080fd5b600080604083850312156139e157600080fd5b6139ea836135af565b915061389a602084016139be565b600060208284031215613a0a57600080fd5b611909826139be565b60008060008060808587031215613a2957600080fd5b613a32856135af565b9350613a40602086016135af565b925060408501359150606085013567ffffffffffffffff811115613a6357600080fd5b613a6f87828801613749565b91505092959194509250565b60008060408385031215613a8e57600080fd5b613a97836135af565b915061389a602084016135af565b600082601f830112613ab657600080fd5b8135602067ffffffffffffffff80831115613ad357613ad36136e9565b8260051b613ae2838201613718565b9384528581018301938381019088861115613afc57600080fd5b84880192505b85831015613b3857823584811115613b1a5760008081fd5b613b288a87838c0101613749565b8352509184019190840190613b02565b98975050505050505050565b8035600281106135c657600080fd5b60008060008060008060c08789031215613b6c57600080fd5b86359550602087013567ffffffffffffffff80821115613b8b57600080fd5b613b978a838b01613aa5565b96506040890135915080821115613bad57600080fd5b613bb98a838b01613749565b95506060890135915060038210613bcf57600080fd5b819450613bde60808a01613b44565b935060a0890135915080821115613bf457600080fd5b50613c0189828a01613aa5565b9150509295509295509295565b600181811c90821680613c2257607f821691505b602082108103613c5b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe41833603018112613cc457600080fd5b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156106d0576106d0613cce565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613d4557600080fd5b83018035915067ffffffffffffffff821115613d6057600080fd5b60200191503681900382131561363a57600080fd5b60008251613cc4818460208701613533565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600081518084526020808501808196508360051b8101915082860160005b85811015613dfe578284038952613dec848351613557565b98850198935090840190600101613dd4565b5091979650505050505050565b600060028710613e1d57613e1d613d87565b86825260038610613e3057613e30613d87565b85602083015260a06040830152613e4a60a0830186613557565b8281036060840152613e5c8186613db6565b90508281036080840152613b388185613db6565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613ea557600080fd5b83018035915067ffffffffffffffff821115613ec057600080fd5b6020019150600581901b360382131561363a57600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112613cc457600080fd5b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b604081526000613f4b604083018688613f0c565b8281036020840152613f5e818587613f0c565b979650505050505050565b601f821115610edb57600081815260208120601f850160051c81016020861015613f905750805b601f850160051c820191505b81811015613faf57828155600101613f9c565b505050505050565b67ffffffffffffffff831115613fcf57613fcf6136e9565b613fe383613fdd8354613c0e565b83613f69565b6000601f8411600181146140355760008515613fff5750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355612049565b600083815260209020601f19861690835b828110156140665786850135825560209485019460019092019101614046565b50868210156140a1577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126140e857600080fd5b83018035915067ffffffffffffffff82111561410357600080fd5b6020019150600681901b360382131561363a57600080fd5b858152606060208201526000614135606083018688613f0c565b8281036040840152613b38818587613f0c565b60006020828403121561415a57600080fd5b81356004811061190957600080fd5b6004811061417957614179613d87565b9052565b8381526020810183905260608101612a3a6040830184614169565b6000602082840312156141aa57600080fd5b5051919050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526141e36080830184613557565b9695505050505050565b6000602082840312156141ff57600080fd5b8151611909816134e8565b60006020828403121561421c57600080fd5b813561ffff8116811461190957600080fd5b80820281158282048414176106d0576106d0613cce565b60008261427b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b815167ffffffffffffffff81111561429a5761429a6136e9565b6142ae816142a88454613c0e565b84613f69565b602080601f83116001811461430157600084156142cb5750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555613faf565b600085815260208120601f198616915b8281101561433057888601518255948401946001909101908401614311565b508582101561436c57878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8183823760009101908152919050565b815160009082906020808601845b838110156143b65781518552938201939082019060010161439a565b50929695505050505050565b600060c0820190508782526001600160a01b0387166020830152856040830152846060830152836080830152613f5e60a083018461416956fea264697066735822122050f641170bcadb20f92227e3bf79fc7af39a92312fb3615550db581ff0e20f1564736f6c63430008140033
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.