ETH Price: $2,241.40 (-1.12%)

Transaction Decoder

Block:
16764790 at Mar-05-2023 09:12:59 PM +UTC
Transaction Fee:
0.033902318975316282 ETH $75.99
Gas Used:
1,247,086 Gas / 27.185229387 Gwei

Account State Difference:

  Address   Before After State Difference Code
0x382c30b8...c03791ecd
0.05 Eth
Nonce: 0
0.016097681024683718 Eth
Nonce: 1
0.033902318975316282
(beaverbuild)
91.896202636438008962 Eth91.897517515973434778 Eth0.001314879535425816
0xF21D88C5...ff7CFcb8F
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 691398875191582982652481357057401643346086430455554164331783959275457846964671746861914608687954933400122502618216445083395254420323793523296310919788275556712758046131412609616245232707365786276733084391969328094950535865053273434132772043149605239265073438628724503325961255127517282437429791215154791501645200089102676172299872974458603212060514643977643920751994323497736247124535427875515974943144708872988412714526733587397372075278461800037945647185298393791878937069571348069326751910171788461797983250895384999340102515548236412921280357593477060484331726976385789189862711457877562995224669121726453873411509279914573493749950990068410855182240240670786262541251394351893912034518498868050442445490109129382330234436354813354751969130367581382618727783306056906823475541143475263909183355786939668423524271362656043242688910716244954045584704455530406699295524904868699172412784329922126270150905644400232152397751760532863657347681988670900893477645038949945930941437366730037081314592088569290794608616600542537112477015069778986848233746205852851875422694513899311316520233630434544430908348154046176800006894264667303843833539714281099031325241896479314204924672260923013937464531179260330932916065280624303550053613876515234626172565005569397605881197948738311601862231797582071852665106113103175711095684580631531129988492450064260959960066435776353135131763597391066218596114719564573833161929930839881984824227082141074183642487267499250808724867702217828874453763126411361680355518414919042590676131109051918446136201522269200552935965131704943980922422234417197456553906365268902527395086976888698201555263792024323357040954250278729306641356670524322763912443387004215985120252841649373660142474823314171514370123730734508613166102940460186419645357910693123257158416123778208639889465638878896312391073953879365126029844248572660700141043262199676773484231370081672546527782648605313956054318538143205796931955776285312089514885064280463842977136516829144505418419723235361023860508195792635750228411770446488150676254052436522072902487873883622156884541008312207938161565040192256030411646308672057956174588615933159989045461379058935999758799982422433656855051525048447298415683347588355598002545120251335703914151919239107827702653685061695230525836253996202584482821387702477082602123138082654197234895808315542174250349058318399838080357489399689291922164536776896081796689829465547999670904784867801625781319114042594708481705662732772906790833916373206397854353497032025458456529079318424814869861204978312952267080477219705770397269763788077337772320435510423369041212090859565324315029241003547093872312101101208697685959537974480859655662517923003622624623261812626899772288409659020081430011646804139390994746602291766264620810095145539886056699187891633306645663321147126716185190271193157406478422691068484765092196238297849545508501521062102014824631074739032732993582399903238357372490383460906825177693142874813127876139295937694633315110462993515070556396483722155198610981747754500384318390948968300574684089762243772169460705170811094384977612885027243675978723920953977399856363865454879084761087594158523666777627159728569281427736725441015321299452398374452542453333970009942410969185609870818208405351676558084099530710143690072115431314694769820225002197887348957494420637244091678389069438114747764233195683932248076350640533527665793852660696034826409628521197189431608502580133551200239995331915821803232131752516791424554087836697069231049547701798026213005159907414435878778887607539962013007628107017841101421075939117352009095101486859482619906865743559129096327617409494503186284288330125375011689288264288093690444734074074217400239604536453136954576727558954657999076891554694713312487094964129530195894211896959474052853577626191106143125724529945335570869770919619006999388387934474955715464632806524885956783186467764571457113967862570250444695482704600115736122783202218342160006072379268015313637225200639893549793251922416378785105732055518186928387589056980263946849222227273190973425844537513995304114777322450208708974381259974332678219016636337455659611147594897704351731118528458022316868571436403349061253968013511350556530008221406221460126769228438654172813659777951625970902338748121792381485912798022280481201797710972853005510741879605975477998112573358627469248564510543159547649891465149101321642539821745068063566473419513835069859385372286382759362162757851294683267258376808452088950548286573960865623344450310072609538964366253743476521613129411485455917657071934034343399523714137257130211701682278738840122573170962449994322092115152605402580648105838500312088829030530493998577518604902003908454929916119442814817371029985442788452051764502971931766342978327176416547608918392293159271925296459998136294595422698605619414284001224426630779221104818414104923612616588906570019870214953203184354054593882371081776652483290168276144322911446837075160959902250898258390946804965836863486713123235844606798506521988660918369848468442288218483272475841073707473508502095496900243622497894379769444487289410820664900964600184119436267663665807373243372576238621750843672723441729396426681106759167449335028221307352865531447109421104008733544162358839662396044320131873913482046455764333732036498388917385423782766835706603389921690734500918845557511626263390672978579191179864456451030986758358976007029014297854272435644576427487589228285668763412586483272877145273428556447793876234758084767667576137002374137426204906654382764559617243814086920755046783329384237890099833402429951843323449919636527016499272978646211631313882350600739482603394928409888602144447533914057039765201745146473632778413370099139989565226171778604978280957340752600142490305978596636066885357926735652542879525144746388042819548627450745397407509088475689567283507972013301479074618496449153452352570998474519893876182399022885593872715032179395988442776982171907425526377007025793325546876514276133960417888766478306546661182973890325981959706841019369985464586269503037160072219787538415779000305775970818926102672073867334842236976012302346638048206777153007573228997511113736158799620525648254123231428320070226467238397083347719474998345672942162516956326843788773341554983742191157186604685533668831915317354828962122924808463709416412281868543616334395828213449197582030986769226862771392250212144805488342521577000315269567981359783034023717018069114235815525562061746178313278115936161642035629014774928298039647904670581507507011390233825717434118115791375118786843945468275460760902225033163623703210640483560558218886302514898916579251710444279593796457772011313402043134824948587318047584757056136306950995136228615848507822191209416076769452749657240974548014661187904860140409807360656295503959635859920148177504493499268951735329836141743509398492941612981926739617550499253962619766879636833379019070984052819907718300916883214056490600576797488351514235633927663307163936798267812494101763597196352234355910947638664632923265213358896381905766155384257367812363070880509827120059444918210970076547353337149796191740625337391929912704927941020808843681952278150225757806360741399254502924167429702161477180949209760782844289926322772025754619285469887913514159570398519699150898551301706778135188215968091234577855440646808286630566563933673328894223073138894286008246773790958915525436710468340805017009685357316710480699362818248825670991318883013098772007405127387086939959216074956933452740740288093264582830374186336993035843085888925822754488626002200503477015862039446946092225490651709925554515762594021629792501225815378663144066201832328962666070904921673578065678523096073705707309660337351087568016877828001795665956206100114075118379915536441711156521038462641048534575266674177658385975130261000233928525265014625952160491490497432327072915646347034924967030046712345050421917789393594199969321735354844211107880960411748714790950694057251703105732981706916209798148128980523626439194344376599686932574374444914274137401934571453450983483980903718064598058916655739998065657321318682784171816852114298591340578164037289520789734049445888759118626493118948852945544427911611768115463382439492774376184965560600261521100958931927369530293158931251945223963764695915291156488293460121212982070479331741194085962674729354972511905877395747772536155501319044500666109093477274457360678992493638628294824154640276855307829377754538206224277878088973341618967624600318657230371874497238680717896706423561420648349774479804600568869285089710785195460557744113657979802835722566186600476160310244450927867138963633278732575668613893507998339630210928882971915755895451457247951429181191202835575519956589423955585742089761224453850620277067658756325125911365871444269609815264373534491061943960465121410001519691696558254672858141374953348687567173877605858201004073054577355126235854487530659011027494557673476359954219489054524601274814299768812456333826032998324689607766031718203498587222978195803731699110564070559117484937353122497155188243078810386005432776405118537406092655169038912090367824661886841397196908848236944995673427758644878491367709584496254532506380946713103901091121658776957386144113570455376261972880698593058089609654844953413567800772256473717538982520799357118739933960732113594276827090089529665362119981196199133616519026881417558167822589150354298222364304137020851055444243958825323292987144383908928364334056760643722418023170690385115956653096935298647568982238063284775901143983726127306635546963590733128525225808381974556998060425790241748427330062771031846119601087507435527021181615919506682379403735995278858844973181371934115376236453067458915319600377459330020203605933610278396303018337098742854565604051809573908758515588263348715410838555390645349613956140509857641596572234515964809638624328160605993816274911877070791612261294824866905297023504156997521731131531978437252395676065506687331123716188986589560050905045050034826689248653134888053904841442421220008724578309519509563639679995035298316441138038841374901217720656338344764987171647319722906401289720348436214582741943535387996481577950879511539414755299323926424810670671595789721773571088371812675449728080491221864648137887451165741843685702844829199065390827560592730415345121589334962173995931962997498130357280114995564295033497307823805886710989641906169942438999332552810922211957200946366340043551641385573832227038190430906827782648153212633192108531417803875083167492358937529330728621277563302213605552264709652897557167561083156160286403292926895677389907574792447103090132422561528677555246245952899430546537702621045177463501110291236459987745458964609274450750815535032444792125707411834181158116531696493716921788958855699191273959951183520279291775655436163028035344141908266158686457636316466519887655070764160059083780593486334860321384256849500289025852220718653280134107561753677352502453562110181910685029604074795638471182996586836179614082587120311814005134967772418921173691507255563217718290430388726759846649096755532120515748748343103446097772138840014188010808008420761230331229998351098411660684570210641485728216058527705059157989215162318564498224794963356269282792040587017863533711138518950156817424344631036651425246270720365040642014922749188286673298726502807193035163964815675112975719004223168578367234288692752401285445898297060305801980709390427788475279117258515733641781996317444038710727166206384582530730534953734986845289639279059355667857459

Execution Trace

PASCII.61025860( )
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
/*
 * @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();
    /**
     * The caller cannot approve to their own address.
     */
    error ApproveToCaller();
    /**
     * 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;
    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;
    /**
     * @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;
    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the
     * zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;
    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom}
     * for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;
    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);
    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
    // =============================================================
    //                        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);
}
contract PASCII is IERC721A { 
    address private _owner;
    function owner() public view returns(address){
        return _owner;
    }
    modifier onlyOwner() { 
        require(_owner==msg.sender);
        _; 
    }
    uint256 public constant MAX_SUPPLY = 950;
    uint256 public MAX_FREE = 600;
    uint256 public MAX_FREE_PER_WALLET = 1;
    uint256 public COST = 0.002 ether;
    string private constant _name = "PASCII";
    string private constant _symbol = "PASCII";
    string private _baseURI = "QmQWP52mjtdTiMxDWbcVNY8j9nLG6XXo791QAxkacTuoNP";
    constructor() {
        _owner = msg.sender;
    }
    function mint(uint256 amount) external payable{
        address _caller = _msgSenderERC721A();
        require(totalSupply() + amount <= MAX_SUPPLY, "SoldOut");
        require(amount*COST <= msg.value, "Value to Low");
        require(amount <= 10, "max 10 per TX");
        _mint(_caller, amount);
    }
    function freeMint() external{
        address _caller = _msgSenderERC721A();
        uint256 amount = 1;
        require(totalSupply() + amount <= MAX_FREE, "Freemint SoldOut");
        require(amount + _numberMinted(_caller) <= MAX_FREE_PER_WALLET, "Max per Wallet");
        _mint(_caller, amount);
    }
    // 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 tokenId of the next token to be minted.
    uint256 private _currentIndex = 0;
    // The number of tokens burned.
    // uint256 private _burnCounter;
    // 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`
    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 => address) private _tokenApprovals;
    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;
    function setData(string memory _base) external onlyOwner{
        _baseURI = _base;
    }
    function setConfig(uint256 _MAX_FREE_PER_WALLET, uint256 _COST, uint256 _MAX_FREE) external onlyOwner{
        MAX_FREE_PER_WALLET = _MAX_FREE_PER_WALLET;
        COST = _COST;
        MAX_FREE = _MAX_FREE;
    }
    /**
     * @dev Returns the starting token ID. 
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }
    /**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId() internal view 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 override returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than `_currentIndex - _startTokenId()` times.
        unchecked {
            return _currentIndex - _startTokenId();
        }
    }
    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view returns (uint256) {
        // Counter underflow is impossible as _currentIndex does not decrement,
        // and it is initialized to `_startTokenId()`
        unchecked {
            return _currentIndex - _startTokenId();
        }
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    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: 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.
    }
    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (_addressToUint256(owner) == 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 auxillary 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);
    }
    /**
     * 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 ownership that has an address and is not burned
                        // before an ownership that does not have an address and is not burned.
                        // Hence, curr will not underflow.
                        //
                        // We can directly compare the packed value.
                        // If the address is zero, packed is zero.
                        while (packed == 0) {
                            packed = _packedOwnerships[--curr];
                        }
                        return packed;
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }
    /**
     * 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;
    }
    /**
     * Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnerships[index]);
    }
    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(uint256 index) internal {
        if (_packedOwnerships[index] == 0) {
            _packedOwnerships[index] = _packedOwnershipOf(index);
        }
    }
    /**
     * Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around in the collection over time.
     */
    function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(tokenId));
    }
    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }
    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }
    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }
    
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
        string memory baseURI = _baseURI;
        return bytes(baseURI).length != 0 ? string(abi.encodePacked("ipfs://", baseURI, "/", _toString(tokenId), ".json")) : "";
    }
    /**
     * @dev Casts the address to uint256 without masking.
     */
    function _addressToUint256(address value) private pure returns (uint256 result) {
        assembly {
            result := value
        }
    }
    /**
     * @dev Casts the boolean to uint256 without branching.
     */
    function _boolToUint256(bool value) private pure returns (uint256 result) {
        assembly {
            result := value
        }
    }
    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public override {
        address owner = address(uint160(_packedOwnershipOf(tokenId)));
        if (to == owner) revert();
        if (_msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                revert ApprovalCallerNotOwnerNorApproved();
            }
        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }
    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
        return _tokenApprovals[tokenId];
    }
    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        if (operator == _msgSenderERC721A()) revert ApproveToCaller();
        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }
    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }
    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
            address from,
            address to,
            uint256 tokenId
            ) public virtual override {
        _transfer(from, to, tokenId);
    }
    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
            address from,
            address to,
            uint256 tokenId
            ) public virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }
    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
            address from,
            address to,
            uint256 tokenId,
            bytes memory _data
            ) public virtual override {
        _transfer(from, to, tokenId);
    }
    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < _currentIndex;
    }
  
    /**
     * @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.
     */
    function _mint(address to, uint256 quantity) internal {
        uint256 startTokenId = _currentIndex;
        if (_addressToUint256(to) == 0) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();
        // Overflows are incredibly unrealistic.
        // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the balance and number minted.
            _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] =
                _addressToUint256(to) |
                (block.timestamp << BITPOS_START_TIMESTAMP) |
                (_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED);
            uint256 updatedIndex = startTokenId;
            uint256 end = updatedIndex + quantity;
            do {
                emit Transfer(address(0), to, updatedIndex++);
            } while (updatedIndex < end);
            _currentIndex = updatedIndex;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }
    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
            address from,
            address to,
            uint256 tokenId
            ) private {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
        if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
        address approvedAddress = _tokenApprovals[tokenId];
        bool isApprovedOrOwner = (_msgSenderERC721A() == from ||
                isApprovedForAll(from, _msgSenderERC721A()) ||
                approvedAddress == _msgSenderERC721A());
        if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        // Clear approvals from the previous owner.
        if (_addressToUint256(approvedAddress) != 0) {
            delete _tokenApprovals[tokenId];
        }
        // 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] =
                _addressToUint256(to) |
                (block.timestamp << BITPOS_START_TIMESTAMP) |
                BITMASK_NEXT_INITIALIZED;
            // 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 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 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 returns (string memory ptr) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), 
            // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged.
            // We will need 1 32-byte word to store the length, 
            // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128.
            ptr := add(mload(0x40), 128)
         // Update the free memory pointer to allocate.
         mstore(0x40, ptr)
         // Cache the end of the memory to calculate the length later.
         let end := ptr
         // We write the string from the rightmost digit to the leftmost digit.
         // The following is essentially a do-while loop that also handles the zero case.
         // Costs a bit more than early returning for the zero case,
         // but cheaper in terms of deployment and overall runtime costs.
         for { 
             // Initialize and perform the first pass without check.
             let temp := value
                 // Move the pointer 1 byte leftwards to point to an empty character slot.
                 ptr := sub(ptr, 1)
                 // Write the character to the pointer. 48 is the ASCII index of '0'.
                 mstore8(ptr, add(48, mod(temp, 10)))
                 temp := div(temp, 10)
         } temp { 
             // Keep dividing `temp` until zero.
        temp := div(temp, 10)
         } { 
             // Body of the for loop.
        ptr := sub(ptr, 1)
         mstore8(ptr, add(48, mod(temp, 10)))
         }
     let length := sub(end, ptr)
         // Move the pointer 32 bytes leftwards to make room for the length.
         ptr := sub(ptr, 32)
         // Store the length.
         mstore(ptr, length)
        }
    }
    function withdraw() external onlyOwner {
        uint256 balance = address(this).balance;
        payable(msg.sender).transfer(balance);
    }
}