ETH Price: $2,515.81 (-4.09%)

Transaction Decoder

Block:
19187493 at Feb-09-2024 02:06:23 AM +UTC
Transaction Fee:
0.113965326806424955 ETH $286.71
Gas Used:
2,083,373 Gas / 54.702315335 Gwei

Emitted Events:

Account State Difference:

  Address   Before After State Difference Code
1.521014624079492484 Eth1.522056310579492484 Eth0.0010416865
0x7A405A70...7456e6eBB
0.5 Eth
Nonce: 0
0.386034673193575045 Eth
Nonce: 1
0.113965326806424955
0xeCd48F32...cE8aF7649
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 261527026612320667694382326714097738220200965086911343713631972455930222233670024777085863592225112563218039411101948167059320508916084492515478160770208208204978572316184283243024135708545674229741997890351019131843122911085422359353283858518995470814311941739561280498330312995576537354428114459152027112611879263212344840784166028261645965241541060558790284662111601383243820237265855451455094712344248719015928410324925877668176295142701122067141110799544789282605193787281390395289321140412010203080255372072275142547695997347484495730308717440127481656405898199265854298782377054137934079968988751427239359328434535200405978917385576140291972159631961439275756875960583650363752623911614521780805167554765926815977013940700347016453270318825742089275042647708738574992685982120734797013530983586235319611360469531309528069453504934325400959258905969542022773887716755077690893399203757763199544715318072872351243266590380133477145958449435766537399442754122973951122724273022597903292203091302090726574897414759095583973516719264768385421005386025716081857783143148943711003209642705618648977725780405757193800355389700966998448887777878071641153482936078567191301896356375484473864192344881448144456897703498514102933472429446686610775384457021494216331930125920008887305893448913145729316953164681331674747767017312182388862462507067543084138671247812388041095920844438209325739372304344479361818842607362970651759474410446113620312077165655053357768911368424916968034646739197796807486479546151675164855651421216648547946379664150186726602379615795458113414886125148321660851725818887993473002326973929563307018225912093559940270866285712971408980977549455502499397475395925038245513439946843944699377429278608563096542670381067884125952441484080240874390331344949112285728438718372226362643719880300581160781843475451601023877726638984217006891134330093015946797356306446651926020594283682337874472076520369176955508027974011995099343552252470725924088322392533097889479707605310884740040795326914936025087835316293137628711646252744148068401842638458523044122861485740061638441320796510190874563975310151735802964615254557655808849693049014829138115520971069975003836832193800386095214143092960172776490990963898001988974226594820705416126374673493445768262172103837164764340003451430033946229814475405757704833012365728218186088434494195377240325898871919255085592614304057319805936812838125715505660446584117910901550734827513741724155104564156098478220351753651438526708642900729071286272669557696875723329476185930501052070649281328059939437709696453534676107079453590633139479976988544833522400624358008780976366659909944665627240409392956855820275989531331069000657483894298595809196483527709869431793133615219322456718781832864014427683793704594850638630364286021586009743192735775787155867498230884643020828885201360002169322888515965480777883164869357422183791335953354703432477141429463899467696109456683642634088049419614102362038104753818383894260362978754456696510145132046362920280590809307739678663293621828013664825558874130496072826267289231471733401267570752777280459585158507634633725636460833407703477941248353422640646978662806211101486092761313543535478634331635172371466469122065137025057807460232255130572065339612145404392589394604237903408723461262734346713676651532694010444099788388020039999392015896383234588133374946010597791483165156943137177399629821711120284354910780472438164026331624460543595852680746260133227358648421677080156186794722174190674772505497969020414210286314956799260014444016068299553928177120372418833759580833083166529745159376977956497392026990841902182127219039886978492299391455196591733031042408115063723777426905863404864728429299470404225170847742676712970603196710547414067164727898636903605887919340997428544872325135375886799098808789956656193536145949797234161021198855259863984999394065185649760361673972136184590387016524414009537381247007592727712995531147690280714971377136539705854220004795761700090905350677258715117176639950400827888997401419430162957458440888086905717804791212689066864910727864249900034650082885019084218911628577978867001307397481415752347202323596753508807477593185359235523895832457857152371550303043816755544177397795950036696592502124251762717591563061780253208712305562871980611509503523444416051433898490036576802049841149239411460833074012355531032572425579351509648191194627645309279281114253325265841526463656274665295670290265315637778534285808183761501359354654641112071125100624608489689297734980542777524540888856968044110872933117300253188718146564739880015332250254426659509938804997111216163858823715716138511380219152913540076865696383178687452708101165140061191964234517322856251529111761339450278387654320608743797182310690972762812737622367592413659572676383679075964762744154473752860287033575748918547613422627618691480182867229781704938005510278204209390137608556416094829330536670757650184629735856159773152875719173913271047327186560777555529553707708303252612215457026445307485155709392382549460052823120260866662307191392697630160767109771605805689763706869604859642679912011887359256202013867378255176787530407957865668497122862154289846908414950358024497039181600910696932181179715651656284307734914332407955323107292333882992780605757095842837386657191614076466475831820784186004895484769319806363113827568227533056870373215570825694762302378857537726358848676030885230942742540474949943699339224829276071149910750097320742789144865828358467402287349485077348704711756672893967949909104015350928685304831268289891263437890962066650140331260525341405613459042940981916255856637285923763280216463650941430999977057203168048944430056224604840405882653175696596805863252656784441151100544092984439616587650312510813325647430990382139765013277692327437131026068459017310781142391745560453728494507044710920143350248530251708272452107733855825909674341837612479436977392903223620144974377955625954597710008921566880402412650403568582742378001234527836241734963930316903216308698335496219744097767651347965369921580741986824762761952898604765303436321186524611733366047965840164611936976489697908718999058988624973585306710890956672342621814585171100018479399258434021891919522637855700089012232693021246200669048811204266139813080103377097969779467223386307743231993687379428297947696101900948255860151289476304207839991634572910940285099579666089242903082389161526879170649293568557443243245125808136403103796485464119663274592223064683794331155586733865050371540534803512467852537970478726726712139496878618099744829702475203297990497750967377637847248530704746240381535619614612286149409332340957606012678033070523493726537628611456369014011266892727257095855546836284376964386038778433410428880200102923253365903204646572560272750183725252865891241376048654703371240904494003890993751437841171567960632956525405454793088017985784675549650366531722106449519279265655482035358461973933263363321227378280357091176981121536011924237634442512226319772036994724596727814579956070655577417558492731467713058955391736006075010568851357731458803606265098136379523797698168542125427310395068100784197689660838834819154283519603015833549787832905515729934309481228489359460653510278617589161044637518444051062749833512888985722207929269472845227917269544862767450693157007216630664939266047830923027024549544355999770764742215414069764129261894551561591866173465321541736783302711148021348367937036588922523465200478642992749353984826372815043060961397822627933597059161854888080830489402891404707251207130650216717710844499425546777735630118095883913742653491882757883383884654597852305434865781882556168278770657307154257872995997085326125683222021658877824742718438109882849879720943673987390824303707463705987827712809468840095840755489568259753111253200470843207088480152089098928077108132177485316773523695945534388438665943094450973785400463085655498511297998393758133188959734727530167410448981383149318903418550114674140094951508959095109979159263702169793752855049016413737983856061981006558828781276015726738885150125460251794773647392751565328307147950692991940767933751927782722932370823935034247261385395439354424492447798287428184868219254380942420487209482455554711622563567191382115183037556944697852427779343093837526295423796118220977720929872168471648865357959691983607180685930992640861935126435783071762948115416125606737414607259011239409133753718222955322015496788095571755822091226073657177912398661331346287070396378461392847973726506980375954138083404636567818210586150937431493626345569923606140357931088417353597126125559329457460801382247233350927483699526836901902790704431474093843298951301274211249141035809440143988054431876624510443836107218389285113945414611641397029837538075144135591576963476789522925709292029140272028195292939700459109765813497895014549487831766797932902085035995011484423531589368594480990419650658212619494466128330768588368870630168941137035683942977747431178605560480749389278479900508483027613472040431216065869192841228921091460208709399841697075794173360944527510548386022906290346538825475215940075770977804757724807978687725944405547931291856563528226540635686853021125749308604540190560080378346232625195818724505830250422613701566001769713569562994024668653874575239571488612945927529931461815975029339640599224449823719909195445489716096535221842315631276040770706267958869661172800581839913966457061510480887367772109016516357994964248744529053330246449383598882904427020751177723930173960603398948858395083941934017719992968051914714465938762748068405714616501250527030428654215535125071322349513391631070489194343418805485887286145261209770437312200518950565346667689221057124676647995384378988843564383160570627578632437806080375555137649757962846657944989448947679988556874528775750446242788443921616794660406441092695977258792164937284239567609901938369747296771244686376060176681239912932897598736454979561969039962543101931931779770492342051741569721079441373995118109870141105212769040782994830268788419188414485619474468993373390438830510687268489272877099689604642641436440762445898428279928321734068366946517400186439215186276292361826166078392829251704515678824349458067372413248945367180746252583071913862847837337987681572466538174090687224160964667091906469169652826386356132800723854255992788071545797227677520840718514158067462898684876860687022077225619232880356895335940953777409388434217136108284119379060410393957576386556585658635443369730258206482122319255369216134022080358668236654050036790622316152769860402140480338958412581048603445488629126443809426616092696625979562602663798457556439024969113986386820363484438957844239300231841000440360139277727134623375821639668565454696411287261449946655851202369498302777978136620116715395072882664404786601763004515407297483249453729352333155116017167026610263197406517217415433196005947150340556154881911022483355206129310859022887276692956181055397283290591816403829759631730845120131719608927890649328355422909497631734947968861678192985991060820535876356155832345157134285011713459947490699658271370821896878443809012076361262459998571761670113709538283307976836453638749084760903661704447847686266498502388847857173225425589986579927694664094938961795189715707495931341240308335061195104555878979022824527028924774319478335762130631521116559771546258398012785595405448023475963593724307622348337117334273098547884348759486489578692312465157558091884422019750275003191833867899714207503071359199624393975711098198592916480578533894743647421552909911827103091728433651696371778846359660375874334657238028517641387778680341017899834598708616602707218486247109975187476865570809166258431030027243261876576919346767275967600405337151634272187286996640475087946103794818095307668805555444713253944075529711589437572104475575501207966763568023855741435321270422274079061058704039674303389068185176010282505875890588011742851079819863535531476499326565034770632887800141252070887152671489120075013213485328102268727816535899620160478084942244906313352111832062213180067839532138415832878175778189728271212536688133747725872680315944452682188545117602111570495443918532429909955494171502854439550190489819856890111710191236808618099719463463281236193851308528560547222586479741642870311337347905229207494317782967876673604656053568461859437869694363320099901168445881230468389811086541878954510051311076900564517964369740275229475176314739181164703316316846624493872077349920802145743377087379186309083758161359409078031275712123512207341166078101092907473417414745103916337063769917769559678958576729652697239920642181460604085501576127111870734491735465127038105640414990063629304776783814863549368112246947514260874835450972157520576025018819596942945626637590719315898546861986175093313140201659124348806539452374385666547691177678984717291722283637247589553177257840336248029107245059661394444623348448287165705628943798788925900070585711594703925509397008833530907026627792722547824490320210943606836509667806163223434226267924170260949978618924986415764280963248116758093755646089778430487938184782682148458737989688464219541586253115209845446899837623884467007097979863911434832020966889367616544466834137258462486335055957145161370355481778986006564051224426813756442691526922374408432785422458436589945608130876055749445871064249420756495311917331760038392196196603800055317752708319414407142846459542191007307119193425713350398429771055737495063734104129859774717008352258757783886886974920935396642501795724613154573524998955178806288837796755796574974337035581608779055597623741079143416056942321731165823631088478827762647560517601355039889934510548628873007306822014444600400765257583168853067426777080300894721910201912353006999752051584036477355962332095264994466489617132527689334122830582779612817684631611837850029621229734888428275743317583773956473462227964626186667323834664687345913026046597596487303364478191598026844662709422676784732791556345971323861228527126928689363841049767665419672918843708780924051534730225607545362029896710774002750496136063672571148168455020387524534947258002477516025388760386369307486949086877186258641080814076493551804275678182080881948297577048761901158961746288563930420144544744556909519351067203751026519363711732230164142797675632663703024716254086301897095709373588785356970500002125659360014984797434948791114779044770680338826911381591949547564961847047299867077549416892378573796492983050686083254900024675889492045926609662750293287805529322459043355252015032855511587260446034442501492357146218428912925089715758754634102566132234058928094584932574398438214418661407342083282929343912007078167340365436978586425525790032037149276940464176483764771697042718789261120527293506411264317160649524291976425104143911522094638029986785746046678933453029709932050608477493344933645919238309615741942027943685187417407021255375127402672671080809456762106072755082923024835884904856162755816882948843866096958200803198785499402841166363132964854586559597402702241958307164519270214711413809496008988530483136123793426716172079706612920998945606439933500579236988819539949473407953160367606650807024127762955215708051593800708050266877759618895910562436482829430049795942630058688749855898553775228248078677124554464148080387105510499874701690675529734795260325413165010959528152051478797816145282273319364800855370948139127947528111876261939309909173361436751084167234407669387370902472982917320484789136769540095449899242710731150192778325321542183264078627822536266208788916407496732897216649922145226798507286027391711622506652608331612229911414879530569527866384312692279832736752135968575186184505470702043240545186330496678756533311339881438630363254042848622982331009871216005491098958990880708794178809432515006029713245694152155080417880193154181349847197108818606895712969688023310741786727001853372974875845749293382572537165489827846153584918116492189822704385322704693975000835064274545282052460540574595349467494633942284460027890882999687916060805767451227318276369148683105967579923095928268862615991913518149400041839207379148464818066823881019356492126092441209035947617492629580079626094433601485409130898627838255977920357759512692226817117289932326609804697723084499999692252529404208706537747399370954142341652009017534588899169889521939164411849022851390685818450742378359594720041639667841638898825728899615715838888596931797641695105735970559854250203327418045953121745896691308407830202148816013502665340546055870154824109761393395544448587582473878834247252484335469820596902010413999667096434008124501619783074407874816855909720941253586187004719494947035081613913301009067941926424664022933739622334293472178323350482659828242638385953437176142189242849259550719125726417910084770627725921044412036489893609889655934149353916814083306034703138900208918831716504781392670759392081335839826175715813709645237235191548656252705320826531199612602179574449511364505033453046817652727132488442058263179375061441900500260714695999982112535662338276224307188478636885195385291110808840787339592211813210092139652788891909103826273068559767208127352556374237444760447956174084370557561669934380072308479820677293327108778534458949317896726865020113717855678097386969712969064035942863340872363770029707756084794163628996955182498446547998525087101863918876110357094452953736590035836223260521528245516821985892891912466001906595669367098394455027050346402914521577407888067010647727544345799876344612409851380852249634559456133690611042318280560271654627066807368544559049973091779083835053564957219478173837784581923164954586834479362069141985381513589024719541218000275226724555606745156024500352731959503111574587310142919585082571250278576832944537870490553054170483894448438162700867794011679226686082116488327787363497096922458868336847313673687475089906782536566446720885354746585335898209415004518484483857018612569054649339067671378678319720786715349805481209511613843583628854389153341896509805271126073552420873905995166528152532385361583194571046334671996851835964723552091197140831122438664860269667814057423787015268163346000476957278896717725236109960013692329864223748260795489352330067773802854422398356798074139384967602117260126848253589443556602732262330030961338860115940635929970755681677510263937052064264641420544068309769729794543920016171350821327035510895121176925895205194375069239695882062323712692320853548921185937481672950442567661889669969264426816235221202454467074885561067770632556970664112178270614892244580621115739303244645772883566110394591402343402224827660276504185132234329230831645759289238787523294920213243325937347046542829193938961176327975511176068935591604756873966046314164681266793128781360565972092097178749862344404126146129599093032920201607854899467960663758963873007831959437581846252637923148871120910645690285710567853273061481975424657462411368410059466537809632448218249495551766267908766839175416419604451608885710290227961066907464632859800674602710631292772494221713372985167116887339331767215392173986819958782366212099382539138961126697376287953237076398905521726666030039608017521076169822090119549612033621625766266256702547134260516715937863283778742083888462780722819367004583779624710812031914005579668496971783603189350698889987915205516969110406511581732135083804717383004366581887846282894974575413150783589457463175951062445946154862769762491152411774540777879491289613892891612992192187812285424812078568819270326798683755057368260632222262862676709298984470121460767012875668446416799125039791432666041605395969930381522289190783060435142766363188145779620091403354599715823797102710145917126443831503420022946970134158558968783464670547398773510487661499866435187496939566917825953480299330844867200351997402469434670430372077254127084009236380528464603293551765373652744496063958271767071933878853969755625263523232159025586131733343488357009321022810587374428804632613077502552072414581771419659877565555998742831702337077521265967694032759471756129631252245012001709015948681230622436817178262712722001999946356896522351387781162897363024746461278375603803084194581990012811161389144078972471853141424019063185345134075231959496864733222615311646611136620831906138449201268545348388830640818812769013339365449194356751104855911181815080604065682734447370309944218915850149433066775974276702736115393343549161720953085329281203373608512054652678915540385326686236339796338215243471525891468491018171583439358212147078016965216322324308897216140021360357722237085168584750225782656051153704497057473553391196989537139895264120570929760259912832363632484451508719733466801689717093375249053665201344162725470772519610249318239298912307

Execution Trace

Tadpole.60c06040( )
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);
    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);
    bool private _paused;
    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }
    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }
    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }
    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }
    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }
    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
// 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 v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    /**
     * @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);
    }
}
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
abstract contract Ownable {
    event OwnershipTransferred(address indexed user, address indexed newOwner);
    error Unauthorized();
    error InvalidOwner();
    address public owner;
    modifier onlyOwner() virtual {
        if (msg.sender != owner) revert Unauthorized();
        _;
    }
    constructor(address _owner) {
        if (_owner == address(0)) revert InvalidOwner();
        owner = _owner;
        emit OwnershipTransferred(address(0), _owner);
    }
    function transferOwnership(address _owner) public virtual onlyOwner {
        if (_owner == address(0)) revert InvalidOwner();
        owner = _owner;
        emit OwnershipTransferred(msg.sender, _owner);
    }
    function revokeOwnership() public virtual onlyOwner {
        owner = address(0);
        emit OwnershipTransferred(msg.sender, address(0));
    }
}
abstract contract ERC721Receiver {
    function onERC721Received(
        address,
        address,
        uint256,
        bytes calldata
    ) external virtual returns (bytes4) {
        return ERC721Receiver.onERC721Received.selector;
    }
}
/// @notice ERC404
///         A gas-efficient, mixed ERC20 / ERC721 implementation
///         with native liquidity and fractionalization.
///
///         This is an experimental standard designed to integrate
///         with pre-existing ERC20 / ERC721 support as smoothly as
///         possible.
///
/// @dev    In order to support full functionality of ERC20 and ERC721
///         supply assumptions are made that slightly constraint usage.
///         Ensure decimals are sufficiently large (standard 18 recommended)
///         as ids are effectively encoded in the lowest range of amounts.
///
///         NFTs are spent on ERC20 functions in a FILO queue, this is by
///         design.
///
abstract contract ERC404 is Ownable {
    // Events
    event ERC20Transfer(address indexed from, address indexed to, uint256 amount);
    event Approval(address indexed owner, address indexed spender, uint256 amount);
    event Transfer(address indexed from, address indexed to, uint256 indexed id);
    event ERC721Approval(address indexed owner, address indexed spender, uint256 indexed id);
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
    // Errors
    error NotFound();
    error AlreadyExists();
    error InvalidRecipient();
    error InvalidSender();
    error UnsafeRecipient();
    // Metadata
    /// @dev Token name
    string public name;
    /// @dev Token symbol
    string public symbol;
    /// @dev Decimals for fractional representation
    uint8 public immutable decimals;
    /// @dev Total supply in fractionalized representation
    uint256 public immutable totalSupply;
    /// @dev Current mint counter, monotonically increasing to ensure accurate ownership
    uint256 public minted;
    // Mappings
    /// @dev Balance of user in fractional representation
    mapping(address => uint256) public balanceOf;
    /// @dev Allowance of user in fractional representation
    mapping(address => mapping(address => uint256)) public allowance;
    /// @dev Approval in native representaion
    mapping(uint256 => address) public getApproved;
    /// @dev Approval for all in native representation
    mapping(address => mapping(address => bool)) public isApprovedForAll;
    /// @dev Owner of id in native representation
    mapping(uint256 => address) internal _ownerOf;
    /// @dev Array of owned ids in native representation
    mapping(address => uint256[]) internal _owned;
    /// @dev Tracks indices for the _owned mapping
    mapping(uint256 => uint256) internal _ownedIndex;
    /// @dev Addresses whitelisted from minting / burning for gas savings (pairs, routers, etc)
    mapping(address => bool) public whitelist;
    // Constructor
    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals,
        uint256 _totalNativeSupply,
        address _owner
    ) Ownable(_owner) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;
        totalSupply = _totalNativeSupply * (10**decimals);
    }
    /// @notice Initialization function to set pairs / etc
    ///         saving gas by avoiding mint / burn on unnecessary targets
    function setWhitelist(address target, bool state) public onlyOwner {
        whitelist[target] = state;
    }
    /// @notice Function to find owner of a given native token
    function ownerOf(uint256 id) public view virtual returns (address owner) {
        owner = _ownerOf[id];
        if (owner == address(0)) {
            revert NotFound();
        }
    }
    /// @notice tokenURI must be implemented by child contract
    function tokenURI(uint256 id) public view virtual returns (string memory);
    /// @notice Function for token approvals
    /// @dev This function assumes id / native if amount less than or equal to current max id
    function approve(address spender, uint256 amountOrId) public virtual returns (bool) {
        if (amountOrId <= minted && amountOrId > 0) {
            address owner = _ownerOf[amountOrId];
            if (msg.sender != owner && !isApprovedForAll[owner][msg.sender]) {
                revert Unauthorized();
            }
            getApproved[amountOrId] = spender;
            emit Approval(owner, spender, amountOrId);
        } else {
            allowance[msg.sender][spender] = amountOrId;
            emit Approval(msg.sender, spender, amountOrId);
        }
        return true;
    }
    /// @notice Function native approvals
    function setApprovalForAll(address operator, bool approved) public virtual {
        isApprovedForAll[msg.sender][operator] = approved;
        emit ApprovalForAll(msg.sender, operator, approved);
    }
    /// @notice Function for mixed transfers
    /// @dev This function assumes id / native if amount less than or equal to current max id
    function transferFrom(
        address from,
        address to,
        uint256 amountOrId
    ) public virtual {
        if (amountOrId <= minted) {
            if (from != _ownerOf[amountOrId]) {
                revert InvalidSender();
            }
            if (to == address(0)) {
                revert InvalidRecipient();
            }
            if (msg.sender != from && !isApprovedForAll[from][msg.sender] && msg.sender != getApproved[amountOrId]) {
                revert Unauthorized();
            }
            balanceOf[from] -= _getUnit();
            unchecked {
                balanceOf[to] += _getUnit();
            }
            _ownerOf[amountOrId] = to;
            delete getApproved[amountOrId];
            // update _owned for sender
            uint256 updatedId = _owned[from][_owned[from].length - 1];
            _owned[from][_ownedIndex[amountOrId]] = updatedId;
            // pop
            _owned[from].pop();
            // update index for the moved id
            _ownedIndex[updatedId] = _ownedIndex[amountOrId];
            // push token to to owned
            _owned[to].push(amountOrId);
            // update index for to owned
            _ownedIndex[amountOrId] = _owned[to].length - 1;
            emit Transfer(from, to, amountOrId);
            emit ERC20Transfer(from, to, _getUnit());
        } else {
            uint256 allowed = allowance[from][msg.sender];
            if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amountOrId;
            _transfer(from, to, amountOrId);
        }
    }
    /// @notice Function for fractional transfers
    function transfer(address to, uint256 amount) public virtual returns (bool) {
        return _transfer(msg.sender, to, amount);
    }
    /// @notice Function for native transfers with contract support
    function safeTransferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        transferFrom(from, to, id);
        if (
            to.code.length != 0 &&
            ERC721Receiver(to).onERC721Received(msg.sender, from, id, "") != ERC721Receiver.onERC721Received.selector
        ) {
            revert UnsafeRecipient();
        }
    }
    /// @notice Function for native transfers with contract support and callback data
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        bytes calldata data
    ) public virtual {
        transferFrom(from, to, id);
        if (
            to.code.length != 0 &&
            ERC721Receiver(to).onERC721Received(msg.sender, from, id, data) != ERC721Receiver.onERC721Received.selector
        ) {
            revert UnsafeRecipient();
        }
    }
    /// @notice Internal function for fractional transfers
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual returns (bool) {
        uint256 unit = _getUnit();
        uint256 balanceBeforeSender = balanceOf[from];
        uint256 balanceBeforeReceiver = balanceOf[to];
        balanceOf[from] -= amount;
        unchecked {
            balanceOf[to] += amount;
        }
        // Skip burn for certain addresses to save gas
        if (!whitelist[from]) {
            uint256 tokens_to_burn = (balanceBeforeSender / unit) - (balanceOf[from] / unit);
            for (uint256 i = 0; i < tokens_to_burn; i++) {
                _burn(from);
            }
        }
        // Skip minting for certain addresses to save gas
        if (!whitelist[to]) {
            uint256 tokens_to_mint = (balanceOf[to] / unit) - (balanceBeforeReceiver / unit);
            for (uint256 i = 0; i < tokens_to_mint; i++) {
                _mint(to);
            }
        }
        emit ERC20Transfer(from, to, amount);
        return true;
    }
    // Internal utility logic
    function _getUnit() internal view returns (uint256) {
        return 10**decimals;
    }
    function _mint(address to) internal virtual {
        if (to == address(0)) {
            revert InvalidRecipient();
        }
        unchecked {
            minted++;
        }
        uint256 id = minted;
        if (_ownerOf[id] != address(0)) {
            revert AlreadyExists();
        }
        _ownerOf[id] = to;
        _owned[to].push(id);
        _ownedIndex[id] = _owned[to].length - 1;
        emit Transfer(address(0), to, id);
    }
    function _burn(address from) internal virtual {
        if (from == address(0)) {
            revert InvalidSender();
        }
        uint256 id = _owned[from][_owned[from].length - 1];
        _owned[from].pop();
        delete _ownedIndex[id];
        delete _ownerOf[id];
        delete getApproved[id];
        emit Transfer(from, address(0), id);
    }
    function _setNameSymbol(string memory _name, string memory _symbol) internal {
        name = _name;
        symbol = _symbol;
    }
}
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "./ERC404.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
/* The official TADPOLE ERC404 by Froggy Friends */
contract Tadpole is ERC404, Pausable {
    string public tadpoleUrl;
    bool public revealed;
    uint256 public buyLimit;
    uint256 public sellLimit;
    uint256 public txLimit;
    mapping (address => uint256) public userBuyLimit;
    mapping (address => uint256) public userSellLimit;
    bool public applyTxLimit;
    constructor(address _owner, uint256 _buyLimit, uint256 _sellLimit) ERC404("Tadpole", "TADPOLE", 18, 10000, _owner) {
        balanceOf[_owner] = 10000 * 10 ** 18;
        buyLimit = _buyLimit * 10 ** 18;
        sellLimit = _sellLimit * 10 ** 18;
        txLimit = 10 * 10 ** 18;
    }
    function pause() public onlyOwner {
        super._pause();
    }
    function unpause() public onlyOwner {
        super._unpause();
    }
    function setLimit(uint256 _buylimit, uint256 _selllimit) public onlyOwner {
        buyLimit = _buylimit * 10 ** 18;
        sellLimit = _selllimit * 10 ** 18;
    }
    function startApplyingLimit() external onlyOwner{
        applyTxLimit = true;
    }
    function stopApplyingLimit() external onlyOwner{
        applyTxLimit = false;
    }
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal override virtual whenNotPaused returns (bool){
        if(applyTxLimit){
            require(amount < txLimit, "exceed tx limit");
        }
        if(!whitelist[from]){
            userSellLimit[from] += amount;
            require(userSellLimit[from] <= sellLimit, "not allowed anymore to sell");
        }
        if(!whitelist[to]){
            userBuyLimit[to] += amount;
            require(userBuyLimit[to] <= buyLimit, "not allowed anymore to buy");
        }
        return super._transfer(from, to, amount);
    }
    function setTadpoleUrl(string memory _tokenURI) public onlyOwner {
        tadpoleUrl = _tokenURI;
    }
    function setNameSymbol(string memory _name, string memory _symbol) public onlyOwner {
        _setNameSymbol(_name, _symbol);
    }
    function setRevealed(bool _revealed) public onlyOwner {
        revealed = _revealed;
    }
    function tokenURI(uint256 id) public view override returns (string memory) {
        if (bytes(tadpoleUrl).length <= 0) return "";
        return
            revealed
                ? string(abi.encodePacked(tadpoleUrl, Strings.toString(id)))
                : string(abi.encodePacked(tadpoleUrl));
    }
}