ETH Price: $2,531.10 (+0.84%)

Transaction Decoder

Block:
16998463 at Apr-07-2023 06:44:35 PM +UTC
Transaction Fee:
0.0437880045470455 ETH $110.83
Gas Used:
1,678,565 Gas / 26.0865707 Gwei

Emitted Events:

Account State Difference:

  Address   Before After State Difference Code
0x5f04D47D...f4c4EBdB7
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 284703100234788953434113707445607232293917526017659833400783448362726136485925238113199629271487754234091821970031349166115776072217025276039325105036262959397201649825544944319707353552701135924256650528082242381984011643079889886512320126623047278190690763903578138429433345143579015085725256014778765597959483887050193398026603459417038594079061271388933922522106832829073747098805422242219509297501441518688764058666793533477754261165007128500440100199561981139511652816448542866732507401305240582271101566408822856009257275260121133229678263971498903580378585404280865701492873618405152054193823555268972333482678825908951833367138408040456526091272983361259291770086719664887203112154908410238985364716335419516878338624883061262056766489011749048256353264669384542336623101152886124327467086058189525270416036722675469451528919528871847921787297238136246584541617940711699325666963947099933989592684964092190590707373433714488137538941219185399464794487092870533989385905125468468377291594811271799687811027980147526591035831605342073853357604716871537431396502237472290300793763992601028333464710185347417613695583923578931139239217673906722263603219643811401446425156520919677222250635150061871500801781962907458995792744953428598504942530254723680302988275287559760382591379349905415421385267448683006807974433952959461989351827098564274974512047766400650406195432540963016076386683584193306893923209704801023259856189129944108115167119970819168048190628739996677931249040415728969589576540428428592962279698714876533243264159188577971601304669940329575548515789008831826400423395784272225977098701730403376871364123153767887843949269463279867489997308904814384739338298677160641900704334613396215087440146724226776498198644099582981798105997716961521242289662702527283857099350404443631217851671660230939354487018007438269146624054694703827962117091264400916237163932803860723781637743862567682905117191154988798441549695981914614819441656212579511013578959203142015661920433331957604335473786822207633828460466834031116020252263183791526520617112743742547629810480068372630685286437309625176146986276692208473561398290287470537817496784728907873228433999874045923497452867860793550786504082183442978754070932858253389083006361437239383695053873282882992523909718925161657705607004088585430949461913056212014417918805263668568313373302258894935901663185245813525455239489935207686275351135273830629030851633001710708574713666130178102970427277729479275394074219598523552722568042478983449779510461283282610129757512499377439030860551734015738886754663229850169273261548162392596835015182002874460951644111567357617821126243273307205102796100934465768141779106469036489757707177984167713580321596905204534789354914996039536039275581457596411962565266148747514218217194893915411053287475991037039216658806242825917787362503284360992907598714544163584108241609721966707515948105075018818522073379560003688184967295062234316219209182906633864015894886893660691672725966082265099730378463073228775921503115928371924746087068623641103193870585380555690967626565510659151650486237561814518906329090610163010476595102672838541788458976886388144926189917624739022922899259345949311259135847685861298854667473261597421856905685949032982365575001749062094592328634663067485832077840194713191743060113883516872926662512259618869164397983391261213257002865177067470103083303784292124030052057351799329532133711668730843446277085921653531984488457744867972052675852095600668801111880844129040921674415036554661471114826608072809894654455762130870782004277643896363948322418370813530454707808820827994674770738182754356989621648546245135478011239613914306345128523049935748324398861503583063363327683192560062224280207872829740031185483470753912615544608127431895542257565465400357519786711421070679546240059712587552200005646366862200662639363501431992155449171136427205635901929418260299846281357415319209422114087175797981785459046350254678617532459991181194443921803672861485722050391266176147873514583382149883120609727076064240740331325701920682474925118329311436378472965973015263435221442281837964986894836051012386742340826403213147412202066301505371860730540491973818440557193396671009043392739341876599311124334103404816271199683015858390045554469681462572965043916648717903761562159338701341796932037455175617055876030495375195766003038470796820064940493824587755256537432171912930103370421762941409721448140474548275534814777721217889349170177472851390207383281715542966985213784897082536733047708988641331584856684797919632884896889098984822383034995735017164426434461808004590648918407625831747493227501165992294209908122968175005664734689748458914143980737157552297280811613345028574541551814290911051217676937600701748314110596809165957094762714089944529404148525439215062620429741298488394588057924943918526415628304525216343106755178396327005357172723856413309228136459081869597968003366296844526379398989069146396101740040593099505980942300483039735277237083812349272419508664128527748305376753913878843575524534677839069041063050253642562317772540608611289763116636677970314047209176772634584380364772049302231250921429026405701552937585764664052795840583226720237554825217038092804852298361204904180924137295080830642867606601120561523029874491065622560219147825999753577794315670929293997128528715172857584561619699895492181553619615499593335870892130590155061467890294515753655954810025375530104923654347286688943550366838181208561608972255901420447573077120702934327591839955694121658552921395391808357164356319229290942385118790122931829146989576363110602006799819956181992515646538639430617800936902599464642560653399330463782865146212760308417160483227116091687399914464004937617392141165144977554489299039949349374255340960053013148439253443628304999893492857020945211084028252076453506503379904662575414585710315854898942225772609221210397254822695372655899083071448593838466099631866499871407951608834932491050409687556080559885487734075542933007760751581920919390836102705480901672612042503684175886237008665246323798102555251862368847553776478380363181610112261854203048573426210110927177821115734655356734114326055756709639304615733907528904207112281189116094475064760208197867094438815561198713618910185638995862659296838476840002233208589935123665897251132093797140678511359960335412344211597715194219724526863440253520479144944831623768721579377259025982391627018848936220683551239150392315148525290640713018798584435336319682159984253567726711515896734144993702339547035567678570817088125296757997409295566746640011647343056367552012774210623706930699713582451420940872113465984527595553630979586406625255156413059552668968141392952756100431638532288005940429977717324292695870411577130210728273688651947716170844374809585569454490311112871784732794550778868852692638072111982356287971914509603969882233995562578057977068208298853718006123591880402534201762196838571199469049568887084760340819077652631887409902455558278604102402774129858455722608808090640865566452618744374451396504969175056763903655215015839083700308864282453808767098607994955019699637265746005747859122112867179592491644756310788622222734960050171181216325782331772193793839694152233900669745200075845434542163209291676528272900904970410741346226361678500817836952943034206441709893666134883073818751022328731270394476817340958223958749587437083296157413705887282751835321787150668601213997846547350986282180664532634088412924768283829969296739771454987593240247087437459202572120769216796890048165326548582177770434056222192436277656293173518666094239156778198453994505101723652371368736502632813060859603527542254484259182738487718583610474102886942868993771857333193786817842520604879832776366860681742558378272304567431470827186966369455643047349215762887381334292338024918191544754363237429236122565357952878460601899054971705148982989252358508769349534103067367420086687085506730180176315993867589329617433854936545866420558052735067852635295454827667301782117348109769672304042236753845440897679258330828513428731829746178318712976233688686986639939095990821392237824014621762222672067559779557392812550529717310365578268251698434287724048392836073167986997694631298719433317365595614098975386909718986988709206516941793184227582171381260504107275074212273797319551736129329791300173893999000906383336826030476162359523828156473314975728974039838633146858348623863072877476060348165924204749785002594928594557949197059285196643429378208456371223982458369582802362848322839557736362797155119948252673218880188259509164344333209363531121707163314829367319486013377581572638772590703007092679256162659847589969251636062595983753598704003509234195224581862108737535915740638479462498410456277787208188752616506292879711416565256170253748405886501971630733513631117366711747844937236221187963720680196335701807740937218203046167660107954649403094751467102967252945419940905637003698560931398931044084244505790645682923519276848677292679489731095850650809703644300840636536125866002941655520530145097917109419805263544742538953933472889187744894649930144423495246854369762253911229211591378141701026677859759077475489771970160070243470120093812607896673765868727758089566043428576626499366173076955519937860430672257529619317827183178386199058947806823698502468120295989055110710891176323058158408231381013573423105398259708972298210268022811154097252764986503816852746120364464591487344683517209504016074825719760842746497517530273941815131874333967163981118509241795887029332368669292340421201963645090027370302818047130562905999572005495361818986756838978667734855693051715119926570232569497248451978218360841991984919452331273244925298217731712142405037500797712968338255444316992293020513986197082518133404596794086366793185990292642352672032631903196292328024426337546009580410454863282544159061625043009208885185826505094334202128693808333048059748424232774054422927277347710601237596050670613197140370152962145182604625889697903814504351080671794536800481379701171917231596840571368345604673744430447657132336608022734433655219941085265448192088924800879393614892513950002650123160329127592627619090091653627620653720075259420919176865546876607198241124193535947193648885294687456007318173662701452923906939015988583067924456948942922924334080948703706847560719113864410426062007116412794537404499190047530196550248202179660657025736978022516043382166471650943390721872263692763461138566795570749431730444408700096232068749827015158684197664016865121519586791711376360851094489856279000126337558806336821088249958970533214849820123361237203806331007631648571090778842513049069614739587716716945272384205465835450339649273799127211316745305750467738988251100041064660353758681691929336481684286146485809373212247127463861124107914096807532068215325537511357075049775718101118319434559226148649428384997893543873884074741112695721122467838215945117878553978139935817040308394354807302397900679875855695235291206609606293061670936474536820844608564090873452905851426011355781741885192677391656772964067609630431832860132934775890149868228191946318199828145785923103491821804437463616122151598914727514704548548912546167392743119397301188943252655791369224699397838429046896995169273646130645138850710673561159994190524843621710807951315296407469099876072590443329242995420619753322390922409759338575616529859251717628374397431049694336166061969886010018715225085246216474012914169970319066482981109490288203625914134010396577601536882953214471521225402491032800355819597946148705962143988005420721830949561719406004086801494165814282880271484124131578303040053397110042790088818037878784462967966384560917085249532982863028320000406565523484073356649106059734874679689029209955266061792677733733245837891385068346787744328997565547361457817646689628951503726299100979182552429409700461957760622370235819734788273488353339371298910815656195063390464289727568740770298053626129815128296133122914645660822094265306159673449331820701041545104467086954256778365861770681271520279618264433404907380041751128449270291001207688044840449842246618243053999562649450179418273504462850659903193794028677222160069393687901790532796488063666248264874737658270739888093735683019935799974640517544810006697158078478447627683884300361156283726560981144524756240739900950873298101810432804157694142642915846846771634991590675801936425611233922052094626504299802770393557097895618885555042423982083462675950388663312519828904099802280840742468352552176795468014026017814652188056969820595477581356969404602870550600058057764343079871944186555954957736162984927465626597787238628532987760829072242412209495144440451257256495162849883050880685179018893609865651339651454650738994606286622654626563420150038243483204178582731425812035809393117581864726998930397795369838217817209929163396419468617237732842879636307929909438164777082894421829528002284980094474483397785309477052512268500221422854178234008682597941710181837128434477372201737648542901602130546631974413079678969408929666424683933997390378844514667817781049330842312634040859850594823030365460614707236379173158208602233890239106361383972220244380489616476584892375554019503924497257966489687669234724282344377200188779496627408095935932829361500111202307716503599361968156050377876840437630425475749149118395095898704077537442230798014599935800788813647475814208433964509772823732700709108627058917954746528331264548968744382231651744329118360814478860621450011792349595461187665546940923966422481016965155039754619068835407361940364871585579210125204122014012702763945866159932820997195479173710694464512990899318050554176931101810904656081152052387275438526234961305148314212680157093966932170555741916588252802378437235943968334120950769014836456100698620723851384867073146007008783719647532436521861886378267209263215547784180467749300056423730508016386691494354522664461232831693233529463582027989650093413199633854367364743884488362800691493117536490669213427164703367045024356140934368353248784170772962445902618439184310299192677204407301603560790882233481745236218233743984826674672270365311542014647226508773744506637198461174021270314680491449364211621049183800987439020088306136521799776598132103399856416176040201511655982738519746824889269926406849668669042462371513028007185899171854930927188051515789466465406427223873223089998700398769310972053809425222994150439393822087330184436052013772234646145740011468330360508968982362148819593372173909465049023483328621319076678869518640765728269418578223729519635717737461710035059492738392806795986716215759598046294593648278798836696104526362441605380326015937537039778339112367280873090720822396447399253981013712323210485777523357162524771905542219363161830254952422506125678007786623232810884501467766947967761329230686546054976863478703710344938369427610888318738873486686467825182487911686408212247092280088024619382008863965978398748834157027447186792500375026054075370106567385450284647710309946302629082561321527062511034438898753765724803164036992571102838922856722054659691020750131382612571801031040000590601496567284322684664788329453735669714963712247575624931558968949919459329445594064192830001564946467329589499362731724335043493798073937687138173113755242437640852920297441275758827021809072651809501600702616289067469425890479146741322499622328511155521243050717071260036442312365565501048142542742390075006049521005137099192350034742244144490225699526460768307
(Fee Recipient: 0x6d2...766)
44.616274115167070638 Eth44.619631245167070638 Eth0.00335713
0xAB9e1DDf...eDF495Ca5
1.344502484149169566 Eth
Nonce: 7
1.300714479602124066 Eth
Nonce: 8
0.0437880045470455

Execution Trace

ShapellaUpgradeNFT.60806040( )
/**********************************************************************************************************
  ____|  |    |                                             ____|              |                   | 
  __|    __|  __ \\    _ \\   __|  _ \\  |   |  __ `__ \\       __| \\ \\   /  _ \\   | \\ \\   /  _ \\   _` | 
  |      |    | | |   __/  |     __/  |   |  |   |   |      |    \\ \\ /  (   |  |  \\ \\ /   __/  (   | 
 _____| \\__| _| |_| \\___| _|   \\___| \\__,_| _|  _|  _|     _____| \\_/  \\___/  _|   \\_/  \\___| \\__,_| 
      ___           ___           ___           ___           ___           ___       ___       ___     
     /\\  \\         /\\__\\         /\\  \\         /\\  \\         /\\  \\         /\\__\\     /\\__\\     /\\  \\    
    /::\\  \\       /:/  /        /::\\  \\       /::\\  \\       /::\\  \\       /:/  /    /:/  /    /::\\  \\   
   /:/\\ \\  \\     /:/__/        /:/\\:\\  \\     /:/\\:\\  \\     /:/\\:\\  \\     /:/  /    /:/  /    /:/\\:\\  \\  
  _\\:\\~\\ \\  \\   /::\\  \\ ___   /::\\~\\:\\  \\   /::\\~\\:\\  \\   /::\\~\\:\\  \\   /:/  /    /:/  /    /::\\~\\:\\  \\ 
 /\\ \\:\\ \\ \\__\\ /:/\\:\\  /\\__\\ /:/\\:\\ \\:\\__\\ /:/\\:\\ \\:\\__\\ /:/\\:\\ \\:\\__\\ /:/__/    /:/__/    /:/\\:\\ \\:\\__\\
 \\:\\ \\:\\ \\/__/ \\/__\\:\\/:/  / \\/__\\:\\/:/  / \\/__\\:\\/:/  / \\:\\~\\:\\ \\/__/ \\:\\  \\    \\:\\  \\    \\/__\\:\\/:/  /
  \\:\\ \\:\\__\\        \\::/  /       \\::/  /       \\::/  /   \\:\\ \\:\\__\\    \\:\\  \\    \\:\\  \\        \\::/  / 
   \\:\\/:/  /        /:/  /        /:/  /         \\/__/     \\:\\ \\/__/     \\:\\  \\    \\:\\  \\       /:/  /  
    \\::/  /        /:/  /        /:/  /                     \\:\\__\\        \\:\\__\\    \\:\\__\\     /:/  /   
     \\/__/         \\/__/         \\/__/                       \\/__/         \\/__/     \\/__/     \\/__/   
**********************************************************************************************************/
pragma solidity 0.8.19;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
 * @dev Revert with an error when the mint is not active
 */
error MintNotActive();
/**
 * @dev Revert with an error mint to recipients count does not match supply
 */
error RecipientLengthDoesNotMatchSupply();
/**
 * @dev Revert with an error when trying to set the mint active when it was already set active
 */
error AlreadySetActive();
/**
 * @dev Revert with an error when trying to mint an invalid token
 */
error InvalidToken();
/**
 * @dev Revert if we've minted all the tokens
 */
error SoldOut();
/**
 * @dev Revert if we have frozen setting URIs
 */
error TokenUrisFrozen();
contract ShapellaUpgradeNFT is ERC721, Ownable {
    string private CONTRIBUTOR_TOKEN_URI;
    string private OPEN_EDITION_TOKEN_URI;
    uint128 private constant CONTRIBUTOR_SUPPLY = 128;
    uint128 private constant CONTRIBUTOR_STARTING_TOKEN_ID = 1;
    uint128 private constant OPEN_EDITION_STARTING_TOKEN_ID = CONTRIBUTOR_SUPPLY + CONTRIBUTOR_STARTING_TOKEN_ID;
    uint64 private constant OPEN_EDITION_LENGTH = 3 days;
    uint128 private nextTokenId = OPEN_EDITION_STARTING_TOKEN_ID;
    uint64 public mintOpenUntil;
    // Until true, admins can set token URIs
    bool public isFrozen = false;
    constructor(
        string memory contributorTokenUri,
        string memory openEditionTokenUri
    ) ERC721("ShapellaUpgrade", "SHAPELLA") {
        CONTRIBUTOR_TOKEN_URI = contributorTokenUri;
        OPEN_EDITION_TOKEN_URI = openEditionTokenUri;
    }
    /**
     * @notice Mint an open edition NFT - restricted to a specific time window
     */
    function publicMint() external {
        if (block.timestamp > mintOpenUntil) {
            revert MintNotActive();
        }
        if (nextTokenId == type(uint128).max) {
            revert SoldOut();
        }
        _mint(_msgSender(), nextTokenId++);
    }
    /**
     * @notice See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (tokenId < OPEN_EDITION_STARTING_TOKEN_ID) {
            return CONTRIBUTOR_TOKEN_URI;
        }
        _requireMinted(tokenId);
        return OPEN_EDITION_TOKEN_URI;
    }
    /**
     * @notice Set the open edition mint to active
     * @dev Restricted to admins. Cannot set active more than once.
     */
    function setActive() external {
        if (mintOpenUntil != 0) {
            revert AlreadySetActive();
        }
        mintOpenUntil = uint64(block.timestamp) + OPEN_EDITION_LENGTH;
    }
    /**
     * @notice Mint a token
     * @dev Restricted to admins.
     * @param tokenId The token to mint
     * @param recipient The address to mint the token to
     */
    function adminMintTo(uint256 tokenId, address recipient) external onlyOwner {
        if (tokenId >= OPEN_EDITION_STARTING_TOKEN_ID) {
            revert InvalidToken();
        }
        _mint(recipient, tokenId);
    }
    /**
     * @notice Mint contributor NFTs
     * @dev Restricted to admins
     * @param recipients The recipient addresses to mint the tokens to
     */
    function adminMintContributorNfts(address[] memory recipients) external onlyOwner {
        if (recipients.length != CONTRIBUTOR_SUPPLY) {
            revert RecipientLengthDoesNotMatchSupply();
        }
        for (uint256 i = 0; i < CONTRIBUTOR_SUPPLY; i++) {
            _mint(recipients[i], CONTRIBUTOR_STARTING_TOKEN_ID + i);
        }
    }
    /**
     * @notice Set token URIs
     * @dev Restricted to admins
     * @param contributorTokenUri CONTRIBUTOR_TOKEN_URI value
     * @param openEditionTokenUri OPEN_EDITION_TOKEN_URI value
     */
    function adminSetTokenUris(
        string memory contributorTokenUri,
        string memory openEditionTokenUri
    ) external onlyOwner {
        if (isFrozen == true) {
            revert TokenUrisFrozen();
        }
        CONTRIBUTOR_TOKEN_URI = contributorTokenUri;
        OPEN_EDITION_TOKEN_URI = openEditionTokenUri;
    }
    /**
     * @notice Sets isFrozen flag to true
     * @dev Restricted to admins; cannot be undone
     */
    function adminSetFrozen() external onlyOwner {
        isFrozen = true;
    }
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;
    // Token name
    string private _name;
    // Token symbol
    string private _symbol;
    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;
    // Mapping owner address to token count
    mapping(address => uint256) private _balances;
    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;
    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;
    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }
    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }
    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }
    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }
    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }
    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);
        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }
    /**
     * @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, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }
    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");
        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner nor approved for all"
        );
        _approve(to, tokenId);
    }
    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);
        return _tokenApprovals[tokenId];
    }
    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }
    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }
    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _transfer(from, to, tokenId);
    }
    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }
    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _safeTransfer(from, to, tokenId, data);
    }
    /**
     * @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.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }
    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }
    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }
    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }
    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }
    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");
        _beforeTokenTransfer(address(0), to, tokenId);
        _balances[to] += 1;
        _owners[tokenId] = to;
        emit Transfer(address(0), to, tokenId);
        _afterTokenTransfer(address(0), to, tokenId);
    }
    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);
        _beforeTokenTransfer(owner, address(0), tokenId);
        // Clear approvals
        _approve(address(0), tokenId);
        _balances[owner] -= 1;
        delete _owners[tokenId];
        emit Transfer(owner, address(0), tokenId);
        _afterTokenTransfer(owner, address(0), tokenId);
    }
    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");
        _beforeTokenTransfer(from, to, tokenId);
        // Clear approvals from the previous owner
        _approve(address(0), tokenId);
        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;
        emit Transfer(from, to, tokenId);
        _afterTokenTransfer(from, to, tokenId);
    }
    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }
    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }
    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }
    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }
    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * 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, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
// 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 (last updated v4.7.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);
    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);
    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;
    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;
    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;
    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;
    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);
    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @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);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.
        return account.code.length > 0;
    }
    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");
        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }
    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }
    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }
    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
// 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.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 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);
}