ERC-1155
Source Code
Overview
Max Total Supply
81,999 SpellBox
Holders
18,343
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:
SpellBox
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
/**@title SpellBox Contract
* @author Turingera
*/
contract SpellBox is ERC1155Supply, ERC2981, Ownable, EIP712, ReentrancyGuard {
struct TimeRange {
uint64 beginTimestamp;
uint64 endTimestamp;
}
using Strings for uint256;
TimeRange private _saleTime;
uint256 private _mintFee;
uint256 private _totalMinted;
address payable private _mintFeeRecipient;
address private _validator;
string private _contractURI;
string public name;
string public symbol;
mapping(bytes32 => bool) private _signatureUsed;
string private constant VERSION = "1";
bytes32 private constant PURCHASE_TYPEHASH =
keccak256(
"purchase(uint256 quantity,uint256 purchaseLimit,address to,uint256 expireTimestamp)"
);
modifier saleActive() {
require(isSaleActive(), "Sale inactive");
_;
}
constructor(
string memory _name,
string memory uri,
string memory contractUri,
address validator,
uint256 saleStartTime,
uint256 saleEndTime,
address loyaltyRecipient,
uint96 loyaltyFeeNumerator,
uint256 mintFee,
address payable mintFeeRecipient
) Ownable(msg.sender) ERC1155(uri) EIP712(_name, VERSION) {
name = _name;
symbol = _name;
_validator = validator;
_contractURI = contractUri;
_mintFee = mintFee;
require(mintFeeRecipient != address(0), "Cannot set to 0 address");
_mintFeeRecipient = mintFeeRecipient;
_setSaleTime(saleStartTime, saleEndTime);
_setDefaultRoyalty(loyaltyRecipient, loyaltyFeeNumerator);
}
receive() external payable {}
function withdrawETH(
address payable recipient,
uint256 amount
) external onlyOwner {
require(amount <= address(this).balance, "Insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Transfer failed");
}
function withdrawErc20(
address tokenAddress,
address to,
uint256 amount
) external onlyOwner {
IERC20 token = IERC20(tokenAddress);
uint256 balance = token.balanceOf(address(this));
require(balance >= amount, "Insufficient balance");
token.transfer(to, amount);
}
function withdrawErc721(
address tokenAddress,
address to,
uint256 tokenId
) external onlyOwner {
IERC721 token = IERC721(tokenAddress);
require(
token.ownerOf(tokenId) == address(this),
"Token is not owned by contract"
);
token.safeTransferFrom(address(this), to, tokenId);
}
function withdrawErc1155(
address tokenAddress,
address to,
uint256 tokenId,
uint256 amount,
bytes memory data
) external onlyOwner {
IERC1155 token = IERC1155(tokenAddress);
uint256 balance = token.balanceOf(address(this), tokenId);
require(balance >= amount, "Insufficient balance");
token.safeTransferFrom(address(this), to, tokenId, amount, data);
}
function purchase(
uint256 quantity,
uint256 purchaseLimit,
address to,
uint256 expireTimestamp,
bytes calldata signature
) external payable saleActive nonReentrant {
require(
quantity != 0 && quantity + getNumberMinted(to) <= purchaseLimit,
"Invalid quantity"
);
_handlePurchase(
quantity,
purchaseLimit,
to,
expireTimestamp,
signature
);
}
function _handlePurchase(
uint256 quantity,
uint256 purchaseLimit,
address to,
uint256 expireTimestamp,
bytes calldata signature
) internal {
require(block.timestamp < expireTimestamp, "Purchase expired!");
uint256 totalMintFee = _mintFee * quantity;
require(msg.value == totalMintFee, "Invalid amount!");
bytes32 signatureHash = keccak256(abi.encodePacked(signature));
require(!_signatureUsed[signatureHash], "Signature used!");
_verifySignature(
quantity,
purchaseLimit,
to,
expireTimestamp,
signature
);
_signatureUsed[signatureHash] = true;
_mint(to, 1, quantity, "");
_totalMinted += 1;
if (totalMintFee > 0) {
_payoutMintFee(totalMintFee);
}
}
function _payoutMintFee(uint256 totalMintFee) internal {
(bool success, ) = _mintFeeRecipient.call{value: totalMintFee}("");
require(success, "Failed to send mint fee");
}
/* Admin Functions */
function setDefaultRoyalty(
address receiver,
uint96 feeNumerator
) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
function setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) external onlyOwner {
_setTokenRoyalty(tokenId, receiver, feeNumerator);
}
function setURI(string memory newuri) public onlyOwner {
_setURI(newuri);
}
function setContractURI(string memory newuri) public onlyOwner {
_contractURI = newuri;
}
function setValidator(address validator) external onlyOwner {
require(validator != address(0), "Cannot set to 0 address");
_validator = validator;
}
function setMintFee(uint256 newMintFee) external onlyOwner {
_mintFee = newMintFee;
}
function setMintFeeRecipient(
address newMintFeeRecipient
) external onlyOwner {
require(newMintFeeRecipient != address(0), "Cannot set to 0 address");
_mintFeeRecipient = payable(newMintFeeRecipient);
}
function _setSaleTime(uint256 startTime, uint256 endTime) internal {
require(
startTime <= type(uint64).max &&
endTime <= type(uint64).max &&
startTime < endTime,
"Invalid time"
);
TimeRange memory newTimeRange = TimeRange(
uint64(startTime),
uint64(endTime)
);
_saleTime = newTimeRange;
}
function setSaleTime(
uint256 saleStartTime,
uint256 saleEndTime
) external onlyOwner {
_setSaleTime(saleStartTime, saleEndTime);
}
/* View & Pure & Getter Functions */
function _verifySignature(
uint256 quantity,
uint256 purchaseLimit,
address to,
uint256 expireTimestamp,
bytes calldata signature
) internal view {
bytes32 digest = _hashTypedDataV4(
keccak256(
abi.encode(
PURCHASE_TYPEHASH,
quantity,
purchaseLimit,
to,
expireTimestamp
)
)
);
require(
ECDSA.recover(digest, signature) == _validator,
"Invalid signature"
);
}
function _isBetween(
uint256 startTime,
uint256 endTime
) internal view returns (bool) {
return startTime <= block.timestamp && block.timestamp < endTime;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
function isSaleActive() public view returns (bool) {
TimeRange memory saleTime = _saleTime;
return _isBetween(saleTime.beginTimestamp, saleTime.endTimestamp);
}
function getNumberMinted(address account) public view returns (uint256) {
return balanceOf(account, 1);
}
function getTotalMinted() public view returns (uint256) {
return _totalMinted;
}
function getSaleTime() public view returns (TimeRange memory) {
return _saleTime;
}
function getMintFee() public view returns (uint256) {
return _mintFee;
}
function getMintFeeRecipient() public view returns (address) {
return _mintFeeRecipient;
}
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC1155, ERC2981) returns (bool) {
return
ERC1155.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId);
}
}// 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.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/ERC721/IERC721.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
* {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/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 v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @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;
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
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.20;
import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
* encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
* does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
* produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
* separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
*
* @custom:oz-upgrades-unsafe-allow state-variable-immutable
*/
abstract contract EIP712 is IERC5267 {
using ShortStrings for *;
bytes32 private constant TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _cachedDomainSeparator;
uint256 private immutable _cachedChainId;
address private immutable _cachedThis;
bytes32 private immutable _hashedName;
bytes32 private immutable _hashedVersion;
ShortString private immutable _name;
ShortString private immutable _version;
string private _nameFallback;
string private _versionFallback;
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
_name = name.toShortStringWithFallback(_nameFallback);
_version = version.toShortStringWithFallback(_versionFallback);
_hashedName = keccak256(bytes(name));
_hashedVersion = keccak256(bytes(version));
_cachedChainId = block.chainid;
_cachedDomainSeparator = _buildDomainSeparator();
_cachedThis = address(this);
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
} else {
return _buildDomainSeparator();
}
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
}
/**
* @dev See {IERC-5267}.
*/
function eip712Domain()
public
view
virtual
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
{
return (
hex"0f", // 01111
_EIP712Name(),
_EIP712Version(),
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}
/**
* @dev The name parameter for the EIP712 domain.
*
* NOTE: By default this function reads _name which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Name() internal view returns (string memory) {
return _name.toStringWithFallback(_nameFallback);
}
/**
* @dev The version parameter for the EIP712 domain.
*
* NOTE: By default this function reads _version which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Version() internal view returns (string memory) {
return _version.toStringWithFallback(_versionFallback);
}
}// 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) (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) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (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) (interfaces/IERC5267.sol)
pragma solidity ^0.8.20;
interface IERC5267 {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
// | length | 0x BB |
type ShortString is bytes32;
/**
* @dev This library provides functions to convert short memory strings
* into a `ShortString` type that can be used as an immutable variable.
*
* Strings of arbitrary length can be optimized using this library if
* they are short enough (up to 31 bytes) by packing them with their
* length (1 byte) in a single EVM word (32 bytes). Additionally, a
* fallback mechanism can be used for every other case.
*
* Usage example:
*
* ```solidity
* contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns (string memory) {
* return _name.toStringWithFallback(_nameFallback);
* }
* }
* ```
*/
library ShortStrings {
// Used as an identifier for strings longer than 31 bytes.
bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;
error StringTooLong(string str);
error InvalidShortString();
/**
* @dev Encode a string of at most 31 chars into a `ShortString`.
*
* This will trigger a `StringTooLong` error is the input string is too long.
*/
function toShortString(string memory str) internal pure returns (ShortString) {
bytes memory bstr = bytes(str);
if (bstr.length > 31) {
revert StringTooLong(str);
}
return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
}
/**
* @dev Decode a `ShortString` back to a "normal" string.
*/
function toString(ShortString sstr) internal pure returns (string memory) {
uint256 len = byteLength(sstr);
// using `new string(len)` would work locally but is not memory safe.
string memory str = new string(32);
/// @solidity memory-safe-assembly
assembly {
mstore(str, len)
mstore(add(str, 0x20), sstr)
}
return str;
}
/**
* @dev Return the length of a `ShortString`.
*/
function byteLength(ShortString sstr) internal pure returns (uint256) {
uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
if (result > 31) {
revert InvalidShortString();
}
return result;
}
/**
* @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
*/
function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
if (bytes(value).length < 32) {
return toShortString(value);
} else {
StorageSlot.getStringSlot(store).value = value;
return ShortString.wrap(FALLBACK_SENTINEL);
}
}
/**
* @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
*/
function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return toString(value);
} else {
return store;
}
}
/**
* @dev Return the length of a string that was encoded to `ShortString` or written to storage using
* {setWithFallback}.
*
* WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
* actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
*/
function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return byteLength(value);
} else {
return bytes(store).length;
}
}
}// 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/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/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/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) (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) (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) (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.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/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) (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) (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.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.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);
}{
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"string","name":"contractUri","type":"string"},{"internalType":"address","name":"validator","type":"address"},{"internalType":"uint256","name":"saleStartTime","type":"uint256"},{"internalType":"uint256","name":"saleEndTime","type":"uint256"},{"internalType":"address","name":"loyaltyRecipient","type":"address"},{"internalType":"uint96","name":"loyaltyFeeNumerator","type":"uint96"},{"internalType":"uint256","name":"mintFee","type":"uint256"},{"internalType":"address payable","name":"mintFeeRecipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"address","name":"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":"InvalidShortString","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":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","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":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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"},{"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":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMintFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMintFeeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getNumberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSaleTime","outputs":[{"components":[{"internalType":"uint64","name":"beginTimestamp","type":"uint64"},{"internalType":"uint64","name":"endTimestamp","type":"uint64"}],"internalType":"struct SpellBox.TimeRange","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalMinted","outputs":[{"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":[],"name":"isSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"purchaseLimit","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"purchase","outputs":[],"stateMutability":"payable","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":"string","name":"newuri","type":"string"}],"name":"setContractURI","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":"newMintFee","type":"uint256"}],"name":"setMintFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newMintFeeRecipient","type":"address"}],"name":"setMintFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"saleStartTime","type":"uint256"},{"internalType":"uint256","name":"saleEndTime","type":"uint256"}],"name":"setSaleTime","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":"string","name":"newuri","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validator","type":"address"}],"name":"setValidator","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":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","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":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"withdrawErc1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawErc20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawErc721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
610160604052348015610010575f80fd5b50604051616862380380616862833981810160405281019061003291906109eb565b896040518060400160405280600181526020017f3100000000000000000000000000000000000000000000000000000000000000815250338b61007a8161030160201b60201c565b505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100eb575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016100e29190610b27565b60405180910390fd5b6100fa8161031460201b60201c565b5061010f6008836103d760201b90919060201c565b610120818152505061012b6009826103d760201b90919060201c565b6101408181525050818051906020012060e08181525050808051906020012061010081815250504660a0818152505061016861042460201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505050506001600a8190555089601190816101bc9190610d44565b5089601290816101cc9190610d44565b5086600f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550876010908161021c9190610d44565b5081600c819055505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610292576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028990610e6d565b60405180910390fd5b80600e5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102e2868661047e60201b60201c565b6102f2848461057d60201b60201c565b505050505050505050506110ad565b80600290816103109190610d44565b5050565b5f60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160075f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f6020835110156103f8576103f18361071e60201b60201c565b905061041e565b826104088361078360201b60201c565b5f0190816104169190610d44565b5060ff5f1b90505b92915050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60e051610100514630604051602001610463959493929190610eb2565b60405160208183030381529060405280519060200120905090565b67ffffffffffffffff801682111580156104a2575067ffffffffffffffff80168111155b80156104ad57508082105b6104ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e390610f4d565b60405180910390fd5b5f60405180604001604052808467ffffffffffffffff1681526020018367ffffffffffffffff16815250905080600b5f820151815f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506020820151815f0160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050505050565b5f61058c61078c60201b60201c565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff1611156105f15781816040517f6f483d090000000000000000000000000000000000000000000000000000000081526004016105e8929190610f9b565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610661575f6040517fb6d9900a0000000000000000000000000000000000000000000000000000000081526004016106589190610b27565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff1681525060055f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151815f0160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550905050505050565b5f80829050601f8151111561076a57826040517f305a27a90000000000000000000000000000000000000000000000000000000081526004016107619190610ffa565b60405180910390fd5b80518161077690611047565b5f1c175f1b915050919050565b5f819050919050565b5f612710905090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6107f4826107ae565b810181811067ffffffffffffffff82111715610813576108126107be565b5b80604052505050565b5f610825610795565b905061083182826107eb565b919050565b5f67ffffffffffffffff8211156108505761084f6107be565b5b610859826107ae565b9050602081019050919050565b8281835e5f83830152505050565b5f61088661088184610836565b61081c565b9050828152602081018484840111156108a2576108a16107aa565b5b6108ad848285610866565b509392505050565b5f82601f8301126108c9576108c86107a6565b5b81516108d9848260208601610874565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61090b826108e2565b9050919050565b61091b81610901565b8114610925575f80fd5b50565b5f8151905061093681610912565b92915050565b5f819050919050565b61094e8161093c565b8114610958575f80fd5b50565b5f8151905061096981610945565b92915050565b5f6bffffffffffffffffffffffff82169050919050565b61098f8161096f565b8114610999575f80fd5b50565b5f815190506109aa81610986565b92915050565b5f6109ba826108e2565b9050919050565b6109ca816109b0565b81146109d4575f80fd5b50565b5f815190506109e5816109c1565b92915050565b5f805f805f805f805f806101408b8d031215610a0a57610a0961079e565b5b5f8b015167ffffffffffffffff811115610a2757610a266107a2565b5b610a338d828e016108b5565b9a505060208b015167ffffffffffffffff811115610a5457610a536107a2565b5b610a608d828e016108b5565b99505060408b015167ffffffffffffffff811115610a8157610a806107a2565b5b610a8d8d828e016108b5565b9850506060610a9e8d828e01610928565b9750506080610aaf8d828e0161095b565b96505060a0610ac08d828e0161095b565b95505060c0610ad18d828e01610928565b94505060e0610ae28d828e0161099c565b935050610100610af48d828e0161095b565b925050610120610b068d828e016109d7565b9150509295989b9194979a5092959850565b610b2181610901565b82525050565b5f602082019050610b3a5f830184610b18565b92915050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610b8e57607f821691505b602082108103610ba157610ba0610b4a565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302610c037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610bc8565b610c0d8683610bc8565b95508019841693508086168417925050509392505050565b5f819050919050565b5f610c48610c43610c3e8461093c565b610c25565b61093c565b9050919050565b5f819050919050565b610c6183610c2e565b610c75610c6d82610c4f565b848454610bd4565b825550505050565b5f90565b610c89610c7d565b610c94818484610c58565b505050565b5b81811015610cb757610cac5f82610c81565b600181019050610c9a565b5050565b601f821115610cfc57610ccd81610ba7565b610cd684610bb9565b81016020851015610ce5578190505b610cf9610cf185610bb9565b830182610c99565b50505b505050565b5f82821c905092915050565b5f610d1c5f1984600802610d01565b1980831691505092915050565b5f610d348383610d0d565b9150826002028217905092915050565b610d4d82610b40565b67ffffffffffffffff811115610d6657610d656107be565b5b610d708254610b77565b610d7b828285610cbb565b5f60209050601f831160018114610dac575f8415610d9a578287015190505b610da48582610d29565b865550610e0b565b601f198416610dba86610ba7565b5f5b82811015610de157848901518255600182019150602085019450602081019050610dbc565b86831015610dfe5784890151610dfa601f891682610d0d565b8355505b6001600288020188555050505b505050505050565b5f82825260208201905092915050565b7f43616e6e6f742073657420746f203020616464726573730000000000000000005f82015250565b5f610e57601783610e13565b9150610e6282610e23565b602082019050919050565b5f6020820190508181035f830152610e8481610e4b565b9050919050565b5f819050919050565b610e9d81610e8b565b82525050565b610eac8161093c565b82525050565b5f60a082019050610ec55f830188610e94565b610ed26020830187610e94565b610edf6040830186610e94565b610eec6060830185610ea3565b610ef96080830184610b18565b9695505050505050565b7f496e76616c69642074696d6500000000000000000000000000000000000000005f82015250565b5f610f37600c83610e13565b9150610f4282610f03565b602082019050919050565b5f6020820190508181035f830152610f6481610f2b565b9050919050565b5f610f85610f80610f7b8461096f565b610c25565b61093c565b9050919050565b610f9581610f6b565b82525050565b5f604082019050610fae5f830185610f8c565b610fbb6020830184610ea3565b9392505050565b5f610fcc82610b40565b610fd68185610e13565b9350610fe6818560208601610866565b610fef816107ae565b840191505092915050565b5f6020820190508181035f8301526110128184610fc2565b905092915050565b5f81519050919050565b5f819050602082019050919050565b5f61103e8251610e8b565b80915050919050565b5f6110518261101a565b8261105b84611024565b905061106681611033565b925060208210156110a6576110a17fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83602003600802610bc8565b831692505b5050919050565b60805160a05160c05160e0516101005161012051610140516157646110fe5f395f61248d01525f61245201525f61393f01525f61391e01525f61360201525f61365801525f61368101526157645ff3fe608060405260043610610227575f3560e01c80635944c7531161012257806395d89b41116100aa578063e8a3d4851161006e578063e8a3d485146107f7578063e985e9c514610821578063eddd0d9c1461085d578063f242432a14610885578063f2fde38b146108ad5761022e565b806395d89b4114610717578063a22cb46514610741578063bd85b03914610769578063ca87e67e146107a5578063cbf21fe4146107cd5761022e565b80637a5caab3116100f15780637a5caab31461062f57806384b0196e146106595780638a59a7fd146106895780638da5cb5b146106c5578063938e3d7b146106ef5761022e565b80635944c7531461059f57806368914e95146105c7578063715018a6146105ef578063751eaf77146106055761022e565b806318160ddd116101b05780634782f779116101745780634782f779146104b957806349b92d5e146104e15780634e1273f4146104fd5780634f558e7914610539578063564566a8146105755761022e565b806318160ddd146103da5780632a55205a146104045780632eb2c2d6146104415780633788fb6a1461046957806339e4905f146104915761022e565b806306fdde03116101f757806306fdde03146102fa5780630ca1c5c9146103245780630e89341c1461034e5780631327d3d81461038a5780631593dee1146103b25761022e565b8062fdd58e1461023257806301ffc9a71461026e57806302fe5305146102aa57806304634d8d146102d25761022e565b3661022e57005b5f80fd5b34801561023d575f80fd5b5061025860048036038101906102539190613b40565b6108d5565b6040516102659190613b8d565b60405180910390f35b348015610279575f80fd5b50610294600480360381019061028f9190613bfb565b61092a565b6040516102a19190613c40565b60405180910390f35b3480156102b5575f80fd5b506102d060048036038101906102cb9190613d95565b61094b565b005b3480156102dd575f80fd5b506102f860048036038101906102f39190613e1d565b61095f565b005b348015610305575f80fd5b5061030e610975565b60405161031b9190613ebb565b60405180910390f35b34801561032f575f80fd5b50610338610a01565b6040516103459190613b8d565b60405180910390f35b348015610359575f80fd5b50610374600480360381019061036f9190613edb565b610a0a565b6040516103819190613ebb565b60405180910390f35b348015610395575f80fd5b506103b060048036038101906103ab9190613f06565b610a9c565b005b3480156103bd575f80fd5b506103d860048036038101906103d39190613f31565b610b55565b005b3480156103e5575f80fd5b506103ee610ca2565b6040516103fb9190613b8d565b60405180910390f35b34801561040f575f80fd5b5061042a60048036038101906104259190613f81565b610cab565b604051610438929190613fce565b60405180910390f35b34801561044c575f80fd5b5061046760048036038101906104629190614157565b610e87565b005b348015610474575f80fd5b5061048f600480360381019061048a9190613f06565b610f2e565b005b34801561049c575f80fd5b506104b760048036038101906104b29190614222565b610fe7565b005b3480156104c4575f80fd5b506104df60048036038101906104da91906142f0565b611129565b005b6104fb60048036038101906104f69190614387565b611221565b005b348015610508575f80fd5b50610523600480360381019061051e91906144dd565b6112f0565b604051610530919061460a565b60405180910390f35b348015610544575f80fd5b5061055f600480360381019061055a9190613edb565b6113f7565b60405161056c9190613c40565b60405180910390f35b348015610580575f80fd5b5061058961140a565b6040516105969190613c40565b60405180910390f35b3480156105aa575f80fd5b506105c560048036038101906105c0919061462a565b6114a7565b005b3480156105d2575f80fd5b506105ed60048036038101906105e89190613f31565b6114bf565b005b3480156105fa575f80fd5b50610603611620565b005b348015610610575f80fd5b50610619611633565b604051610626919061467a565b60405180910390f35b34801561063a575f80fd5b5061064361165b565b6040516106509190613b8d565b60405180910390f35b348015610664575f80fd5b5061066d611664565b60405161068097969594939291906146e5565b60405180910390f35b348015610694575f80fd5b506106af60048036038101906106aa9190613f06565b611709565b6040516106bc9190613b8d565b60405180910390f35b3480156106d0575f80fd5b506106d961171c565b6040516106e6919061467a565b60405180910390f35b3480156106fa575f80fd5b5061071560048036038101906107109190613d95565b611744565b005b348015610722575f80fd5b5061072b61175f565b6040516107389190613ebb565b60405180910390f35b34801561074c575f80fd5b5061076760048036038101906107629190614791565b6117eb565b005b348015610774575f80fd5b5061078f600480360381019061078a9190613edb565b611801565b60405161079c9190613b8d565b60405180910390f35b3480156107b0575f80fd5b506107cb60048036038101906107c69190613f81565b61181b565b005b3480156107d8575f80fd5b506107e1611831565b6040516107ee919061481e565b60405180910390f35b348015610802575f80fd5b5061080b6118ac565b6040516108189190613ebb565b60405180910390f35b34801561082c575f80fd5b5061084760048036038101906108429190614837565b61193c565b6040516108549190613c40565b60405180910390f35b348015610868575f80fd5b50610883600480360381019061087e9190613edb565b6119ca565b005b348015610890575f80fd5b506108ab60048036038101906108a69190614222565b6119dc565b005b3480156108b8575f80fd5b506108d360048036038101906108ce9190613f06565b611a83565b005b5f805f8381526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f61093482611b07565b80610944575061094382611be8565b5b9050919050565b610953611c61565b61095c81611ce8565b50565b610967611c61565b6109718282611cfb565b5050565b60118054610982906148a2565b80601f01602080910402602001604051908101604052809291908181526020018280546109ae906148a2565b80156109f95780601f106109d0576101008083540402835291602001916109f9565b820191905f5260205f20905b8154815290600101906020018083116109dc57829003601f168201915b505050505081565b5f600d54905090565b606060028054610a19906148a2565b80601f0160208091040260200160405190810160405280929190818152602001828054610a45906148a2565b8015610a905780601f10610a6757610100808354040283529160200191610a90565b820191905f5260205f20905b815481529060010190602001808311610a7357829003601f168201915b50505050509050919050565b610aa4611c61565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b099061491c565b60405180910390fd5b80600f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610b5d611c61565b5f8390505f8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610b9b919061467a565b602060405180830381865afa158015610bb6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bda919061494e565b905082811015610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906149c3565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b8152600401610c5a929190613fce565b6020604051808303815f875af1158015610c76573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c9a91906149f5565b505050505050565b5f600454905090565b5f805f60065f8681526020019081526020015f206040518060400160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020015f820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505f73ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff1603610e345760056040518060400160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020015f820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b5f610e3d611e96565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610e699190614a4d565b610e739190614abb565b9050815f0151819350935050509250929050565b5f610e90611e9f565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015610ed55750610ed3868261193c565b155b15610f195780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401610f10929190614aeb565b60405180910390fd5b610f268686868686611ea6565b505050505050565b610f36611c61565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fa4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9b9061491c565b60405180910390fd5b80600e5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610fef611c61565b5f8590505f8173ffffffffffffffffffffffffffffffffffffffff1662fdd58e30876040518363ffffffff1660e01b815260040161102e929190613fce565b602060405180830381865afa158015611049573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061106d919061494e565b9050838110156110b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a9906149c3565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663f242432a30888888886040518663ffffffff1660e01b81526004016110f3959493929190614b64565b5f604051808303815f87803b15801561110a575f80fd5b505af115801561111c573d5f803e3d5ffd5b5050505050505050505050565b611131611c61565b47811115611174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116b906149c3565b60405180910390fd5b5f8273ffffffffffffffffffffffffffffffffffffffff168260405161119990614be9565b5f6040518083038185875af1925050503d805f81146111d3576040519150601f19603f3d011682016040523d82523d5f602084013e6111d8565b606091505b505090508061121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390614c47565b60405180910390fd5b505050565b61122961140a565b611268576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125f90614caf565b60405180910390fd5b611270611f9a565b5f861415801561129357508461128585611709565b876112909190614ccd565b11155b6112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c990614d4a565b60405180910390fd5b6112e0868686868686611fe9565b6112e861218f565b505050505050565b6060815183511461133c57815183516040517f5b059991000000000000000000000000000000000000000000000000000000008152600401611333929190614d68565b60405180910390fd5b5f835167ffffffffffffffff81111561135857611357613c71565b5b6040519080825280602002602001820160405280156113865781602001602082028036833780820191505090505b5090505f5b84518110156113ec576113c26113aa828761219990919063ffffffff16565b6113bd83876121ac90919063ffffffff16565b6108d5565b8282815181106113d5576113d4614d8f565b5b60200260200101818152505080600101905061138b565b508091505092915050565b5f8061140283611801565b119050919050565b5f80600b6040518060400160405290815f82015f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020015f820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505090506114a1815f015167ffffffffffffffff16826020015167ffffffffffffffff166121bf565b91505090565b6114af611c61565b6114ba8383836121d7565b505050565b6114c7611c61565b5f8390503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16636352211e846040518263ffffffff1660e01b815260040161151b9190613b8d565b602060405180830381865afa158015611536573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061155a9190614dd0565b73ffffffffffffffffffffffffffffffffffffffff16146115b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a790614e45565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166342842e0e3085856040518463ffffffff1660e01b81526004016115ed93929190614e63565b5f604051808303815f87803b158015611604575f80fd5b505af1158015611616573d5f803e3d5ffd5b5050505050505050565b611628611c61565b6116315f612386565b565b5f600e5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f600c54905090565b5f6060805f805f6060611675612449565b61167d612484565b46305f801b5f67ffffffffffffffff81111561169c5761169b613c71565b5b6040519080825280602002602001820160405280156116ca5781602001602082028036833780820191505090505b507f0f00000000000000000000000000000000000000000000000000000000000000959493929190965096509650965096509650965090919293949596565b5f6117158260016108d5565b9050919050565b5f60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61174c611c61565b806010908161175b9190615035565b5050565b6012805461176c906148a2565b80601f0160208091040260200160405190810160405280929190818152602001828054611798906148a2565b80156117e35780601f106117ba576101008083540402835291602001916117e3565b820191905f5260205f20905b8154815290600101906020018083116117c657829003601f168201915b505050505081565b6117fd6117f6611e9f565b83836124bf565b5050565b5f60035f8381526020019081526020015f20549050919050565b611823611c61565b61182d8282612628565b5050565b611839613a76565b600b6040518060400160405290815f82015f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020015f820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681525050905090565b6060601080546118bb906148a2565b80601f01602080910402602001604051908101604052809291908181526020018280546118e7906148a2565b80156119325780601f1061190957610100808354040283529160200191611932565b820191905f5260205f20905b81548152906001019060200180831161191557829003601f168201915b5050505050905090565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b6119d2611c61565b80600c8190555050565b5f6119e5611e9f565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015611a2a5750611a28868261193c565b155b15611a6e5780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401611a65929190614aeb565b60405180910390fd5b611a7b8686868686612727565b505050505050565b611a8b611c61565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611afb575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401611af2919061467a565b60405180910390fd5b611b0481612386565b50565b5f7fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611bd157507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611be15750611be08261282d565b5b9050919050565b5f7f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611c5a5750611c5982611b07565b5b9050919050565b611c69611e9f565b73ffffffffffffffffffffffffffffffffffffffff16611c8761171c565b73ffffffffffffffffffffffffffffffffffffffff1614611ce657611caa611e9f565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611cdd919061467a565b60405180910390fd5b565b8060029081611cf79190615035565b5050565b5f611d04611e96565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115611d695781816040517f6f483d09000000000000000000000000000000000000000000000000000000008152600401611d60929190615134565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611dd9575f6040517fb6d9900a000000000000000000000000000000000000000000000000000000008152600401611dd0919061467a565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff1681525060055f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151815f0160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550905050505050565b5f612710905090565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611f16575f6040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401611f0d919061467a565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603611f86575f6040517f01a83514000000000000000000000000000000000000000000000000000000008152600401611f7d919061467a565b60405180910390fd5b611f938585858585612896565b5050505050565b6002600a5403611fdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd6906151a5565b60405180910390fd5b6002600a81905550565b82421061202b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120229061520d565b60405180910390fd5b5f86600c5461203a9190614a4d565b905080341461207e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207590615275565b60405180910390fd5b5f83836040516020016120929291906152b7565b60405160208183030381529060405280519060200120905060135f8281526020019081526020015f205f9054906101000a900460ff1615612108576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ff90615319565b60405180910390fd5b612116888888888888612942565b600160135f8381526020019081526020015f205f6101000a81548160ff02191690831515021790555061215a8660018a60405180602001604052805f815250612a80565b6001600d5f82825461216c9190614ccd565b925050819055505f8211156121855761218482612b15565b5b5050505050505050565b6001600a81905550565b5f60208202602084010151905092915050565b5f60208202602084010151905092915050565b5f4283111580156121cf57508142105b905092915050565b5f6121e0611e96565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115612247578382826040517fdfd1fc1b00000000000000000000000000000000000000000000000000000000815260040161223e93929190615337565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036122b957835f6040517f969f08520000000000000000000000000000000000000000000000000000000081526004016122b092919061536c565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff1681525060065f8681526020019081526020015f205f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151815f0160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505050505050565b5f60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160075f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b606061247f60087f0000000000000000000000000000000000000000000000000000000000000000612be290919063ffffffff16565b905090565b60606124ba60097f0000000000000000000000000000000000000000000000000000000000000000612be290919063ffffffff16565b905090565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361252f575f6040517fced3e100000000000000000000000000000000000000000000000000000000008152600401612526919061467a565b60405180910390fd5b8060015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161261b9190613c40565b60405180910390a3505050565b67ffffffffffffffff8016821115801561264c575067ffffffffffffffff80168111155b801561265757508082105b612696576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161268d906153dd565b60405180910390fd5b5f60405180604001604052808467ffffffffffffffff1681526020018367ffffffffffffffff16815250905080600b5f820151815f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506020820151815f0160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612797575f6040517f57f447ce00000000000000000000000000000000000000000000000000000000815260040161278e919061467a565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603612807575f6040517f01a835140000000000000000000000000000000000000000000000000000000081526004016127fe919061467a565b60405180910390fd5b5f806128138585612c8f565b915091506128248787848487612896565b50505050505050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6128a285858585612cbf565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461293b575f6128de611e9f565b9050600184510361292a575f6128fd5f866121ac90919063ffffffff16565b90505f6129135f866121ac90919063ffffffff16565b9050612923838989858589612e5c565b5050612939565b61293881878787878761300b565b5b505b5050505050565b5f61299a7fd74ac019784698b6e7b591bf623d975d8891a4d39d9fa905dbc7560c0fc5ee068888888860405160200161297f9594939291906153fb565b604051602081830303815290604052805190602001206131ba565b9050600f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612a218285858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050506131d3565b73ffffffffffffffffffffffffffffffffffffffff1614612a77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a6e90615496565b60405180910390fd5b50505050505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612af0575f6040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612ae7919061467a565b60405180910390fd5b5f80612afc8585612c8f565b91509150612b0d5f87848487612896565b505050505050565b5f600e5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682604051612b5b90614be9565b5f6040518083038185875af1925050503d805f8114612b95576040519150601f19603f3d011682016040523d82523d5f602084013e612b9a565b606091505b5050905080612bde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd5906154fe565b60405180910390fd5b5050565b606060ff5f1b8314612bfe57612bf7836131fd565b9050612c89565b818054612c0a906148a2565b80601f0160208091040260200160405190810160405280929190818152602001828054612c36906148a2565b8015612c815780601f10612c5857610100808354040283529160200191612c81565b820191905f5260205f20905b815481529060010190602001808311612c6457829003601f168201915b505050505090505b92915050565b60608060405191506001825283602083015260408201905060018152826020820152604081016040529250929050565b612ccb8484848461326f565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612d9e575f805b8351811015612d83575f838281518110612d1e57612d1d614d8f565b5b602002602001015190508060035f878581518110612d3f57612d3e614d8f565b5b602002602001015181526020019081526020015f205f828254612d629190614ccd565b925050819055508083612d759190614ccd565b925050806001019050612d01565b508060045f828254612d959190614ccd565b92505081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612e56575f805b8351811015612e44575f838281518110612df157612df0614d8f565b5b602002602001015190508060035f878581518110612e1257612e11614d8f565b5b602002602001015181526020019081526020015f205f8282540392505081905550808301925050806001019050612dd4565b508060045f8282540392505081905550505b50505050565b5f8473ffffffffffffffffffffffffffffffffffffffff163b1115613003578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b8152600401612ebc959493929190614b64565b6020604051808303815f875af1925050508015612ef757506040513d601f19601f82011682018060405250810190612ef49190615530565b60015b612f78573d805f8114612f25576040519150601f19603f3d011682016040523d82523d5f602084013e612f2a565b606091505b505f815103612f7057846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612f67919061467a565b60405180910390fd5b805181602001fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461300157846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612ff8919061467a565b60405180910390fd5b505b505050505050565b5f8473ffffffffffffffffffffffffffffffffffffffff163b11156131b2578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161306b95949392919061555b565b6020604051808303815f875af19250505080156130a657506040513d601f19601f820116820180604052508101906130a39190615530565b60015b613127573d805f81146130d4576040519150601f19603f3d011682016040523d82523d5f602084013e6130d9565b606091505b505f81510361311f57846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401613116919061467a565b60405180910390fd5b805181602001fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146131b057846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016131a7919061467a565b60405180910390fd5b505b505050505050565b5f6131cc6131c66135ff565b836136b5565b9050919050565b5f805f806131e186866136f5565b9250925092506131f1828261374a565b82935050505092915050565b60605f613209836138ac565b90505f602067ffffffffffffffff81111561322757613226613c71565b5b6040519080825280601f01601f1916602001820160405280156132595781602001600182028036833780820191505090505b5090508181528360208201528092505050919050565b80518251146132b957815181516040517f5b0599910000000000000000000000000000000000000000000000000000000081526004016132b0929190614d68565b60405180910390fd5b5f6132c2611e9f565b90505f5b83518110156134be575f6132e382866121ac90919063ffffffff16565b90505f6132f983866121ac90919063ffffffff16565b90505f73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461341c575f805f8481526020019081526020015f205f8a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156133c857888183856040517f03dee4c50000000000000000000000000000000000000000000000000000000081526004016133bf94939291906155c1565b60405180910390fd5b8181035f808581526020019081526020015f205f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16146134b157805f808481526020019081526020015f205f8973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546134a99190614ccd565b925050819055505b50508060010190506132c6565b506001835103613579575f6134dc5f856121ac90919063ffffffff16565b90505f6134f25f856121ac90919063ffffffff16565b90508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62858560405161356a929190614d68565b60405180910390a450506135f8565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516135ef929190615604565b60405180910390a45b5050505050565b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1614801561367a57507f000000000000000000000000000000000000000000000000000000000000000046145b156136a7577f000000000000000000000000000000000000000000000000000000000000000090506136b2565b6136af6138fa565b90505b90565b5f6040517f190100000000000000000000000000000000000000000000000000000000000081528360028201528260228201526042812091505092915050565b5f805f6041845103613735575f805f602087015192506040870151915060608701515f1a90506137278882858561398f565b955095509550505050613743565b5f600285515f1b9250925092505b9250925092565b5f600381111561375d5761375c615639565b5b8260038111156137705761376f615639565b5b03156138a8576001600381111561378a57613789615639565b5b82600381111561379d5761379c615639565b5b036137d4576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260038111156137e8576137e7615639565b5b8260038111156137fb576137fa615639565b5b0361383f57805f1c6040517ffce698f70000000000000000000000000000000000000000000000000000000081526004016138369190613b8d565b60405180910390fd5b60038081111561385257613851615639565b5b82600381111561386557613864615639565b5b036138a757806040517fd78bce0c00000000000000000000000000000000000000000000000000000000815260040161389e9190615666565b60405180910390fd5b5b5050565b5f8060ff835f1c169050601f8111156138f1576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80915050919050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000463060405160200161397495949392919061567f565b60405160208183030381529060405280519060200120905090565b5f805f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0845f1c11156139cb575f600385925092509250613a6c565b5f6001888888886040515f81526020016040526040516139ee94939291906156eb565b6020604051602081039080840390855afa158015613a0e573d5f803e3d5ffd5b5050506020604051035190505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603613a5f575f60015f801b93509350935050613a6c565b805f805f1b935093509350505b9450945094915050565b60405180604001604052805f67ffffffffffffffff1681526020015f67ffffffffffffffff1681525090565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f613adc82613ab3565b9050919050565b613aec81613ad2565b8114613af6575f80fd5b50565b5f81359050613b0781613ae3565b92915050565b5f819050919050565b613b1f81613b0d565b8114613b29575f80fd5b50565b5f81359050613b3a81613b16565b92915050565b5f8060408385031215613b5657613b55613aab565b5b5f613b6385828601613af9565b9250506020613b7485828601613b2c565b9150509250929050565b613b8781613b0d565b82525050565b5f602082019050613ba05f830184613b7e565b92915050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613bda81613ba6565b8114613be4575f80fd5b50565b5f81359050613bf581613bd1565b92915050565b5f60208284031215613c1057613c0f613aab565b5b5f613c1d84828501613be7565b91505092915050565b5f8115159050919050565b613c3a81613c26565b82525050565b5f602082019050613c535f830184613c31565b92915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b613ca782613c61565b810181811067ffffffffffffffff82111715613cc657613cc5613c71565b5b80604052505050565b5f613cd8613aa2565b9050613ce48282613c9e565b919050565b5f67ffffffffffffffff821115613d0357613d02613c71565b5b613d0c82613c61565b9050602081019050919050565b828183375f83830152505050565b5f613d39613d3484613ce9565b613ccf565b905082815260208101848484011115613d5557613d54613c5d565b5b613d60848285613d19565b509392505050565b5f82601f830112613d7c57613d7b613c59565b5b8135613d8c848260208601613d27565b91505092915050565b5f60208284031215613daa57613da9613aab565b5b5f82013567ffffffffffffffff811115613dc757613dc6613aaf565b5b613dd384828501613d68565b91505092915050565b5f6bffffffffffffffffffffffff82169050919050565b613dfc81613ddc565b8114613e06575f80fd5b50565b5f81359050613e1781613df3565b92915050565b5f8060408385031215613e3357613e32613aab565b5b5f613e4085828601613af9565b9250506020613e5185828601613e09565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f613e8d82613e5b565b613e978185613e65565b9350613ea7818560208601613e75565b613eb081613c61565b840191505092915050565b5f6020820190508181035f830152613ed38184613e83565b905092915050565b5f60208284031215613ef057613eef613aab565b5b5f613efd84828501613b2c565b91505092915050565b5f60208284031215613f1b57613f1a613aab565b5b5f613f2884828501613af9565b91505092915050565b5f805f60608486031215613f4857613f47613aab565b5b5f613f5586828701613af9565b9350506020613f6686828701613af9565b9250506040613f7786828701613b2c565b9150509250925092565b5f8060408385031215613f9757613f96613aab565b5b5f613fa485828601613b2c565b9250506020613fb585828601613b2c565b9150509250929050565b613fc881613ad2565b82525050565b5f604082019050613fe15f830185613fbf565b613fee6020830184613b7e565b9392505050565b5f67ffffffffffffffff82111561400f5761400e613c71565b5b602082029050602081019050919050565b5f80fd5b5f61403661403184613ff5565b613ccf565b9050808382526020820190506020840283018581111561405957614058614020565b5b835b81811015614082578061406e8882613b2c565b84526020840193505060208101905061405b565b5050509392505050565b5f82601f8301126140a05761409f613c59565b5b81356140b0848260208601614024565b91505092915050565b5f67ffffffffffffffff8211156140d3576140d2613c71565b5b6140dc82613c61565b9050602081019050919050565b5f6140fb6140f6846140b9565b613ccf565b90508281526020810184848401111561411757614116613c5d565b5b614122848285613d19565b509392505050565b5f82601f83011261413e5761413d613c59565b5b813561414e8482602086016140e9565b91505092915050565b5f805f805f60a086880312156141705761416f613aab565b5b5f61417d88828901613af9565b955050602061418e88828901613af9565b945050604086013567ffffffffffffffff8111156141af576141ae613aaf565b5b6141bb8882890161408c565b935050606086013567ffffffffffffffff8111156141dc576141db613aaf565b5b6141e88882890161408c565b925050608086013567ffffffffffffffff81111561420957614208613aaf565b5b6142158882890161412a565b9150509295509295909350565b5f805f805f60a0868803121561423b5761423a613aab565b5b5f61424888828901613af9565b955050602061425988828901613af9565b945050604061426a88828901613b2c565b935050606061427b88828901613b2c565b925050608086013567ffffffffffffffff81111561429c5761429b613aaf565b5b6142a88882890161412a565b9150509295509295909350565b5f6142bf82613ab3565b9050919050565b6142cf816142b5565b81146142d9575f80fd5b50565b5f813590506142ea816142c6565b92915050565b5f806040838503121561430657614305613aab565b5b5f614313858286016142dc565b925050602061432485828601613b2c565b9150509250929050565b5f80fd5b5f8083601f84011261434757614346613c59565b5b8235905067ffffffffffffffff8111156143645761436361432e565b5b6020830191508360018202830111156143805761437f614020565b5b9250929050565b5f805f805f8060a087890312156143a1576143a0613aab565b5b5f6143ae89828a01613b2c565b96505060206143bf89828a01613b2c565b95505060406143d089828a01613af9565b94505060606143e189828a01613b2c565b935050608087013567ffffffffffffffff81111561440257614401613aaf565b5b61440e89828a01614332565b92509250509295509295509295565b5f67ffffffffffffffff82111561443757614436613c71565b5b602082029050602081019050919050565b5f61445a6144558461441d565b613ccf565b9050808382526020820190506020840283018581111561447d5761447c614020565b5b835b818110156144a657806144928882613af9565b84526020840193505060208101905061447f565b5050509392505050565b5f82601f8301126144c4576144c3613c59565b5b81356144d4848260208601614448565b91505092915050565b5f80604083850312156144f3576144f2613aab565b5b5f83013567ffffffffffffffff8111156145105761450f613aaf565b5b61451c858286016144b0565b925050602083013567ffffffffffffffff81111561453d5761453c613aaf565b5b6145498582860161408c565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61458581613b0d565b82525050565b5f614596838361457c565b60208301905092915050565b5f602082019050919050565b5f6145b882614553565b6145c2818561455d565b93506145cd8361456d565b805f5b838110156145fd5781516145e4888261458b565b97506145ef836145a2565b9250506001810190506145d0565b5085935050505092915050565b5f6020820190508181035f83015261462281846145ae565b905092915050565b5f805f6060848603121561464157614640613aab565b5b5f61464e86828701613b2c565b935050602061465f86828701613af9565b925050604061467086828701613e09565b9150509250925092565b5f60208201905061468d5f830184613fbf565b92915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6146c781614693565b82525050565b5f819050919050565b6146df816146cd565b82525050565b5f60e0820190506146f85f83018a6146be565b818103602083015261470a8189613e83565b9050818103604083015261471e8188613e83565b905061472d6060830187613b7e565b61473a6080830186613fbf565b61474760a08301856146d6565b81810360c083015261475981846145ae565b905098975050505050505050565b61477081613c26565b811461477a575f80fd5b50565b5f8135905061478b81614767565b92915050565b5f80604083850312156147a7576147a6613aab565b5b5f6147b485828601613af9565b92505060206147c58582860161477d565b9150509250929050565b5f67ffffffffffffffff82169050919050565b6147eb816147cf565b82525050565b604082015f8201516148055f8501826147e2565b50602082015161481860208501826147e2565b50505050565b5f6040820190506148315f8301846147f1565b92915050565b5f806040838503121561484d5761484c613aab565b5b5f61485a85828601613af9565b925050602061486b85828601613af9565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806148b957607f821691505b6020821081036148cc576148cb614875565b5b50919050565b7f43616e6e6f742073657420746f203020616464726573730000000000000000005f82015250565b5f614906601783613e65565b9150614911826148d2565b602082019050919050565b5f6020820190508181035f830152614933816148fa565b9050919050565b5f8151905061494881613b16565b92915050565b5f6020828403121561496357614962613aab565b5b5f6149708482850161493a565b91505092915050565b7f496e73756666696369656e742062616c616e63650000000000000000000000005f82015250565b5f6149ad601483613e65565b91506149b882614979565b602082019050919050565b5f6020820190508181035f8301526149da816149a1565b9050919050565b5f815190506149ef81614767565b92915050565b5f60208284031215614a0a57614a09613aab565b5b5f614a17848285016149e1565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f614a5782613b0d565b9150614a6283613b0d565b9250828202614a7081613b0d565b91508282048414831517614a8757614a86614a20565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f614ac582613b0d565b9150614ad083613b0d565b925082614ae057614adf614a8e565b5b828204905092915050565b5f604082019050614afe5f830185613fbf565b614b0b6020830184613fbf565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b5f614b3682614b12565b614b408185614b1c565b9350614b50818560208601613e75565b614b5981613c61565b840191505092915050565b5f60a082019050614b775f830188613fbf565b614b846020830187613fbf565b614b916040830186613b7e565b614b9e6060830185613b7e565b8181036080830152614bb08184614b2c565b90509695505050505050565b5f81905092915050565b50565b5f614bd45f83614bbc565b9150614bdf82614bc6565b5f82019050919050565b5f614bf382614bc9565b9150819050919050565b7f5472616e73666572206661696c656400000000000000000000000000000000005f82015250565b5f614c31600f83613e65565b9150614c3c82614bfd565b602082019050919050565b5f6020820190508181035f830152614c5e81614c25565b9050919050565b7f53616c6520696e616374697665000000000000000000000000000000000000005f82015250565b5f614c99600d83613e65565b9150614ca482614c65565b602082019050919050565b5f6020820190508181035f830152614cc681614c8d565b9050919050565b5f614cd782613b0d565b9150614ce283613b0d565b9250828201905080821115614cfa57614cf9614a20565b5b92915050565b7f496e76616c6964207175616e74697479000000000000000000000000000000005f82015250565b5f614d34601083613e65565b9150614d3f82614d00565b602082019050919050565b5f6020820190508181035f830152614d6181614d28565b9050919050565b5f604082019050614d7b5f830185613b7e565b614d886020830184613b7e565b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050614dca81613ae3565b92915050565b5f60208284031215614de557614de4613aab565b5b5f614df284828501614dbc565b91505092915050565b7f546f6b656e206973206e6f74206f776e656420627920636f6e747261637400005f82015250565b5f614e2f601e83613e65565b9150614e3a82614dfb565b602082019050919050565b5f6020820190508181035f830152614e5c81614e23565b9050919050565b5f606082019050614e765f830186613fbf565b614e836020830185613fbf565b614e906040830184613b7e565b949350505050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302614ef47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614eb9565b614efe8683614eb9565b95508019841693508086168417925050509392505050565b5f819050919050565b5f614f39614f34614f2f84613b0d565b614f16565b613b0d565b9050919050565b5f819050919050565b614f5283614f1f565b614f66614f5e82614f40565b848454614ec5565b825550505050565b5f90565b614f7a614f6e565b614f85818484614f49565b505050565b5b81811015614fa857614f9d5f82614f72565b600181019050614f8b565b5050565b601f821115614fed57614fbe81614e98565b614fc784614eaa565b81016020851015614fd6578190505b614fea614fe285614eaa565b830182614f8a565b50505b505050565b5f82821c905092915050565b5f61500d5f1984600802614ff2565b1980831691505092915050565b5f6150258383614ffe565b9150826002028217905092915050565b61503e82613e5b565b67ffffffffffffffff81111561505757615056613c71565b5b61506182546148a2565b61506c828285614fac565b5f60209050601f83116001811461509d575f841561508b578287015190505b615095858261501a565b8655506150fc565b601f1984166150ab86614e98565b5f5b828110156150d2578489015182556001820191506020850194506020810190506150ad565b868310156150ef57848901516150eb601f891682614ffe565b8355505b6001600288020188555050505b505050505050565b5f61511e61511961511484613ddc565b614f16565b613b0d565b9050919050565b61512e81615104565b82525050565b5f6040820190506151475f830185615125565b6151546020830184613b7e565b9392505050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c005f82015250565b5f61518f601f83613e65565b915061519a8261515b565b602082019050919050565b5f6020820190508181035f8301526151bc81615183565b9050919050565b7f50757263686173652065787069726564210000000000000000000000000000005f82015250565b5f6151f7601183613e65565b9150615202826151c3565b602082019050919050565b5f6020820190508181035f830152615224816151eb565b9050919050565b7f496e76616c696420616d6f756e742100000000000000000000000000000000005f82015250565b5f61525f600f83613e65565b915061526a8261522b565b602082019050919050565b5f6020820190508181035f83015261528c81615253565b9050919050565b5f61529e8385614bbc565b93506152ab838584613d19565b82840190509392505050565b5f6152c3828486615293565b91508190509392505050565b7f5369676e617475726520757365642100000000000000000000000000000000005f82015250565b5f615303600f83613e65565b915061530e826152cf565b602082019050919050565b5f6020820190508181035f830152615330816152f7565b9050919050565b5f60608201905061534a5f830186613b7e565b6153576020830185615125565b6153646040830184613b7e565b949350505050565b5f60408201905061537f5f830185613b7e565b61538c6020830184613fbf565b9392505050565b7f496e76616c69642074696d6500000000000000000000000000000000000000005f82015250565b5f6153c7600c83613e65565b91506153d282615393565b602082019050919050565b5f6020820190508181035f8301526153f4816153bb565b9050919050565b5f60a08201905061540e5f8301886146d6565b61541b6020830187613b7e565b6154286040830186613b7e565b6154356060830185613fbf565b6154426080830184613b7e565b9695505050505050565b7f496e76616c6964207369676e61747572650000000000000000000000000000005f82015250565b5f615480601183613e65565b915061548b8261544c565b602082019050919050565b5f6020820190508181035f8301526154ad81615474565b9050919050565b7f4661696c656420746f2073656e64206d696e74206665650000000000000000005f82015250565b5f6154e8601783613e65565b91506154f3826154b4565b602082019050919050565b5f6020820190508181035f830152615515816154dc565b9050919050565b5f8151905061552a81613bd1565b92915050565b5f6020828403121561554557615544613aab565b5b5f6155528482850161551c565b91505092915050565b5f60a08201905061556e5f830188613fbf565b61557b6020830187613fbf565b818103604083015261558d81866145ae565b905081810360608301526155a181856145ae565b905081810360808301526155b58184614b2c565b90509695505050505050565b5f6080820190506155d45f830187613fbf565b6155e16020830186613b7e565b6155ee6040830185613b7e565b6155fb6060830184613b7e565b95945050505050565b5f6040820190508181035f83015261561c81856145ae565b9050818103602083015261563081846145ae565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f6020820190506156795f8301846146d6565b92915050565b5f60a0820190506156925f8301886146d6565b61569f60208301876146d6565b6156ac60408301866146d6565b6156b96060830185613b7e565b6156c66080830184613fbf565b9695505050505050565b5f60ff82169050919050565b6156e5816156d0565b82525050565b5f6080820190506156fe5f8301876146d6565b61570b60208301866156dc565b61571860408301856146d6565b61572560608301846146d6565b9594505050505056fea2646970667358221220753d4247b8913256ee29c128a0485b84a7cc054d50ac9856665fe2c4781b0efb64736f6c634300081900330000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000016a20c0f77bf710f154737006417b6f34e63f98100000000000000000000000000000000000000000000000000000000664c002000000000000000000000000000000000000000000000000000000000669c6ba0000000000000000000000000565dbd5c10e80bc116cc2548ccdcb1ae298f38f600000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000005af3107a4000000000000000000000000000565dbd5c10e80bc116cc2548ccdcb1ae298f38f600000000000000000000000000000000000000000000000000000000000000085370656c6c426f78000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d68747470733a2f2f6170692e7370656c6c677572752e61692f6170692f5370656c6c426f783f69643d7b69647d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d68747470733a2f2f6170692e7370656c6c677572752e61692f6170692f5370656c6c426f78436f6e747261637400000000000000000000000000000000000000
Deployed Bytecode
0x608060405260043610610227575f3560e01c80635944c7531161012257806395d89b41116100aa578063e8a3d4851161006e578063e8a3d485146107f7578063e985e9c514610821578063eddd0d9c1461085d578063f242432a14610885578063f2fde38b146108ad5761022e565b806395d89b4114610717578063a22cb46514610741578063bd85b03914610769578063ca87e67e146107a5578063cbf21fe4146107cd5761022e565b80637a5caab3116100f15780637a5caab31461062f57806384b0196e146106595780638a59a7fd146106895780638da5cb5b146106c5578063938e3d7b146106ef5761022e565b80635944c7531461059f57806368914e95146105c7578063715018a6146105ef578063751eaf77146106055761022e565b806318160ddd116101b05780634782f779116101745780634782f779146104b957806349b92d5e146104e15780634e1273f4146104fd5780634f558e7914610539578063564566a8146105755761022e565b806318160ddd146103da5780632a55205a146104045780632eb2c2d6146104415780633788fb6a1461046957806339e4905f146104915761022e565b806306fdde03116101f757806306fdde03146102fa5780630ca1c5c9146103245780630e89341c1461034e5780631327d3d81461038a5780631593dee1146103b25761022e565b8062fdd58e1461023257806301ffc9a71461026e57806302fe5305146102aa57806304634d8d146102d25761022e565b3661022e57005b5f80fd5b34801561023d575f80fd5b5061025860048036038101906102539190613b40565b6108d5565b6040516102659190613b8d565b60405180910390f35b348015610279575f80fd5b50610294600480360381019061028f9190613bfb565b61092a565b6040516102a19190613c40565b60405180910390f35b3480156102b5575f80fd5b506102d060048036038101906102cb9190613d95565b61094b565b005b3480156102dd575f80fd5b506102f860048036038101906102f39190613e1d565b61095f565b005b348015610305575f80fd5b5061030e610975565b60405161031b9190613ebb565b60405180910390f35b34801561032f575f80fd5b50610338610a01565b6040516103459190613b8d565b60405180910390f35b348015610359575f80fd5b50610374600480360381019061036f9190613edb565b610a0a565b6040516103819190613ebb565b60405180910390f35b348015610395575f80fd5b506103b060048036038101906103ab9190613f06565b610a9c565b005b3480156103bd575f80fd5b506103d860048036038101906103d39190613f31565b610b55565b005b3480156103e5575f80fd5b506103ee610ca2565b6040516103fb9190613b8d565b60405180910390f35b34801561040f575f80fd5b5061042a60048036038101906104259190613f81565b610cab565b604051610438929190613fce565b60405180910390f35b34801561044c575f80fd5b5061046760048036038101906104629190614157565b610e87565b005b348015610474575f80fd5b5061048f600480360381019061048a9190613f06565b610f2e565b005b34801561049c575f80fd5b506104b760048036038101906104b29190614222565b610fe7565b005b3480156104c4575f80fd5b506104df60048036038101906104da91906142f0565b611129565b005b6104fb60048036038101906104f69190614387565b611221565b005b348015610508575f80fd5b50610523600480360381019061051e91906144dd565b6112f0565b604051610530919061460a565b60405180910390f35b348015610544575f80fd5b5061055f600480360381019061055a9190613edb565b6113f7565b60405161056c9190613c40565b60405180910390f35b348015610580575f80fd5b5061058961140a565b6040516105969190613c40565b60405180910390f35b3480156105aa575f80fd5b506105c560048036038101906105c0919061462a565b6114a7565b005b3480156105d2575f80fd5b506105ed60048036038101906105e89190613f31565b6114bf565b005b3480156105fa575f80fd5b50610603611620565b005b348015610610575f80fd5b50610619611633565b604051610626919061467a565b60405180910390f35b34801561063a575f80fd5b5061064361165b565b6040516106509190613b8d565b60405180910390f35b348015610664575f80fd5b5061066d611664565b60405161068097969594939291906146e5565b60405180910390f35b348015610694575f80fd5b506106af60048036038101906106aa9190613f06565b611709565b6040516106bc9190613b8d565b60405180910390f35b3480156106d0575f80fd5b506106d961171c565b6040516106e6919061467a565b60405180910390f35b3480156106fa575f80fd5b5061071560048036038101906107109190613d95565b611744565b005b348015610722575f80fd5b5061072b61175f565b6040516107389190613ebb565b60405180910390f35b34801561074c575f80fd5b5061076760048036038101906107629190614791565b6117eb565b005b348015610774575f80fd5b5061078f600480360381019061078a9190613edb565b611801565b60405161079c9190613b8d565b60405180910390f35b3480156107b0575f80fd5b506107cb60048036038101906107c69190613f81565b61181b565b005b3480156107d8575f80fd5b506107e1611831565b6040516107ee919061481e565b60405180910390f35b348015610802575f80fd5b5061080b6118ac565b6040516108189190613ebb565b60405180910390f35b34801561082c575f80fd5b5061084760048036038101906108429190614837565b61193c565b6040516108549190613c40565b60405180910390f35b348015610868575f80fd5b50610883600480360381019061087e9190613edb565b6119ca565b005b348015610890575f80fd5b506108ab60048036038101906108a69190614222565b6119dc565b005b3480156108b8575f80fd5b506108d360048036038101906108ce9190613f06565b611a83565b005b5f805f8381526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f61093482611b07565b80610944575061094382611be8565b5b9050919050565b610953611c61565b61095c81611ce8565b50565b610967611c61565b6109718282611cfb565b5050565b60118054610982906148a2565b80601f01602080910402602001604051908101604052809291908181526020018280546109ae906148a2565b80156109f95780601f106109d0576101008083540402835291602001916109f9565b820191905f5260205f20905b8154815290600101906020018083116109dc57829003601f168201915b505050505081565b5f600d54905090565b606060028054610a19906148a2565b80601f0160208091040260200160405190810160405280929190818152602001828054610a45906148a2565b8015610a905780601f10610a6757610100808354040283529160200191610a90565b820191905f5260205f20905b815481529060010190602001808311610a7357829003601f168201915b50505050509050919050565b610aa4611c61565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b099061491c565b60405180910390fd5b80600f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610b5d611c61565b5f8390505f8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610b9b919061467a565b602060405180830381865afa158015610bb6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bda919061494e565b905082811015610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906149c3565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b8152600401610c5a929190613fce565b6020604051808303815f875af1158015610c76573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c9a91906149f5565b505050505050565b5f600454905090565b5f805f60065f8681526020019081526020015f206040518060400160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020015f820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505f73ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff1603610e345760056040518060400160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020015f820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b5f610e3d611e96565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610e699190614a4d565b610e739190614abb565b9050815f0151819350935050509250929050565b5f610e90611e9f565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015610ed55750610ed3868261193c565b155b15610f195780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401610f10929190614aeb565b60405180910390fd5b610f268686868686611ea6565b505050505050565b610f36611c61565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fa4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9b9061491c565b60405180910390fd5b80600e5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610fef611c61565b5f8590505f8173ffffffffffffffffffffffffffffffffffffffff1662fdd58e30876040518363ffffffff1660e01b815260040161102e929190613fce565b602060405180830381865afa158015611049573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061106d919061494e565b9050838110156110b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a9906149c3565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663f242432a30888888886040518663ffffffff1660e01b81526004016110f3959493929190614b64565b5f604051808303815f87803b15801561110a575f80fd5b505af115801561111c573d5f803e3d5ffd5b5050505050505050505050565b611131611c61565b47811115611174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116b906149c3565b60405180910390fd5b5f8273ffffffffffffffffffffffffffffffffffffffff168260405161119990614be9565b5f6040518083038185875af1925050503d805f81146111d3576040519150601f19603f3d011682016040523d82523d5f602084013e6111d8565b606091505b505090508061121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390614c47565b60405180910390fd5b505050565b61122961140a565b611268576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125f90614caf565b60405180910390fd5b611270611f9a565b5f861415801561129357508461128585611709565b876112909190614ccd565b11155b6112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c990614d4a565b60405180910390fd5b6112e0868686868686611fe9565b6112e861218f565b505050505050565b6060815183511461133c57815183516040517f5b059991000000000000000000000000000000000000000000000000000000008152600401611333929190614d68565b60405180910390fd5b5f835167ffffffffffffffff81111561135857611357613c71565b5b6040519080825280602002602001820160405280156113865781602001602082028036833780820191505090505b5090505f5b84518110156113ec576113c26113aa828761219990919063ffffffff16565b6113bd83876121ac90919063ffffffff16565b6108d5565b8282815181106113d5576113d4614d8f565b5b60200260200101818152505080600101905061138b565b508091505092915050565b5f8061140283611801565b119050919050565b5f80600b6040518060400160405290815f82015f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020015f820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505090506114a1815f015167ffffffffffffffff16826020015167ffffffffffffffff166121bf565b91505090565b6114af611c61565b6114ba8383836121d7565b505050565b6114c7611c61565b5f8390503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16636352211e846040518263ffffffff1660e01b815260040161151b9190613b8d565b602060405180830381865afa158015611536573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061155a9190614dd0565b73ffffffffffffffffffffffffffffffffffffffff16146115b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a790614e45565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166342842e0e3085856040518463ffffffff1660e01b81526004016115ed93929190614e63565b5f604051808303815f87803b158015611604575f80fd5b505af1158015611616573d5f803e3d5ffd5b5050505050505050565b611628611c61565b6116315f612386565b565b5f600e5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f600c54905090565b5f6060805f805f6060611675612449565b61167d612484565b46305f801b5f67ffffffffffffffff81111561169c5761169b613c71565b5b6040519080825280602002602001820160405280156116ca5781602001602082028036833780820191505090505b507f0f00000000000000000000000000000000000000000000000000000000000000959493929190965096509650965096509650965090919293949596565b5f6117158260016108d5565b9050919050565b5f60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61174c611c61565b806010908161175b9190615035565b5050565b6012805461176c906148a2565b80601f0160208091040260200160405190810160405280929190818152602001828054611798906148a2565b80156117e35780601f106117ba576101008083540402835291602001916117e3565b820191905f5260205f20905b8154815290600101906020018083116117c657829003601f168201915b505050505081565b6117fd6117f6611e9f565b83836124bf565b5050565b5f60035f8381526020019081526020015f20549050919050565b611823611c61565b61182d8282612628565b5050565b611839613a76565b600b6040518060400160405290815f82015f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020015f820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681525050905090565b6060601080546118bb906148a2565b80601f01602080910402602001604051908101604052809291908181526020018280546118e7906148a2565b80156119325780601f1061190957610100808354040283529160200191611932565b820191905f5260205f20905b81548152906001019060200180831161191557829003601f168201915b5050505050905090565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b6119d2611c61565b80600c8190555050565b5f6119e5611e9f565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015611a2a5750611a28868261193c565b155b15611a6e5780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401611a65929190614aeb565b60405180910390fd5b611a7b8686868686612727565b505050505050565b611a8b611c61565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611afb575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401611af2919061467a565b60405180910390fd5b611b0481612386565b50565b5f7fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611bd157507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611be15750611be08261282d565b5b9050919050565b5f7f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611c5a5750611c5982611b07565b5b9050919050565b611c69611e9f565b73ffffffffffffffffffffffffffffffffffffffff16611c8761171c565b73ffffffffffffffffffffffffffffffffffffffff1614611ce657611caa611e9f565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611cdd919061467a565b60405180910390fd5b565b8060029081611cf79190615035565b5050565b5f611d04611e96565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115611d695781816040517f6f483d09000000000000000000000000000000000000000000000000000000008152600401611d60929190615134565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611dd9575f6040517fb6d9900a000000000000000000000000000000000000000000000000000000008152600401611dd0919061467a565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff1681525060055f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151815f0160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550905050505050565b5f612710905090565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611f16575f6040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401611f0d919061467a565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603611f86575f6040517f01a83514000000000000000000000000000000000000000000000000000000008152600401611f7d919061467a565b60405180910390fd5b611f938585858585612896565b5050505050565b6002600a5403611fdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd6906151a5565b60405180910390fd5b6002600a81905550565b82421061202b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120229061520d565b60405180910390fd5b5f86600c5461203a9190614a4d565b905080341461207e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207590615275565b60405180910390fd5b5f83836040516020016120929291906152b7565b60405160208183030381529060405280519060200120905060135f8281526020019081526020015f205f9054906101000a900460ff1615612108576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ff90615319565b60405180910390fd5b612116888888888888612942565b600160135f8381526020019081526020015f205f6101000a81548160ff02191690831515021790555061215a8660018a60405180602001604052805f815250612a80565b6001600d5f82825461216c9190614ccd565b925050819055505f8211156121855761218482612b15565b5b5050505050505050565b6001600a81905550565b5f60208202602084010151905092915050565b5f60208202602084010151905092915050565b5f4283111580156121cf57508142105b905092915050565b5f6121e0611e96565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115612247578382826040517fdfd1fc1b00000000000000000000000000000000000000000000000000000000815260040161223e93929190615337565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036122b957835f6040517f969f08520000000000000000000000000000000000000000000000000000000081526004016122b092919061536c565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff1681525060065f8681526020019081526020015f205f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151815f0160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505050505050565b5f60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160075f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b606061247f60087f5370656c6c426f78000000000000000000000000000000000000000000000008612be290919063ffffffff16565b905090565b60606124ba60097f3100000000000000000000000000000000000000000000000000000000000001612be290919063ffffffff16565b905090565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361252f575f6040517fced3e100000000000000000000000000000000000000000000000000000000008152600401612526919061467a565b60405180910390fd5b8060015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161261b9190613c40565b60405180910390a3505050565b67ffffffffffffffff8016821115801561264c575067ffffffffffffffff80168111155b801561265757508082105b612696576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161268d906153dd565b60405180910390fd5b5f60405180604001604052808467ffffffffffffffff1681526020018367ffffffffffffffff16815250905080600b5f820151815f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506020820151815f0160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612797575f6040517f57f447ce00000000000000000000000000000000000000000000000000000000815260040161278e919061467a565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603612807575f6040517f01a835140000000000000000000000000000000000000000000000000000000081526004016127fe919061467a565b60405180910390fd5b5f806128138585612c8f565b915091506128248787848487612896565b50505050505050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6128a285858585612cbf565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461293b575f6128de611e9f565b9050600184510361292a575f6128fd5f866121ac90919063ffffffff16565b90505f6129135f866121ac90919063ffffffff16565b9050612923838989858589612e5c565b5050612939565b61293881878787878761300b565b5b505b5050505050565b5f61299a7fd74ac019784698b6e7b591bf623d975d8891a4d39d9fa905dbc7560c0fc5ee068888888860405160200161297f9594939291906153fb565b604051602081830303815290604052805190602001206131ba565b9050600f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612a218285858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050506131d3565b73ffffffffffffffffffffffffffffffffffffffff1614612a77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a6e90615496565b60405180910390fd5b50505050505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612af0575f6040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612ae7919061467a565b60405180910390fd5b5f80612afc8585612c8f565b91509150612b0d5f87848487612896565b505050505050565b5f600e5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682604051612b5b90614be9565b5f6040518083038185875af1925050503d805f8114612b95576040519150601f19603f3d011682016040523d82523d5f602084013e612b9a565b606091505b5050905080612bde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd5906154fe565b60405180910390fd5b5050565b606060ff5f1b8314612bfe57612bf7836131fd565b9050612c89565b818054612c0a906148a2565b80601f0160208091040260200160405190810160405280929190818152602001828054612c36906148a2565b8015612c815780601f10612c5857610100808354040283529160200191612c81565b820191905f5260205f20905b815481529060010190602001808311612c6457829003601f168201915b505050505090505b92915050565b60608060405191506001825283602083015260408201905060018152826020820152604081016040529250929050565b612ccb8484848461326f565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612d9e575f805b8351811015612d83575f838281518110612d1e57612d1d614d8f565b5b602002602001015190508060035f878581518110612d3f57612d3e614d8f565b5b602002602001015181526020019081526020015f205f828254612d629190614ccd565b925050819055508083612d759190614ccd565b925050806001019050612d01565b508060045f828254612d959190614ccd565b92505081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612e56575f805b8351811015612e44575f838281518110612df157612df0614d8f565b5b602002602001015190508060035f878581518110612e1257612e11614d8f565b5b602002602001015181526020019081526020015f205f8282540392505081905550808301925050806001019050612dd4565b508060045f8282540392505081905550505b50505050565b5f8473ffffffffffffffffffffffffffffffffffffffff163b1115613003578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b8152600401612ebc959493929190614b64565b6020604051808303815f875af1925050508015612ef757506040513d601f19601f82011682018060405250810190612ef49190615530565b60015b612f78573d805f8114612f25576040519150601f19603f3d011682016040523d82523d5f602084013e612f2a565b606091505b505f815103612f7057846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612f67919061467a565b60405180910390fd5b805181602001fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461300157846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612ff8919061467a565b60405180910390fd5b505b505050505050565b5f8473ffffffffffffffffffffffffffffffffffffffff163b11156131b2578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161306b95949392919061555b565b6020604051808303815f875af19250505080156130a657506040513d601f19601f820116820180604052508101906130a39190615530565b60015b613127573d805f81146130d4576040519150601f19603f3d011682016040523d82523d5f602084013e6130d9565b606091505b505f81510361311f57846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401613116919061467a565b60405180910390fd5b805181602001fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146131b057846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016131a7919061467a565b60405180910390fd5b505b505050505050565b5f6131cc6131c66135ff565b836136b5565b9050919050565b5f805f806131e186866136f5565b9250925092506131f1828261374a565b82935050505092915050565b60605f613209836138ac565b90505f602067ffffffffffffffff81111561322757613226613c71565b5b6040519080825280601f01601f1916602001820160405280156132595781602001600182028036833780820191505090505b5090508181528360208201528092505050919050565b80518251146132b957815181516040517f5b0599910000000000000000000000000000000000000000000000000000000081526004016132b0929190614d68565b60405180910390fd5b5f6132c2611e9f565b90505f5b83518110156134be575f6132e382866121ac90919063ffffffff16565b90505f6132f983866121ac90919063ffffffff16565b90505f73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461341c575f805f8481526020019081526020015f205f8a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156133c857888183856040517f03dee4c50000000000000000000000000000000000000000000000000000000081526004016133bf94939291906155c1565b60405180910390fd5b8181035f808581526020019081526020015f205f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16146134b157805f808481526020019081526020015f205f8973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546134a99190614ccd565b925050819055505b50508060010190506132c6565b506001835103613579575f6134dc5f856121ac90919063ffffffff16565b90505f6134f25f856121ac90919063ffffffff16565b90508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62858560405161356a929190614d68565b60405180910390a450506135f8565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516135ef929190615604565b60405180910390a45b5050505050565b5f7f000000000000000000000000010f58b7a3f95409fe48365c75f8ba2cae4ac10473ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1614801561367a57507f000000000000000000000000000000000000000000000000000000000000a4b146145b156136a7577f5713248763dd1bdb869db39d1589fb3f5b7476e68021aded0330a82b43e5b82c90506136b2565b6136af6138fa565b90505b90565b5f6040517f190100000000000000000000000000000000000000000000000000000000000081528360028201528260228201526042812091505092915050565b5f805f6041845103613735575f805f602087015192506040870151915060608701515f1a90506137278882858561398f565b955095509550505050613743565b5f600285515f1b9250925092505b9250925092565b5f600381111561375d5761375c615639565b5b8260038111156137705761376f615639565b5b03156138a8576001600381111561378a57613789615639565b5b82600381111561379d5761379c615639565b5b036137d4576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260038111156137e8576137e7615639565b5b8260038111156137fb576137fa615639565b5b0361383f57805f1c6040517ffce698f70000000000000000000000000000000000000000000000000000000081526004016138369190613b8d565b60405180910390fd5b60038081111561385257613851615639565b5b82600381111561386557613864615639565b5b036138a757806040517fd78bce0c00000000000000000000000000000000000000000000000000000000815260040161389e9190615666565b60405180910390fd5b5b5050565b5f8060ff835f1c169050601f8111156138f1576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80915050919050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f694dd2df6f5c85efb04d70ed3c69a20c99e2489c858eb1dd713ab4357f8b3e897fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6463060405160200161397495949392919061567f565b60405160208183030381529060405280519060200120905090565b5f805f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0845f1c11156139cb575f600385925092509250613a6c565b5f6001888888886040515f81526020016040526040516139ee94939291906156eb565b6020604051602081039080840390855afa158015613a0e573d5f803e3d5ffd5b5050506020604051035190505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603613a5f575f60015f801b93509350935050613a6c565b805f805f1b935093509350505b9450945094915050565b60405180604001604052805f67ffffffffffffffff1681526020015f67ffffffffffffffff1681525090565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f613adc82613ab3565b9050919050565b613aec81613ad2565b8114613af6575f80fd5b50565b5f81359050613b0781613ae3565b92915050565b5f819050919050565b613b1f81613b0d565b8114613b29575f80fd5b50565b5f81359050613b3a81613b16565b92915050565b5f8060408385031215613b5657613b55613aab565b5b5f613b6385828601613af9565b9250506020613b7485828601613b2c565b9150509250929050565b613b8781613b0d565b82525050565b5f602082019050613ba05f830184613b7e565b92915050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613bda81613ba6565b8114613be4575f80fd5b50565b5f81359050613bf581613bd1565b92915050565b5f60208284031215613c1057613c0f613aab565b5b5f613c1d84828501613be7565b91505092915050565b5f8115159050919050565b613c3a81613c26565b82525050565b5f602082019050613c535f830184613c31565b92915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b613ca782613c61565b810181811067ffffffffffffffff82111715613cc657613cc5613c71565b5b80604052505050565b5f613cd8613aa2565b9050613ce48282613c9e565b919050565b5f67ffffffffffffffff821115613d0357613d02613c71565b5b613d0c82613c61565b9050602081019050919050565b828183375f83830152505050565b5f613d39613d3484613ce9565b613ccf565b905082815260208101848484011115613d5557613d54613c5d565b5b613d60848285613d19565b509392505050565b5f82601f830112613d7c57613d7b613c59565b5b8135613d8c848260208601613d27565b91505092915050565b5f60208284031215613daa57613da9613aab565b5b5f82013567ffffffffffffffff811115613dc757613dc6613aaf565b5b613dd384828501613d68565b91505092915050565b5f6bffffffffffffffffffffffff82169050919050565b613dfc81613ddc565b8114613e06575f80fd5b50565b5f81359050613e1781613df3565b92915050565b5f8060408385031215613e3357613e32613aab565b5b5f613e4085828601613af9565b9250506020613e5185828601613e09565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f613e8d82613e5b565b613e978185613e65565b9350613ea7818560208601613e75565b613eb081613c61565b840191505092915050565b5f6020820190508181035f830152613ed38184613e83565b905092915050565b5f60208284031215613ef057613eef613aab565b5b5f613efd84828501613b2c565b91505092915050565b5f60208284031215613f1b57613f1a613aab565b5b5f613f2884828501613af9565b91505092915050565b5f805f60608486031215613f4857613f47613aab565b5b5f613f5586828701613af9565b9350506020613f6686828701613af9565b9250506040613f7786828701613b2c565b9150509250925092565b5f8060408385031215613f9757613f96613aab565b5b5f613fa485828601613b2c565b9250506020613fb585828601613b2c565b9150509250929050565b613fc881613ad2565b82525050565b5f604082019050613fe15f830185613fbf565b613fee6020830184613b7e565b9392505050565b5f67ffffffffffffffff82111561400f5761400e613c71565b5b602082029050602081019050919050565b5f80fd5b5f61403661403184613ff5565b613ccf565b9050808382526020820190506020840283018581111561405957614058614020565b5b835b81811015614082578061406e8882613b2c565b84526020840193505060208101905061405b565b5050509392505050565b5f82601f8301126140a05761409f613c59565b5b81356140b0848260208601614024565b91505092915050565b5f67ffffffffffffffff8211156140d3576140d2613c71565b5b6140dc82613c61565b9050602081019050919050565b5f6140fb6140f6846140b9565b613ccf565b90508281526020810184848401111561411757614116613c5d565b5b614122848285613d19565b509392505050565b5f82601f83011261413e5761413d613c59565b5b813561414e8482602086016140e9565b91505092915050565b5f805f805f60a086880312156141705761416f613aab565b5b5f61417d88828901613af9565b955050602061418e88828901613af9565b945050604086013567ffffffffffffffff8111156141af576141ae613aaf565b5b6141bb8882890161408c565b935050606086013567ffffffffffffffff8111156141dc576141db613aaf565b5b6141e88882890161408c565b925050608086013567ffffffffffffffff81111561420957614208613aaf565b5b6142158882890161412a565b9150509295509295909350565b5f805f805f60a0868803121561423b5761423a613aab565b5b5f61424888828901613af9565b955050602061425988828901613af9565b945050604061426a88828901613b2c565b935050606061427b88828901613b2c565b925050608086013567ffffffffffffffff81111561429c5761429b613aaf565b5b6142a88882890161412a565b9150509295509295909350565b5f6142bf82613ab3565b9050919050565b6142cf816142b5565b81146142d9575f80fd5b50565b5f813590506142ea816142c6565b92915050565b5f806040838503121561430657614305613aab565b5b5f614313858286016142dc565b925050602061432485828601613b2c565b9150509250929050565b5f80fd5b5f8083601f84011261434757614346613c59565b5b8235905067ffffffffffffffff8111156143645761436361432e565b5b6020830191508360018202830111156143805761437f614020565b5b9250929050565b5f805f805f8060a087890312156143a1576143a0613aab565b5b5f6143ae89828a01613b2c565b96505060206143bf89828a01613b2c565b95505060406143d089828a01613af9565b94505060606143e189828a01613b2c565b935050608087013567ffffffffffffffff81111561440257614401613aaf565b5b61440e89828a01614332565b92509250509295509295509295565b5f67ffffffffffffffff82111561443757614436613c71565b5b602082029050602081019050919050565b5f61445a6144558461441d565b613ccf565b9050808382526020820190506020840283018581111561447d5761447c614020565b5b835b818110156144a657806144928882613af9565b84526020840193505060208101905061447f565b5050509392505050565b5f82601f8301126144c4576144c3613c59565b5b81356144d4848260208601614448565b91505092915050565b5f80604083850312156144f3576144f2613aab565b5b5f83013567ffffffffffffffff8111156145105761450f613aaf565b5b61451c858286016144b0565b925050602083013567ffffffffffffffff81111561453d5761453c613aaf565b5b6145498582860161408c565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61458581613b0d565b82525050565b5f614596838361457c565b60208301905092915050565b5f602082019050919050565b5f6145b882614553565b6145c2818561455d565b93506145cd8361456d565b805f5b838110156145fd5781516145e4888261458b565b97506145ef836145a2565b9250506001810190506145d0565b5085935050505092915050565b5f6020820190508181035f83015261462281846145ae565b905092915050565b5f805f6060848603121561464157614640613aab565b5b5f61464e86828701613b2c565b935050602061465f86828701613af9565b925050604061467086828701613e09565b9150509250925092565b5f60208201905061468d5f830184613fbf565b92915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6146c781614693565b82525050565b5f819050919050565b6146df816146cd565b82525050565b5f60e0820190506146f85f83018a6146be565b818103602083015261470a8189613e83565b9050818103604083015261471e8188613e83565b905061472d6060830187613b7e565b61473a6080830186613fbf565b61474760a08301856146d6565b81810360c083015261475981846145ae565b905098975050505050505050565b61477081613c26565b811461477a575f80fd5b50565b5f8135905061478b81614767565b92915050565b5f80604083850312156147a7576147a6613aab565b5b5f6147b485828601613af9565b92505060206147c58582860161477d565b9150509250929050565b5f67ffffffffffffffff82169050919050565b6147eb816147cf565b82525050565b604082015f8201516148055f8501826147e2565b50602082015161481860208501826147e2565b50505050565b5f6040820190506148315f8301846147f1565b92915050565b5f806040838503121561484d5761484c613aab565b5b5f61485a85828601613af9565b925050602061486b85828601613af9565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806148b957607f821691505b6020821081036148cc576148cb614875565b5b50919050565b7f43616e6e6f742073657420746f203020616464726573730000000000000000005f82015250565b5f614906601783613e65565b9150614911826148d2565b602082019050919050565b5f6020820190508181035f830152614933816148fa565b9050919050565b5f8151905061494881613b16565b92915050565b5f6020828403121561496357614962613aab565b5b5f6149708482850161493a565b91505092915050565b7f496e73756666696369656e742062616c616e63650000000000000000000000005f82015250565b5f6149ad601483613e65565b91506149b882614979565b602082019050919050565b5f6020820190508181035f8301526149da816149a1565b9050919050565b5f815190506149ef81614767565b92915050565b5f60208284031215614a0a57614a09613aab565b5b5f614a17848285016149e1565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f614a5782613b0d565b9150614a6283613b0d565b9250828202614a7081613b0d565b91508282048414831517614a8757614a86614a20565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f614ac582613b0d565b9150614ad083613b0d565b925082614ae057614adf614a8e565b5b828204905092915050565b5f604082019050614afe5f830185613fbf565b614b0b6020830184613fbf565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b5f614b3682614b12565b614b408185614b1c565b9350614b50818560208601613e75565b614b5981613c61565b840191505092915050565b5f60a082019050614b775f830188613fbf565b614b846020830187613fbf565b614b916040830186613b7e565b614b9e6060830185613b7e565b8181036080830152614bb08184614b2c565b90509695505050505050565b5f81905092915050565b50565b5f614bd45f83614bbc565b9150614bdf82614bc6565b5f82019050919050565b5f614bf382614bc9565b9150819050919050565b7f5472616e73666572206661696c656400000000000000000000000000000000005f82015250565b5f614c31600f83613e65565b9150614c3c82614bfd565b602082019050919050565b5f6020820190508181035f830152614c5e81614c25565b9050919050565b7f53616c6520696e616374697665000000000000000000000000000000000000005f82015250565b5f614c99600d83613e65565b9150614ca482614c65565b602082019050919050565b5f6020820190508181035f830152614cc681614c8d565b9050919050565b5f614cd782613b0d565b9150614ce283613b0d565b9250828201905080821115614cfa57614cf9614a20565b5b92915050565b7f496e76616c6964207175616e74697479000000000000000000000000000000005f82015250565b5f614d34601083613e65565b9150614d3f82614d00565b602082019050919050565b5f6020820190508181035f830152614d6181614d28565b9050919050565b5f604082019050614d7b5f830185613b7e565b614d886020830184613b7e565b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050614dca81613ae3565b92915050565b5f60208284031215614de557614de4613aab565b5b5f614df284828501614dbc565b91505092915050565b7f546f6b656e206973206e6f74206f776e656420627920636f6e747261637400005f82015250565b5f614e2f601e83613e65565b9150614e3a82614dfb565b602082019050919050565b5f6020820190508181035f830152614e5c81614e23565b9050919050565b5f606082019050614e765f830186613fbf565b614e836020830185613fbf565b614e906040830184613b7e565b949350505050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302614ef47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614eb9565b614efe8683614eb9565b95508019841693508086168417925050509392505050565b5f819050919050565b5f614f39614f34614f2f84613b0d565b614f16565b613b0d565b9050919050565b5f819050919050565b614f5283614f1f565b614f66614f5e82614f40565b848454614ec5565b825550505050565b5f90565b614f7a614f6e565b614f85818484614f49565b505050565b5b81811015614fa857614f9d5f82614f72565b600181019050614f8b565b5050565b601f821115614fed57614fbe81614e98565b614fc784614eaa565b81016020851015614fd6578190505b614fea614fe285614eaa565b830182614f8a565b50505b505050565b5f82821c905092915050565b5f61500d5f1984600802614ff2565b1980831691505092915050565b5f6150258383614ffe565b9150826002028217905092915050565b61503e82613e5b565b67ffffffffffffffff81111561505757615056613c71565b5b61506182546148a2565b61506c828285614fac565b5f60209050601f83116001811461509d575f841561508b578287015190505b615095858261501a565b8655506150fc565b601f1984166150ab86614e98565b5f5b828110156150d2578489015182556001820191506020850194506020810190506150ad565b868310156150ef57848901516150eb601f891682614ffe565b8355505b6001600288020188555050505b505050505050565b5f61511e61511961511484613ddc565b614f16565b613b0d565b9050919050565b61512e81615104565b82525050565b5f6040820190506151475f830185615125565b6151546020830184613b7e565b9392505050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c005f82015250565b5f61518f601f83613e65565b915061519a8261515b565b602082019050919050565b5f6020820190508181035f8301526151bc81615183565b9050919050565b7f50757263686173652065787069726564210000000000000000000000000000005f82015250565b5f6151f7601183613e65565b9150615202826151c3565b602082019050919050565b5f6020820190508181035f830152615224816151eb565b9050919050565b7f496e76616c696420616d6f756e742100000000000000000000000000000000005f82015250565b5f61525f600f83613e65565b915061526a8261522b565b602082019050919050565b5f6020820190508181035f83015261528c81615253565b9050919050565b5f61529e8385614bbc565b93506152ab838584613d19565b82840190509392505050565b5f6152c3828486615293565b91508190509392505050565b7f5369676e617475726520757365642100000000000000000000000000000000005f82015250565b5f615303600f83613e65565b915061530e826152cf565b602082019050919050565b5f6020820190508181035f830152615330816152f7565b9050919050565b5f60608201905061534a5f830186613b7e565b6153576020830185615125565b6153646040830184613b7e565b949350505050565b5f60408201905061537f5f830185613b7e565b61538c6020830184613fbf565b9392505050565b7f496e76616c69642074696d6500000000000000000000000000000000000000005f82015250565b5f6153c7600c83613e65565b91506153d282615393565b602082019050919050565b5f6020820190508181035f8301526153f4816153bb565b9050919050565b5f60a08201905061540e5f8301886146d6565b61541b6020830187613b7e565b6154286040830186613b7e565b6154356060830185613fbf565b6154426080830184613b7e565b9695505050505050565b7f496e76616c6964207369676e61747572650000000000000000000000000000005f82015250565b5f615480601183613e65565b915061548b8261544c565b602082019050919050565b5f6020820190508181035f8301526154ad81615474565b9050919050565b7f4661696c656420746f2073656e64206d696e74206665650000000000000000005f82015250565b5f6154e8601783613e65565b91506154f3826154b4565b602082019050919050565b5f6020820190508181035f830152615515816154dc565b9050919050565b5f8151905061552a81613bd1565b92915050565b5f6020828403121561554557615544613aab565b5b5f6155528482850161551c565b91505092915050565b5f60a08201905061556e5f830188613fbf565b61557b6020830187613fbf565b818103604083015261558d81866145ae565b905081810360608301526155a181856145ae565b905081810360808301526155b58184614b2c565b90509695505050505050565b5f6080820190506155d45f830187613fbf565b6155e16020830186613b7e565b6155ee6040830185613b7e565b6155fb6060830184613b7e565b95945050505050565b5f6040820190508181035f83015261561c81856145ae565b9050818103602083015261563081846145ae565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f6020820190506156795f8301846146d6565b92915050565b5f60a0820190506156925f8301886146d6565b61569f60208301876146d6565b6156ac60408301866146d6565b6156b96060830185613b7e565b6156c66080830184613fbf565b9695505050505050565b5f60ff82169050919050565b6156e5816156d0565b82525050565b5f6080820190506156fe5f8301876146d6565b61570b60208301866156dc565b61571860408301856146d6565b61572560608301846146d6565b9594505050505056fea2646970667358221220753d4247b8913256ee29c128a0485b84a7cc054d50ac9856665fe2c4781b0efb64736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000016a20c0f77bf710f154737006417b6f34e63f98100000000000000000000000000000000000000000000000000000000664c002000000000000000000000000000000000000000000000000000000000669c6ba0000000000000000000000000565dbd5c10e80bc116cc2548ccdcb1ae298f38f600000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000005af3107a4000000000000000000000000000565dbd5c10e80bc116cc2548ccdcb1ae298f38f600000000000000000000000000000000000000000000000000000000000000085370656c6c426f78000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d68747470733a2f2f6170692e7370656c6c677572752e61692f6170692f5370656c6c426f783f69643d7b69647d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d68747470733a2f2f6170692e7370656c6c677572752e61692f6170692f5370656c6c426f78436f6e747261637400000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): SpellBox
Arg [1] : uri (string): https://api.spellguru.ai/api/SpellBox?id={id}
Arg [2] : contractUri (string): https://api.spellguru.ai/api/SpellBoxContract
Arg [3] : validator (address): 0x16a20c0f77Bf710f154737006417B6f34e63F981
Arg [4] : saleStartTime (uint256): 1716256800
Arg [5] : saleEndTime (uint256): 1721527200
Arg [6] : loyaltyRecipient (address): 0x565DBD5C10e80bC116cc2548CCdCB1ae298F38f6
Arg [7] : loyaltyFeeNumerator (uint96): 250
Arg [8] : mintFee (uint256): 100000000000000
Arg [9] : mintFeeRecipient (address): 0x565DBD5C10e80bC116cc2548CCdCB1ae298F38f6
-----Encoded View---------------
18 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [3] : 00000000000000000000000016a20c0f77bf710f154737006417b6f34e63f981
Arg [4] : 00000000000000000000000000000000000000000000000000000000664c0020
Arg [5] : 00000000000000000000000000000000000000000000000000000000669c6ba0
Arg [6] : 000000000000000000000000565dbd5c10e80bc116cc2548ccdcb1ae298f38f6
Arg [7] : 00000000000000000000000000000000000000000000000000000000000000fa
Arg [8] : 00000000000000000000000000000000000000000000000000005af3107a4000
Arg [9] : 000000000000000000000000565dbd5c10e80bc116cc2548ccdcb1ae298f38f6
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [11] : 5370656c6c426f78000000000000000000000000000000000000000000000000
Arg [12] : 000000000000000000000000000000000000000000000000000000000000002d
Arg [13] : 68747470733a2f2f6170692e7370656c6c677572752e61692f6170692f537065
Arg [14] : 6c6c426f783f69643d7b69647d00000000000000000000000000000000000000
Arg [15] : 000000000000000000000000000000000000000000000000000000000000002d
Arg [16] : 68747470733a2f2f6170692e7370656c6c677572752e61692f6170692f537065
Arg [17] : 6c6c426f78436f6e747261637400000000000000000000000000000000000000
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.