ETH Price: $3,814.65 (+6.75%)

Contract Diff Checker

Contract Name:
Tomie

Contract Source Code:

// SPDX-License-Identifier: MIT
/*
M#..MMMMMp` .(+MM9!..gMMMM9"74T""MaggqHmo ?MN.d!dF.M<CdndNYGJ@^  ..J"1(+g#BMNHgggJgNNHHmJmJ..dHMMMMMMMMMMMMMMMMM\ ({{._.>.(YWMMN#9!(#MMMMt .(gMM@1aJJJ._ZMMN(mMMMN@?MMMaM#^.MMMNdMM]
[email protected].(MF! ..MM#9>! ..JdMMHMNe(TNg?TNa,MMM Mbd#J.NMB\d=.J!.kY1JMMM5(MMMMMM9YWQHMMNNMm+gMMNHHMNHMMMMMMMMMMM#~.(` (?jWa.!:?TMMNYHM# ._~ .,T"! .("TMMMM@^?MMMBYNe.gMMMMNxJMMYTMMM]
MM"""HMHMNdM) .+MM5~` ..W"!..JNMMMMMMMMMMMMMMMM&d#M#[email protected]#<d#QB'(QgMM8~.JMagNNMMMMMMMMMMaJ/TMNMNNMMNMMMMM%?(P(!-.   .TJ!.!Te  dM<~!`  ..(&J(J<7<<<_(Ng=! .,,MMMM#"= .dM\ .MMM]
MMggMMMN, ?9!.MM=!  .J"`..MMMMMMMMMMMMMMMMMMMMMMMNMMNMM#~dMEGM@(M5dhJHMMMHSkggMMMMTHMMakWMMNgVMMNm+,TNgMkM#MMMM@<1N ! .:    .4/ .(N!   ..JY"31-?!     ....?1-V"^   _""   .MMNg,.MMM]
T"=`  dMMr .MM=   .#= .dMMMMMMMMMMMMMMMMMMMMMMMMMMMMNjd#dHMuM#jMX8dSBv5J6yGYT5c(77zZG,7HMNJHMMNgTMNe?YJHMNMMMMNN&.d; -?.   `..?C  .mJY=<.JJ7<..gVY7<_   ..gB^    `  ..,?!   4JMNMMM%
   ..M@   .MD   ,d^.(MMMMMMMMMMYTMNNMMMMMMMMMMMMMMMMMMM#MS@#MH4HwdG.^?t /(I,(CTTu&-.?1Wx4WMN(MNJTNHMMN,Tv"MMMWMMb .N!>` ..?<!  ..d07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(.   < ..4dI('   ?TMMMm7_.v+-.THfTo,.CTz6uHClkzV<wNxd#WMMMMM#tJbH[
71MMMMaMHP  ( .  ..1_<i.   1.1?NMMMMb~<t-..     ~w>)((NMWk0zGvd76?jWSQMMMMNMMMMMN(MHzWMN/MMMdMNdMMMMMSRdMN?hdNj`JN[1    -_  _1J.      ?MMNx(,.. JH2Yl/z1++>jvW(H4x.(MUM@MM@MMHDqNMX%
NM#: XMN(Nx : dNMM,_~o.(.` .(.(64M#ML..1/   ?_.  (tl,+TMNQWI11l7V1%.qNMMMMMMNMMMMRMNb1WMb.MMMMMdMMM#MR64dMLjNN  .MR 1  `j;  .=d         7MMNZ!`.,THo_~2(>v+Z~1dXZDZJMXMbM#(MN#DHM#M[
MMMMMMMB9?"<`  dMb.. _<, ?-. .-.?SUWM&.! .!!~_.._?F?<_ ,MWWk+<?OJ$jMMMMMHWSM#MMMMNMvMRvWMp(MMMMNMMMNMMNl<dMe1M_  MN. 1  (z  .?J[         JNVY^  `.MM+.>z+vj1<.XD$Pw3MMMdMF.MM]qMdNd[
....JWa....-....(""    .<. -~. <<.C-,p._!(.--.  ..+,.~`-cHkNb<iiXWMMMMMM##M#NdMMbMpNJMNdNN,4#MM#MNdMM:?RljHJNM[  JM}  ~. 1r_`..d,` `     JMHU!~`  JMr(.v11Z+C.ODIt9(dMM4M]dMM}J#JMN)
MMNNgJJ-..?"""MMMMMNNJ.,._.   !.-- ~ ?e.(7T,~-.  .,l<?- ??NhOr_GdHMMMRMMNbH@(dM#NZNyh,HN?M#,dsMNMMWdMp ?p1ONXWri ,Nt     .N.  -^&    `   MMK??~___jM>%+1v(z1>.j1zj><dMMdM%(MH!MDd#W)
""T"WMMMMMMMNgJ.._7TMMMMMNaa,   ._~.~.,N,,^(<~!!!~~~_  ~   ~ic.gM%dMM#HMMR(HJsdNdNXUkh.TNJHJZMMMkVWLTM[ X/1O/vMsl Mj.    `?Ho! .V<,   ` dMMf??!~` dM(<O1>Z<1:xV(ww(!dMMHMld#X(MIMXd\
          `?"WMMMMNJ,. ?TWMMMMN&,   _`  7Nc .;  _!~<j(,._   .wdMNMMMNMXdMM UwdKMLvHn(vN,?WmWJMNMbnjBoO#: N,1WzM/l J|3`     .Wn.: J3&...dMV9x~?!! (W8C(11(I>d1II(%2( MM##MkdXRd#jNMd[
 `~~-.           ?TMMMNg,.  ?TMMMMN,.     ?9a.,(  .=`  (, .dMNMMMMPMMJNRMM;(1OMHN,?Hh 1Wo WmrWM#MXwdcSVJ-,@.44.U,[ S.;       7HR.>.zFHMFZ???!`~ (Zz>:O>>z1+r(((P.[{.MMXWM#B>(M6dMMH\
       ?-. `         ?TMMMNg,  (TMMMMNa,     ?TG.J:    Z[ [email protected]<(Wh.(Nm.WNWdMK7cvI-?vs.z/JIh 1,,.;.,        7WMWgx((So...> _1zCv<(z(<CcJ>; v ((`,MMHfJNt.M#dMMMN)
          <.~.          -"WMMNx.  ?MMMMMNa,    .=kC  .7(~+MM8MMbMMMdMMNkL?M;?gNHMN_1.CH,.WsJMMZMN OcZJ.(0X.t.xJ<.!(.(.(,`     .JzidXUWXmwAeoJ&uw0Z+IJc(<<<>!`.>~yc /dMdNjM_MMhdMMMN}
    `      ` `  `  `        TMMMm,  (HMMMMMNJ.=  (T9B=.tdN#dqMMNMMNNMWMMk{?NJMNNHMl (-_O& WRqMbM#-,L(k( .4W(_`3\(, l   .i`  ` .XX$iz1zVwWW9Zdkd1wIZvG-u&(.<  ( (I!.LgM#W[TdMMrdMMMM)
 `     `              `      `(WMMN,  (MMMMMF`       .=JMMHFdMMM0MM#MpUMMJ,WNMMMMNN..J71(S,W#MNM@(.0.._:  ?k, .I. ~.-    1.  .=Jw$jUUUUXUXAkRJvQWsuJY"5UYTMNae!,% wNMMNNd}MMMOMMMMH)
?!  `   `      `        `       .TMMN,` ?MM#        J(dM#MMA#MMMNdMMJMpWMMN-MMMMMM#=/   D 7?MxMN@`~l1 ~.   .43.}_.  C     ?, ?~?=(<z1dUUuXU7`.d#6?` ` .  . ?HNmv .NMMMMN]uMMMrWUW0J)
-..      `  ` (~4e7<.     `        TMMm. .Wt     `.m-=XdNNMWMMMMMNMMNMMeWMNN,MNMM#`J    /  (,MdMM. ! >  `    1.1` _`,.  `  .<.`   _ ~<(X0:  .XM!  .<->.J-  .JzN).MMMMMMK#,MNMC?h?^,}
?i?+       `  j` .4, 7a.   `        .WMNe (`      dMMNbMMdNdMMMMMM#MMMMMRWMMNXMH#` G.  ,`    d?NR6.  .<.      <-   _ }`      -~     .?V7    1MF,=777T9WNX2_.l.XIgWMMMMMWNxM#=d^0n ,}
  ?l1,` `     ,,   (-  T,`    `       ?MMNt    `  dMMMMN#Z8WMMMMMMMMMNWMMNJMM#MM!   ?6.]   ` .L?W[ ` (dWQg,`   .-    >     `  `            .gM:?,      (MMN.(&gdM#MMMM#jMMMf(l (-n,}
    _V.     `  4.  `1   (n      `     `.H#`      .MMMMMMMNWMMM#WMMMNMMWMMMbMMNM>      .N+     O WW,  `?NMMM|`    _   _  `        ` `      `(MM)?k,      ,MMHNMHdWUMMMM4MM#j=,.` 4,d}
      (.  `     4, ..'   .h             .\       JMMMMMMMMMMMMEHdMMNMMkdMM#MHWt     `.DW#>    .;,w;    .NHXMN,             u..             !jdE.?N,   `.ddNMMMWkdXMMM%.MMN(Ng/    (}
       1         ?dD_      h         `  - .      fMMMMMMMMMMMMHMMMMMM#CJMMMMX=    `  dK,MZ;`   < z1.   .d#WU8Ne.        `.. dMN.      `  `   Od),CH&J(dNNgdMMMydX0MMm.,WMHGMMN,   ,}
       .[        `>.<   `  .[   `       j  I.  `.' HMMMMMMMMMMN#MMMMXN!(MHN=     .. (NR_(NJ.     .Ii    ?dRWWXMNe(.  ` .7?_.j.!`  `          ?XN+1~WgMMMMMMMM#RRMXMF1. _?TM9WMMn..,}
   `   `(.`  `    .-(`    ``j.    ` `  `v       (p.d(MMMMMMMMMMMMMMMM@ dMY    `    .MSW[ ?#)  `   (/>  ,C?MkHWW9Tmn.     -`.dMHg..            (?% .MMMMMMMMMMNHM#dMb (71(.N:     .?}
    `   .)      ` .2        .]          r       dMNP(MMMMMMMMMMMMMMMN\.#'         .fMkW]  Mb       1.: (v1MNkkn+QfTNUn..d_dY^  (7M3(;`  `       ~.MMMMMMMMMM#MMMMMMMN,            ,}
         1`       J%   `    .%      `   \      `dMMMMMNMMMMMMMMMMMMN#.=       ` .MN<dNKb  d#  `(A. ._.!dMhJMN#dT(,jf(TNm.(^     .!        `    .J!HMMMMMMMMMQMSMN?MMNr?Ng..   `   ,}
    `  ` ,   `  ` d        7j[  `    ` .!  `    HMMMMNMMMHMMMMMMMMMM#!  `  `  (MkMNkMMSb  JE     ?TUh...Dd>dMMK8QJ(6Z<x?H,   `              ` .=  JMMMMMMMNNMBMjM[?MMH-?MN/WMHdm7 ,}
 `    `  ._       d-        .S        `J        b.WMMMMMOdMMMMMMMMMM)  `    .MRMMM#HMMdF  jS   .Y177ZXHJxY=vqMMHWma--&J!1H    `        `     J!  .MMNMMMMMMMGMF,MN.?Y8r ?Mb.MNKN  ,}
,         [   `   ,F   `    `I     `  .t       .] .MMMMMMMM1?MMM#^  `      j#HdMjM#HMNWP  JK .Y .! .>  !7mdVdMMMM#SOCv1(K^       `  `    ``.C   `.MZMMMMM#MqM8].MMDJ!?7<(JM[(WMW[ ,)
SI.  `   `1        D      `  r        J`   `   .] ,DMMMMMMNy1uY^         .J8HSM@dMMMMMX%  z!.^ .k../     ?Nv0dWMMMNNgmYO    `             .^    .MMNdMMMMHW@M[b JMW)(.    ?F""7N#h,)
XwS.    ` ,_`      P  `      b  `    .:  `     .] ,<`?MMMMM#"`        `.JMMMmM#dM#dMMBd\  1J'   .lZ`     `7MYWYWM#7~!J`?      `      `  .Y    `.MMNdNMMNMNM(MNd.MdXN,."T&.d>     jW)
VkWv;      [   `  .b         z    `.J^  .:     .[ ,c .~?MMY       `   .MMMMMMNWMM6MMMNF> .Z`     (!   `      _TY"`  J`     `     `  ` .Y`     .MZMM#[email protected](](NMMMm,          `?}
?ONJN, `   j      .F   `  `  (_  `.Y    J    ` (o..b. i.Y          `.dMMMMMMMMMM$MMMSdHp J      (                       `         `.."       .MWbd6DdMMNdMMjMMLb MMWWw/TN&J.,. ,  .}
 ~(TNH)    .;   ` ,)        `.b` ,^  .(   `.  .#\?N..kD      ` `  `.HMMMMMMMMMMMM#q@ZOidd`   ` .!  `   ` `  `               ` ``..M\        .MMMNJrHkMMMKNJ#MMM#.Y(?W_  db.` ?M.  .}
& -THHg_.   3    `J!          (;J!  ,MB  ..!  J[  ?d#'            .kMMMMMMMMMMMMMMNf.T!        r           `           `    ..gMMMF         .MMMMk#dNMMNIMRMMMM#( ,- <, dE((h._b  .}
Q9,  ?TM[   (.   .F   `   `  `.F    .V}  _` . T\   =    `    `.`.dMMMMMMM#MMMMMMMMM"`    ` `  (U              `   ` `  ..(gMMMMMM#-.     `  dMMMMMNWMM##ZJW2MMM#j  4, ?&Z@dQH@ .b.,}
Ndh/`  .h,` .}`  .\         .J'     .<!  ` /       `  `    ` -(dMMMMMMMMMZMMMMMMM=          .Jt(   `  `  `  `  ` ..JNMMMMMMMMMMM#=        . MMMMMMMd#Mh#SJ-H,MMMd,  ?++%4m#=`   .b,}
7Wh?1-   ?.  (   v     ` `.J^     `,.`            `.Z`     .JdM#NeWMMMMMMKT""T""`       ` .7` I,`        ` ...gMMMMMMMMMMMMMMM#'        `.  dMMMMMMMNMdMRk.dnMMMNN,      (4-$ `  (m}
   ?4&(-     .! .\    ` .J^        .r            `.f   ` `.?!W$ .?MB""=`             ` ..4\    WJ,......gNMMMMMMMMMMMMMMMMMMMY        `   ` ,MMMMMMMMS7MhNXdWMMMHWMm.      .4,  .XH)
      .7+.<     P      ,^          z`          ``.Z'    _.. .\                      ...MMMb     M90dWXXNMMMMMMMMMMMMMMMMMMM#'      `       .78MMMMMWMh.MT9"=?7"TM#MMMJ,`     J;.?`,}
         T,  ` J`  `  /         ` .!  -   `     .?!  ` .>v`      !      `     ` ...(gMMMMM@`   `Jkkwv1zWWMMMMMMMMMMMMMMMMM@`   `                 ``` `     .??>   dX^     ` .d%   ,\
    `     (n  .\            `   `.\` ,     `  `/!`   .d%:           `     `..gMMMMMMMMM#=` `    v~!?TWpddMMMMMMMMMMMMMMMB!       `  `   `  .             ....`   `d'       .%    .J}
      `     ?&J_  `             .:     `      !     .8:       !         ..dMMMMMMMMMMD`        .%     .MkMMMMMMMMMMMMMB'    `            .!`  ` ..   .,!   ` ?.. ,`      `.\..JY=`,}
   `    `     d{`         `   ` !         `       .0'             ` (mJ7!`    ??77TB=       .JNc{      .bMMMMMMMMMMMM=        `    `   -v!      ..J.?`        jMMn       (MY^     .}
              (}   `   `          .             .v'  _ `        `..dY`                  ` .MMMMN}    +:.bdMMMMMMMMM@!                 _       `   `  .,!   .J=`        `,%        .}
    `  `      (`      `    `     .`  ` `   `  `.=     `  `  ``..jC(:       `            .dMMMMMMb  .dOzidgMMMMMMMM%    `   `  `  `  ` ...`  .... ..(Y`  ..=          ` ('       ` .}
      `   `  `j     `           .!          `.('           `.-> '       `   ....     ..gdHJMMMMMMb  (OzjMdMMMMMM#!           ._?!???!`         ?5i?"h(HV=           .-Y!      ` ..J\
   `       `  d    `      `   `.~       `   .>         ` ..J=        ..&W9MMMMMMM#YMMMMMMk(MMMMMMM<  j1zNdMMMMMF    `   `.J^                         `      `  ` .g#^  ` ...gWM#! ,}
      ` `     J~               J    `  `  `.\    `  ` `.__^       .dMMM8_M#MMXM#M#bjMMMMMMNMMWMMMMb   ?:XdMMMM#         (!                `  `           `   ` .WD!  .-T"!`..MM#  ,}
...           d`      `    `  .!          .1!                    .J5dMM+.dMMMkMMM#N(MNdMMMMMM#ZMMMM[    KMMMMM#    ` `.^      `  `     `        `            .+F   .dF  MMMMMMMF  ,}
I=====vIzC`  `d   `     `    .2   `   `  ``!   `   `         ` .Y<.,JMMr{,MMM#ddMNd_MN(#MMMMMb0>dMMM,   bMMMMM%      ,`            `       `  `    `   `  `  `...Jf!(Me ,"<JMMMF J,}
+;>+zzwsssAA0OL              +:                   `    `     .Y   } CMMN1 MMM#WndMN[d#(MMTMMMMN(.,MMN, .PMMMMM\              `           `             `...JW#TN,.NdMN?N,,MMMMN..MH}
 `  __<<?<<+z4F    `   `    .(   `   `   .                  ,t    (.(JMMr;.UMMpXl?RldM4NEjMWMMMMx! TMN..tMMMMM~   `        `     `    `         `  ` .(HTMMb1?mJN,.MMM| dMN,.TMMN%,}
          (1zw]           ` ({          /                ` J^      { 1dMNJ. 1dMp6;(NM\.Wn#!.MMMMMe  (Mb,jMMMMM`                            `     `..MMWMRMM#/G,HJMNdMMNJM!TMNggWM\,}
           ``(\  `  `   `  .l{  `    ` /       `  `  ` `  J!    `  .. >VMNx. ?XMcv<.Mz(X#: ?.(MMMMb  ,MddMMMMM,`      ` `   ` `  `  `   `   ` `..MMMMNdMMNMMJ/4.?HMM#WMMMNJJMMM(M|,}
      `  `   (`           `J`         /  `            ` .d!        `~  i?MMs. .WK<_v`.w2$  .{ 1WMMMN. d#dMM"  h   `                `     `  `.jMMM#hMMNHMM#MdHx7, ("N.,?MM= JMM;Mb,{
    `   `  ..y`   `   `    >       ` .`   `  `   ` `   .f`   `            4J>`  8<_ _-v_\   1  17MMMN,(MY!    ,m.  `    `  `               .+MMMMMMHNNdMRdM;(HMN,+,.MMMMMMNgJMF.M#(}
((i..JgmkVOwX@     `   `  .`  `  `  .`        `      `.K   `  ` `          (1.   ..    !     i  _?MMMNJF    .MMMN,  `       ` `  `  `    ` .MMMMdNJNMMb?MNTN, 4JWZTNR_  ?WMHMMhMMD,}
YCzOOv7TUQAXdF  `         ``        }   `  `     `  `.#AZz1+...   `  `                  `  `      .MMMMF  .MMMMMMN.   `                     WMMNMeTg6JMm,!TMT5.?gMm.(TMa,  JMMF .Nj}
-(JJc"7!`   J%        `           `-              ` .#zv11><?7771++-   `  `    ..XHHmaJ..           WMM].MMMMMM#^.N     `                    7MMMMR.Um,?Mn,(#+.MMMgMMF a,UxdMMh(Mb,{
            K     `             `      `         ` .@!<<+?<<<<-_~~<:;<<.`     .KwwwwvwOXXHMa,.       TM#MMMMMD`   ,b       `  `  `       `    /b?WMN,?Tn.W,?NMM9MMF`?! ?N.dMMMMMMMN:
   ``   .. .b   `  `   ` `  `             `  `  ` .F      `   !  ..__(,      `.NwZwwzwvuwzwOZHMa,.    7#MMM@`      ?x  `     `      `  `    `  (b   TK7aQ,Te,MN(MMp N,..?NMMMMNm,?j{
 . .` .``  J]                        `          .J$..                  `    `((JNkXzwzwwQQkWmQkwwWMa-, qMB^     ` ..d,                          ?b   .=.-17TNdMMeWMkMNJN.JMMMMm?MF,{
           .]                          `   `   .#`   `                      .+++zNRrwXXuXWWMMMMMMMNmkMMNkUSa...JHSZrZMx   `      `              `vL     ..>  ??T@   MMNMNNd#!(MMN,,{
        `   t      `  `  `  `  `  `  `    `   .#`     ` :..                ___!` ,KwwrzuuuXWMMMMMMMMMMMMN0vdNggNMMMMHrHe    `            `  `     Ue      ._ .. .W, (MMMMMMMg-dMM%,{
   `  `     j.`  `                           .X3          !             `        -SuXvzXuwXwXXwzuXWHWXMMMNNkMH9HW8XvvwwMp     `    `         `     Wo          _<(dh.TMMMMMMMMMMN-,}
    `    `  ,)        `   `          ` `   ` (d~  `  `     ~..`  `  `  . ` -.   `,RuQggNNgggmQmXXuuuXQMMMMQM#WHHNNNNmmuXM[`         `    `          Ux `  `        7B,JMMMMMMMMdMN,}
       `   `,b `  `    `   `  `  `      `   .d(--.     `          `   `    ?`  `  ?MMMMMMMMMMMMMMMNMMdMMNMMMNcz1+vMMMMMNkMx `  `  `   `    `  `      Ua..            .4MM#  .MMMMMz}
 `  `        N     `                `     `  X n...~.    `             `          ?=?"""TUYwUUTY"""TYT#MNMVMNMm/?~`.WMMMMMN,  `             `   `     VpOkHHUHHk&...   ?WY""dMMMN!,\
        `  ..M[         `   `        `      .f W-(z11.        `           ` ??!~`  ~.            ..v<.HMHdmdMMNMe.   .THWQXN.            `             ?b ?71aaeQXHMMm+  ?a,WMNMF ,}
     ` ..Y^   N.                  `      ` `?` dr~?<11(.             `         .             .>_-(+<`(HMKd#<JMMMRN,        .b                    `      ?k.        !?7!`   ?G,TMN,,}
    `.V!      ,b`  `  `                `       ,#(<+<TIue+(.`       `           j,.     .(?<<<-((>1+udHMRrN j<MMMNdN.       (b   `  `      `  `    `   ` (N.                 ?h,?=,}
    (D         d[         `                     MkY7<<_?C??i-.. `                  ?7i,`  ;<??!   ,C1MdNyOM_ (zNMMNZM,`      d;          `      `         .H,                  .4&,}
 `.dt  `  `     N.  `  `    `  `  ` `     `     d[.-+<jzz>O1zQszl.   ` ` ` `          .>...      .?+j#MMkwd)  _?MdMNwMm.`  `  N     `  `    `               Te.`   `  `  ` .-WHBTMM%
.JD`       `  ` J[                   `  `       J#zZ1+vC&ua&-?TV=76..          `            .`.  -<<jSMMNzd] `<(dNdMNmdN,    `([              `  `   `       -N,     ...vY=vRVwwVZ(}
=     `          H.   `  `                   `  .N<1zu+gkwUXe++vO(Jz+(--    `     `  `  `        <<+HQMNHwdb`.++&MRMMNmwMe     W, `     `  `       `   ` `   ` TMY""7!      ?NOu2`,}
       `  `  `   (L     `   `  `  `  `   `       dP<-++-xvOv77""TSV77=jauz&.          `   ` `    +?jBdMMHzrN    (?WkMMMNsMb    .N.   `    `     `               (N,     `    (N}  ,}
    `             W-                  `   `      ,NO<(J<?!~(-uO+.Jz&+(z1i(-?z-.`   `            .?vHwdMMHwOH.   `(-NZdMMNZWh.   ,b           `          `  `      7m.         .N, ,}
      `  `        ,b  `   `        `              drvY<uZXJJTz<uyTSQZTUa+VI(.(Jz-.      `     `.-_(8wdMMBXwW_    (+dNwVMMHXdN,..,J[              `                 ,N,   `      4,z}
    `      `  `    M,       `  `     `    `  `    ,N(Jy?T1++uaJv61JJ71J(OA(ukdT6--..  `  ` .....z>K0XdMHuzwd]`    CvWkwZMNKzVNswzvM.     `  `   `   `  `   ` `       Tp `   `    ?g}
        `          Jb  `          `     `        ` dmJgyTBYYTWT"YT9HBTMUMHa-.azGz&-(.`      .9771(8XuMNSzwwdF...J(+zdNuuwMRwzVNOOI?b  `                         `     (N,         (%
   `                N.     `                        W@z?OxVTXTTZ7TVY"TVYTW9TTS&+78V99I(.    (11> KvXzWHSzOwXb+UZw0dkwWKuzdSXzwdb1+-J[`     `  `   `     `   `          .W,`       ,}
    `  `      `     ?b  `      `     `    `   `  `  .N2"171Z3(-uSQXW#XNZXHxwWWOzOyw+-__-...   .OdSvvXHSwvvvd#wywZdHHWd#wZwwwvwzM[   M.          `    `       `          `?h.  `   .}
 `      `  `     `   N.     `     `   `              .N/777OksVGJXx+J+1(.JZOzVY4V9w&+(-...    (4HwvXw0ZOvuzd#wz1+yWMMkMkvOwwXOwwN,  ,b   `  `            `      `         .W,     .)
,     `              d]                 `  `    `     ,NJuk&J&J+jJJgzywz?T9Sv1(-<!!...-<`    ` J#rXvwwvXvwXX@GZzwd9UXkd#zwwzvzXwdN   q,        `  `        `       `        7L    .}
N.  `     `   `   `  .N   `        `             `   ` ,NYv31+Z0v?0Z1-(x&(+1+(xvTCu&WSC_   ` .(j#zXzuzwwwXXd8w&wSxQdMHWNZXzzzwwwrM[  .b              `  `   `        `  `    (N.` .}
-N.     `             M-     `  `    `  `  `   `   `    ,NCCv1J1(.Jux?TZUUWmmWWYz+Xev!      (1+(KzuwwXwuwXwWzRGdgWRzAdWMuuuzzzXzwdb   J<  ` `   `        `    `  `     `      .W, .}
 (b  `     `  `  `  ` d[                  `   `          ,N>..(+JdHUW9TY<OgkXUVz7!``     `,WSy&d0uzXXuzXXuXHUXWO6wZ4Y?1WOXwuXzrrzwW. .,b     `    `   `      `      `     `   ` 4e.\
  ?b   `              ,b  `       `   `          `   `    ,N,(C1uXU&OAZWW9YwXUXC` !-. `   _uxzOdXuwuzXzzXuX#6<!!~.-`   JwX0XwXXwuwdR1&(J|  `        `                            Ug\
   Xp   ` `  `    `    N.  `  `     `  `     `    `   `  ` ,Nx71+vUww0Ius0dKVW=..?`    ..17zOuzWXzXuXXXzwzd%~!`        ,kXkwzwwvzXdv11>.N.    ` `       `  `  ` `  `   `  `       T}
    N,          `      d|                 `                `,N&J?<(udYS+1zz7^`     ..!+xOu+(>_ WzuVzXuuwzXW             TNQQQmmmQQM0w1c1?b  `      `         `               `    .\
R   ,N.               `,b       `     `         `            ,NJ7V1/7(-7!      ..<-+zZTY7T7wdY=TmmkXXuuuXw$         .._`.(OUzz&OovIzz+1Jod|       `    `                `         .}
Mb   db`  `        `   .#   `      `      `      `  `  `      .N2--!        ...JQmQAOO77?` !` ?!~!?""YB""!  .....J(..xv6~7z1zuJi(oyuizJkwOH,  `          `  `    `    `   `       .)
M@.   W[`  `  `  `    ` N      `     `       `     `  `  ` `   ,N,       ...JOOz<<`                  .(++u+gXHMMGGXQWdXVTv4gD&kuww1+wdkH0OvN.  `    `   `    `  `   `       `  `  .\
MN.    M,               N        `     `  `    `                .N,    (<<!!`           `  `   <1+ZUWkvGd9TW95V0XdwdQxiJdWYkUVXVZwU6VVXVS1-?b`   `         `             `      ` .)
MMN,`  .N,   `  `  `    N   `       `            `    `          ,N.                      .JwAg&gkNHHXHHAHHWdkHH6X9Y1CvACJ7<?UWU0OZZjzYoz(: d|        `               `      `    .)
MMMMp  `,N.`        `   M.     `     `   `        `  `  `    `    (N.             ` ` .(zMNggkMWH99WMVXKM8dAkXX&SZ(+JzCjXwXZwzZwwXwzZC+T:... W.    `    `    `  `  `    `         .)
MMMMM_   (N.    `       d|        `       `  ` `          `    `   ?R` `  `   `...zOQHHB0wQWHWMmmdHWXWXYzTYZv1VviJJjwJ6ZV6XV6XTUUZ1+=+&zZ^`  ,b `        `  `            `  `   ` .)
MMMMM`    ?b  `   `   ` (]  `        `      `      `  `    `      ` Tp    `  jSJSwvOXkAwwX9UWMMHMWYWW44ZZCTTX97ZXGkwdXJd8UvCOTC1?+v1?!        ?[    `  `       `    `             .[
MMMM#  `  `?b           ,b             `                       `     Wo      ?"7?!`  ...(??=77V9UY7TwmkX2?J6>(<1VzUwWV4J1JZC1?~~` !          ` 4,                       `         .)
MMMMN       db          .@         `     `        `                  .N,                !~?~~---(-(((-vTCz--1JZ=+77! <_`.!                      N,       `  `              `  `   .[
MMMMM;  `    dp`   `  `  N            `                `              (b                    ~?????<<<u&&&zz11<~~                           `  ./?N,            `                ` .[
TMMMMM,      (dp         M     `           `    `  `      `  `  `      d[  `            `          `                        `           ` ..?<-~-,W, `  `    `          `         .[
.,MMMMMN,    .)7m        M_      `  `         `      `      `      `  ` N.`    `     `                                  `    `   ` ` ...1++<-<(!..,W,    `  `    `  `    `  `     .[
JNJMMMMMMN,  .\ ?R.`  `  d)          `    `           `                 Jb              `  `     `     `  `  `             .   ...JCwOvjZ1J+v^-<~-  Te`                         ` .r
MMMMMMMMMF`  J`  ?N.     J]   `    `  ` `    `  ` `    ` `     `  `  `   MzIO+..   `         `  ` .... ......-_~++((+zwuagAdXkWX87COzxY1w+v^.<<_-~ ` ?b      `        `  `   `    .]
#^~`?=JMM`  .]   `,N,  ` ,b `                      `                   ` J#Owz<1XWa...` `  `        ??<1u+Jv4oJJxwdTHH0SAmkGO(zvIJiJ=(yOc=v11!        ,N,`      `       `     `   .]
m.... ,MN-  (:     .H,  `.N     `   `     `          `  `  `  `  `  `    .NuZUX&&&vOO+?7Tu....`    `        ??7"THMMM#WmXXXSwXZ8AXYzI<-~,<<?`         ` 4,` `      `            ` .]
MMMMMMNMMb.`d_       Wp   M|           `       `  `                       dRXmXVTC1z&zC<+&&z&dMBY"TO+(.....`        ~`(((-T7Vl-Z<(I<JCJ=7!         `     ?L            `    `     .]
MD7MMMMMMMMN(]        7b. (b         `     `         `            `     ` (b  .._???zCVY"7<-(<++(<;+(((J-(+(7=1(..            ` !    `                    .N, `         `          ]
D7# TMMM@MMMFS.`` `   `?b. H.  ` ` `  `  `   `  ` ` `  `` `  ` ` `  ` `   .M `    ?!_~?!<?7"??7?T77C1+(+zz111+<<<<?!..  `                  ` ` `` `  `  `   Te  ` ` `  `  `  ` ``  ]
© J.I./Asahi Shimbun Publishing
© J.I./Asahi Shimbun Publishing and Junji Ito "Maniac" Production Committee
*/

pragma solidity ^0.8.7;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
import "erc721a/contracts/ERC721A.sol";

import "@openzeppelin/contracts/utils/Strings.sol";

import {DefaultOperatorFilterer} from "./lib/OpenSea/DefaultOperatorFilterer.sol";

contract Tomie is ERC721A, ERC2981, ReentrancyGuard, Ownable, DefaultOperatorFilterer {
    event Killed(address killer, uint256 killedTokenId, uint256 birthTokenId, uint256 totalKill);

    uint256 firstBorn = 2222;
    uint256 lastPhase = 4;
    string baseName = "Tomie ";
    string lv0_description =
        unicode'Regenerating TOMIE has been airdropped to \\"TOMIE by Junji Ito\\" holders.  \\nYou can enjoy the KILL gimmick at the following website  \\nhttps://nft.ji-anime.com/kill  \\n※Please note that the kill system is subject to terminate without notice.  \\n  \\n© JI Inc./Asahi Shimbun Publications Inc.  \\n© JI/Asahi Shimbun Publications, Junji Ito Maniac Production Committee';
    string description =
        unicode'This is the NFT of Tomie, who has been murdered once but regenerates and grows again and again.  \\nRegenerating Tomie can be killed again at the following website.  \\nhttps://nft.ji-anime.com/kill  \\nThis NFT is a benefit for the holders of \\"TOMIE by Junji Ito\\".  \\n※Please note that the kill system is subject to terminate without notice.  \\n  \\n© JI Inc./Asahi Shimbun Publications Inc.  \\n© JI/Asahi Shimbun Publications, Junji Ito Maniac Production Committee';

    mapping(uint256 => string[]) private imageURIs;
    mapping(uint256 => string[]) private titles;
    mapping(uint256 => string[]) private colors;

    uint256 private regenerateTime = 2 days;
    mapping(uint256 => uint256) private birthTimes;
    mapping(uint256 => uint256) private killTimes;

    uint256 public killCost = 0.01 ether;
    uint256 public freeKill = 1;

    mapping(address => uint256[]) public killedTokenIds;

    address public royaltyAddress;
    uint96 public royaltyFee = 1000;

    constructor() ERC721A("Tomie", "TOMIE") {
        _setDefaultRoyalty(msg.sender, royaltyFee);
    }

    function _startTokenId() internal pure override returns (uint256) {
        return 1;
    }

    function beginning(address[] memory _enchantedPeople, uint256[] memory numOfTomie)
        external
        onlyOwner
    {
        require(_enchantedPeople.length == numOfTomie.length, "No match Arguments");

        for (uint256 i = 0; i < _enchantedPeople.length; i++) {
            uint256 startTokenid = _nextTokenId();
            require(totalSupply() + numOfTomie[i] <= firstBorn, "No more births.");

            _safeMint(_enchantedPeople[i], numOfTomie[i]);

            for (uint256 j = 0; j < numOfTomie[i]; j++) {
                birthTimes[startTokenid + j] = 1;
            }
        }
    }

    function setMetadata(
        uint256 phase,
        string[] memory newImageURIs,
        string[] memory newTitles,
        string[] memory newColors
    ) external onlyOwner {
        require(
            newImageURIs.length == newTitles.length && newImageURIs.length == newColors.length,
            "Array size mismatch."
        );
        setImageURIs(phase, newImageURIs);
        setTitles(phase, newTitles);
        setColors(phase, newColors);
    }

    function setImageURIs(uint256 phase, string[] memory newImageURIs) public onlyOwner {
        imageURIs[phase] = newImageURIs;
    }

    function setTitles(uint256 phase, string[] memory newTitles) public onlyOwner {
        titles[phase] = newTitles;
    }

    function setColors(uint256 phase, string[] memory newColors) public onlyOwner {
        colors[phase] = newColors;
    }

    function setBaseName(string memory newBaseName) external onlyOwner {
        baseName = newBaseName;
    }

    function setLv0Description(string memory newDescription) external onlyOwner {
        lv0_description = newDescription;
    }

    function setDescription(string memory newDescription) external onlyOwner {
        description = newDescription;
    }

    function setRegenerateTime(uint256 newRegenerateTime) external onlyOwner {
        regenerateTime = newRegenerateTime;
    }

    function setFreeKill(uint256 newFreeKill) external onlyOwner {
        freeKill = newFreeKill;
    }

    function setKillCost(uint256 newKillCost) external onlyOwner {
        killCost = newKillCost;
    }

    // Kill her. But rebirth.
    function kill(uint256 tokenId) external payable nonReentrant {
        require(ownerOf(tokenId) == msg.sender, "I'm not your Tomie, boy.");

        require(
            killedTokenIds[msg.sender].length < freeKill || msg.value == killCost,
            "You need to pay the killing fee."
        );

        // kill
        _burn(tokenId);
        killTimes[tokenId] = block.timestamp;

        killedTokenIds[msg.sender].push(tokenId);
        birthTimes[_nextTokenId()] = block.timestamp;
        _safeMint(msg.sender, 1);

        emit Killed(msg.sender, tokenId, _nextTokenId() - 1, killedTokenIds[msg.sender].length);
    }

    function getOwnTokenIds(address owner) external view returns (uint256[] memory) {
        unchecked {
            uint256 tokenIdsIdx;
            address currOwnershipAddr;
            uint256 tokenIdsLength = balanceOf(owner);
            uint256[] memory tokenIds = new uint256[](tokenIdsLength);
            TokenOwnership memory ownership;
            for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                ownership = _ownershipAt(i);
                if (ownership.burned) {
                    continue;
                }
                if (ownership.addr != address(0)) {
                    currOwnershipAddr = ownership.addr;
                }
                if (currOwnershipAddr == owner) {
                    tokenIds[tokenIdsIdx++] = i;
                }
            }
            return tokenIds;
        }
    }

    function getKilledTokenIds(address walletAddress) external view returns (uint256[] memory) {
        return killedTokenIds[walletAddress];
    }

    function isBorned(uint256 tokenId) private view returns (bool) {
        return _startTokenId() <= tokenId && tokenId < _nextTokenId();
    }

    function getRegenerateLevel(uint256 tokenId) public view returns (uint256) {
        require(isBorned(tokenId), "Not yet Birthed.");

        if (birthTimes[tokenId] == 1) {
            return 0;
        }

        uint256 n = 0;
        if (killTimes[tokenId] == 0) {
            n = (block.timestamp - birthTimes[tokenId]) / regenerateTime + 1;
        } else {
            n = (killTimes[tokenId] - birthTimes[tokenId]) / regenerateTime + 1;
        }

        if (n > lastPhase) n = lastPhase;
        return n;
    }

    function _getImageIndex(uint256 tokenId) private view returns (uint256) {
        uint256 regenerateLevel = getRegenerateLevel(tokenId);
        uint256 imageNum = imageURIs[regenerateLevel].length;
        uint256 random = uint256(
            keccak256(abi.encodePacked(tokenId, birthTimes[tokenId], regenerateLevel))
        );
        uint256 imageIndex = random % imageNum;
        return imageIndex;
    }

    function getDescription(uint256 level) private view returns (string memory) {
        if (level == 0) {
            return lv0_description;
        } else {
            return description;
        }
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override(ERC721A)
        returns (string memory)
    {
        require(isBorned(tokenId), "Not yet Birthed.");

        uint256 level = getRegenerateLevel(tokenId);
        uint256 index = _getImageIndex(tokenId);

        bytes memory attrs = abi.encodePacked(
            '"attributes":[{"trait_type":"regenerateLevel","value":"L',
            Strings.toString(level),
            '"},{"trait_type":"Title","value":"',
            titles[level][index],
            '"},{"trait_type":"Color","value":"',
            colors[level][index],
            '"}]'
        );

        return
            string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    Base64.encode(
                        abi.encodePacked(
                            '{"name":"',
                            baseName,
                            "#",
                            Strings.toString(tokenId),
                            '","description":"',
                            getDescription(level),
                            '","image":"',
                            imageURIs[level][index],
                            '",',
                            attrs,
                            "}"
                        )
                    )
                )
            );
    }

    //other function
    function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
        _setDefaultRoyalty(receiver, feeNumerator);
    }

    function withdraw() external onlyOwner {
        require(payable(msg.sender).send(address(this).balance));
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721A, ERC2981)
        returns (bool)
    {
        return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
    }

    // DefaultOperatorFilterer
    function setApprovalForAll(address operator, bool approved)
        public
        override
        onlyAllowedOperatorApproval(operator)
    {
        super.setApprovalForAll(operator, approved);
    }

    function approve(address operator, uint256 tokenId)
        public
        payable
        override
        onlyAllowedOperatorApproval(operator)
    {
        super.approve(operator, tokenId);
    }

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable override onlyAllowedOperator(from) {
        super.transferFrom(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public payable override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId, data);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {OperatorFilterer} from "./OperatorFilterer.sol";

/**
 * @title  DefaultOperatorFilterer
 * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription.
 */
abstract contract DefaultOperatorFilterer is OperatorFilterer {
    address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

    constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
}

// 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 0;
    }

    /**
     * @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 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(baseURI, _toString(tokenId))) : '';
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, it can be overridden in child contracts.
     */
    function _baseURI() internal view virtual 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, together 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
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @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`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";

/**
 * @title  OperatorFilterer
 * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
 *         registrant's entries in the OperatorFilterRegistry.
 * @dev    This smart contract is meant to be inherited by token contracts so they can use the following:
 *         - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
 *         - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
 */
abstract contract OperatorFilterer {
    error OperatorNotAllowed(address operator);

    IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY =
        IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);

    constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
        // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
        // will not revert, but the contract will need to be registered with the registry once it is deployed in
        // order for the modifier to filter addresses.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (subscribe) {
                OPERATOR_FILTER_REGISTRY.registerAndSubscribe(
                    address(this),
                    subscriptionOrRegistrantToCopy
                );
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(
                        address(this),
                        subscriptionOrRegistrantToCopy
                    );
                } else {
                    OPERATOR_FILTER_REGISTRY.register(address(this));
                }
            }
        }
    }

    modifier onlyAllowedOperator(address from) virtual {
        // Allow spending tokens from addresses with balance
        // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
        // from an EOA.
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    modifier onlyAllowedOperatorApproval(address operator) virtual {
        _checkFilterOperator(operator);
        _;
    }

    function _checkFilterOperator(address operator) internal view virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);

    function register(address registrant) external;

    function registerAndSubscribe(address registrant, address subscription) external;

    function registerAndCopyEntries(address registrant, address registrantToCopy) external;

    function unregister(address addr) external;

    function updateOperator(
        address registrant,
        address operator,
        bool filtered
    ) external;

    function updateOperators(
        address registrant,
        address[] calldata operators,
        bool filtered
    ) external;

    function updateCodeHash(
        address registrant,
        bytes32 codehash,
        bool filtered
    ) external;

    function updateCodeHashes(
        address registrant,
        bytes32[] calldata codeHashes,
        bool filtered
    ) external;

    function subscribe(address registrant, address registrantToSubscribe) external;

    function unsubscribe(address registrant, bool copyExistingEntries) external;

    function subscriptionOf(address addr) external returns (address registrant);

    function subscribers(address registrant) external returns (address[] memory);

    function subscriberAt(address registrant, uint256 index) external returns (address);

    function copyEntriesOf(address registrant, address registrantToCopy) external;

    function isOperatorFiltered(address registrant, address operator) external returns (bool);

    function isCodeHashOfFiltered(address registrant, address operatorWithCode)
        external
        returns (bool);

    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);

    function filteredOperators(address addr) external returns (address[] memory);

    function filteredCodeHashes(address addr) external returns (bytes32[] memory);

    function filteredOperatorAt(address registrant, uint256 index) external returns (address);

    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);

    function isRegistered(address addr) external returns (bool);

    function codeHashOf(address addr) external returns (bytes32);
}

// 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
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):