Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 111 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set Approval For... | 22020114 | 360 days ago | IN | 0 ETH | 0.00041551 | ||||
| Safe Transfer Fr... | 20708982 | 544 days ago | IN | 0 ETH | 0.00007547 | ||||
| Safe Transfer Fr... | 19682077 | 687 days ago | IN | 0 ETH | 0.00079581 | ||||
| Safe Transfer Fr... | 19682074 | 687 days ago | IN | 0 ETH | 0.00112805 | ||||
| Safe Transfer Fr... | 19682072 | 687 days ago | IN | 0 ETH | 0.00084529 | ||||
| Safe Transfer Fr... | 19682069 | 687 days ago | IN | 0 ETH | 0.00118447 | ||||
| Safe Transfer Fr... | 19682066 | 687 days ago | IN | 0 ETH | 0.00182041 | ||||
| Set Approval For... | 19033626 | 778 days ago | IN | 0 ETH | 0.00197958 | ||||
| Safe Transfer Fr... | 18905981 | 796 days ago | IN | 0 ETH | 0.00131684 | ||||
| Set Approval For... | 18890401 | 798 days ago | IN | 0 ETH | 0.00103354 | ||||
| Withdraw | 18888216 | 798 days ago | IN | 0 ETH | 0.00053454 | ||||
| Reveal | 18886047 | 799 days ago | IN | 0 ETH | 0.00110297 | ||||
| Mint Public | 18885767 | 799 days ago | IN | 0.005 ETH | 0.00236393 | ||||
| Transfer From | 18885549 | 799 days ago | IN | 0 ETH | 0.00263509 | ||||
| Transfer From | 18885539 | 799 days ago | IN | 0 ETH | 0.00293804 | ||||
| Mint Allow List | 18882922 | 799 days ago | IN | 0 ETH | 0.00400865 | ||||
| Mint Public | 18882278 | 799 days ago | IN | 0.025 ETH | 0.0018217 | ||||
| Mint Public | 18882092 | 799 days ago | IN | 0.005 ETH | 0.00204437 | ||||
| Safe Transfer Fr... | 18882082 | 799 days ago | IN | 0 ETH | 0.00227576 | ||||
| Mint Public | 18882079 | 799 days ago | IN | 0.015 ETH | 0.0016949 | ||||
| Safe Transfer Fr... | 18882077 | 799 days ago | IN | 0 ETH | 0.00123737 | ||||
| Safe Transfer Fr... | 18882075 | 799 days ago | IN | 0 ETH | 0.00231589 | ||||
| Safe Transfer Fr... | 18882073 | 799 days ago | IN | 0 ETH | 0.00178994 | ||||
| Safe Transfer Fr... | 18882071 | 799 days ago | IN | 0 ETH | 0.00219432 | ||||
| Safe Transfer Fr... | 18882069 | 799 days ago | IN | 0 ETH | 0.00277797 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 18888216 | 798 days ago | 0.53 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
OnchainGifts
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 20 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17 .0;
import { ERC721A } from "@erc721a/ERC721A.sol";
import { NFTEventsAndErrors } from "./NFTEventsAndErrors.sol";
import { Utils } from "./utils/Utils.sol";
import { Constants } from "./utils/Constants.sol";
import { LibString } from "./utils/LibString.sol";
import { LibPRNG } from "./LibPRNG.sol";
import { SVG } from "./utils/SVG.sol";
import { AllowList } from "./utils/AllowList.sol";
/// @title onchain gifts
/// @notice generative onchain gifts to celebrate the holiday season.
contract OnchainGifts is ERC721A, NFTEventsAndErrors, Constants, AllowList {
using LibString for uint16;
using LibPRNG for LibPRNG.PRNG;
bool public publicMintEnabled;
uint16 internal immutable _allowListMintMaxTotal;
uint8 internal immutable _allowListMintMaxPerWallet;
mapping(address user => uint8 minted) internal _allowListMinted;
bytes32 internal _revealedSeed;
string[] internal _GIFTS = [
"1f388",
"1f366",
"1f32e",
"1f95e",
"1f3ae",
"1f3b3",
"1f3c2",
"1f6f9",
"1f3a3",
"1f3be",
"1f3c8",
"1f996",
"1f995",
"1f314",
"1f680",
"1f319",
"26fa",
"1f419",
"1f988",
"1f422",
"1f407",
"1f98d",
"1f40e",
"1f408",
"1f415",
"1f308",
"1f302",
"1f6f7",
"1f30b",
"1f420",
"1f6a2",
"1f3c4",
"1f3d6",
"26f5",
"1f697",
"1f483",
"1f47e",
"1f0cf",
"1f3af",
"1f34d",
"1f3a1",
"1f349",
"1f353",
"1f384",
"1f344",
"1f33b",
"1f41b",
"1f3b8",
"1f3b7",
"1f681"
];
string[] internal _GIFT_TRAITS = [
unicode"🎈",
unicode"🍦",
unicode"🌮",
unicode"🥞",
unicode"🎮",
unicode"🎳",
unicode"🏂",
unicode"🛹",
unicode"🎣",
unicode"🎾",
unicode"🏈",
unicode"🦖",
unicode"🦕",
unicode"🌔",
unicode"🚀",
unicode"🌙",
unicode"⛺",
unicode"🐙",
unicode"🦈",
unicode"🐢",
unicode"🐇",
unicode"🦍",
unicode"🐎",
unicode"🐈",
unicode"🐕",
unicode"🌈",
unicode"🌂",
unicode"🛷",
unicode"🌋",
unicode"🐠",
unicode"🚢",
unicode"🏄",
unicode"🏖️",
unicode"⛵️",
unicode"🚗",
unicode"💃",
unicode"👾",
unicode"🃏",
unicode"🎯",
unicode"🍍",
unicode"🎡",
unicode"🍉",
unicode"🍓",
unicode"🎄",
unicode"🍄",
unicode"🌻",
unicode"🐛",
unicode"🎸",
unicode"🎷",
unicode"🚁"
];
constructor(
bytes32 allowListMerkleRoot,
uint16 allowListMintMaxTotalVal,
uint8 allowListMintMaxPerWalletVal
)
AllowList(allowListMerkleRoot)
ERC721A("onchain gifts", "GIFT")
{
_allowListMintMaxTotal = allowListMintMaxTotalVal;
_allowListMintMaxPerWallet = allowListMintMaxPerWalletVal;
}
/// @notice Update public mint enabled.
/// @param enabled public mint enabled.
function updatePublicMintEnabled(bool enabled) external onlyOwner {
publicMintEnabled = enabled;
}
/// @notice Mint tokens for allowlist minters.
/// @param proof proof
/// @param amount amount of tokens to mint
function mintAllowList(bytes32[] calldata proof, uint8 amount) external onlyAllowListed(proof) {
// Checks
unchecked {
if (_totalMinted() + amount > _allowListMintMaxTotal) {
// Check allowlist mint total is not exceeding max allowed to be minted during allowlist phase
revert AllowListMintCapExceeded();
}
if (_allowListMinted[msg.sender] + amount > _allowListMintMaxPerWallet) {
// Check wallet is not exceeding max allowed during allowlist phase
revert AllowListMintCapPerWalletExceeded();
}
}
// Effects
// Increase allowlist minted by amount
unchecked {
_allowListMinted[msg.sender] += amount;
}
// Perform mint
_coreMint(msg.sender, amount);
}
/// @notice Mint tokens.
/// @param amount amount of tokens to mint
function mintPublic(uint8 amount) external payable {
// Checks
if (!publicMintEnabled) {
// Check public mint enabled
revert PublicMintNotEnabled();
}
unchecked {
if (amount * PRICE != msg.value) {
// Check payment by sender is correct
revert IncorrectPayment();
}
}
_coreMint(msg.sender, amount);
}
function _coreMint(address to, uint8 amount) internal {
// Checks
uint256 nextTokenIdToBeMinted = _nextTokenId();
unchecked {
if (MAX_SUPPLY + 1 < nextTokenIdToBeMinted + amount) {
// Check max supply not exceeded
revert MaxSupplyReached();
}
if (_revealedSeed != bytes32(0)) {
// Check not already revealed
revert AlreadyRevealed();
}
}
// Perform mint
_mint(to, amount);
}
function reveal() external onlyOwner {
if (_revealedSeed != bytes32(0)) {
revert AlreadyRevealed();
}
_revealedSeed = keccak256(abi.encodePacked(block.prevrandao));
}
function _startTokenId() internal pure override returns (uint256) {
return 1;
}
/// @notice Withdraw all ETH from the contract.
function withdraw() external {
(bool success,) = _VAULT_ADDRESS.call{ value: address(this).balance }("");
require(success);
}
/// @notice Get art inner color hue.
/// @param tokenId token id
/// @return hue
function getInnerColorHue(uint256 tokenId) public view returns (uint16 hue) {
LibPRNG.PRNG memory prng;
prng.seed(keccak256(abi.encodePacked(_revealedSeed, tokenId, uint256(1001))));
return uint16(prng.uniform(360));
}
/// @notice Get art text.
/// @param tokenId token id
/// @return art text encoded, art text emoji
function artText(uint256 tokenId) public view returns (string memory, string memory) {
if (_revealedSeed == bytes32(0)) {
return ("🎁", unicode"🎁");
}
LibPRNG.PRNG memory prng;
prng.seed(keccak256(abi.encodePacked(_revealedSeed, tokenId)));
uint256 giftIndex = prng.uniform(_GIFTS.length);
return (string.concat("&#x", _GIFTS[giftIndex], ";"), _GIFT_TRAITS[giftIndex]);
}
/// @notice Get animation script.
/// @return animation script
function animationScript() public view returns (string memory) {
string memory script = "<script>let g=[";
unchecked {
for (uint256 i; i < _GIFTS.length;) {
script = string.concat(script, '"&#x', _GIFTS[i], ';"', i + 1 < _GIFTS.length ? "," : "");
++i;
}
script = string.concat(
script,
'],r=!1,s=t=>new Promise((e=>setTimeout(e,t)));let z=document.getElementById("gift");let og=z.innerHTML;document.addEventListener("click",(async()=>{if(r)return;let t=!0;for(let t=0;t<g.length;t++)z.innerHTML=g[t],await s(100);z.innerHTML=og,t=!1}));</script>'
);
}
return script;
}
/// @notice Get art svg for token.
/// @param tokenId token id
/// @return art
function art(uint256 tokenId) public view returns (string memory) {
(string memory artTextEncoded,) = artText(tokenId);
return string.concat(
'<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 400 400" fill="none"><rect width="400" height="400" fill="#ea4630" rx="5%" /><rect x="40" y="40" width="320" height="320" fill="green" rx="5%" /><rect x="80" y="80" width="240" height="240" fill="hsla(',
getInnerColorHue(tokenId).toString(),
',50%,86%,100%)" rx="2.5%" /><text id="gift" x="200" y="210" text-anchor="middle" font-size="82" alignment-baseline="middle" stroke-width="2" stroke="#000" style="user-select: none">',
artTextEncoded,
"</text></svg>"
);
}
/// @notice Get token uri for token.
/// @param tokenId token id
/// @return tokenURI
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) {
revert URIQueryForNonexistentToken();
}
string memory artSvg = art(tokenId);
(, string memory artTextTrait) = artText(tokenId);
return Utils.formatTokenURI(
tokenId,
string.concat("data:image/svg+xml;base64,", Utils.encodeBase64(bytes(artSvg))),
string.concat(
"data:text/html;base64,",
Utils.encodeBase64(
bytes(
string.concat(
'<html style="overflow:hidden"><body style="margin:0">',
artSvg,
animationScript(),
"</body></html>"
)
)
)
),
string.concat(
"[",
Utils.getTrait("Gift", artTextTrait, false, true),
Utils.getTrait("Inner hue", getInnerColorHue(tokenId).toString(), true, false),
"]"
)
);
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import "./IERC721A.sol";
/**
* @dev Interface of ERC721 token receiver.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
)
external
returns (bytes4);
}
/**
* @title ERC721A
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
* starting from `_startTokenId()`.
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned.
// See {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 1;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() public view virtual override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
}
/**
* Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal virtual {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
_packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes
// of the XOR of all function selectors in the interface.
// See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
// (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
return interfaceId == 0x01ffc9a7 // ERC165 interface ID for ERC165.
|| interfaceId == 0x80ac58cd // ERC165 interface ID for ERC721.
|| interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256) public view virtual override returns (string memory) {
return "";
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr) {
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
// Invariant:
// There will always be an initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `curr` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @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) public payable virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner) {
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId].value;
}
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex // If within bounds,
&& _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
)
private
pure
returns (bool result)
{
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) {
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
}
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] =
_packOwnershipData(to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked));
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public payable virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @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 memory _data
)
public
payable
virtual
override
{
transferFrom(from, to, tokenId);
if (to.code.length != 0) {
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token IDs
* are about to be transferred. This includes minting.
* And also called before burning one token.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual { }
/**
* @dev Hook that is called after a set of serially-ordered token IDs
* have been transferred. This includes minting.
* And also called after one token has been burned.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual { }
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns whether the call correctly returned the expected magic value.
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
)
private
returns (bool)
{
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] =
_packOwnershipData(to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0));
uint256 toMasked;
uint256 end = startTokenId + quantity;
// Use assembly to loop and emit the `Transfer` event for gas savings.
// The duplicated `log4` removes an extra check and reduces stack juggling.
// The assembly, OnchainDinos with the surrounding Solidity code, have been
// delicately arranged to nudge the compiler into producing optimized opcodes.
assembly {
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
toMasked := and(to, _BITMASK_ADDRESS)
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
startTokenId // `tokenId`.
)
// The `iszero(eq(,))` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
// The compiler will optimize the `iszero` away for performance.
for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } {
// Emit the `Transfer` event. Similar to above.
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
}
}
if (toMasked == 0) revert MintToZeroAddress();
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] =
_packOwnershipData(to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0));
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(address to, uint256 quantity, bytes memory _data) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, "");
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) {
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
}
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) revert OwnershipNotInitializedForExtraData();
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _extraData(address from, address to, uint24 previousExtraData) internal view virtual returns (uint24) { }
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(address from, address to, uint256 prevOwnershipPacked) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
}
// =============================================================
// OTHER OPERATIONS
// =============================================================
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a uint256 to its ASCII string decimal representation.
*/
function _toString(uint256 value) internal pure virtual returns (string memory str) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
// Update the free memory pointer to allocate.
mstore(0x40, m)
// Assign the `str` to the end.
str := sub(m, 0x20)
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 { } {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17 .0;
interface NFTEventsAndErrors {
error MaxSupplyReached();
error IncorrectPayment();
error AlreadyRevealed();
error AllowListMintCapPerWalletExceeded();
error AllowListMintCapExceeded();
error PublicMintNotEnabled();
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17 .0;
import { LibPRNG } from "./LibPRNG.sol";
import { LibString } from "./LibString.sol";
library Utils {
using LibPRNG for LibPRNG.PRNG;
using LibString for uint256;
string internal constant _BASE64_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function formatTokenURI(
uint256 _tokenId,
string memory _imageURI,
string memory _animationURI,
string memory _properties
)
internal
pure
returns (string memory)
{
return string.concat(
"data:application/json;base64,",
encodeBase64(
bytes(
string.concat(
'{"name":"onchain gift #',
_tokenId.toString(),
'","description":"onchain gifts are generative onchain presents to celebrate the holiday season","attributes":',
_properties,
',"image":"',
_imageURI,
'","animation_url":"',
_animationURI,
'"}'
)
)
)
);
}
function getTrait(
string memory traitType,
string memory value,
bool isNumberValue,
bool includeTrailingComma
)
internal
pure
returns (string memory)
{
return string.concat(
'{"trait_type":"',
traitType,
'","value":',
isNumberValue ? value : string.concat('"', value, '"'),
"}",
includeTrailingComma ? "," : ""
);
}
// Encode some bytes in base64
// https://gist.github.com/mbvissers/8ba9ac1eca9ed0ef6973bd49b3c999ba
function encodeBase64(bytes memory data) internal pure returns (string memory) {
if (data.length == 0) return "";
// load the table into memory
string memory table = _BASE64_TABLE;
unchecked {
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((data.length + 2) / 3);
// add some extra buffer at the end required for the writing
string memory result = new string(encodedLen + 32);
assembly {
// set the actual output length
mstore(result, encodedLen)
// prepare the lookup table
let tablePtr := add(table, 1)
// input ptr
let dataPtr := data
let endPtr := add(dataPtr, mload(data))
// result ptr, jump over length
let resultPtr := add(result, 32)
// run over the input, 3 bytes at a time
for { } lt(dataPtr, endPtr) { } {
dataPtr := add(dataPtr, 3)
// read 3 bytes
let input := mload(dataPtr)
// write 4 characters
mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F)))))
resultPtr := add(resultPtr, 1)
mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F)))))
resultPtr := add(resultPtr, 1)
mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(6, input), 0x3F)))))
resultPtr := add(resultPtr, 1)
mstore(resultPtr, shl(248, mload(add(tablePtr, and(input, 0x3F)))))
resultPtr := add(resultPtr, 1)
}
// padding with '='
switch mod(mload(data), 3)
case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
}
return result;
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17 .0;
contract Constants {
uint256 public constant PRICE = 0.005 ether;
uint256 internal constant MAX_SUPPLY = 1111;
address payable internal constant _VAULT_ADDRESS = payable(address(0x39Ab90066cec746A032D67e4fe3378f16294CF6b));
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Library for converting numbers into strings and other string operations.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol)
library LibString {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The `length` of the output is too small to contain all the hex digits.
error HexLengthInsufficient();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The constant returned when the `search` is not found in the string.
uint256 internal constant NOT_FOUND = type(uint256).max;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* DECIMAL OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the base 10 decimal representation of `value`.
function toString(uint256 value) internal pure returns (string memory str) {
/// @solidity memory-safe-assembly
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits.
str := add(mload(0x40), 0x80)
// Update the free memory pointer to allocate.
mstore(0x40, add(str, 0x20))
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
let w := not(0) // Tsk.
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
for {
let temp := value
} 1 {
} {
str := add(str, w) // `sub(str, 1)`.
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
if iszero(temp) {
break
}
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
/// @dev Returns the base 10 decimal representation of `value`.
function toString(int256 value) internal pure returns (string memory str) {
if (value >= 0) {
return toString(uint256(value));
}
unchecked {
str = toString(uint256(-value));
}
/// @solidity memory-safe-assembly
assembly {
// We still have some spare memory space on the left,
// as we have allocated 3 words (96 bytes) for up to 78 digits.
let length := mload(str) // Load the string length.
mstore(str, 0x2d) // Store the '-' character.
str := sub(str, 1) // Move back the string pointer by a byte.
mstore(str, add(length, 1)) // Update the string length.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* HEXADECIMAL OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the hexadecimal representation of `value`,
/// left-padded to an input length of `length` bytes.
/// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte,
/// giving a total length of `length * 2 + 2` bytes.
/// Reverts if `length` is too small for the output to contain all the digits.
function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) {
str = toHexStringNoPrefix(value, length);
/// @solidity memory-safe-assembly
assembly {
let strLength := add(mload(str), 2) // Compute the length.
mstore(str, 0x3078) // Write the "0x" prefix.
str := sub(str, 2) // Move the pointer.
mstore(str, strLength) // Write the length.
}
}
/// @dev Returns the hexadecimal representation of `value`,
/// left-padded to an input length of `length` bytes.
/// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte,
/// giving a total length of `length * 2` bytes.
/// Reverts if `length` is too small for the output to contain all the digits.
function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory str) {
/// @solidity memory-safe-assembly
assembly {
// We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes
// for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length.
// We add 0x20 to the total and round down to a multiple of 0x20.
// (0x20 + 0x20 + 0x02 + 0x20) = 0x62.
str := add(mload(0x40), and(add(shl(1, length), 0x42), not(0x1f)))
// Allocate the memory.
mstore(0x40, add(str, 0x20))
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end to calculate the length later.
let end := str
// Store "0123456789abcdef" in scratch space.
mstore(0x0f, 0x30313233343536373839616263646566)
let start := sub(str, add(length, length))
let w := not(1) // Tsk.
let temp := value
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
for {
} 1 {
} {
str := add(str, w) // `sub(str, 2)`.
mstore8(add(str, 1), mload(and(temp, 15)))
mstore8(str, mload(and(shr(4, temp), 15)))
temp := shr(8, temp)
if iszero(xor(str, start)) {
break
}
}
if temp {
// Store the function selector of `HexLengthInsufficient()`.
mstore(0x00, 0x2194895a)
// Revert with (offset, size).
revert(0x1c, 0x04)
}
// Compute the string's length.
let strLength := sub(end, str)
// Move the pointer and write the length.
str := sub(str, 0x20)
mstore(str, strLength)
}
}
/// @dev Returns the hexadecimal representation of `value`.
/// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
/// As address are 20 bytes long, the output will left-padded to have
/// a length of `20 * 2 + 2` bytes.
function toHexString(uint256 value) internal pure returns (string memory str) {
str = toHexStringNoPrefix(value);
/// @solidity memory-safe-assembly
assembly {
let strLength := add(mload(str), 2) // Compute the length.
mstore(str, 0x3078) // Write the "0x" prefix.
str := sub(str, 2) // Move the pointer.
mstore(str, strLength) // Write the length.
}
}
/// @dev Returns the hexadecimal representation of `value`.
/// The output is encoded using 2 hexadecimal digits per byte.
/// As address are 20 bytes long, the output will left-padded to have
/// a length of `20 * 2` bytes.
function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {
/// @solidity memory-safe-assembly
assembly {
// We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
// 0x02 bytes for the prefix, and 0x40 bytes for the digits.
// The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0.
str := add(mload(0x40), 0x80)
// Allocate the memory.
mstore(0x40, add(str, 0x20))
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end to calculate the length later.
let end := str
// Store "0123456789abcdef" in scratch space.
mstore(0x0f, 0x30313233343536373839616263646566)
let w := not(1) // Tsk.
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
for {
let temp := value
} 1 {
} {
str := add(str, w) // `sub(str, 2)`.
mstore8(add(str, 1), mload(and(temp, 15)))
mstore8(str, mload(and(shr(4, temp), 15)))
temp := shr(8, temp)
if iszero(temp) {
break
}
}
// Compute the string's length.
let strLength := sub(end, str)
// Move the pointer and write the length.
str := sub(str, 0x20)
mstore(str, strLength)
}
}
/// @dev Returns the hexadecimal representation of `value`.
/// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte,
/// and the alphabets are capitalized conditionally according to
/// https://eips.ethereum.org/EIPS/eip-55
function toHexStringChecksumed(address value) internal pure returns (string memory str) {
str = toHexString(value);
/// @solidity memory-safe-assembly
assembly {
let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...`
let o := add(str, 0x22)
let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `
let t := shl(240, 136) // `0b10001000 << 240`
for {
let i := 0
} 1 {
} {
mstore(add(i, i), mul(t, byte(i, hashed)))
i := add(i, 1)
if eq(i, 20) {
break
}
}
mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask)))))
o := add(o, 0x20)
mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask)))))
}
}
/// @dev Returns the hexadecimal representation of `value`.
/// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
function toHexString(address value) internal pure returns (string memory str) {
str = toHexStringNoPrefix(value);
/// @solidity memory-safe-assembly
assembly {
let strLength := add(mload(str), 2) // Compute the length.
mstore(str, 0x3078) // Write the "0x" prefix.
str := sub(str, 2) // Move the pointer.
mstore(str, strLength) // Write the length.
}
}
/// @dev Returns the hexadecimal representation of `value`.
/// The output is encoded using 2 hexadecimal digits per byte.
function toHexStringNoPrefix(address value) internal pure returns (string memory str) {
/// @solidity memory-safe-assembly
assembly {
str := mload(0x40)
// Allocate the memory.
// We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
// 0x02 bytes for the prefix, and 0x28 bytes for the digits.
// The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80.
mstore(0x40, add(str, 0x80))
// Store "0123456789abcdef" in scratch space.
mstore(0x0f, 0x30313233343536373839616263646566)
str := add(str, 2)
mstore(str, 40)
let o := add(str, 0x20)
mstore(add(o, 40), 0)
value := shl(96, value)
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
for {
let i := 0
} 1 {
} {
let p := add(o, add(i, i))
let temp := byte(i, value)
mstore8(add(p, 1), mload(and(temp, 15)))
mstore8(p, mload(shr(4, temp)))
i := add(i, 1)
if eq(i, 20) {
break
}
}
}
}
/// @dev Returns the hex encoded string from the raw bytes.
/// The output is encoded using 2 hexadecimal digits per byte.
function toHexString(bytes memory raw) internal pure returns (string memory str) {
str = toHexStringNoPrefix(raw);
/// @solidity memory-safe-assembly
assembly {
let strLength := add(mload(str), 2) // Compute the length.
mstore(str, 0x3078) // Write the "0x" prefix.
str := sub(str, 2) // Move the pointer.
mstore(str, strLength) // Write the length.
}
}
/// @dev Returns the hex encoded string from the raw bytes.
/// The output is encoded using 2 hexadecimal digits per byte.
function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) {
/// @solidity memory-safe-assembly
assembly {
let length := mload(raw)
str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix.
mstore(str, add(length, length)) // Store the length of the output.
// Store "0123456789abcdef" in scratch space.
mstore(0x0f, 0x30313233343536373839616263646566)
let o := add(str, 0x20)
let end := add(raw, length)
for {
} iszero(eq(raw, end)) {
} {
raw := add(raw, 1)
mstore8(add(o, 1), mload(and(mload(raw), 15)))
mstore8(o, mload(and(shr(4, mload(raw)), 15)))
o := add(o, 2)
}
mstore(o, 0) // Zeroize the slot after the string.
mstore(0x40, and(add(o, 31), not(31))) // Allocate the memory.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* RUNE STRING OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the number of UTF characters in the string.
function runeCount(string memory s) internal pure returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
if mload(s) {
mstore(0x00, div(not(0), 255))
mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506)
let o := add(s, 0x20)
let end := add(o, mload(s))
for {
result := 1
} 1 {
result := add(result, 1)
} {
o := add(o, byte(0, mload(shr(250, mload(o)))))
if iszero(lt(o, end)) {
break
}
}
}
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* BYTE STRING OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// For performance and bytecode compactness, all indices of the following operations
// are byte (ASCII) offsets, not UTF character offsets.
/// @dev Returns `subject` all occurrences of `search` replaced with `replacement`.
function replace(
string memory subject,
string memory search,
string memory replacement
) internal pure returns (string memory result) {
/// @solidity memory-safe-assembly
assembly {
let subjectLength := mload(subject)
let searchLength := mload(search)
let replacementLength := mload(replacement)
subject := add(subject, 0x20)
search := add(search, 0x20)
replacement := add(replacement, 0x20)
result := add(mload(0x40), 0x20)
let subjectEnd := add(subject, subjectLength)
if iszero(gt(searchLength, subjectLength)) {
let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1)
let h := 0
if iszero(lt(searchLength, 32)) {
h := keccak256(search, searchLength)
}
let m := shl(3, sub(32, and(searchLength, 31)))
let s := mload(search)
for {
} 1 {
} {
let t := mload(subject)
// Whether the first `searchLength % 32` bytes of
// `subject` and `search` matches.
if iszero(shr(m, xor(t, s))) {
if h {
if iszero(eq(keccak256(subject, searchLength), h)) {
mstore(result, t)
result := add(result, 1)
subject := add(subject, 1)
if iszero(lt(subject, subjectSearchEnd)) {
break
}
continue
}
}
// Copy the `replacement` one word at a time.
for {
let o := 0
} 1 {
} {
mstore(add(result, o), mload(add(replacement, o)))
o := add(o, 0x20)
if iszero(lt(o, replacementLength)) {
break
}
}
result := add(result, replacementLength)
subject := add(subject, searchLength)
if searchLength {
if iszero(lt(subject, subjectSearchEnd)) {
break
}
continue
}
}
mstore(result, t)
result := add(result, 1)
subject := add(subject, 1)
if iszero(lt(subject, subjectSearchEnd)) {
break
}
}
}
let resultRemainder := result
result := add(mload(0x40), 0x20)
let k := add(sub(resultRemainder, result), sub(subjectEnd, subject))
// Copy the rest of the string one word at a time.
for {
} lt(subject, subjectEnd) {
} {
mstore(resultRemainder, mload(subject))
resultRemainder := add(resultRemainder, 0x20)
subject := add(subject, 0x20)
}
result := sub(result, 0x20)
// Zeroize the slot after the string.
let last := add(add(result, 0x20), k)
mstore(last, 0)
// Allocate memory for the length and the bytes,
// rounded up to a multiple of 32.
mstore(0x40, and(add(last, 31), not(31)))
// Store the length of the result.
mstore(result, k)
}
}
/// @dev Returns the byte index of the first location of `search` in `subject`,
/// searching from left to right, starting from `from`.
/// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
function indexOf(string memory subject, string memory search, uint256 from) internal pure returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
for {
let subjectLength := mload(subject)
} 1 {
} {
if iszero(mload(search)) {
if iszero(gt(from, subjectLength)) {
result := from
break
}
result := subjectLength
break
}
let searchLength := mload(search)
let subjectStart := add(subject, 0x20)
result := not(0) // Initialize to `NOT_FOUND`.
subject := add(subjectStart, from)
let end := add(sub(add(subjectStart, subjectLength), searchLength), 1)
let m := shl(3, sub(32, and(searchLength, 31)))
let s := mload(add(search, 0x20))
if iszero(and(lt(subject, end), lt(from, subjectLength))) {
break
}
if iszero(lt(searchLength, 32)) {
for {
let h := keccak256(add(search, 0x20), searchLength)
} 1 {
} {
if iszero(shr(m, xor(mload(subject), s))) {
if eq(keccak256(subject, searchLength), h) {
result := sub(subject, subjectStart)
break
}
}
subject := add(subject, 1)
if iszero(lt(subject, end)) {
break
}
}
break
}
for {
} 1 {
} {
if iszero(shr(m, xor(mload(subject), s))) {
result := sub(subject, subjectStart)
break
}
subject := add(subject, 1)
if iszero(lt(subject, end)) {
break
}
}
break
}
}
}
/// @dev Returns the byte index of the first location of `search` in `subject`,
/// searching from left to right.
/// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
function indexOf(string memory subject, string memory search) internal pure returns (uint256 result) {
result = indexOf(subject, search, 0);
}
/// @dev Returns the byte index of the first location of `search` in `subject`,
/// searching from right to left, starting from `from`.
/// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
function lastIndexOf(
string memory subject,
string memory search,
uint256 from
) internal pure returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
for {
} 1 {
} {
result := not(0) // Initialize to `NOT_FOUND`.
let searchLength := mload(search)
if gt(searchLength, mload(subject)) {
break
}
let w := result
let fromMax := sub(mload(subject), searchLength)
if iszero(gt(fromMax, from)) {
from := fromMax
}
let end := add(add(subject, 0x20), w)
subject := add(add(subject, 0x20), from)
if iszero(gt(subject, end)) {
break
}
// As this function is not too often used,
// we shall simply use keccak256 for smaller bytecode size.
for {
let h := keccak256(add(search, 0x20), searchLength)
} 1 {
} {
if eq(keccak256(subject, searchLength), h) {
result := sub(subject, add(end, 1))
break
}
subject := add(subject, w) // `sub(subject, 1)`.
if iszero(gt(subject, end)) {
break
}
}
break
}
}
}
/// @dev Returns the byte index of the first location of `search` in `subject`,
/// searching from right to left.
/// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
function lastIndexOf(string memory subject, string memory search) internal pure returns (uint256 result) {
result = lastIndexOf(subject, search, uint256(int256(-1)));
}
/// @dev Returns whether `subject` starts with `search`.
function startsWith(string memory subject, string memory search) internal pure returns (bool result) {
/// @solidity memory-safe-assembly
assembly {
let searchLength := mload(search)
// Just using keccak256 directly is actually cheaper.
// forgefmt: disable-next-item
result := and(
iszero(gt(searchLength, mload(subject))),
eq(keccak256(add(subject, 0x20), searchLength), keccak256(add(search, 0x20), searchLength))
)
}
}
/// @dev Returns whether `subject` ends with `search`.
function endsWith(string memory subject, string memory search) internal pure returns (bool result) {
/// @solidity memory-safe-assembly
assembly {
let searchLength := mload(search)
let subjectLength := mload(subject)
// Whether `search` is not longer than `subject`.
let withinRange := iszero(gt(searchLength, subjectLength))
// Just using keccak256 directly is actually cheaper.
// forgefmt: disable-next-item
result := and(
withinRange,
eq(
keccak256(
// `subject + 0x20 + max(subjectLength - searchLength, 0)`.
add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))),
searchLength
),
keccak256(add(search, 0x20), searchLength)
)
)
}
}
/// @dev Returns `subject` repeated `times`.
function repeat(string memory subject, uint256 times) internal pure returns (string memory result) {
/// @solidity memory-safe-assembly
assembly {
let subjectLength := mload(subject)
if iszero(or(iszero(times), iszero(subjectLength))) {
subject := add(subject, 0x20)
result := mload(0x40)
let output := add(result, 0x20)
for {
} 1 {
} {
// Copy the `subject` one word at a time.
for {
let o := 0
} 1 {
} {
mstore(add(output, o), mload(add(subject, o)))
o := add(o, 0x20)
if iszero(lt(o, subjectLength)) {
break
}
}
output := add(output, subjectLength)
times := sub(times, 1)
if iszero(times) {
break
}
}
// Zeroize the slot after the string.
mstore(output, 0)
// Store the length.
let resultLength := sub(output, add(result, 0x20))
mstore(result, resultLength)
// Allocate memory for the length and the bytes,
// rounded up to a multiple of 32.
mstore(0x40, add(result, and(add(resultLength, 63), not(31))))
}
}
}
/// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive).
/// `start` and `end` are byte offsets.
function slice(string memory subject, uint256 start, uint256 end) internal pure returns (string memory result) {
/// @solidity memory-safe-assembly
assembly {
let subjectLength := mload(subject)
if iszero(gt(subjectLength, end)) {
end := subjectLength
}
if iszero(gt(subjectLength, start)) {
start := subjectLength
}
if lt(start, end) {
result := mload(0x40)
let resultLength := sub(end, start)
mstore(result, resultLength)
subject := add(subject, start)
let w := not(31)
// Copy the `subject` one word at a time, backwards.
for {
let o := and(add(resultLength, 31), w)
} 1 {
} {
mstore(add(result, o), mload(add(subject, o)))
o := add(o, w) // `sub(o, 0x20)`.
if iszero(o) {
break
}
}
// Zeroize the slot after the string.
mstore(add(add(result, 0x20), resultLength), 0)
// Allocate memory for the length and the bytes,
// rounded up to a multiple of 32.
mstore(0x40, add(result, and(add(resultLength, 63), w)))
}
}
}
/// @dev Returns a copy of `subject` sliced from `start` to the end of the string.
/// `start` is a byte offset.
function slice(string memory subject, uint256 start) internal pure returns (string memory result) {
result = slice(subject, start, uint256(int256(-1)));
}
/// @dev Returns all the indices of `search` in `subject`.
/// The indices are byte offsets.
function indicesOf(string memory subject, string memory search) internal pure returns (uint256[] memory result) {
/// @solidity memory-safe-assembly
assembly {
let subjectLength := mload(subject)
let searchLength := mload(search)
if iszero(gt(searchLength, subjectLength)) {
subject := add(subject, 0x20)
search := add(search, 0x20)
result := add(mload(0x40), 0x20)
let subjectStart := subject
let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1)
let h := 0
if iszero(lt(searchLength, 32)) {
h := keccak256(search, searchLength)
}
let m := shl(3, sub(32, and(searchLength, 31)))
let s := mload(search)
for {
} 1 {
} {
let t := mload(subject)
// Whether the first `searchLength % 32` bytes of
// `subject` and `search` matches.
if iszero(shr(m, xor(t, s))) {
if h {
if iszero(eq(keccak256(subject, searchLength), h)) {
subject := add(subject, 1)
if iszero(lt(subject, subjectSearchEnd)) {
break
}
continue
}
}
// Append to `result`.
mstore(result, sub(subject, subjectStart))
result := add(result, 0x20)
// Advance `subject` by `searchLength`.
subject := add(subject, searchLength)
if searchLength {
if iszero(lt(subject, subjectSearchEnd)) {
break
}
continue
}
}
subject := add(subject, 1)
if iszero(lt(subject, subjectSearchEnd)) {
break
}
}
let resultEnd := result
// Assign `result` to the free memory pointer.
result := mload(0x40)
// Store the length of `result`.
mstore(result, shr(5, sub(resultEnd, add(result, 0x20))))
// Allocate memory for result.
// We allocate one more word, so this array can be recycled for {split}.
mstore(0x40, add(resultEnd, 0x20))
}
}
}
/// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string.
function split(string memory subject, string memory delimiter) internal pure returns (string[] memory result) {
uint256[] memory indices = indicesOf(subject, delimiter);
/// @solidity memory-safe-assembly
assembly {
let w := not(31)
let indexPtr := add(indices, 0x20)
let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1)))
mstore(add(indicesEnd, w), mload(subject))
mstore(indices, add(mload(indices), 1))
let prevIndex := 0
for {
} 1 {
} {
let index := mload(indexPtr)
mstore(indexPtr, 0x60)
if iszero(eq(index, prevIndex)) {
let element := mload(0x40)
let elementLength := sub(index, prevIndex)
mstore(element, elementLength)
// Copy the `subject` one word at a time, backwards.
for {
let o := and(add(elementLength, 31), w)
} 1 {
} {
mstore(add(element, o), mload(add(add(subject, prevIndex), o)))
o := add(o, w) // `sub(o, 0x20)`.
if iszero(o) {
break
}
}
// Zeroize the slot after the string.
mstore(add(add(element, 0x20), elementLength), 0)
// Allocate memory for the length and the bytes,
// rounded up to a multiple of 32.
mstore(0x40, add(element, and(add(elementLength, 63), w)))
// Store the `element` into the array.
mstore(indexPtr, element)
}
prevIndex := add(index, mload(delimiter))
indexPtr := add(indexPtr, 0x20)
if iszero(lt(indexPtr, indicesEnd)) {
break
}
}
result := indices
if iszero(mload(delimiter)) {
result := add(indices, 0x20)
mstore(result, sub(mload(indices), 2))
}
}
}
/// @dev Returns a concatenated string of `a` and `b`.
/// Cheaper than `string.concat()` and does not de-align the free memory pointer.
function concat(string memory a, string memory b) internal pure returns (string memory result) {
/// @solidity memory-safe-assembly
assembly {
let w := not(31)
result := mload(0x40)
let aLength := mload(a)
// Copy `a` one word at a time, backwards.
for {
let o := and(add(mload(a), 32), w)
} 1 {
} {
mstore(add(result, o), mload(add(a, o)))
o := add(o, w) // `sub(o, 0x20)`.
if iszero(o) {
break
}
}
let bLength := mload(b)
let output := add(result, mload(a))
// Copy `b` one word at a time, backwards.
for {
let o := and(add(bLength, 32), w)
} 1 {
} {
mstore(add(output, o), mload(add(b, o)))
o := add(o, w) // `sub(o, 0x20)`.
if iszero(o) {
break
}
}
let totalLength := add(aLength, bLength)
let last := add(add(result, 0x20), totalLength)
// Zeroize the slot after the string.
mstore(last, 0)
// Stores the length.
mstore(result, totalLength)
// Allocate memory for the length and the bytes,
// rounded up to a multiple of 32.
mstore(0x40, and(add(last, 31), w))
}
}
/// @dev Returns a copy of the string in either lowercase or UPPERCASE.
function toCase(string memory subject, bool toUpper) internal pure returns (string memory result) {
/// @solidity memory-safe-assembly
assembly {
let length := mload(subject)
if length {
result := add(mload(0x40), 0x20)
subject := add(subject, 1)
let flags := shl(add(70, shl(5, toUpper)), 67108863)
let w := not(0)
for {
let o := length
} 1 {
} {
o := add(o, w)
let b := and(0xff, mload(add(subject, o)))
mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20)))
if iszero(o) {
break
}
}
// Restore the result.
result := mload(0x40)
// Stores the string length.
mstore(result, length)
// Zeroize the slot after the string.
let last := add(add(result, 0x20), length)
mstore(last, 0)
// Allocate memory for the length and the bytes,
// rounded up to a multiple of 32.
mstore(0x40, and(add(last, 31), not(31)))
}
}
}
/// @dev Returns a lowercased copy of the string.
function lower(string memory subject) internal pure returns (string memory result) {
result = toCase(subject, false);
}
/// @dev Returns an UPPERCASED copy of the string.
function upper(string memory subject) internal pure returns (string memory result) {
result = toCase(subject, true);
}
/// @dev Escapes the string to be used within HTML tags.
function escapeHTML(string memory s) internal pure returns (string memory result) {
/// @solidity memory-safe-assembly
assembly {
for {
let end := add(s, mload(s))
result := add(mload(0x40), 0x20)
// Store the bytes of the packed offsets and strides into the scratch space.
// `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6.
mstore(0x1f, 0x900094)
mstore(0x08, 0xc0000000a6ab)
// Store ""&'<>" into the scratch space.
mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b))
} iszero(eq(s, end)) {
} {
s := add(s, 1)
let c := and(mload(s), 0xff)
// Not in `["\"","'","&","<",">"]`.
if iszero(and(shl(c, 1), 0x500000c400000000)) {
mstore8(result, c)
result := add(result, 1)
continue
}
let t := shr(248, mload(c))
mstore(result, mload(and(t, 31)))
result := add(result, shr(5, t))
}
let last := result
// Zeroize the slot after the string.
mstore(last, 0)
// Restore the result to the start of the free memory.
result := mload(0x40)
// Store the length of the result.
mstore(result, sub(last, add(result, 0x20)))
// Allocate memory for the length and the bytes,
// rounded up to a multiple of 32.
mstore(0x40, and(add(last, 31), not(31)))
}
}
/// @dev Escapes the string to be used within double-quotes in a JSON.
function escapeJSON(string memory s) internal pure returns (string memory result) {
/// @solidity memory-safe-assembly
assembly {
for {
let end := add(s, mload(s))
result := add(mload(0x40), 0x20)
// Store "\\u0000" in scratch space.
// Store "0123456789abcdef" in scratch space.
// Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`.
// into the scratch space.
mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672)
// Bitmask for detecting `["\"","\\"]`.
let e := or(shl(0x22, 1), shl(0x5c, 1))
} iszero(eq(s, end)) {
} {
s := add(s, 1)
let c := and(mload(s), 0xff)
if iszero(lt(c, 0x20)) {
if iszero(and(shl(c, 1), e)) {
// Not in `["\"","\\"]`.
mstore8(result, c)
result := add(result, 1)
continue
}
mstore8(result, 0x5c) // "\\".
mstore8(add(result, 1), c)
result := add(result, 2)
continue
}
if iszero(and(shl(c, 1), 0x3700)) {
// Not in `["\b","\t","\n","\f","\d"]`.
mstore8(0x1d, mload(shr(4, c))) // Hex value.
mstore8(0x1e, mload(and(c, 15))) // Hex value.
mstore(result, mload(0x19)) // "\\u00XX".
result := add(result, 6)
continue
}
mstore8(result, 0x5c) // "\\".
mstore8(add(result, 1), mload(add(c, 8)))
result := add(result, 2)
}
let last := result
// Zeroize the slot after the string.
mstore(last, 0)
// Restore the result to the start of the free memory.
result := mload(0x40)
// Store the length of the result.
mstore(result, sub(last, add(result, 0x20)))
// Allocate memory for the length and the bytes,
// rounded up to a multiple of 32.
mstore(0x40, and(add(last, 31), not(31)))
}
}
/// @dev Returns whether `a` equals `b`.
function eq(string memory a, string memory b) internal pure returns (bool result) {
assembly {
result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b)))
}
}
/// @dev Packs a single string with its length into a single word.
/// Returns `bytes32(0)` if the length is zero or greater than 31.
function packOne(string memory a) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
// We don't need to zero right pad the string,
// since this is our own custom non-standard packing scheme.
result := mul(
// Load the length and the bytes.
mload(add(a, 0x1f)),
// `length != 0 && length < 32`. Abuses underflow.
// Assumes that the length is valid and within the block gas limit.
lt(sub(mload(a), 1), 0x1f)
)
}
}
/// @dev Unpacks a string packed using {packOne}.
/// Returns the empty string if `packed` is `bytes32(0)`.
/// If `packed` is not an output of {packOne}, the output behaviour is undefined.
function unpackOne(bytes32 packed) internal pure returns (string memory result) {
/// @solidity memory-safe-assembly
assembly {
// Grab the free memory pointer.
result := mload(0x40)
// Allocate 2 words (1 for the length, 1 for the bytes).
mstore(0x40, add(result, 0x40))
// Zeroize the length slot.
mstore(result, 0)
// Store the length and bytes.
mstore(add(result, 0x1f), packed)
// Right pad with zeroes.
mstore(add(add(result, 0x20), mload(result)), 0)
}
}
/// @dev Packs two strings with their lengths into a single word.
/// Returns `bytes32(0)` if combined length is zero or greater than 30.
function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let aLength := mload(a)
// We don't need to zero right pad the strings,
// since this is our own custom non-standard packing scheme.
result := mul(
// Load the length and the bytes of `a` and `b`.
or(shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))), mload(sub(add(b, 0x1e), aLength))),
// `totalLength != 0 && totalLength < 31`. Abuses underflow.
// Assumes that the lengths are valid and within the block gas limit.
lt(sub(add(aLength, mload(b)), 1), 0x1e)
)
}
}
/// @dev Unpacks strings packed using {packTwo}.
/// Returns the empty strings if `packed` is `bytes32(0)`.
/// If `packed` is not an output of {packTwo}, the output behaviour is undefined.
function unpackTwo(bytes32 packed) internal pure returns (string memory resultA, string memory resultB) {
/// @solidity memory-safe-assembly
assembly {
// Grab the free memory pointer.
resultA := mload(0x40)
resultB := add(resultA, 0x40)
// Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words.
mstore(0x40, add(resultB, 0x40))
// Zeroize the length slots.
mstore(resultA, 0)
mstore(resultB, 0)
// Store the lengths and bytes.
mstore(add(resultA, 0x1f), packed)
mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA))))
// Right pad with zeroes.
mstore(add(add(resultA, 0x20), mload(resultA)), 0)
mstore(add(add(resultB, 0x20), mload(resultB)), 0)
}
}
/// @dev Directly returns `a` without copying.
function directReturn(string memory a) internal pure {
assembly {
// Assumes that the string does not start from the scratch space.
let retStart := sub(a, 0x20)
let retSize := add(mload(a), 0x40)
// Right pad with zeroes. Just in case the string is produced
// by a method that doesn't zero right pad.
mstore(add(retStart, retSize), 0)
// Store the return offset.
mstore(retStart, 0x20)
// End the transaction, returning the string.
return(retStart, retSize)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Library for generating psuedorandom numbers.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibPRNG.sol)
library LibPRNG {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* STRUCTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev A psuedorandom number state in memory.
struct PRNG {
uint256 state;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Seeds the `prng` with `state`.
function seed(PRNG memory prng, bytes32 state) internal pure {
/// @solidity memory-safe-assembly
assembly {
mstore(prng, state)
}
}
/// @dev Returns a psuedorandom uint256, uniformly distributed
/// between 0 (inclusive) and `upper` (exclusive).
/// If your modulus is big, this method is recommended
/// for uniform sampling to avoid modulo bias.
/// For uniform sampling across all uint256 values,
/// or for small enough moduli such that the bias is neligible,
/// use {next} instead.
function uniform(
PRNG memory prng,
uint256 upper
) internal pure returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
// prettier-ignore
for {} 1 {} {
result := keccak256(prng, 0x20)
mstore(prng, result)
// prettier-ignore
if iszero(lt(result, mod(sub(0, upper), upper))) { break }
}
result := mod(result, upper)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17 .0;
library SVG {
/* MAIN ELEMENTS */
function line(string memory _props) internal pure returns (string memory) {
return string.concat("<line ", _props, "/>");
}
function rect(string memory _props) internal pure returns (string memory) {
return string.concat('<rect height="1" width="1" ', _props, "/>");
}
/* COMMON */
// an SVG attribute
function prop(string memory _key, string memory _val) internal pure returns (string memory) {
return string.concat(_key, "=", '"', _val, '" ');
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17.0;
import { TwoStepOwnable } from "./TwoStepOwnable.sol";
/**
* @notice Smart contract that verifies and tracks allow list redemptions against a configurable Merkle root, up to a
* max number configured at deploy
*/
contract AllowList is TwoStepOwnable {
bytes32 public merkleRoot;
error NotAllowListed();
///@notice Checks if msg.sender is included in AllowList, revert otherwise
///@param proof Merkle proof
modifier onlyAllowListed(bytes32[] calldata proof) {
if (!isAllowListed(proof, msg.sender)) {
revert NotAllowListed();
}
_;
}
constructor(bytes32 _merkleRoot) {
merkleRoot = _merkleRoot;
}
///@notice set the Merkle root in the contract. OnlyOwner.
///@param _merkleRoot the new Merkle root
function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {
merkleRoot = _merkleRoot;
}
///@notice Given a Merkle proof, check if an address is AllowListed against the root
///@param proof Merkle proof
///@param data abi-encoded data to be checked against the root
///@return boolean isAllowListed
function isAllowListed(bytes32[] calldata proof, bytes memory data) public view returns (bool) {
return verifyCalldata(proof, merkleRoot, keccak256(data));
}
///@notice Given a Merkle proof, check if an address is AllowListed against the root
///@param proof Merkle proof
///@param addr address to check against allow list
///@return boolean isAllowListed
function isAllowListed(bytes32[] calldata proof, address addr) public view returns (bool) {
return verifyCalldata(proof, merkleRoot, keccak256(abi.encodePacked(addr)));
}
/**
* @dev Calldata version of {verify}
* Copied from OpenZeppelin's MerkleProof.sol
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Calldata version of {processProof}
* Copied from OpenZeppelin's MerkleProof.sol
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length;) {
computedHash = _hashPair(computedHash, proof[i]);
unchecked {
++i;
}
}
return computedHash;
}
/// @dev Copied from OpenZeppelin's MerkleProof.sol
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
/// @dev Copied from OpenZeppelin's MerkleProof.sol
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the
* ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @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`,
* 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 be 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,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom}
* whenever possible.
*
* 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 payable;
/**
* @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 payable;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Library for generating psuedorandom numbers.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibPRNG.sol)
library LibPRNG {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* STRUCTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev A psuedorandom number state in memory.
struct PRNG {
uint256 state;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Seeds the `prng` with `state`.
function seed(PRNG memory prng, bytes32 state) internal pure {
/// @solidity memory-safe-assembly
assembly {
mstore(prng, state)
}
}
/// @dev Returns a psuedorandom uint256, uniformly distributed
/// between 0 (inclusive) and `upper` (exclusive).
/// If your modulus is big, this method is recommended
/// for uniform sampling to avoid modulo bias.
/// For uniform sampling across all uint256 values,
/// or for small enough moduli such that the bias is neligible,
/// use {next} instead.
function uniform(PRNG memory prng, uint256 upper) internal pure returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
// prettier-ignore
for {} 1 {} {
result := keccak256(prng, 0x20)
mstore(prng, result)
// prettier-ignore
if iszero(lt(result, mod(sub(0, upper), upper))) { break }
}
result := mod(result, upper)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
/**
* @notice A two-step extension of Ownable, where the new owner must claim ownership of the contract after owner
* initiates transfer
* Owner can cancel the transfer at any point before the new owner claims ownership.
* Helpful in guarding against transferring ownership to an address that is unable to act as the Owner.
*/
abstract contract TwoStepOwnable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
address internal potentialOwner;
event PotentialOwnerUpdated(address newPotentialAdministrator);
error NewOwnerIsZeroAddress();
error NotNextOwner();
error OnlyOwner();
modifier onlyOwner() {
_checkOwner();
_;
}
constructor() {
_transferOwnership(msg.sender);
}
///@notice Initiate ownership transfer to newPotentialOwner. Note: new owner will have to manually acceptOwnership
///@param newPotentialOwner address of potential new owner
function transferOwnership(address newPotentialOwner) public virtual onlyOwner {
if (newPotentialOwner == address(0)) {
revert NewOwnerIsZeroAddress();
}
potentialOwner = newPotentialOwner;
emit PotentialOwnerUpdated(newPotentialOwner);
}
///@notice Claim ownership of smart contract, after the current owner has initiated the process with
/// transferOwnership
function acceptOwnership() public virtual {
address _potentialOwner = potentialOwner;
if (msg.sender != _potentialOwner) {
revert NotNextOwner();
}
delete potentialOwner;
emit PotentialOwnerUpdated(address(0));
_transferOwnership(_potentialOwner);
}
///@notice cancel ownership transfer
function cancelOwnershipTransfer() public virtual onlyOwner {
delete potentialOwner;
emit PotentialOwnerUpdated(address(0));
}
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 != msg.sender) {
revert OnlyOwner();
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}{
"remappings": [
"@prb/test/=lib/prb-test/src/",
"forge-std/=lib/forge-std/src/",
"src/=src/",
"@erc721a/=lib/ERC721A/contracts/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"@solady/=lib/solady/src/",
"operator-filter-registry/=lib/operator-filter-registry/",
"ERC721A/=lib/ERC721A/contracts/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/",
"openzeppelin-contracts-upgradeable/=lib/operator-filter-registry/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"prb-math/=lib/prb-math/src/",
"prb-test/=lib/prb-test/src/",
"solady/=lib/solady/src/",
"solidity-trigonometry/=lib/solidity-trigonometry/src/",
"solmate/=lib/solady/lib/solmate/src/"
],
"optimizer": {
"enabled": true,
"runs": 20
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": false
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"bytes32","name":"allowListMerkleRoot","type":"bytes32"},{"internalType":"uint16","name":"allowListMintMaxTotalVal","type":"uint16"},{"internalType":"uint8","name":"allowListMintMaxPerWalletVal","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AllowListMintCapExceeded","type":"error"},{"inputs":[],"name":"AllowListMintCapPerWalletExceeded","type":"error"},{"inputs":[],"name":"AlreadyRevealed","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"IncorrectPayment","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NotAllowListed","type":"error"},{"inputs":[],"name":"NotNextOwner","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PublicMintNotEnabled","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newPotentialAdministrator","type":"address"}],"name":"PotentialOwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"animationScript","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"art","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"artText","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getInnerColorHue","outputs":[{"internalType":"uint16","name":"hue","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"isAllowListed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"addr","type":"address"}],"name":"isAllowListed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint8","name":"amount","type":"uint8"}],"name":"mintAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"amount","type":"uint8"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMintEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newPotentialOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"updatePublicMintEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
600561070081815264062cc6670760db1b6107205260c09081526107408281526418b3199b1b60d91b6107605260e05261078082815264316633326560d81b6107a052610100526107c082815264316639356560d81b6107e0526101205261080082815264316633616560d81b610820526101405261084082815264316633623360d81b61086052610160526108808281526418b319b19960d91b6108a052610180526108c082815264316636663960d81b6108e0526101a05261090082815264316633613360d81b610920526101c05261094082815264316633626560d81b610960526101e05261098082815264062cc66c6760db1b6109a052610200526109c08281526418b31c9c9b60d91b6109e05261022052610a0082815264316639393560d81b610a205261024052610a40828152640c598ccc4d60da1b610a605261026052610a8082815264031663638360dc1b610aa05261028052610ac082815264316633313960d81b610ae0526102a0526004610b00818152633236666160e01b610b20526102c052610b4083815264316634313960d81b610b60526102e052610b8083815264062cc7270760db1b610ba05261030052610bc08381526418b31a191960d91b610be05261032052610c0083815264316634303760d81b610c205261034052610c40838152640c598e4e1960da1b610c605261036052610c8083815264316634306560d81b610ca05261038052610cc083815264062cc6860760db1b610ce0526103a052610d0083815264316634313560d81b610d20526103c052610d4083815264062cc6660760db1b610d60526103e052610d808381526418b319981960d91b610da05261040052610dc083815264316636663760d81b610de05261042052610e008381526418b319983160d91b610e205261044052610e4083815264031663432360dc1b610e605261046052610e808381526418b31b309960d91b610ea05261048052610ec0838152640c598cd8cd60da1b610ee0526104a052610f008381526418b319b21b60d91b610f20526104c052610f40908152633236663560e01b610f60526104e052610f8082815264316636393760d81b610fa05261050052610fc082815264316634383360d81b610fe0526105205261100082815264316634376560d81b61102052610540526110408281526418b31831b360d91b61106052610560526110808281526418b319b0b360d91b6110a052610580526110c0828152640c598ccd1960da1b6110e0526105a05261110082815264316633613160d81b611120526105c05261114082815264316633343960d81b611160526105e05261118082815264316633353360d81b6111a052610600526111c0828152640c598cce0d60da1b6111e05261062052611200828152640c598ccd0d60da1b61122052610640526112408281526418b31999b160d91b61126052610660526112808281526418b31a18b160d91b6112a052610680526112c082815264062cc66c4760db1b6112e0526106a05261130082815264316633623760d81b611320526106c05261138060405261134091825264316636383160d81b611360526106e0919091526200049890600e90603262000b47565b50604080516106808101825260046106408201818152631e13f1d160e31b61066084015282528251808401845281815263784fc6d360e11b602082810191909152808401919091528351808501855282815263784fc65760e11b81830152838501528351808501855282815263784fd2cf60e11b8183015260608401528351808501855282815263784fc75760e11b8183015260808401528351808501855282815263f09f8eb360e01b8183015260a08401528351808501855282815263784fc7c160e11b8183015260c08401528351808501855282815263f09f9bb960e01b8183015260e08401528351808501855282815263f09f8ea360e01b818301526101008401528351808501855282815263784fc75f60e11b8183015261012084015283518085018552828152631e13f1f160e31b818301526101408401528351808501855282815263784fd34b60e11b818301526101608401528351808501855282815263f09fa69560e01b8183015261018084015283518085018552828152633c27e32560e21b818301526101a0840152835180850185528281526301e13f3560e71b818301526101c08401528351808501855282815263f09f8c9960e01b818301526101e0840152835180850185526003815262714ddd60e91b818301526102008401528351808501855282815263f09f909960e01b8183015261022084015283518085018552828152631e13f4d160e31b818301526102408401528351808501855282815263784fc85160e11b818301526102608401528351808501855282815263f09f908760e01b818301526102808401528351808501855282815263f09fa68d60e01b818301526102a08401528351808501855282815263784fc84760e11b818301526102c084015283518085018552828152631e13f21160e31b818301526102e08401528351808501855282815263f09f909560e01b8183015261030084015283518085018552828152631e13f19160e31b818301526103208401528351808501855282815263784fc64160e11b818301526103408401528351808501855282815263f09f9bb760e01b818301526103608401528351808501855282815263f09f8c8b60e01b8183015261038084015283518085018552828152630784fc8560e51b818301526103a08401528351808501855282815263784fcd5160e11b818301526103c084015283518085018552828152633c27e3e160e21b818301526103e0840152835180850185526007815266f09f8f96efb88f60c81b81830152610400840152835180850185526006815265e29bb5efb88f60d01b818301526104208401528351808501855282815263f09f9a9760e01b818301526104408401528351808501855282815263f09f928360e01b818301526104608401528351808501855282815263784fc8df60e11b818301526104808401528351808501855282815263f09f838f60e01b818301526104a08401528351808501855282815263f09f8eaf60e01b818301526104c08401528351808501855282815263f09f8d8d60e01b818301526104e08401528351808501855282815263f09f8ea160e01b818301526105008401528351808501855282815263f09f8d8960e01b818301526105208401528351808501855282815263f09f8d9360e01b8183015261054084015283518085018552828152633c27e3a160e21b8183015261056084015283518085018552828152633c27e36160e21b818301526105808401528351808501855282815263f09f8cbb60e01b818301526105a08401528351808501855282815263f09f909b60e01b818301526105c084015283518085018552828152631e13f1d760e31b818301526105e08401528351808501855282815263f09f8eb760e01b81830152610600840152835180850190945290835263f09f9a8160e01b9083015261062081019190915262000a3490600f90603262000b47565b5034801562000a4257600080fd5b50604051620035793803806200357983398101604081905262000a659162000c1e565b826040518060400160405280600d81526020016c6f6e636861696e20676966747360981b8152506040518060400160405280600481526020016311d2519560e21b815250816002908162000aba919062000d16565b50600362000ac9828262000d16565b505060016000555062000adc3362000af5565b600a5561ffff90911660805260ff1660a0525062000de2565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82805482825590600052602060002090810192821562000b92579160200282015b8281111562000b92578251829062000b81908262000d16565b509160200191906001019062000b68565b5062000ba092915062000ba4565b5090565b8082111562000ba057600062000bbb828262000bc5565b5060010162000ba4565b50805462000bd39062000c87565b6000825580601f1062000be4575050565b601f01602090049060005260206000209081019062000c04919062000c07565b50565b5b8082111562000ba0576000815560010162000c08565b60008060006060848603121562000c3457600080fd5b83519250602084015161ffff8116811462000c4e57600080fd5b604085015190925060ff8116811462000c6657600080fd5b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168062000c9c57607f821691505b60208210810362000cbd57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000d1157600081815260208120601f850160051c8101602086101562000cec5750805b601f850160051c820191505b8181101562000d0d5782815560010162000cf8565b5050505b505050565b81516001600160401b0381111562000d325762000d3262000c71565b62000d4a8162000d43845462000c87565b8462000cc3565b602080601f83116001811462000d82576000841562000d695750858301515b600019600386901b1c1916600185901b17855562000d0d565b600085815260208120601f198616915b8281101562000db35788860151825594840194600190910190840162000d92565b508582101562000dd25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05161277162000e086000396000610d3601526000610cce01526127716000f3fe6080604052600436106101995760003560e01c8063715018a6116100dd578063715018a6146103b25780637449da48146103c757806379ba5097146103e75780637cb64759146103fc57806383281cec1461041c5780638d859f3e1461043c5780638da5cb5b1461045757806395d89b4114610475578063a22cb4651461048a578063a475b5dd146104aa578063a85cd889146104bf578063b88d4fde146104df578063c87b56dd146104f2578063d1cb835e14610512578063e985e9c514610527578063f2fde38b14610570578063f3b674a41461059057600080fd5b806301ffc9a71461019e57806306fdde03146101d3578063081812fc146101f5578063095ea7b3146102225780630f4161aa1461023757806318160ddd1461025157806323452b9c1461027857806323b872dd1461028d5780632eb4a7ab146102a05780633ccfd60b146102b657806342842e0e146102cb57806351bf7b54146102de57806356ff1be81461030c5780636352211e1461032c57806367dce1ed1461034c57806369fbea121461035f57806370a0823114610392575b600080fd5b3480156101aa57600080fd5b506101be6101b9366004611900565b6105b0565b60405190151581526020015b60405180910390f35b3480156101df57600080fd5b506101e8610602565b6040516101ca919061196d565b34801561020157600080fd5b50610215610210366004611980565b610694565b6040516101ca9190611999565b6102356102303660046119c9565b6106d8565b005b34801561024357600080fd5b50600b546101be9060ff1681565b34801561025d57600080fd5b5060015460005403600019015b6040519081526020016101ca565b34801561028457600080fd5b50610235610778565b61023561029b3660046119f3565b6107b9565b3480156102ac57600080fd5b5061026a600a5481565b3480156102c257600080fd5b5061023561093f565b6102356102d93660046119f3565b6109ab565b3480156102ea57600080fd5b506102fe6102f9366004611980565b6109cb565b6040516101ca929190611a2f565b34801561031857600080fd5b50610235610327366004611a6d565b610b6e565b34801561033857600080fd5b50610215610347366004611980565b610b89565b61023561035a366004611a99565b610b94565b34801561036b57600080fd5b5061037f61037a366004611980565b610bed565b60405161ffff90911681526020016101ca565b34801561039e57600080fd5b5061026a6103ad366004611ab4565b610c40565b3480156103be57600080fd5b50610235610c8e565b3480156103d357600080fd5b506102356103e2366004611b1a565b610ca2565b3480156103f357600080fd5b50610235610daf565b34801561040857600080fd5b50610235610417366004611980565b610e1b565b34801561042857600080fd5b506101be610437366004611c0f565b610e28565b34801561044857600080fd5b5061026a6611c37937e0800081565b34801561046357600080fd5b506008546001600160a01b0316610215565b34801561048157600080fd5b506101e8610e47565b34801561049657600080fd5b506102356104a5366004611c77565b610e56565b3480156104b657600080fd5b50610235610ec2565b3480156104cb57600080fd5b506101e86104da366004611980565b610f13565b6102356104ed366004611caa565b610f61565b3480156104fe57600080fd5b506101e861050d366004611980565b610fab565b34801561051e57600080fd5b506101e86110ed565b34801561053357600080fd5b506101be610542366004611d11565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561057c57600080fd5b5061023561058b366004611ab4565b6111d4565b34801561059c57600080fd5b506101be6105ab366004611d3b565b611247565b60006301ffc9a760e01b6001600160e01b0319831614806105e157506380ac58cd60e01b6001600160e01b03198316145b806105fc5750635b5e139f60e01b6001600160e01b03198316145b92915050565b60606002805461061190611d85565b80601f016020809104026020016040519081016040528092919081815260200182805461063d90611d85565b801561068a5780601f1061065f5761010080835404028352916020019161068a565b820191906000526020600020905b81548152906001019060200180831161066d57829003601f168201915b5050505050905090565b600061069f8261128a565b6106bc576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006106e382610b89565b9050336001600160a01b0382161461071c576106ff8133610542565b61071c576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6107806112bf565b600980546001600160a01b0319169055604051600080516020612731833981519152906107af90600090611999565b60405180910390a1565b60006107c4826112ea565b9050836001600160a01b0316816001600160a01b0316146107f75760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610844576108278633610542565b61084457604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661086b57604051633a954ecd60e21b815260040160405180910390fd5b801561087657600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716815220805460010190556108b385600160e11b611359565b600085815260046020526040812091909155600160e11b84169003610908576001840160008181526004602052604081205490036109065760005481146109065760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b031660008051602061275183398151915260405160405180910390a4505050505050565b6040516000907339ab90066cec746a032d67e4fe3378f16294cf6b9047908381818185875af1925050503d8060008114610995576040519150601f19603f3d011682016040523d82523d6000602084013e61099a565b606091505b50509050806109a857600080fd5b50565b6109c683838360405180602001604052806000815250610f61565b505050565b600d546060908190610a1f576040518060400160405280600981526020016826237831663338313b60b81b81525060405180604001604052806004815260200163f09f8e8160e01b81525091509150915091565b604080516020808201835260008252600d5483519182015291820185905290610a6b906060015b604051602081830303815290604052805190602001208261136e90919063ffffffff16565b600e54600090610a7c908390611372565b9050600e8181548110610a9157610a91611dbf565b90600052602060002001604051602001610aab9190611e72565b604051602081830303815290604052600f8281548110610acd57610acd611dbf565b90600052602060002001808054610ae390611d85565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0f90611d85565b8015610b5c5780601f10610b3157610100808354040283529160200191610b5c565b820191906000526020600020905b815481529060010190602001808311610b3f57829003601f168201915b50505050509050935093505050915091565b610b766112bf565b600b805460ff1916911515919091179055565b60006105fc826112ea565b600b5460ff16610bb7576040516393e8222560e01b815260040160405180910390fd5b346611c37937e080008260ff160214610be35760405163569e8c1160e01b815260040160405180910390fd5b6109a83382611390565b6000610c056040518060200160405280600081525090565b600d5460408051602081019290925281018490526103e96060820152610c2d90608001610a46565b610c3981610168611372565b9392505050565b60006001600160a01b038216610c69576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b610c966112bf565b610ca060006113e9565b565b8282610caf828233611247565b610ccc57604051630e5060e160e21b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000061ffff168360ff16610d026000546000190190565b011115610d2257604051637c44f5af60e11b815260040160405180910390fd5b336000908152600c602052604090205460ff7f000000000000000000000000000000000000000000000000000000000000000081169181168501161115610d7c57604051632ae6c11560e21b815260040160405180910390fd5b336000818152600c60205260409020805460ff80821687011660ff19909116179055610da89084611390565b5050505050565b6009546001600160a01b0316338114610ddb57604051636b7584e760e11b815260040160405180910390fd5b600980546001600160a01b031916905560405160008051602061273183398151915290610e0a90600090611999565b60405180910390a16109a8816113e9565b610e236112bf565b600a55565b6000610e3f8484600a54858051906020012061143b565b949350505050565b60606003805461061190611d85565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610eca6112bf565b600d5415610eeb5760405163a89ac15160e01b815260040160405180910390fd5b604080514460208201520160408051601f198184030181529190528051602090910120600d55565b60606000610f20836109cb565b509050610f38610f2f84610bed565b61ffff16611453565b81604051602001610f4a929190611eb7565b604051602081830303815290604052915050919050565b610f6c8484846107b9565b6001600160a01b0383163b15610fa557610f8884848484611497565b610fa5576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6060610fb68261128a565b610fd357604051630a14c4b560e41b815260040160405180910390fd5b6000610fde83610f13565b90506000610feb846109cb565b915050610e3f84610ffb8461157f565b60405160200161100b9190612135565b60405160208183030381529060405261104b856110266110ed565b604051602001611037929190612177565b60405160208183030381529060405261157f565b60405160200161105b919061220b565b60408051601f19818403018152828201909152600482526311da599d60e21b60208301529061108e9086600060016116d1565b6110c860405180604001604052806009815260200168496e6e65722068756560b81b8152506110bf610f2f8c610bed565b600160006116d1565b6040516020016110d9929190612249565b604051602081830303815290604052611760565b60408051808201909152600f81526e3c7363726970743e6c657420673d5b60881b602082015260609060005b600e548110156111ac5781600e828154811061113757611137611dbf565b90600052602060002001600e8054905083600101106111655760405180602001604052806000815250611180565b604051806040016040528060018152602001600b60fa1b8152505b60405160200161119293929190612296565b60408051601f198184030181529190529150600101611119565b50806040516020016111be91906122ee565b60408051601f1981840301815291905292915050565b6111dc6112bf565b6001600160a01b03811661120357604051633a247dd760e11b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383161790556040516000805160206127318339815191529061123c908390611999565b60405180910390a150565b600a546040516001600160601b0319606084901b166020820152600091610e3f91869186916034016040516020818303038152906040528051906020012061143b565b60008160011115801561129e575060005482105b80156105fc575050600090815260046020526040902054600160e01b161590565b6008546001600160a01b03163314610ca057604051635fc483c560e01b815260040160405180910390fd5b60008180600111611340576000548110156113405760008181526004602052604081205490600160e01b8216900361133e575b80600003610c3957506000190160008181526004602052604090205461131d565b505b604051636f96cda160e11b815260040160405180910390fd5b4260a01b176001600160a01b03919091161790565b9052565b60005b60208320905080835281826000030681106113755706919050565b60005460ff8216810161045810156113bb5760405163d05cb60960e01b815260040160405180910390fd5b600d54156113dc5760405163a89ac15160e01b815260040160405180910390fd5b6109c6838360ff16611794565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008261144986868561187c565b1495945050505050565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a90048061146e575050819003601f19909101908152919050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906114cc903390899088908890600401612446565b6020604051808303816000875af1925050508015611507575060408051601f3d908101601f1916820190925261150491810190612483565b60015b611565573d808015611535576040519150601f19603f3d011682016040523d82523d6000602084013e61153a565b606091505b50805160000361155d576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610e3f565b6060815160000361159e57505060408051602081019091526000815290565b60006040518060600160405280604081526020016126f1604091399050600060038451600201816115d1576115d16124a0565b0460040290506000816020016001600160401b038111156115f4576115f4611b6d565b6040519080825280601f01601f19166020018201604052801561161e576020820181803683370190505b509050818152600183018586518101602084015b8183101561168c5760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b93820193909352600401611632565b6003895106600181146116a657600281146116b7576116c3565b613d3d60f01b6001198301526116c3565b603d60f81b6000198301525b509398975050505050505050565b606084836116fe57846040516020016116ea91906124b6565b604051602081830303815290604052611700565b845b8361171a5760405180602001604052806000815250611735565b604051806040016040528060018152602001600b60fa1b8152505b604051602001611747939291906124e4565b6040516020818303038152906040529050949350505050565b606061178461176e86611453565b8386866040516020016110379493929190612568565b60405160200161174791906126ab565b60008054908290036117b95760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038316600090815260056020526040902080546001600160401b0184020190556117f0836001841460e11b611359565b6000828152600460205260408120919091556001600160a01b0384169083830190839083906000805160206127518339815191528180a4600183015b8181146118525780836000600080516020612751833981519152600080a460010161182c565b508160000361187357604051622e076360e81b815260040160405180910390fd5b60005550505050565b600081815b848110156118b5576118ab8287878481811061189f5761189f611dbf565b905060200201356118be565b9150600101611881565b50949350505050565b60008183106118da576000828152602084905260409020610c39565b5060009182526020526040902090565b6001600160e01b0319811681146109a857600080fd5b60006020828403121561191257600080fd5b8135610c39816118ea565b60005b83811015611938578181015183820152602001611920565b50506000910152565b6000815180845261195981602086016020860161191d565b601f01601f19169290920160200192915050565b602081526000610c396020830184611941565b60006020828403121561199257600080fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b03811681146119c457600080fd5b919050565b600080604083850312156119dc57600080fd5b6119e5836119ad565b946020939093013593505050565b600080600060608486031215611a0857600080fd5b611a11846119ad565b9250611a1f602085016119ad565b9150604084013590509250925092565b604081526000611a426040830185611941565b8281036020840152611a548185611941565b95945050505050565b803580151581146119c457600080fd5b600060208284031215611a7f57600080fd5b610c3982611a5d565b803560ff811681146119c457600080fd5b600060208284031215611aab57600080fd5b610c3982611a88565b600060208284031215611ac657600080fd5b610c39826119ad565b60008083601f840112611ae157600080fd5b5081356001600160401b03811115611af857600080fd5b6020830191508360208260051b8501011115611b1357600080fd5b9250929050565b600080600060408486031215611b2f57600080fd5b83356001600160401b03811115611b4557600080fd5b611b5186828701611acf565b9094509250611b64905060208501611a88565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b600082601f830112611b9457600080fd5b81356001600160401b0380821115611bae57611bae611b6d565b604051601f8301601f19908116603f01168101908282118183101715611bd657611bd6611b6d565b81604052838152866020858801011115611bef57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060408486031215611c2457600080fd5b83356001600160401b0380821115611c3b57600080fd5b611c4787838801611acf565b90955093506020860135915080821115611c6057600080fd5b50611c6d86828701611b83565b9150509250925092565b60008060408385031215611c8a57600080fd5b611c93836119ad565b9150611ca160208401611a5d565b90509250929050565b60008060008060808587031215611cc057600080fd5b611cc9856119ad565b9350611cd7602086016119ad565b92506040850135915060608501356001600160401b03811115611cf957600080fd5b611d0587828801611b83565b91505092959194509250565b60008060408385031215611d2457600080fd5b611d2d836119ad565b9150611ca1602084016119ad565b600080600060408486031215611d5057600080fd5b83356001600160401b03811115611d6657600080fd5b611d7286828701611acf565b9094509250611b649050602085016119ad565b600181811c90821680611d9957607f821691505b602082108103611db957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b8054600090600181811c9080831680611def57607f831692505b60208084108203611e1057634e487b7160e01b600052602260045260246000fd5b818015611e245760018114611e3957611e66565b60ff1986168952841515850289019650611e66565b60008881526020902060005b86811015611e5e5781548b820152908501908301611e45565b505084890196505b50505050505092915050565b6204c46f60eb1b81526000611e8a6003830184611dd5565b603b60f81b81526001019392505050565b60008151611ead81856020860161191d565b9290920192915050565b7f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f737667222077696474683d223130302522206865696768743d2231303060208201527f25222076696577426f783d223020302034303020343030222066696c6c3d226e60408201527f6f6e65223e3c726563742077696474683d2234303022206865696768743d223460608201527f3030222066696c6c3d2223656134363330222072783d22352522202f3e3c726560808201527f637420783d2234302220793d223430222077696474683d22333230222068656960a08201527f6768743d22333230222066696c6c3d22677265656e222072783d22352522202f60c08201527f3e3c7265637420783d2238302220793d223830222077696474683d223234302260e082015278040d0cad2ced0e87a446468604440ccd2d8d87a44d0e6d8c25603b1b6101008201526000610119845161201e818386016020890161191d565b61210e61210883838701017f2c3530252c3836252c3130302529222072783d22322e352522202f3e3c74657881527f742069643d22676966742220783d223230302220793d2232313022207465787460208201527f2d616e63686f723d226d6964646c652220666f6e742d73697a653d223832222060408201527f616c69676e6d656e742d626173656c696e653d226d6964646c6522207374726f60608201527f6b652d77696474683d223222207374726f6b653d222330303022207374796c656080820152741e913ab9b2b916b9b2b632b1ba1d103737b732911f60591b60a082015260b50190565b86611e9b565b91505061212a816c1e17ba32bc3a1f1e17b9bb339f60991b9052565b600d01949350505050565b7919185d184e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b60321b81526000825161216a81601a85016020870161191d565b91909101601a0192915050565b7f3c68746d6c207374796c653d226f766572666c6f773a68696464656e223e3c6281527437b23c9039ba3cb6329e9136b0b933b4b71d18111f60591b6020820152600083516121cd81603585016020880161191d565b8351908301906121e481603584016020880161191d565b6d1e17b137b23c9f1e17b43a36b61f60911b60359290910191820152604301949350505050565b7519185d184e9d195e1d0bda1d1b5b0ed8985cd94d8d0b60521b81526000825161223c81601685016020870161191d565b9190910160160192915050565b605b60f81b81526000835161226581600185016020880161191d565b83519083019061227c81600184016020880161191d565b605d60f81b60019290910191820152600201949350505050565b600084516122a881846020890161191d565b630444c46f60e31b9083019081526122c36004820186611dd5565b611d9160f11b815284519091506122e181600284016020880161191d565b0160020195945050505050565b6000825161230081846020870161191d565b7f5d2c723d21312c733d743d3e6e65772050726f6d6973652828653d3e736574549201918252507f696d656f757428652c742929293b6c6574207a3d646f63756d656e742e67657460208201527f456c656d656e744279496428226769667422293b6c6574206f673d7a2e696e6e60408201527f657248544d4c3b646f63756d656e742e6164644576656e744c697374656e657260608201527f2822636c69636b222c286173796e6328293d3e7b696628722972657475726e3b60808201527f6c657420743d21303b666f72286c657420743d303b743c672e6c656e6774683b60a08201527f742b2b297a2e696e6e657248544d4c3d675b745d2c617761697420732831303060c08201527f293b7a2e696e6e657248544d4c3d6f672c743d21317d29293b3c2f736372697060e0820152613a1f60f11b61010082015261010201919050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061247990830184611941565b9695505050505050565b60006020828403121561249557600080fd5b8151610c39816118ea565b634e487b7160e01b600052601260045260246000fd5b6000601160f91b80835283516124d381600186016020880161191d565b600193019283015250600201919050565b6e3d913a3930b4ba2fba3cb832911d1160891b8152835160009061250f81600f85016020890161191d565b691116113b30b63ab2911d60b11b600f91840191820152845161253981601984016020890161191d565b607d60f81b60199290910191820152835161255b81601a84016020880161191d565b01601a0195945050505050565b767b226e616d65223a226f6e636861696e2067696674202360481b8152845160009061259b816017850160208a0161191d565b7f222c226465736372697074696f6e223a226f6e636861696e20676966747320616017918401918201527f72652067656e65726174697665206f6e636861696e2070726573656e7473207460378201527f6f2063656c6562726174652074686520686f6c6964617920736561736f6e222c60578201526c1130ba3a3934b13aba32b9911d60991b6077820152855161263a816084840160208a0161191d565b69161134b6b0b3b2911d1160b11b60849290910191820152845161266581608e84016020890161191d565b01612688608e82017211161130b734b6b0ba34b7b72fbab936111d1160691b9052565b61269560a1820185611e9b565b61227d60f01b8152600201979650505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516126e381601d85016020870161191d565b91909101601d019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974daddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef62f03b4b8a2082eb8be670b3ea6d07716aecc59300f123046d1dad881bd34c9f00000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000005
Deployed Bytecode
0x6080604052600436106101995760003560e01c8063715018a6116100dd578063715018a6146103b25780637449da48146103c757806379ba5097146103e75780637cb64759146103fc57806383281cec1461041c5780638d859f3e1461043c5780638da5cb5b1461045757806395d89b4114610475578063a22cb4651461048a578063a475b5dd146104aa578063a85cd889146104bf578063b88d4fde146104df578063c87b56dd146104f2578063d1cb835e14610512578063e985e9c514610527578063f2fde38b14610570578063f3b674a41461059057600080fd5b806301ffc9a71461019e57806306fdde03146101d3578063081812fc146101f5578063095ea7b3146102225780630f4161aa1461023757806318160ddd1461025157806323452b9c1461027857806323b872dd1461028d5780632eb4a7ab146102a05780633ccfd60b146102b657806342842e0e146102cb57806351bf7b54146102de57806356ff1be81461030c5780636352211e1461032c57806367dce1ed1461034c57806369fbea121461035f57806370a0823114610392575b600080fd5b3480156101aa57600080fd5b506101be6101b9366004611900565b6105b0565b60405190151581526020015b60405180910390f35b3480156101df57600080fd5b506101e8610602565b6040516101ca919061196d565b34801561020157600080fd5b50610215610210366004611980565b610694565b6040516101ca9190611999565b6102356102303660046119c9565b6106d8565b005b34801561024357600080fd5b50600b546101be9060ff1681565b34801561025d57600080fd5b5060015460005403600019015b6040519081526020016101ca565b34801561028457600080fd5b50610235610778565b61023561029b3660046119f3565b6107b9565b3480156102ac57600080fd5b5061026a600a5481565b3480156102c257600080fd5b5061023561093f565b6102356102d93660046119f3565b6109ab565b3480156102ea57600080fd5b506102fe6102f9366004611980565b6109cb565b6040516101ca929190611a2f565b34801561031857600080fd5b50610235610327366004611a6d565b610b6e565b34801561033857600080fd5b50610215610347366004611980565b610b89565b61023561035a366004611a99565b610b94565b34801561036b57600080fd5b5061037f61037a366004611980565b610bed565b60405161ffff90911681526020016101ca565b34801561039e57600080fd5b5061026a6103ad366004611ab4565b610c40565b3480156103be57600080fd5b50610235610c8e565b3480156103d357600080fd5b506102356103e2366004611b1a565b610ca2565b3480156103f357600080fd5b50610235610daf565b34801561040857600080fd5b50610235610417366004611980565b610e1b565b34801561042857600080fd5b506101be610437366004611c0f565b610e28565b34801561044857600080fd5b5061026a6611c37937e0800081565b34801561046357600080fd5b506008546001600160a01b0316610215565b34801561048157600080fd5b506101e8610e47565b34801561049657600080fd5b506102356104a5366004611c77565b610e56565b3480156104b657600080fd5b50610235610ec2565b3480156104cb57600080fd5b506101e86104da366004611980565b610f13565b6102356104ed366004611caa565b610f61565b3480156104fe57600080fd5b506101e861050d366004611980565b610fab565b34801561051e57600080fd5b506101e86110ed565b34801561053357600080fd5b506101be610542366004611d11565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561057c57600080fd5b5061023561058b366004611ab4565b6111d4565b34801561059c57600080fd5b506101be6105ab366004611d3b565b611247565b60006301ffc9a760e01b6001600160e01b0319831614806105e157506380ac58cd60e01b6001600160e01b03198316145b806105fc5750635b5e139f60e01b6001600160e01b03198316145b92915050565b60606002805461061190611d85565b80601f016020809104026020016040519081016040528092919081815260200182805461063d90611d85565b801561068a5780601f1061065f5761010080835404028352916020019161068a565b820191906000526020600020905b81548152906001019060200180831161066d57829003601f168201915b5050505050905090565b600061069f8261128a565b6106bc576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006106e382610b89565b9050336001600160a01b0382161461071c576106ff8133610542565b61071c576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6107806112bf565b600980546001600160a01b0319169055604051600080516020612731833981519152906107af90600090611999565b60405180910390a1565b60006107c4826112ea565b9050836001600160a01b0316816001600160a01b0316146107f75760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610844576108278633610542565b61084457604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661086b57604051633a954ecd60e21b815260040160405180910390fd5b801561087657600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716815220805460010190556108b385600160e11b611359565b600085815260046020526040812091909155600160e11b84169003610908576001840160008181526004602052604081205490036109065760005481146109065760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b031660008051602061275183398151915260405160405180910390a4505050505050565b6040516000907339ab90066cec746a032d67e4fe3378f16294cf6b9047908381818185875af1925050503d8060008114610995576040519150601f19603f3d011682016040523d82523d6000602084013e61099a565b606091505b50509050806109a857600080fd5b50565b6109c683838360405180602001604052806000815250610f61565b505050565b600d546060908190610a1f576040518060400160405280600981526020016826237831663338313b60b81b81525060405180604001604052806004815260200163f09f8e8160e01b81525091509150915091565b604080516020808201835260008252600d5483519182015291820185905290610a6b906060015b604051602081830303815290604052805190602001208261136e90919063ffffffff16565b600e54600090610a7c908390611372565b9050600e8181548110610a9157610a91611dbf565b90600052602060002001604051602001610aab9190611e72565b604051602081830303815290604052600f8281548110610acd57610acd611dbf565b90600052602060002001808054610ae390611d85565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0f90611d85565b8015610b5c5780601f10610b3157610100808354040283529160200191610b5c565b820191906000526020600020905b815481529060010190602001808311610b3f57829003601f168201915b50505050509050935093505050915091565b610b766112bf565b600b805460ff1916911515919091179055565b60006105fc826112ea565b600b5460ff16610bb7576040516393e8222560e01b815260040160405180910390fd5b346611c37937e080008260ff160214610be35760405163569e8c1160e01b815260040160405180910390fd5b6109a83382611390565b6000610c056040518060200160405280600081525090565b600d5460408051602081019290925281018490526103e96060820152610c2d90608001610a46565b610c3981610168611372565b9392505050565b60006001600160a01b038216610c69576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b610c966112bf565b610ca060006113e9565b565b8282610caf828233611247565b610ccc57604051630e5060e160e21b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000001f461ffff168360ff16610d026000546000190190565b011115610d2257604051637c44f5af60e11b815260040160405180910390fd5b336000908152600c602052604090205460ff7f000000000000000000000000000000000000000000000000000000000000000581169181168501161115610d7c57604051632ae6c11560e21b815260040160405180910390fd5b336000818152600c60205260409020805460ff80821687011660ff19909116179055610da89084611390565b5050505050565b6009546001600160a01b0316338114610ddb57604051636b7584e760e11b815260040160405180910390fd5b600980546001600160a01b031916905560405160008051602061273183398151915290610e0a90600090611999565b60405180910390a16109a8816113e9565b610e236112bf565b600a55565b6000610e3f8484600a54858051906020012061143b565b949350505050565b60606003805461061190611d85565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610eca6112bf565b600d5415610eeb5760405163a89ac15160e01b815260040160405180910390fd5b604080514460208201520160408051601f198184030181529190528051602090910120600d55565b60606000610f20836109cb565b509050610f38610f2f84610bed565b61ffff16611453565b81604051602001610f4a929190611eb7565b604051602081830303815290604052915050919050565b610f6c8484846107b9565b6001600160a01b0383163b15610fa557610f8884848484611497565b610fa5576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6060610fb68261128a565b610fd357604051630a14c4b560e41b815260040160405180910390fd5b6000610fde83610f13565b90506000610feb846109cb565b915050610e3f84610ffb8461157f565b60405160200161100b9190612135565b60405160208183030381529060405261104b856110266110ed565b604051602001611037929190612177565b60405160208183030381529060405261157f565b60405160200161105b919061220b565b60408051601f19818403018152828201909152600482526311da599d60e21b60208301529061108e9086600060016116d1565b6110c860405180604001604052806009815260200168496e6e65722068756560b81b8152506110bf610f2f8c610bed565b600160006116d1565b6040516020016110d9929190612249565b604051602081830303815290604052611760565b60408051808201909152600f81526e3c7363726970743e6c657420673d5b60881b602082015260609060005b600e548110156111ac5781600e828154811061113757611137611dbf565b90600052602060002001600e8054905083600101106111655760405180602001604052806000815250611180565b604051806040016040528060018152602001600b60fa1b8152505b60405160200161119293929190612296565b60408051601f198184030181529190529150600101611119565b50806040516020016111be91906122ee565b60408051601f1981840301815291905292915050565b6111dc6112bf565b6001600160a01b03811661120357604051633a247dd760e11b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383161790556040516000805160206127318339815191529061123c908390611999565b60405180910390a150565b600a546040516001600160601b0319606084901b166020820152600091610e3f91869186916034016040516020818303038152906040528051906020012061143b565b60008160011115801561129e575060005482105b80156105fc575050600090815260046020526040902054600160e01b161590565b6008546001600160a01b03163314610ca057604051635fc483c560e01b815260040160405180910390fd5b60008180600111611340576000548110156113405760008181526004602052604081205490600160e01b8216900361133e575b80600003610c3957506000190160008181526004602052604090205461131d565b505b604051636f96cda160e11b815260040160405180910390fd5b4260a01b176001600160a01b03919091161790565b9052565b60005b60208320905080835281826000030681106113755706919050565b60005460ff8216810161045810156113bb5760405163d05cb60960e01b815260040160405180910390fd5b600d54156113dc5760405163a89ac15160e01b815260040160405180910390fd5b6109c6838360ff16611794565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008261144986868561187c565b1495945050505050565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a90048061146e575050819003601f19909101908152919050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906114cc903390899088908890600401612446565b6020604051808303816000875af1925050508015611507575060408051601f3d908101601f1916820190925261150491810190612483565b60015b611565573d808015611535576040519150601f19603f3d011682016040523d82523d6000602084013e61153a565b606091505b50805160000361155d576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610e3f565b6060815160000361159e57505060408051602081019091526000815290565b60006040518060600160405280604081526020016126f1604091399050600060038451600201816115d1576115d16124a0565b0460040290506000816020016001600160401b038111156115f4576115f4611b6d565b6040519080825280601f01601f19166020018201604052801561161e576020820181803683370190505b509050818152600183018586518101602084015b8183101561168c5760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b93820193909352600401611632565b6003895106600181146116a657600281146116b7576116c3565b613d3d60f01b6001198301526116c3565b603d60f81b6000198301525b509398975050505050505050565b606084836116fe57846040516020016116ea91906124b6565b604051602081830303815290604052611700565b845b8361171a5760405180602001604052806000815250611735565b604051806040016040528060018152602001600b60fa1b8152505b604051602001611747939291906124e4565b6040516020818303038152906040529050949350505050565b606061178461176e86611453565b8386866040516020016110379493929190612568565b60405160200161174791906126ab565b60008054908290036117b95760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038316600090815260056020526040902080546001600160401b0184020190556117f0836001841460e11b611359565b6000828152600460205260408120919091556001600160a01b0384169083830190839083906000805160206127518339815191528180a4600183015b8181146118525780836000600080516020612751833981519152600080a460010161182c565b508160000361187357604051622e076360e81b815260040160405180910390fd5b60005550505050565b600081815b848110156118b5576118ab8287878481811061189f5761189f611dbf565b905060200201356118be565b9150600101611881565b50949350505050565b60008183106118da576000828152602084905260409020610c39565b5060009182526020526040902090565b6001600160e01b0319811681146109a857600080fd5b60006020828403121561191257600080fd5b8135610c39816118ea565b60005b83811015611938578181015183820152602001611920565b50506000910152565b6000815180845261195981602086016020860161191d565b601f01601f19169290920160200192915050565b602081526000610c396020830184611941565b60006020828403121561199257600080fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b03811681146119c457600080fd5b919050565b600080604083850312156119dc57600080fd5b6119e5836119ad565b946020939093013593505050565b600080600060608486031215611a0857600080fd5b611a11846119ad565b9250611a1f602085016119ad565b9150604084013590509250925092565b604081526000611a426040830185611941565b8281036020840152611a548185611941565b95945050505050565b803580151581146119c457600080fd5b600060208284031215611a7f57600080fd5b610c3982611a5d565b803560ff811681146119c457600080fd5b600060208284031215611aab57600080fd5b610c3982611a88565b600060208284031215611ac657600080fd5b610c39826119ad565b60008083601f840112611ae157600080fd5b5081356001600160401b03811115611af857600080fd5b6020830191508360208260051b8501011115611b1357600080fd5b9250929050565b600080600060408486031215611b2f57600080fd5b83356001600160401b03811115611b4557600080fd5b611b5186828701611acf565b9094509250611b64905060208501611a88565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b600082601f830112611b9457600080fd5b81356001600160401b0380821115611bae57611bae611b6d565b604051601f8301601f19908116603f01168101908282118183101715611bd657611bd6611b6d565b81604052838152866020858801011115611bef57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060408486031215611c2457600080fd5b83356001600160401b0380821115611c3b57600080fd5b611c4787838801611acf565b90955093506020860135915080821115611c6057600080fd5b50611c6d86828701611b83565b9150509250925092565b60008060408385031215611c8a57600080fd5b611c93836119ad565b9150611ca160208401611a5d565b90509250929050565b60008060008060808587031215611cc057600080fd5b611cc9856119ad565b9350611cd7602086016119ad565b92506040850135915060608501356001600160401b03811115611cf957600080fd5b611d0587828801611b83565b91505092959194509250565b60008060408385031215611d2457600080fd5b611d2d836119ad565b9150611ca1602084016119ad565b600080600060408486031215611d5057600080fd5b83356001600160401b03811115611d6657600080fd5b611d7286828701611acf565b9094509250611b649050602085016119ad565b600181811c90821680611d9957607f821691505b602082108103611db957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b8054600090600181811c9080831680611def57607f831692505b60208084108203611e1057634e487b7160e01b600052602260045260246000fd5b818015611e245760018114611e3957611e66565b60ff1986168952841515850289019650611e66565b60008881526020902060005b86811015611e5e5781548b820152908501908301611e45565b505084890196505b50505050505092915050565b6204c46f60eb1b81526000611e8a6003830184611dd5565b603b60f81b81526001019392505050565b60008151611ead81856020860161191d565b9290920192915050565b7f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f737667222077696474683d223130302522206865696768743d2231303060208201527f25222076696577426f783d223020302034303020343030222066696c6c3d226e60408201527f6f6e65223e3c726563742077696474683d2234303022206865696768743d223460608201527f3030222066696c6c3d2223656134363330222072783d22352522202f3e3c726560808201527f637420783d2234302220793d223430222077696474683d22333230222068656960a08201527f6768743d22333230222066696c6c3d22677265656e222072783d22352522202f60c08201527f3e3c7265637420783d2238302220793d223830222077696474683d223234302260e082015278040d0cad2ced0e87a446468604440ccd2d8d87a44d0e6d8c25603b1b6101008201526000610119845161201e818386016020890161191d565b61210e61210883838701017f2c3530252c3836252c3130302529222072783d22322e352522202f3e3c74657881527f742069643d22676966742220783d223230302220793d2232313022207465787460208201527f2d616e63686f723d226d6964646c652220666f6e742d73697a653d223832222060408201527f616c69676e6d656e742d626173656c696e653d226d6964646c6522207374726f60608201527f6b652d77696474683d223222207374726f6b653d222330303022207374796c656080820152741e913ab9b2b916b9b2b632b1ba1d103737b732911f60591b60a082015260b50190565b86611e9b565b91505061212a816c1e17ba32bc3a1f1e17b9bb339f60991b9052565b600d01949350505050565b7919185d184e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b60321b81526000825161216a81601a85016020870161191d565b91909101601a0192915050565b7f3c68746d6c207374796c653d226f766572666c6f773a68696464656e223e3c6281527437b23c9039ba3cb6329e9136b0b933b4b71d18111f60591b6020820152600083516121cd81603585016020880161191d565b8351908301906121e481603584016020880161191d565b6d1e17b137b23c9f1e17b43a36b61f60911b60359290910191820152604301949350505050565b7519185d184e9d195e1d0bda1d1b5b0ed8985cd94d8d0b60521b81526000825161223c81601685016020870161191d565b9190910160160192915050565b605b60f81b81526000835161226581600185016020880161191d565b83519083019061227c81600184016020880161191d565b605d60f81b60019290910191820152600201949350505050565b600084516122a881846020890161191d565b630444c46f60e31b9083019081526122c36004820186611dd5565b611d9160f11b815284519091506122e181600284016020880161191d565b0160020195945050505050565b6000825161230081846020870161191d565b7f5d2c723d21312c733d743d3e6e65772050726f6d6973652828653d3e736574549201918252507f696d656f757428652c742929293b6c6574207a3d646f63756d656e742e67657460208201527f456c656d656e744279496428226769667422293b6c6574206f673d7a2e696e6e60408201527f657248544d4c3b646f63756d656e742e6164644576656e744c697374656e657260608201527f2822636c69636b222c286173796e6328293d3e7b696628722972657475726e3b60808201527f6c657420743d21303b666f72286c657420743d303b743c672e6c656e6774683b60a08201527f742b2b297a2e696e6e657248544d4c3d675b745d2c617761697420732831303060c08201527f293b7a2e696e6e657248544d4c3d6f672c743d21317d29293b3c2f736372697060e0820152613a1f60f11b61010082015261010201919050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061247990830184611941565b9695505050505050565b60006020828403121561249557600080fd5b8151610c39816118ea565b634e487b7160e01b600052601260045260246000fd5b6000601160f91b80835283516124d381600186016020880161191d565b600193019283015250600201919050565b6e3d913a3930b4ba2fba3cb832911d1160891b8152835160009061250f81600f85016020890161191d565b691116113b30b63ab2911d60b11b600f91840191820152845161253981601984016020890161191d565b607d60f81b60199290910191820152835161255b81601a84016020880161191d565b01601a0195945050505050565b767b226e616d65223a226f6e636861696e2067696674202360481b8152845160009061259b816017850160208a0161191d565b7f222c226465736372697074696f6e223a226f6e636861696e20676966747320616017918401918201527f72652067656e65726174697665206f6e636861696e2070726573656e7473207460378201527f6f2063656c6562726174652074686520686f6c6964617920736561736f6e222c60578201526c1130ba3a3934b13aba32b9911d60991b6077820152855161263a816084840160208a0161191d565b69161134b6b0b3b2911d1160b11b60849290910191820152845161266581608e84016020890161191d565b01612688608e82017211161130b734b6b0ba34b7b72fbab936111d1160691b9052565b61269560a1820185611e9b565b61227d60f01b8152600201979650505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516126e381601d85016020870161191d565b91909101601d019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974daddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
62f03b4b8a2082eb8be670b3ea6d07716aecc59300f123046d1dad881bd34c9f00000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000005
-----Decoded View---------------
Arg [0] : allowListMerkleRoot (bytes32): 0x62f03b4b8a2082eb8be670b3ea6d07716aecc59300f123046d1dad881bd34c9f
Arg [1] : allowListMintMaxTotalVal (uint16): 500
Arg [2] : allowListMintMaxPerWalletVal (uint8): 5
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 62f03b4b8a2082eb8be670b3ea6d07716aecc59300f123046d1dad881bd34c9f
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000005
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.