ETH Price: $3,365.15 (+10.64%)

Transaction Decoder

Block:
18424644 at Oct-25-2023 03:40:35 AM +UTC
Transaction Fee:
0.01893664118324331 ETH $63.72
Gas Used:
1,325,047 Gas / 14.29129773 Gwei

Account State Difference:

  Address   Before After State Difference Code
0x1B2F51c7...fB3105722
0.02854877 Eth
Nonce: 0
0.00961212881675669 Eth
Nonce: 1
0.01893664118324331
3.366508871217741461 Eth3.366530087679498693 Eth0.000021216461757232
0x821f1b08...86d140d1C
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 22343941647263988636371163835616547016723374530820722592819384656694319932755035751148006930428554518023748422091090254030704818173715855644349037308203826411652186831495344786707038489647833206572500950635706795684513447340097377039508422917108259335750371009497708588430234661354404428200336537513347182336277294477002886162447273335525035169106883692051346752322457859355184523683304052343440684819119757367522491408452064584110167958717968308708064648152088713301693232256271347180198675088417208477635137057653026994307464696425865032601065151402861943792103887680463139767938700787829944659628643515711931722247224137826106891385639329855678526128426912005753466634648506606727413374964890038818911137320922208073517755314234530153959166770741973989568013639766738843235605082345482630117425105927492445724916755990905172402762976125744707377549806530358986517227505874869157517810968466422283975983193523230670841085617213013094646701534034332618523311261017395719873496839730846951662692779751954201981687088470968756141476880387291731547526278447791183086350373287328937146019209429131831796386764259394868253889617610429556199031113654034470946611930845499869579348225657177853907892915019312455830307701411906236638417881023370414157458163171391289012660717537935375989302139669432111872019276821331354554206758836731187940908822469014742970400484510432539467644276797005108393000217819622898597959087563893654822124050782769602293570699639584947326424875456324356723171810238335678117706359426867493135419537637943859309304918156638668587593442180727408683620240044197625205752077955631327992058640355375626694222279047478497575709847568442424711003555090832518816830960082413154206874325466744152699906490510765094760063938627884125372581758036006545543284939506357071108181625569682466610676441335765743063246918134020879403009706450695249221693120833988497294840410384374628551070044729826051720250198449629020167900204295066219016272803783341565579323965186014774702330076291657775490895139957801277082855936923134181232324379107423596501548422230782432269923282412790443929314923557622779332104499760430879818926123294691622665761533480748272426686794479575307359680905255763063206980090187657056114129886155493518518015346702348251072134564259874224723683866008008364310540716340645074338268111905901247993243690208980160946289254063276894584455439350276002046041790685108047847517740976042623382258981504006058906086785489473622203701154451846722035647999980029677449269611051511049050183662841741755546942522536421482576045412235846249715922486518237933598740362335183208684495569369187379021523771793229950360781497498558368539165230033394852832685406579682633092140938983187759952168046321165991727220609663532070857952129869101643174611680616447609443928908334653508879247753424763859420926345532023734273784986247226754730389081499711969111833857019516500538673163614334094078098477262736208515034005122742115315488909852598076850190357520309780431818763417965820167021434026735202068318979223324493987047193263909845480639708169204811359496258472465936992158184842763349837168506183847490671993363599722652566718629319135074845796125421222129332161053452216636449328109733357407175066782156832903089838236605886108312606591731724781291801360289349638716426991191306594233422116424615162007740473639921191940558735349311793198156317267133031569685792469380492566801983594171153994882941351937864179362003118850488493684110642018752299087587255145288808093248727388989159504914005742592452675133959134535001616673707915569960662737851117527160204359790119914774794647561144392812906557805948189126583983212738333472299341616155527354032814457811798344813731466688960084610411263829941441579072673559457290822314023249676182726675337747018262013019292222483859512619975678735288834963017049141921718298528047966965659972496868352321880769660228800054507859151317879764082026527113195541872551565541042926507837216341995622706772207567465978228389059107556037697607086197252771818902239114471733287862459359049284657270172507850856284853581835702237228717738016506968358413442850772756641637015820071819076538981545505424362289524278240122511313365067230488272552047492659889913904407560772353811405742564626272767135312837590898589972627311620241553039462098274404597339086932885092349205360894275830795578267842634772360985169897122219153025492111547116541067014570206255145354449842162147212396027254182100472648790788480994388316410876027739511860957833272962925161288259855740592308434405914884993247799858689923285125044663974284333361296058535157185613987366692959737172837136920013693762818044531676533916435826769666675536492412463516897939404419439037950005249754896242343266744646115828379234920598339614961103587665581208587579909457322201419213031898055527683855918658755515963633690188842123055977179652527508207792881209496907722654803655234955708226589575316383029333366762273489577495429536727710835779256758085127544105968715116155181700629857776229190917246902977810083259275531076990504789435522873325222360316592839010877575545601192372610381490015504756459660702154579996343936987425429143565954192929231254901082627543971421387968793532984459188786197582535116375963850371197762035766348366652252614002819361931684574961012251251405762874811847198447565055365751758578818360589274078404634355778040874913216072928528339565135353195838846778515796300214487462053836062847126494990090480381034269468469353695035424885337031599228985020794090022616808926642714053002249883565427403340988115876838825584345926955710281426426486619904678301758171526036838491071263516303174334352963302896687064345789586593731067911018674796932577603429433336432564323783437588166714602156873745507556542134769249812945394008493012753045519208096297120862201115288718262652189320932232412326491533536826125845523620406413133239247223825204556518822881437440851317480502444379423970505118290868596611770534238159156977229062739509366970635401096946448211773351797594455258900065536258599395505925329620164803695458877027445332427067372429649528331128908126438463063404965409978715554007554638499661110286406639615373074106785034951514489751213570149635081674818643725236168326133068132278393368671470378960015039399538961302488168163092487058032105669576167986036604200282182041782541828168657456132734437873390725575489346153709066417756824001798329441697467766317229310052330942625335488580053187752758530342766521411654182812838309034352705790813108043772322961238040891974723122488699839641350199346032407275275896520285886146137301851568406703230936876773958442799285017404300565990659555552225474414077785401402138794914547903941037505935361711350692524776094657450011420486574789941273493419609977570030810749720999403140415266044674652459530063182154377858365163824908705186693479241528197559820447442649285783774438188994952488913085245722396940667955393920142332926605634006662887296057635227129331622727641628618864519375265421311567414293174192988018463846063506783827751456698456231827114107282625627642523267194751204719452544346167917178383318321283979935466466945011949458677759205682989270709659228678823617557909002748729959491066834687106834041700316979498162074027218669557885968055459938541768859220921768374195047505308306854608122713743907626858357193248485503087635746193466859697601540175252443627198262156626910445855161094838722318627134102687570703033925476357126955707792030468725698111693065994591789771393359898512381027554739097201174459922254361509692114204058649161095224120962647419615066512463101658091651924202992823613977140087258574741148784482008624150966983345417269126305569231620622858419539305553525815375946421260415915086065265464439842801262114992576310369595394098511388833783012490223020752891318624065383269587403694299400088713645871087238917323755246191184857312933814193045749483473796550612167187622758310305119932968477063323020498289777578227575033749330499595244171726367563941843731454353907708704215990136668446747179738121139574326487669598098997945120994058821652764698181526551731571421606045683855921221821720991596182711081117468750092173001379290946156699068217579146193860622938612884428153058110490850188514809499744806131972574323951177696798682834717435597158673248409980527168699226397783176220934816980186604170168668515886314512416745688507177174194393360943666281984575869058844590395818269996228802695318517700640022815338056006563493510153132026028573304658575433253345501923119533673657536847269539881205602351652604521792584753060131052400955155355775492351090695142073781690489128894262825092176721551514743865145245800223182364693154535511368925862368671893774106478620369675624820866676087228328969930389169748085463552723379862401640240987673161097720824648657389691563536291237838275175158702189059107881403906372818151610952449086933955399299324921634918302426983661280298380473403976426187711096978531087593614593465625137952673686280162821752939494090644154086492823596887016277815492088692693858876286706709191156587920472001517639266293067104054527921697373645322751186765565729028054094603289459132519848684609185895686684657395492840759055996461833355236911326067331283603542838671647873682280287250733848912406492010431456961239044990750915750351123738885065032075082481214165050286405679275529164582163269651443867410252023687316513797931578404480419500692595859301840546615912018346824698633254333544315097601569349918719838446999924039593407414908063271800685481105633927112707781376941167771090507464139676659398981640331209649861709202746272650537378163629765121278339850758268781865537905388459032557129519243856716359818111815901562797464377757764325375006704731821928398922379118625992375345275245336093640682522085987562524203525844932140216449838030992436279131993710074865360528771551362101620038743499518197547526466657863983920401425434564431459559263670470270579159586998109087908888420365636928099606211298834297719715429795056826690503160490686206833458433163086651906127797162888745291705813198476553542657173884910753562895864803194532687793972258049640209269573975569377862349260821987315277862395046903192975866745153408598810116130178033102260045410074688212940960582683084126654839114535875215265755487862248713314036652521183345380836229091186659378776500463312561934691527740827959688048825994932367760677454333355240501576870154571796063669073159111532255857715088238683510913213178422291449885143271416436892133941254665839689333905175621493186067029541041304388995940856401487772323183295623856559386624809188396497917078041827186799552736535184189240027888529152797983995616181593469834069682418030070847433857323931525539280868767346980834004695823375639461587492553470521361696466882159177996972583105564571164770641767733629865396611411784704824963978787480239422496703590668739754639950238291325580982614917267774341281647552462751788283170601186297204803211904451774085624408561146205920527963173143838476484067750664235206854003236360062612455586202138065556569806431363554062022276295437700751906217937049865605281319167889156324670697980005884481787924225194339087674669669644583093677710144835989107022313650831397988007193611117545278666535198605525026032520501945371171366670357400320224968440810572775902482675855282267288030575583345030662951120661915956836459867940658842372301388536304088933728884841060150544266515385734065611352831377159965322022995626532432269925193415433023516168643213467246783228708782827507512555693945021659145296968316901836217097958058972917733951954533329422601245734488542791834356825523837389077321773746855287229781054330443217520098864799670043720534164752723265924517512136270466600224205907045800795799312429393757932295027651282494306276875067231081999046968683681912894249281910022810878071051451582660938730074800092892258390141305391473778184841418999741228767427906347627821604282474312709085395932332135483622840367403597394657392619322396242308970139514089812728262998404403431768334531814392995454446712658393288557627618247545176028215918028825269688844108744392681350994906861706788732845293619

Execution Trace

MossadPunks.611e6160( )
// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;
/**
 * @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 MossadPunks is IERC721A { 
    address private _owner;
    function owner() public view returns(address){
        return _owner;
    }
    uint256 public MAX_SUPPLY = 7777;
    uint256 public MAX_FREE = 7777;
    uint256 public MAX_FREE_PER_WALLET = 5;
    uint256 public COST = 0.0009 ether;
    string private constant _name = "Mossad Punks";
    string private constant _symbol = "MOSP";
    string private _baseURI = "bafybeiec4ful4xijwycygc7vdvpxyesg7elm2yq23ascn4q6rdqhfurfym";
    constructor() {
        _owner = msg.sender;
    }
    function mint(uint32 amount) public payable nob {
        require(totalSupply() + amount <= MAX_SUPPLY);
        _mint_complain(amount);
        _mint(msg.sender, amount);
    }
    function _mint_complain(uint256 amount) internal  {
        uint256 t = totalSupply();
        if (msg.value == 0) {
            require(t + amount <= MAX_FREE, "sold_out");
            require(tx.origin == msg.sender);
            require(balanceOf(msg.sender) < MAX_FREE_PER_WALLET || t < 400);
            require(amount <= MAX_FREE_PER_WALLET || msg.sender == owner());
            uint256 freetx = (MAX_SUPPLY - t) / 25;
            require(blockmints[block.number] < freetx);
            blockmints[block.number]++;
        } else {
            require(msg.value >= amount * COST, "more_eth");
        }
    }
    // 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;
    mapping(uint256 => uint256) blockmints;
    function setData(string memory _base) external onlyOwner{
        _baseURI = _base;
    }
    function setConfig(uint256 _MAX_FREE, uint256 _MAX_FREE_PER_WALLET, uint256 MAX_S) external onlyOwner{
        MAX_FREE = _MAX_FREE;
        MAX_FREE_PER_WALLET = _MAX_FREE_PER_WALLET;
        MAX_SUPPLY = MAX_S;
    }
    /**
     * @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)
        }
    }
    modifier onlyOwner() { 
        require(_owner==msg.sender, "not Owner");
        _; 
    }
    modifier nob() {
        require(tx.origin==msg.sender, "no Script");
        _;
    }
    function withdraw() external onlyOwner {
        uint256 balance = address(this).balance;
        payable(msg.sender).transfer(balance);
    }
}