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) public 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":"","type":"uint256"}],"name":"tokenLockedByCustomValidator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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
60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615a1a80620000f36000396000f3fe6080604052600436106103945760003560e01c806382b42c02116101e8578063b3cc59db11610108578063d5391393116100ab578063e985e9c51161007a578063e985e9c514610bf1578063effcf2b714610c11578063f2fde38b14610c26578063f71236c414610c46578063f86a352914610c7757600080fd5b8063d539139314610af1578063d547741f14610b25578063d7818e2814610b45578063dedd76e714610b6557600080fd5b8063b3cc59db14610a13578063b88d4fde14610a28578063bdc769eb14610a48578063be66422114610a5b578063bfccdaf714610a7b578063c204642c14610a9c578063c87b56dd14610abc578063ce4c61aa14610adc57600080fd5b806395d89b411161018b578063a22cb4651161015a578063a22cb46514610965578063a9fc664e14610985578063aa8a6754146109a5578063ac9650d8146109cc578063b0fde7fb146109f957600080fd5b806395d89b411461090357806397f5cdcf14610918578063a07c7ce41461092e578063a217fddf1461095057600080fd5b806382b42c02146107e0578063869d3bde146108005780638c8ea8e6146108155780638cd90c321461085b5780638da5cb5b146108945780638e021c06146108b357806390411aca146108ce57806391d14854146108e357600080fd5b80633f52af3c116102d35780636352211e11610276578063715018a611610245578063715018a61461076c57806372c06f5a14610781578063743976a0146107965780637f1fea59146107ab57806380420736146107cb57600080fd5b80636352211e146106ec578063659b8b2a1461070c5780636e49aa0a1461072c57806370a082311461074c57600080fd5b80633f52af3c146105d657806341dfed3a146105f657806342842e0e1461060b57806342966c681461062b5780634e0b9df21461064b57806351e85af61461066b578063548e76821461068057806360659a92146106a057600080fd5b806323b872dd1161033b57806323b872dd146104c9578063248a9ca3146104e95780632955a21d1461051a5780632a55205a1461052d5780632f2ff15d1461056c5780633540558a1461058c57806336568abe146105ae5780633ccfd60b146105ce57600080fd5b806301ffc9a7146103995780630293741b146103ce57806306fdde03146103f0578063081812fc14610405578063095ea7b31461043d578063098144d41461045f5780630d705df61461047e57806318160ddd146104a6575b600080fd5b3480156103a557600080fd5b506103b96103b43660046148f0565b610c8e565b60405190151581526020015b60405180910390f35b3480156103da57600080fd5b506103e3610cd4565b6040516103c5919061495d565b3480156103fc57600080fd5b506103e3610d67565b34801561041157600080fd5b50610425610420366004614970565b610d76565b6040516001600160a01b0390911681526020016103c5565b34801561044957600080fd5b5061045d6104583660046149a5565b610e03565b005b34801561046b57600080fd5b506101d2546001600160a01b0316610425565b34801561048a57600080fd5b506040805163657711f560e11b815260016020820152016103c5565b3480156104b257600080fd5b506104bb610f13565b6040519081526020016103c5565b3480156104d557600080fd5b5061045d6104e43660046149cf565b610f2a565b3480156104f557600080fd5b506104bb610504366004614970565b6000908152610100602052604090206001015490565b61045d610528366004614ace565b610f5b565b34801561053957600080fd5b5061054d610548366004614b38565b611329565b604080516001600160a01b0390931683526020830191909152016103c5565b34801561057857600080fd5b5061045d610587366004614b5a565b6113d7565b34801561059857600080fd5b506104bb6000805160206159c583398151915281565b3480156105ba57600080fd5b5061045d6105c9366004614b5a565b6113fd565b61045d61147b565b3480156105e257600080fd5b5061045d6105f1366004614b9d565b6114fb565b34801561060257600080fd5b506104bb61157c565b34801561061757600080fd5b5061045d6106263660046149cf565b6115be565b34801561063757600080fd5b506104bb610646366004614970565b6115d9565b34801561065757600080fd5b5061045d610666366004614c0b565b611681565b34801561067757600080fd5b5061045d6116c7565b34801561068c57600080fd5b5061045d61069b366004614c6d565b61174d565b3480156106ac57600080fd5b506101c8546106cc906001600160801b0380821691600160801b90041682565b604080516001600160801b039384168152929091166020830152016103c5565b3480156106f857600080fd5b50610425610707366004614970565b6117d8565b34801561071857600080fd5b506101cd546103b990610100900460ff1681565b34801561073857600080fd5b5061045d610747366004614da7565b611898565b34801561075857600080fd5b506104bb610767366004614f04565b611baf565b34801561077857600080fd5b5061045d611c3f565b34801561078d57600080fd5b5061045d611c53565b3480156107a257600080fd5b506103e3611cb3565b3480156107b757600080fd5b5061045d6107c6366004614f04565b611cc3565b3480156107d757600080fd5b5061045d611d61565b3480156107ec57600080fd5b5061045d6107fb366004614f1f565b611dda565b34801561080c57600080fd5b506104bb611ec5565b34801561082157600080fd5b506104bb610830366004614f04565b6001600160a01b0316600090815260d36020526040902054600160601b90046001600160601b031690565b34801561086757600080fd5b506104bb610876366004614b5a565b6101d060209081526000928352604080842090915290825290205481565b3480156108a057600080fd5b50610196546001600160a01b0316610425565b3480156108bf57600080fd5b506101cd546103b99060ff1681565b3480156108da57600080fd5b5060cc546104bb565b3480156108ef57600080fd5b506103b96108fe366004614b5a565b611f43565b34801561090f57600080fd5b506103e3611f6f565b34801561092457600080fd5b506104bb60cc5481565b34801561093a57600080fd5b506101cd546103b990600160b01b900460ff1681565b34801561095c57600080fd5b506104bb600081565b34801561097157600080fd5b5061045d610980366004614f42565b611f7e565b34801561099157600080fd5b5061045d6109a0366004614f04565b611f89565b3480156109b157600080fd5b506101cd54610425906201000090046001600160a01b031681565b3480156109d857600080fd5b506109ec6109e7366004614fb0565b611fbd565b6040516103c59190614ff1565b348015610a0557600080fd5b5060d4546103b99060ff1681565b348015610a1f57600080fd5b5061045d6120af565b348015610a3457600080fd5b5061045d610a43366004615053565b61214b565b61045d610a563660046150ba565b61217d565b348015610a6757600080fd5b5061045d610a76366004614f04565b61230c565b348015610a8757600080fd5b506101d354610425906001600160a01b031681565b348015610aa857600080fd5b506104bb610ab7366004615114565b61239f565b348015610ac857600080fd5b506103e3610ad7366004614970565b61255b565b348015610ae857600080fd5b506104bb6125ee565b348015610afd57600080fd5b506104bb7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b348015610b3157600080fd5b5061045d610b40366004614b5a565b612643565b348015610b5157600080fd5b5061045d610b60366004615158565b612669565b348015610b7157600080fd5b50610b85610b80366004614970565b6127d9565b6040516103c59190600060c08201905064ffffffffff80845116835280602085015116602084015250604083015163ffffffff808216604085015280606086015116606085015250506001600160701b03608084015116608083015260a083015160a083015292915050565b348015610bfd57600080fd5b506103b9610c0c3660046151df565b6128ad565b348015610c1d57600080fd5b506103e36128db565b348015610c3257600080fd5b5061045d610c41366004614f04565b61297f565b348015610c5257600080fd5b506103b9610c61366004614970565b6101d46020526000908152604090205460ff1681565b348015610c8357600080fd5b506104bb6101d15481565b60006001600160e01b03198216632b435fdb60e21b1480610cbf57506001600160e01b0319821663503e914d60e11b145b80610cce5750610cce826129f5565b92915050565b60606101cb8054610ce490615209565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1090615209565b8015610d5d5780601f10610d3257610100808354040283529160200191610d5d565b820191906000526020600020905b815481529060010190602001808311610d4057829003601f168201915b5050505050905090565b606060ca8054610ce490615209565b6000610d8182612a1a565b610de75760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815260d160205260409020546001600160a01b031690565b6000610e0e826117d8565b9050806001600160a01b0316836001600160a01b031603610e7b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610dde565b336001600160a01b0382161480610e975750610e9781336128ad565b610f045760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610dde565b610f0e8383612a4d565b505050565b600060cd5460cc54610f259190615259565b905090565b610f343382612adf565b610f505760405162461bcd60e51b8152600401610dde9061526c565b610f0e838383612ba9565b826000108015610f6c575060148311155b610f89576040516332b4cb2160e21b815260040160405180910390fd5b6000610f93611ec5565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506110269066031742a8f46000906152bd565b905061103286826152d0565b341461105157604051632c1d501360e11b815260040160405180910390fd5b8660000361107257604051633ab3447f60e11b815260040160405180910390fd5b60cc54606083015163ffffffff16811061109e5760405162491a1760e81b815260040160405180910390fd5b60a0830151156110c157604051630268975d60e51b815260040160405180910390fd5b6101cd54610100900460ff1661119c5760006110df86898b8a612d43565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb71611100828c612dc5565b6001600160a01b031614611127576040516332c3ce2560e11b815260040160405180910390fd5b6001600160a01b038616600090815260d36020526040902054600160c01b90046001600160401b0316891161116f5760405163dc5a682560e01b815260040160405180910390fd5b61117a89604b6152bd565b43111561119a57604051639e8c142f60e01b815260040160405180910390fd5b505b60006111ac86868a85888c612de9565b90506111b986828b612f7e565b6000731075266c86cd9b1b021af63e09102af3d2dcbdb76111e18366031742a8f460006152d0565b604051600081818185875af1925050503d806000811461121d576040519150601f19603f3d011682016040523d82523d6000602084013e611222565b606091505b505090508061124457604051635579a42f60e11b815260040160405180910390fd5b888210156112d257600084611259848c615259565b61126391906152d0565b604051909150600090339083908381818185875af1925050503d80600081146112a8576040519150601f19603f3d011682016040523d82523d6000602084013e6112ad565b606091505b50509050806112cf57604051635579a42f60e11b815260040160405180910390fd5b50505b604080516001600160a01b0389168152602081018890529081018390527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f9060600160405180910390a15050505050505050505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161139e5750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b6020810151600090612710906113bd906001600160601b0316876152d0565b6113c791906152e7565b91519350909150505b9250929050565b600082815261010060205260409020600101546113f381612f99565b610f0e8383612fa3565b6001600160a01b038116331461146d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610dde565b611477828261302a565b5050565b600061148681612f99565b6101ce546040516000916001600160a01b03169047908381818185875af1925050503d80600081146114d4576040519150601f19603f3d011682016040523d82523d6000602084013e6114d9565b606091505b505090508061147757604051635579a42f60e11b815260040160405180910390fd5b611506600033611f43565b61152357604051634e8df0bf60e01b815260040160405180910390fd5b61152d8282613092565b604080516001600160a01b03841681526001600160601b03831660208201527fef5955f7902e6696c028804c62be1c24a0f98d9d30de5c31c83fa7f8b5c15c6f91015b60405180910390a15050565b600066031742a8f460006101cf6000611593611ec5565b8152602081019190915260400160002054610f259190600160901b90046001600160701b03166152bd565b610f0e8383836040518060200160405280600081525061214b565b6101cd54600090600160b01b900460ff166116075760405163c7c39e4f60e01b815260040160405180910390fd5b611619611613836117d8565b336128ad565b8061163d5750611628826117d8565b6001600160a01b0316336001600160a01b0316145b8061165857503361164d83610d76565b6001600160a01b0316145b6116745760405162ccfedb60e31b815260040160405180910390fd5b61167d8261318f565b5090565b6116996000805160206159c583398151915233611f43565b6116b657604051634e8df0bf60e01b815260040160405180910390fd5b6116c18383836132ac565b50505050565b6116d2600033611f43565b6116ef57604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156117145760405163ddff29e960e01b815260040160405180910390fd5b6101cd805460ff191660011790556040517f31d1c0a3af6e15844ff9c1bf6201a5cf123137eb2fb3eeb96861a436d49cd25f90600090a1565b6117656000805160206159c583398151915233611f43565b61178257604051634e8df0bf60e01b815260040160405180910390fd5b6101c880546001600160801b03908116600160801b918416918202179091556040519081527f8c8298dd23c82a4aa45d27f480c6ce0aa2588e13df0b2fe2c827ca4a6836a5f8906020015b60405180910390a150565b60006117e382612a1a565b6118405760405162461bcd60e51b815260206004820152602860248201527f45524337323178797a3a20517565727920666f72206e6f6e206578697374656e6044820152677420746f6b656e2160c01b6064820152608401610dde565b600082815260ce602052604090205482906001600160a01b031680611891575b50600081815260cf60205260409020546001600160a01b03168015611886579392505050565b816001019150611860565b9392505050565b600054610100900460ff16158080156118b85750600054600160ff909116105b806118d25750303b1580156118d2575060005460ff166001145b6119355760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610dde565b6000805460ff191660011790558015611958576000805461ff0019166101001790555b6001600160a01b038a1661197f5760405163d92e233d60e01b815260040160405180910390fd5b885160031461198d57600080fd5b855160021461199b57600080fd5b6119a58c8c61373b565b6119ad61376c565b6119b561376c565b6119be85613793565b604080518082019091526001600160801b038e81168083529089166020909201829052600160801b909102176101c8556101cd805462010000600160b01b031916620100006001600160a01b038d160217905588518990600090611a2457611a24615309565b60200260200101516101cb9081611a3b9190615365565b5088600181518110611a4f57611a4f615309565b60200260200101516101c99081611a669190615365565b5088600281518110611a7a57611a7a615309565b60200260200101516101ca9081611a919190615365565b5060d4805460ff191683151517905585518690600090611ab357611ab3615309565b60200260200101516101ce60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611b0686600181518110611af857611af8615309565b602002602001015189613092565b611b11600086612fa3565b611b296000805160206159c583398151915286612fa3565b8215611b3d57611b3b848460006132ac565b505b611b5a73721c002b0059009a671d00ad1700c9748146cd1b6137e6565b8015611ba0576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b60006001600160a01b038216611c1a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610dde565b506001600160a01b0316600090815260d360205260409020546001600160601b031690565b611c4761388c565b611c516000613793565b565b611c5e600033611f43565b611c7b57604051634e8df0bf60e01b815260040160405180910390fd5b6101d2546001600160a01b0316611ca957611c5173721c002b0059009a671d00ad1700c9748146cd1b6137e6565b611c5160006137e6565b60606101c98054610ce490615209565b611cce600033611f43565b611ceb57604051634e8df0bf60e01b815260040160405180910390fd5b6001600160a01b038116611d125760405163d92e233d60e01b815260040160405180910390fd5b6101ce80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd45e158b56e768c1167267f8516bcf96348071775faded3c9216b60855d873de906020016117cd565b611d6c600033611f43565b611d8957604051634e8df0bf60e01b815260040160405180910390fd5b6101cd54610100900460ff1615611d9f57600080fd5b6101cd805461ff0019166101001790556040517ffbbcc58867e8fad1d9f72f1b991660f5ec5e4e068374aa442b8604eef182b63990600090a1565b6101d3546001600160a01b03163314611e245760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610dde565b60008281526101d4602052604090205460ff161515811515146114775760008281526101d460205260409020805460ff19168215801591909117909155611e95576040518281527f032bc66be43dbccb7487781d168eb7bda224628a3b2c3388bdf69b532a3a161190602001611570565b6040518281527ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290602001611570565b6101d1546000905b8015611f29576000190160008181526101cf602052604090205464ffffffffff164210801590611f1a575060008181526101cf6020526040902054600160281b900464ffffffffff164211155b15611f2457919050565b611ecd565b5060405163b7b2409760e01b815260040160405180910390fd5b6000918252610100602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060cb8054610ce490615209565b6114773383836138e7565b611f94600033611f43565b611fb157604051634e8df0bf60e01b815260040160405180910390fd5b611fba816137e6565b50565b604080516000815260208101909152606090826001600160401b03811115611fe757611fe7614a0b565b60405190808252806020026020018201604052801561201a57816020015b60608152602001906001900390816120055790505b50915060005b838110156120a7576120773086868481811061203e5761203e615309565b90506020028101906120509190615424565b856040516020016120639392919061546a565b6040516020818303038152906040526139b5565b83828151811061208957612089615309565b6020026020010181905250808061209f90615491565b915050612020565b505092915050565b6120c76000805160206159c583398151915233611f43565b6120e457604051634e8df0bf60e01b815260040160405180910390fd5b6101cd805460ff600160b01b808304821615810260ff60b01b1990931692909217928390556040517f6ae3331a8bd1998bb8fd9d3d02b720f4862fb43e7586d302ba44e3923cea922d936121419390049091161515815260200190565b60405180910390a1565b6121553383612adf565b6121715760405162461bcd60e51b8152600401610dde9061526c565b6116c1848484846139da565b82600010801561218e575060148311155b6121ab576040516332b4cb2160e21b815260040160405180910390fd5b60006121b5611ec5565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506122489066031742a8f46000906152bd565b905061225486826152d0565b341461227357604051632c1d501360e11b815260040160405180910390fd5b60a082015161229557604051637904b60360e11b815260040160405180910390fd5b60cc54606083015163ffffffff1681106122c15760405162491a1760e81b815260040160405180910390fd5b6122d289898560a00151888a613a0d565b6122ef576040516334ce9a3d60e11b815260040160405180910390fd5b60006122ff86868a85888c612de9565b90506111b9868243612f7e565b612317600033611f43565b61233457604051634e8df0bf60e01b815260040160405180910390fd5b6101d354604080516001600160a01b03928316815291831660208301527f506563f582a1103ea9c5c3797795f524f078d85ab1c1d15b96d812667b5c94c6910160405180910390a16101d380546001600160a01b0319166001600160a01b0392909216919091179055565b600060148211156123c3576040516332b4cb2160e21b815260040160405180910390fd5b816000036123e4576040516332b4cb2160e21b815260040160405180910390fd5b601483511115612407576040516349a3ec1560e11b815260040160405180910390fd5b8251600003612429576040516349a3ec1560e11b815260040160405180910390fd5b6124416000805160206159c583398151915233611f43565b15801561247557506124737ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933611f43565b155b1561249357604051634e8df0bf60e01b815260040160405180910390fd5b60008284516124a291906152d0565b60cc546124af91906152bd565b6101c8549091506001600160801b03168111156124df5760405163a67c036160e01b815260040160405180910390fd5b60005b84518110156125185761251085828151811061250057612500615309565b6020026020010151856000612f7e565b6001016124e2565b507f74074e463a8efcb02859ade8892e3934bd28eb75c9d1e6085a40c474088e2bfe83828660405161254c939291906154aa565b60405180910390a19392505050565b606061256682612a1a565b6125835760405163677510db60e11b815260040160405180910390fd5b600061258d6128db565b90506000612599611cb3565b905060006125a5610cd4565b905082516000036125b857949350505050565b82826125c387613a84565b6040516020016125d593929190615508565b6040516020818303038152906040529350505050919050565b6101d1546000905b801561263b576000190160008181526101cf6020526040902054600160281b900464ffffffffff16421115612636576126308160016152bd565b91505090565b6125f6565b506000905090565b6000828152610100602052604090206001015461265f81612f99565b610f0e838361302a565b6126816000805160206159c583398151915233611f43565b61269e57604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156126c35760405163ddff29e960e01b815260040160405180910390fd5b60006126d0338484613b16565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb716126f18286612dc5565b6001600160a01b031614612718576040516332c3ce2560e11b815260040160405180910390fd5b825115612767576101ca61272c8482615365565b507ff5e721c51327df71720f204c71b46bc26bcafb44db5012739c85814c7862f6c06101ca60405161275e9190615541565b60405180910390a15b8151156116c1576101cc61277b8382615365565b506040805160208101909152600081526101c9906127999082615365565b507f8eca6ea708f9bc34439b72366aa672afc86bb8b1294f1ba9637945c5dab8ea746101cc6040516127cb9190615541565b60405180910390a150505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091526101d154821061282e576040516327e7ab7d60e11b815260040160405180910390fd5b5060009081526101cf6020908152604091829020825160c081018452815464ffffffffff8082168352600160281b82041693820193909352600160501b830463ffffffff90811694820194909452600160701b83049093166060840152600160901b9091046001600160701b031660808301526001015460a082015290565b6001600160a01b03918216600090815260d26020908152604080832093909416825291909152205460ff1690565b60606101cc80546128eb90615209565b9050600003612971576101cd5460405163511113e560e01b8152620100009091046001600160a01b03169063511113e59061292c906101ca90600401615541565b600060405180830381865afa158015612949573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f2591908101906155cc565b6101cc8054610ce490615209565b61298761388c565b6001600160a01b0381166129ec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610dde565b611fba81613793565b60006001600160e01b03198216637965db0b60e01b1480610cce5750610cce82613b89565b600081815260d0602052604081205460ff1615612a3957506000919050565b816000108015610cce57505060cc54101590565b600081815260d160205260409020546001600160a01b039081169083168114610f0e57600082815260d16020526040902080546001600160a01b0319166001600160a01b0385169081179091558290612aa5826117d8565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000612aea82612a1a565b612b4b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610dde565b6000612b56836117d8565b9050806001600160a01b0316846001600160a01b03161480612b915750836001600160a01b0316612b8684610d76565b6001600160a01b0316145b80612ba15750612ba181856128ad565b949350505050565b826001600160a01b0316612bbc826117d8565b6001600160a01b031614612c205760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610dde565b6001600160a01b038216612c825760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610dde565b612c8d838383613be4565b612c98600082612a4d565b6001600160a01b03838116600081815260d36020908152604080832080546001600160601b03198082166001600160601b039283166000190183161790925595881680855282852080549283169288166001019097169190911790955585835260ce90915280822080546001600160a01b0319168517905551849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610f0e838383613d5a565b604080517f5b174e00b853ebb074ee5cb5d23ca67a264896e5670f923ac103fccad5232b5560208201526001600160a01b03861691810191909152606081018490526080810183905260a081018290526000908190612dbb9060c0015b60405160208183030381529060405280519060200120613dc8565b9695505050505050565b6000806000612dd48585613e90565b91509150612de181613ed2565b509392505050565b6001600160a01b038616600081815260d360209081526040808320548984526101d083528184209484529390915280822054908501519192600160601b90046001600160601b03169163ffffffff1615612e8b57846040015163ffffffff168110612e6757604051632f18066d60e01b815260040160405180910390fd5b846040015163ffffffff168782011115612e8b5780856040015163ffffffff160396505b6101c854600160801b90046001600160801b03168015612ed557808310612ec557604051632f18066d60e01b815260040160405180910390fd5b808884011115612ed55782810397505b856060015163ffffffff168888011115612ef95786866060015163ffffffff160397505b600085118015612f1257506101cd54610100900460ff16155b15612f4757848210612f3757604051632f18066d60e01b815260040160405180910390fd5b848883011115612f475781850397505b5060008881526101d0602090815260408083206001600160a01b038d16845290915290209087019055508490509695505050505050565b610f0e83836040518060200160405280600081525084614017565b611fba8133614031565b612fad8282611f43565b611477576000828152610100602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612fe63390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6130348282611f43565b15611477576000828152610100602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6127106001600160601b03821611156131005760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610dde565b6001600160a01b0382166131565760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610dde565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b61319881612a1a565b6131f45760405162461bcd60e51b815260206004820152602760248201527f45524337323178797a3a20517565727920666f72206e6f6e6578697374656e7460448201526620746f6b656e2160c81b6064820152608401610dde565b60006131ff826117d8565b905061320d81600084613be4565b613218600083612a4d565b6001600160a01b038116600081815260d36020908152604080832080546001600160601b031981166001600160601b039182166000190190911617905585835260d0909152808220805460ff1916600190811790915560cd80549091019055518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a461147781600084613d5a565b600082816132b86125ee565b905060148211156132dc576040516373c2b52560e11b815260040160405180910390fd5b6101d15480158015906132ee57508185105b1561330c576040516344ca163560e11b815260040160405180910390fd5b8085111561332d576040516307cc4d8f60e01b815260040160405180910390fd5b6133386014836152bd565b61334284876152bd565b11156133615760405163c1eae7bb60e01b815260040160405180910390fd5b60008581526101cf602052604081205464ffffffffff16908490036133ee574281116133a05760405163bf4a806960e01b815260040160405180910390fd5b6101d18690556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b906133da908a908a908a90615679565b60405180910390a185945050505050611891565b60008888600081811061340357613403615309565b905060c002018036038101906134199190615734565b905060cc54816060015163ffffffff16101561344857604051630e93fda160e21b815260040160405180910390fd5b42821115801561345757508115155b801561346557506101d15487105b156134c257805164ffffffffff16821461349257604051632ca4094f60e21b815260040160405180910390fd5b42816020015164ffffffffff16116134bd5760405163804491f960e01b815260040160405180910390fd5b6134ed565b42816000015164ffffffffff16116134ed5760405163667e606760e11b815260040160405180910390fd5b868581015b888214613526578a8a8a840381811061350d5761350d615309565b905060c002018036038101906135239190615734565b92505b6101c85460608401516001600160801b0390911663ffffffff90911611156135615760405163bccc7e2360e01b815260040160405180910390fd5b826000015164ffffffffff16836020015164ffffffffff161161359757604051631131dc6b60e11b815260040160405180910390fd5b811561362757600019820160009081526101cf6020526040902054606084015164ffffffffff600160281b8304169163ffffffff600160701b9091048116911610156135fd574281106135fd576040516357be1d0d60e01b815260040160405180910390fd5b835164ffffffffff1681106136255760405163064f2b0760e31b815260040160405180910390fd5b505b60008281526101cf60209081526040918290208551815492870151938701516060880151608089015164ffffffffff93841669ffffffffffffffffffff1990961695909517600160281b93909616929092029490941767ffffffffffffffff60501b1916600160501b63ffffffff9586160263ffffffff60701b191617600160701b9490911693909302929092176001600160901b0316600160901b6001600160701b039092169190910217815560a0840151600191820155909101908082106134f2576101d18190556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b90613725908d908d908d90615679565b60405180910390a19a9950505050505050505050565b600054610100900460ff166137625760405162461bcd60e51b8152600401610dde906157ce565b611477828261408a565b600054610100900460ff16611c515760405162461bcd60e51b8152600401610dde906157ce565b61019680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116803b15159015801590613801575080155b1561381f576040516332483afb60e01b815260040160405180910390fd5b6101d254604080516001600160a01b03928316815291841660208301527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a16101d280546001600160a01b0319166001600160a01b038416179055611477826140ca565b610196546001600160a01b03163314611c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610dde565b816001600160a01b0316836001600160a01b0316036139485760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610dde565b6001600160a01b03838116600081815260d26020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6060611891838360405180606001604052806027815260200161599e60279139614144565b6139e5848484612ba9565b6139f1848484846141b2565b6116c15760405162461bcd60e51b8152600401610dde90615819565b6000612dbb868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040516001600160601b0319606089901b166020820152603481018790528892506054019050604051602081830303815290604052805190602001206142b0565b60606000613a91836142c6565b60010190506000816001600160401b03811115613ab057613ab0614a0b565b6040519080825280601f01601f191660200182016040528015613ada576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613ae457509392505050565b600080613b807f35fa4dcabfcae3f1b6e0c4c1ac43df02ba9cb39e2dcdc3d3f1b92a38118e33548686805190602001208680519060200120604051602001612da094939291909384526001600160a01b039290921660208401526040830152606082015260800190565b95945050505050565b60006001600160e01b0319821663152a902d60e11b1480613bba57506001600160e01b031982166380ac58cd60e01b145b80613bd557506001600160e01b03198216635b5e139f60e01b145b80610cce5750610cce8261439e565b6001600160a01b0383161580613c0157506001600160a01b038216155b15613c0b57505050565b60d45460ff1615613c2f576040516328f11eb160e21b815260040160405180910390fd5b6101d3546101d2546001600160a01b039182169116338215613cc757826001600160a01b0316816001600160a01b031614613cc75760405163657711f560e11b81526001600160a01b0384169063caee23ea90613c969084908a908a908a9060040161586b565b60006040518083038186803b158015613cae57600080fd5b505afa158015613cc2573d6000803e3d6000fd5b505050505b6001600160a01b03821615613d5257816001600160a01b0316816001600160a01b031614613d525760405163657711f560e11b81526001600160a01b0383169063caee23ea90613d219084908a908a908a9060040161586b565b60006040518083038186803b158015613d3957600080fd5b505afa158015613d4d573d6000803e3d6000fd5b505050505b505050505050565b60008181526101d4602052604090205460ff1615610f0e5760008181526101d4602052604090819020805460ff19169055517ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290613dbb9083815260200190565b60405180910390a1505050565b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f36cb08f6aafe2399767bf40e9642429d7535f40e61bd81428cad09095c5d337d918101919091527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a0820152600090819060c001604051602081830303815290604052805190602001209050611891818460405161190160f01b8152600281019290925260228201526042902090565b6000808251604103613ec65760208301516040840151606085015160001a613eba878285856143d3565b945094505050506113d0565b506000905060026113d0565b6000816004811115613ee657613ee6615895565b03613eee5750565b6001816004811115613f0257613f02615895565b03613f4a5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610dde565b6002816004811115613f5e57613f5e615895565b03613fab5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610dde565b6003816004811115613fbf57613fbf615895565b03611fba5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610dde565b61402284848361448d565b6139f160008560cc54856141b2565b61403b8282611f43565b6114775761404881614616565b614053836020614628565b6040516020016140649291906158ab565b60408051601f198184030181529082905262461bcd60e51b8252610dde9160040161495d565b600054610100900460ff166140b15760405162461bcd60e51b8152600401610dde906157ce565b60ca6140bd8382615365565b5060cb610f0e8282615365565b6001600160a01b03811615611fba57803b80156114775760405163fb2de5d760e01b81523060048201526102d160248201526001600160a01b0383169063fb2de5d790604401600060405180830381600087803b15801561412a57600080fd5b505af192505050801561413b575060015b15611477575050565b6060600080856001600160a01b031685604051614161919061591a565b600060405180830381855af49150503d806000811461419c576040519150601f19603f3d011682016040523d82523d6000602084013e6141a1565b606091505b5091509150612dbb868383876147c3565b60006001600160a01b0384163b156142a857604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906141f6903390899088908890600401615936565b6020604051808303816000875af1925050508015614231575060408051601f3d908101601f1916820190925261422e91810190615969565b60015b61428e573d80801561425f576040519150601f19603f3d011682016040523d82523d6000602084013e614264565b606091505b5080516000036142865760405162461bcd60e51b8152600401610dde90615819565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612ba1565b506001612ba1565b6000826142bd858461483c565b14949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106143055772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310614331576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061434f57662386f26fc10000830492506010015b6305f5e1008310614367576305f5e100830492506008015b612710831061437b57612710830492506004015b6064831061438d576064830492506002015b600a8310610cce5760010192915050565b60006001600160e01b0319821663152a902d60e11b1480610cce57506301ffc9a760e01b6001600160e01b0319831614610cce565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156144005750600090506003614484565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614454573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661447d57600060019250925050614484565b9150600090505b94509492505050565b6001600160a01b0383166144e35760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610dde565b6144f160008460cc54613be4565b60cc8054838101918290556001600160a01b038516600090815260d36020526040902080546001600160601b038082168701166001600160601b0319909116179055908215614590576001600160a01b038516600090815260d36020526040902080546001600160601b03808216600160601b92839004821688019091169091026001600160c01b031617600160c01b6001600160401b038616021790555b600081815260cf6020526040902080546001600160a01b0319166001600160a01b03871617905560018281019082015b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48160010191508082106145c0575050506116c160008560cc54613d5a565b6060610cce6001600160a01b03831660145b606060006146378360026152d0565b6146429060026152bd565b6001600160401b0381111561465957614659614a0b565b6040519080825280601f01601f191660200182016040528015614683576020820181803683370190505b509050600360fc1b8160008151811061469e5761469e615309565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106146cd576146cd615309565b60200101906001600160f81b031916908160001a90535060006146f18460026152d0565b6146fc9060016152bd565b90505b6001811115614774576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061473057614730615309565b1a60f81b82828151811061474657614746615309565b60200101906001600160f81b031916908160001a90535060049490941c9361476d81615986565b90506146ff565b5083156118915760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610dde565b6060831561483257825160000361482b576001600160a01b0385163b61482b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610dde565b5081612ba1565b612ba18383614881565b600081815b8451811015612de15761486d8286838151811061486057614860615309565b60200260200101516148ab565b91508061487981615491565b915050614841565b8151156148915781518083602001fd5b8060405162461bcd60e51b8152600401610dde919061495d565b60008183106148c7576000828152602084905260409020611891565b6000838152602083905260409020611891565b6001600160e01b031981168114611fba57600080fd5b60006020828403121561490257600080fd5b8135611891816148da565b60005b83811015614928578181015183820152602001614910565b50506000910152565b6000815180845261494981602086016020860161490d565b601f01601f19169290920160200192915050565b6020815260006118916020830184614931565b60006020828403121561498257600080fd5b5035919050565b80356001600160a01b03811681146149a057600080fd5b919050565b600080604083850312156149b857600080fd5b6149c183614989565b946020939093013593505050565b6000806000606084860312156149e457600080fd5b6149ed84614989565b92506149fb60208501614989565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614a4957614a49614a0b565b604052919050565b60006001600160401b03821115614a6a57614a6a614a0b565b50601f01601f191660200190565b600082601f830112614a8957600080fd5b8135614a9c614a9782614a51565b614a21565b818152846020838601011115614ab157600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215614ae657600080fd5b85356001600160401b03811115614afc57600080fd5b614b0888828901614a78565b955050602086013593506040860135925060608601359150614b2c60808701614989565b90509295509295909350565b60008060408385031215614b4b57600080fd5b50508035926020909101359150565b60008060408385031215614b6d57600080fd5b82359150614b7d60208401614989565b90509250929050565b80356001600160601b03811681146149a057600080fd5b60008060408385031215614bb057600080fd5b614bb983614989565b9150614b7d60208401614b86565b60008083601f840112614bd957600080fd5b5081356001600160401b03811115614bf057600080fd5b60208301915083602060c0830285010111156113d057600080fd5b600080600060408486031215614c2057600080fd5b83356001600160401b03811115614c3657600080fd5b614c4286828701614bc7565b909790965060209590950135949350505050565b80356001600160801b03811681146149a057600080fd5b600060208284031215614c7f57600080fd5b61189182614c56565b60006001600160401b03821115614ca157614ca1614a0b565b5060051b60200190565b600082601f830112614cbc57600080fd5b81356020614ccc614a9783614c88565b82815260059290921b84018101918181019086841115614ceb57600080fd5b8286015b84811015614d2a5780356001600160401b03811115614d0e5760008081fd5b614d1c8986838b0101614a78565b845250918301918301614cef565b509695505050505050565b600082601f830112614d4657600080fd5b81356020614d56614a9783614c88565b82815260059290921b84018101918181019086841115614d7557600080fd5b8286015b84811015614d2a57614d8a81614989565b8352918301918301614d79565b803580151581146149a057600080fd5b6000806000806000806000806000806000806101608d8f031215614dca57600080fd5b614dd38d614c56565b9b506001600160401b0360208e01351115614ded57600080fd5b614dfd8e60208f01358f01614a78565b9a506001600160401b0360408e01351115614e1757600080fd5b614e278e60408f01358f01614a78565b9950614e3560608e01614989565b98506001600160401b0360808e01351115614e4f57600080fd5b614e5f8e60808f01358f01614cab565b9750614e6d60a08e01614b86565b9650614e7b60c08e01614c56565b95506001600160401b0360e08e01351115614e9557600080fd5b614ea58e60e08f01358f01614d35565b9450614eb46101008e01614989565b93506001600160401b036101208e01351115614ecf57600080fd5b614ee08e6101208f01358f01614bc7565b9093509150614ef26101408e01614d97565b90509295989b509295989b509295989b565b600060208284031215614f1657600080fd5b61189182614989565b60008060408385031215614f3257600080fd5b82359150614b7d60208401614d97565b60008060408385031215614f5557600080fd5b614f5e83614989565b9150614b7d60208401614d97565b60008083601f840112614f7e57600080fd5b5081356001600160401b03811115614f9557600080fd5b6020830191508360208260051b85010111156113d057600080fd5b60008060208385031215614fc357600080fd5b82356001600160401b03811115614fd957600080fd5b614fe585828601614f6c565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561504657603f19888603018452615034858351614931565b94509285019290850190600101615018565b5092979650505050505050565b6000806000806080858703121561506957600080fd5b61507285614989565b935061508060208601614989565b92506040850135915060608501356001600160401b038111156150a257600080fd5b6150ae87828801614a78565b91505092959194509250565b6000806000806000608086880312156150d257600080fd5b85356001600160401b038111156150e857600080fd5b6150f488828901614f6c565b9096509450506020860135925060408601359150614b2c60608701614989565b6000806040838503121561512757600080fd5b82356001600160401b0381111561513d57600080fd5b61514985828601614d35565b95602094909401359450505050565b60008060006060848603121561516d57600080fd5b83356001600160401b038082111561518457600080fd5b61519087838801614a78565b945060208601359150808211156151a657600080fd5b6151b287838801614a78565b935060408601359150808211156151c857600080fd5b506151d586828701614a78565b9150509250925092565b600080604083850312156151f257600080fd5b6151fb83614989565b9150614b7d60208401614989565b600181811c9082168061521d57607f821691505b60208210810361523d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610cce57610cce615243565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b80820180821115610cce57610cce615243565b8082028115828204841417610cce57610cce615243565b60008261530457634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f821115610f0e57600081815260208120601f850160051c810160208610156153465750805b601f850160051c820191505b81811015613d5257828155600101615352565b81516001600160401b0381111561537e5761537e614a0b565b6153928161538c8454615209565b8461531f565b602080601f8311600181146153c757600084156153af5750858301515b600019600386901b1c1916600185901b178555613d52565b600085815260208120601f198616915b828110156153f6578886015182559484019460019091019084016153d7565b50858210156154145787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808335601e1984360301811261543b57600080fd5b8301803591506001600160401b0382111561545557600080fd5b6020019150368190038213156113d057600080fd5b82848237600083820160008152835161548781836020880161490d565b0195945050505050565b6000600182016154a3576154a3615243565b5060010190565b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b818110156154fa5784516001600160a01b0316835293830193918301916001016154d5565b509098975050505050505050565b6000845161551a81846020890161490d565b84519083019061552e81836020890161490d565b845191019061548781836020880161490d565b600060208083526000845461555581615209565b808487015260406001808416600081146155765760018114615590576155be565b60ff1985168984015283151560051b8901830195506155be565b896000528660002060005b858110156155b65781548b820186015290830190880161559b565b8a0184019650505b509398975050505050505050565b6000602082840312156155de57600080fd5b81516001600160401b038111156155f457600080fd5b8201601f8101841361560557600080fd5b8051615613614a9782614a51565b81815285602083850101111561562857600080fd5b613b8082602083016020860161490d565b803564ffffffffff811681146149a057600080fd5b803563ffffffff811681146149a057600080fd5b80356001600160701b03811681146149a057600080fd5b6040808252818101849052600090606080840187845b8881101561571e5764ffffffffff806156a784615639565b1684526020816156b8828601615639565b1690850152506156c982860161564e565b63ffffffff80821687860152806156e187860161564e565b1686860152505060806001600160701b036156fd828501615662565b169084015260a0828101359084015260c0928301929091019060010161568f565b5050809350505050826020830152949350505050565b600060c0828403121561574657600080fd5b60405160c081018181106001600160401b038211171561576857615768614a0b565b60405261577483615639565b815261578260208401615639565b60208201526157936040840161564e565b60408201526157a46060840161564e565b60608201526157b560808401615662565b608082015260a083013560a08201528091505092915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052602160045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516158dd81601785016020880161490d565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161590e81602884016020880161490d565b01602801949350505050565b6000825161592c81846020870161490d565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612dbb90830184614931565b60006020828403121561597b57600080fd5b8151611891816148da565b60008161599557615995615243565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564fd63b67fde00b77f1f54f050135a475665b815acd10a8e7fd785ba074846734aa2646970667358221220184460d2cf1a2fb4a62d4c22335dfeeb46cef695cde65be3a8b638d7da8929b764736f6c63430008110033
Deployed Bytecode
0x6080604052600436106103945760003560e01c806382b42c02116101e8578063b3cc59db11610108578063d5391393116100ab578063e985e9c51161007a578063e985e9c514610bf1578063effcf2b714610c11578063f2fde38b14610c26578063f71236c414610c46578063f86a352914610c7757600080fd5b8063d539139314610af1578063d547741f14610b25578063d7818e2814610b45578063dedd76e714610b6557600080fd5b8063b3cc59db14610a13578063b88d4fde14610a28578063bdc769eb14610a48578063be66422114610a5b578063bfccdaf714610a7b578063c204642c14610a9c578063c87b56dd14610abc578063ce4c61aa14610adc57600080fd5b806395d89b411161018b578063a22cb4651161015a578063a22cb46514610965578063a9fc664e14610985578063aa8a6754146109a5578063ac9650d8146109cc578063b0fde7fb146109f957600080fd5b806395d89b411461090357806397f5cdcf14610918578063a07c7ce41461092e578063a217fddf1461095057600080fd5b806382b42c02146107e0578063869d3bde146108005780638c8ea8e6146108155780638cd90c321461085b5780638da5cb5b146108945780638e021c06146108b357806390411aca146108ce57806391d14854146108e357600080fd5b80633f52af3c116102d35780636352211e11610276578063715018a611610245578063715018a61461076c57806372c06f5a14610781578063743976a0146107965780637f1fea59146107ab57806380420736146107cb57600080fd5b80636352211e146106ec578063659b8b2a1461070c5780636e49aa0a1461072c57806370a082311461074c57600080fd5b80633f52af3c146105d657806341dfed3a146105f657806342842e0e1461060b57806342966c681461062b5780634e0b9df21461064b57806351e85af61461066b578063548e76821461068057806360659a92146106a057600080fd5b806323b872dd1161033b57806323b872dd146104c9578063248a9ca3146104e95780632955a21d1461051a5780632a55205a1461052d5780632f2ff15d1461056c5780633540558a1461058c57806336568abe146105ae5780633ccfd60b146105ce57600080fd5b806301ffc9a7146103995780630293741b146103ce57806306fdde03146103f0578063081812fc14610405578063095ea7b31461043d578063098144d41461045f5780630d705df61461047e57806318160ddd146104a6575b600080fd5b3480156103a557600080fd5b506103b96103b43660046148f0565b610c8e565b60405190151581526020015b60405180910390f35b3480156103da57600080fd5b506103e3610cd4565b6040516103c5919061495d565b3480156103fc57600080fd5b506103e3610d67565b34801561041157600080fd5b50610425610420366004614970565b610d76565b6040516001600160a01b0390911681526020016103c5565b34801561044957600080fd5b5061045d6104583660046149a5565b610e03565b005b34801561046b57600080fd5b506101d2546001600160a01b0316610425565b34801561048a57600080fd5b506040805163657711f560e11b815260016020820152016103c5565b3480156104b257600080fd5b506104bb610f13565b6040519081526020016103c5565b3480156104d557600080fd5b5061045d6104e43660046149cf565b610f2a565b3480156104f557600080fd5b506104bb610504366004614970565b6000908152610100602052604090206001015490565b61045d610528366004614ace565b610f5b565b34801561053957600080fd5b5061054d610548366004614b38565b611329565b604080516001600160a01b0390931683526020830191909152016103c5565b34801561057857600080fd5b5061045d610587366004614b5a565b6113d7565b34801561059857600080fd5b506104bb6000805160206159c583398151915281565b3480156105ba57600080fd5b5061045d6105c9366004614b5a565b6113fd565b61045d61147b565b3480156105e257600080fd5b5061045d6105f1366004614b9d565b6114fb565b34801561060257600080fd5b506104bb61157c565b34801561061757600080fd5b5061045d6106263660046149cf565b6115be565b34801561063757600080fd5b506104bb610646366004614970565b6115d9565b34801561065757600080fd5b5061045d610666366004614c0b565b611681565b34801561067757600080fd5b5061045d6116c7565b34801561068c57600080fd5b5061045d61069b366004614c6d565b61174d565b3480156106ac57600080fd5b506101c8546106cc906001600160801b0380821691600160801b90041682565b604080516001600160801b039384168152929091166020830152016103c5565b3480156106f857600080fd5b50610425610707366004614970565b6117d8565b34801561071857600080fd5b506101cd546103b990610100900460ff1681565b34801561073857600080fd5b5061045d610747366004614da7565b611898565b34801561075857600080fd5b506104bb610767366004614f04565b611baf565b34801561077857600080fd5b5061045d611c3f565b34801561078d57600080fd5b5061045d611c53565b3480156107a257600080fd5b506103e3611cb3565b3480156107b757600080fd5b5061045d6107c6366004614f04565b611cc3565b3480156107d757600080fd5b5061045d611d61565b3480156107ec57600080fd5b5061045d6107fb366004614f1f565b611dda565b34801561080c57600080fd5b506104bb611ec5565b34801561082157600080fd5b506104bb610830366004614f04565b6001600160a01b0316600090815260d36020526040902054600160601b90046001600160601b031690565b34801561086757600080fd5b506104bb610876366004614b5a565b6101d060209081526000928352604080842090915290825290205481565b3480156108a057600080fd5b50610196546001600160a01b0316610425565b3480156108bf57600080fd5b506101cd546103b99060ff1681565b3480156108da57600080fd5b5060cc546104bb565b3480156108ef57600080fd5b506103b96108fe366004614b5a565b611f43565b34801561090f57600080fd5b506103e3611f6f565b34801561092457600080fd5b506104bb60cc5481565b34801561093a57600080fd5b506101cd546103b990600160b01b900460ff1681565b34801561095c57600080fd5b506104bb600081565b34801561097157600080fd5b5061045d610980366004614f42565b611f7e565b34801561099157600080fd5b5061045d6109a0366004614f04565b611f89565b3480156109b157600080fd5b506101cd54610425906201000090046001600160a01b031681565b3480156109d857600080fd5b506109ec6109e7366004614fb0565b611fbd565b6040516103c59190614ff1565b348015610a0557600080fd5b5060d4546103b99060ff1681565b348015610a1f57600080fd5b5061045d6120af565b348015610a3457600080fd5b5061045d610a43366004615053565b61214b565b61045d610a563660046150ba565b61217d565b348015610a6757600080fd5b5061045d610a76366004614f04565b61230c565b348015610a8757600080fd5b506101d354610425906001600160a01b031681565b348015610aa857600080fd5b506104bb610ab7366004615114565b61239f565b348015610ac857600080fd5b506103e3610ad7366004614970565b61255b565b348015610ae857600080fd5b506104bb6125ee565b348015610afd57600080fd5b506104bb7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b348015610b3157600080fd5b5061045d610b40366004614b5a565b612643565b348015610b5157600080fd5b5061045d610b60366004615158565b612669565b348015610b7157600080fd5b50610b85610b80366004614970565b6127d9565b6040516103c59190600060c08201905064ffffffffff80845116835280602085015116602084015250604083015163ffffffff808216604085015280606086015116606085015250506001600160701b03608084015116608083015260a083015160a083015292915050565b348015610bfd57600080fd5b506103b9610c0c3660046151df565b6128ad565b348015610c1d57600080fd5b506103e36128db565b348015610c3257600080fd5b5061045d610c41366004614f04565b61297f565b348015610c5257600080fd5b506103b9610c61366004614970565b6101d46020526000908152604090205460ff1681565b348015610c8357600080fd5b506104bb6101d15481565b60006001600160e01b03198216632b435fdb60e21b1480610cbf57506001600160e01b0319821663503e914d60e11b145b80610cce5750610cce826129f5565b92915050565b60606101cb8054610ce490615209565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1090615209565b8015610d5d5780601f10610d3257610100808354040283529160200191610d5d565b820191906000526020600020905b815481529060010190602001808311610d4057829003601f168201915b5050505050905090565b606060ca8054610ce490615209565b6000610d8182612a1a565b610de75760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815260d160205260409020546001600160a01b031690565b6000610e0e826117d8565b9050806001600160a01b0316836001600160a01b031603610e7b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610dde565b336001600160a01b0382161480610e975750610e9781336128ad565b610f045760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610dde565b610f0e8383612a4d565b505050565b600060cd5460cc54610f259190615259565b905090565b610f343382612adf565b610f505760405162461bcd60e51b8152600401610dde9061526c565b610f0e838383612ba9565b826000108015610f6c575060148311155b610f89576040516332b4cb2160e21b815260040160405180910390fd5b6000610f93611ec5565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506110269066031742a8f46000906152bd565b905061103286826152d0565b341461105157604051632c1d501360e11b815260040160405180910390fd5b8660000361107257604051633ab3447f60e11b815260040160405180910390fd5b60cc54606083015163ffffffff16811061109e5760405162491a1760e81b815260040160405180910390fd5b60a0830151156110c157604051630268975d60e51b815260040160405180910390fd5b6101cd54610100900460ff1661119c5760006110df86898b8a612d43565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb71611100828c612dc5565b6001600160a01b031614611127576040516332c3ce2560e11b815260040160405180910390fd5b6001600160a01b038616600090815260d36020526040902054600160c01b90046001600160401b0316891161116f5760405163dc5a682560e01b815260040160405180910390fd5b61117a89604b6152bd565b43111561119a57604051639e8c142f60e01b815260040160405180910390fd5b505b60006111ac86868a85888c612de9565b90506111b986828b612f7e565b6000731075266c86cd9b1b021af63e09102af3d2dcbdb76111e18366031742a8f460006152d0565b604051600081818185875af1925050503d806000811461121d576040519150601f19603f3d011682016040523d82523d6000602084013e611222565b606091505b505090508061124457604051635579a42f60e11b815260040160405180910390fd5b888210156112d257600084611259848c615259565b61126391906152d0565b604051909150600090339083908381818185875af1925050503d80600081146112a8576040519150601f19603f3d011682016040523d82523d6000602084013e6112ad565b606091505b50509050806112cf57604051635579a42f60e11b815260040160405180910390fd5b50505b604080516001600160a01b0389168152602081018890529081018390527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f9060600160405180910390a15050505050505050505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161139e5750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b6020810151600090612710906113bd906001600160601b0316876152d0565b6113c791906152e7565b91519350909150505b9250929050565b600082815261010060205260409020600101546113f381612f99565b610f0e8383612fa3565b6001600160a01b038116331461146d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610dde565b611477828261302a565b5050565b600061148681612f99565b6101ce546040516000916001600160a01b03169047908381818185875af1925050503d80600081146114d4576040519150601f19603f3d011682016040523d82523d6000602084013e6114d9565b606091505b505090508061147757604051635579a42f60e11b815260040160405180910390fd5b611506600033611f43565b61152357604051634e8df0bf60e01b815260040160405180910390fd5b61152d8282613092565b604080516001600160a01b03841681526001600160601b03831660208201527fef5955f7902e6696c028804c62be1c24a0f98d9d30de5c31c83fa7f8b5c15c6f91015b60405180910390a15050565b600066031742a8f460006101cf6000611593611ec5565b8152602081019190915260400160002054610f259190600160901b90046001600160701b03166152bd565b610f0e8383836040518060200160405280600081525061214b565b6101cd54600090600160b01b900460ff166116075760405163c7c39e4f60e01b815260040160405180910390fd5b611619611613836117d8565b336128ad565b8061163d5750611628826117d8565b6001600160a01b0316336001600160a01b0316145b8061165857503361164d83610d76565b6001600160a01b0316145b6116745760405162ccfedb60e31b815260040160405180910390fd5b61167d8261318f565b5090565b6116996000805160206159c583398151915233611f43565b6116b657604051634e8df0bf60e01b815260040160405180910390fd5b6116c18383836132ac565b50505050565b6116d2600033611f43565b6116ef57604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156117145760405163ddff29e960e01b815260040160405180910390fd5b6101cd805460ff191660011790556040517f31d1c0a3af6e15844ff9c1bf6201a5cf123137eb2fb3eeb96861a436d49cd25f90600090a1565b6117656000805160206159c583398151915233611f43565b61178257604051634e8df0bf60e01b815260040160405180910390fd5b6101c880546001600160801b03908116600160801b918416918202179091556040519081527f8c8298dd23c82a4aa45d27f480c6ce0aa2588e13df0b2fe2c827ca4a6836a5f8906020015b60405180910390a150565b60006117e382612a1a565b6118405760405162461bcd60e51b815260206004820152602860248201527f45524337323178797a3a20517565727920666f72206e6f6e206578697374656e6044820152677420746f6b656e2160c01b6064820152608401610dde565b600082815260ce602052604090205482906001600160a01b031680611891575b50600081815260cf60205260409020546001600160a01b03168015611886579392505050565b816001019150611860565b9392505050565b600054610100900460ff16158080156118b85750600054600160ff909116105b806118d25750303b1580156118d2575060005460ff166001145b6119355760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610dde565b6000805460ff191660011790558015611958576000805461ff0019166101001790555b6001600160a01b038a1661197f5760405163d92e233d60e01b815260040160405180910390fd5b885160031461198d57600080fd5b855160021461199b57600080fd5b6119a58c8c61373b565b6119ad61376c565b6119b561376c565b6119be85613793565b604080518082019091526001600160801b038e81168083529089166020909201829052600160801b909102176101c8556101cd805462010000600160b01b031916620100006001600160a01b038d160217905588518990600090611a2457611a24615309565b60200260200101516101cb9081611a3b9190615365565b5088600181518110611a4f57611a4f615309565b60200260200101516101c99081611a669190615365565b5088600281518110611a7a57611a7a615309565b60200260200101516101ca9081611a919190615365565b5060d4805460ff191683151517905585518690600090611ab357611ab3615309565b60200260200101516101ce60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611b0686600181518110611af857611af8615309565b602002602001015189613092565b611b11600086612fa3565b611b296000805160206159c583398151915286612fa3565b8215611b3d57611b3b848460006132ac565b505b611b5a73721c002b0059009a671d00ad1700c9748146cd1b6137e6565b8015611ba0576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b60006001600160a01b038216611c1a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610dde565b506001600160a01b0316600090815260d360205260409020546001600160601b031690565b611c4761388c565b611c516000613793565b565b611c5e600033611f43565b611c7b57604051634e8df0bf60e01b815260040160405180910390fd5b6101d2546001600160a01b0316611ca957611c5173721c002b0059009a671d00ad1700c9748146cd1b6137e6565b611c5160006137e6565b60606101c98054610ce490615209565b611cce600033611f43565b611ceb57604051634e8df0bf60e01b815260040160405180910390fd5b6001600160a01b038116611d125760405163d92e233d60e01b815260040160405180910390fd5b6101ce80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd45e158b56e768c1167267f8516bcf96348071775faded3c9216b60855d873de906020016117cd565b611d6c600033611f43565b611d8957604051634e8df0bf60e01b815260040160405180910390fd5b6101cd54610100900460ff1615611d9f57600080fd5b6101cd805461ff0019166101001790556040517ffbbcc58867e8fad1d9f72f1b991660f5ec5e4e068374aa442b8604eef182b63990600090a1565b6101d3546001600160a01b03163314611e245760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610dde565b60008281526101d4602052604090205460ff161515811515146114775760008281526101d460205260409020805460ff19168215801591909117909155611e95576040518281527f032bc66be43dbccb7487781d168eb7bda224628a3b2c3388bdf69b532a3a161190602001611570565b6040518281527ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290602001611570565b6101d1546000905b8015611f29576000190160008181526101cf602052604090205464ffffffffff164210801590611f1a575060008181526101cf6020526040902054600160281b900464ffffffffff164211155b15611f2457919050565b611ecd565b5060405163b7b2409760e01b815260040160405180910390fd5b6000918252610100602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060cb8054610ce490615209565b6114773383836138e7565b611f94600033611f43565b611fb157604051634e8df0bf60e01b815260040160405180910390fd5b611fba816137e6565b50565b604080516000815260208101909152606090826001600160401b03811115611fe757611fe7614a0b565b60405190808252806020026020018201604052801561201a57816020015b60608152602001906001900390816120055790505b50915060005b838110156120a7576120773086868481811061203e5761203e615309565b90506020028101906120509190615424565b856040516020016120639392919061546a565b6040516020818303038152906040526139b5565b83828151811061208957612089615309565b6020026020010181905250808061209f90615491565b915050612020565b505092915050565b6120c76000805160206159c583398151915233611f43565b6120e457604051634e8df0bf60e01b815260040160405180910390fd5b6101cd805460ff600160b01b808304821615810260ff60b01b1990931692909217928390556040517f6ae3331a8bd1998bb8fd9d3d02b720f4862fb43e7586d302ba44e3923cea922d936121419390049091161515815260200190565b60405180910390a1565b6121553383612adf565b6121715760405162461bcd60e51b8152600401610dde9061526c565b6116c1848484846139da565b82600010801561218e575060148311155b6121ab576040516332b4cb2160e21b815260040160405180910390fd5b60006121b5611ec5565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506122489066031742a8f46000906152bd565b905061225486826152d0565b341461227357604051632c1d501360e11b815260040160405180910390fd5b60a082015161229557604051637904b60360e11b815260040160405180910390fd5b60cc54606083015163ffffffff1681106122c15760405162491a1760e81b815260040160405180910390fd5b6122d289898560a00151888a613a0d565b6122ef576040516334ce9a3d60e11b815260040160405180910390fd5b60006122ff86868a85888c612de9565b90506111b9868243612f7e565b612317600033611f43565b61233457604051634e8df0bf60e01b815260040160405180910390fd5b6101d354604080516001600160a01b03928316815291831660208301527f506563f582a1103ea9c5c3797795f524f078d85ab1c1d15b96d812667b5c94c6910160405180910390a16101d380546001600160a01b0319166001600160a01b0392909216919091179055565b600060148211156123c3576040516332b4cb2160e21b815260040160405180910390fd5b816000036123e4576040516332b4cb2160e21b815260040160405180910390fd5b601483511115612407576040516349a3ec1560e11b815260040160405180910390fd5b8251600003612429576040516349a3ec1560e11b815260040160405180910390fd5b6124416000805160206159c583398151915233611f43565b15801561247557506124737ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933611f43565b155b1561249357604051634e8df0bf60e01b815260040160405180910390fd5b60008284516124a291906152d0565b60cc546124af91906152bd565b6101c8549091506001600160801b03168111156124df5760405163a67c036160e01b815260040160405180910390fd5b60005b84518110156125185761251085828151811061250057612500615309565b6020026020010151856000612f7e565b6001016124e2565b507f74074e463a8efcb02859ade8892e3934bd28eb75c9d1e6085a40c474088e2bfe83828660405161254c939291906154aa565b60405180910390a19392505050565b606061256682612a1a565b6125835760405163677510db60e11b815260040160405180910390fd5b600061258d6128db565b90506000612599611cb3565b905060006125a5610cd4565b905082516000036125b857949350505050565b82826125c387613a84565b6040516020016125d593929190615508565b6040516020818303038152906040529350505050919050565b6101d1546000905b801561263b576000190160008181526101cf6020526040902054600160281b900464ffffffffff16421115612636576126308160016152bd565b91505090565b6125f6565b506000905090565b6000828152610100602052604090206001015461265f81612f99565b610f0e838361302a565b6126816000805160206159c583398151915233611f43565b61269e57604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156126c35760405163ddff29e960e01b815260040160405180910390fd5b60006126d0338484613b16565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb716126f18286612dc5565b6001600160a01b031614612718576040516332c3ce2560e11b815260040160405180910390fd5b825115612767576101ca61272c8482615365565b507ff5e721c51327df71720f204c71b46bc26bcafb44db5012739c85814c7862f6c06101ca60405161275e9190615541565b60405180910390a15b8151156116c1576101cc61277b8382615365565b506040805160208101909152600081526101c9906127999082615365565b507f8eca6ea708f9bc34439b72366aa672afc86bb8b1294f1ba9637945c5dab8ea746101cc6040516127cb9190615541565b60405180910390a150505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091526101d154821061282e576040516327e7ab7d60e11b815260040160405180910390fd5b5060009081526101cf6020908152604091829020825160c081018452815464ffffffffff8082168352600160281b82041693820193909352600160501b830463ffffffff90811694820194909452600160701b83049093166060840152600160901b9091046001600160701b031660808301526001015460a082015290565b6001600160a01b03918216600090815260d26020908152604080832093909416825291909152205460ff1690565b60606101cc80546128eb90615209565b9050600003612971576101cd5460405163511113e560e01b8152620100009091046001600160a01b03169063511113e59061292c906101ca90600401615541565b600060405180830381865afa158015612949573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f2591908101906155cc565b6101cc8054610ce490615209565b61298761388c565b6001600160a01b0381166129ec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610dde565b611fba81613793565b60006001600160e01b03198216637965db0b60e01b1480610cce5750610cce82613b89565b600081815260d0602052604081205460ff1615612a3957506000919050565b816000108015610cce57505060cc54101590565b600081815260d160205260409020546001600160a01b039081169083168114610f0e57600082815260d16020526040902080546001600160a01b0319166001600160a01b0385169081179091558290612aa5826117d8565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000612aea82612a1a565b612b4b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610dde565b6000612b56836117d8565b9050806001600160a01b0316846001600160a01b03161480612b915750836001600160a01b0316612b8684610d76565b6001600160a01b0316145b80612ba15750612ba181856128ad565b949350505050565b826001600160a01b0316612bbc826117d8565b6001600160a01b031614612c205760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610dde565b6001600160a01b038216612c825760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610dde565b612c8d838383613be4565b612c98600082612a4d565b6001600160a01b03838116600081815260d36020908152604080832080546001600160601b03198082166001600160601b039283166000190183161790925595881680855282852080549283169288166001019097169190911790955585835260ce90915280822080546001600160a01b0319168517905551849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610f0e838383613d5a565b604080517f5b174e00b853ebb074ee5cb5d23ca67a264896e5670f923ac103fccad5232b5560208201526001600160a01b03861691810191909152606081018490526080810183905260a081018290526000908190612dbb9060c0015b60405160208183030381529060405280519060200120613dc8565b9695505050505050565b6000806000612dd48585613e90565b91509150612de181613ed2565b509392505050565b6001600160a01b038616600081815260d360209081526040808320548984526101d083528184209484529390915280822054908501519192600160601b90046001600160601b03169163ffffffff1615612e8b57846040015163ffffffff168110612e6757604051632f18066d60e01b815260040160405180910390fd5b846040015163ffffffff168782011115612e8b5780856040015163ffffffff160396505b6101c854600160801b90046001600160801b03168015612ed557808310612ec557604051632f18066d60e01b815260040160405180910390fd5b808884011115612ed55782810397505b856060015163ffffffff168888011115612ef95786866060015163ffffffff160397505b600085118015612f1257506101cd54610100900460ff16155b15612f4757848210612f3757604051632f18066d60e01b815260040160405180910390fd5b848883011115612f475781850397505b5060008881526101d0602090815260408083206001600160a01b038d16845290915290209087019055508490509695505050505050565b610f0e83836040518060200160405280600081525084614017565b611fba8133614031565b612fad8282611f43565b611477576000828152610100602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612fe63390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6130348282611f43565b15611477576000828152610100602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6127106001600160601b03821611156131005760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610dde565b6001600160a01b0382166131565760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610dde565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b61319881612a1a565b6131f45760405162461bcd60e51b815260206004820152602760248201527f45524337323178797a3a20517565727920666f72206e6f6e6578697374656e7460448201526620746f6b656e2160c81b6064820152608401610dde565b60006131ff826117d8565b905061320d81600084613be4565b613218600083612a4d565b6001600160a01b038116600081815260d36020908152604080832080546001600160601b031981166001600160601b039182166000190190911617905585835260d0909152808220805460ff1916600190811790915560cd80549091019055518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a461147781600084613d5a565b600082816132b86125ee565b905060148211156132dc576040516373c2b52560e11b815260040160405180910390fd5b6101d15480158015906132ee57508185105b1561330c576040516344ca163560e11b815260040160405180910390fd5b8085111561332d576040516307cc4d8f60e01b815260040160405180910390fd5b6133386014836152bd565b61334284876152bd565b11156133615760405163c1eae7bb60e01b815260040160405180910390fd5b60008581526101cf602052604081205464ffffffffff16908490036133ee574281116133a05760405163bf4a806960e01b815260040160405180910390fd5b6101d18690556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b906133da908a908a908a90615679565b60405180910390a185945050505050611891565b60008888600081811061340357613403615309565b905060c002018036038101906134199190615734565b905060cc54816060015163ffffffff16101561344857604051630e93fda160e21b815260040160405180910390fd5b42821115801561345757508115155b801561346557506101d15487105b156134c257805164ffffffffff16821461349257604051632ca4094f60e21b815260040160405180910390fd5b42816020015164ffffffffff16116134bd5760405163804491f960e01b815260040160405180910390fd5b6134ed565b42816000015164ffffffffff16116134ed5760405163667e606760e11b815260040160405180910390fd5b868581015b888214613526578a8a8a840381811061350d5761350d615309565b905060c002018036038101906135239190615734565b92505b6101c85460608401516001600160801b0390911663ffffffff90911611156135615760405163bccc7e2360e01b815260040160405180910390fd5b826000015164ffffffffff16836020015164ffffffffff161161359757604051631131dc6b60e11b815260040160405180910390fd5b811561362757600019820160009081526101cf6020526040902054606084015164ffffffffff600160281b8304169163ffffffff600160701b9091048116911610156135fd574281106135fd576040516357be1d0d60e01b815260040160405180910390fd5b835164ffffffffff1681106136255760405163064f2b0760e31b815260040160405180910390fd5b505b60008281526101cf60209081526040918290208551815492870151938701516060880151608089015164ffffffffff93841669ffffffffffffffffffff1990961695909517600160281b93909616929092029490941767ffffffffffffffff60501b1916600160501b63ffffffff9586160263ffffffff60701b191617600160701b9490911693909302929092176001600160901b0316600160901b6001600160701b039092169190910217815560a0840151600191820155909101908082106134f2576101d18190556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b90613725908d908d908d90615679565b60405180910390a19a9950505050505050505050565b600054610100900460ff166137625760405162461bcd60e51b8152600401610dde906157ce565b611477828261408a565b600054610100900460ff16611c515760405162461bcd60e51b8152600401610dde906157ce565b61019680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116803b15159015801590613801575080155b1561381f576040516332483afb60e01b815260040160405180910390fd5b6101d254604080516001600160a01b03928316815291841660208301527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a16101d280546001600160a01b0319166001600160a01b038416179055611477826140ca565b610196546001600160a01b03163314611c515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610dde565b816001600160a01b0316836001600160a01b0316036139485760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610dde565b6001600160a01b03838116600081815260d26020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6060611891838360405180606001604052806027815260200161599e60279139614144565b6139e5848484612ba9565b6139f1848484846141b2565b6116c15760405162461bcd60e51b8152600401610dde90615819565b6000612dbb868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040516001600160601b0319606089901b166020820152603481018790528892506054019050604051602081830303815290604052805190602001206142b0565b60606000613a91836142c6565b60010190506000816001600160401b03811115613ab057613ab0614a0b565b6040519080825280601f01601f191660200182016040528015613ada576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613ae457509392505050565b600080613b807f35fa4dcabfcae3f1b6e0c4c1ac43df02ba9cb39e2dcdc3d3f1b92a38118e33548686805190602001208680519060200120604051602001612da094939291909384526001600160a01b039290921660208401526040830152606082015260800190565b95945050505050565b60006001600160e01b0319821663152a902d60e11b1480613bba57506001600160e01b031982166380ac58cd60e01b145b80613bd557506001600160e01b03198216635b5e139f60e01b145b80610cce5750610cce8261439e565b6001600160a01b0383161580613c0157506001600160a01b038216155b15613c0b57505050565b60d45460ff1615613c2f576040516328f11eb160e21b815260040160405180910390fd5b6101d3546101d2546001600160a01b039182169116338215613cc757826001600160a01b0316816001600160a01b031614613cc75760405163657711f560e11b81526001600160a01b0384169063caee23ea90613c969084908a908a908a9060040161586b565b60006040518083038186803b158015613cae57600080fd5b505afa158015613cc2573d6000803e3d6000fd5b505050505b6001600160a01b03821615613d5257816001600160a01b0316816001600160a01b031614613d525760405163657711f560e11b81526001600160a01b0383169063caee23ea90613d219084908a908a908a9060040161586b565b60006040518083038186803b158015613d3957600080fd5b505afa158015613d4d573d6000803e3d6000fd5b505050505b505050505050565b60008181526101d4602052604090205460ff1615610f0e5760008181526101d4602052604090819020805460ff19169055517ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290613dbb9083815260200190565b60405180910390a1505050565b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f36cb08f6aafe2399767bf40e9642429d7535f40e61bd81428cad09095c5d337d918101919091527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a0820152600090819060c001604051602081830303815290604052805190602001209050611891818460405161190160f01b8152600281019290925260228201526042902090565b6000808251604103613ec65760208301516040840151606085015160001a613eba878285856143d3565b945094505050506113d0565b506000905060026113d0565b6000816004811115613ee657613ee6615895565b03613eee5750565b6001816004811115613f0257613f02615895565b03613f4a5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610dde565b6002816004811115613f5e57613f5e615895565b03613fab5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610dde565b6003816004811115613fbf57613fbf615895565b03611fba5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610dde565b61402284848361448d565b6139f160008560cc54856141b2565b61403b8282611f43565b6114775761404881614616565b614053836020614628565b6040516020016140649291906158ab565b60408051601f198184030181529082905262461bcd60e51b8252610dde9160040161495d565b600054610100900460ff166140b15760405162461bcd60e51b8152600401610dde906157ce565b60ca6140bd8382615365565b5060cb610f0e8282615365565b6001600160a01b03811615611fba57803b80156114775760405163fb2de5d760e01b81523060048201526102d160248201526001600160a01b0383169063fb2de5d790604401600060405180830381600087803b15801561412a57600080fd5b505af192505050801561413b575060015b15611477575050565b6060600080856001600160a01b031685604051614161919061591a565b600060405180830381855af49150503d806000811461419c576040519150601f19603f3d011682016040523d82523d6000602084013e6141a1565b606091505b5091509150612dbb868383876147c3565b60006001600160a01b0384163b156142a857604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906141f6903390899088908890600401615936565b6020604051808303816000875af1925050508015614231575060408051601f3d908101601f1916820190925261422e91810190615969565b60015b61428e573d80801561425f576040519150601f19603f3d011682016040523d82523d6000602084013e614264565b606091505b5080516000036142865760405162461bcd60e51b8152600401610dde90615819565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612ba1565b506001612ba1565b6000826142bd858461483c565b14949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106143055772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310614331576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061434f57662386f26fc10000830492506010015b6305f5e1008310614367576305f5e100830492506008015b612710831061437b57612710830492506004015b6064831061438d576064830492506002015b600a8310610cce5760010192915050565b60006001600160e01b0319821663152a902d60e11b1480610cce57506301ffc9a760e01b6001600160e01b0319831614610cce565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156144005750600090506003614484565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614454573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661447d57600060019250925050614484565b9150600090505b94509492505050565b6001600160a01b0383166144e35760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610dde565b6144f160008460cc54613be4565b60cc8054838101918290556001600160a01b038516600090815260d36020526040902080546001600160601b038082168701166001600160601b0319909116179055908215614590576001600160a01b038516600090815260d36020526040902080546001600160601b03808216600160601b92839004821688019091169091026001600160c01b031617600160c01b6001600160401b038616021790555b600081815260cf6020526040902080546001600160a01b0319166001600160a01b03871617905560018281019082015b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48160010191508082106145c0575050506116c160008560cc54613d5a565b6060610cce6001600160a01b03831660145b606060006146378360026152d0565b6146429060026152bd565b6001600160401b0381111561465957614659614a0b565b6040519080825280601f01601f191660200182016040528015614683576020820181803683370190505b509050600360fc1b8160008151811061469e5761469e615309565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106146cd576146cd615309565b60200101906001600160f81b031916908160001a90535060006146f18460026152d0565b6146fc9060016152bd565b90505b6001811115614774576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061473057614730615309565b1a60f81b82828151811061474657614746615309565b60200101906001600160f81b031916908160001a90535060049490941c9361476d81615986565b90506146ff565b5083156118915760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610dde565b6060831561483257825160000361482b576001600160a01b0385163b61482b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610dde565b5081612ba1565b612ba18383614881565b600081815b8451811015612de15761486d8286838151811061486057614860615309565b60200260200101516148ab565b91508061487981615491565b915050614841565b8151156148915781518083602001fd5b8060405162461bcd60e51b8152600401610dde919061495d565b60008183106148c7576000828152602084905260409020611891565b6000838152602083905260409020611891565b6001600160e01b031981168114611fba57600080fd5b60006020828403121561490257600080fd5b8135611891816148da565b60005b83811015614928578181015183820152602001614910565b50506000910152565b6000815180845261494981602086016020860161490d565b601f01601f19169290920160200192915050565b6020815260006118916020830184614931565b60006020828403121561498257600080fd5b5035919050565b80356001600160a01b03811681146149a057600080fd5b919050565b600080604083850312156149b857600080fd5b6149c183614989565b946020939093013593505050565b6000806000606084860312156149e457600080fd5b6149ed84614989565b92506149fb60208501614989565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614a4957614a49614a0b565b604052919050565b60006001600160401b03821115614a6a57614a6a614a0b565b50601f01601f191660200190565b600082601f830112614a8957600080fd5b8135614a9c614a9782614a51565b614a21565b818152846020838601011115614ab157600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215614ae657600080fd5b85356001600160401b03811115614afc57600080fd5b614b0888828901614a78565b955050602086013593506040860135925060608601359150614b2c60808701614989565b90509295509295909350565b60008060408385031215614b4b57600080fd5b50508035926020909101359150565b60008060408385031215614b6d57600080fd5b82359150614b7d60208401614989565b90509250929050565b80356001600160601b03811681146149a057600080fd5b60008060408385031215614bb057600080fd5b614bb983614989565b9150614b7d60208401614b86565b60008083601f840112614bd957600080fd5b5081356001600160401b03811115614bf057600080fd5b60208301915083602060c0830285010111156113d057600080fd5b600080600060408486031215614c2057600080fd5b83356001600160401b03811115614c3657600080fd5b614c4286828701614bc7565b909790965060209590950135949350505050565b80356001600160801b03811681146149a057600080fd5b600060208284031215614c7f57600080fd5b61189182614c56565b60006001600160401b03821115614ca157614ca1614a0b565b5060051b60200190565b600082601f830112614cbc57600080fd5b81356020614ccc614a9783614c88565b82815260059290921b84018101918181019086841115614ceb57600080fd5b8286015b84811015614d2a5780356001600160401b03811115614d0e5760008081fd5b614d1c8986838b0101614a78565b845250918301918301614cef565b509695505050505050565b600082601f830112614d4657600080fd5b81356020614d56614a9783614c88565b82815260059290921b84018101918181019086841115614d7557600080fd5b8286015b84811015614d2a57614d8a81614989565b8352918301918301614d79565b803580151581146149a057600080fd5b6000806000806000806000806000806000806101608d8f031215614dca57600080fd5b614dd38d614c56565b9b506001600160401b0360208e01351115614ded57600080fd5b614dfd8e60208f01358f01614a78565b9a506001600160401b0360408e01351115614e1757600080fd5b614e278e60408f01358f01614a78565b9950614e3560608e01614989565b98506001600160401b0360808e01351115614e4f57600080fd5b614e5f8e60808f01358f01614cab565b9750614e6d60a08e01614b86565b9650614e7b60c08e01614c56565b95506001600160401b0360e08e01351115614e9557600080fd5b614ea58e60e08f01358f01614d35565b9450614eb46101008e01614989565b93506001600160401b036101208e01351115614ecf57600080fd5b614ee08e6101208f01358f01614bc7565b9093509150614ef26101408e01614d97565b90509295989b509295989b509295989b565b600060208284031215614f1657600080fd5b61189182614989565b60008060408385031215614f3257600080fd5b82359150614b7d60208401614d97565b60008060408385031215614f5557600080fd5b614f5e83614989565b9150614b7d60208401614d97565b60008083601f840112614f7e57600080fd5b5081356001600160401b03811115614f9557600080fd5b6020830191508360208260051b85010111156113d057600080fd5b60008060208385031215614fc357600080fd5b82356001600160401b03811115614fd957600080fd5b614fe585828601614f6c565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561504657603f19888603018452615034858351614931565b94509285019290850190600101615018565b5092979650505050505050565b6000806000806080858703121561506957600080fd5b61507285614989565b935061508060208601614989565b92506040850135915060608501356001600160401b038111156150a257600080fd5b6150ae87828801614a78565b91505092959194509250565b6000806000806000608086880312156150d257600080fd5b85356001600160401b038111156150e857600080fd5b6150f488828901614f6c565b9096509450506020860135925060408601359150614b2c60608701614989565b6000806040838503121561512757600080fd5b82356001600160401b0381111561513d57600080fd5b61514985828601614d35565b95602094909401359450505050565b60008060006060848603121561516d57600080fd5b83356001600160401b038082111561518457600080fd5b61519087838801614a78565b945060208601359150808211156151a657600080fd5b6151b287838801614a78565b935060408601359150808211156151c857600080fd5b506151d586828701614a78565b9150509250925092565b600080604083850312156151f257600080fd5b6151fb83614989565b9150614b7d60208401614989565b600181811c9082168061521d57607f821691505b60208210810361523d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610cce57610cce615243565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b80820180821115610cce57610cce615243565b8082028115828204841417610cce57610cce615243565b60008261530457634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f821115610f0e57600081815260208120601f850160051c810160208610156153465750805b601f850160051c820191505b81811015613d5257828155600101615352565b81516001600160401b0381111561537e5761537e614a0b565b6153928161538c8454615209565b8461531f565b602080601f8311600181146153c757600084156153af5750858301515b600019600386901b1c1916600185901b178555613d52565b600085815260208120601f198616915b828110156153f6578886015182559484019460019091019084016153d7565b50858210156154145787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808335601e1984360301811261543b57600080fd5b8301803591506001600160401b0382111561545557600080fd5b6020019150368190038213156113d057600080fd5b82848237600083820160008152835161548781836020880161490d565b0195945050505050565b6000600182016154a3576154a3615243565b5060010190565b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b818110156154fa5784516001600160a01b0316835293830193918301916001016154d5565b509098975050505050505050565b6000845161551a81846020890161490d565b84519083019061552e81836020890161490d565b845191019061548781836020880161490d565b600060208083526000845461555581615209565b808487015260406001808416600081146155765760018114615590576155be565b60ff1985168984015283151560051b8901830195506155be565b896000528660002060005b858110156155b65781548b820186015290830190880161559b565b8a0184019650505b509398975050505050505050565b6000602082840312156155de57600080fd5b81516001600160401b038111156155f457600080fd5b8201601f8101841361560557600080fd5b8051615613614a9782614a51565b81815285602083850101111561562857600080fd5b613b8082602083016020860161490d565b803564ffffffffff811681146149a057600080fd5b803563ffffffff811681146149a057600080fd5b80356001600160701b03811681146149a057600080fd5b6040808252818101849052600090606080840187845b8881101561571e5764ffffffffff806156a784615639565b1684526020816156b8828601615639565b1690850152506156c982860161564e565b63ffffffff80821687860152806156e187860161564e565b1686860152505060806001600160701b036156fd828501615662565b169084015260a0828101359084015260c0928301929091019060010161568f565b5050809350505050826020830152949350505050565b600060c0828403121561574657600080fd5b60405160c081018181106001600160401b038211171561576857615768614a0b565b60405261577483615639565b815261578260208401615639565b60208201526157936040840161564e565b60408201526157a46060840161564e565b60608201526157b560808401615662565b608082015260a083013560a08201528091505092915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b634e487b7160e01b600052602160045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516158dd81601785016020880161490d565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161590e81602884016020880161490d565b01602801949350505050565b6000825161592c81846020870161490d565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612dbb90830184614931565b60006020828403121561597b57600080fd5b8151611891816148da565b60008161599557615995615243565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564fd63b67fde00b77f1f54f050135a475665b815acd10a8e7fd785ba074846734aa2646970667358221220184460d2cf1a2fb4a62d4c22335dfeeb46cef695cde65be3a8b638d7da8929b764736f6c63430008110033
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.