ERC-1155
Source Code
Overview
Max Total Supply
1,385 gam3s_awards
Holders
1,378
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
ERC1155M
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 20 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./utils/Constants.sol";
import "../magicdrop-types/contracts/IERC1155M.sol";
/**
* @title ERC1155M
*
* @dev OpenZeppelin's ERC1155 subclass with MagicEden launchpad features including
* - multi token minting
* - multi minting stages with time-based auto stage switch
* - global and stage wallet-level minting limit
* - whitelist
* - variable wallet limit
*/
contract ERC1155M is
IERC1155M,
ERC1155Supply,
ERC2981,
Ownable2Step,
ReentrancyGuard
{
using ECDSA for bytes32;
using SafeERC20 for IERC20;
// Collection name.
string public name;
// Collection symbol.
string public symbol;
// The total mintable supply per token.
uint256[] private _maxMintableSupply;
// Global wallet limit, across all stages, per token.
uint256[] private _globalWalletLimit;
// Mint stage information. See MintStageInfo for details.
MintStageInfo[] private _mintStages;
// Whether the token can be transferred.
bool private _transferable;
// Minted count per stage per token per wallet
mapping(uint256 => mapping(uint256 => mapping(address => uint32)))
private _stageMintedCountsPerTokenPerWallet;
// Minted count per stage per token.
mapping(uint256 => mapping(uint256 => uint256))
private _stageMintedCountsPerToken;
// Total mint fee
uint256 private _totalMintFee;
// Specify how long a signature from cosigner is valid for, recommend 300 seconds.
uint64 private _timestampExpirySeconds;
// The address of the cosigner server.
address private _cosigner;
// Address of ERC-20 token used to pay for minting. If 0 address, use native currency.
address private immutable MINT_CURRENCY;
// Number of tokens.
uint256 private immutable NUM_TOKENS;
// Fund receiver
address public immutable FUND_RECEIVER;
// Authorized minters
mapping(address => bool) private _authorizedMinters;
constructor(
string memory collectionName,
string memory collectionSymbol,
string memory uri,
uint256[] memory maxMintableSupply,
uint256[] memory globalWalletLimit,
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency,
address fundReceiver,
address royaltyReceiver,
uint96 royaltyFeeNumerator
) Ownable(msg.sender) ERC1155(uri) {
if (maxMintableSupply.length != globalWalletLimit.length) {
revert InvalidLimitArgsLength();
}
for (uint256 i = 0; i < globalWalletLimit.length; i++) {
if (
maxMintableSupply[i] > 0 &&
globalWalletLimit[i] > maxMintableSupply[i]
) {
revert GlobalWalletLimitOverflow();
}
}
name = collectionName;
symbol = collectionSymbol;
NUM_TOKENS = globalWalletLimit.length;
_maxMintableSupply = maxMintableSupply;
_globalWalletLimit = globalWalletLimit;
_cosigner = cosigner;
_timestampExpirySeconds = timestampExpirySeconds;
_transferable = true;
MINT_CURRENCY = mintCurrency;
FUND_RECEIVER = fundReceiver;
_setDefaultRoyalty(royaltyReceiver, royaltyFeeNumerator);
}
/**
* @dev Returns whether it has enough supply for the given qty.
*/
modifier hasSupply(uint256 tokenId, uint256 qty) {
if (
_maxMintableSupply[tokenId] > 0 &&
totalSupply(tokenId) + qty > _maxMintableSupply[tokenId]
) revert NoSupplyLeft();
_;
}
/**
* @dev Returns whether the msg sender is authorized to mint.
*/
modifier onlyAuthorizedMinter() {
if (_authorizedMinters[_msgSender()] != true) revert NotAuthorized();
_;
}
/**
* @dev Add authorized minter. Can only be called by contract owner.
*/
function addAuthorizedMinter(address minter) external onlyOwner {
_authorizedMinters[minter] = true;
}
/**
* @dev Remove authorized minter. Can only be called by contract owner.
*/
function removeAuthorizedMinter(address minter) external onlyOwner {
_authorizedMinters[minter] = false;
}
/**
* @dev Returns cosign nonce.
*/
function getCosignNonce(
address minter,
uint256 tokenId
) public view override returns (uint256) {
return totalMintedByAddress(minter)[tokenId];
}
/**
* @dev Sets cosigner.
*/
function setCosigner(address cosigner) external onlyOwner {
_cosigner = cosigner;
emit SetCosigner(cosigner);
}
/**
* @dev Sets stages in the format of an array of `MintStageInfo`.
*
* Following is an example of launch with two stages. The first stage is exclusive for whitelisted wallets
* specified by merkle root.
* [{
* price: 10000000000000000000,
* maxStageSupply: 2000,
* walletLimit: 1,
* merkleRoot: 0x559fadeb887449800b7b320bf1e92d309f329b9641ac238bebdb74e15c0a5218,
* startTimeUnixSeconds: 1667768000,
* endTimeUnixSeconds: 1667771600,
* },
* {
* price: 20000000000000000000,
* maxStageSupply: 3000,
* walletLimit: 2,
* merkleRoot: 0,
* startTimeUnixSeconds: 1667771600,
* endTimeUnixSeconds: 1667775200,
* }
* ]
*/
function setStages(MintStageInfo[] calldata newStages) external onlyOwner {
delete _mintStages;
for (uint256 i = 0; i < newStages.length; i++) {
if (i >= 1) {
if (
newStages[i].startTimeUnixSeconds <
newStages[i - 1].endTimeUnixSeconds +
TIMESTAMP_EXPIRY_SECONDS
) {
revert InsufficientStageTimeGap();
}
}
_assertValidStartAndEndTimestamp(
newStages[i].startTimeUnixSeconds,
newStages[i].endTimeUnixSeconds
);
_assertValidStageArgsLength(newStages[i]);
_mintStages.push(
MintStageInfo({
price: newStages[i].price,
mintFee: newStages[i].mintFee,
walletLimit: newStages[i].walletLimit,
merkleRoot: newStages[i].merkleRoot,
maxStageSupply: newStages[i].maxStageSupply,
startTimeUnixSeconds: newStages[i].startTimeUnixSeconds,
endTimeUnixSeconds: newStages[i].endTimeUnixSeconds
})
);
emit UpdateStage(
i,
newStages[i].price,
newStages[i].mintFee,
newStages[i].walletLimit,
newStages[i].merkleRoot,
newStages[i].maxStageSupply,
newStages[i].startTimeUnixSeconds,
newStages[i].endTimeUnixSeconds
);
}
}
/**
* @dev Returns maximum mintable supply per token.
*/
function getMaxMintableSupply(
uint256 tokenId
) external view override returns (uint256) {
return _maxMintableSupply[tokenId];
}
/**
* @dev Sets maximum mintable supply. New supply cannot be larger than the old or the supply alraedy minted.
*/
function setMaxMintableSupply(
uint256 tokenId,
uint256 maxMintableSupply
) external virtual onlyOwner {
if (tokenId >= NUM_TOKENS) {
revert InvalidTokenId();
}
if (
_maxMintableSupply[tokenId] != 0 &&
maxMintableSupply > _maxMintableSupply[tokenId]
) {
revert CannotIncreaseMaxMintableSupply();
}
if (maxMintableSupply < totalSupply(tokenId)) {
revert NewSupplyLessThanTotalSupply();
}
_maxMintableSupply[tokenId] = maxMintableSupply;
emit SetMaxMintableSupply(tokenId, maxMintableSupply);
}
/**
* @dev Returns global wallet limit. This is the max number of tokens can be minted by one wallet.
*/
function getGlobalWalletLimit(
uint256 tokenId
) external view override returns (uint256) {
return _globalWalletLimit[tokenId];
}
/**
* @dev Sets global wallet limit.
*/
function setGlobalWalletLimit(
uint256 tokenId,
uint256 globalWalletLimit
) external onlyOwner {
if (tokenId >= NUM_TOKENS) {
revert InvalidTokenId();
}
if (
_maxMintableSupply[tokenId] > 0 &&
globalWalletLimit > _maxMintableSupply[tokenId]
) {
revert GlobalWalletLimitOverflow();
}
_globalWalletLimit[tokenId] = globalWalletLimit;
emit SetGlobalWalletLimit(tokenId, globalWalletLimit);
}
/**
* @dev Returns number of minted tokens for a given address.
*/
function totalMintedByAddress(
address account
) public view virtual override returns (uint256[] memory) {
uint256[] memory totalMinted = new uint256[](NUM_TOKENS);
uint256 numStages = _mintStages.length;
for (uint256 token = 0; token < NUM_TOKENS; token++) {
for (uint256 stage = 0; stage < numStages; stage++) {
totalMinted[token] += _stageMintedCountsPerTokenPerWallet[
stage
][token][account];
}
}
return totalMinted;
}
/**
* @dev Returns number of minted token for a given token and address.
*/
function totalMintedByTokenByAddress(
address account,
uint256 tokenId
) internal view virtual returns (uint256) {
uint256 totalMinted = 0;
uint256 numStages = _mintStages.length;
for (uint256 i = 0; i < numStages; i++) {
totalMinted += _stageMintedCountsPerTokenPerWallet[i][tokenId][
account
];
}
return totalMinted;
}
/**
* @dev Returns number of minted tokens for a given stage and address.
*/
function totalMintedByStageByAddress(
uint256 stage,
address account
) internal view virtual returns (uint256[] memory) {
uint256[] memory totalMinted = new uint256[](NUM_TOKENS);
for (uint256 token = 0; token < NUM_TOKENS; token++) {
totalMinted[token] += _stageMintedCountsPerTokenPerWallet[stage][
token
][account];
}
return totalMinted;
}
function totalSupply()
public
view
override(ERC1155Supply, IERC1155M)
returns (uint256)
{
return ERC1155Supply.totalSupply();
}
function totalSupply(
uint256 tokenId
) public view override(ERC1155Supply, IERC1155M) returns (uint256) {
return ERC1155Supply.totalSupply(tokenId);
}
/**
* @dev Returns number of stages.
*/
function getNumberStages() external view override returns (uint256) {
return _mintStages.length;
}
/**
* @dev Returns info for one stage specified by stage index (starting from 0).
*/
function getStageInfo(
uint256 stage
)
external
view
override
returns (MintStageInfo memory, uint256[] memory, uint256[] memory)
{
if (stage >= _mintStages.length) {
revert InvalidStage();
}
uint256[] memory walletMinted = totalMintedByAddress(msg.sender);
uint256[] memory stageMinted = totalMintedByStageByAddress(
stage,
msg.sender
);
return (_mintStages[stage], walletMinted, stageMinted);
}
/**
* @dev Returns mint currency address.
*/
function getMintCurrency() external view returns (address) {
return MINT_CURRENCY;
}
/**
* @dev Mints token(s).
*
* tokenId - token id
* qty - number of tokens to mint
* proof - the merkle proof generated on client side. This applies if using whitelist
* timestamp - the current timestamp
* signature - the signature from cosigner if using cosigner
*/
function mint(
uint256 tokenId,
uint32 qty,
bytes32[] calldata proof,
uint64 timestamp,
bytes calldata signature
) external payable virtual nonReentrant {
_mintInternal(msg.sender, tokenId, qty, 0, proof, timestamp, signature);
}
/**
* @dev Mints token(s) with limit.
*
* tokenId - token id
* qty - number of tokens to mint
* limit - limit for the given minter
* proof - the merkle proof generated on client side. This applies if using whitelist
* timestamp - the current timestamp
* signature - the signature from cosigner if using cosigner
*/
function mintWithLimit(
uint256 tokenId,
uint32 qty,
uint32 limit,
bytes32[] calldata proof,
uint64 timestamp,
bytes calldata signature
) external payable virtual nonReentrant {
_mintInternal(
msg.sender,
tokenId,
qty,
limit,
proof,
timestamp,
signature
);
}
/**
* @dev Authorized mints token(s) with limit
*
* to - the token recipient
* tokenId - token id
* qty - number of tokens to mint
* limit - limit for the given minter
* proof - the merkle proof generated on client side. This applies if using whitelist
*/
function authorizedMint(
address to,
uint256 tokenId,
uint32 qty,
uint32 limit,
bytes32[] calldata proof
) external payable onlyAuthorizedMinter {
_mintInternal(to, tokenId, qty, limit, proof, 0, bytes("0"));
}
/**
* @dev Implementation of minting.
*/
function _mintInternal(
address to,
uint256 tokenId,
uint32 qty,
uint32 limit,
bytes32[] calldata proof,
uint64 timestamp,
bytes memory signature
) internal hasSupply(tokenId, qty) {
uint64 stageTimestamp = uint64(block.timestamp);
bool waiveMintFee = false;
if (_cosigner != address(0)) {
waiveMintFee = assertValidCosign(
msg.sender,
tokenId,
qty,
timestamp,
signature
);
_assertValidTimestamp(timestamp);
stageTimestamp = timestamp;
}
uint256 activeStage = getActiveStageFromTimestamp(stageTimestamp);
MintStageInfo memory stage = _mintStages[activeStage];
uint80 adjustedMintFee = waiveMintFee ? 0 : stage.mintFee[tokenId];
// Check value if minting with ETH
if (
MINT_CURRENCY == address(0) &&
msg.value < (stage.price[tokenId] + adjustedMintFee) * qty
) revert NotEnoughValue();
// Check stage supply if applicable
if (stage.maxStageSupply[tokenId] > 0) {
if (
_stageMintedCountsPerToken[activeStage][tokenId] + qty >
stage.maxStageSupply[tokenId]
) revert StageSupplyExceeded();
}
// Check global wallet limit if applicable
if (_globalWalletLimit[tokenId] > 0) {
if (
totalMintedByTokenByAddress(to, tokenId) + qty >
_globalWalletLimit[tokenId]
) revert WalletGlobalLimitExceeded();
}
// Check wallet limit for stage if applicable, limit == 0 means no limit enforced
if (stage.walletLimit[tokenId] > 0) {
if (
_stageMintedCountsPerTokenPerWallet[activeStage][tokenId][to] +
qty >
stage.walletLimit[tokenId]
) revert WalletStageLimitExceeded();
}
// Check merkle proof if applicable, merkleRoot == 0x00...00 means no proof required
if (stage.merkleRoot[tokenId] != 0) {
if (
MerkleProof.processProof(
proof,
keccak256(abi.encodePacked(to, limit))
) != stage.merkleRoot[tokenId]
) revert InvalidProof();
// Verify merkle proof mint limit
if (
limit > 0 &&
_stageMintedCountsPerTokenPerWallet[activeStage][tokenId][to] +
qty >
limit
) {
revert WalletStageLimitExceeded();
}
}
if (MINT_CURRENCY != address(0)) {
// ERC20 mint payment
IERC20(MINT_CURRENCY).safeTransferFrom(
msg.sender,
address(this),
(stage.price[tokenId] + adjustedMintFee) * qty
);
}
_totalMintFee += adjustedMintFee * qty;
_stageMintedCountsPerTokenPerWallet[activeStage][tokenId][to] += qty;
_stageMintedCountsPerToken[activeStage][tokenId] += qty;
_mint(to, tokenId, qty, "");
}
/**
* @dev Mints token(s) by owner.
*
* NOTE: This function bypasses validations thus only available for owner.
* This is typically used for owner to pre-mint or mint the remaining of the supply.
*/
function ownerMint(
address to,
uint256 tokenId,
uint32 qty
) external onlyOwner hasSupply(tokenId, qty) {
_mint(to, tokenId, qty, "");
}
/**
* @dev Withdraws funds by owner.
*/
function withdraw() external onlyOwner {
(bool success, ) = MINT_FEE_RECEIVER.call{value: _totalMintFee}("");
if (!success) revert TransferFailed();
_totalMintFee = 0;
uint256 remainingValue = address(this).balance;
(success, ) = FUND_RECEIVER.call{value: remainingValue}("");
if (!success) revert WithdrawFailed();
emit Withdraw(_totalMintFee + remainingValue);
}
/**
* @dev Withdraws ERC-20 funds by owner.
*/
function withdrawERC20() external onlyOwner {
if (MINT_CURRENCY == address(0)) revert WrongMintCurrency();
IERC20(MINT_CURRENCY).safeTransfer(MINT_FEE_RECEIVER, _totalMintFee);
_totalMintFee = 0;
uint256 remaining = IERC20(MINT_CURRENCY).balanceOf(address(this));
IERC20(MINT_CURRENCY).safeTransfer(FUND_RECEIVER, remaining);
emit WithdrawERC20(MINT_CURRENCY, _totalMintFee + remaining);
}
/**
* @dev Sets a new URI for all token types. The URI relies on token type ID
* substitution mechanism.
*/
function setURI(string calldata newURI) external onlyOwner {
_setURI(newURI);
}
/**
* @dev Sets transferable of the tokens.
*/
function setTransferable(bool transferable) external onlyOwner {
_transferable = transferable;
emit SetTransferable(transferable);
}
/**
* @dev Returns the current active stage based on timestamp.
*/
function getActiveStageFromTimestamp(
uint64 timestamp
) public view returns (uint256) {
for (uint256 i = 0; i < _mintStages.length; i++) {
if (
timestamp >= _mintStages[i].startTimeUnixSeconds &&
timestamp < _mintStages[i].endTimeUnixSeconds
) {
return i;
}
}
revert InvalidStage();
}
/**
* @dev Returns data hash for the given minter, qty, waiveMintFee and timestamp.
*/
function getCosignDigest(
address minter,
uint256 tokenId,
uint32 qty,
bool waiveMintFee,
uint64 timestamp
) public view returns (bytes32) {
if (_cosigner == address(0)) revert CosignerNotSet();
return
MessageHashUtils.toEthSignedMessageHash(
keccak256(
abi.encodePacked(
address(this),
minter,
qty,
waiveMintFee,
_cosigner,
timestamp,
block.chainid,
getCosignNonce(minter, tokenId)
)
)
);
}
/**
* @dev Validates the the given signature. Returns whether mint fee is waived.
*/
function assertValidCosign(
address minter,
uint256 tokenId,
uint32 qty,
uint64 timestamp,
bytes memory signature
) public view returns (bool) {
if (
SignatureChecker.isValidSignatureNow(
_cosigner,
getCosignDigest(
minter,
tokenId,
qty,
/* waiveMintFee= */ true,
timestamp
),
signature
)
) {
return true;
}
if (
SignatureChecker.isValidSignatureNow(
_cosigner,
getCosignDigest(
minter,
tokenId,
qty,
/* waiveMintFee= */ false,
timestamp
),
signature
)
) {
return false;
}
revert InvalidCosignSignature();
}
/**
* @dev Set default royalty for all tokens
*/
function setDefaultRoyalty(
address receiver,
uint96 feeNumerator
) public onlyOwner {
super._setDefaultRoyalty(receiver, feeNumerator);
emit DefaultRoyaltySet(receiver, feeNumerator);
}
/**
* @dev Set default royalty for individual token
*/
function setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) public onlyOwner {
super._setTokenRoyalty(tokenId, receiver, feeNumerator);
emit TokenRoyaltySet(tokenId, receiver, feeNumerator);
}
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC2981, ERC1155) returns (bool) {
return
ERC1155.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId);
}
/**
* @dev The hook of token transfer to validate the transfer.
*/
function _update(
address from,
address to,
uint256[] memory ids,
uint256[] memory values
) internal virtual override {
super._update(from, to, ids, values);
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if (!fromZeroAddress && !toZeroAddress && !_transferable) {
revert NotTransferable();
}
}
/**
* @dev Validates the start timestamp is before end timestamp. Used when updating stages.
*/
function _assertValidStartAndEndTimestamp(
uint64 start,
uint64 end
) internal pure {
if (start >= end) revert InvalidStartAndEndTimestamp();
}
/**
* @dev Validates the timestamp is not expired.
*/
function _assertValidTimestamp(uint64 timestamp) internal view {
if (timestamp < block.timestamp - _timestampExpirySeconds)
revert TimestampExpired();
}
function _assertValidStageArgsLength(
MintStageInfo calldata stageInfo
) internal {
if (
stageInfo.price.length != NUM_TOKENS ||
stageInfo.mintFee.length != NUM_TOKENS ||
stageInfo.walletLimit.length != NUM_TOKENS ||
stageInfo.merkleRoot.length != NUM_TOKENS ||
stageInfo.maxStageSupply.length != NUM_TOKENS
) {
revert InvalidStageArgsLength();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.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.
*
* The initial owner is set to the address provided by the deployer. 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 Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be 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 v5.0.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.20;
import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.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.
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);
/**
* @dev The default royalty receiver is invalid.
*/
error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);
/**
* @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);
/**
* @dev The royalty receiver for `tokenId` is invalid.
*/
error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual 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 {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
}
_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 {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
}
_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];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.20;
import {IERC1155} from "./IERC1155.sol";
import {IERC1155Receiver} from "./IERC1155Receiver.sol";
import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol";
import {Context} from "../../utils/Context.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {Arrays} from "../../utils/Arrays.sol";
import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*/
abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors {
using Arrays for uint256[];
using Arrays for address[];
mapping(uint256 id => mapping(address account => uint256)) private _balances;
mapping(address account => mapping(address operator => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256 /* id */) public view virtual returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*/
function balanceOf(address account, uint256 id) public view virtual returns (uint256) {
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
) public view virtual returns (uint256[] memory) {
if (accounts.length != ids.length) {
revert ERC1155InvalidArrayLength(ids.length, accounts.length);
}
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i));
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_safeTransferFrom(from, to, id, value, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_safeBatchTransferFrom(from, to, ids, values, data);
}
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
* (or `to`) is the zero address.
*
* Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received}
* or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
* - `ids` and `values` must have the same length.
*
* NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.
*/
function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual {
if (ids.length != values.length) {
revert ERC1155InvalidArrayLength(ids.length, values.length);
}
address operator = _msgSender();
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids.unsafeMemoryAccess(i);
uint256 value = values.unsafeMemoryAccess(i);
if (from != address(0)) {
uint256 fromBalance = _balances[id][from];
if (fromBalance < value) {
revert ERC1155InsufficientBalance(from, fromBalance, value, id);
}
unchecked {
// Overflow not possible: value <= fromBalance
_balances[id][from] = fromBalance - value;
}
}
if (to != address(0)) {
_balances[id][to] += value;
}
}
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
emit TransferSingle(operator, from, to, id, value);
} else {
emit TransferBatch(operator, from, to, ids, values);
}
}
/**
* @dev Version of {_update} that performs the token acceptance check by calling
* {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
* contains code (eg. is a smart contract at the moment of execution).
*
* IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
* update to the contract state after this function would break the check-effect-interaction pattern. Consider
* overriding {_update} instead.
*/
function _updateWithAcceptanceCheck(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal virtual {
_update(from, to, ids, values);
if (to != address(0)) {
address operator = _msgSender();
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
_doSafeTransferAcceptanceCheck(operator, from, to, id, value, data);
} else {
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data);
}
}
}
/**
* @dev Transfers a `value` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, to, ids, values, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
* - `ids` and `values` must have the same length.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, to, ids, values, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the values in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(address(0), to, ids, values, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
_updateWithAcceptanceCheck(address(0), to, ids, values, data);
}
/**
* @dev Destroys a `value` amount of tokens of type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
*/
function _burn(address from, uint256 id, uint256 value) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, address(0), ids, values, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
* - `ids` and `values` must have the same length.
*/
function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, address(0), ids, values, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the zero address.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (operator == address(0)) {
revert ERC1155InvalidOperator(address(0));
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address
* if it contains code at the moment of execution.
*/
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 value,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
// Tokens rejected
revert ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-ERC1155Receiver implementer
revert ERC1155InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
/**
* @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address
* if it contains code at the moment of execution.
*/
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
// Tokens rejected
revert ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-ERC1155Receiver implementer
revert ERC1155InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
/**
* @dev Creates an array in memory with only one value for each of the elements provided.
*/
function _asSingletonArrays(
uint256 element1,
uint256 element2
) private pure returns (uint256[] memory array1, uint256[] memory array2) {
/// @solidity memory-safe-assembly
assembly {
// Load the free memory pointer
array1 := mload(0x40)
// Set array length to 1
mstore(array1, 1)
// Store the single element at the next word after the length (where content starts)
mstore(add(array1, 0x20), element1)
// Repeat for next array locating it right after the first array
array2 := add(array1, 0x40)
mstore(array2, 1)
mstore(add(array2, 0x20), element2)
// Update the free memory pointer by pointing after the second array
mstore(0x40, add(array2, 0x40))
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.20;
import {ERC1155} from "../ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*
* NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens
* that can be minted.
*
* CAUTION: This extension should not be added in an upgrade to an already deployed contract.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 id => uint256) private _totalSupply;
uint256 private _totalSupplyAll;
/**
* @dev Total value of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Total value of tokens.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupplyAll;
}
/**
* @dev Indicates whether any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_update}.
*/
function _update(
address from,
address to,
uint256[] memory ids,
uint256[] memory values
) internal virtual override {
super._update(from, to, ids, values);
if (from == address(0)) {
uint256 totalMintValue = 0;
for (uint256 i = 0; i < ids.length; ++i) {
uint256 value = values[i];
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply[ids[i]] += value;
totalMintValue += value;
}
// Overflow check required: The rest of the code assumes that totalSupplyAll never overflows
_totalSupplyAll += totalMintValue;
}
if (to == address(0)) {
uint256 totalBurnValue = 0;
for (uint256 i = 0; i < ids.length; ++i) {
uint256 value = values[i];
unchecked {
// Overflow not possible: values[i] <= balanceOf(from, ids[i]) <= totalSupply(ids[i])
_totalSupply[ids[i]] -= value;
// Overflow not possible: sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
totalBurnValue += value;
}
}
unchecked {
// Overflow not possible: totalBurnValue = sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
_totalSupplyAll -= totalBurnValue;
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.20;
import {IERC1155} from "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Interface that must be implemented by smart contracts in order to receive
* ERC-1155 token transfers.
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
import {Math} from "./math/Math.sol";
/**
* @dev Collection of functions related to array types.
*/
library Arrays {
using StorageSlot for bytes32;
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* `array` is expected to be sorted in ascending order, and to contain no
* repeated elements.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getUint256Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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 Context {
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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError, bytes32) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS, s);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.20;
/**
* @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 MerkleProof {
/**
*@dev The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @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}
*/
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.
*/
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}
*/
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.
*/
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.
*/
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).
*/
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.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// 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) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
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.
*/
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.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// 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) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Sorts the pair (a, b) and hashes the result.
*/
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
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 (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)
pragma solidity ^0.8.20;
import {Strings} from "../Strings.sol";
/**
* @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
*
* The library provides methods for generating a hash of a message that conforms to the
* https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
* specifications.
*/
library MessageHashUtils {
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing a bytes32 `messageHash` with
* `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
* keccak256, although any bytes32 value can be safely used because the final digest will
* be re-hashed.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
}
}
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing an arbitrary `message` with
* `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
return
keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
}
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x00` (data with intended validator).
*
* The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
* `validator` address. Then hashing the result.
*
* See {ECDSA-recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(hex"19_00", validator, data));
}
/**
* @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
*
* The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
* `\x19\x01` and hashing the result. It corresponds to the hash signed by the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
*
* See {ECDSA-recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, hex"19_01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
digest := keccak256(ptr, 0x42)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/SignatureChecker.sol)
pragma solidity ^0.8.20;
import {ECDSA} from "./ECDSA.sol";
import {IERC1271} from "../../interfaces/IERC1271.sol";
/**
* @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
* signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
* Argent and Safe Wallet (previously Gnosis Safe).
*/
library SignatureChecker {
/**
* @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
* signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
(address recovered, ECDSA.RecoverError error, ) = ECDSA.tryRecover(hash, signature);
return
(error == ECDSA.RecoverError.NoError && recovered == signer) ||
isValidERC1271SignatureNow(signer, hash, signature);
}
/**
* @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
* against the signer smart contract using ERC1271.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidERC1271SignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(bool success, bytes memory result) = signer.staticcall(
abi.encodeCall(IERC1271.isValidSignature, (hash, signature))
);
return (success &&
result.length >= 32 &&
abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @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 ReentrancyGuard {
// 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;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_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
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// 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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant ME_SUBSCRIPTION = 0x0403c10721Ff2936EfF684Bbb57CD792Fd4b1B6c; address constant MINT_FEE_RECEIVER = 0x0B98151bEdeE73f9Ba5F2C7b72dEa02D38Ce49Fc; uint64 constant TIMESTAMP_EXPIRY_SECONDS = 300;
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC1155M {
error CannotIncreaseMaxMintableSupply();
error CosignerNotSet();
error NewSupplyLessThanTotalSupply();
error GlobalWalletLimitOverflow();
error InsufficientStageTimeGap();
error InvalidCosignSignature();
error InvalidLimitArgsLength();
error InvalidProof();
error InvalidStage();
error InvalidStageArgsLength();
error InvalidTokenId();
error InvalidStartAndEndTimestamp();
error NoSupplyLeft();
error NotAuthorized();
error NotEnoughValue();
error NotTransferable();
error StageSupplyExceeded();
error TimestampExpired();
error TransferFailed();
error WalletGlobalLimitExceeded();
error WalletStageLimitExceeded();
error WithdrawFailed();
error WrongMintCurrency();
error NotSupported();
struct MintStageInfo {
uint80[] price;
uint80[] mintFee;
uint32[] walletLimit; // 0 for unlimited
bytes32[] merkleRoot; // 0x0 for no presale enforced
uint24[] maxStageSupply; // 0 for unlimited
uint64 startTimeUnixSeconds;
uint64 endTimeUnixSeconds;
}
event UpdateStage(
uint256 indexed stage,
uint80[] price,
uint80[] mintFee,
uint32[] walletLimit,
bytes32[] merkleRoot,
uint24[] maxStageSupply,
uint64 startTimeUnixSeconds,
uint64 endTimeUnixSeconds
);
event SetCosigner(address cosigner);
event SetMaxMintableSupply(
uint256 indexed tokenId,
uint256 maxMintableSupply
);
event SetGlobalWalletLimit(
uint256 indexed tokenId,
uint256 globalWalletLimit
);
event Withdraw(uint256 value);
event WithdrawERC20(address indexed mintCurrency, uint256 value);
event SetTransferable(bool transferable);
event DefaultRoyaltySet(address receiver, uint96 feeNumerator);
event TokenRoyaltySet(
uint256 indexed tokenId,
address receiver,
uint96 feeNumerator
);
function getNumberStages() external view returns (uint256);
function totalSupply() external view returns (uint256);
function totalSupply(uint256 tokenId) external view returns (uint256);
function getGlobalWalletLimit(
uint256 tokenId
) external view returns (uint256);
function getMaxMintableSupply(
uint256 tokenId
) external view returns (uint256);
function totalMintedByAddress(
address account
) external view returns (uint256[] memory);
function getCosignNonce(
address minter,
uint256 tokenId
) external view returns (uint256);
function getStageInfo(
uint256 stage
)
external
view
returns (MintStageInfo memory, uint256[] memory, uint256[] memory);
function mint(
uint256 tokenId,
uint32 qty,
bytes32[] calldata proof,
uint64 timestamp,
bytes calldata signature
) external payable;
function mintWithLimit(
uint256 tokenId,
uint32 qty,
uint32 limit,
bytes32[] calldata proof,
uint64 timestamp,
bytes calldata signature
) external payable;
function authorizedMint(
address to,
uint256 tokenId,
uint32 qty,
uint32 limit,
bytes32[] calldata proof
) external payable;
}{
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 20,
"details": {
"yulDetails": {
"optimizerSteps": "dhfoD[xarrscLMcCTU]uljmul"
}
}
},
"evmVersion": "paris",
"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":[{"internalType":"string","name":"collectionName","type":"string"},{"internalType":"string","name":"collectionSymbol","type":"string"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256[]","name":"maxMintableSupply","type":"uint256[]"},{"internalType":"uint256[]","name":"globalWalletLimit","type":"uint256[]"},{"internalType":"address","name":"cosigner","type":"address"},{"internalType":"uint64","name":"timestampExpirySeconds","type":"uint64"},{"internalType":"address","name":"mintCurrency","type":"address"},{"internalType":"address","name":"fundReceiver","type":"address"},{"internalType":"address","name":"royaltyReceiver","type":"address"},{"internalType":"uint96","name":"royaltyFeeNumerator","type":"uint96"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"CannotIncreaseMaxMintableSupply","type":"error"},{"inputs":[],"name":"CosignerNotSet","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"GlobalWalletLimitOverflow","type":"error"},{"inputs":[],"name":"InsufficientStageTimeGap","type":"error"},{"inputs":[],"name":"InvalidCosignSignature","type":"error"},{"inputs":[],"name":"InvalidLimitArgsLength","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidStage","type":"error"},{"inputs":[],"name":"InvalidStageArgsLength","type":"error"},{"inputs":[],"name":"InvalidStartAndEndTimestamp","type":"error"},{"inputs":[],"name":"InvalidTokenId","type":"error"},{"inputs":[],"name":"NewSupplyLessThanTotalSupply","type":"error"},{"inputs":[],"name":"NoSupplyLeft","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotEnoughValue","type":"error"},{"inputs":[],"name":"NotSupported","type":"error"},{"inputs":[],"name":"NotTransferable","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StageSupplyExceeded","type":"error"},{"inputs":[],"name":"TimestampExpired","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"WalletGlobalLimitExceeded","type":"error"},{"inputs":[],"name":"WalletStageLimitExceeded","type":"error"},{"inputs":[],"name":"WithdrawFailed","type":"error"},{"inputs":[],"name":"WrongMintCurrency","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","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":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"DefaultRoyaltySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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":false,"internalType":"address","name":"cosigner","type":"address"}],"name":"SetCosigner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"globalWalletLimit","type":"uint256"}],"name":"SetGlobalWalletLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxMintableSupply","type":"uint256"}],"name":"SetMaxMintableSupply","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"transferable","type":"bool"}],"name":"SetTransferable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"TokenRoyaltySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"stage","type":"uint256"},{"indexed":false,"internalType":"uint80[]","name":"price","type":"uint80[]"},{"indexed":false,"internalType":"uint80[]","name":"mintFee","type":"uint80[]"},{"indexed":false,"internalType":"uint32[]","name":"walletLimit","type":"uint32[]"},{"indexed":false,"internalType":"bytes32[]","name":"merkleRoot","type":"bytes32[]"},{"indexed":false,"internalType":"uint24[]","name":"maxStageSupply","type":"uint24[]"},{"indexed":false,"internalType":"uint64","name":"startTimeUnixSeconds","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"endTimeUnixSeconds","type":"uint64"}],"name":"UpdateStage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"mintCurrency","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"WithdrawERC20","type":"event"},{"inputs":[],"name":"FUND_RECEIVER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"addAuthorizedMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"qty","type":"uint32"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"assertValidCosign","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"qty","type":"uint32"},{"internalType":"uint32","name":"limit","type":"uint32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"authorizedMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"getActiveStageFromTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"qty","type":"uint32"},{"internalType":"bool","name":"waiveMintFee","type":"bool"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"getCosignDigest","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCosignNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getGlobalWalletLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getMaxMintableSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMintCurrency","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumberStages","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"stage","type":"uint256"}],"name":"getStageInfo","outputs":[{"components":[{"internalType":"uint80[]","name":"price","type":"uint80[]"},{"internalType":"uint80[]","name":"mintFee","type":"uint80[]"},{"internalType":"uint32[]","name":"walletLimit","type":"uint32[]"},{"internalType":"bytes32[]","name":"merkleRoot","type":"bytes32[]"},{"internalType":"uint24[]","name":"maxStageSupply","type":"uint24[]"},{"internalType":"uint64","name":"startTimeUnixSeconds","type":"uint64"},{"internalType":"uint64","name":"endTimeUnixSeconds","type":"uint64"}],"internalType":"struct IERC1155M.MintStageInfo","name":"","type":"tuple"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"qty","type":"uint32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"qty","type":"uint32"},{"internalType":"uint32","name":"limit","type":"uint32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintWithLimit","outputs":[],"stateMutability":"payable","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":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"qty","type":"uint32"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"removeAuthorizedMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","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":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","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":"cosigner","type":"address"}],"name":"setCosigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"globalWalletLimit","type":"uint256"}],"name":"setGlobalWalletLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"maxMintableSupply","type":"uint256"}],"name":"setMaxMintableSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint80[]","name":"price","type":"uint80[]"},{"internalType":"uint80[]","name":"mintFee","type":"uint80[]"},{"internalType":"uint32[]","name":"walletLimit","type":"uint32[]"},{"internalType":"bytes32[]","name":"merkleRoot","type":"bytes32[]"},{"internalType":"uint24[]","name":"maxStageSupply","type":"uint24[]"},{"internalType":"uint64","name":"startTimeUnixSeconds","type":"uint64"},{"internalType":"uint64","name":"endTimeUnixSeconds","type":"uint64"}],"internalType":"struct IERC1155M.MintStageInfo[]","name":"newStages","type":"tuple[]"}],"name":"setStages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"transferable","type":"bool"}],"name":"setTransferable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"totalMintedByAddress","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":"uint256","name":"tokenId","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e0604052346200008e576200002b62000018620003b2565b9998909897919796929695939562000818565b604051615bf2908162000d7b8239608051818181610adf015281816141020152614a5e015260a0518181816131390152818161325f0152818161334d01528181613cad0152615ae5015260c051818181610e23015281816149a00152614b5a0152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b03821117620000cb57604052565b62000093565b90620000e8620000e060405190565b9283620000a9565b565b6001600160401b038111620000cb57602090601f01601f19160190565b60005b8381106200011b5750506000910152565b81810151838201526020016200010a565b90929192620001456200013f82620000ea565b620000d1565b918294828452828201116200008e576020620000e893019062000107565b9080601f830112156200008e57815162000180926020016200012c565b90565b6001600160401b038111620000cb5760051b60200190565b805b036200008e57565b90505190620000e8826200019b565b90929192620001c76200013f8262000183565b93602085838152019160051b8301928184116200008e57915b838310620001ee5750505050565b60208091620001fe8486620001a5565b815201920191620001e0565b9080601f830112156200008e5781516200018092602001620001b4565b6001600160a01b031690565b6001600160a01b0381166200019d565b90505190620000e88262000233565b6001600160401b0381166200019d565b90505190620000e88262000252565b6001600160601b0381166200019d565b90505190620000e88262000271565b9190610160838203126200008e5782516001600160401b0381116200008e5781620002bd91850162000163565b60208401519093906001600160401b0381116200008e5782620002e291830162000163565b60408201519093906001600160401b0381116200008e57836200030791840162000163565b60608301519093906001600160401b0381116200008e57816200032c9185016200020a565b60808401519093906001600160401b0381116200008e5782620003519183016200020a565b92620003618360a0840162000243565b92620003718160c0850162000262565b92620003818260e0830162000243565b92620001806200039684610100850162000243565b93610140620003aa82610120870162000243565b940162000281565b620003d56200696d80380380620003c981620000d1565b92833981019062000290565b91939597999a909294969899989796959493929190565b6200018062000180620001809290565b634e487b7160e01b600052601160045260246000fd5b6000198114620004225760010190565b620003fc565b634e487b7160e01b600052603260045260246000fd5b8051821015620004535760209160051b010190565b62000428565b634e487b7160e01b600052602260045260246000fd5b600181811c92911682811562000493575b5060208310146200048d57565b62000459565b607f1692503862000480565b9060031b620004b4600019821b5b9384921b90565b169119161790565b9190620004d162000180620004da93620003ec565b9083546200049f565b9055565b620000e891600091620004bc565b818110620004f8575050565b80620005086000600193620004de565b01620004ec565b9190601f81116200051f57505050565b62000533620000e893600052602060002090565b906020601f840160051c8301931062000555575b601f0160051c0190620004ec565b909150819062000547565b81519192916001600160401b038111620000cb576200058c816200058584546200046f565b846200050f565b6020601f8211600114620005cd578190620004da939495600092620005c1575b5050600019600383901b1c19169060011b1790565b015190503880620005ac565b601f19821694620005e384600052602060002090565b9160005b8781106200062257508360019596971062000607575b505050811b019055565b015160001960f8600385901b161c19169055388080620005fd565b90926020600181928686015181550194019101620005e7565b90620000e89162000560565b81811062000653575050565b80620006636000600193620004de565b0162000647565b9190918282106200067a57505050565b6200069e620006926200068e620000e89590565b9390565b91600052602060002090565b918201910162000647565b90680100000000000000008111620000cb5781620006c9620000e8935490565b908281556200066a565b8151916001600160401b038311620000cb57620006926200070091620006fa8585620006a9565b60200190565b60005b838110620007115750505050565b60019060206200072362000180865190565b940193818401550162000703565b90620000e891620006d3565b620001809062000227906001600160a01b031682565b62000180906200073d565b620001809062000753565b906200077d62000180620004da926200075e565b825490600160401b600160e01b039060401b600160401b600160e01b031990921691161790565b6200018090620007ba906001600160401b031682565b6001600160401b031690565b90620007da62000180620004da92620007a4565b82546001600160401b0319166001600160401b03919091161790565b906200080962000180620004da92151590565b825460ff191660ff9091161790565b979399959162000830909b97939995919b33620009aa565b88516200084762000843620001808d5190565b9190565b036200097857899a6200085b6000620003ec565b986200086a620001808b9d5190565b8c1015620008fe578c8b8d8c6200088e620001806200088a84866200043e565b5190565b119283620008c9575b505050620008b357620008ab8d9c62000412565b9b516200086a565b604051630590c51360e01b8152600490fd5b0390fd5b620008f49293506200088a82620008ed6200088a620008439562000180956200043e565b956200043e565b118b8d8f62000897565b620000e89b506200095e9699506200095694979a620009396200094e9495979a9e93620009316200094694600a6200063b565b600b6200063b565b825160a052600c62000731565b600d62000731565b601362000769565b6013620007c6565b6200096c6001600f620007f6565b60805260c05262000c76565b6040516302c3f8e160e21b8152600490fd5b620001806001620003ec565b906200018062000180620004da92620003ec565b90620009b691620009cc565b620000e8620009c46200098a565b600962000996565b90620000e891620009f7565b6200022762000180620001809290565b6200018090620009d8565b9052565b9062000a039062000a68565b62000a0f6000620009e8565b6001600160a01b0381166001600160a01b0383161462000a355750620000e89062000ac1565b620008c59062000a4460405190565b631e4fbdf760e01b8152918291600483016001600160a01b03909116815260200190565b620000e890620000e890620000e89062000b81565b9060031b620004b46001600160a01b03821b620004ad565b919062000aaa62000180620004da936200075e565b90835462000a7d565b620000e89160009162000a95565b620000e89062000ad46000600862000ab3565b62000b21565b620001809062000227565b62000180905462000ada565b9062000b0562000180620004da926200075e565b82546001600160a01b0319166001600160a01b03919091161790565b62000b4f62000b4862000b35600762000ae5565b62000b4284600762000af1565b6200075e565b916200075e565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e062000b7b60405190565b600090a3565b620000e89060026200063b565b620001809081906001600160601b031681565b620009f39062000b8e565b916020620000e892949362000bc681604081019762000ba1565b0152565b620001806040620000d1565b620001809062000bec906001600160601b031682565b6001600160601b031690565b9062000c0c62000180620004da9262000bd6565b8254906001600160a01b03199060a01b6001600160a01b0390921691161790565b62000c636020620000e89362000c5562000c4e82516001600160a01b031690565b8562000af1565b01516001600160601b031690565b9062000bf8565b90620000e89162000c2d565b9062000c8b62000c8562000d6d565b62000b8e565b8062000c978362000b8e565b1162000d37575062000caa6000620009e8565b6001600160a01b0381166001600160a01b0384161462000d0457509062000cfc620000e89262000cec62000cdd62000bca565b6001600160a01b039094168452565b6001600160601b03166020830152565b600562000c6a565b620008c59062000d1360405190565b635b6cc80560e11b8152918291600483016001600160a01b03909116815260200190565b90620008c562000d4660405190565b636f483d0960e01b81529283926004840162000bac565b62000bec62000180620001809290565b6200018061271062000d5d56fe6080604052600436101561001257600080fd5b60003560e01c8062fdd58e146102f157806301ffc9a7146102ec57806302045138146102e757806302fe5305146102e257806304634d8d146102dd57806306fdde03146102d85780630e89341c146102d357806318160ddd146102ce57806322fe44c3146102c9578063274a204b146102c45780632a55205a146102bf5780632d759d0f146102ba5780632eb2c2d6146102b55780632ed6d5e8146102b05780633115bba7146102ab5780633ccfd60b146102a6578063424aa884146102a157806345b9206e1461029c578063475ae039146102975780634e1273f4146102925780634f558e791461028d5780635944c753146102885780635e9dbe0c146102835780635f710f5c1461027e57806367808a3414610279578063700d19f21461027457806370da24ee1461026f578063715018a61461026a5780637254f9c01461026557806379ba5097146102605780638d3a3e381461025b5780638da5cb5b1461025657806390bac5611461025157806395d89b411461024c57806397cf84fc146102475780639823560c146102425780639cd237071461023d578063a22cb46514610238578063a3759f6014610233578063bd85b0391461022e578063e2bc7c1214610229578063e30c397814610224578063e8e61bb81461021f578063e985e9c51461021a578063f242432a146102155763f2fde38b03610315576113e1565b6113c5565b611368565b61132c565b611311565b6112f8565b6112b8565b61128e565b61109f565b611064565b611035565b61101a565b610fff565b610fd6565b610f3b565b610f1f565b610f07565b610eed565b610e63565b610e47565b610e0e565b610df3565b610dc7565b610da8565b610d2e565b610cea565b610cc2565b610b93565b610b74565b610aca565b610aa2565b610a89565b610a41565b610a25565b610880565b610851565b610814565b6107de565b610718565b6106fd565b6106c2565b6104d3565b61047b565b610407565b6103c5565b610363565b6001600160a01b031690565b90565b61030e816102f6565b0361031557565b600080fd5b9050359061032782610305565b565b8061030e565b9050359061032782610329565b919060408382031261031557806020610358610302938661031a565b940161032f565b9052565b346103155761039061037f61037936600461033c565b9061167c565b6040515b9182918290815260200190565b0390f35b6001600160e01b0319811661030e565b9050359061032782610394565b9060208282031261031557610302916103a4565b34610315576103906103e06103db3660046103b1565b6155a9565b6040515b91829182901515815260200190565b90602082820312610315576103029161031a565b346103155761041f61041a3660046103f3565b612083565b604051005b9181601f8401121561031557823591826001600160401b038111610315576020908186019501011161031557565b906020828203126103155781356001600160401b038111610315576104779201610424565b9091565b346103155761041f61048e366004610452565b90614c23565b6001600160601b03811661030e565b9050359061032782610494565b9190604083820312610315578060206104cc610302938661031a565b94016104a3565b346103155761041f6104e63660046104b0565b90615308565b600091031261031557565b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052602260045260246000fd5b600181811c929116828115610544575b50602083101461053f57565b61050d565b607f16925038610533565b8054600093929161056c61056283610523565b8085529360200190565b91600181169081156105be575060011461058557505050565b6105989192939450600052602060002090565b916000925b8184106105aa5750500190565b80548484015260209093019260010161059d565b60ff19168352505090151560051b019150565b906103029161054f565b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b0382111761061257604052565b6105db565b9061032761062460405190565b806106308180966105d1565b03906105f1565b906106455761030290610617565b6104f7565b6103026000600a610637565b60005b8381106106695750506000910152565b8181015183820152602001610659565b61069a6106a36020936106ad9361068e815190565b80835293849260200190565b95869101610656565b601f01601f191690565b0190565b906020610302928181520190610679565b34610315576106d23660046104ec565b6103906106dd61064a565b604051918291826106b1565b90602082820312610315576103029161032f565b34610315576103906106dd6107133660046106e9565b611631565b34610315576107283660046104ec565b61039061037f61341d565b63ffffffff811661030e565b9050359061032782610733565b909182601f830112156103155781359283926001600160401b038511610315578060208092019560051b01011161031557565b91909160a08184031261031557610796838261031a565b926107a4816020840161032f565b926107b2826040850161073f565b926107c0836060830161073f565b9260808201356001600160401b03811161031557610477920161074c565b61041f6107ec36600461077f565b94939093929192613eb5565b919060408382031261031557806020610358610302938661032f565b346103155761041f6108273660046107f8565b9061330d565b61035f906102f6565b91602061032792949361084d81604081019761082d565b0152565b346103155761086a6108643660046107f8565b90611ef3565b9061039061087760405190565b92839283610836565b346103155761039061037f6108963660046106e9565b613116565b906103276108a860405190565b92836105f1565b6001600160401b0381116106125760051b60200190565b909291926108db6108d6826108af565b61089b565b93602085838152019160051b83019281841161031557915b8383106109005750505050565b6020809161090e848661032f565b8152019201916108f3565b9080601f8301121561031557816020610302933591016108c6565b6001600160401b03811161061257602090601f01601f19160190565b90826000939282370152565b9092919261096c6108d682610934565b91829482845282820111610315576020610327930190610950565b9080601f83011215610315578160206103029335910161095c565b91909160a081840312610315576109b9838261031a565b926109c7816020840161031a565b9260408301356001600160401b03811161031557826109e7918501610919565b9260608101356001600160401b0381116103155783610a07918301610919565b9260808201356001600160401b038111610315576103029201610987565b346103155761041f610a383660046109a2565b939290926118b1565b3461031557610a513660046104ec565b61041f614bca565b909160608284031261031557610302610a72848461031a565b936040610a82826020870161032f565b940161073f565b346103155761041f610a9c366004610a59565b91614923565b3461031557610ab23660046104ec565b61041f614a23565b602081019291610327919061082d565b3461031557610ada3660046104ec565b6103907f00000000000000000000000000000000000000000000000000000000000000005b60405191829182610aba565b6001600160401b031690565b6001600160401b03811661030e565b9050359061032782610b17565b91909160a08184031261031557610b4a838261031a565b92610b58816020840161032f565b92610b66826040850161073f565b92610a078360608301610b26565b34610315576103906103e0610b8a366004610b33565b93929092614f88565b346103155761041f610ba63660046103f3565b611fe4565b90929192610bbb6108d6826108af565b93602085838152019160051b83019281841161031557915b838310610be05750505050565b60208091610bee848661031a565b815201920191610bd3565b9080601f830112156103155781602061030293359101610bab565b9190916040818403126103155780356001600160401b0381116103155783610c3d918301610bf9565b9260208201356001600160401b038111610315576103029201610919565b90610c7b610c74610c6a845190565b8084529260200190565b9260200190565b9060005b818110610c8c5750505090565b909192610ca9610ca26001928651815260200190565b9460200190565b929101610c7f565b906020610302928181520190610c5b565b3461031557610390610cde610cd8366004610c14565b90611740565b60405191829182610cb1565b34610315576103906103e0610d003660046106e9565b611e0b565b909160608284031261031557610302610d1e848461032f565b9360406104cc826020870161031a565b346103155761041f610d41366004610d05565b916154ab565b80151561030e565b9050359061032782610d47565b919060a08382031261031557610d72818461031a565b92610d80826020830161032f565b92610302610d91846040850161073f565b936080610da18260608701610d4f565b9401610b26565b346103155761039061037f610dbe366004610d5c565b93929092614ed7565b346103155761041f610dda3660046103f3565b611fbf565b906020828203126103155761030291610b26565b346103155761039061037f610e09366004610ddf565b614dd2565b3461031557610e1e3660046104ec565b6103907f0000000000000000000000000000000000000000000000000000000000000000610aff565b3461031557610e573660046104ec565b61039061037f600e5490565b3461031557610e733660046104ec565b61041f611445565b9160a08383031261031557610e90828461032f565b92610e9e836020830161073f565b9260408201356001600160401b0381116103155781610ebe91840161074c565b93909392610ecf8360608301610b26565b9260808201356001600160401b038111610315576104779201610424565b61041f610efb366004610e7b565b95949094939193613d90565b3461031557610f173660046104ec565b61041f611605565b346103155761039061037f610f3536600461033c565b90611fed565b3461031557610f4b3660046104ec565b610390610aff611403565b9060c08282031261031557610f6b818361032f565b92610f79826020850161073f565b92610f87836040830161073f565b9260608201356001600160401b0381116103155781610fa791840161074c565b93909392610fb88360808301610b26565b9260a08201356001600160401b038111610315576104779201610424565b61041f610fe4366004610f56565b96959095949194939293613e2c565b6103026000600b610637565b346103155761100f3660046104ec565b6103906106dd610ff3565b3461031557610390610cde6110303660046103f3565b61334a565b346103155761039061037f61104b3660046106e9565b613242565b906020828203126103155761030291610d4f565b346103155761041f611077366004611050565b614dc9565b919060408382031261031557806020611098610302938661031a565b9401610d4f565b346103155761041f6110b236600461107c565b90611805565b906110c7610c74610c6a845190565b9060005b8181106110d85750505090565b9091926110f7610ca260019286516001600160501b0316815260200190565b9291016110cb565b9061110e610c74610c6a845190565b9060005b81811061111f5750505090565b90919261113b610ca2600192865163ffffffff16815260200190565b929101611112565b90611152610c74610c6a845190565b9060005b8181106111635750505090565b909192611179610ca26001928651815260200190565b929101611156565b90611190610c74610c6a845190565b9060005b8181106111a15750505090565b9091926111bc610ca2600192865162ffffff16815260200190565b929101611194565b906103029060c08061123361122161120f6111fd6111eb895160e0895260e08901906110b8565b60208a015188820360208a01526110b8565b604089015187820360408901526110ff565b60608801518682036060880152611143565b60808701518582036080870152611181565b60a0808701516001600160401b0316908501529401516001600160401b0316910152565b916112809061127261030295936060865260608601906111c4565b908482036020860152610c5b565b916040818403910152610c5b565b34610315576103906112a96112a43660046106e9565b613c4e565b60405191939193849384611257565b346103155761039061037f6112ce3660046106e9565b61342a565b906020828203126103155781356001600160401b03811161031557610477920161074c565b346103155761041f61130b3660046112d3565b906130d7565b34610315576113213660046104ec565b610390610aff611498565b346103155761041f61133f3660046107f8565b90613238565b919060408382031261031557806020611361610302938661031a565b940161031a565b34610315576103906103e061137e366004611345565b90611810565b91909160a0818403126103155761139b838261031a565b926113a9816020840161031a565b926113b7826040850161032f565b92610a07836060830161032f565b346103155761041f6113d8366004611384565b93929092611847565b346103155761041f6113f43660046103f3565b611560565b61030290546102f6565b61030260076113f9565b61141561144d565b610327611433565b6102f66103026103029290565b6103029061141d565b610327611440600061142a565b6115af565b61032761140d565b611455611403565b3390611469611463836102f6565b916102f6565b036114715750565b6114949061147e60405190565b63118cdaa760e01b815291829160048301610aba565b0390fd5b61030260086113f9565b610327906114ae61144d565b611509565b610302906102f6906001600160a01b031682565b610302906114b3565b610302906114c7565b906114e9610302611505926114d0565b82546001600160a01b0319166001600160a01b03919091161790565b9055565b6115148160086114d9565b61152d611527611522611403565b6114d0565b916114d0565b907f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270061155860405190565b80805b0390a3565b610327906114a2565b9060031b6115826001600160a01b03821b5b9384921b90565b169119161790565b919061159b610302611505936114d0565b908354611569565b6103279160009161158a565b610327906115bf600060086115a3565b6115da6115276115cf60076113f9565b6115228460076114d9565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e061155860405190565b3361160e611498565b61161a611463836102f6565b0361147157610327906115af565b61030290610617565b506103026002611628565b6103026103026103029290565b906116539061163c565b600052602052604060002090565b90611653906114d0565b6103029081565b610302905461166b565b6116939061168e610302936000611649565b611661565b611672565b9081526040810192916103279160200152565b906116b86108d6836108af565b918252565b369037565b906103276116cf836116ab565b602081946116df601f19916108af565b0191016116bd565b634e487b7160e01b600052601160045260246000fd5b600019811461170c5760010190565b6116e7565b634e487b7160e01b600052603260045260246000fd5b805182101561173b5760209160051b010190565b611711565b90611749825190565b61175b611757610302845190565b9190565b036117d55761177061176b835190565b6116c2565b9161177b600061163c565b611786610302835190565b8110156117cf57806117c56117b86117a86117ca948660209160051b01015190565b600584901b870160200151610379565b6117c28388611727565b52565b6116fd565b61177b565b50505090565b5190516117e2565b915190565b906114946117ef60405190565b635b05999160e01b815292839260048401611698565b610327919033611aa2565b6103029161168e611822926001611661565b5460ff1690565b91602061032792949361184081604081019761082d565b019061082d565b949392919033611856816102f6565b61185f886102f6565b14158061189a575b611876575061032794956118f3565b869061149461188460405190565b63711bec9160e11b815292839260048401611829565b506118ac6118a88289611810565b1590565b611867565b9493929190336118c0816102f6565b6118c9886102f6565b1415806118e0575b61187657506103279495611a28565b506118ee6118a88289611810565b6118d1565b909194939294611903600061142a565b61190c816102f6565b80611916866102f6565b1461196257611924846102f6565b146119405750610327949561193891611de6565b929091611985565b6114949061194d60405190565b626a0d4560e21b815291829160048301610aba565b6114948261196f60405190565b632bfa23e760e11b815291829160048301610aba565b9193929061199582868386615644565b6119a76119a2600061142a565b6102f6565b6119b0826102f6565b036119bd575b5050505050565b33926119c7865190565b6119d4611757600161163c565b03611a1857611a08611a0e966119fb6119ed600061163c565b809260209160051b01015190565b9460209160051b01015190565b93611bd4565b38808080806119b6565b611a23959293611d40565b611a0e565b9493929190611a37600061142a565b95611a41876102f6565b80611a4b846102f6565b14611a7657611a59826102f6565b14611a6957610327959650611985565b6114948761194d60405190565b6114948861196f60405190565b90611a9361030261150592151590565b825460ff191660ff9091161790565b611aac600061142a565b611ab5816102f6565b611abe846102f6565b14611b17575061155b611b0d611b078361152287611b028861168e7f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31996001611661565b611a83565b936114d0565b936103e460405190565b61149490611b2460405190565b62ced3e160e81b815291829160048301610aba565b9050519061032782610394565b906020828203126103155761030291611b39565b9193611b8860a094611b816103029897611b7787611b8f9761082d565b602087019061082d565b6040850152565b6060830152565b8160808201520190610679565b6040513d6000823e3d90fd5b906116b86108d683610934565b3d15611bcf57611bc43d611ba8565b903d6000602084013e565b606090565b9193929094611bef95853b611be9600061163c565b97889190565b11611bfe575b50505050505050565b6000602094611c36611c126115228a6114d0565b94611c1c60405190565b9889978896879563f23a6e6160e01b875260048701611b5a565b03925af160009181611cbe575b50611c895750611c5a565b38808080808080611bf5565b611c62611bb5565b91611c6e610302845190565b03611c80576114949061196f60405190565b50805190602001fd5b909150611ca663f23a6e6160e01b5b916001600160e01b03191690565b03611cb15750611c4e565b6114949061196f60405190565b611ce091925060203d8111611ce7575b611cd881836105f1565b810190611b46565b9038611c43565b503d611cce565b93906103029593611d13611d3294611d0988611d249561082d565b602088019061082d565b60a0604087015260a0860190610c5b565b908482036060860152610c5b565b916080818403910152610679565b9193929094611d5595853b611be9600061163c565b11611d635750505050505050565b6000602094611d9b611d776115228a6114d0565b94611d8160405190565b9889978896879563bc197c8160e01b875260048701611cee565b03925af160009181611dc6575b50611db35750611c5a565b909150611ca663bc197c8160e01b611c98565b611ddf91925060203d8111611ce757611cd881836105f1565b9038611da8565b9160806040518094600182526020820152604081019360018552606082015201604052565b611e149061342a565b611e21611757600061163c565b1190565b9061035f906102f6565b6103029060a01c5b6001600160601b031690565b6103029054611e2f565b906001600160601b03169052565b610302604061089b565b90610327611e71611e5b565b6020611e8f8295611e8a611e84826113f9565b85611e25565b611e43565b9101611e4d565b61030290611e65565b61030290516102f6565b6103029081906001600160601b031681565b8181029291811591840414171561170c57565b634e487b7160e01b600052601260045260246000fd5b8115611eee570490565b611ece565b611f04611f09919392936006611649565b611e96565b91611f1383611e9f565b611f236114636119a2600061142a565b14611f6c575b611f66611f5561175792611f4f611f4a60208801516001600160601b031690565b611ea9565b90611ebb565b611f60611f4a611f98565b90611ee4565b92611e9f565b9150611757611f66611f55611f816005611e96565b9492505050611f29565b611e376103026103029290565b610302612710611f8b565b61032790611faf61144d565b6001611b02610327926014611661565b61032790611fa3565b61032790611fd461144d565b6000611b02610327926014611661565b61032790611fc8565b61030291611ffd6120029261334a565b611727565b5190565b6103279061201261144d565b61204e565b90612027610302611505926114d0565b825490600160401b600160e01b039060401b600160401b600160e01b031990921691161790565b61207e7faea1573caf7b4fdd079b947d86c1be6c725642c47582f8f9bd2c7d2a30bf0bd991610aff816013612017565b0390a1565b61032790612006565b906103279161209961144d565b612dcc565b610302906006611ebb565b9060031b611582600019821b61157b565b91906120cb6103026115059361163c565b9083546120a9565b610327916000916120ba565b8181106120ea575050565b806120f860006001936120d3565b016120df565b9060001960209190910360031b1c8154169055565b91909182821061212257505050565b612133610327936002600391010490565b90600a600361214f600286018290045b93600052602060002090565b92830194060280612163575b5001906120df565b6121719060001985016120fe565b3861215b565b90600160401b8111610612578161218f610327935490565b90828155612113565b600061032791612177565b906106455761032790612198565b8181106121bc575050565b806121ca60006001936120d3565b016121b1565b9190918282106121df57505050565b6103279260070160031c90601c6122036007850160031c5b92600052602060002090565b9182019360021b1680612219575b5001906121b1565b6122279060001985016120fe565b38612211565b90600160401b81116106125781612245610327935490565b908281556121d0565b60006103279161222d565b90610645576103279061224e565b91906120cb6103026115059390565b61032791600091612267565b81811061228d575050565b8061229b6000600193612276565b01612282565b9190918282106122b057505050565b6122d06122c46122c06103279590565b9390565b91600052602060002090565b9182019101612282565b90600160401b811161061257816122f2610327935490565b908281556122a1565b6000610327916122da565b9061064557610327906122fb565b81811061231f575050565b8061232d60006001936120d3565b01612314565b91909182821061234257505050565b612353610327936009600a91010490565b906003600a61236760098601829004612143565b9283019406028061237b575b500190612314565b6123899060001985016120fe565b38612373565b90600160401b811161061257816123a7610327935490565b90828155612333565b60006103279161238f565b9061064557610327906123b0565b60056000916123d883826121a3565b6123e583600183016121a3565b6123f28360028301612259565b6123ff8360038301612306565b61240c83600483016123bb565b0155565b9061064557610327906123c9565b818110612429575050565b806124376000600693612410565b0161241e565b91909182821061244c57505050565b6124646122c461245e6103279561209e565b9361209e565b918201910161241e565b90600160401b81116106125781612486610327935490565b9082815561243d565b60006103279161246e565b90610645576103279061248f565b90359060de1981360301821215610315570190565b9082101561173b576103029160051b8101906124a8565b3561030281610b17565b9190820391821161170c57565b610b0b6103026103029290565b61030261012c6124eb565b61251e906001600160401b03165b916001600160401b031690565b01906001600160401b03821161170c57565b903590601e1981360301821215610315570180359182916001600160401b03841161031557602001809360051b36031261031557565b61030260e061089b565b6001600160501b03811661030e565b9050359061032782612570565b9092919261259c6108d6826108af565b93602085838152019160051b83019281841161031557915b8383106125c15750505050565b602080916125cf848661257f565b8152019201916125b4565b61030291369161258c565b909291926125f56108d6826108af565b93602085838152019160051b83019281841161031557915b83831061261a5750505050565b60208091612628848661073f565b81520192019161260d565b6103029136916125e5565b9092919261264e6108d6826108af565b93602085838152019160051b83019281841161031557915b8383106126735750505050565b60208091612681848661032f565b815201920191612666565b61030291369161263e565b62ffffff811661030e565b9050359061032782612697565b909291926126bf6108d6826108af565b93602085838152019160051b83019281841161031557915b8383106126e45750505050565b602080916126f284866126a2565b8152019201916126d7565b6103029136916126af565b805482101561173b57612722600691600052602060002090565b91020190600090565b9060031b6115826001600160501b03821b61157b565b9061274a815190565b906001600160401b038211610612576121f76127709161276a8486612177565b60200190565b600382049160005b8381106127e1575060038302900380612792575b50505050565b92600093845b8181106127ad5750505001553880808061278c565b90919460206127d76001926127cc6103028a516001600160501b031690565b9085600a029061272b565b9601929101612798565b6000805b600381106127fa575083820155600101612778565b9590602061282360019261281861030286516001600160501b031690565b908a600a029061272b565b920196016127e5565b9061032791612741565b9060031b61158263ffffffff821b61157b565b61285c6103026103029263ffffffff1690565b63ffffffff1690565b9061286e815190565b906001600160401b038211610612576121f761288e9161276a848661222d565b8160031c9160005b8381106128fc575060071981169003806128b05750505050565b92600093845b8181106128cb5750505001553880808061278c565b90919460206128f26001926128e76103028a5163ffffffff1690565b908560021b90612836565b96019291016128b6565b6000805b60088110612915575083820155600101612896565b9590602061293b600192612930610302865163ffffffff1690565b908a60021b90612836565b92019601612900565b9061032791612865565b8151916001600160401b038311610612576122c46129709161276a85856122da565b60005b8381106129805750505050565b6001906020612990610302865190565b9401938184015501612973565b906103279161294e565b9060031b61158262ffffff821b61157b565b906129c2815190565b906001600160401b038211610612576121f76129e29161276a848661238f565b600a82049160005b838110612a4e5750600a8302900380612a035750505050565b92600093845b818110612a1e5750505001553880808061278c565b9091946020612a44600192612a396103028a5162ffffff1690565b9085600302906129a7565b9601929101612a09565b6000805b600a8110612a675750838201556001016129ea565b95906020612a8c600192612a81610302865162ffffff1690565b908a600302906129a7565b92019601612a52565b90610327916129b9565b610b0b610302610302926001600160401b031690565b90612ac561030261150592612a9f565b825467ffffffffffffffff19166001600160401b039091161790565b90612af161030261150592612a9f565b82549067ffffffffffffffff60401b9060401b67ffffffffffffffff60401b1990921691161790565b90612bc060c0600561032794612b37612b31865190565b8261282c565b612b4e612b45602087015190565b6001830161282c565b612b65612b5c604087015190565b60028301612944565b612b7c612b73606087015190565b6003830161299d565b612b93612b8a608087015190565b60048301612a95565b0192612bb2612bac60a08301516001600160401b031690565b85612ab5565b01516001600160401b031690565b90612ae1565b91906106455761032791612b1a565b80549190600160401b8310156106125782612bf891600161032795018155612708565b90612bc6565b5061030290602081019061257f565b818352602090920191906000825b828210612c29575050505090565b90919293612c58612c51600192612c408886612bfe565b6001600160501b0316815260200190565b9560200190565b93920190612c1b565b5061030290602081019061073f565b818352602090920191906000825b828210612c8c575050505090565b90919293612cb1612c51600192612ca38886612c61565b63ffffffff16815260200190565b93920190612c7e565b9037565b8183529091602001916001600160fb1b0381116103155782916106ad9160051b938491612cba565b506103029060208101906126a2565b818352602090920191906000825b828210612d11575050505090565b90919293612d35612c51600192612d288886612ce6565b62ffffff16815260200190565b93920190612d03565b979060c09995612dab976103279d9f9e9c968b612d8191612d9d98612d73612d8f97612dbd9f9a60e0865260e0860191612c0d565b926020818503910152612c0d565b918b830360408d0152612c70565b9188830360608a0152612cbe565b918583036080870152612cf5565b6001600160401b0390971660a0830152565b01906001600160401b03169052565b90612dd96000600e61249a565b612de3600061163c565b612ded600161163c565b600e915b80848110156130cf57821115613071575b612e0d8185876124bd565b60a001612e19906124d4565b612e248286886124bd565b60c001612e30906124d4565b612e3991615a4b565b612e448185876124bd565b612e4d90615ace565b612e588185876124bd565b80612e6291612530565b908587612e708583836124bd565b60208101612e7d91612530565b90612e898785856124bd565b60408101612e9691612530565b90612ea28987876124bd565b60608101612eaf91612530565b929093612ebd8b89896124bd565b60808101612eca91612530565b9690978c612ed9818c846124bd565b60a001612ee5906124d4565b9a612eef926124bd565b60c001612efb906124d4565b99612f04612566565b9b612f0e916125da565b8b52612f19916125da565b60208a0152612f2791612633565b6040880152612f359161268c565b6060860152612f43916126fd565b60808401526001600160401b031660a08301526001600160401b031660c0820152612f6e9084612bd5565b612f798185876124bd565b80612f8391612530565b90612f8f8387896124bd565b60208101612f9c91612530565b92909187612fab86828c6124bd565b60408101612fb891612530565b8b612fc78985839695966124bd565b60608101612fd491612530565b90612fe08b86856124bd565b60808101612fed91612530565b9490938c612ffc8189846124bd565b60a001613008906124d4565b97613012926124bd565b60c00161301e906124d4565b966130288d61163c565b9b61303260405190565b9b8c9b61303f9b8d612d3e565b037f7fec20ffa7d178b5b4d9eb21ec7ff2a1376af8e08ab6cb4c691750db41fc40d191a261306c906116fd565b612df1565b61308760a06130818387896124bd565b016124d4565b6130b7612511610b0b6130a960c06130816130a289896124de565b8b8d6124bd565b6130b16124f8565b90612503565b1015612e0257604051636bc1af9360e01b8152600490fd5b505050505050565b906103279161208c565b805482101561173b576130f990600052602060002090565b0190600090565b6103029160031b1c81565b906103029154613100565b61312461030291600c6130e1565b9061310b565b906103279161313761144d565b7f00000000000000000000000000000000000000000000000000000000000000008110156132265761316d61312482600c6130e1565b61317a611757600061163c565b14158061320d575b6131fb576131926103028261342a565b82106131e9576131e46131da826131d5856131cf7fc95161027a9b2f0376fa8fa5f504100ccc4748c73f4e479bac3778d02ee5621c96600c6130e1565b906120ba565b61163c565b9261038360405190565b0390a2565b60405163fb7af64960e01b8152600490fd5b60405163430b83b160e11b8152600490fd5b5061321f61030261312483600c6130e1565b8211613182565b6040516307ed98ed60e31b8152600490fd5b906103279161312a565b61312461030291600d6130e1565b906103279161325d61144d565b7f00000000000000000000000000000000000000000000000000000000000000008110156132265761329361312482600c6130e1565b6132a0611757600061163c565b11806132f4575b6132e2576131e46131da826131d5856131cf7f0c899f003b7b88b925c6cdfe9b56bc4df2b91107f0f6d1cec1c3538d156bbe4896600d6130e1565b604051630590c51360e01b8152600490fd5b5061330661030261312483600c6130e1565b82116132a7565b9061032791613250565b6103029061285c565b6103029054613317565b6103026103026103029263ffffffff1690565b9190820180921161170c57565b907f000000000000000000000000000000000000000000000000000000000000000091613376836116c2565b90613380600e5490565b9261338b600061163c565b93613397611757869790565b945b8187101561341357805b868110156133fe57806117c56133ef6133dd6133d86133d38a61168e8f6133ce6133f99a6010611649565b611649565b613320565b61332a565b6133ea6120028d8c611727565b61333d565b6117c28b8a611727565b6133a3565b5091909561340b906116fd565b959091613399565b5050935050905090565b6103026103026004611672565b61030290611693610302916003611649565b613444612566565b90816060808252602082015260606040820152606080820152613465606090565b608082015260c06000918260a08201520152565b61030261343c565b610302905b6001600160501b031690565b6103029060501c613486565b6103029060a01c613486565b906001906134bc612143610c6a855490565b600092613546575b5490808310613529575b80831061350c575b82106134e3575b806117cf565b82613503600193946134f660209461349e565b6001600160501b03169052565b019101386134dd565b91926020816135206001936134f686613492565b019301916134d6565b919260208161353d6001936134f686613481565b019301916134ce565b816002840110156134c4579260016060600392613588875461356b836134f683613481565b61357b602084016134f683613492565b6134f6604084019161349e565b019401920191613546565b90610302916134aa565b906103276135aa60405190565b80610630818096613593565b6103029060201c61285c565b6103029060401c61285c565b6103029060601c61285c565b6103029060801c61285c565b6103029060a01c61285c565b6103029060c01c61285c565b6103029060e01c61285c565b9060019061361c612143610c6a855490565b600092613752575b5490808310613735575b808310613718575b8083106136fb575b8083106136de575b8083106136c1575b8083106136a4575b808310613687575b821061366a57806117cf565b826135036001939461367d6020946135fe565b63ffffffff169052565b919260208161369b60019361367d866135f2565b0193019161365e565b91926020816136b860019361367d866135e6565b01930191613656565b91926020816136d560019361367d866135da565b0193019161364e565b91926020816136f260019361367d866135ce565b01930191613646565b919260208161370f60019361367d866135c2565b0193019161363e565b919260208161372c60019361367d866135b6565b01930191613636565b919260208161374960019361367d86613317565b0193019161362e565b81600784011015613624579260016101006008926137e587546137788361367d83613317565b6137886020840161367d836135b6565b6137986040840161367d836135c2565b6137a86060840161367d836135ce565b6137b86080840161367d836135da565b6137c860a0840161367d836135e6565b6137d860c0840161367d836135f2565b61367d60e08401916135fe565b019401920191613752565b906103029161360a565b9061032761380760405190565b806106308180966137f0565b906138226121f7610c6a845490565b9060005b8181106138335750505090565b90919261385761385060019261384887611672565b815260200190565b9460010190565b929101613826565b9061030291613813565b9061032761387660405190565b8061063081809661385f565b610302905b62ffffff1690565b6103029060181c613887565b6103029060301c613887565b6103029060481c613887565b6103029060601c613887565b6103029060781c613887565b6103029060901c613887565b6103029060a81c613887565b6103029060c01c613887565b6103029060d81c613887565b9060019061390d612143610c6a855490565b600092613a8c575b5490808310613a6f575b808310613a52575b808310613a35575b808310613a18575b8083106139fb575b8083106139de575b8083106139c1575b8083106139a4575b808310613987575b821061396b57806117cf565b826135036001939461397e6020946138ef565b62ffffff169052565b919260208161399b60019361397e866138e3565b0193019161395f565b91926020816139b860019361397e866138d7565b01930191613957565b91926020816139d560019361397e866138cb565b0193019161394f565b91926020816139f260019361397e866138bf565b01930191613947565b9192602081613a0f60019361397e866138b3565b0193019161393f565b9192602081613a2c60019361397e866138a7565b01930191613937565b9192602081613a4960019361397e8661389b565b0193019161392f565b9192602081613a6660019361397e8661388f565b01930191613927565b9192602081613a8360019361397e86613882565b0193019161391f565b8160098401101561391557926001610140600a92613b418754613ab28361397e83613882565b613ac26020840161397e8361388f565b613ad26040840161397e8361389b565b613ae26060840161397e836138a7565b613af26080840161397e836138b3565b613b0260a0840161397e836138bf565b613b1260c0840161397e836138cb565b613b2260e0840161397e836138d7565b613b33610100840161397e836138e3565b61397e6101208401916138ef565b019401920191613a8c565b90610302916138fb565b90610327613b6360405190565b80610630818096613b4c565b61030290610b0b565b6103029054613b6f565b6103029060401c610b0b565b6103029054613b82565b90610327613ba4612566565b60c0613c3760058396613bbd613bb98261359d565b8652565b613bd3613bcc6001830161359d565b6020870152565b613be9613be2600283016137fa565b6040870152565b613bff613bf860038301613869565b6060870152565b613c15613c0e60048301613b56565b6080870152565b01613c32613c2282613b78565b6001600160401b031660a0860152565b613b8e565b6001600160401b0316910152565b61030290613b98565b613c56613479565b50613c63610302600e5490565b811015613c9757613c733361334a565b91613c92613c8c613c843385613ca9565b93600e612708565b50613c45565b929190565b60405163e82a532960e01b8152600490fd5b91907f000000000000000000000000000000000000000000000000000000000000000092613cd6846116c2565b92613ce8613ce4600061163c565b9590565b945b85811015613d3157806117c5613d22613d156133d86133d38961168e613d2c986133ce8c6010611649565b6133ea612002858b611727565b6117c28389611727565b613cea565b509350505090565b90613d50969594939291613d4b613db9565b613d70565b610327613df9565b61285c6103026103029290565b61030291369161095c565b9490613d8961032797613d836000613d58565b93613d65565b953361454d565b90610327969594939291613d39565b610302600261163c565b906103026103026115059261163c565b613dc36009611672565b613dcb613d9f565b908114613ddd57610327906009613da9565b604051633ee5aeb560e01b8152600490fd5b610302600161163c565b610327613e04613def565b6009613da9565b90613d5097969594939291613e1e613db9565b9561032797613d8991613d65565b9061032797969594939291613e0b565b9493929190613e4f611822336014611661565b600190151503613e625761032795613e93565b60405163ea8e4eb560e01b8152600490fd5b613e7e6001611ba8565b600360fc1b602082015290565b610302613e74565b926103279592949194613ea4613e8b565b95613eaf60006124eb565b9561454d565b906103279594939291613e3c565b96959493929190613ed38261332a565b613ee161312483600c6130e1565b613eee611757600061163c565b119081613f16575b50613f045761032797614098565b60405163800113cb60e01b8152600490fd5b613f2491506133ea8361342a565b613f3861175761030261312485600c6130e1565b1138613ef6565b6103029060401c6102f6565b6103029054613f3f565b6134866103026103029290565b613f7d906001600160501b03165b916001600160501b031690565b01906001600160501b03821161170c57565b6134866103026103029263ffffffff1690565b613fb4906001600160501b0316613f70565b02906001600160501b03821691820361170c57565b6103029081906001600160501b031681565b6138876103026103029290565b6103026103026103029262ffffff1690565b61400f9063ffffffff165b9163ffffffff1690565b019063ffffffff821161170c57565b61402a61035f916102f6565b60601b90565b60e01b90565b61035f9063ffffffff1660e01b90565b90601892614057836106ad9361401e565b6014830190614036565b9061407161030261150592612849565b825463ffffffff191663ffffffff9091161790565b6103026000611ba8565b610302614086565b95946140ce9194959392936140ac426124eb565b906000996140ba6013613f4b565b6140c66119a28d61142a565b9586916102f6565b03614528575b50506140df90614dd2565b956140ee613c8c88600e612708565b9815614511576140fe6000613f55565b935b7f00000000000000000000000000000000000000000000000000000000000000009361412b856102f6565b14928386898d836144e4575b5050506144d2578a926080840189898c61415e614155848651611727565b5162ffffff1690565b61417461416b6000613fdb565b9162ffffff1690565b1161447c575b908e935061418c61312484600d6130e1565b614199611757600061163c565b11614426575b60406141d59801936141bf6141b5858751611727565b5163ffffffff1690565b6141c96000613d58565b998a9163ffffffff1690565b116143f0575b505050505060608c01916141f36120028b8551611727565b614200611757600061163c565b0361430f575b505050505061428d6142a89461425f61425861424e61424988614295996103279f8d9a908b916133ce9b156142b6575b5050505061424386613f8f565b90613fa2565b613fc9565b6133ea6012611672565b6012613da9565b6133d86142758a61168e876133ce8d6010611649565b6142878361428283613320565b613ffa565b90614061565b956011611649565b6142a2846133ea83611672565b90613da9565b6142b0614090565b9261455d565b6142496142f5614306956142f06142e36142d26142fe966114d0565b976142dc306114d0565b9751611727565b516001600160501b031690565b613f62565b6142438c613f8f565b9133906145e5565b80893880614236565b6103026120028b61436e8f95614369611757968a6143506143759a61434261433660405190565b93849260208401614046565b03601f1981018352826105f1565b61436261435b825190565b9160200190565b209261268c565b6147cc565b9551611727565b036143de5763ffffffff16908111908589888a856143b3575b50505050506143a1573880808080614206565b60405163b4f3729b60e01b8152600490fd5b6143d394955061285c939261168e614282936133ce6133d3946010611649565b11388589888a61438e565b6040516309bde33960e01b8152600490fd5b8361436e61285c936142826133d36141b59561168e6144179a6133ce6140059b6010611649565b116143a15738898b8a8e6141db565b505061444692955061443791614843565b6144408961332a565b9061333d565b61445a6117576103026131248c600d6130e1565b1161446a578a928a898b8a61419f565b60405163751304ed60e11b8152600490fd5b6144b1939497508261436e6144ac936144406144a6611693611757986133ce614155986011611649565b9161332a565b613fe8565b116144c1578a923889898c61417a565b60405162d0844960e21b8152600490fd5b604051630717c22560e51b8152600490fd5b6145079350916142f06142e36144fe936142499551611727565b6142438a613f8f565b341086898d614137565b6145226142e38760208c0151611727565b93614100565b8161453c929b506140df9350878933614f88565b9861454681615a8e565b90386140d4565b9061032797969594939291613ec3565b9093929161456b600061142a565b94614575866102f6565b61457e846102f6565b146145925761032794959161193891611de6565b6114948661196f60405190565b6145b26140306103029263ffffffff1690565b6001600160e01b03191690565b60409061084d61032794969593966145db83606081019961082d565b602083019061082d565b90916146289061461a610327956145ff6323b872dd61459f565b9261460960405190565b9687946020860152602485016145bf565b03601f1981018452836105f1565b61464e565b9050519061032782610d47565b90602082820312610315576103029161462d565b61465a614661916114d0565b91826146c8565b8051614670611757600061163c565b141590816146a4575b506146815750565b6114949061468e60405190565b635274afe760e01b815291829160048301610aba565b6146c29150806020806146b86118a8945190565b830101910161463a565b38614679565b610302916146d6600061163c565b6146df306114d0565b81813110614709575060008281926020610302969551920190855af1614703611bb5565b9161472c565b6114949061471660405190565b63cd78605960e01b815291829160048301610aba565b9015614738565b501590565b15614743575061479d565b61475e61474e835190565b614758600061163c565b91829190565b149081614792575b5061476f575090565b6114949061477c60405190565b639996b31560e01b815291829160048301610aba565b9050813b1438614766565b80516147ac611757600061163c565b11156147ba57805190602001fd5b604051630a12f52160e11b8152600490fd5b6147d6600061163c565b915b6147e3610302835190565b8310156148105761480461480a916147fe6120028686611727565b90614816565b926116fd565b916147d8565b91505090565b81811015614831579061030291600052602052604060002090565b61030291600052602052604060002090565b61484d600061163c565b91829361485c610302600e5490565b945b858510156148925761488661488c916144406133d86133d38861168e896133ce8d6010611649565b946116fd565b9361485e565b945092505050565b9061032792916148a861144d565b91906148b38261332a565b6148c161312483600c6130e1565b6148ce611757600061163c565b1190816148e4575b50613f04576103279261490d565b6148f291506133ea8361342a565b61490661175761030261312485600c6130e1565b11386148d6565b9061491a6103279361332a565b906142b0614090565b90610327929161489a565b61493661144d565b610327614970600080730b98151bedee73f9ba5f2c7b72dea02d38ce49fc61495e6012611672565b60405190818003925af1614733611bb5565b614a1157614981614258600061163c565b61498a306114d0565b316149c960008061499a60405190565b600090857f00000000000000000000000000000000000000000000000000000000000000005af1614733611bb5565b6149ff5761207e61037f7f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d926133ea6012611672565b604051631d42c86760e21b8152600490fd5b6040516312171d8360e31b8152600490fd5b61032761492e565b614a3361144d565b610327614a5c565b9050519061032782610329565b906020828203126103155761030291614a3b565b7f0000000000000000000000000000000000000000000000000000000000000000614a8a6119a2600061142a565b614a93826102f6565b14614bb857614b12614aa4826114d0565b614acd730b98151bedee73f9ba5f2c7b72dea02d38ce49fc614ac66012611672565b9083614bd2565b614ada614258600061163c565b6020614ae5826114d0565b614aee306114d0565b90614af860405190565b948592839182916370a0823160e01b835260048301610aba565b03915afa908115614bb357611b076131e4926131da927fbe7426aee8a34d0263892b55ce65ce81d8f4c806eb4719e59015ea49feb92d2295600092614b7f575b508161424e917f000000000000000000000000000000000000000000000000000000000000000090614bd2565b61424e919250614ba59060203d8111614bac575b614b9d81836105f1565b810190614a48565b9190614b52565b503d614b93565b611b9c565b60405163a47ca0b760e01b8152600490fd5b610327614a2b565b6146286103279361461a614be963a9059cbb61459f565b91614bf360405190565b958693602085015260248401610836565b9061032791614c1161144d565b61032791614c1e91613d65565b614d82565b9061032791614c04565b818110614c38575050565b80614c4660006001936120d3565b01614c2d565b9190601f8111614c5b57505050565b614c6d61032793600052602060002090565b906020601f840160051c83019310614c8d575b601f0160051c0190614c2d565b9091508190614c80565b9060001960039190911b1c191690565b81614cb191614c97565b9060011b1790565b81519192916001600160401b03811161061257614ce081614cda8454610523565b84614c4c565b6020601f8211600114614d0f578190611505939495600092614d04575b5050614ca7565b015190503880614cfd565b601f19821694614d2484600052602060002090565b9160005b878110614d60575083600195969710614d46575b505050811b019055565b614d56910151601f841690614c97565b9055388080614d3c565b90926020600181928686015181550194019101614d28565b9061032791614cb9565b610327906002614d78565b61032790614d9961144d565b61207e7fbcde07732ba7563e295b3edc0bf5ec939a471d93d850a58a6f2902c0ed323728916103e081600f611a83565b61032790614d8d565b614ddc600061163c565b90614de9610302600e5490565b915b82811015613c9757614e0d610b0b6005614e0684600e612708565b5001613b78565b6001600160401b038316908110159081614e35575b5061481057614e30906116fd565b614deb565b9050614e51610b0b6005614e4a85600e612708565b5001613b8e565b1138614e22565b61035f906001600160401b031660c01b90565b969260899895614eb5614ed096614ea9614ebf94614e9f614ec99860148f6106ad9f9a81614e989161401e565b019061401e565b60288d0190614036565b151560f81b602c8b0152565b602d89019061401e565b6041870190614e58565b6049850152565b6069830152565b90919293614ee56013613f4b565b614ef56114636119a2600061142a565b14614f765761030294614f3c9361434292614f0f306114d0565b91614f24614f1d6013613f4b565b9187611fed565b93614f2e60405190565b988997469560208a01614e6b565b614f4761435b825190565b207b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b600052601c52603c60002090565b6040516353bd4fb360e11b8152600490fd5b91909392614f94600090565b50614fb784614fa36013613f4b565b614fb1846001878b8a614ed7565b90615028565b614fef576000614fb192614fd596614fcf6013613f4b565b95614ed7565b614fea5760405162b7fad960e11b8152600490fd5b600090565b5050505050600190565b634e487b7160e01b600052602160045260246000fd5b6004111561501957565b614ff9565b906103278261500f565b91906150348282615089565b5061504b615045600096939661501e565b9161501e565b149384615072575b5083156150605750505090565b61506a93506151f0565b3880806117cf565b909350615081611463856102f6565b149238615053565b8151615098611757604161163c565b036150c257906150bb916020820151906060604084015193015160001a90615117565b9192909190565b506150d86131d56150d3600061142a565b925190565b909160029190565b6103029061163c565b61084d6103279461511060609498979561510685608081019b9052565b60ff166020850152565b6040830152565b9091615122846150e0565b6151446117576fa2a8918ca85bafe22016d0b997e4df60600160ff1b0361163c565b116151bf57906151666020946000949361515d60405190565b948594856150e9565b838052039060015afa15614bb357600051615181600061142a565b61518a816102f6565b615193836102f6565b146151ab57506151a3600061163c565b909160009190565b90506151b7600061163c565b909160019190565b5050506151cc600061142a565b9160039190565b806151e360409261030295949052565b8160208201520190610679565b60009291614342615220859461520560405190565b9283916020830195630b135d3f60e11b8752602484016151d3565b51915afa61522c611bb5565b8161526f575b8161523b575090565b615255915060208061524b835190565b8301019101614a48565b61526b611757610302630b135d3f60e11b6145b2565b1490565b9050615279815190565b615286611757602061163c565b101590615232565b906103279161529b61144d565b6152c6565b9160206103279294936152b781604081019761082d565b01906001600160601b03169052565b907f8a8bae378cb731c5c40b632330c6836c2f916f48edb967699c86736f9a6a76ef916152f382826153b0565b61207e6152ff60405190565b928392836152a0565b906103279161528e565b61035f90611ea9565b91602061032792949361084d816040810197615312565b61030290611e37906001600160601b031682565b9061535661030261150592615332565b8254906001600160a01b03199060a01b6001600160a01b0390921691161790565b6153a060206103279361539261538c82611e9f565b856114d9565b01516001600160601b031690565b90615346565b9061032791615377565b906153bc611f4a611f98565b806153c683611ea9565b1161543b57506153d6600061142a565b6153df816102f6565b6153e8846102f6565b1461541857509061541161032792615408615401611e5b565b9384611e25565b60208301611e4d565b60056153a6565b6114949061542560405190565b635b6cc80560e11b815291829160048301610aba565b9061149461544860405190565b636f483d0960e01b81529283926004840161531b565b90610327929161546c61144d565b9161549e7f7f5b076c952c0ec86e5425963c1326dd0f03a3595c19f81d765e8ff559a6e33c92936131d58386836154f0565b926131e46152ff60405190565b90610327929161545e565b60409061084d61032794969593966154d18360608101999052565b6020830190615312565b90815260408101929161032791602090611840565b90916154fd611f4a611f98565b8061550783611ea9565b116155855750615517600061142a565b615520816102f6565b615529856102f6565b146155625750610327929161555661555d9261554d615546611e5b565b9586611e25565b60208501611e4d565b6006611649565b6153a6565b8261149461556f60405190565b634b4f842960e11b8152928392600484016154db565b611494839161559360405190565b63dfd1fc1b60e01b8152938493600485016154b6565b6155b2816155c7565b9081156155bd575090565b610302915061560b565b6001600160e01b03198116636cdb3d1360e11b8114919082156155fa575b5081156155f0575090565b6103029150615634565b6303a24d0760e21b149150386155e5565b63152a902d60e11b6001600160e01b031982161490811561562a575090565b61030291506155c7565b61526b6301ffc9a760e01b611c98565b6156779061565b615670939561567d9587846156c1565b6156686119a2600061142a565b9283916102f6565b14936102f6565b14911590565b90816156b8575b50806156a3575b61569157565b60405163dc8d8db760e01b8152600490fd5b506156b36118a8600f5460ff1690565b61568b565b15905038615684565b906156d6919493929461565b84878484615833565b14615772575b6156e5906102f6565b146156ef57509050565b6156f9600061163c565b90815b615707610302865190565b8310156157545761480461574e916157226120028686611727565b906106ad61573d615736612002898c611727565b6003611649565b6142a28461574a83611672565b0390565b916156fc565b905061032792935061576b915061574a6004611672565b6004613da9565b92615780600093929361163c565b9285845b61578f610302835190565b8610156157c6576157be91614886916133ea6142956157366120028b6157b8612002828e611727565b96611727565b938690615784565b6156e59396929495506157e2915061576b906133ea6004611672565b90506156dc565b61084d6103279461511060609498979561580785608081019b61082d565b6020850152565b909161582561030293604084526040840190610c5b565b916020818403910152610c5b565b9390929192615840845190565b61584e611757610302865190565b03615a3f579092903391615862600061163c565b9485936158726119a2600061142a565b945b61587f610302855190565b81101561596557600581901b840160200151600582901b880160200151876158a68c6102f6565b036158f7575b906158cb929187896158bd826102f6565b036158d0575b5050506116fd565b615874565b6158e56142a29161168e6158ef956000611649565b916133ea83611672565b3880876158c3565b6159096116938c61168e856000611649565b81811061594057906159378c615932615926846158cb9897960390565b9161168e866000611649565b613da9565b909192506158ac565b8b611494848461594f60405190565b6303dee4c560e01b8152948594600486016157e9565b509294959190969350615976815190565b615983611757600161163c565b036159f6576159d56159d5611b07846159c87fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6297966159db9660209160051b01015190565b9960209160051b01015190565b946114d0565b946159f16159e860405190565b92839283611698565b0390a4565b949050615a296159d56159d57f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb946114d0565b946159f1615a3660405190565b9283928361580e565b826117e26117dd865190565b90615a5e906001600160401b0316612511565b1015615a6657565b604051631750215560e11b8152600490fd5b610302610302610302926001600160401b031690565b615ab5615aaf610302615aa9615aa46013613b78565b615a78565b426124de565b91615a78565b10615abc57565b6040516313634e8d60e11b8152600490fd5b615b09615ae3615ade8380612530565b905090565b7f0000000000000000000000000000000000000000000000000000000000000000614758565b1491821592615b9e575b8215615b80575b8215615b62575b8215615b42575b5050615b3057565b604051634f7ee04f60e11b8152600490fd5b615b59919250615ade816080610302930190612530565b14153880615b28565b915080615b78610302615ade6060860186612530565b141591615b21565b915080615b96610302615ade6040860186612530565b141591615b1a565b915080615bb4610302615ade6020860186612530565b141591615b1356fea26469706673582212203bac6f46211faa309a1491cf18347b3834aaf31acc1a888687e48d071f1d21f764736f6c63430008140033000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000068e48d37ad3030ae133f2d0b41409648a14c7fd40000000000000000000000009dd3ecd7d75027d8983f176191b764315adbc1730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001647414d3320417761726473203230323420426164676500000000000000000000000000000000000000000000000000000000000000000000000000000000000c67616d33735f6177617264730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b68747470733a2f2f62616679626569666b366b68706e747961347372366e79766261766e726b3362346a7735617068356e33706668756f746d6271707a6835376d67652e697066732e7733732e6c696e6b2f7b69647d2e6a736f6e00000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c8062fdd58e146102f157806301ffc9a7146102ec57806302045138146102e757806302fe5305146102e257806304634d8d146102dd57806306fdde03146102d85780630e89341c146102d357806318160ddd146102ce57806322fe44c3146102c9578063274a204b146102c45780632a55205a146102bf5780632d759d0f146102ba5780632eb2c2d6146102b55780632ed6d5e8146102b05780633115bba7146102ab5780633ccfd60b146102a6578063424aa884146102a157806345b9206e1461029c578063475ae039146102975780634e1273f4146102925780634f558e791461028d5780635944c753146102885780635e9dbe0c146102835780635f710f5c1461027e57806367808a3414610279578063700d19f21461027457806370da24ee1461026f578063715018a61461026a5780637254f9c01461026557806379ba5097146102605780638d3a3e381461025b5780638da5cb5b1461025657806390bac5611461025157806395d89b411461024c57806397cf84fc146102475780639823560c146102425780639cd237071461023d578063a22cb46514610238578063a3759f6014610233578063bd85b0391461022e578063e2bc7c1214610229578063e30c397814610224578063e8e61bb81461021f578063e985e9c51461021a578063f242432a146102155763f2fde38b03610315576113e1565b6113c5565b611368565b61132c565b611311565b6112f8565b6112b8565b61128e565b61109f565b611064565b611035565b61101a565b610fff565b610fd6565b610f3b565b610f1f565b610f07565b610eed565b610e63565b610e47565b610e0e565b610df3565b610dc7565b610da8565b610d2e565b610cea565b610cc2565b610b93565b610b74565b610aca565b610aa2565b610a89565b610a41565b610a25565b610880565b610851565b610814565b6107de565b610718565b6106fd565b6106c2565b6104d3565b61047b565b610407565b6103c5565b610363565b6001600160a01b031690565b90565b61030e816102f6565b0361031557565b600080fd5b9050359061032782610305565b565b8061030e565b9050359061032782610329565b919060408382031261031557806020610358610302938661031a565b940161032f565b9052565b346103155761039061037f61037936600461033c565b9061167c565b6040515b9182918290815260200190565b0390f35b6001600160e01b0319811661030e565b9050359061032782610394565b9060208282031261031557610302916103a4565b34610315576103906103e06103db3660046103b1565b6155a9565b6040515b91829182901515815260200190565b90602082820312610315576103029161031a565b346103155761041f61041a3660046103f3565b612083565b604051005b9181601f8401121561031557823591826001600160401b038111610315576020908186019501011161031557565b906020828203126103155781356001600160401b038111610315576104779201610424565b9091565b346103155761041f61048e366004610452565b90614c23565b6001600160601b03811661030e565b9050359061032782610494565b9190604083820312610315578060206104cc610302938661031a565b94016104a3565b346103155761041f6104e63660046104b0565b90615308565b600091031261031557565b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052602260045260246000fd5b600181811c929116828115610544575b50602083101461053f57565b61050d565b607f16925038610533565b8054600093929161056c61056283610523565b8085529360200190565b91600181169081156105be575060011461058557505050565b6105989192939450600052602060002090565b916000925b8184106105aa5750500190565b80548484015260209093019260010161059d565b60ff19168352505090151560051b019150565b906103029161054f565b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b0382111761061257604052565b6105db565b9061032761062460405190565b806106308180966105d1565b03906105f1565b906106455761030290610617565b6104f7565b6103026000600a610637565b60005b8381106106695750506000910152565b8181015183820152602001610659565b61069a6106a36020936106ad9361068e815190565b80835293849260200190565b95869101610656565b601f01601f191690565b0190565b906020610302928181520190610679565b34610315576106d23660046104ec565b6103906106dd61064a565b604051918291826106b1565b90602082820312610315576103029161032f565b34610315576103906106dd6107133660046106e9565b611631565b34610315576107283660046104ec565b61039061037f61341d565b63ffffffff811661030e565b9050359061032782610733565b909182601f830112156103155781359283926001600160401b038511610315578060208092019560051b01011161031557565b91909160a08184031261031557610796838261031a565b926107a4816020840161032f565b926107b2826040850161073f565b926107c0836060830161073f565b9260808201356001600160401b03811161031557610477920161074c565b61041f6107ec36600461077f565b94939093929192613eb5565b919060408382031261031557806020610358610302938661032f565b346103155761041f6108273660046107f8565b9061330d565b61035f906102f6565b91602061032792949361084d81604081019761082d565b0152565b346103155761086a6108643660046107f8565b90611ef3565b9061039061087760405190565b92839283610836565b346103155761039061037f6108963660046106e9565b613116565b906103276108a860405190565b92836105f1565b6001600160401b0381116106125760051b60200190565b909291926108db6108d6826108af565b61089b565b93602085838152019160051b83019281841161031557915b8383106109005750505050565b6020809161090e848661032f565b8152019201916108f3565b9080601f8301121561031557816020610302933591016108c6565b6001600160401b03811161061257602090601f01601f19160190565b90826000939282370152565b9092919261096c6108d682610934565b91829482845282820111610315576020610327930190610950565b9080601f83011215610315578160206103029335910161095c565b91909160a081840312610315576109b9838261031a565b926109c7816020840161031a565b9260408301356001600160401b03811161031557826109e7918501610919565b9260608101356001600160401b0381116103155783610a07918301610919565b9260808201356001600160401b038111610315576103029201610987565b346103155761041f610a383660046109a2565b939290926118b1565b3461031557610a513660046104ec565b61041f614bca565b909160608284031261031557610302610a72848461031a565b936040610a82826020870161032f565b940161073f565b346103155761041f610a9c366004610a59565b91614923565b3461031557610ab23660046104ec565b61041f614a23565b602081019291610327919061082d565b3461031557610ada3660046104ec565b6103907f00000000000000000000000000000000000000000000000000000000000000005b60405191829182610aba565b6001600160401b031690565b6001600160401b03811661030e565b9050359061032782610b17565b91909160a08184031261031557610b4a838261031a565b92610b58816020840161032f565b92610b66826040850161073f565b92610a078360608301610b26565b34610315576103906103e0610b8a366004610b33565b93929092614f88565b346103155761041f610ba63660046103f3565b611fe4565b90929192610bbb6108d6826108af565b93602085838152019160051b83019281841161031557915b838310610be05750505050565b60208091610bee848661031a565b815201920191610bd3565b9080601f830112156103155781602061030293359101610bab565b9190916040818403126103155780356001600160401b0381116103155783610c3d918301610bf9565b9260208201356001600160401b038111610315576103029201610919565b90610c7b610c74610c6a845190565b8084529260200190565b9260200190565b9060005b818110610c8c5750505090565b909192610ca9610ca26001928651815260200190565b9460200190565b929101610c7f565b906020610302928181520190610c5b565b3461031557610390610cde610cd8366004610c14565b90611740565b60405191829182610cb1565b34610315576103906103e0610d003660046106e9565b611e0b565b909160608284031261031557610302610d1e848461032f565b9360406104cc826020870161031a565b346103155761041f610d41366004610d05565b916154ab565b80151561030e565b9050359061032782610d47565b919060a08382031261031557610d72818461031a565b92610d80826020830161032f565b92610302610d91846040850161073f565b936080610da18260608701610d4f565b9401610b26565b346103155761039061037f610dbe366004610d5c565b93929092614ed7565b346103155761041f610dda3660046103f3565b611fbf565b906020828203126103155761030291610b26565b346103155761039061037f610e09366004610ddf565b614dd2565b3461031557610e1e3660046104ec565b6103907f00000000000000000000000068e48d37ad3030ae133f2d0b41409648a14c7fd4610aff565b3461031557610e573660046104ec565b61039061037f600e5490565b3461031557610e733660046104ec565b61041f611445565b9160a08383031261031557610e90828461032f565b92610e9e836020830161073f565b9260408201356001600160401b0381116103155781610ebe91840161074c565b93909392610ecf8360608301610b26565b9260808201356001600160401b038111610315576104779201610424565b61041f610efb366004610e7b565b95949094939193613d90565b3461031557610f173660046104ec565b61041f611605565b346103155761039061037f610f3536600461033c565b90611fed565b3461031557610f4b3660046104ec565b610390610aff611403565b9060c08282031261031557610f6b818361032f565b92610f79826020850161073f565b92610f87836040830161073f565b9260608201356001600160401b0381116103155781610fa791840161074c565b93909392610fb88360808301610b26565b9260a08201356001600160401b038111610315576104779201610424565b61041f610fe4366004610f56565b96959095949194939293613e2c565b6103026000600b610637565b346103155761100f3660046104ec565b6103906106dd610ff3565b3461031557610390610cde6110303660046103f3565b61334a565b346103155761039061037f61104b3660046106e9565b613242565b906020828203126103155761030291610d4f565b346103155761041f611077366004611050565b614dc9565b919060408382031261031557806020611098610302938661031a565b9401610d4f565b346103155761041f6110b236600461107c565b90611805565b906110c7610c74610c6a845190565b9060005b8181106110d85750505090565b9091926110f7610ca260019286516001600160501b0316815260200190565b9291016110cb565b9061110e610c74610c6a845190565b9060005b81811061111f5750505090565b90919261113b610ca2600192865163ffffffff16815260200190565b929101611112565b90611152610c74610c6a845190565b9060005b8181106111635750505090565b909192611179610ca26001928651815260200190565b929101611156565b90611190610c74610c6a845190565b9060005b8181106111a15750505090565b9091926111bc610ca2600192865162ffffff16815260200190565b929101611194565b906103029060c08061123361122161120f6111fd6111eb895160e0895260e08901906110b8565b60208a015188820360208a01526110b8565b604089015187820360408901526110ff565b60608801518682036060880152611143565b60808701518582036080870152611181565b60a0808701516001600160401b0316908501529401516001600160401b0316910152565b916112809061127261030295936060865260608601906111c4565b908482036020860152610c5b565b916040818403910152610c5b565b34610315576103906112a96112a43660046106e9565b613c4e565b60405191939193849384611257565b346103155761039061037f6112ce3660046106e9565b61342a565b906020828203126103155781356001600160401b03811161031557610477920161074c565b346103155761041f61130b3660046112d3565b906130d7565b34610315576113213660046104ec565b610390610aff611498565b346103155761041f61133f3660046107f8565b90613238565b919060408382031261031557806020611361610302938661031a565b940161031a565b34610315576103906103e061137e366004611345565b90611810565b91909160a0818403126103155761139b838261031a565b926113a9816020840161031a565b926113b7826040850161032f565b92610a07836060830161032f565b346103155761041f6113d8366004611384565b93929092611847565b346103155761041f6113f43660046103f3565b611560565b61030290546102f6565b61030260076113f9565b61141561144d565b610327611433565b6102f66103026103029290565b6103029061141d565b610327611440600061142a565b6115af565b61032761140d565b611455611403565b3390611469611463836102f6565b916102f6565b036114715750565b6114949061147e60405190565b63118cdaa760e01b815291829160048301610aba565b0390fd5b61030260086113f9565b610327906114ae61144d565b611509565b610302906102f6906001600160a01b031682565b610302906114b3565b610302906114c7565b906114e9610302611505926114d0565b82546001600160a01b0319166001600160a01b03919091161790565b9055565b6115148160086114d9565b61152d611527611522611403565b6114d0565b916114d0565b907f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270061155860405190565b80805b0390a3565b610327906114a2565b9060031b6115826001600160a01b03821b5b9384921b90565b169119161790565b919061159b610302611505936114d0565b908354611569565b6103279160009161158a565b610327906115bf600060086115a3565b6115da6115276115cf60076113f9565b6115228460076114d9565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e061155860405190565b3361160e611498565b61161a611463836102f6565b0361147157610327906115af565b61030290610617565b506103026002611628565b6103026103026103029290565b906116539061163c565b600052602052604060002090565b90611653906114d0565b6103029081565b610302905461166b565b6116939061168e610302936000611649565b611661565b611672565b9081526040810192916103279160200152565b906116b86108d6836108af565b918252565b369037565b906103276116cf836116ab565b602081946116df601f19916108af565b0191016116bd565b634e487b7160e01b600052601160045260246000fd5b600019811461170c5760010190565b6116e7565b634e487b7160e01b600052603260045260246000fd5b805182101561173b5760209160051b010190565b611711565b90611749825190565b61175b611757610302845190565b9190565b036117d55761177061176b835190565b6116c2565b9161177b600061163c565b611786610302835190565b8110156117cf57806117c56117b86117a86117ca948660209160051b01015190565b600584901b870160200151610379565b6117c28388611727565b52565b6116fd565b61177b565b50505090565b5190516117e2565b915190565b906114946117ef60405190565b635b05999160e01b815292839260048401611698565b610327919033611aa2565b6103029161168e611822926001611661565b5460ff1690565b91602061032792949361184081604081019761082d565b019061082d565b949392919033611856816102f6565b61185f886102f6565b14158061189a575b611876575061032794956118f3565b869061149461188460405190565b63711bec9160e11b815292839260048401611829565b506118ac6118a88289611810565b1590565b611867565b9493929190336118c0816102f6565b6118c9886102f6565b1415806118e0575b61187657506103279495611a28565b506118ee6118a88289611810565b6118d1565b909194939294611903600061142a565b61190c816102f6565b80611916866102f6565b1461196257611924846102f6565b146119405750610327949561193891611de6565b929091611985565b6114949061194d60405190565b626a0d4560e21b815291829160048301610aba565b6114948261196f60405190565b632bfa23e760e11b815291829160048301610aba565b9193929061199582868386615644565b6119a76119a2600061142a565b6102f6565b6119b0826102f6565b036119bd575b5050505050565b33926119c7865190565b6119d4611757600161163c565b03611a1857611a08611a0e966119fb6119ed600061163c565b809260209160051b01015190565b9460209160051b01015190565b93611bd4565b38808080806119b6565b611a23959293611d40565b611a0e565b9493929190611a37600061142a565b95611a41876102f6565b80611a4b846102f6565b14611a7657611a59826102f6565b14611a6957610327959650611985565b6114948761194d60405190565b6114948861196f60405190565b90611a9361030261150592151590565b825460ff191660ff9091161790565b611aac600061142a565b611ab5816102f6565b611abe846102f6565b14611b17575061155b611b0d611b078361152287611b028861168e7f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31996001611661565b611a83565b936114d0565b936103e460405190565b61149490611b2460405190565b62ced3e160e81b815291829160048301610aba565b9050519061032782610394565b906020828203126103155761030291611b39565b9193611b8860a094611b816103029897611b7787611b8f9761082d565b602087019061082d565b6040850152565b6060830152565b8160808201520190610679565b6040513d6000823e3d90fd5b906116b86108d683610934565b3d15611bcf57611bc43d611ba8565b903d6000602084013e565b606090565b9193929094611bef95853b611be9600061163c565b97889190565b11611bfe575b50505050505050565b6000602094611c36611c126115228a6114d0565b94611c1c60405190565b9889978896879563f23a6e6160e01b875260048701611b5a565b03925af160009181611cbe575b50611c895750611c5a565b38808080808080611bf5565b611c62611bb5565b91611c6e610302845190565b03611c80576114949061196f60405190565b50805190602001fd5b909150611ca663f23a6e6160e01b5b916001600160e01b03191690565b03611cb15750611c4e565b6114949061196f60405190565b611ce091925060203d8111611ce7575b611cd881836105f1565b810190611b46565b9038611c43565b503d611cce565b93906103029593611d13611d3294611d0988611d249561082d565b602088019061082d565b60a0604087015260a0860190610c5b565b908482036060860152610c5b565b916080818403910152610679565b9193929094611d5595853b611be9600061163c565b11611d635750505050505050565b6000602094611d9b611d776115228a6114d0565b94611d8160405190565b9889978896879563bc197c8160e01b875260048701611cee565b03925af160009181611dc6575b50611db35750611c5a565b909150611ca663bc197c8160e01b611c98565b611ddf91925060203d8111611ce757611cd881836105f1565b9038611da8565b9160806040518094600182526020820152604081019360018552606082015201604052565b611e149061342a565b611e21611757600061163c565b1190565b9061035f906102f6565b6103029060a01c5b6001600160601b031690565b6103029054611e2f565b906001600160601b03169052565b610302604061089b565b90610327611e71611e5b565b6020611e8f8295611e8a611e84826113f9565b85611e25565b611e43565b9101611e4d565b61030290611e65565b61030290516102f6565b6103029081906001600160601b031681565b8181029291811591840414171561170c57565b634e487b7160e01b600052601260045260246000fd5b8115611eee570490565b611ece565b611f04611f09919392936006611649565b611e96565b91611f1383611e9f565b611f236114636119a2600061142a565b14611f6c575b611f66611f5561175792611f4f611f4a60208801516001600160601b031690565b611ea9565b90611ebb565b611f60611f4a611f98565b90611ee4565b92611e9f565b9150611757611f66611f55611f816005611e96565b9492505050611f29565b611e376103026103029290565b610302612710611f8b565b61032790611faf61144d565b6001611b02610327926014611661565b61032790611fa3565b61032790611fd461144d565b6000611b02610327926014611661565b61032790611fc8565b61030291611ffd6120029261334a565b611727565b5190565b6103279061201261144d565b61204e565b90612027610302611505926114d0565b825490600160401b600160e01b039060401b600160401b600160e01b031990921691161790565b61207e7faea1573caf7b4fdd079b947d86c1be6c725642c47582f8f9bd2c7d2a30bf0bd991610aff816013612017565b0390a1565b61032790612006565b906103279161209961144d565b612dcc565b610302906006611ebb565b9060031b611582600019821b61157b565b91906120cb6103026115059361163c565b9083546120a9565b610327916000916120ba565b8181106120ea575050565b806120f860006001936120d3565b016120df565b9060001960209190910360031b1c8154169055565b91909182821061212257505050565b612133610327936002600391010490565b90600a600361214f600286018290045b93600052602060002090565b92830194060280612163575b5001906120df565b6121719060001985016120fe565b3861215b565b90600160401b8111610612578161218f610327935490565b90828155612113565b600061032791612177565b906106455761032790612198565b8181106121bc575050565b806121ca60006001936120d3565b016121b1565b9190918282106121df57505050565b6103279260070160031c90601c6122036007850160031c5b92600052602060002090565b9182019360021b1680612219575b5001906121b1565b6122279060001985016120fe565b38612211565b90600160401b81116106125781612245610327935490565b908281556121d0565b60006103279161222d565b90610645576103279061224e565b91906120cb6103026115059390565b61032791600091612267565b81811061228d575050565b8061229b6000600193612276565b01612282565b9190918282106122b057505050565b6122d06122c46122c06103279590565b9390565b91600052602060002090565b9182019101612282565b90600160401b811161061257816122f2610327935490565b908281556122a1565b6000610327916122da565b9061064557610327906122fb565b81811061231f575050565b8061232d60006001936120d3565b01612314565b91909182821061234257505050565b612353610327936009600a91010490565b906003600a61236760098601829004612143565b9283019406028061237b575b500190612314565b6123899060001985016120fe565b38612373565b90600160401b811161061257816123a7610327935490565b90828155612333565b60006103279161238f565b9061064557610327906123b0565b60056000916123d883826121a3565b6123e583600183016121a3565b6123f28360028301612259565b6123ff8360038301612306565b61240c83600483016123bb565b0155565b9061064557610327906123c9565b818110612429575050565b806124376000600693612410565b0161241e565b91909182821061244c57505050565b6124646122c461245e6103279561209e565b9361209e565b918201910161241e565b90600160401b81116106125781612486610327935490565b9082815561243d565b60006103279161246e565b90610645576103279061248f565b90359060de1981360301821215610315570190565b9082101561173b576103029160051b8101906124a8565b3561030281610b17565b9190820391821161170c57565b610b0b6103026103029290565b61030261012c6124eb565b61251e906001600160401b03165b916001600160401b031690565b01906001600160401b03821161170c57565b903590601e1981360301821215610315570180359182916001600160401b03841161031557602001809360051b36031261031557565b61030260e061089b565b6001600160501b03811661030e565b9050359061032782612570565b9092919261259c6108d6826108af565b93602085838152019160051b83019281841161031557915b8383106125c15750505050565b602080916125cf848661257f565b8152019201916125b4565b61030291369161258c565b909291926125f56108d6826108af565b93602085838152019160051b83019281841161031557915b83831061261a5750505050565b60208091612628848661073f565b81520192019161260d565b6103029136916125e5565b9092919261264e6108d6826108af565b93602085838152019160051b83019281841161031557915b8383106126735750505050565b60208091612681848661032f565b815201920191612666565b61030291369161263e565b62ffffff811661030e565b9050359061032782612697565b909291926126bf6108d6826108af565b93602085838152019160051b83019281841161031557915b8383106126e45750505050565b602080916126f284866126a2565b8152019201916126d7565b6103029136916126af565b805482101561173b57612722600691600052602060002090565b91020190600090565b9060031b6115826001600160501b03821b61157b565b9061274a815190565b906001600160401b038211610612576121f76127709161276a8486612177565b60200190565b600382049160005b8381106127e1575060038302900380612792575b50505050565b92600093845b8181106127ad5750505001553880808061278c565b90919460206127d76001926127cc6103028a516001600160501b031690565b9085600a029061272b565b9601929101612798565b6000805b600381106127fa575083820155600101612778565b9590602061282360019261281861030286516001600160501b031690565b908a600a029061272b565b920196016127e5565b9061032791612741565b9060031b61158263ffffffff821b61157b565b61285c6103026103029263ffffffff1690565b63ffffffff1690565b9061286e815190565b906001600160401b038211610612576121f761288e9161276a848661222d565b8160031c9160005b8381106128fc575060071981169003806128b05750505050565b92600093845b8181106128cb5750505001553880808061278c565b90919460206128f26001926128e76103028a5163ffffffff1690565b908560021b90612836565b96019291016128b6565b6000805b60088110612915575083820155600101612896565b9590602061293b600192612930610302865163ffffffff1690565b908a60021b90612836565b92019601612900565b9061032791612865565b8151916001600160401b038311610612576122c46129709161276a85856122da565b60005b8381106129805750505050565b6001906020612990610302865190565b9401938184015501612973565b906103279161294e565b9060031b61158262ffffff821b61157b565b906129c2815190565b906001600160401b038211610612576121f76129e29161276a848661238f565b600a82049160005b838110612a4e5750600a8302900380612a035750505050565b92600093845b818110612a1e5750505001553880808061278c565b9091946020612a44600192612a396103028a5162ffffff1690565b9085600302906129a7565b9601929101612a09565b6000805b600a8110612a675750838201556001016129ea565b95906020612a8c600192612a81610302865162ffffff1690565b908a600302906129a7565b92019601612a52565b90610327916129b9565b610b0b610302610302926001600160401b031690565b90612ac561030261150592612a9f565b825467ffffffffffffffff19166001600160401b039091161790565b90612af161030261150592612a9f565b82549067ffffffffffffffff60401b9060401b67ffffffffffffffff60401b1990921691161790565b90612bc060c0600561032794612b37612b31865190565b8261282c565b612b4e612b45602087015190565b6001830161282c565b612b65612b5c604087015190565b60028301612944565b612b7c612b73606087015190565b6003830161299d565b612b93612b8a608087015190565b60048301612a95565b0192612bb2612bac60a08301516001600160401b031690565b85612ab5565b01516001600160401b031690565b90612ae1565b91906106455761032791612b1a565b80549190600160401b8310156106125782612bf891600161032795018155612708565b90612bc6565b5061030290602081019061257f565b818352602090920191906000825b828210612c29575050505090565b90919293612c58612c51600192612c408886612bfe565b6001600160501b0316815260200190565b9560200190565b93920190612c1b565b5061030290602081019061073f565b818352602090920191906000825b828210612c8c575050505090565b90919293612cb1612c51600192612ca38886612c61565b63ffffffff16815260200190565b93920190612c7e565b9037565b8183529091602001916001600160fb1b0381116103155782916106ad9160051b938491612cba565b506103029060208101906126a2565b818352602090920191906000825b828210612d11575050505090565b90919293612d35612c51600192612d288886612ce6565b62ffffff16815260200190565b93920190612d03565b979060c09995612dab976103279d9f9e9c968b612d8191612d9d98612d73612d8f97612dbd9f9a60e0865260e0860191612c0d565b926020818503910152612c0d565b918b830360408d0152612c70565b9188830360608a0152612cbe565b918583036080870152612cf5565b6001600160401b0390971660a0830152565b01906001600160401b03169052565b90612dd96000600e61249a565b612de3600061163c565b612ded600161163c565b600e915b80848110156130cf57821115613071575b612e0d8185876124bd565b60a001612e19906124d4565b612e248286886124bd565b60c001612e30906124d4565b612e3991615a4b565b612e448185876124bd565b612e4d90615ace565b612e588185876124bd565b80612e6291612530565b908587612e708583836124bd565b60208101612e7d91612530565b90612e898785856124bd565b60408101612e9691612530565b90612ea28987876124bd565b60608101612eaf91612530565b929093612ebd8b89896124bd565b60808101612eca91612530565b9690978c612ed9818c846124bd565b60a001612ee5906124d4565b9a612eef926124bd565b60c001612efb906124d4565b99612f04612566565b9b612f0e916125da565b8b52612f19916125da565b60208a0152612f2791612633565b6040880152612f359161268c565b6060860152612f43916126fd565b60808401526001600160401b031660a08301526001600160401b031660c0820152612f6e9084612bd5565b612f798185876124bd565b80612f8391612530565b90612f8f8387896124bd565b60208101612f9c91612530565b92909187612fab86828c6124bd565b60408101612fb891612530565b8b612fc78985839695966124bd565b60608101612fd491612530565b90612fe08b86856124bd565b60808101612fed91612530565b9490938c612ffc8189846124bd565b60a001613008906124d4565b97613012926124bd565b60c00161301e906124d4565b966130288d61163c565b9b61303260405190565b9b8c9b61303f9b8d612d3e565b037f7fec20ffa7d178b5b4d9eb21ec7ff2a1376af8e08ab6cb4c691750db41fc40d191a261306c906116fd565b612df1565b61308760a06130818387896124bd565b016124d4565b6130b7612511610b0b6130a960c06130816130a289896124de565b8b8d6124bd565b6130b16124f8565b90612503565b1015612e0257604051636bc1af9360e01b8152600490fd5b505050505050565b906103279161208c565b805482101561173b576130f990600052602060002090565b0190600090565b6103029160031b1c81565b906103029154613100565b61312461030291600c6130e1565b9061310b565b906103279161313761144d565b7f00000000000000000000000000000000000000000000000000000000000000018110156132265761316d61312482600c6130e1565b61317a611757600061163c565b14158061320d575b6131fb576131926103028261342a565b82106131e9576131e46131da826131d5856131cf7fc95161027a9b2f0376fa8fa5f504100ccc4748c73f4e479bac3778d02ee5621c96600c6130e1565b906120ba565b61163c565b9261038360405190565b0390a2565b60405163fb7af64960e01b8152600490fd5b60405163430b83b160e11b8152600490fd5b5061321f61030261312483600c6130e1565b8211613182565b6040516307ed98ed60e31b8152600490fd5b906103279161312a565b61312461030291600d6130e1565b906103279161325d61144d565b7f00000000000000000000000000000000000000000000000000000000000000018110156132265761329361312482600c6130e1565b6132a0611757600061163c565b11806132f4575b6132e2576131e46131da826131d5856131cf7f0c899f003b7b88b925c6cdfe9b56bc4df2b91107f0f6d1cec1c3538d156bbe4896600d6130e1565b604051630590c51360e01b8152600490fd5b5061330661030261312483600c6130e1565b82116132a7565b9061032791613250565b6103029061285c565b6103029054613317565b6103026103026103029263ffffffff1690565b9190820180921161170c57565b907f000000000000000000000000000000000000000000000000000000000000000191613376836116c2565b90613380600e5490565b9261338b600061163c565b93613397611757869790565b945b8187101561341357805b868110156133fe57806117c56133ef6133dd6133d86133d38a61168e8f6133ce6133f99a6010611649565b611649565b613320565b61332a565b6133ea6120028d8c611727565b61333d565b6117c28b8a611727565b6133a3565b5091909561340b906116fd565b959091613399565b5050935050905090565b6103026103026004611672565b61030290611693610302916003611649565b613444612566565b90816060808252602082015260606040820152606080820152613465606090565b608082015260c06000918260a08201520152565b61030261343c565b610302905b6001600160501b031690565b6103029060501c613486565b6103029060a01c613486565b906001906134bc612143610c6a855490565b600092613546575b5490808310613529575b80831061350c575b82106134e3575b806117cf565b82613503600193946134f660209461349e565b6001600160501b03169052565b019101386134dd565b91926020816135206001936134f686613492565b019301916134d6565b919260208161353d6001936134f686613481565b019301916134ce565b816002840110156134c4579260016060600392613588875461356b836134f683613481565b61357b602084016134f683613492565b6134f6604084019161349e565b019401920191613546565b90610302916134aa565b906103276135aa60405190565b80610630818096613593565b6103029060201c61285c565b6103029060401c61285c565b6103029060601c61285c565b6103029060801c61285c565b6103029060a01c61285c565b6103029060c01c61285c565b6103029060e01c61285c565b9060019061361c612143610c6a855490565b600092613752575b5490808310613735575b808310613718575b8083106136fb575b8083106136de575b8083106136c1575b8083106136a4575b808310613687575b821061366a57806117cf565b826135036001939461367d6020946135fe565b63ffffffff169052565b919260208161369b60019361367d866135f2565b0193019161365e565b91926020816136b860019361367d866135e6565b01930191613656565b91926020816136d560019361367d866135da565b0193019161364e565b91926020816136f260019361367d866135ce565b01930191613646565b919260208161370f60019361367d866135c2565b0193019161363e565b919260208161372c60019361367d866135b6565b01930191613636565b919260208161374960019361367d86613317565b0193019161362e565b81600784011015613624579260016101006008926137e587546137788361367d83613317565b6137886020840161367d836135b6565b6137986040840161367d836135c2565b6137a86060840161367d836135ce565b6137b86080840161367d836135da565b6137c860a0840161367d836135e6565b6137d860c0840161367d836135f2565b61367d60e08401916135fe565b019401920191613752565b906103029161360a565b9061032761380760405190565b806106308180966137f0565b906138226121f7610c6a845490565b9060005b8181106138335750505090565b90919261385761385060019261384887611672565b815260200190565b9460010190565b929101613826565b9061030291613813565b9061032761387660405190565b8061063081809661385f565b610302905b62ffffff1690565b6103029060181c613887565b6103029060301c613887565b6103029060481c613887565b6103029060601c613887565b6103029060781c613887565b6103029060901c613887565b6103029060a81c613887565b6103029060c01c613887565b6103029060d81c613887565b9060019061390d612143610c6a855490565b600092613a8c575b5490808310613a6f575b808310613a52575b808310613a35575b808310613a18575b8083106139fb575b8083106139de575b8083106139c1575b8083106139a4575b808310613987575b821061396b57806117cf565b826135036001939461397e6020946138ef565b62ffffff169052565b919260208161399b60019361397e866138e3565b0193019161395f565b91926020816139b860019361397e866138d7565b01930191613957565b91926020816139d560019361397e866138cb565b0193019161394f565b91926020816139f260019361397e866138bf565b01930191613947565b9192602081613a0f60019361397e866138b3565b0193019161393f565b9192602081613a2c60019361397e866138a7565b01930191613937565b9192602081613a4960019361397e8661389b565b0193019161392f565b9192602081613a6660019361397e8661388f565b01930191613927565b9192602081613a8360019361397e86613882565b0193019161391f565b8160098401101561391557926001610140600a92613b418754613ab28361397e83613882565b613ac26020840161397e8361388f565b613ad26040840161397e8361389b565b613ae26060840161397e836138a7565b613af26080840161397e836138b3565b613b0260a0840161397e836138bf565b613b1260c0840161397e836138cb565b613b2260e0840161397e836138d7565b613b33610100840161397e836138e3565b61397e6101208401916138ef565b019401920191613a8c565b90610302916138fb565b90610327613b6360405190565b80610630818096613b4c565b61030290610b0b565b6103029054613b6f565b6103029060401c610b0b565b6103029054613b82565b90610327613ba4612566565b60c0613c3760058396613bbd613bb98261359d565b8652565b613bd3613bcc6001830161359d565b6020870152565b613be9613be2600283016137fa565b6040870152565b613bff613bf860038301613869565b6060870152565b613c15613c0e60048301613b56565b6080870152565b01613c32613c2282613b78565b6001600160401b031660a0860152565b613b8e565b6001600160401b0316910152565b61030290613b98565b613c56613479565b50613c63610302600e5490565b811015613c9757613c733361334a565b91613c92613c8c613c843385613ca9565b93600e612708565b50613c45565b929190565b60405163e82a532960e01b8152600490fd5b91907f000000000000000000000000000000000000000000000000000000000000000192613cd6846116c2565b92613ce8613ce4600061163c565b9590565b945b85811015613d3157806117c5613d22613d156133d86133d38961168e613d2c986133ce8c6010611649565b6133ea612002858b611727565b6117c28389611727565b613cea565b509350505090565b90613d50969594939291613d4b613db9565b613d70565b610327613df9565b61285c6103026103029290565b61030291369161095c565b9490613d8961032797613d836000613d58565b93613d65565b953361454d565b90610327969594939291613d39565b610302600261163c565b906103026103026115059261163c565b613dc36009611672565b613dcb613d9f565b908114613ddd57610327906009613da9565b604051633ee5aeb560e01b8152600490fd5b610302600161163c565b610327613e04613def565b6009613da9565b90613d5097969594939291613e1e613db9565b9561032797613d8991613d65565b9061032797969594939291613e0b565b9493929190613e4f611822336014611661565b600190151503613e625761032795613e93565b60405163ea8e4eb560e01b8152600490fd5b613e7e6001611ba8565b600360fc1b602082015290565b610302613e74565b926103279592949194613ea4613e8b565b95613eaf60006124eb565b9561454d565b906103279594939291613e3c565b96959493929190613ed38261332a565b613ee161312483600c6130e1565b613eee611757600061163c565b119081613f16575b50613f045761032797614098565b60405163800113cb60e01b8152600490fd5b613f2491506133ea8361342a565b613f3861175761030261312485600c6130e1565b1138613ef6565b6103029060401c6102f6565b6103029054613f3f565b6134866103026103029290565b613f7d906001600160501b03165b916001600160501b031690565b01906001600160501b03821161170c57565b6134866103026103029263ffffffff1690565b613fb4906001600160501b0316613f70565b02906001600160501b03821691820361170c57565b6103029081906001600160501b031681565b6138876103026103029290565b6103026103026103029262ffffff1690565b61400f9063ffffffff165b9163ffffffff1690565b019063ffffffff821161170c57565b61402a61035f916102f6565b60601b90565b60e01b90565b61035f9063ffffffff1660e01b90565b90601892614057836106ad9361401e565b6014830190614036565b9061407161030261150592612849565b825463ffffffff191663ffffffff9091161790565b6103026000611ba8565b610302614086565b95946140ce9194959392936140ac426124eb565b906000996140ba6013613f4b565b6140c66119a28d61142a565b9586916102f6565b03614528575b50506140df90614dd2565b956140ee613c8c88600e612708565b9815614511576140fe6000613f55565b935b7f00000000000000000000000000000000000000000000000000000000000000009361412b856102f6565b14928386898d836144e4575b5050506144d2578a926080840189898c61415e614155848651611727565b5162ffffff1690565b61417461416b6000613fdb565b9162ffffff1690565b1161447c575b908e935061418c61312484600d6130e1565b614199611757600061163c565b11614426575b60406141d59801936141bf6141b5858751611727565b5163ffffffff1690565b6141c96000613d58565b998a9163ffffffff1690565b116143f0575b505050505060608c01916141f36120028b8551611727565b614200611757600061163c565b0361430f575b505050505061428d6142a89461425f61425861424e61424988614295996103279f8d9a908b916133ce9b156142b6575b5050505061424386613f8f565b90613fa2565b613fc9565b6133ea6012611672565b6012613da9565b6133d86142758a61168e876133ce8d6010611649565b6142878361428283613320565b613ffa565b90614061565b956011611649565b6142a2846133ea83611672565b90613da9565b6142b0614090565b9261455d565b6142496142f5614306956142f06142e36142d26142fe966114d0565b976142dc306114d0565b9751611727565b516001600160501b031690565b613f62565b6142438c613f8f565b9133906145e5565b80893880614236565b6103026120028b61436e8f95614369611757968a6143506143759a61434261433660405190565b93849260208401614046565b03601f1981018352826105f1565b61436261435b825190565b9160200190565b209261268c565b6147cc565b9551611727565b036143de5763ffffffff16908111908589888a856143b3575b50505050506143a1573880808080614206565b60405163b4f3729b60e01b8152600490fd5b6143d394955061285c939261168e614282936133ce6133d3946010611649565b11388589888a61438e565b6040516309bde33960e01b8152600490fd5b8361436e61285c936142826133d36141b59561168e6144179a6133ce6140059b6010611649565b116143a15738898b8a8e6141db565b505061444692955061443791614843565b6144408961332a565b9061333d565b61445a6117576103026131248c600d6130e1565b1161446a578a928a898b8a61419f565b60405163751304ed60e11b8152600490fd5b6144b1939497508261436e6144ac936144406144a6611693611757986133ce614155986011611649565b9161332a565b613fe8565b116144c1578a923889898c61417a565b60405162d0844960e21b8152600490fd5b604051630717c22560e51b8152600490fd5b6145079350916142f06142e36144fe936142499551611727565b6142438a613f8f565b341086898d614137565b6145226142e38760208c0151611727565b93614100565b8161453c929b506140df9350878933614f88565b9861454681615a8e565b90386140d4565b9061032797969594939291613ec3565b9093929161456b600061142a565b94614575866102f6565b61457e846102f6565b146145925761032794959161193891611de6565b6114948661196f60405190565b6145b26140306103029263ffffffff1690565b6001600160e01b03191690565b60409061084d61032794969593966145db83606081019961082d565b602083019061082d565b90916146289061461a610327956145ff6323b872dd61459f565b9261460960405190565b9687946020860152602485016145bf565b03601f1981018452836105f1565b61464e565b9050519061032782610d47565b90602082820312610315576103029161462d565b61465a614661916114d0565b91826146c8565b8051614670611757600061163c565b141590816146a4575b506146815750565b6114949061468e60405190565b635274afe760e01b815291829160048301610aba565b6146c29150806020806146b86118a8945190565b830101910161463a565b38614679565b610302916146d6600061163c565b6146df306114d0565b81813110614709575060008281926020610302969551920190855af1614703611bb5565b9161472c565b6114949061471660405190565b63cd78605960e01b815291829160048301610aba565b9015614738565b501590565b15614743575061479d565b61475e61474e835190565b614758600061163c565b91829190565b149081614792575b5061476f575090565b6114949061477c60405190565b639996b31560e01b815291829160048301610aba565b9050813b1438614766565b80516147ac611757600061163c565b11156147ba57805190602001fd5b604051630a12f52160e11b8152600490fd5b6147d6600061163c565b915b6147e3610302835190565b8310156148105761480461480a916147fe6120028686611727565b90614816565b926116fd565b916147d8565b91505090565b81811015614831579061030291600052602052604060002090565b61030291600052602052604060002090565b61484d600061163c565b91829361485c610302600e5490565b945b858510156148925761488661488c916144406133d86133d38861168e896133ce8d6010611649565b946116fd565b9361485e565b945092505050565b9061032792916148a861144d565b91906148b38261332a565b6148c161312483600c6130e1565b6148ce611757600061163c565b1190816148e4575b50613f04576103279261490d565b6148f291506133ea8361342a565b61490661175761030261312485600c6130e1565b11386148d6565b9061491a6103279361332a565b906142b0614090565b90610327929161489a565b61493661144d565b610327614970600080730b98151bedee73f9ba5f2c7b72dea02d38ce49fc61495e6012611672565b60405190818003925af1614733611bb5565b614a1157614981614258600061163c565b61498a306114d0565b316149c960008061499a60405190565b600090857f00000000000000000000000068e48d37ad3030ae133f2d0b41409648a14c7fd45af1614733611bb5565b6149ff5761207e61037f7f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d926133ea6012611672565b604051631d42c86760e21b8152600490fd5b6040516312171d8360e31b8152600490fd5b61032761492e565b614a3361144d565b610327614a5c565b9050519061032782610329565b906020828203126103155761030291614a3b565b7f0000000000000000000000000000000000000000000000000000000000000000614a8a6119a2600061142a565b614a93826102f6565b14614bb857614b12614aa4826114d0565b614acd730b98151bedee73f9ba5f2c7b72dea02d38ce49fc614ac66012611672565b9083614bd2565b614ada614258600061163c565b6020614ae5826114d0565b614aee306114d0565b90614af860405190565b948592839182916370a0823160e01b835260048301610aba565b03915afa908115614bb357611b076131e4926131da927fbe7426aee8a34d0263892b55ce65ce81d8f4c806eb4719e59015ea49feb92d2295600092614b7f575b508161424e917f00000000000000000000000068e48d37ad3030ae133f2d0b41409648a14c7fd490614bd2565b61424e919250614ba59060203d8111614bac575b614b9d81836105f1565b810190614a48565b9190614b52565b503d614b93565b611b9c565b60405163a47ca0b760e01b8152600490fd5b610327614a2b565b6146286103279361461a614be963a9059cbb61459f565b91614bf360405190565b958693602085015260248401610836565b9061032791614c1161144d565b61032791614c1e91613d65565b614d82565b9061032791614c04565b818110614c38575050565b80614c4660006001936120d3565b01614c2d565b9190601f8111614c5b57505050565b614c6d61032793600052602060002090565b906020601f840160051c83019310614c8d575b601f0160051c0190614c2d565b9091508190614c80565b9060001960039190911b1c191690565b81614cb191614c97565b9060011b1790565b81519192916001600160401b03811161061257614ce081614cda8454610523565b84614c4c565b6020601f8211600114614d0f578190611505939495600092614d04575b5050614ca7565b015190503880614cfd565b601f19821694614d2484600052602060002090565b9160005b878110614d60575083600195969710614d46575b505050811b019055565b614d56910151601f841690614c97565b9055388080614d3c565b90926020600181928686015181550194019101614d28565b9061032791614cb9565b610327906002614d78565b61032790614d9961144d565b61207e7fbcde07732ba7563e295b3edc0bf5ec939a471d93d850a58a6f2902c0ed323728916103e081600f611a83565b61032790614d8d565b614ddc600061163c565b90614de9610302600e5490565b915b82811015613c9757614e0d610b0b6005614e0684600e612708565b5001613b78565b6001600160401b038316908110159081614e35575b5061481057614e30906116fd565b614deb565b9050614e51610b0b6005614e4a85600e612708565b5001613b8e565b1138614e22565b61035f906001600160401b031660c01b90565b969260899895614eb5614ed096614ea9614ebf94614e9f614ec99860148f6106ad9f9a81614e989161401e565b019061401e565b60288d0190614036565b151560f81b602c8b0152565b602d89019061401e565b6041870190614e58565b6049850152565b6069830152565b90919293614ee56013613f4b565b614ef56114636119a2600061142a565b14614f765761030294614f3c9361434292614f0f306114d0565b91614f24614f1d6013613f4b565b9187611fed565b93614f2e60405190565b988997469560208a01614e6b565b614f4761435b825190565b207b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b600052601c52603c60002090565b6040516353bd4fb360e11b8152600490fd5b91909392614f94600090565b50614fb784614fa36013613f4b565b614fb1846001878b8a614ed7565b90615028565b614fef576000614fb192614fd596614fcf6013613f4b565b95614ed7565b614fea5760405162b7fad960e11b8152600490fd5b600090565b5050505050600190565b634e487b7160e01b600052602160045260246000fd5b6004111561501957565b614ff9565b906103278261500f565b91906150348282615089565b5061504b615045600096939661501e565b9161501e565b149384615072575b5083156150605750505090565b61506a93506151f0565b3880806117cf565b909350615081611463856102f6565b149238615053565b8151615098611757604161163c565b036150c257906150bb916020820151906060604084015193015160001a90615117565b9192909190565b506150d86131d56150d3600061142a565b925190565b909160029190565b6103029061163c565b61084d6103279461511060609498979561510685608081019b9052565b60ff166020850152565b6040830152565b9091615122846150e0565b6151446117576fa2a8918ca85bafe22016d0b997e4df60600160ff1b0361163c565b116151bf57906151666020946000949361515d60405190565b948594856150e9565b838052039060015afa15614bb357600051615181600061142a565b61518a816102f6565b615193836102f6565b146151ab57506151a3600061163c565b909160009190565b90506151b7600061163c565b909160019190565b5050506151cc600061142a565b9160039190565b806151e360409261030295949052565b8160208201520190610679565b60009291614342615220859461520560405190565b9283916020830195630b135d3f60e11b8752602484016151d3565b51915afa61522c611bb5565b8161526f575b8161523b575090565b615255915060208061524b835190565b8301019101614a48565b61526b611757610302630b135d3f60e11b6145b2565b1490565b9050615279815190565b615286611757602061163c565b101590615232565b906103279161529b61144d565b6152c6565b9160206103279294936152b781604081019761082d565b01906001600160601b03169052565b907f8a8bae378cb731c5c40b632330c6836c2f916f48edb967699c86736f9a6a76ef916152f382826153b0565b61207e6152ff60405190565b928392836152a0565b906103279161528e565b61035f90611ea9565b91602061032792949361084d816040810197615312565b61030290611e37906001600160601b031682565b9061535661030261150592615332565b8254906001600160a01b03199060a01b6001600160a01b0390921691161790565b6153a060206103279361539261538c82611e9f565b856114d9565b01516001600160601b031690565b90615346565b9061032791615377565b906153bc611f4a611f98565b806153c683611ea9565b1161543b57506153d6600061142a565b6153df816102f6565b6153e8846102f6565b1461541857509061541161032792615408615401611e5b565b9384611e25565b60208301611e4d565b60056153a6565b6114949061542560405190565b635b6cc80560e11b815291829160048301610aba565b9061149461544860405190565b636f483d0960e01b81529283926004840161531b565b90610327929161546c61144d565b9161549e7f7f5b076c952c0ec86e5425963c1326dd0f03a3595c19f81d765e8ff559a6e33c92936131d58386836154f0565b926131e46152ff60405190565b90610327929161545e565b60409061084d61032794969593966154d18360608101999052565b6020830190615312565b90815260408101929161032791602090611840565b90916154fd611f4a611f98565b8061550783611ea9565b116155855750615517600061142a565b615520816102f6565b615529856102f6565b146155625750610327929161555661555d9261554d615546611e5b565b9586611e25565b60208501611e4d565b6006611649565b6153a6565b8261149461556f60405190565b634b4f842960e11b8152928392600484016154db565b611494839161559360405190565b63dfd1fc1b60e01b8152938493600485016154b6565b6155b2816155c7565b9081156155bd575090565b610302915061560b565b6001600160e01b03198116636cdb3d1360e11b8114919082156155fa575b5081156155f0575090565b6103029150615634565b6303a24d0760e21b149150386155e5565b63152a902d60e11b6001600160e01b031982161490811561562a575090565b61030291506155c7565b61526b6301ffc9a760e01b611c98565b6156779061565b615670939561567d9587846156c1565b6156686119a2600061142a565b9283916102f6565b14936102f6565b14911590565b90816156b8575b50806156a3575b61569157565b60405163dc8d8db760e01b8152600490fd5b506156b36118a8600f5460ff1690565b61568b565b15905038615684565b906156d6919493929461565b84878484615833565b14615772575b6156e5906102f6565b146156ef57509050565b6156f9600061163c565b90815b615707610302865190565b8310156157545761480461574e916157226120028686611727565b906106ad61573d615736612002898c611727565b6003611649565b6142a28461574a83611672565b0390565b916156fc565b905061032792935061576b915061574a6004611672565b6004613da9565b92615780600093929361163c565b9285845b61578f610302835190565b8610156157c6576157be91614886916133ea6142956157366120028b6157b8612002828e611727565b96611727565b938690615784565b6156e59396929495506157e2915061576b906133ea6004611672565b90506156dc565b61084d6103279461511060609498979561580785608081019b61082d565b6020850152565b909161582561030293604084526040840190610c5b565b916020818403910152610c5b565b9390929192615840845190565b61584e611757610302865190565b03615a3f579092903391615862600061163c565b9485936158726119a2600061142a565b945b61587f610302855190565b81101561596557600581901b840160200151600582901b880160200151876158a68c6102f6565b036158f7575b906158cb929187896158bd826102f6565b036158d0575b5050506116fd565b615874565b6158e56142a29161168e6158ef956000611649565b916133ea83611672565b3880876158c3565b6159096116938c61168e856000611649565b81811061594057906159378c615932615926846158cb9897960390565b9161168e866000611649565b613da9565b909192506158ac565b8b611494848461594f60405190565b6303dee4c560e01b8152948594600486016157e9565b509294959190969350615976815190565b615983611757600161163c565b036159f6576159d56159d5611b07846159c87fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6297966159db9660209160051b01015190565b9960209160051b01015190565b946114d0565b946159f16159e860405190565b92839283611698565b0390a4565b949050615a296159d56159d57f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb946114d0565b946159f1615a3660405190565b9283928361580e565b826117e26117dd865190565b90615a5e906001600160401b0316612511565b1015615a6657565b604051631750215560e11b8152600490fd5b610302610302610302926001600160401b031690565b615ab5615aaf610302615aa9615aa46013613b78565b615a78565b426124de565b91615a78565b10615abc57565b6040516313634e8d60e11b8152600490fd5b615b09615ae3615ade8380612530565b905090565b7f0000000000000000000000000000000000000000000000000000000000000001614758565b1491821592615b9e575b8215615b80575b8215615b62575b8215615b42575b5050615b3057565b604051634f7ee04f60e11b8152600490fd5b615b59919250615ade816080610302930190612530565b14153880615b28565b915080615b78610302615ade6060860186612530565b141591615b21565b915080615b96610302615ade6040860186612530565b141591615b1a565b915080615bb4610302615ade6020860186612530565b141591615b1356fea26469706673582212203bac6f46211faa309a1491cf18347b3834aaf31acc1a888687e48d071f1d21f764736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000068e48d37ad3030ae133f2d0b41409648a14c7fd40000000000000000000000009dd3ecd7d75027d8983f176191b764315adbc1730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001647414d3320417761726473203230323420426164676500000000000000000000000000000000000000000000000000000000000000000000000000000000000c67616d33735f6177617264730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b68747470733a2f2f62616679626569666b366b68706e747961347372366e79766261766e726b3362346a7735617068356e33706668756f746d6271707a6835376d67652e697066732e7733732e6c696e6b2f7b69647d2e6a736f6e00000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : collectionName (string): GAM3 Awards 2024 Badge
Arg [1] : collectionSymbol (string): gam3s_awards
Arg [2] : uri (string): https://bafybeifk6khpntya4sr6nyvbavnrk3b4jw5aph5n3pfhuotmbqpzh57mge.ipfs.w3s.link/{id}.json
Arg [3] : maxMintableSupply (uint256[]): 0
Arg [4] : globalWalletLimit (uint256[]): 0
Arg [5] : cosigner (address): 0x0000000000000000000000000000000000000000
Arg [6] : timestampExpirySeconds (uint64): 300
Arg [7] : mintCurrency (address): 0x0000000000000000000000000000000000000000
Arg [8] : fundReceiver (address): 0x68e48D37AD3030ae133f2D0B41409648A14C7fd4
Arg [9] : royaltyReceiver (address): 0x9dd3eCD7D75027D8983f176191B764315adBC173
Arg [10] : royaltyFeeNumerator (uint96): 0
-----Encoded View---------------
23 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [4] : 00000000000000000000000000000000000000000000000000000000000002a0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [6] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 00000000000000000000000068e48d37ad3030ae133f2d0b41409648a14c7fd4
Arg [9] : 0000000000000000000000009dd3ecd7d75027d8983f176191b764315adbc173
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [12] : 47414d3320417761726473203230323420426164676500000000000000000000
Arg [13] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [14] : 67616d33735f6177617264730000000000000000000000000000000000000000
Arg [15] : 000000000000000000000000000000000000000000000000000000000000005b
Arg [16] : 68747470733a2f2f62616679626569666b366b68706e747961347372366e7976
Arg [17] : 6261766e726b3362346a7735617068356e33706668756f746d6271707a683537
Arg [18] : 6d67652e697066732e7733732e6c696e6b2f7b69647d2e6a736f6e0000000000
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [20] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [21] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [22] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.