Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
FairXYZDeployer
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 140 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
// @author: Fair.xyz dev
pragma solidity 0.8.17;
import "./ERC721xyzUpgradeable.sol";
import "./FairXYZDeployerErrorsAndEvents.sol";
import "../interfaces/IFairXYZWallets.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol";
import {ICreatorToken} from "../../common/interfaces/ICreatorToken.sol";
import {ICreatorTokenLegacy} from "../../common/interfaces/ICreatorTokenLegacy.sol";
import {ITransferValidator} from "../../common/interfaces/ITransferValidator.sol";
import {ITransferValidatorSetTokenType} from "../../common/interfaces/ITransferValidatorSetTokenType.sol";
contract FairXYZDeployer is
ERC721xyzUpgradeable,
AccessControlUpgradeable,
MulticallUpgradeable,
ReentrancyGuardUpgradeable,
OwnableUpgradeable,
FairXYZDeployerErrorsAndEvents,
ICreatorToken
{
using ECDSAUpgradeable for bytes32;
using StringsUpgradeable for uint256;
struct TokensAvailableToMint {
/// @dev Max number of tokens on sale across the whole collection
uint128 maxTokens;
/// @dev The creator can enforce a max mints per wallet at a global level, i.e. across all stages
uint128 globalMintsPerWallet;
}
TokensAvailableToMint public tokensAvailable;
/// @dev URI information
string internal baseURI;
string internal pathURI;
string internal preRevealURI;
string internal _overrideURI;
bool public lockURI;
/// @dev Bool to allow signature-less minting, in case the seller/creator wants to liberate themselves
// from being bound to a signature generated on the Fair.xyz back-end
bool public signatureReleased;
/// @dev Interface into FairXYZWallets. This provides the wallet address to which the Fair.xyz fee is sent to
address public interfaceAddress;
/// @dev Burnable token bool
bool public burnable;
/// @dev Sale information - this tells the contract where the proceeds from the primary sale should go to
address internal _primarySaleReceiver;
/// @dev Tightly pack the parameters that define a sale stage
struct StageData {
uint40 startTime;
uint40 endTime;
uint32 mintsPerWallet;
uint32 phaseLimit;
uint112 price;
bytes32 merkleRoot;
}
/// @dev Mapping a stage ID to its corresponding StageData struct
mapping(uint256 => StageData) internal stageMap;
/// @dev Mapping to keep track of the number of mints a given wallet has done on a specific stage
mapping(uint256 => mapping(address => uint256)) public stageMints;
/// @dev Total number of sale stages
uint256 public totalStages;
/// @dev Pre-defined roles for AccessControl
bytes32 public constant SECOND_ADMIN_ROLE = keccak256("T2A");
bytes32 public constant MINTER_ROLE = keccak256("MINTER");
uint256 internal constant stageLengthLimit = 20;
uint256 constant FairxyzMintFee = 0.00087 ether;
/// @dev Fair.xyz fee recipient address
address internal constant FairxyzReceiverAddress =
0x1075266C86Cd9b1B021Af63e09102AF3D2DCBDb7;
/// @dev Fair.xyz address required for verifying signatures in the contract
address internal constant FairxyzSignerAddress =
0x7A6F5866f97034Bb7153829bdAaC1FFCb8Facb71;
/// @dev EIP-712 signatures
bytes32 constant EIP712_NAME_HASH = keccak256("Fair.xyz");
bytes32 constant EIP712_VERSION_HASH = keccak256("1.0.0");
bytes32 constant EIP712_DOMAIN_TYPE_HASH =
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
bytes32 constant EIP712_MINT_TYPE_HASH =
keccak256(
"Mint(address recipient,uint256 quantity,uint256 nonce,uint256 maxMintsPerWallet)"
);
bytes32 constant EIP712_URICHANGE_TYPE_HASH =
keccak256("URIChange(address sender,string newPathURI,string newURI)");
event NewStagesSet(StageData[] stages, uint256 startIndex);
/// @dev Thrown when setting a transfer validator address that has no deployed code.
error CreatorTokenBase__InvalidTransferValidatorContract();
/// @dev The default transfer validator that will be used when first enabled.
address private constant DEFAULT_TRANSFER_VALIDATOR =
address(0x721C002B0059009a671D00aD1700c9748146cd1B);
/// @dev Address of the transfer validator to apply to transactions.
address private transferValidator;
/// @dev Address of an optional custom transfer validator implemented by the creator.
address public customTransferValidator;
/// @dev Mapping to track if a token is locked by the custom transfer validator.
/// @dev It is not intended to be used in this contract for anything other than emitting suitable events.
mapping(uint256 => bool) private _tokenLockedByCustomValidator;
/*///////////////////////////////////////////////////////////////
Initialisation
//////////////////////////////////////////////////////////////*/
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/**
* @dev Initialise a new Creator contract by setting variables and initialising
* inherited contracts
*/
function _initialize(
uint128 maxTokens_,
string memory name_,
string memory symbol_,
address interfaceAddress_,
string[] memory URIs_,
uint96 royaltyPercentage_,
uint128 globalMintsPerWallet_,
address[] memory royaltyReceivers,
address ownerOfContract,
StageData[] calldata stages,
bool isSBT
) external initializer {
if (interfaceAddress_ == address(0)) revert ZeroAddress();
require(URIs_.length == 3);
require(royaltyReceivers.length == 2);
__ERC721_init(name_, symbol_);
__AccessControl_init();
__Multicall_init();
_transferOwnership(ownerOfContract);
tokensAvailable = TokensAvailableToMint(
maxTokens_,
globalMintsPerWallet_
);
interfaceAddress = interfaceAddress_;
preRevealURI = URIs_[0];
baseURI = URIs_[1];
pathURI = URIs_[2];
isSoulBound = isSBT;
_primarySaleReceiver = royaltyReceivers[0];
_setDefaultRoyalty(royaltyReceivers[1], royaltyPercentage_);
_grantRole(DEFAULT_ADMIN_ROLE, ownerOfContract);
_grantRole(SECOND_ADMIN_ROLE, ownerOfContract);
if (stages.length > 0) {
_setStages(stages, 0);
}
_setTransferValidator(DEFAULT_TRANSFER_VALIDATOR);
}
/*///////////////////////////////////////////////////////////////
Sale stages logic
//////////////////////////////////////////////////////////////*/
/**
* @dev View sale parameters corresponding to a given stage
*/
function viewStageMap(
uint256 stageId
) external view returns (StageData memory) {
if (stageId >= totalStages) revert StageDoesNotExist();
return stageMap[stageId];
}
/**
* @dev View the current active sale stage for a sale based on being within the
* time bounds for the start time and end time for the considered stage
*/
function viewCurrentStage() public view returns (uint256) {
for (uint256 i = totalStages; i > 0; ) {
unchecked {
--i;
}
if (
block.timestamp >= stageMap[i].startTime &&
block.timestamp <= stageMap[i].endTime
) {
return i;
}
}
revert SaleNotActive();
}
/**
* @dev Get the price for the current active sale stage
* reverts if there is no current active stage
*/
function viewCurrentPrice() public view returns (uint256) {
return stageMap[viewCurrentStage()].price + FairxyzMintFee;
}
/**
* @dev Returns the earliest stage which has not closed yet
*/
function viewLatestStage() public view returns (uint256) {
for (uint256 i = totalStages; i > 0; ) {
unchecked {
--i;
}
if (block.timestamp > stageMap[i].endTime) {
return i + 1;
}
}
return 0;
}
/**
* @dev See _setStages
*/
function setStages(StageData[] calldata stages, uint256 startId) external {
if (!hasRole(SECOND_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
_setStages(stages, startId);
}
/**
* @dev Set the parameters for a list of sale stages, starting from startId onwards
*/
function _setStages(
StageData[] calldata stages,
uint256 startId
) internal returns (uint256) {
uint256 stagesLength = stages.length;
uint256 latestStage = viewLatestStage();
// Cannot set more than the stage length limit stages per transaction
if (stagesLength > stageLengthLimit) revert StageLimitPerTx();
uint256 currentTotalStages = totalStages;
// Check that the stage the user is overriding from onwards is not a closed stage
if (currentTotalStages > 0 && startId < latestStage)
revert CannotEditPastStages();
// The startId cannot be an arbitrary number, it must follow a sequential order based on the current number of stages
if (startId > currentTotalStages) revert IncorrectIndex();
// There can be no more than 20 sale stages (stageLengthLimit) between the most recent active stage and the last possible stage
if (startId + stagesLength > latestStage + stageLengthLimit)
revert TooManyStagesInTheFuture();
uint256 initialStageStartTime = stageMap[startId].startTime;
// In order to delete a stage, calldata of length 0 must be provided. The stage referenced by the startIndex
// and all stages after that will no longer be considered for the drop
if (stagesLength == 0) {
// The stage cannot have started at any point for it to be deleted
if (initialStageStartTime <= block.timestamp)
revert CannotDeleteOngoingStage();
// The new length of total stages is startId, as everything from there onwards is now disregarded
totalStages = startId;
emit NewStagesSet(stages, startId);
return startId;
}
StageData memory newStage = stages[0];
if (newStage.phaseLimit < _mintedTokens)
revert TokenCountExceedsPhaseLimit();
if (
initialStageStartTime <= block.timestamp &&
initialStageStartTime != 0 &&
startId < totalStages
) {
// If the start time of the stage being replaced is in the past and exists
// the new stage start time must match it
if (initialStageStartTime != newStage.startTime)
revert InvalidStartTime();
// The end time for a stage cannot be in the past
if (newStage.endTime <= block.timestamp) revert EndTimeInThePast();
} else {
// the start time of the stage being replaced is in the future or doesn't exist
// the new stage start time can't be in the past
if (newStage.startTime <= block.timestamp)
revert StartTimeInThePast();
}
unchecked {
uint256 i = startId;
uint256 stageCount = startId + stagesLength;
do {
if (i != startId) {
newStage = stages[i - startId];
}
// The number of tokens the user can mint up to in a stage cannot exceed the total supply available
if (newStage.phaseLimit > tokensAvailable.maxTokens)
revert PhaseLimitExceedsTokenCount();
// The end time cannot be less than the start time for a sale
if (newStage.endTime <= newStage.startTime)
revert EndTimeLessThanStartTime();
if (i > 0) {
uint256 previousStageEndTime = stageMap[i - 1].endTime;
// The number of total NFTs on sale cannot decrease below the total for a stage which has not ended
if (newStage.phaseLimit < stageMap[i - 1].phaseLimit) {
if (previousStageEndTime >= block.timestamp)
revert LessNFTsOnSaleThanBefore();
}
// A sale can only start after the previous one has closed
if (newStage.startTime <= previousStageEndTime)
revert PhaseStartsBeforePriorPhaseEnd();
}
// Update the variables in a given stage's stageMap with the correct indexing within the stages function input
stageMap[i] = newStage;
++i;
} while (i < stageCount);
// The total number of stages is updated to be the startId + the length of stages added from there onwards
totalStages = stageCount;
emit NewStagesSet(stages, startId);
return stageCount;
}
}
/*///////////////////////////////////////////////////////////////
Sale proceeds & royalties
//////////////////////////////////////////////////////////////*/
/**
* @dev Override primary sale receiver
*/
function changePrimarySaleReceiver(
address newPrimarySaleReceiver
) external {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
if (newPrimarySaleReceiver == address(0)) revert ZeroAddress();
_primarySaleReceiver = newPrimarySaleReceiver;
emit NewPrimarySaleReceiver(_primarySaleReceiver);
}
/**
* @dev Override secondary royalty receiver and royalty percentage fee
*/
function changeSecondaryRoyaltyReceiver(
address newSecondaryRoyaltyReceiver,
uint96 newRoyaltyValue
) external {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
_setDefaultRoyalty(newSecondaryRoyaltyReceiver, newRoyaltyValue);
emit NewSecondaryRoyalties(
newSecondaryRoyaltyReceiver,
newRoyaltyValue
);
}
/**
* @dev Transfers the contract balance to the primary sale receiver
*/
function withdraw() external payable onlyRole(DEFAULT_ADMIN_ROLE) {
(bool sent_, ) = _primarySaleReceiver.call{
value: address(this).balance
}("");
if (!sent_) revert ETHSendFail();
}
/*///////////////////////////////////////////////////////////////
Token metadata
//////////////////////////////////////////////////////////////*/
/**
* @dev Return the Base URI, used when there is no expected reveal experience
*/
function _baseURI() public view returns (string memory) {
return baseURI;
}
/**
* @dev Return the path URI - used for reveal experience
*/
function _pathURI() public view returns (string memory) {
if (bytes(_overrideURI).length == 0) {
return IFairXYZWallets(interfaceAddress).viewPathURI(pathURI);
} else {
return _overrideURI;
}
}
/**
* @dev Return the pre-reveal URI, which is used when there is a reveal experience
* and the reveal metadata has not been set yet.
*/
function _preRevealURI() public view returns (string memory) {
return preRevealURI;
}
/**
* @dev Combines path URI, base URI and pre-reveal URI for the full metadata journey on Fair.xyz
*/
function tokenURI(
uint256 tokenId
) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert TokenDoesNotExist();
string memory pathURI_ = _pathURI();
string memory baseURI_ = _baseURI();
string memory preRevealURI_ = _preRevealURI();
if (bytes(pathURI_).length == 0) {
return preRevealURI_;
} else {
return
string(
abi.encodePacked(pathURI_, baseURI_, tokenId.toString())
);
}
}
/**
* @dev Lock the token metadata forever. This action is non reversible.
*/
function lockURIforever() external {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
if (lockURI) revert AlreadyLockedURI();
lockURI = true;
emit URILocked();
}
/**
* @dev Hash the variables to be modified for URI changes.
*/
function hashURIChange(
address sender,
string memory newPathURI,
string memory newURI
) private view returns (bytes32) {
bytes32 digest = _hashTypedDataV4(
keccak256(
abi.encode(
EIP712_URICHANGE_TYPE_HASH,
sender,
keccak256(bytes(newPathURI)),
keccak256(bytes(newURI))
)
)
);
return digest;
}
/**
* @dev Change values for the URIs. New Path URI implies a new reveal date being used.
* newURI acts as an override for all priorly defined URIs). If lockURI() has been
* executed, then this function will fail, as the data will have been locked forever.
*/
function changeURI(
bytes memory signature,
string memory newPathURI,
string memory newURI
) external {
if (!hasRole(SECOND_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
// URI cannot be modified if it has been locked
if (lockURI) revert AlreadyLockedURI();
bytes32 messageHash = hashURIChange(msg.sender, newPathURI, newURI);
if (messageHash.recover(signature) != FairxyzSignerAddress)
revert UnrecognizableHash();
if (bytes(newPathURI).length != 0) {
pathURI = newPathURI;
emit NewPathURI(pathURI);
}
if (bytes(newURI).length != 0) {
_overrideURI = newURI;
baseURI = "";
emit NewTokenURI(_overrideURI);
}
}
/*///////////////////////////////////////////////////////////////
Burning
//////////////////////////////////////////////////////////////*/
/**
* @dev Toggle the burn state for NFTs in the contract
*/
function toggleBurnable() external {
if (!hasRole(SECOND_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
burnable = !burnable;
emit BurnableSet(burnable);
}
/**
* @dev Burn a token. Requires being an approved operator or the owner of an NFT
*/
function burn(uint256 tokenId) external returns (uint256) {
if (!burnable) revert BurningOff();
if (
!(isApprovedForAll(ownerOf(tokenId), msg.sender) ||
msg.sender == ownerOf(tokenId) ||
getApproved(tokenId) == msg.sender)
) revert BurnerIsNotApproved();
_burn(tokenId);
return tokenId;
}
/*///////////////////////////////////////////////////////////////
Minting + airdrop logic
//////////////////////////////////////////////////////////////*/
/**
* @dev Set global max mints per wallet
*/
function setGlobalMaxMints(uint128 newGlobalMaxMintsPerWallet) external {
if (!hasRole(SECOND_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
tokensAvailable.globalMintsPerWallet = newGlobalMaxMintsPerWallet;
emit NewMaxMintsPerWalletSet(newGlobalMaxMintsPerWallet);
}
/**
* @dev Allow for signature-less minting on public sales
*/
function releaseSignature() external {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
require(!signatureReleased);
signatureReleased = true;
emit SignatureReleased();
}
/**
* @dev Hash transaction data for minting
*/
function hashMintParams(
address recipient,
uint256 quantity,
uint256 nonce,
uint256 maxMintsPerWallet
) private view returns (bytes32) {
bytes32 digest = _hashTypedDataV4(
keccak256(
abi.encode(
EIP712_MINT_TYPE_HASH,
recipient,
quantity,
nonce,
maxMintsPerWallet
)
)
);
return digest;
}
/**
* @dev Handle excess NFTs being minted in a transaction based on the different stage and sale limits
*/
function handleReimbursement(
address recipient,
uint256 presentStage,
uint256 numberOfTokens,
uint256 currentMintedTokens,
StageData memory dropData,
uint256 maxMintsPerWallet
) internal returns (uint256) {
// Load the total number of NFTs the user has minted across all stages
uint256 mintsPerWallet = uint256(mintData[recipient].mintsPerWallet);
// Load the number of NFTs the user has minted solely on the active stage
uint256 stageMintsPerWallet = stageMints[presentStage][recipient];
unchecked {
// A value of 0 means there is no limit as to how many mints a wallet can do in this stage
if (dropData.mintsPerWallet > 0) {
// Check that the user has not reached the minting limit per wallet for this stage
if (stageMintsPerWallet >= dropData.mintsPerWallet)
revert ExceedsMintsPerWallet();
// Cap the number of tokens the user can mint so that it does not exceed the limit
// per wallet for this stage
if (
stageMintsPerWallet + numberOfTokens >
dropData.mintsPerWallet
) {
numberOfTokens =
dropData.mintsPerWallet -
stageMintsPerWallet;
}
}
uint256 _globalMintsPerWallet = tokensAvailable
.globalMintsPerWallet;
// A value of 0 means there is no limit as to how many mints a wallet can do across all stages
if (_globalMintsPerWallet > 0) {
// Check that the user has not reached the minting limit per wallet across the whole contract
if (mintsPerWallet >= _globalMintsPerWallet)
revert ExceedsMintsPerWallet();
// Cap the number of tokens the user can mint so that it does not exceed the minting limit
// per wallet across the whole contract
if (mintsPerWallet + numberOfTokens > _globalMintsPerWallet) {
numberOfTokens = _globalMintsPerWallet - mintsPerWallet;
}
}
// Cap the number of tokens the user can mint so that it does not exceed the minting limit
// of tokens on sale for this stage
if (currentMintedTokens + numberOfTokens > dropData.phaseLimit) {
numberOfTokens = dropData.phaseLimit - currentMintedTokens;
}
// A value of 0 means there is no limit as to how many mints a wallet has been authorised to mint.
// This form of mint authorisation is managed through pre-generated signatures - if the contract has
// been released from signature minting then this check is omitted
if (maxMintsPerWallet > 0 && !signatureReleased) {
// Check that the user has not reached the minting limit per wallet they have been allowlisted for
if (stageMintsPerWallet >= maxMintsPerWallet)
revert ExceedsMintsPerWallet();
// Cap the number of tokens the user can mint so that it does not exceed the limit
// of mints the wallet has been allowlisted for
if (stageMintsPerWallet + numberOfTokens > maxMintsPerWallet) {
numberOfTokens = maxMintsPerWallet - stageMintsPerWallet;
}
}
// Update the total number mints the recipient has done for this stage
stageMintsPerWallet += numberOfTokens;
stageMints[presentStage][recipient] = stageMintsPerWallet;
return (numberOfTokens);
}
}
/**
* @dev Mint token(s) for public sales
*/
function mint(
bytes memory signature,
uint256 nonce,
uint256 numberOfTokens,
uint256 maxMintsPerWallet,
address recipient
) external payable {
// At least 1 and no more than 20 tokens can be minted per transaction
if (!((0 < numberOfTokens) && (numberOfTokens <= 20)))
revert TokenLimitPerTx();
// Check the active stage - reverts if no stage is active
uint256 presentStage = viewCurrentStage();
// Load the minting parameters for this stage
StageData memory dropData = stageMap[presentStage];
// Check that enough ETH is sent for the minting quantity
uint256 costPerToken = dropData.price + FairxyzMintFee;
if (msg.value != costPerToken * numberOfTokens) revert NotEnoughETH();
// Nonce = 0 is reserved for airdrop mints, to distinguish them from other mints in the
// _mint function on ERC721xyzUpgradeable
if (nonce == 0) revert InvalidNonce();
uint256 currentMintedTokens = _mintedTokens;
// The number of minted tokens cannot exceed the number of NFTs on sale for this stage
if (currentMintedTokens >= dropData.phaseLimit) revert PhaseLimitEnd();
// If a Merkle Root is defined for the stage, then this is an allowlist stage. Thus the function merkleMint
// must be used instead
if (dropData.merkleRoot != bytes32(0)) revert MerkleStage();
// If the contract is released from signature minting, skips this signature verification
if (!signatureReleased) {
// Hash the variables
bytes32 messageHash = hashMintParams(
recipient,
numberOfTokens,
nonce,
maxMintsPerWallet
);
// Ensure the recovered address from the signature is the Fair.xyz signer address
if (messageHash.recover(signature) != FairxyzSignerAddress)
revert UnrecognizableHash();
// mintData[recipient].blockNumber is the last block (nonce) that was used to mint from the given address.
// Nonces can only increase in number in each transaction, and are part of the signature. This ensures
// that past signatures are not reused
if (mintData[recipient].blockNumber >= nonce) revert ReusedHash();
// Set a time limit of 75 blocks for the signature
if (block.number > nonce + 75) revert TimeLimit();
}
uint256 adjustedNumberOfTokens = handleReimbursement(
recipient,
presentStage,
numberOfTokens,
currentMintedTokens,
dropData,
maxMintsPerWallet
);
// Mint the NFTs
_safeMint(recipient, adjustedNumberOfTokens, nonce);
(bool feeSent, ) = FairxyzReceiverAddress.call{
value: (FairxyzMintFee * adjustedNumberOfTokens)
}("");
if (!feeSent) revert ETHSendFail();
// If the value for numberOfTokens is less than the origMintCount, then there is reimbursement
// to be done
if (adjustedNumberOfTokens < numberOfTokens) {
uint256 reimbursementPrice = (numberOfTokens -
adjustedNumberOfTokens) * costPerToken;
(bool sent, ) = msg.sender.call{value: reimbursementPrice}("");
if (!sent) revert ETHSendFail();
}
emit Mint(recipient, presentStage, adjustedNumberOfTokens);
}
/**
* @notice Verify merkle proof for address and address minting limit
*/
function verifyMerkleAddress(
bytes32[] calldata merkleProof,
bytes32 _merkleRoot,
address minterAddress,
uint256 walletLimit
) private pure returns (bool) {
return
MerkleProofUpgradeable.verify(
merkleProof,
_merkleRoot,
keccak256(abi.encodePacked(minterAddress, walletLimit))
);
}
/**
* @dev Mint token(s) for allowlist sales
*/
function merkleMint(
bytes32[] calldata _merkleProof,
uint256 numberOfTokens,
uint256 maxMintsPerWallet,
address recipient
) external payable {
// At least 1 and no more than 20 tokens can be minted per transaction
if (!((0 < numberOfTokens) && (numberOfTokens <= 20)))
revert TokenLimitPerTx();
// Check the active stage - reverts if no stage is active
uint256 presentStage = viewCurrentStage();
// Load the minting parameters for this stage
StageData memory dropData = stageMap[presentStage];
// Check that enough ETH is sent for the minting quantity
uint256 costPerToken = dropData.price + FairxyzMintFee;
if (msg.value != costPerToken * numberOfTokens) revert NotEnoughETH();
// If a Merkle Root is not defined for the stage, then this is an public sale stage. Thus the function mint()
// must be used instead
if (dropData.merkleRoot == bytes32(0)) revert PublicStage();
uint256 currentMintedTokens = _mintedTokens;
// The number of minted tokens cannot exceed the number of NFTs on sale for this stage
if (currentMintedTokens >= dropData.phaseLimit) revert PhaseLimitEnd();
// Verify the Merkle Proof for the recipient address and the maximum number of mints the wallet has been assigned
// on the allowlist
if (
!(
verifyMerkleAddress(
_merkleProof,
dropData.merkleRoot,
recipient,
maxMintsPerWallet
)
)
) revert MerkleProofFail();
uint256 adjustedNumberOfTokens = handleReimbursement(
recipient,
presentStage,
numberOfTokens,
currentMintedTokens,
dropData,
maxMintsPerWallet
);
// Mint NFTs
_safeMint(recipient, adjustedNumberOfTokens, block.number);
(bool feeSent, ) = FairxyzReceiverAddress.call{
value: (FairxyzMintFee * adjustedNumberOfTokens)
}("");
if (!feeSent) revert ETHSendFail();
// If the value for numberOfTokens is less than the origMintCount, then there is reimbursement
// to be done
if (adjustedNumberOfTokens < numberOfTokens) {
uint256 reimbursementPrice = (numberOfTokens -
adjustedNumberOfTokens) * costPerToken;
(bool sent, ) = msg.sender.call{value: reimbursementPrice}("");
if (!sent) revert ETHSendFail();
}
emit Mint(recipient, presentStage, adjustedNumberOfTokens);
}
/**
* @dev See the total mints across all stages for a wallet
*/
function totalWalletMints(
address minterAddress
) external view returns (uint256) {
return mintData[minterAddress].mintsPerWallet;
}
/**
* @dev Airdrop tokens to a list of addresses
*/
function airdrop(
address[] memory address_,
uint256 tokenCount
) external returns (uint256) {
if (tokenCount > 20) revert TokenLimitPerTx();
if (tokenCount == 0) revert TokenLimitPerTx();
if (address_.length > 20) revert AddressLimitPerTx();
if (address_.length == 0) revert AddressLimitPerTx();
if (
!hasRole(SECOND_ADMIN_ROLE, msg.sender) &&
!hasRole(MINTER_ROLE, msg.sender)
) revert UnauthorisedUser();
uint256 newTotal = _mintedTokens + address_.length * tokenCount;
unchecked {
if (newTotal > tokensAvailable.maxTokens)
revert ExceedsNFTsOnSale();
for (uint256 i; i < address_.length; ) {
_safeMint(address_[i], tokenCount, 0);
++i;
}
emit Airdrop(tokenCount, newTotal, address_);
return newTotal;
}
}
/*///////////////////////////////////////////////////////////////
Miscellanous
//////////////////////////////////////////////////////////////*/
function supportsInterface(
bytes4 interfaceId
)
public
view
virtual
override(AccessControlUpgradeable, ERC721xyzUpgradeable)
returns (bool)
{
return
interfaceId == type(ICreatorToken).interfaceId ||
interfaceId == type(ICreatorTokenLegacy).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @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.
*/
function _hashTypedDataV4(
bytes32 structHash
) internal view virtual returns (bytes32) {
bytes32 domainSeparator = keccak256(
abi.encode(
EIP712_DOMAIN_TYPE_HASH,
EIP712_NAME_HASH,
EIP712_VERSION_HASH,
block.chainid,
address(this)
)
);
return ECDSAUpgradeable.toTypedDataHash(domainSeparator, structHash);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal view override {
// If the token is being transferred to or from the zero address, do nothing
if (from == address(0) || to == address(0)) {
return;
}
// If the token is soulbound, revert
if (isSoulBound) revert TokenIsSoulBound();
address customValidator = customTransferValidator;
address validator = transferValidator;
address operator = msg.sender;
// If a custom transfer validator is set, validate the transfer
if (customValidator != address(0)) {
if (operator != customValidator) {
ITransferValidator(customValidator).validateTransfer(
operator,
from,
to,
tokenId
);
}
}
// If a default transfer validator is set, validate the transfer
if (validator != address(0)) {
if (operator != validator) {
ITransferValidator(validator).validateTransfer(
operator,
from,
to,
tokenId
);
}
}
}
function _afterTokenTransfer(
address,
address,
uint256 tokenId
) internal override {
// If the token is locked by the custom transfer validator, unlock it and emit the Unlocked event
if (_tokenLockedByCustomValidator[tokenId]) {
_tokenLockedByCustomValidator[tokenId] = false;
emit Unlocked(tokenId);
}
}
// * ERC721C * //
/**
* @notice Sets the transfer validator for the token contract.
*
* @dev Throws when provided validator contract is not the zero address and does not have code.
* @dev Throws when the caller is not the contract owner.
*
* @dev <h4>Postconditions:</h4>
* 1. The transferValidator address is updated.
* 2. The `TransferValidatorUpdated` event is emitted.
*
* @param transferValidator_ The address of the transfer validator contract.
*/
function setTransferValidator(address transferValidator_) public {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
_setTransferValidator(transferValidator_);
}
/**
* @notice Sets the custom transfer validator for the token contract.
* @param customTransferValidator_ The address of the custom transfer validator to set.
*/
function setCustomTransferValidator(
address customTransferValidator_
) public {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
emit CustomTransferValidatorUpdated(
customTransferValidator,
customTransferValidator_
);
customTransferValidator = customTransferValidator_;
}
/**
* @notice Sets the transfer validator for the token contract.
* @dev Throws if the transfer validator is not a valid contract.
* @param transferValidator_ The address of the transfer validator to set.
*/
function _setTransferValidator(address transferValidator_) internal {
bool isValidTransferValidator = transferValidator_.code.length > 0;
if (transferValidator_ != address(0) && !isValidTransferValidator) {
revert CreatorTokenBase__InvalidTransferValidatorContract();
}
emit TransferValidatorUpdated(transferValidator, transferValidator_);
transferValidator = transferValidator_;
_registerTokenType(transferValidator_);
}
/**
* @notice Returns the transfer validator contract address for this token contract.
*/
function getTransferValidator() public view override returns (address) {
return transferValidator;
}
/**
* @notice Returns the function selector for the transfer validator's validation function to be called
* @notice for transaction simulation.
*/
function getTransferValidationFunction()
external
pure
returns (bytes4 functionSignature, bool isViewFunction)
{
functionSignature = bytes4(
keccak256("validateTransfer(address,address,address,uint256)")
);
isViewFunction = true;
}
/**
* @notice Removes or sets the default transfer validator depending on the current state.
* @dev Uses pre-existing function name for backwards compatibility with Fair.xyz platform.
*/
function toggleOperatorFilterDisabled() public {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
if (transferValidator == address(0)) {
_setTransferValidator(DEFAULT_TRANSFER_VALIDATOR);
} else {
_setTransferValidator(address(0));
}
}
/**
* @notice Registers the token type for a transfer validator.
* @param validator The address of the transfer validator to register.
*/
function _registerTokenType(address validator) internal {
if (validator != address(0)) {
uint256 validatorCodeSize;
assembly {
validatorCodeSize := extcodesize(validator)
}
if (validatorCodeSize > 0) {
try
ITransferValidatorSetTokenType(validator)
.setTokenTypeOfCollection(address(this), 721)
{} catch {}
}
}
}
/**
* @notice Emits the Locked or Unlocked event for a token at the request of the custom transfer validator.
* @dev Throws if the caller is not the custom transfer validator.
* @param tokenId The ID of the token to lock or unlock.
* @param locked Whether to lock or unlock the token.
*/
function customValidatorTokenLock(uint256 tokenId, bool locked) public {
require(msg.sender == customTransferValidator, "Unauthorized");
if (_tokenLockedByCustomValidator[tokenId] != locked) {
_tokenLockedByCustomValidator[tokenId] = locked;
if (locked) {
emit Locked(tokenId);
} else {
emit Unlocked(tokenId);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import {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, IAccessControlUpgradeable, ERC165Upgradeable {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
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(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981Upgradeable is IERC165Upgradeable {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import {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;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981Upgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
function __ERC2981_init() internal onlyInitializing {
}
function __ERC2981_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {
return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981Upgradeable
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[48] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721ReceiverUpgradeable {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../StringsUpgradeable.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSAUpgradeable {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProofUpgradeable {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.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);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.5) (utils/Multicall.sol)
pragma solidity ^0.8.0;
import "./AddressUpgradeable.sol";
import "./ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* Consider any assumption about calldata validation performed by the sender may be violated if it's not especially
* careful about sending transactions invoking {multicall}. For example, a relay address that filters function
* selectors won't filter calls nested within a {multicall} operation.
*
* NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}).
* If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data`
* to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of
* {_msgSender} are not propagated to subcalls.
*
* _Available since v4.1._
*/
abstract contract MulticallUpgradeable is Initializable, ContextUpgradeable {
function __Multicall_init() internal onlyInitializing {
}
function __Multicall_init_unchained() internal onlyInitializing {
}
/**
* @dev Receives and executes a batch of function calls on this contract.
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
bytes memory context = msg.sender == _msgSender()
? new bytes(0)
: msg.data[msg.data.length - _contextSuffixLength():];
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = AddressUpgradeable.functionDelegateCall(address(this), bytes.concat(data[i], context));
}
return results;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
interface ICreatorToken {
event TransferValidatorUpdated(address oldValidator, address newValidator);
function getTransferValidator() external view returns (address validator);
function setTransferValidator(address validator) external;
function getTransferValidationFunction()
external
view
returns (bytes4 functionSignature, bool isViewFunction);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ICreatorTokenLegacy {
event TransferValidatorUpdated(address oldValidator, address newValidator);
function getTransferValidator() external view returns (address validator);
function setTransferValidator(address validator) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
interface ITransferValidator {
function applyCollectionTransferPolicy(
address caller,
address from,
address to
) external view;
function validateTransfer(
address caller,
address from,
address to
) external view;
function validateTransfer(
address caller,
address from,
address to,
uint256 tokenId
) external view;
function validateTransfer(
address caller,
address from,
address to,
uint256 tokenId,
uint256 amount
) external;
function beforeAuthorizedTransfer(
address operator,
address token,
uint256 tokenId
) external;
function afterAuthorizedTransfer(address token, uint256 tokenId) external;
function beforeAuthorizedTransfer(address operator, address token) external;
function afterAuthorizedTransfer(address token) external;
function beforeAuthorizedTransfer(address token, uint256 tokenId) external;
function beforeAuthorizedTransferWithAmount(
address token,
uint256 tokenId,
uint256 amount
) external;
function afterAuthorizedTransferWithAmount(
address token,
uint256 tokenId
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
interface ITransferValidatorSetTokenType {
function setTokenTypeOfCollection(
address collection,
uint16 tokenType
) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
contract EmptyUpgradeable {
bool private bool1;
address private address1;
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// @ Fair.xyz dev
pragma solidity 0.8.17;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "../EmptyUpgradeable.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, with modifications by the Fair.xyz team, thus setting the ERC721xyz standard
*/
abstract contract ERC721xyzUpgradeable is
ContextUpgradeable,
ERC165Upgradeable,
IERC721Upgradeable,
ERC2981Upgradeable,
IERC721MetadataUpgradeable,
EmptyUpgradeable
{
using AddressUpgradeable for address;
using StringsUpgradeable for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Token mint count
uint256 public _mintedTokens;
// Token burnt count
uint256 internal _burntTokensCount;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping from token ID to original owner address
mapping(uint256 => address) private _origOwners;
// Burnt tokens
mapping(uint256 => bool) private _tokenIsBurnt;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Mint information per wallet
struct minterData {
uint96 balance;
uint96 mintsPerWallet;
uint64 blockNumber;
}
mapping(address => minterData) internal mintData;
bool public isSoulBound;
error TokenIsSoulBound();
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
function __ERC721_init(
string memory name_,
string memory symbol_
) internal onlyInitializing {
__ERC721_init_unchained(name_, symbol_);
}
function __ERC721_init_unchained(
string memory name_,
string memory symbol_
) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(
bytes4 interfaceId
)
public
view
virtual
override(ERC2981Upgradeable, ERC165Upgradeable, IERC165Upgradeable)
returns (bool)
{
return
interfaceId == type(IERC2981Upgradeable).interfaceId ||
interfaceId == type(IERC721Upgradeable).interfaceId ||
interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(
address owner
) public view virtual override returns (uint256) {
require(
owner != address(0),
"ERC721: balance query for the zero address"
);
return mintData[owner].balance;
}
/**
* @dev Returns number of minted Tokens
*/
function viewMinted() public view virtual returns (uint256) {
return _mintedTokens;
}
// return all tokens
function totalSupply() public view virtual returns (uint256) {
return _mintedTokens - _burntTokensCount;
}
/**
* @dev Mints a batch of `tokenIds` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* In order to employ tight-packing, we use uint96 for the user balance and mints per wallet,
* and uint64 for the nonce. This is suitable because uint96 supports up to 2**96 - 2 = 7.92*10**28
* individual tokens being minted. Anything higher than this will cause an overflow. Similarly, the
* nonce stores block timestamps, in UNIX time, for which uint64 is more than sufficient.
*
* Requirements:
*
* - `to` cannot be the zero address.
*
* Emits {Transfer} events.
*/
function _mint(
address to,
uint256 numberOfTokens,
uint256 nonce
) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
_beforeTokenTransfer(address(0), to, _mintedTokens);
uint256 orig_count = _mintedTokens;
unchecked {
uint256 new_count = orig_count + numberOfTokens;
_mintedTokens = new_count;
mintData[to].balance += uint96(numberOfTokens);
// Nonce = 0 is for airdrop mints, which do not count towards wallet minting
// limits or signature nonce updates
if (nonce != 0) {
mintData[to].mintsPerWallet += uint96(numberOfTokens);
mintData[to].blockNumber = uint64(nonce);
}
_origOwners[new_count] = to;
uint256 i = orig_count + 1;
uint256 loop_ = new_count + 1;
do {
emit Transfer(address(0), to, i);
++i;
} while (i < loop_);
}
_afterTokenTransfer(address(0), to, _mintedTokens);
}
/**
* @dev Returns owner of token ID.
*/
function ownerOf(
uint256 tokenId
) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721xyz: Query for non existent token!");
uint256 counter = tokenId;
address _owner = _owners[tokenId];
if (_owner == address(0)) {
while (true) {
_owner = _origOwners[counter];
if (_owner != address(0)) {
return _owner;
}
unchecked {
++counter;
}
}
}
return _owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721xyzUpgradeable.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(
uint256 tokenId
) public view virtual override returns (address) {
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(
address operator,
bool approved
) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(
address owner,
address operator
) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
if (_tokenIsBurnt[tokenId]) return false;
return (0 < tokenId && tokenId <= _mintedTokens);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(
address spender,
uint256 tokenId
) internal view virtual returns (bool) {
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ERC721xyzUpgradeable.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 tokenCount,
uint256 nonce
) internal virtual {
_safeMint(to, tokenCount, "", nonce);
}
/**
* @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 tokenCount,
bytes memory _data,
uint256 nonce
) internal virtual {
_mint(to, tokenCount, nonce);
require(
_checkOnERC721Received(address(0), to, _mintedTokens, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
require(_exists(tokenId), "ERC721xyz: Query for nonexistent token!");
address owner = ERC721xyzUpgradeable.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
unchecked {
mintData[owner].balance -= 1;
_tokenIsBurnt[tokenId] = true;
_burntTokensCount += 1;
}
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), 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 virtual {
require(
ERC721xyzUpgradeable.ownerOf(tokenId) == from,
"ERC721: transfer from incorrect owner"
);
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
unchecked {
mintData[from].balance -= 1;
mintData[to].balance += 1;
_owners[tokenId] = to;
}
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
address _approved = _tokenApprovals[tokenId];
if (_approved != to) {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721xyzUpgradeable.ownerOf(tokenId), to, tokenId);
}
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721ReceiverUpgradeable(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return
retval ==
IERC721ReceiverUpgradeable.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721: transfer to non ERC721Receiver implementer"
);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[43] private __gap;
}// SPDX-License-Identifier: MIT
// @author: Fair.xyz dev
pragma solidity 0.8.17;
contract FairXYZDeployerErrorsAndEvents {
/// @dev Events
event Airdrop(uint256 tokenCount, uint256 newTotal, address[] recipients);
event BurnableSet(bool burnState);
event SignatureReleased();
event NewMaxMintsPerWalletSet(uint128 newGlobalMintsPerWallet);
event NewPathURI(string newPathURI);
event NewPrimarySaleReceiver(address newPrimaryReceiver);
event NewSecondaryRoyalties(
address newSecondaryReceiver,
uint96 newRoyalty
);
event NewTokenURI(string newTokenURI);
event Mint(address minterAddress, uint256 stage, uint256 mintCount);
event URILocked();
event CustomTransferValidatorUpdated(
address oldValidator,
address newValidator
);
event Locked(uint256 tokenId);
event Unlocked(uint256 tokenId);
/// @dev Errors
error AddressLimitPerTx();
error AlreadyLockedURI();
error BurnerIsNotApproved();
error BurningOff();
error CannotDeleteOngoingStage();
error CannotEditPastStages();
error ETHSendFail();
error EndTimeInThePast();
error EndTimeLessThanStartTime();
error ExceedsMintsPerWallet();
error ExceedsNFTsOnSale();
error IncorrectIndex();
error InvalidNonce();
error InvalidStartTime();
error LessNFTsOnSaleThanBefore();
error MerkleProofFail();
error MerkleStage();
error NotEnoughETH();
error PhaseLimitEnd();
error PhaseLimitExceedsTokenCount();
error PhaseStartsBeforePriorPhaseEnd();
error PublicStage();
error ReusedHash();
error SaleEnd();
error SaleNotActive();
error StageDoesNotExist();
error StageLimitPerTx();
error StartTimeInThePast();
error TimeLimit();
error TokenCountExceedsPhaseLimit();
error TokenDoesNotExist();
error TokenLimitPerTx();
error TooManyStagesInTheFuture();
error UnauthorisedUser();
error UnrecognizableHash();
error ZeroAddress();
}// SPDX-License-Identifier: MIT
// @ Fair.xyz dev
pragma solidity 0.8.17;
interface IFairXYZWallets {
function viewWithdraw() external view returns (address);
function viewPathURI(string memory pathURI_)
external
view
returns (string memory);
}{
"optimizer": {
"enabled": true,
"runs": 140
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressLimitPerTx","type":"error"},{"inputs":[],"name":"AlreadyLockedURI","type":"error"},{"inputs":[],"name":"BurnerIsNotApproved","type":"error"},{"inputs":[],"name":"BurningOff","type":"error"},{"inputs":[],"name":"CannotDeleteOngoingStage","type":"error"},{"inputs":[],"name":"CannotEditPastStages","type":"error"},{"inputs":[],"name":"CreatorTokenBase__InvalidTransferValidatorContract","type":"error"},{"inputs":[],"name":"ETHSendFail","type":"error"},{"inputs":[],"name":"EndTimeInThePast","type":"error"},{"inputs":[],"name":"EndTimeLessThanStartTime","type":"error"},{"inputs":[],"name":"ExceedsMintsPerWallet","type":"error"},{"inputs":[],"name":"ExceedsNFTsOnSale","type":"error"},{"inputs":[],"name":"IncorrectIndex","type":"error"},{"inputs":[],"name":"InvalidNonce","type":"error"},{"inputs":[],"name":"InvalidStartTime","type":"error"},{"inputs":[],"name":"LessNFTsOnSaleThanBefore","type":"error"},{"inputs":[],"name":"MerkleProofFail","type":"error"},{"inputs":[],"name":"MerkleStage","type":"error"},{"inputs":[],"name":"NotEnoughETH","type":"error"},{"inputs":[],"name":"PhaseLimitEnd","type":"error"},{"inputs":[],"name":"PhaseLimitExceedsTokenCount","type":"error"},{"inputs":[],"name":"PhaseStartsBeforePriorPhaseEnd","type":"error"},{"inputs":[],"name":"PublicStage","type":"error"},{"inputs":[],"name":"ReusedHash","type":"error"},{"inputs":[],"name":"SaleEnd","type":"error"},{"inputs":[],"name":"SaleNotActive","type":"error"},{"inputs":[],"name":"StageDoesNotExist","type":"error"},{"inputs":[],"name":"StageLimitPerTx","type":"error"},{"inputs":[],"name":"StartTimeInThePast","type":"error"},{"inputs":[],"name":"TimeLimit","type":"error"},{"inputs":[],"name":"TokenCountExceedsPhaseLimit","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TokenIsSoulBound","type":"error"},{"inputs":[],"name":"TokenLimitPerTx","type":"error"},{"inputs":[],"name":"TooManyStagesInTheFuture","type":"error"},{"inputs":[],"name":"UnauthorisedUser","type":"error"},{"inputs":[],"name":"UnrecognizableHash","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenCount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotal","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"Airdrop","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"burnState","type":"bool"}],"name":"BurnableSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldValidator","type":"address"},{"indexed":false,"internalType":"address","name":"newValidator","type":"address"}],"name":"CustomTransferValidatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minterAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"stage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintCount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"newGlobalMintsPerWallet","type":"uint128"}],"name":"NewMaxMintsPerWalletSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newPathURI","type":"string"}],"name":"NewPathURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newPrimaryReceiver","type":"address"}],"name":"NewPrimarySaleReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newSecondaryReceiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"newRoyalty","type":"uint96"}],"name":"NewSecondaryRoyalties","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"uint32","name":"mintsPerWallet","type":"uint32"},{"internalType":"uint32","name":"phaseLimit","type":"uint32"},{"internalType":"uint112","name":"price","type":"uint112"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"indexed":false,"internalType":"struct FairXYZDeployer.StageData[]","name":"stages","type":"tuple[]"},{"indexed":false,"internalType":"uint256","name":"startIndex","type":"uint256"}],"name":"NewStagesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newTokenURI","type":"string"}],"name":"NewTokenURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":[],"name":"SignatureReleased","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":false,"internalType":"address","name":"oldValidator","type":"address"},{"indexed":false,"internalType":"address","name":"newValidator","type":"address"}],"name":"TransferValidatorUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"URILocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unlocked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECOND_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"maxTokens_","type":"uint128"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"interfaceAddress_","type":"address"},{"internalType":"string[]","name":"URIs_","type":"string[]"},{"internalType":"uint96","name":"royaltyPercentage_","type":"uint96"},{"internalType":"uint128","name":"globalMintsPerWallet_","type":"uint128"},{"internalType":"address[]","name":"royaltyReceivers","type":"address[]"},{"internalType":"address","name":"ownerOfContract","type":"address"},{"components":[{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"uint32","name":"mintsPerWallet","type":"uint32"},{"internalType":"uint32","name":"phaseLimit","type":"uint32"},{"internalType":"uint112","name":"price","type":"uint112"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct FairXYZDeployer.StageData[]","name":"stages","type":"tuple[]"},{"internalType":"bool","name":"isSBT","type":"bool"}],"name":"_initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_mintedTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_pathURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_preRevealURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"address_","type":"address[]"},{"internalType":"uint256","name":"tokenCount","type":"uint256"}],"name":"airdrop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newPrimarySaleReceiver","type":"address"}],"name":"changePrimarySaleReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSecondaryRoyaltyReceiver","type":"address"},{"internalType":"uint96","name":"newRoyaltyValue","type":"uint96"}],"name":"changeSecondaryRoyaltyReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"string","name":"newPathURI","type":"string"},{"internalType":"string","name":"newURI","type":"string"}],"name":"changeURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"customTransferValidator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"}],"name":"customValidatorTokenLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransferValidationFunction","outputs":[{"internalType":"bytes4","name":"functionSignature","type":"bytes4"},{"internalType":"bool","name":"isViewFunction","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransferValidator","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[],"name":"interfaceAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSoulBound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockURI","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockURIforever","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"},{"internalType":"uint256","name":"maxMintsPerWallet","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"merkleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"},{"internalType":"uint256","name":"maxMintsPerWallet","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"releaseSignature","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"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":"address","name":"customTransferValidator_","type":"address"}],"name":"setCustomTransferValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"newGlobalMaxMintsPerWallet","type":"uint128"}],"name":"setGlobalMaxMints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"uint32","name":"mintsPerWallet","type":"uint32"},{"internalType":"uint32","name":"phaseLimit","type":"uint32"},{"internalType":"uint112","name":"price","type":"uint112"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct FairXYZDeployer.StageData[]","name":"stages","type":"tuple[]"},{"internalType":"uint256","name":"startId","type":"uint256"}],"name":"setStages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transferValidator_","type":"address"}],"name":"setTransferValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signatureReleased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"stageMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleOperatorFilterDisabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensAvailable","outputs":[{"internalType":"uint128","name":"maxTokens","type":"uint128"},{"internalType":"uint128","name":"globalMintsPerWallet","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStages","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minterAddress","type":"address"}],"name":"totalWalletMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"viewCurrentPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewCurrentStage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewLatestStage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"stageId","type":"uint256"}],"name":"viewStageMap","outputs":[{"components":[{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"uint32","name":"mintsPerWallet","type":"uint32"},{"internalType":"uint32","name":"phaseLimit","type":"uint32"},{"internalType":"uint112","name":"price","type":"uint112"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct FairXYZDeployer.StageData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6159ce80620000f36000396000f3fe6080604052600436106103795760003560e01c806382b42c02116101cd578063b0fde7fb11610108578063ce4c61aa116100ab578063dedd76e71161007a578063dedd76e714610b4a578063e985e9c514610bd6578063effcf2b714610bf6578063f2fde38b14610c0b578063f86a352914610c2b57600080fd5b8063ce4c61aa14610ac1578063d539139314610ad6578063d547741f14610b0a578063d7818e2814610b2a57600080fd5b8063b0fde7fb146109de578063b3cc59db146109f8578063b88d4fde14610a0d578063bdc769eb14610a2d578063be66422114610a40578063bfccdaf714610a60578063c204642c14610a81578063c87b56dd14610aa157600080fd5b806395d89b411161017057806395d89b41146108e857806397f5cdcf146108fd578063a07c7ce414610913578063a217fddf14610935578063a22cb4651461094a578063a9fc664e1461096a578063aa8a67541461098a578063ac9650d8146109b157600080fd5b806382b42c02146107c5578063869d3bde146107e55780638c8ea8e6146107fa5780638cd90c32146108405780638da5cb5b146108795780638e021c061461089857806390411aca146108b357806391d14854146108c857600080fd5b80633f52af3c116102b85780636352211e1161025b578063715018a61161022a578063715018a61461075157806372c06f5a14610766578063743976a01461077b5780637f1fea591461079057806380420736146107b057600080fd5b80636352211e146106d1578063659b8b2a146106f15780636e49aa0a1461071157806370a082311461073157600080fd5b80633f52af3c146105bb57806341dfed3a146105db57806342842e0e146105f057806342966c68146106105780634e0b9df21461063057806351e85af614610650578063548e76821461066557806360659a921461068557600080fd5b806323b872dd1161032057806323b872dd146104ae578063248a9ca3146104ce5780632955a21d146104ff5780632a55205a146105125780632f2ff15d146105515780633540558a1461057157806336568abe146105935780633ccfd60b146105b357600080fd5b806301ffc9a71461037e5780630293741b146103b357806306fdde03146103d5578063081812fc146103ea578063095ea7b314610422578063098144d4146104445780630d705df61461046357806318160ddd1461048b575b600080fd5b34801561038a57600080fd5b5061039e6103993660046148a4565b610c42565b60405190151581526020015b60405180910390f35b3480156103bf57600080fd5b506103c8610c88565b6040516103aa9190614911565b3480156103e157600080fd5b506103c8610d1b565b3480156103f657600080fd5b5061040a610405366004614924565b610d2a565b6040516001600160a01b0390911681526020016103aa565b34801561042e57600080fd5b5061044261043d366004614959565b610db7565b005b34801561045057600080fd5b506101d2546001600160a01b031661040a565b34801561046f57600080fd5b506040805163657711f560e11b815260016020820152016103aa565b34801561049757600080fd5b506104a0610ec7565b6040519081526020016103aa565b3480156104ba57600080fd5b506104426104c9366004614983565b610ede565b3480156104da57600080fd5b506104a06104e9366004614924565b6000908152610100602052604090206001015490565b61044261050d366004614a82565b610f0f565b34801561051e57600080fd5b5061053261052d366004614aec565b6112dd565b604080516001600160a01b0390931683526020830191909152016103aa565b34801561055d57600080fd5b5061044261056c366004614b0e565b61138b565b34801561057d57600080fd5b506104a060008051602061597983398151915281565b34801561059f57600080fd5b506104426105ae366004614b0e565b6113b1565b61044261142f565b3480156105c757600080fd5b506104426105d6366004614b51565b6114af565b3480156105e757600080fd5b506104a0611530565b3480156105fc57600080fd5b5061044261060b366004614983565b611572565b34801561061c57600080fd5b506104a061062b366004614924565b61158d565b34801561063c57600080fd5b5061044261064b366004614bbf565b611635565b34801561065c57600080fd5b5061044261167b565b34801561067157600080fd5b50610442610680366004614c21565b611701565b34801561069157600080fd5b506101c8546106b1906001600160801b0380821691600160801b90041682565b604080516001600160801b039384168152929091166020830152016103aa565b3480156106dd57600080fd5b5061040a6106ec366004614924565b61178c565b3480156106fd57600080fd5b506101cd5461039e90610100900460ff1681565b34801561071d57600080fd5b5061044261072c366004614d5b565b61184c565b34801561073d57600080fd5b506104a061074c366004614eb8565b611b63565b34801561075d57600080fd5b50610442611bf3565b34801561077257600080fd5b50610442611c07565b34801561078757600080fd5b506103c8611c67565b34801561079c57600080fd5b506104426107ab366004614eb8565b611c77565b3480156107bc57600080fd5b50610442611d15565b3480156107d157600080fd5b506104426107e0366004614ed3565b611d8e565b3480156107f157600080fd5b506104a0611e79565b34801561080657600080fd5b506104a0610815366004614eb8565b6001600160a01b0316600090815260d36020526040902054600160601b90046001600160601b031690565b34801561084c57600080fd5b506104a061085b366004614b0e565b6101d060209081526000928352604080842090915290825290205481565b34801561088557600080fd5b50610196546001600160a01b031661040a565b3480156108a457600080fd5b506101cd5461039e9060ff1681565b3480156108bf57600080fd5b5060cc546104a0565b3480156108d457600080fd5b5061039e6108e3366004614b0e565b611ef7565b3480156108f457600080fd5b506103c8611f23565b34801561090957600080fd5b506104a060cc5481565b34801561091f57600080fd5b506101cd5461039e90600160b01b900460ff1681565b34801561094157600080fd5b506104a0600081565b34801561095657600080fd5b50610442610965366004614ef6565b611f32565b34801561097657600080fd5b50610442610985366004614eb8565b611f3d565b34801561099657600080fd5b506101cd5461040a906201000090046001600160a01b031681565b3480156109bd57600080fd5b506109d16109cc366004614f64565b611f71565b6040516103aa9190614fa5565b3480156109ea57600080fd5b5060d45461039e9060ff1681565b348015610a0457600080fd5b50610442612063565b348015610a1957600080fd5b50610442610a28366004615007565b6120ff565b610442610a3b36600461506e565b612131565b348015610a4c57600080fd5b50610442610a5b366004614eb8565b6122c0565b348015610a6c57600080fd5b506101d35461040a906001600160a01b031681565b348015610a8d57600080fd5b506104a0610a9c3660046150c8565b612353565b348015610aad57600080fd5b506103c8610abc366004614924565b61250f565b348015610acd57600080fd5b506104a06125a2565b348015610ae257600080fd5b506104a07ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b348015610b1657600080fd5b50610442610b25366004614b0e565b6125f7565b348015610b3657600080fd5b50610442610b4536600461510c565b61261d565b348015610b5657600080fd5b50610b6a610b65366004614924565b61278d565b6040516103aa9190600060c08201905064ffffffffff80845116835280602085015116602084015250604083015163ffffffff808216604085015280606086015116606085015250506001600160701b03608084015116608083015260a083015160a083015292915050565b348015610be257600080fd5b5061039e610bf1366004615193565b612861565b348015610c0257600080fd5b506103c861288f565b348015610c1757600080fd5b50610442610c26366004614eb8565b612933565b348015610c3757600080fd5b506104a06101d15481565b60006001600160e01b03198216632b435fdb60e21b1480610c7357506001600160e01b0319821663503e914d60e11b145b80610c825750610c82826129a9565b92915050565b60606101cb8054610c98906151bd565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc4906151bd565b8015610d115780601f10610ce657610100808354040283529160200191610d11565b820191906000526020600020905b815481529060010190602001808311610cf457829003601f168201915b5050505050905090565b606060ca8054610c98906151bd565b6000610d35826129ce565b610d9b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815260d160205260409020546001600160a01b031690565b6000610dc28261178c565b9050806001600160a01b0316836001600160a01b031603610e2f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610d92565b336001600160a01b0382161480610e4b5750610e4b8133612861565b610eb85760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610d92565b610ec28383612a01565b505050565b600060cd5460cc54610ed9919061520d565b905090565b610ee83382612a93565b610f045760405162461bcd60e51b8152600401610d9290615220565b610ec2838383612b5d565b826000108015610f20575060148311155b610f3d576040516332b4cb2160e21b815260040160405180910390fd5b6000610f47611e79565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a0820152929350610fda9066031742a8f4600090615271565b9050610fe68682615284565b341461100557604051632c1d501360e11b815260040160405180910390fd5b8660000361102657604051633ab3447f60e11b815260040160405180910390fd5b60cc54606083015163ffffffff1681106110525760405162491a1760e81b815260040160405180910390fd5b60a08301511561107557604051630268975d60e51b815260040160405180910390fd5b6101cd54610100900460ff1661115057600061109386898b8a612cf7565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb716110b4828c612d79565b6001600160a01b0316146110db576040516332c3ce2560e11b815260040160405180910390fd5b6001600160a01b038616600090815260d36020526040902054600160c01b90046001600160401b031689116111235760405163dc5a682560e01b815260040160405180910390fd5b61112e89604b615271565b43111561114e57604051639e8c142f60e01b815260040160405180910390fd5b505b600061116086868a85888c612d9d565b905061116d86828b612f32565b6000731075266c86cd9b1b021af63e09102af3d2dcbdb76111958366031742a8f46000615284565b604051600081818185875af1925050503d80600081146111d1576040519150601f19603f3d011682016040523d82523d6000602084013e6111d6565b606091505b50509050806111f857604051635579a42f60e11b815260040160405180910390fd5b888210156112865760008461120d848c61520d565b6112179190615284565b604051909150600090339083908381818185875af1925050503d806000811461125c576040519150601f19603f3d011682016040523d82523d6000602084013e611261565b606091505b505090508061128357604051635579a42f60e11b815260040160405180910390fd5b50505b604080516001600160a01b0389168152602081018890529081018390527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f9060600160405180910390a15050505050505050505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916113525750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090611371906001600160601b031687615284565b61137b919061529b565b91519350909150505b9250929050565b600082815261010060205260409020600101546113a781612f4d565b610ec28383612f57565b6001600160a01b03811633146114215760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610d92565b61142b8282612fde565b5050565b600061143a81612f4d565b6101ce546040516000916001600160a01b03169047908381818185875af1925050503d8060008114611488576040519150601f19603f3d011682016040523d82523d6000602084013e61148d565b606091505b505090508061142b57604051635579a42f60e11b815260040160405180910390fd5b6114ba600033611ef7565b6114d757604051634e8df0bf60e01b815260040160405180910390fd5b6114e18282613046565b604080516001600160a01b03841681526001600160601b03831660208201527fef5955f7902e6696c028804c62be1c24a0f98d9d30de5c31c83fa7f8b5c15c6f91015b60405180910390a15050565b600066031742a8f460006101cf6000611547611e79565b8152602081019190915260400160002054610ed99190600160901b90046001600160701b0316615271565b610ec2838383604051806020016040528060008152506120ff565b6101cd54600090600160b01b900460ff166115bb5760405163c7c39e4f60e01b815260040160405180910390fd5b6115cd6115c78361178c565b33612861565b806115f157506115dc8261178c565b6001600160a01b0316336001600160a01b0316145b8061160c57503361160183610d2a565b6001600160a01b0316145b6116285760405162ccfedb60e31b815260040160405180910390fd5b61163182613143565b5090565b61164d60008051602061597983398151915233611ef7565b61166a57604051634e8df0bf60e01b815260040160405180910390fd5b611675838383613260565b50505050565b611686600033611ef7565b6116a357604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156116c85760405163ddff29e960e01b815260040160405180910390fd5b6101cd805460ff191660011790556040517f31d1c0a3af6e15844ff9c1bf6201a5cf123137eb2fb3eeb96861a436d49cd25f90600090a1565b61171960008051602061597983398151915233611ef7565b61173657604051634e8df0bf60e01b815260040160405180910390fd5b6101c880546001600160801b03908116600160801b918416918202179091556040519081527f8c8298dd23c82a4aa45d27f480c6ce0aa2588e13df0b2fe2c827ca4a6836a5f8906020015b60405180910390a150565b6000611797826129ce565b6117f45760405162461bcd60e51b815260206004820152602860248201527f45524337323178797a3a20517565727920666f72206e6f6e206578697374656e6044820152677420746f6b656e2160c01b6064820152608401610d92565b600082815260ce602052604090205482906001600160a01b031680611845575b50600081815260cf60205260409020546001600160a01b0316801561183a579392505050565b816001019150611814565b9392505050565b600054610100900460ff161580801561186c5750600054600160ff909116105b806118865750303b158015611886575060005460ff166001145b6118e95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d92565b6000805460ff19166001179055801561190c576000805461ff0019166101001790555b6001600160a01b038a166119335760405163d92e233d60e01b815260040160405180910390fd5b885160031461194157600080fd5b855160021461194f57600080fd5b6119598c8c6136ef565b611961613720565b611969613720565b61197285613747565b604080518082019091526001600160801b038e81168083529089166020909201829052600160801b909102176101c8556101cd805462010000600160b01b031916620100006001600160a01b038d1602179055885189906000906119d8576119d86152bd565b60200260200101516101cb90816119ef9190615319565b5088600181518110611a0357611a036152bd565b60200260200101516101c99081611a1a9190615319565b5088600281518110611a2e57611a2e6152bd565b60200260200101516101ca9081611a459190615319565b5060d4805460ff191683151517905585518690600090611a6757611a676152bd565b60200260200101516101ce60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611aba86600181518110611aac57611aac6152bd565b602002602001015189613046565b611ac5600086612f57565b611add60008051602061597983398151915286612f57565b8215611af157611aef84846000613260565b505b611b0e73721c002b0059009a671d00ad1700c9748146cd1b61379a565b8015611b54576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b60006001600160a01b038216611bce5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610d92565b506001600160a01b0316600090815260d360205260409020546001600160601b031690565b611bfb613840565b611c056000613747565b565b611c12600033611ef7565b611c2f57604051634e8df0bf60e01b815260040160405180910390fd5b6101d2546001600160a01b0316611c5d57611c0573721c002b0059009a671d00ad1700c9748146cd1b61379a565b611c05600061379a565b60606101c98054610c98906151bd565b611c82600033611ef7565b611c9f57604051634e8df0bf60e01b815260040160405180910390fd5b6001600160a01b038116611cc65760405163d92e233d60e01b815260040160405180910390fd5b6101ce80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd45e158b56e768c1167267f8516bcf96348071775faded3c9216b60855d873de90602001611781565b611d20600033611ef7565b611d3d57604051634e8df0bf60e01b815260040160405180910390fd5b6101cd54610100900460ff1615611d5357600080fd5b6101cd805461ff0019166101001790556040517ffbbcc58867e8fad1d9f72f1b991660f5ec5e4e068374aa442b8604eef182b63990600090a1565b6101d3546001600160a01b03163314611dd85760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610d92565b60008281526101d4602052604090205460ff1615158115151461142b5760008281526101d460205260409020805460ff19168215801591909117909155611e49576040518281527f032bc66be43dbccb7487781d168eb7bda224628a3b2c3388bdf69b532a3a161190602001611524565b6040518281527ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290602001611524565b6101d1546000905b8015611edd576000190160008181526101cf602052604090205464ffffffffff164210801590611ece575060008181526101cf6020526040902054600160281b900464ffffffffff164211155b15611ed857919050565b611e81565b5060405163b7b2409760e01b815260040160405180910390fd5b6000918252610100602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060cb8054610c98906151bd565b61142b33838361389b565b611f48600033611ef7565b611f6557604051634e8df0bf60e01b815260040160405180910390fd5b611f6e8161379a565b50565b604080516000815260208101909152606090826001600160401b03811115611f9b57611f9b6149bf565b604051908082528060200260200182016040528015611fce57816020015b6060815260200190600190039081611fb95790505b50915060005b8381101561205b5761202b30868684818110611ff257611ff26152bd565b905060200281019061200491906153d8565b856040516020016120179392919061541e565b604051602081830303815290604052613969565b83828151811061203d5761203d6152bd565b6020026020010181905250808061205390615445565b915050611fd4565b505092915050565b61207b60008051602061597983398151915233611ef7565b61209857604051634e8df0bf60e01b815260040160405180910390fd5b6101cd805460ff600160b01b808304821615810260ff60b01b1990931692909217928390556040517f6ae3331a8bd1998bb8fd9d3d02b720f4862fb43e7586d302ba44e3923cea922d936120f59390049091161515815260200190565b60405180910390a1565b6121093383612a93565b6121255760405162461bcd60e51b8152600401610d9290615220565b6116758484848461398e565b826000108015612142575060148311155b61215f576040516332b4cb2160e21b815260040160405180910390fd5b6000612169611e79565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506121fc9066031742a8f4600090615271565b90506122088682615284565b341461222757604051632c1d501360e11b815260040160405180910390fd5b60a082015161224957604051637904b60360e11b815260040160405180910390fd5b60cc54606083015163ffffffff1681106122755760405162491a1760e81b815260040160405180910390fd5b61228689898560a00151888a6139c1565b6122a3576040516334ce9a3d60e11b815260040160405180910390fd5b60006122b386868a85888c612d9d565b905061116d868243612f32565b6122cb600033611ef7565b6122e857604051634e8df0bf60e01b815260040160405180910390fd5b6101d354604080516001600160a01b03928316815291831660208301527f506563f582a1103ea9c5c3797795f524f078d85ab1c1d15b96d812667b5c94c6910160405180910390a16101d380546001600160a01b0319166001600160a01b0392909216919091179055565b60006014821115612377576040516332b4cb2160e21b815260040160405180910390fd5b81600003612398576040516332b4cb2160e21b815260040160405180910390fd5b6014835111156123bb576040516349a3ec1560e11b815260040160405180910390fd5b82516000036123dd576040516349a3ec1560e11b815260040160405180910390fd5b6123f560008051602061597983398151915233611ef7565b15801561242957506124277ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933611ef7565b155b1561244757604051634e8df0bf60e01b815260040160405180910390fd5b60008284516124569190615284565b60cc546124639190615271565b6101c8549091506001600160801b03168111156124935760405163a67c036160e01b815260040160405180910390fd5b60005b84518110156124cc576124c48582815181106124b4576124b46152bd565b6020026020010151856000612f32565b600101612496565b507f74074e463a8efcb02859ade8892e3934bd28eb75c9d1e6085a40c474088e2bfe8382866040516125009392919061545e565b60405180910390a19392505050565b606061251a826129ce565b6125375760405163677510db60e11b815260040160405180910390fd5b600061254161288f565b9050600061254d611c67565b90506000612559610c88565b9050825160000361256c57949350505050565b828261257787613a38565b604051602001612589939291906154bc565b6040516020818303038152906040529350505050919050565b6101d1546000905b80156125ef576000190160008181526101cf6020526040902054600160281b900464ffffffffff164211156125ea576125e4816001615271565b91505090565b6125aa565b506000905090565b6000828152610100602052604090206001015461261381612f4d565b610ec28383612fde565b61263560008051602061597983398151915233611ef7565b61265257604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156126775760405163ddff29e960e01b815260040160405180910390fd5b6000612684338484613aca565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb716126a58286612d79565b6001600160a01b0316146126cc576040516332c3ce2560e11b815260040160405180910390fd5b82511561271b576101ca6126e08482615319565b507ff5e721c51327df71720f204c71b46bc26bcafb44db5012739c85814c7862f6c06101ca60405161271291906154f5565b60405180910390a15b815115611675576101cc61272f8382615319565b506040805160208101909152600081526101c99061274d9082615319565b507f8eca6ea708f9bc34439b72366aa672afc86bb8b1294f1ba9637945c5dab8ea746101cc60405161277f91906154f5565b60405180910390a150505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091526101d15482106127e2576040516327e7ab7d60e11b815260040160405180910390fd5b5060009081526101cf6020908152604091829020825160c081018452815464ffffffffff8082168352600160281b82041693820193909352600160501b830463ffffffff90811694820194909452600160701b83049093166060840152600160901b9091046001600160701b031660808301526001015460a082015290565b6001600160a01b03918216600090815260d26020908152604080832093909416825291909152205460ff1690565b60606101cc805461289f906151bd565b9050600003612925576101cd5460405163511113e560e01b8152620100009091046001600160a01b03169063511113e5906128e0906101ca906004016154f5565b600060405180830381865afa1580156128fd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ed99190810190615580565b6101cc8054610c98906151bd565b61293b613840565b6001600160a01b0381166129a05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d92565b611f6e81613747565b60006001600160e01b03198216637965db0b60e01b1480610c825750610c8282613b3d565b600081815260d0602052604081205460ff16156129ed57506000919050565b816000108015610c8257505060cc54101590565b600081815260d160205260409020546001600160a01b039081169083168114610ec257600082815260d16020526040902080546001600160a01b0319166001600160a01b0385169081179091558290612a598261178c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000612a9e826129ce565b612aff5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610d92565b6000612b0a8361178c565b9050806001600160a01b0316846001600160a01b03161480612b455750836001600160a01b0316612b3a84610d2a565b6001600160a01b0316145b80612b555750612b558185612861565b949350505050565b826001600160a01b0316612b708261178c565b6001600160a01b031614612bd45760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610d92565b6001600160a01b038216612c365760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610d92565b612c41838383613b98565b612c4c600082612a01565b6001600160a01b03838116600081815260d36020908152604080832080546001600160601b03198082166001600160601b039283166000190183161790925595881680855282852080549283169288166001019097169190911790955585835260ce90915280822080546001600160a01b0319168517905551849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610ec2838383613d0e565b604080517f5b174e00b853ebb074ee5cb5d23ca67a264896e5670f923ac103fccad5232b5560208201526001600160a01b03861691810191909152606081018490526080810183905260a081018290526000908190612d6f9060c0015b60405160208183030381529060405280519060200120613d7c565b9695505050505050565b6000806000612d888585613e44565b91509150612d9581613e86565b509392505050565b6001600160a01b038616600081815260d360209081526040808320548984526101d083528184209484529390915280822054908501519192600160601b90046001600160601b03169163ffffffff1615612e3f57846040015163ffffffff168110612e1b57604051632f18066d60e01b815260040160405180910390fd5b846040015163ffffffff168782011115612e3f5780856040015163ffffffff160396505b6101c854600160801b90046001600160801b03168015612e8957808310612e7957604051632f18066d60e01b815260040160405180910390fd5b808884011115612e895782810397505b856060015163ffffffff168888011115612ead5786866060015163ffffffff160397505b600085118015612ec657506101cd54610100900460ff16155b15612efb57848210612eeb57604051632f18066d60e01b815260040160405180910390fd5b848883011115612efb5781850397505b5060008881526101d0602090815260408083206001600160a01b038d16845290915290209087019055508490509695505050505050565b610ec283836040518060200160405280600081525084613fcb565b611f6e8133613fe5565b612f618282611ef7565b61142b576000828152610100602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612f9a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612fe88282611ef7565b1561142b576000828152610100602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6127106001600160601b03821611156130b45760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610d92565b6001600160a01b03821661310a5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610d92565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b61314c816129ce565b6131a85760405162461bcd60e51b815260206004820152602760248201527f45524337323178797a3a20517565727920666f72206e6f6e6578697374656e7460448201526620746f6b656e2160c81b6064820152608401610d92565b60006131b38261178c565b90506131c181600084613b98565b6131cc600083612a01565b6001600160a01b038116600081815260d36020908152604080832080546001600160601b031981166001600160601b039182166000190190911617905585835260d0909152808220805460ff1916600190811790915560cd80549091019055518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a461142b81600084613d0e565b6000828161326c6125a2565b90506014821115613290576040516373c2b52560e11b815260040160405180910390fd5b6101d15480158015906132a257508185105b156132c0576040516344ca163560e11b815260040160405180910390fd5b808511156132e1576040516307cc4d8f60e01b815260040160405180910390fd5b6132ec601483615271565b6132f68487615271565b11156133155760405163c1eae7bb60e01b815260040160405180910390fd5b60008581526101cf602052604081205464ffffffffff16908490036133a2574281116133545760405163bf4a806960e01b815260040160405180910390fd5b6101d18690556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b9061338e908a908a908a9061562d565b60405180910390a185945050505050611845565b6000888860008181106133b7576133b76152bd565b905060c002018036038101906133cd91906156e8565b905060cc54816060015163ffffffff1610156133fc57604051630e93fda160e21b815260040160405180910390fd5b42821115801561340b57508115155b801561341957506101d15487105b1561347657805164ffffffffff16821461344657604051632ca4094f60e21b815260040160405180910390fd5b42816020015164ffffffffff16116134715760405163804491f960e01b815260040160405180910390fd5b6134a1565b42816000015164ffffffffff16116134a15760405163667e606760e11b815260040160405180910390fd5b868581015b8882146134da578a8a8a84038181106134c1576134c16152bd565b905060c002018036038101906134d791906156e8565b92505b6101c85460608401516001600160801b0390911663ffffffff90911611156135155760405163bccc7e2360e01b815260040160405180910390fd5b826000015164ffffffffff16836020015164ffffffffff161161354b57604051631131dc6b60e11b815260040160405180910390fd5b81156135db57600019820160009081526101cf6020526040902054606084015164ffffffffff600160281b8304169163ffffffff600160701b9091048116911610156135b1574281106135b1576040516357be1d0d60e01b815260040160405180910390fd5b835164ffffffffff1681106135d95760405163064f2b0760e31b815260040160405180910390fd5b505b60008281526101cf60209081526040918290208551815492870151938701516060880151608089015164ffffffffff93841669ffffffffffffffffffff1990961695909517600160281b93909616929092029490941767ffffffffffffffff60501b1916600160501b63ffffffff9586160263ffffffff60701b191617600160701b9490911693909302929092176001600160901b0316600160901b6001600160701b039092169190910217815560a0840151600191820155909101908082106134a6576101d18190556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b906136d9908d908d908d9061562d565b60405180910390a19a9950505050505050505050565b600054610100900460ff166137165760405162461bcd60e51b8152600401610d9290615782565b61142b828261403e565b600054610100900460ff16611c055760405162461bcd60e51b8152600401610d9290615782565b61019680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116803b151590158015906137b5575080155b156137d3576040516332483afb60e01b815260040160405180910390fd5b6101d254604080516001600160a01b03928316815291841660208301527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a16101d280546001600160a01b0319166001600160a01b03841617905561142b8261407e565b610196546001600160a01b03163314611c055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d92565b816001600160a01b0316836001600160a01b0316036138fc5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d92565b6001600160a01b03838116600081815260d26020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60606118458383604051806060016040528060278152602001615952602791396140f8565b613999848484612b5d565b6139a584848484614166565b6116755760405162461bcd60e51b8152600401610d92906157cd565b6000612d6f868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040516001600160601b0319606089901b16602082015260348101879052889250605401905060405160208183030381529060405280519060200120614264565b60606000613a458361427a565b60010190506000816001600160401b03811115613a6457613a646149bf565b6040519080825280601f01601f191660200182016040528015613a8e576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613a9857509392505050565b600080613b347f35fa4dcabfcae3f1b6e0c4c1ac43df02ba9cb39e2dcdc3d3f1b92a38118e33548686805190602001208680519060200120604051602001612d5494939291909384526001600160a01b039290921660208401526040830152606082015260800190565b95945050505050565b60006001600160e01b0319821663152a902d60e11b1480613b6e57506001600160e01b031982166380ac58cd60e01b145b80613b8957506001600160e01b03198216635b5e139f60e01b145b80610c825750610c8282614352565b6001600160a01b0383161580613bb557506001600160a01b038216155b15613bbf57505050565b60d45460ff1615613be3576040516328f11eb160e21b815260040160405180910390fd5b6101d3546101d2546001600160a01b039182169116338215613c7b57826001600160a01b0316816001600160a01b031614613c7b5760405163657711f560e11b81526001600160a01b0384169063caee23ea90613c4a9084908a908a908a9060040161581f565b60006040518083038186803b158015613c6257600080fd5b505afa158015613c76573d6000803e3d6000fd5b505050505b6001600160a01b03821615613d0657816001600160a01b0316816001600160a01b031614613d065760405163657711f560e11b81526001600160a01b0383169063caee23ea90613cd59084908a908a908a9060040161581f565b60006040518083038186803b158015613ced57600080fd5b505afa158015613d01573d6000803e3d6000fd5b505050505b505050505050565b60008181526101d4602052604090205460ff1615610ec25760008181526101d4602052604090819020805460ff19169055517ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290613d6f9083815260200190565b60405180910390a1505050565b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f36cb08f6aafe2399767bf40e9642429d7535f40e61bd81428cad09095c5d337d918101919091527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a0820152600090819060c001604051602081830303815290604052805190602001209050611845818460405161190160f01b8152600281019290925260228201526042902090565b6000808251604103613e7a5760208301516040840151606085015160001a613e6e87828585614387565b94509450505050611384565b50600090506002611384565b6000816004811115613e9a57613e9a615849565b03613ea25750565b6001816004811115613eb657613eb6615849565b03613efe5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610d92565b6002816004811115613f1257613f12615849565b03613f5f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610d92565b6003816004811115613f7357613f73615849565b03611f6e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610d92565b613fd6848483614441565b6139a560008560cc5485614166565b613fef8282611ef7565b61142b57613ffc816145ca565b6140078360206145dc565b60405160200161401892919061585f565b60408051601f198184030181529082905262461bcd60e51b8252610d9291600401614911565b600054610100900460ff166140655760405162461bcd60e51b8152600401610d9290615782565b60ca6140718382615319565b5060cb610ec28282615319565b6001600160a01b03811615611f6e57803b801561142b5760405163fb2de5d760e01b81523060048201526102d160248201526001600160a01b0383169063fb2de5d790604401600060405180830381600087803b1580156140de57600080fd5b505af19250505080156140ef575060015b1561142b575050565b6060600080856001600160a01b03168560405161411591906158ce565b600060405180830381855af49150503d8060008114614150576040519150601f19603f3d011682016040523d82523d6000602084013e614155565b606091505b5091509150612d6f86838387614777565b60006001600160a01b0384163b1561425c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906141aa9033908990889088906004016158ea565b6020604051808303816000875af19250505080156141e5575060408051601f3d908101601f191682019092526141e29181019061591d565b60015b614242573d808015614213576040519150601f19603f3d011682016040523d82523d6000602084013e614218565b606091505b50805160000361423a5760405162461bcd60e51b8152600401610d92906157cd565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612b55565b506001612b55565b60008261427185846147f0565b14949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106142b95772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106142e5576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061430357662386f26fc10000830492506010015b6305f5e100831061431b576305f5e100830492506008015b612710831061432f57612710830492506004015b60648310614341576064830492506002015b600a8310610c825760010192915050565b60006001600160e01b0319821663152a902d60e11b1480610c8257506301ffc9a760e01b6001600160e01b0319831614610c82565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156143b45750600090506003614438565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614408573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661443157600060019250925050614438565b9150600090505b94509492505050565b6001600160a01b0383166144975760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d92565b6144a560008460cc54613b98565b60cc8054838101918290556001600160a01b038516600090815260d36020526040902080546001600160601b038082168701166001600160601b0319909116179055908215614544576001600160a01b038516600090815260d36020526040902080546001600160601b03808216600160601b92839004821688019091169091026001600160c01b031617600160c01b6001600160401b038616021790555b600081815260cf6020526040902080546001600160a01b0319166001600160a01b03871617905560018281019082015b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48160010191508082106145745750505061167560008560cc54613d0e565b6060610c826001600160a01b03831660145b606060006145eb836002615284565b6145f6906002615271565b6001600160401b0381111561460d5761460d6149bf565b6040519080825280601f01601f191660200182016040528015614637576020820181803683370190505b509050600360fc1b81600081518110614652576146526152bd565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614681576146816152bd565b60200101906001600160f81b031916908160001a90535060006146a5846002615284565b6146b0906001615271565b90505b6001811115614728576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106146e4576146e46152bd565b1a60f81b8282815181106146fa576146fa6152bd565b60200101906001600160f81b031916908160001a90535060049490941c936147218161593a565b90506146b3565b5083156118455760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d92565b606083156147e65782516000036147df576001600160a01b0385163b6147df5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d92565b5081612b55565b612b558383614835565b600081815b8451811015612d955761482182868381518110614814576148146152bd565b602002602001015161485f565b91508061482d81615445565b9150506147f5565b8151156148455781518083602001fd5b8060405162461bcd60e51b8152600401610d929190614911565b600081831061487b576000828152602084905260409020611845565b6000838152602083905260409020611845565b6001600160e01b031981168114611f6e57600080fd5b6000602082840312156148b657600080fd5b81356118458161488e565b60005b838110156148dc5781810151838201526020016148c4565b50506000910152565b600081518084526148fd8160208601602086016148c1565b601f01601f19169290920160200192915050565b60208152600061184560208301846148e5565b60006020828403121561493657600080fd5b5035919050565b80356001600160a01b038116811461495457600080fd5b919050565b6000806040838503121561496c57600080fd5b6149758361493d565b946020939093013593505050565b60008060006060848603121561499857600080fd5b6149a18461493d565b92506149af6020850161493d565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156149fd576149fd6149bf565b604052919050565b60006001600160401b03821115614a1e57614a1e6149bf565b50601f01601f191660200190565b600082601f830112614a3d57600080fd5b8135614a50614a4b82614a05565b6149d5565b818152846020838601011115614a6557600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215614a9a57600080fd5b85356001600160401b03811115614ab057600080fd5b614abc88828901614a2c565b955050602086013593506040860135925060608601359150614ae06080870161493d565b90509295509295909350565b60008060408385031215614aff57600080fd5b50508035926020909101359150565b60008060408385031215614b2157600080fd5b82359150614b316020840161493d565b90509250929050565b80356001600160601b038116811461495457600080fd5b60008060408385031215614b6457600080fd5b614b6d8361493d565b9150614b3160208401614b3a565b60008083601f840112614b8d57600080fd5b5081356001600160401b03811115614ba457600080fd5b60208301915083602060c08302850101111561138457600080fd5b600080600060408486031215614bd457600080fd5b83356001600160401b03811115614bea57600080fd5b614bf686828701614b7b565b909790965060209590950135949350505050565b80356001600160801b038116811461495457600080fd5b600060208284031215614c3357600080fd5b61184582614c0a565b60006001600160401b03821115614c5557614c556149bf565b5060051b60200190565b600082601f830112614c7057600080fd5b81356020614c80614a4b83614c3c565b82815260059290921b84018101918181019086841115614c9f57600080fd5b8286015b84811015614cde5780356001600160401b03811115614cc25760008081fd5b614cd08986838b0101614a2c565b845250918301918301614ca3565b509695505050505050565b600082601f830112614cfa57600080fd5b81356020614d0a614a4b83614c3c565b82815260059290921b84018101918181019086841115614d2957600080fd5b8286015b84811015614cde57614d3e8161493d565b8352918301918301614d2d565b8035801515811461495457600080fd5b6000806000806000806000806000806000806101608d8f031215614d7e57600080fd5b614d878d614c0a565b9b506001600160401b0360208e01351115614da157600080fd5b614db18e60208f01358f01614a2c565b9a506001600160401b0360408e01351115614dcb57600080fd5b614ddb8e60408f01358f01614a2c565b9950614de960608e0161493d565b98506001600160401b0360808e01351115614e0357600080fd5b614e138e60808f01358f01614c5f565b9750614e2160a08e01614b3a565b9650614e2f60c08e01614c0a565b95506001600160401b0360e08e01351115614e4957600080fd5b614e598e60e08f01358f01614ce9565b9450614e686101008e0161493d565b93506001600160401b036101208e01351115614e8357600080fd5b614e948e6101208f01358f01614b7b565b9093509150614ea66101408e01614d4b565b90509295989b509295989b509295989b565b600060208284031215614eca57600080fd5b6118458261493d565b60008060408385031215614ee657600080fd5b82359150614b3160208401614d4b565b60008060408385031215614f0957600080fd5b614f128361493d565b9150614b3160208401614d4b565b60008083601f840112614f3257600080fd5b5081356001600160401b03811115614f4957600080fd5b6020830191508360208260051b850101111561138457600080fd5b60008060208385031215614f7757600080fd5b82356001600160401b03811115614f8d57600080fd5b614f9985828601614f20565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614ffa57603f19888603018452614fe88583516148e5565b94509285019290850190600101614fcc565b5092979650505050505050565b6000806000806080858703121561501d57600080fd5b6150268561493d565b93506150346020860161493d565b92506040850135915060608501356001600160401b0381111561505657600080fd5b61506287828801614a2c565b91505092959194509250565b60008060008060006080868803121561508657600080fd5b85356001600160401b0381111561509c57600080fd5b6150a888828901614f20565b9096509450506020860135925060408601359150614ae06060870161493d565b600080604083850312156150db57600080fd5b82356001600160401b038111156150f157600080fd5b6150fd85828601614ce9565b95602094909401359450505050565b60008060006060848603121561512157600080fd5b83356001600160401b038082111561513857600080fd5b61514487838801614a2c565b9450602086013591508082111561515a57600080fd5b61516687838801614a2c565b9350604086013591508082111561517c57600080fd5b5061518986828701614a2c565b9150509250925092565b600080604083850312156151a657600080fd5b6151af8361493d565b9150614b316020840161493d565b600181811c908216806151d157607f821691505b6020821081036151f157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610c8257610c826151f7565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b80820180821115610c8257610c826151f7565b8082028115828204841417610c8257610c826151f7565b6000826152b857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f821115610ec257600081815260208120601f850160051c810160208610156152fa5750805b601f850160051c820191505b81811015613d0657828155600101615306565b81516001600160401b03811115615332576153326149bf565b6153468161534084546151bd565b846152d3565b602080601f83116001811461537b57600084156153635750858301515b600019600386901b1c1916600185901b178555613d06565b600085815260208120601f198616915b828110156153aa5788860151825594840194600190910190840161538b565b50858210156153c85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808335601e198436030181126153ef57600080fd5b8301803591506001600160401b0382111561540957600080fd5b60200191503681900382131561138457600080fd5b82848237600083820160008152835161543b8183602088016148c1565b0195945050505050565b600060018201615457576154576151f7565b5060010190565b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b818110156154ae5784516001600160a01b031683529383019391830191600101615489565b509098975050505050505050565b600084516154ce8184602089016148c1565b8451908301906154e28183602089016148c1565b845191019061543b8183602088016148c1565b6000602080835260008454615509816151bd565b8084870152604060018084166000811461552a576001811461554457615572565b60ff1985168984015283151560051b890183019550615572565b896000528660002060005b8581101561556a5781548b820186015290830190880161554f565b8a0184019650505b509398975050505050505050565b60006020828403121561559257600080fd5b81516001600160401b038111156155a857600080fd5b8201601f810184136155b957600080fd5b80516155c7614a4b82614a05565b8181528560208385010111156155dc57600080fd5b613b348260208301602086016148c1565b803564ffffffffff8116811461495457600080fd5b803563ffffffff8116811461495457600080fd5b80356001600160701b038116811461495457600080fd5b6040808252818101849052600090606080840187845b888110156156d25764ffffffffff8061565b846155ed565b16845260208161566c8286016155ed565b16908501525061567d828601615602565b63ffffffff8082168786015280615695878601615602565b1686860152505060806001600160701b036156b1828501615616565b169084015260a0828101359084015260c09283019290910190600101615643565b5050809350505050826020830152949350505050565b600060c082840312156156fa57600080fd5b60405160c081018181106001600160401b038211171561571c5761571c6149bf565b604052615728836155ed565b8152615736602084016155ed565b602082015261574760408401615602565b604082015261575860608401615602565b606082015261576960808401615616565b608082015260a083013560a08201528091505092915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052602160045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516158918160178501602088016148c1565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516158c28160288401602088016148c1565b01602801949350505050565b600082516158e08184602087016148c1565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612d6f908301846148e5565b60006020828403121561592f57600080fd5b81516118458161488e565b600081615949576159496151f7565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564fd63b67fde00b77f1f54f050135a475665b815acd10a8e7fd785ba074846734aa2646970667358221220ae06ef7093372eeadecbb5f87c1369466b7e2beb7a96046ae78e07f589fe599064736f6c63430008110033
Deployed Bytecode
0x6080604052600436106103795760003560e01c806382b42c02116101cd578063b0fde7fb11610108578063ce4c61aa116100ab578063dedd76e71161007a578063dedd76e714610b4a578063e985e9c514610bd6578063effcf2b714610bf6578063f2fde38b14610c0b578063f86a352914610c2b57600080fd5b8063ce4c61aa14610ac1578063d539139314610ad6578063d547741f14610b0a578063d7818e2814610b2a57600080fd5b8063b0fde7fb146109de578063b3cc59db146109f8578063b88d4fde14610a0d578063bdc769eb14610a2d578063be66422114610a40578063bfccdaf714610a60578063c204642c14610a81578063c87b56dd14610aa157600080fd5b806395d89b411161017057806395d89b41146108e857806397f5cdcf146108fd578063a07c7ce414610913578063a217fddf14610935578063a22cb4651461094a578063a9fc664e1461096a578063aa8a67541461098a578063ac9650d8146109b157600080fd5b806382b42c02146107c5578063869d3bde146107e55780638c8ea8e6146107fa5780638cd90c32146108405780638da5cb5b146108795780638e021c061461089857806390411aca146108b357806391d14854146108c857600080fd5b80633f52af3c116102b85780636352211e1161025b578063715018a61161022a578063715018a61461075157806372c06f5a14610766578063743976a01461077b5780637f1fea591461079057806380420736146107b057600080fd5b80636352211e146106d1578063659b8b2a146106f15780636e49aa0a1461071157806370a082311461073157600080fd5b80633f52af3c146105bb57806341dfed3a146105db57806342842e0e146105f057806342966c68146106105780634e0b9df21461063057806351e85af614610650578063548e76821461066557806360659a921461068557600080fd5b806323b872dd1161032057806323b872dd146104ae578063248a9ca3146104ce5780632955a21d146104ff5780632a55205a146105125780632f2ff15d146105515780633540558a1461057157806336568abe146105935780633ccfd60b146105b357600080fd5b806301ffc9a71461037e5780630293741b146103b357806306fdde03146103d5578063081812fc146103ea578063095ea7b314610422578063098144d4146104445780630d705df61461046357806318160ddd1461048b575b600080fd5b34801561038a57600080fd5b5061039e6103993660046148a4565b610c42565b60405190151581526020015b60405180910390f35b3480156103bf57600080fd5b506103c8610c88565b6040516103aa9190614911565b3480156103e157600080fd5b506103c8610d1b565b3480156103f657600080fd5b5061040a610405366004614924565b610d2a565b6040516001600160a01b0390911681526020016103aa565b34801561042e57600080fd5b5061044261043d366004614959565b610db7565b005b34801561045057600080fd5b506101d2546001600160a01b031661040a565b34801561046f57600080fd5b506040805163657711f560e11b815260016020820152016103aa565b34801561049757600080fd5b506104a0610ec7565b6040519081526020016103aa565b3480156104ba57600080fd5b506104426104c9366004614983565b610ede565b3480156104da57600080fd5b506104a06104e9366004614924565b6000908152610100602052604090206001015490565b61044261050d366004614a82565b610f0f565b34801561051e57600080fd5b5061053261052d366004614aec565b6112dd565b604080516001600160a01b0390931683526020830191909152016103aa565b34801561055d57600080fd5b5061044261056c366004614b0e565b61138b565b34801561057d57600080fd5b506104a060008051602061597983398151915281565b34801561059f57600080fd5b506104426105ae366004614b0e565b6113b1565b61044261142f565b3480156105c757600080fd5b506104426105d6366004614b51565b6114af565b3480156105e757600080fd5b506104a0611530565b3480156105fc57600080fd5b5061044261060b366004614983565b611572565b34801561061c57600080fd5b506104a061062b366004614924565b61158d565b34801561063c57600080fd5b5061044261064b366004614bbf565b611635565b34801561065c57600080fd5b5061044261167b565b34801561067157600080fd5b50610442610680366004614c21565b611701565b34801561069157600080fd5b506101c8546106b1906001600160801b0380821691600160801b90041682565b604080516001600160801b039384168152929091166020830152016103aa565b3480156106dd57600080fd5b5061040a6106ec366004614924565b61178c565b3480156106fd57600080fd5b506101cd5461039e90610100900460ff1681565b34801561071d57600080fd5b5061044261072c366004614d5b565b61184c565b34801561073d57600080fd5b506104a061074c366004614eb8565b611b63565b34801561075d57600080fd5b50610442611bf3565b34801561077257600080fd5b50610442611c07565b34801561078757600080fd5b506103c8611c67565b34801561079c57600080fd5b506104426107ab366004614eb8565b611c77565b3480156107bc57600080fd5b50610442611d15565b3480156107d157600080fd5b506104426107e0366004614ed3565b611d8e565b3480156107f157600080fd5b506104a0611e79565b34801561080657600080fd5b506104a0610815366004614eb8565b6001600160a01b0316600090815260d36020526040902054600160601b90046001600160601b031690565b34801561084c57600080fd5b506104a061085b366004614b0e565b6101d060209081526000928352604080842090915290825290205481565b34801561088557600080fd5b50610196546001600160a01b031661040a565b3480156108a457600080fd5b506101cd5461039e9060ff1681565b3480156108bf57600080fd5b5060cc546104a0565b3480156108d457600080fd5b5061039e6108e3366004614b0e565b611ef7565b3480156108f457600080fd5b506103c8611f23565b34801561090957600080fd5b506104a060cc5481565b34801561091f57600080fd5b506101cd5461039e90600160b01b900460ff1681565b34801561094157600080fd5b506104a0600081565b34801561095657600080fd5b50610442610965366004614ef6565b611f32565b34801561097657600080fd5b50610442610985366004614eb8565b611f3d565b34801561099657600080fd5b506101cd5461040a906201000090046001600160a01b031681565b3480156109bd57600080fd5b506109d16109cc366004614f64565b611f71565b6040516103aa9190614fa5565b3480156109ea57600080fd5b5060d45461039e9060ff1681565b348015610a0457600080fd5b50610442612063565b348015610a1957600080fd5b50610442610a28366004615007565b6120ff565b610442610a3b36600461506e565b612131565b348015610a4c57600080fd5b50610442610a5b366004614eb8565b6122c0565b348015610a6c57600080fd5b506101d35461040a906001600160a01b031681565b348015610a8d57600080fd5b506104a0610a9c3660046150c8565b612353565b348015610aad57600080fd5b506103c8610abc366004614924565b61250f565b348015610acd57600080fd5b506104a06125a2565b348015610ae257600080fd5b506104a07ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b348015610b1657600080fd5b50610442610b25366004614b0e565b6125f7565b348015610b3657600080fd5b50610442610b4536600461510c565b61261d565b348015610b5657600080fd5b50610b6a610b65366004614924565b61278d565b6040516103aa9190600060c08201905064ffffffffff80845116835280602085015116602084015250604083015163ffffffff808216604085015280606086015116606085015250506001600160701b03608084015116608083015260a083015160a083015292915050565b348015610be257600080fd5b5061039e610bf1366004615193565b612861565b348015610c0257600080fd5b506103c861288f565b348015610c1757600080fd5b50610442610c26366004614eb8565b612933565b348015610c3757600080fd5b506104a06101d15481565b60006001600160e01b03198216632b435fdb60e21b1480610c7357506001600160e01b0319821663503e914d60e11b145b80610c825750610c82826129a9565b92915050565b60606101cb8054610c98906151bd565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc4906151bd565b8015610d115780601f10610ce657610100808354040283529160200191610d11565b820191906000526020600020905b815481529060010190602001808311610cf457829003601f168201915b5050505050905090565b606060ca8054610c98906151bd565b6000610d35826129ce565b610d9b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815260d160205260409020546001600160a01b031690565b6000610dc28261178c565b9050806001600160a01b0316836001600160a01b031603610e2f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610d92565b336001600160a01b0382161480610e4b5750610e4b8133612861565b610eb85760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610d92565b610ec28383612a01565b505050565b600060cd5460cc54610ed9919061520d565b905090565b610ee83382612a93565b610f045760405162461bcd60e51b8152600401610d9290615220565b610ec2838383612b5d565b826000108015610f20575060148311155b610f3d576040516332b4cb2160e21b815260040160405180910390fd5b6000610f47611e79565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a0820152929350610fda9066031742a8f4600090615271565b9050610fe68682615284565b341461100557604051632c1d501360e11b815260040160405180910390fd5b8660000361102657604051633ab3447f60e11b815260040160405180910390fd5b60cc54606083015163ffffffff1681106110525760405162491a1760e81b815260040160405180910390fd5b60a08301511561107557604051630268975d60e51b815260040160405180910390fd5b6101cd54610100900460ff1661115057600061109386898b8a612cf7565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb716110b4828c612d79565b6001600160a01b0316146110db576040516332c3ce2560e11b815260040160405180910390fd5b6001600160a01b038616600090815260d36020526040902054600160c01b90046001600160401b031689116111235760405163dc5a682560e01b815260040160405180910390fd5b61112e89604b615271565b43111561114e57604051639e8c142f60e01b815260040160405180910390fd5b505b600061116086868a85888c612d9d565b905061116d86828b612f32565b6000731075266c86cd9b1b021af63e09102af3d2dcbdb76111958366031742a8f46000615284565b604051600081818185875af1925050503d80600081146111d1576040519150601f19603f3d011682016040523d82523d6000602084013e6111d6565b606091505b50509050806111f857604051635579a42f60e11b815260040160405180910390fd5b888210156112865760008461120d848c61520d565b6112179190615284565b604051909150600090339083908381818185875af1925050503d806000811461125c576040519150601f19603f3d011682016040523d82523d6000602084013e611261565b606091505b505090508061128357604051635579a42f60e11b815260040160405180910390fd5b50505b604080516001600160a01b0389168152602081018890529081018390527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f9060600160405180910390a15050505050505050505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916113525750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090611371906001600160601b031687615284565b61137b919061529b565b91519350909150505b9250929050565b600082815261010060205260409020600101546113a781612f4d565b610ec28383612f57565b6001600160a01b03811633146114215760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610d92565b61142b8282612fde565b5050565b600061143a81612f4d565b6101ce546040516000916001600160a01b03169047908381818185875af1925050503d8060008114611488576040519150601f19603f3d011682016040523d82523d6000602084013e61148d565b606091505b505090508061142b57604051635579a42f60e11b815260040160405180910390fd5b6114ba600033611ef7565b6114d757604051634e8df0bf60e01b815260040160405180910390fd5b6114e18282613046565b604080516001600160a01b03841681526001600160601b03831660208201527fef5955f7902e6696c028804c62be1c24a0f98d9d30de5c31c83fa7f8b5c15c6f91015b60405180910390a15050565b600066031742a8f460006101cf6000611547611e79565b8152602081019190915260400160002054610ed99190600160901b90046001600160701b0316615271565b610ec2838383604051806020016040528060008152506120ff565b6101cd54600090600160b01b900460ff166115bb5760405163c7c39e4f60e01b815260040160405180910390fd5b6115cd6115c78361178c565b33612861565b806115f157506115dc8261178c565b6001600160a01b0316336001600160a01b0316145b8061160c57503361160183610d2a565b6001600160a01b0316145b6116285760405162ccfedb60e31b815260040160405180910390fd5b61163182613143565b5090565b61164d60008051602061597983398151915233611ef7565b61166a57604051634e8df0bf60e01b815260040160405180910390fd5b611675838383613260565b50505050565b611686600033611ef7565b6116a357604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156116c85760405163ddff29e960e01b815260040160405180910390fd5b6101cd805460ff191660011790556040517f31d1c0a3af6e15844ff9c1bf6201a5cf123137eb2fb3eeb96861a436d49cd25f90600090a1565b61171960008051602061597983398151915233611ef7565b61173657604051634e8df0bf60e01b815260040160405180910390fd5b6101c880546001600160801b03908116600160801b918416918202179091556040519081527f8c8298dd23c82a4aa45d27f480c6ce0aa2588e13df0b2fe2c827ca4a6836a5f8906020015b60405180910390a150565b6000611797826129ce565b6117f45760405162461bcd60e51b815260206004820152602860248201527f45524337323178797a3a20517565727920666f72206e6f6e206578697374656e6044820152677420746f6b656e2160c01b6064820152608401610d92565b600082815260ce602052604090205482906001600160a01b031680611845575b50600081815260cf60205260409020546001600160a01b0316801561183a579392505050565b816001019150611814565b9392505050565b600054610100900460ff161580801561186c5750600054600160ff909116105b806118865750303b158015611886575060005460ff166001145b6118e95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d92565b6000805460ff19166001179055801561190c576000805461ff0019166101001790555b6001600160a01b038a166119335760405163d92e233d60e01b815260040160405180910390fd5b885160031461194157600080fd5b855160021461194f57600080fd5b6119598c8c6136ef565b611961613720565b611969613720565b61197285613747565b604080518082019091526001600160801b038e81168083529089166020909201829052600160801b909102176101c8556101cd805462010000600160b01b031916620100006001600160a01b038d1602179055885189906000906119d8576119d86152bd565b60200260200101516101cb90816119ef9190615319565b5088600181518110611a0357611a036152bd565b60200260200101516101c99081611a1a9190615319565b5088600281518110611a2e57611a2e6152bd565b60200260200101516101ca9081611a459190615319565b5060d4805460ff191683151517905585518690600090611a6757611a676152bd565b60200260200101516101ce60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611aba86600181518110611aac57611aac6152bd565b602002602001015189613046565b611ac5600086612f57565b611add60008051602061597983398151915286612f57565b8215611af157611aef84846000613260565b505b611b0e73721c002b0059009a671d00ad1700c9748146cd1b61379a565b8015611b54576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b60006001600160a01b038216611bce5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610d92565b506001600160a01b0316600090815260d360205260409020546001600160601b031690565b611bfb613840565b611c056000613747565b565b611c12600033611ef7565b611c2f57604051634e8df0bf60e01b815260040160405180910390fd5b6101d2546001600160a01b0316611c5d57611c0573721c002b0059009a671d00ad1700c9748146cd1b61379a565b611c05600061379a565b60606101c98054610c98906151bd565b611c82600033611ef7565b611c9f57604051634e8df0bf60e01b815260040160405180910390fd5b6001600160a01b038116611cc65760405163d92e233d60e01b815260040160405180910390fd5b6101ce80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd45e158b56e768c1167267f8516bcf96348071775faded3c9216b60855d873de90602001611781565b611d20600033611ef7565b611d3d57604051634e8df0bf60e01b815260040160405180910390fd5b6101cd54610100900460ff1615611d5357600080fd5b6101cd805461ff0019166101001790556040517ffbbcc58867e8fad1d9f72f1b991660f5ec5e4e068374aa442b8604eef182b63990600090a1565b6101d3546001600160a01b03163314611dd85760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610d92565b60008281526101d4602052604090205460ff1615158115151461142b5760008281526101d460205260409020805460ff19168215801591909117909155611e49576040518281527f032bc66be43dbccb7487781d168eb7bda224628a3b2c3388bdf69b532a3a161190602001611524565b6040518281527ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290602001611524565b6101d1546000905b8015611edd576000190160008181526101cf602052604090205464ffffffffff164210801590611ece575060008181526101cf6020526040902054600160281b900464ffffffffff164211155b15611ed857919050565b611e81565b5060405163b7b2409760e01b815260040160405180910390fd5b6000918252610100602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060cb8054610c98906151bd565b61142b33838361389b565b611f48600033611ef7565b611f6557604051634e8df0bf60e01b815260040160405180910390fd5b611f6e8161379a565b50565b604080516000815260208101909152606090826001600160401b03811115611f9b57611f9b6149bf565b604051908082528060200260200182016040528015611fce57816020015b6060815260200190600190039081611fb95790505b50915060005b8381101561205b5761202b30868684818110611ff257611ff26152bd565b905060200281019061200491906153d8565b856040516020016120179392919061541e565b604051602081830303815290604052613969565b83828151811061203d5761203d6152bd565b6020026020010181905250808061205390615445565b915050611fd4565b505092915050565b61207b60008051602061597983398151915233611ef7565b61209857604051634e8df0bf60e01b815260040160405180910390fd5b6101cd805460ff600160b01b808304821615810260ff60b01b1990931692909217928390556040517f6ae3331a8bd1998bb8fd9d3d02b720f4862fb43e7586d302ba44e3923cea922d936120f59390049091161515815260200190565b60405180910390a1565b6121093383612a93565b6121255760405162461bcd60e51b8152600401610d9290615220565b6116758484848461398e565b826000108015612142575060148311155b61215f576040516332b4cb2160e21b815260040160405180910390fd5b6000612169611e79565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506121fc9066031742a8f4600090615271565b90506122088682615284565b341461222757604051632c1d501360e11b815260040160405180910390fd5b60a082015161224957604051637904b60360e11b815260040160405180910390fd5b60cc54606083015163ffffffff1681106122755760405162491a1760e81b815260040160405180910390fd5b61228689898560a00151888a6139c1565b6122a3576040516334ce9a3d60e11b815260040160405180910390fd5b60006122b386868a85888c612d9d565b905061116d868243612f32565b6122cb600033611ef7565b6122e857604051634e8df0bf60e01b815260040160405180910390fd5b6101d354604080516001600160a01b03928316815291831660208301527f506563f582a1103ea9c5c3797795f524f078d85ab1c1d15b96d812667b5c94c6910160405180910390a16101d380546001600160a01b0319166001600160a01b0392909216919091179055565b60006014821115612377576040516332b4cb2160e21b815260040160405180910390fd5b81600003612398576040516332b4cb2160e21b815260040160405180910390fd5b6014835111156123bb576040516349a3ec1560e11b815260040160405180910390fd5b82516000036123dd576040516349a3ec1560e11b815260040160405180910390fd5b6123f560008051602061597983398151915233611ef7565b15801561242957506124277ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933611ef7565b155b1561244757604051634e8df0bf60e01b815260040160405180910390fd5b60008284516124569190615284565b60cc546124639190615271565b6101c8549091506001600160801b03168111156124935760405163a67c036160e01b815260040160405180910390fd5b60005b84518110156124cc576124c48582815181106124b4576124b46152bd565b6020026020010151856000612f32565b600101612496565b507f74074e463a8efcb02859ade8892e3934bd28eb75c9d1e6085a40c474088e2bfe8382866040516125009392919061545e565b60405180910390a19392505050565b606061251a826129ce565b6125375760405163677510db60e11b815260040160405180910390fd5b600061254161288f565b9050600061254d611c67565b90506000612559610c88565b9050825160000361256c57949350505050565b828261257787613a38565b604051602001612589939291906154bc565b6040516020818303038152906040529350505050919050565b6101d1546000905b80156125ef576000190160008181526101cf6020526040902054600160281b900464ffffffffff164211156125ea576125e4816001615271565b91505090565b6125aa565b506000905090565b6000828152610100602052604090206001015461261381612f4d565b610ec28383612fde565b61263560008051602061597983398151915233611ef7565b61265257604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156126775760405163ddff29e960e01b815260040160405180910390fd5b6000612684338484613aca565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb716126a58286612d79565b6001600160a01b0316146126cc576040516332c3ce2560e11b815260040160405180910390fd5b82511561271b576101ca6126e08482615319565b507ff5e721c51327df71720f204c71b46bc26bcafb44db5012739c85814c7862f6c06101ca60405161271291906154f5565b60405180910390a15b815115611675576101cc61272f8382615319565b506040805160208101909152600081526101c99061274d9082615319565b507f8eca6ea708f9bc34439b72366aa672afc86bb8b1294f1ba9637945c5dab8ea746101cc60405161277f91906154f5565b60405180910390a150505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091526101d15482106127e2576040516327e7ab7d60e11b815260040160405180910390fd5b5060009081526101cf6020908152604091829020825160c081018452815464ffffffffff8082168352600160281b82041693820193909352600160501b830463ffffffff90811694820194909452600160701b83049093166060840152600160901b9091046001600160701b031660808301526001015460a082015290565b6001600160a01b03918216600090815260d26020908152604080832093909416825291909152205460ff1690565b60606101cc805461289f906151bd565b9050600003612925576101cd5460405163511113e560e01b8152620100009091046001600160a01b03169063511113e5906128e0906101ca906004016154f5565b600060405180830381865afa1580156128fd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ed99190810190615580565b6101cc8054610c98906151bd565b61293b613840565b6001600160a01b0381166129a05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d92565b611f6e81613747565b60006001600160e01b03198216637965db0b60e01b1480610c825750610c8282613b3d565b600081815260d0602052604081205460ff16156129ed57506000919050565b816000108015610c8257505060cc54101590565b600081815260d160205260409020546001600160a01b039081169083168114610ec257600082815260d16020526040902080546001600160a01b0319166001600160a01b0385169081179091558290612a598261178c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000612a9e826129ce565b612aff5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610d92565b6000612b0a8361178c565b9050806001600160a01b0316846001600160a01b03161480612b455750836001600160a01b0316612b3a84610d2a565b6001600160a01b0316145b80612b555750612b558185612861565b949350505050565b826001600160a01b0316612b708261178c565b6001600160a01b031614612bd45760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610d92565b6001600160a01b038216612c365760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610d92565b612c41838383613b98565b612c4c600082612a01565b6001600160a01b03838116600081815260d36020908152604080832080546001600160601b03198082166001600160601b039283166000190183161790925595881680855282852080549283169288166001019097169190911790955585835260ce90915280822080546001600160a01b0319168517905551849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610ec2838383613d0e565b604080517f5b174e00b853ebb074ee5cb5d23ca67a264896e5670f923ac103fccad5232b5560208201526001600160a01b03861691810191909152606081018490526080810183905260a081018290526000908190612d6f9060c0015b60405160208183030381529060405280519060200120613d7c565b9695505050505050565b6000806000612d888585613e44565b91509150612d9581613e86565b509392505050565b6001600160a01b038616600081815260d360209081526040808320548984526101d083528184209484529390915280822054908501519192600160601b90046001600160601b03169163ffffffff1615612e3f57846040015163ffffffff168110612e1b57604051632f18066d60e01b815260040160405180910390fd5b846040015163ffffffff168782011115612e3f5780856040015163ffffffff160396505b6101c854600160801b90046001600160801b03168015612e8957808310612e7957604051632f18066d60e01b815260040160405180910390fd5b808884011115612e895782810397505b856060015163ffffffff168888011115612ead5786866060015163ffffffff160397505b600085118015612ec657506101cd54610100900460ff16155b15612efb57848210612eeb57604051632f18066d60e01b815260040160405180910390fd5b848883011115612efb5781850397505b5060008881526101d0602090815260408083206001600160a01b038d16845290915290209087019055508490509695505050505050565b610ec283836040518060200160405280600081525084613fcb565b611f6e8133613fe5565b612f618282611ef7565b61142b576000828152610100602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612f9a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612fe88282611ef7565b1561142b576000828152610100602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6127106001600160601b03821611156130b45760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610d92565b6001600160a01b03821661310a5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610d92565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b61314c816129ce565b6131a85760405162461bcd60e51b815260206004820152602760248201527f45524337323178797a3a20517565727920666f72206e6f6e6578697374656e7460448201526620746f6b656e2160c81b6064820152608401610d92565b60006131b38261178c565b90506131c181600084613b98565b6131cc600083612a01565b6001600160a01b038116600081815260d36020908152604080832080546001600160601b031981166001600160601b039182166000190190911617905585835260d0909152808220805460ff1916600190811790915560cd80549091019055518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a461142b81600084613d0e565b6000828161326c6125a2565b90506014821115613290576040516373c2b52560e11b815260040160405180910390fd5b6101d15480158015906132a257508185105b156132c0576040516344ca163560e11b815260040160405180910390fd5b808511156132e1576040516307cc4d8f60e01b815260040160405180910390fd5b6132ec601483615271565b6132f68487615271565b11156133155760405163c1eae7bb60e01b815260040160405180910390fd5b60008581526101cf602052604081205464ffffffffff16908490036133a2574281116133545760405163bf4a806960e01b815260040160405180910390fd5b6101d18690556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b9061338e908a908a908a9061562d565b60405180910390a185945050505050611845565b6000888860008181106133b7576133b76152bd565b905060c002018036038101906133cd91906156e8565b905060cc54816060015163ffffffff1610156133fc57604051630e93fda160e21b815260040160405180910390fd5b42821115801561340b57508115155b801561341957506101d15487105b1561347657805164ffffffffff16821461344657604051632ca4094f60e21b815260040160405180910390fd5b42816020015164ffffffffff16116134715760405163804491f960e01b815260040160405180910390fd5b6134a1565b42816000015164ffffffffff16116134a15760405163667e606760e11b815260040160405180910390fd5b868581015b8882146134da578a8a8a84038181106134c1576134c16152bd565b905060c002018036038101906134d791906156e8565b92505b6101c85460608401516001600160801b0390911663ffffffff90911611156135155760405163bccc7e2360e01b815260040160405180910390fd5b826000015164ffffffffff16836020015164ffffffffff161161354b57604051631131dc6b60e11b815260040160405180910390fd5b81156135db57600019820160009081526101cf6020526040902054606084015164ffffffffff600160281b8304169163ffffffff600160701b9091048116911610156135b1574281106135b1576040516357be1d0d60e01b815260040160405180910390fd5b835164ffffffffff1681106135d95760405163064f2b0760e31b815260040160405180910390fd5b505b60008281526101cf60209081526040918290208551815492870151938701516060880151608089015164ffffffffff93841669ffffffffffffffffffff1990961695909517600160281b93909616929092029490941767ffffffffffffffff60501b1916600160501b63ffffffff9586160263ffffffff60701b191617600160701b9490911693909302929092176001600160901b0316600160901b6001600160701b039092169190910217815560a0840151600191820155909101908082106134a6576101d18190556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b906136d9908d908d908d9061562d565b60405180910390a19a9950505050505050505050565b600054610100900460ff166137165760405162461bcd60e51b8152600401610d9290615782565b61142b828261403e565b600054610100900460ff16611c055760405162461bcd60e51b8152600401610d9290615782565b61019680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116803b151590158015906137b5575080155b156137d3576040516332483afb60e01b815260040160405180910390fd5b6101d254604080516001600160a01b03928316815291841660208301527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a16101d280546001600160a01b0319166001600160a01b03841617905561142b8261407e565b610196546001600160a01b03163314611c055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d92565b816001600160a01b0316836001600160a01b0316036138fc5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d92565b6001600160a01b03838116600081815260d26020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60606118458383604051806060016040528060278152602001615952602791396140f8565b613999848484612b5d565b6139a584848484614166565b6116755760405162461bcd60e51b8152600401610d92906157cd565b6000612d6f868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040516001600160601b0319606089901b16602082015260348101879052889250605401905060405160208183030381529060405280519060200120614264565b60606000613a458361427a565b60010190506000816001600160401b03811115613a6457613a646149bf565b6040519080825280601f01601f191660200182016040528015613a8e576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613a9857509392505050565b600080613b347f35fa4dcabfcae3f1b6e0c4c1ac43df02ba9cb39e2dcdc3d3f1b92a38118e33548686805190602001208680519060200120604051602001612d5494939291909384526001600160a01b039290921660208401526040830152606082015260800190565b95945050505050565b60006001600160e01b0319821663152a902d60e11b1480613b6e57506001600160e01b031982166380ac58cd60e01b145b80613b8957506001600160e01b03198216635b5e139f60e01b145b80610c825750610c8282614352565b6001600160a01b0383161580613bb557506001600160a01b038216155b15613bbf57505050565b60d45460ff1615613be3576040516328f11eb160e21b815260040160405180910390fd5b6101d3546101d2546001600160a01b039182169116338215613c7b57826001600160a01b0316816001600160a01b031614613c7b5760405163657711f560e11b81526001600160a01b0384169063caee23ea90613c4a9084908a908a908a9060040161581f565b60006040518083038186803b158015613c6257600080fd5b505afa158015613c76573d6000803e3d6000fd5b505050505b6001600160a01b03821615613d0657816001600160a01b0316816001600160a01b031614613d065760405163657711f560e11b81526001600160a01b0383169063caee23ea90613cd59084908a908a908a9060040161581f565b60006040518083038186803b158015613ced57600080fd5b505afa158015613d01573d6000803e3d6000fd5b505050505b505050505050565b60008181526101d4602052604090205460ff1615610ec25760008181526101d4602052604090819020805460ff19169055517ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290613d6f9083815260200190565b60405180910390a1505050565b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f36cb08f6aafe2399767bf40e9642429d7535f40e61bd81428cad09095c5d337d918101919091527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a0820152600090819060c001604051602081830303815290604052805190602001209050611845818460405161190160f01b8152600281019290925260228201526042902090565b6000808251604103613e7a5760208301516040840151606085015160001a613e6e87828585614387565b94509450505050611384565b50600090506002611384565b6000816004811115613e9a57613e9a615849565b03613ea25750565b6001816004811115613eb657613eb6615849565b03613efe5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610d92565b6002816004811115613f1257613f12615849565b03613f5f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610d92565b6003816004811115613f7357613f73615849565b03611f6e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610d92565b613fd6848483614441565b6139a560008560cc5485614166565b613fef8282611ef7565b61142b57613ffc816145ca565b6140078360206145dc565b60405160200161401892919061585f565b60408051601f198184030181529082905262461bcd60e51b8252610d9291600401614911565b600054610100900460ff166140655760405162461bcd60e51b8152600401610d9290615782565b60ca6140718382615319565b5060cb610ec28282615319565b6001600160a01b03811615611f6e57803b801561142b5760405163fb2de5d760e01b81523060048201526102d160248201526001600160a01b0383169063fb2de5d790604401600060405180830381600087803b1580156140de57600080fd5b505af19250505080156140ef575060015b1561142b575050565b6060600080856001600160a01b03168560405161411591906158ce565b600060405180830381855af49150503d8060008114614150576040519150601f19603f3d011682016040523d82523d6000602084013e614155565b606091505b5091509150612d6f86838387614777565b60006001600160a01b0384163b1561425c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906141aa9033908990889088906004016158ea565b6020604051808303816000875af19250505080156141e5575060408051601f3d908101601f191682019092526141e29181019061591d565b60015b614242573d808015614213576040519150601f19603f3d011682016040523d82523d6000602084013e614218565b606091505b50805160000361423a5760405162461bcd60e51b8152600401610d92906157cd565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612b55565b506001612b55565b60008261427185846147f0565b14949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106142b95772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106142e5576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061430357662386f26fc10000830492506010015b6305f5e100831061431b576305f5e100830492506008015b612710831061432f57612710830492506004015b60648310614341576064830492506002015b600a8310610c825760010192915050565b60006001600160e01b0319821663152a902d60e11b1480610c8257506301ffc9a760e01b6001600160e01b0319831614610c82565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156143b45750600090506003614438565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614408573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661443157600060019250925050614438565b9150600090505b94509492505050565b6001600160a01b0383166144975760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d92565b6144a560008460cc54613b98565b60cc8054838101918290556001600160a01b038516600090815260d36020526040902080546001600160601b038082168701166001600160601b0319909116179055908215614544576001600160a01b038516600090815260d36020526040902080546001600160601b03808216600160601b92839004821688019091169091026001600160c01b031617600160c01b6001600160401b038616021790555b600081815260cf6020526040902080546001600160a01b0319166001600160a01b03871617905560018281019082015b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48160010191508082106145745750505061167560008560cc54613d0e565b6060610c826001600160a01b03831660145b606060006145eb836002615284565b6145f6906002615271565b6001600160401b0381111561460d5761460d6149bf565b6040519080825280601f01601f191660200182016040528015614637576020820181803683370190505b509050600360fc1b81600081518110614652576146526152bd565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614681576146816152bd565b60200101906001600160f81b031916908160001a90535060006146a5846002615284565b6146b0906001615271565b90505b6001811115614728576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106146e4576146e46152bd565b1a60f81b8282815181106146fa576146fa6152bd565b60200101906001600160f81b031916908160001a90535060049490941c936147218161593a565b90506146b3565b5083156118455760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d92565b606083156147e65782516000036147df576001600160a01b0385163b6147df5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d92565b5081612b55565b612b558383614835565b600081815b8451811015612d955761482182868381518110614814576148146152bd565b602002602001015161485f565b91508061482d81615445565b9150506147f5565b8151156148455781518083602001fd5b8060405162461bcd60e51b8152600401610d929190614911565b600081831061487b576000828152602084905260409020611845565b6000838152602083905260409020611845565b6001600160e01b031981168114611f6e57600080fd5b6000602082840312156148b657600080fd5b81356118458161488e565b60005b838110156148dc5781810151838201526020016148c4565b50506000910152565b600081518084526148fd8160208601602086016148c1565b601f01601f19169290920160200192915050565b60208152600061184560208301846148e5565b60006020828403121561493657600080fd5b5035919050565b80356001600160a01b038116811461495457600080fd5b919050565b6000806040838503121561496c57600080fd5b6149758361493d565b946020939093013593505050565b60008060006060848603121561499857600080fd5b6149a18461493d565b92506149af6020850161493d565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156149fd576149fd6149bf565b604052919050565b60006001600160401b03821115614a1e57614a1e6149bf565b50601f01601f191660200190565b600082601f830112614a3d57600080fd5b8135614a50614a4b82614a05565b6149d5565b818152846020838601011115614a6557600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215614a9a57600080fd5b85356001600160401b03811115614ab057600080fd5b614abc88828901614a2c565b955050602086013593506040860135925060608601359150614ae06080870161493d565b90509295509295909350565b60008060408385031215614aff57600080fd5b50508035926020909101359150565b60008060408385031215614b2157600080fd5b82359150614b316020840161493d565b90509250929050565b80356001600160601b038116811461495457600080fd5b60008060408385031215614b6457600080fd5b614b6d8361493d565b9150614b3160208401614b3a565b60008083601f840112614b8d57600080fd5b5081356001600160401b03811115614ba457600080fd5b60208301915083602060c08302850101111561138457600080fd5b600080600060408486031215614bd457600080fd5b83356001600160401b03811115614bea57600080fd5b614bf686828701614b7b565b909790965060209590950135949350505050565b80356001600160801b038116811461495457600080fd5b600060208284031215614c3357600080fd5b61184582614c0a565b60006001600160401b03821115614c5557614c556149bf565b5060051b60200190565b600082601f830112614c7057600080fd5b81356020614c80614a4b83614c3c565b82815260059290921b84018101918181019086841115614c9f57600080fd5b8286015b84811015614cde5780356001600160401b03811115614cc25760008081fd5b614cd08986838b0101614a2c565b845250918301918301614ca3565b509695505050505050565b600082601f830112614cfa57600080fd5b81356020614d0a614a4b83614c3c565b82815260059290921b84018101918181019086841115614d2957600080fd5b8286015b84811015614cde57614d3e8161493d565b8352918301918301614d2d565b8035801515811461495457600080fd5b6000806000806000806000806000806000806101608d8f031215614d7e57600080fd5b614d878d614c0a565b9b506001600160401b0360208e01351115614da157600080fd5b614db18e60208f01358f01614a2c565b9a506001600160401b0360408e01351115614dcb57600080fd5b614ddb8e60408f01358f01614a2c565b9950614de960608e0161493d565b98506001600160401b0360808e01351115614e0357600080fd5b614e138e60808f01358f01614c5f565b9750614e2160a08e01614b3a565b9650614e2f60c08e01614c0a565b95506001600160401b0360e08e01351115614e4957600080fd5b614e598e60e08f01358f01614ce9565b9450614e686101008e0161493d565b93506001600160401b036101208e01351115614e8357600080fd5b614e948e6101208f01358f01614b7b565b9093509150614ea66101408e01614d4b565b90509295989b509295989b509295989b565b600060208284031215614eca57600080fd5b6118458261493d565b60008060408385031215614ee657600080fd5b82359150614b3160208401614d4b565b60008060408385031215614f0957600080fd5b614f128361493d565b9150614b3160208401614d4b565b60008083601f840112614f3257600080fd5b5081356001600160401b03811115614f4957600080fd5b6020830191508360208260051b850101111561138457600080fd5b60008060208385031215614f7757600080fd5b82356001600160401b03811115614f8d57600080fd5b614f9985828601614f20565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614ffa57603f19888603018452614fe88583516148e5565b94509285019290850190600101614fcc565b5092979650505050505050565b6000806000806080858703121561501d57600080fd5b6150268561493d565b93506150346020860161493d565b92506040850135915060608501356001600160401b0381111561505657600080fd5b61506287828801614a2c565b91505092959194509250565b60008060008060006080868803121561508657600080fd5b85356001600160401b0381111561509c57600080fd5b6150a888828901614f20565b9096509450506020860135925060408601359150614ae06060870161493d565b600080604083850312156150db57600080fd5b82356001600160401b038111156150f157600080fd5b6150fd85828601614ce9565b95602094909401359450505050565b60008060006060848603121561512157600080fd5b83356001600160401b038082111561513857600080fd5b61514487838801614a2c565b9450602086013591508082111561515a57600080fd5b61516687838801614a2c565b9350604086013591508082111561517c57600080fd5b5061518986828701614a2c565b9150509250925092565b600080604083850312156151a657600080fd5b6151af8361493d565b9150614b316020840161493d565b600181811c908216806151d157607f821691505b6020821081036151f157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610c8257610c826151f7565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b80820180821115610c8257610c826151f7565b8082028115828204841417610c8257610c826151f7565b6000826152b857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f821115610ec257600081815260208120601f850160051c810160208610156152fa5750805b601f850160051c820191505b81811015613d0657828155600101615306565b81516001600160401b03811115615332576153326149bf565b6153468161534084546151bd565b846152d3565b602080601f83116001811461537b57600084156153635750858301515b600019600386901b1c1916600185901b178555613d06565b600085815260208120601f198616915b828110156153aa5788860151825594840194600190910190840161538b565b50858210156153c85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808335601e198436030181126153ef57600080fd5b8301803591506001600160401b0382111561540957600080fd5b60200191503681900382131561138457600080fd5b82848237600083820160008152835161543b8183602088016148c1565b0195945050505050565b600060018201615457576154576151f7565b5060010190565b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b818110156154ae5784516001600160a01b031683529383019391830191600101615489565b509098975050505050505050565b600084516154ce8184602089016148c1565b8451908301906154e28183602089016148c1565b845191019061543b8183602088016148c1565b6000602080835260008454615509816151bd565b8084870152604060018084166000811461552a576001811461554457615572565b60ff1985168984015283151560051b890183019550615572565b896000528660002060005b8581101561556a5781548b820186015290830190880161554f565b8a0184019650505b509398975050505050505050565b60006020828403121561559257600080fd5b81516001600160401b038111156155a857600080fd5b8201601f810184136155b957600080fd5b80516155c7614a4b82614a05565b8181528560208385010111156155dc57600080fd5b613b348260208301602086016148c1565b803564ffffffffff8116811461495457600080fd5b803563ffffffff8116811461495457600080fd5b80356001600160701b038116811461495457600080fd5b6040808252818101849052600090606080840187845b888110156156d25764ffffffffff8061565b846155ed565b16845260208161566c8286016155ed565b16908501525061567d828601615602565b63ffffffff8082168786015280615695878601615602565b1686860152505060806001600160701b036156b1828501615616565b169084015260a0828101359084015260c09283019290910190600101615643565b5050809350505050826020830152949350505050565b600060c082840312156156fa57600080fd5b60405160c081018181106001600160401b038211171561571c5761571c6149bf565b604052615728836155ed565b8152615736602084016155ed565b602082015261574760408401615602565b604082015261575860608401615602565b606082015261576960808401615616565b608082015260a083013560a08201528091505092915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052602160045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516158918160178501602088016148c1565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516158c28160288401602088016148c1565b01602801949350505050565b600082516158e08184602087016148c1565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612d6f908301846148e5565b60006020828403121561592f57600080fd5b81516118458161488e565b600081615949576159496151f7565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564fd63b67fde00b77f1f54f050135a475665b815acd10a8e7fd785ba074846734aa2646970667358221220ae06ef7093372eeadecbb5f87c1369466b7e2beb7a96046ae78e07f589fe599064736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.