123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647 |
- :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
- :Math: pass:normal[xref:utils.adoc#Math[`Math`]]
- :SignedMath: pass:normal[xref:utils.adoc#SignedMath[`SignedMath`]]
- :SafeCast: pass:normal[xref:utils.adoc#SafeCast[`SafeCast`]]
- :ECDSA: pass:normal[xref:utils.adoc#ECDSA[`ECDSA`]]
- :MessageHashUtils: pass:normal[xref:utils.adoc#MessageHashUtils[`MessageHashUtils`]]
- :SignatureChecker: pass:normal[xref:utils.adoc#SignatureChecker[`SignatureChecker`]]
- :MerkleProof: pass:normal[xref:utils.adoc#MerkleProof[`MerkleProof`]]
- :EIP712: pass:normal[xref:utils.adoc#EIP712[`EIP712`]]
- :ReentrancyGuard: pass:normal[xref:utils.adoc#ReentrancyGuard[`ReentrancyGuard`]]
- :Pausable: pass:normal[xref:utils.adoc#Pausable[`Pausable`]]
- :Nonces: pass:normal[xref:utils.adoc#Nonces[`Nonces`]]
- :BitMaps: pass:normal[xref:utils.adoc#BitMaps[`BitMaps`]]
- :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
- :EnumerableSet: pass:normal[xref:utils.adoc#EnumerableSet[`EnumerableSet`]]
- :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
- :DoubleEndedQueue: pass:normal[xref:utils.adoc#DoubleEndedQueue[`DoubleEndedQueue`]]
- :Checkpoints: pass:normal[xref:utils.adoc#Checkpoints[`Checkpoints`]]
- :Create2: pass:normal[xref:utils.adoc#Create2[`Create2`]]
- :Address: pass:normal[xref:utils.adoc#Address[`Address`]]
- :Arrays: pass:normal[xref:utils.adoc#Arrays[`Arrays`]]
- :Base64: pass:normal[xref:utils.adoc#Base64[`Base64`]]
- :Strings: pass:normal[xref:utils.adoc#Strings[`Strings`]]
- :ShortString: pass:normal[xref:utils.adoc#ShortString[`ShortString`]]
- :StorageSlot: pass:normal[xref:utils.adoc#StorageSlot[`StorageSlot`]]
- :Multicall: pass:normal[xref:utils.adoc#Multicall[`Multicall`]]
- :Context: pass:normal[xref:utils.adoc#Context[`Context`]]
- :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
- :EnumerableSet: pass:normal[xref:utils.adoc#EnumerableSet[`EnumerableSet`]]
- :xref-Math-tryAdd-uint256-uint256-: xref:utils.adoc#Math-tryAdd-uint256-uint256-
- :xref-Math-trySub-uint256-uint256-: xref:utils.adoc#Math-trySub-uint256-uint256-
- :xref-Math-tryMul-uint256-uint256-: xref:utils.adoc#Math-tryMul-uint256-uint256-
- :xref-Math-tryDiv-uint256-uint256-: xref:utils.adoc#Math-tryDiv-uint256-uint256-
- :xref-Math-tryMod-uint256-uint256-: xref:utils.adoc#Math-tryMod-uint256-uint256-
- :xref-Math-max-uint256-uint256-: xref:utils.adoc#Math-max-uint256-uint256-
- :xref-Math-min-uint256-uint256-: xref:utils.adoc#Math-min-uint256-uint256-
- :xref-Math-average-uint256-uint256-: xref:utils.adoc#Math-average-uint256-uint256-
- :xref-Math-ceilDiv-uint256-uint256-: xref:utils.adoc#Math-ceilDiv-uint256-uint256-
- :xref-Math-mulDiv-uint256-uint256-uint256-: xref:utils.adoc#Math-mulDiv-uint256-uint256-uint256-
- :xref-Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-
- :xref-Math-sqrt-uint256-: xref:utils.adoc#Math-sqrt-uint256-
- :xref-Math-sqrt-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-sqrt-uint256-enum-Math-Rounding-
- :xref-Math-log2-uint256-: xref:utils.adoc#Math-log2-uint256-
- :xref-Math-log2-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log2-uint256-enum-Math-Rounding-
- :xref-Math-log10-uint256-: xref:utils.adoc#Math-log10-uint256-
- :xref-Math-log10-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log10-uint256-enum-Math-Rounding-
- :xref-Math-log256-uint256-: xref:utils.adoc#Math-log256-uint256-
- :xref-Math-log256-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log256-uint256-enum-Math-Rounding-
- :xref-Math-unsignedRoundsUp-enum-Math-Rounding-: xref:utils.adoc#Math-unsignedRoundsUp-enum-Math-Rounding-
- :xref-Math-MathOverflowedMulDiv--: xref:utils.adoc#Math-MathOverflowedMulDiv--
- :xref-SignedMath-max-int256-int256-: xref:utils.adoc#SignedMath-max-int256-int256-
- :xref-SignedMath-min-int256-int256-: xref:utils.adoc#SignedMath-min-int256-int256-
- :xref-SignedMath-average-int256-int256-: xref:utils.adoc#SignedMath-average-int256-int256-
- :xref-SignedMath-abs-int256-: xref:utils.adoc#SignedMath-abs-int256-
- :xref-SafeCast-toUint248-uint256-: xref:utils.adoc#SafeCast-toUint248-uint256-
- :xref-SafeCast-toUint240-uint256-: xref:utils.adoc#SafeCast-toUint240-uint256-
- :xref-SafeCast-toUint232-uint256-: xref:utils.adoc#SafeCast-toUint232-uint256-
- :xref-SafeCast-toUint224-uint256-: xref:utils.adoc#SafeCast-toUint224-uint256-
- :xref-SafeCast-toUint216-uint256-: xref:utils.adoc#SafeCast-toUint216-uint256-
- :xref-SafeCast-toUint208-uint256-: xref:utils.adoc#SafeCast-toUint208-uint256-
- :xref-SafeCast-toUint200-uint256-: xref:utils.adoc#SafeCast-toUint200-uint256-
- :xref-SafeCast-toUint192-uint256-: xref:utils.adoc#SafeCast-toUint192-uint256-
- :xref-SafeCast-toUint184-uint256-: xref:utils.adoc#SafeCast-toUint184-uint256-
- :xref-SafeCast-toUint176-uint256-: xref:utils.adoc#SafeCast-toUint176-uint256-
- :xref-SafeCast-toUint168-uint256-: xref:utils.adoc#SafeCast-toUint168-uint256-
- :xref-SafeCast-toUint160-uint256-: xref:utils.adoc#SafeCast-toUint160-uint256-
- :xref-SafeCast-toUint152-uint256-: xref:utils.adoc#SafeCast-toUint152-uint256-
- :xref-SafeCast-toUint144-uint256-: xref:utils.adoc#SafeCast-toUint144-uint256-
- :xref-SafeCast-toUint136-uint256-: xref:utils.adoc#SafeCast-toUint136-uint256-
- :xref-SafeCast-toUint128-uint256-: xref:utils.adoc#SafeCast-toUint128-uint256-
- :xref-SafeCast-toUint120-uint256-: xref:utils.adoc#SafeCast-toUint120-uint256-
- :xref-SafeCast-toUint112-uint256-: xref:utils.adoc#SafeCast-toUint112-uint256-
- :xref-SafeCast-toUint104-uint256-: xref:utils.adoc#SafeCast-toUint104-uint256-
- :xref-SafeCast-toUint96-uint256-: xref:utils.adoc#SafeCast-toUint96-uint256-
- :xref-SafeCast-toUint88-uint256-: xref:utils.adoc#SafeCast-toUint88-uint256-
- :xref-SafeCast-toUint80-uint256-: xref:utils.adoc#SafeCast-toUint80-uint256-
- :xref-SafeCast-toUint72-uint256-: xref:utils.adoc#SafeCast-toUint72-uint256-
- :xref-SafeCast-toUint64-uint256-: xref:utils.adoc#SafeCast-toUint64-uint256-
- :xref-SafeCast-toUint56-uint256-: xref:utils.adoc#SafeCast-toUint56-uint256-
- :xref-SafeCast-toUint48-uint256-: xref:utils.adoc#SafeCast-toUint48-uint256-
- :xref-SafeCast-toUint40-uint256-: xref:utils.adoc#SafeCast-toUint40-uint256-
- :xref-SafeCast-toUint32-uint256-: xref:utils.adoc#SafeCast-toUint32-uint256-
- :xref-SafeCast-toUint24-uint256-: xref:utils.adoc#SafeCast-toUint24-uint256-
- :xref-SafeCast-toUint16-uint256-: xref:utils.adoc#SafeCast-toUint16-uint256-
- :xref-SafeCast-toUint8-uint256-: xref:utils.adoc#SafeCast-toUint8-uint256-
- :xref-SafeCast-toUint256-int256-: xref:utils.adoc#SafeCast-toUint256-int256-
- :xref-SafeCast-toInt248-int256-: xref:utils.adoc#SafeCast-toInt248-int256-
- :xref-SafeCast-toInt240-int256-: xref:utils.adoc#SafeCast-toInt240-int256-
- :xref-SafeCast-toInt232-int256-: xref:utils.adoc#SafeCast-toInt232-int256-
- :xref-SafeCast-toInt224-int256-: xref:utils.adoc#SafeCast-toInt224-int256-
- :xref-SafeCast-toInt216-int256-: xref:utils.adoc#SafeCast-toInt216-int256-
- :xref-SafeCast-toInt208-int256-: xref:utils.adoc#SafeCast-toInt208-int256-
- :xref-SafeCast-toInt200-int256-: xref:utils.adoc#SafeCast-toInt200-int256-
- :xref-SafeCast-toInt192-int256-: xref:utils.adoc#SafeCast-toInt192-int256-
- :xref-SafeCast-toInt184-int256-: xref:utils.adoc#SafeCast-toInt184-int256-
- :xref-SafeCast-toInt176-int256-: xref:utils.adoc#SafeCast-toInt176-int256-
- :xref-SafeCast-toInt168-int256-: xref:utils.adoc#SafeCast-toInt168-int256-
- :xref-SafeCast-toInt160-int256-: xref:utils.adoc#SafeCast-toInt160-int256-
- :xref-SafeCast-toInt152-int256-: xref:utils.adoc#SafeCast-toInt152-int256-
- :xref-SafeCast-toInt144-int256-: xref:utils.adoc#SafeCast-toInt144-int256-
- :xref-SafeCast-toInt136-int256-: xref:utils.adoc#SafeCast-toInt136-int256-
- :xref-SafeCast-toInt128-int256-: xref:utils.adoc#SafeCast-toInt128-int256-
- :xref-SafeCast-toInt120-int256-: xref:utils.adoc#SafeCast-toInt120-int256-
- :xref-SafeCast-toInt112-int256-: xref:utils.adoc#SafeCast-toInt112-int256-
- :xref-SafeCast-toInt104-int256-: xref:utils.adoc#SafeCast-toInt104-int256-
- :xref-SafeCast-toInt96-int256-: xref:utils.adoc#SafeCast-toInt96-int256-
- :xref-SafeCast-toInt88-int256-: xref:utils.adoc#SafeCast-toInt88-int256-
- :xref-SafeCast-toInt80-int256-: xref:utils.adoc#SafeCast-toInt80-int256-
- :xref-SafeCast-toInt72-int256-: xref:utils.adoc#SafeCast-toInt72-int256-
- :xref-SafeCast-toInt64-int256-: xref:utils.adoc#SafeCast-toInt64-int256-
- :xref-SafeCast-toInt56-int256-: xref:utils.adoc#SafeCast-toInt56-int256-
- :xref-SafeCast-toInt48-int256-: xref:utils.adoc#SafeCast-toInt48-int256-
- :xref-SafeCast-toInt40-int256-: xref:utils.adoc#SafeCast-toInt40-int256-
- :xref-SafeCast-toInt32-int256-: xref:utils.adoc#SafeCast-toInt32-int256-
- :xref-SafeCast-toInt24-int256-: xref:utils.adoc#SafeCast-toInt24-int256-
- :xref-SafeCast-toInt16-int256-: xref:utils.adoc#SafeCast-toInt16-int256-
- :xref-SafeCast-toInt8-int256-: xref:utils.adoc#SafeCast-toInt8-int256-
- :xref-SafeCast-toInt256-uint256-: xref:utils.adoc#SafeCast-toInt256-uint256-
- :xref-SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-: xref:utils.adoc#SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-
- :xref-SafeCast-SafeCastOverflowedIntToUint-int256-: xref:utils.adoc#SafeCast-SafeCastOverflowedIntToUint-int256-
- :xref-SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-: xref:utils.adoc#SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-
- :xref-SafeCast-SafeCastOverflowedUintToInt-uint256-: xref:utils.adoc#SafeCast-SafeCastOverflowedUintToInt-uint256-
- :xref-ECDSA-tryRecover-bytes32-bytes-: xref:utils.adoc#ECDSA-tryRecover-bytes32-bytes-
- :xref-ECDSA-recover-bytes32-bytes-: xref:utils.adoc#ECDSA-recover-bytes32-bytes-
- :xref-ECDSA-tryRecover-bytes32-bytes32-bytes32-: xref:utils.adoc#ECDSA-tryRecover-bytes32-bytes32-bytes32-
- :xref-ECDSA-recover-bytes32-bytes32-bytes32-: xref:utils.adoc#ECDSA-recover-bytes32-bytes32-bytes32-
- :xref-ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-: xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-
- :xref-ECDSA-recover-bytes32-uint8-bytes32-bytes32-: xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-
- :xref-ECDSA-ECDSAInvalidSignature--: xref:utils.adoc#ECDSA-ECDSAInvalidSignature--
- :xref-ECDSA-ECDSAInvalidSignatureLength-uint256-: xref:utils.adoc#ECDSA-ECDSAInvalidSignatureLength-uint256-
- :xref-ECDSA-ECDSAInvalidSignatureS-bytes32-: xref:utils.adoc#ECDSA-ECDSAInvalidSignatureS-bytes32-
- :MessageHashUtils-toEthSignedMessageHash: pass:normal[xref:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes-[`MessageHashUtils.toEthSignedMessageHash`]]
- :MessageHashUtils-toEthSignedMessageHash: pass:normal[xref:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes-[`MessageHashUtils.toEthSignedMessageHash`]]
- :ECDSA-tryRecover: pass:normal[xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`ECDSA.tryRecover`]]
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :ECDSA-tryRecover: pass:normal[xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`ECDSA.tryRecover`]]
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :ECDSA: pass:normal[xref:utils.adoc#ECDSA[`ECDSA`]]
- :xref-MessageHashUtils-toEthSignedMessageHash-bytes32-: xref:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes32-
- :xref-MessageHashUtils-toEthSignedMessageHash-bytes-: xref:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes-
- :xref-MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-: xref:utils.adoc#MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-
- :xref-MessageHashUtils-toTypedDataHash-bytes32-bytes32-: xref:utils.adoc#MessageHashUtils-toTypedDataHash-bytes32-bytes32-
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :xref-SignatureChecker-isValidSignatureNow-address-bytes32-bytes-: xref:utils.adoc#SignatureChecker-isValidSignatureNow-address-bytes32-bytes-
- :xref-SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-: xref:utils.adoc#SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-
- :xref-MerkleProof-verify-bytes32---bytes32-bytes32-: xref:utils.adoc#MerkleProof-verify-bytes32---bytes32-bytes32-
- :xref-MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-: xref:utils.adoc#MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-
- :xref-MerkleProof-processProof-bytes32---bytes32-: xref:utils.adoc#MerkleProof-processProof-bytes32---bytes32-
- :xref-MerkleProof-processProofCalldata-bytes32---bytes32-: xref:utils.adoc#MerkleProof-processProofCalldata-bytes32---bytes32-
- :xref-MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---: xref:utils.adoc#MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---
- :xref-MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---: xref:utils.adoc#MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---
- :xref-MerkleProof-processMultiProof-bytes32---bool---bytes32---: xref:utils.adoc#MerkleProof-processMultiProof-bytes32---bool---bytes32---
- :xref-MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---: xref:utils.adoc#MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---
- :xref-MerkleProof-MerkleProofInvalidMultiproof--: xref:utils.adoc#MerkleProof-MerkleProofInvalidMultiproof--
- :xref-EIP712-constructor-string-string-: xref:utils.adoc#EIP712-constructor-string-string-
- :xref-EIP712-_domainSeparatorV4--: xref:utils.adoc#EIP712-_domainSeparatorV4--
- :xref-EIP712-_hashTypedDataV4-bytes32-: xref:utils.adoc#EIP712-_hashTypedDataV4-bytes32-
- :xref-EIP712-eip712Domain--: xref:utils.adoc#EIP712-eip712Domain--
- :xref-EIP712-_EIP712Name--: xref:utils.adoc#EIP712-_EIP712Name--
- :xref-EIP712-_EIP712Version--: xref:utils.adoc#EIP712-_EIP712Version--
- :xref-IERC5267-EIP712DomainChanged--: xref:interfaces.adoc#IERC5267-EIP712DomainChanged--
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :xref-ReentrancyGuard-nonReentrant--: xref:utils.adoc#ReentrancyGuard-nonReentrant--
- :xref-ReentrancyGuard-constructor--: xref:utils.adoc#ReentrancyGuard-constructor--
- :xref-ReentrancyGuard-_reentrancyGuardEntered--: xref:utils.adoc#ReentrancyGuard-_reentrancyGuardEntered--
- :xref-ReentrancyGuard-ReentrancyGuardReentrantCall--: xref:utils.adoc#ReentrancyGuard-ReentrancyGuardReentrantCall--
- :xref-Pausable-whenNotPaused--: xref:utils.adoc#Pausable-whenNotPaused--
- :xref-Pausable-whenPaused--: xref:utils.adoc#Pausable-whenPaused--
- :xref-Pausable-constructor--: xref:utils.adoc#Pausable-constructor--
- :xref-Pausable-paused--: xref:utils.adoc#Pausable-paused--
- :xref-Pausable-_requireNotPaused--: xref:utils.adoc#Pausable-_requireNotPaused--
- :xref-Pausable-_requirePaused--: xref:utils.adoc#Pausable-_requirePaused--
- :xref-Pausable-_pause--: xref:utils.adoc#Pausable-_pause--
- :xref-Pausable-_unpause--: xref:utils.adoc#Pausable-_unpause--
- :xref-Pausable-Paused-address-: xref:utils.adoc#Pausable-Paused-address-
- :xref-Pausable-Unpaused-address-: xref:utils.adoc#Pausable-Unpaused-address-
- :xref-Pausable-EnforcedPause--: xref:utils.adoc#Pausable-EnforcedPause--
- :xref-Pausable-ExpectedPause--: xref:utils.adoc#Pausable-ExpectedPause--
- :xref-Nonces-nonces-address-: xref:utils.adoc#Nonces-nonces-address-
- :xref-Nonces-_useNonce-address-: xref:utils.adoc#Nonces-_useNonce-address-
- :xref-Nonces-_useCheckedNonce-address-uint256-: xref:utils.adoc#Nonces-_useCheckedNonce-address-uint256-
- :xref-Nonces-InvalidAccountNonce-address-uint256-: xref:utils.adoc#Nonces-InvalidAccountNonce-address-uint256-
- :ERC165Checker: pass:normal[xref:utils.adoc#ERC165Checker[`ERC165Checker`]]
- :ERC165: pass:normal[xref:utils.adoc#ERC165[`ERC165`]]
- :xref-IERC165-supportsInterface-bytes4-: xref:utils.adoc#IERC165-supportsInterface-bytes4-
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :xref-ERC165-supportsInterface-bytes4-: xref:utils.adoc#ERC165-supportsInterface-bytes4-
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :xref-ERC165Checker-supportsERC165-address-: xref:utils.adoc#ERC165Checker-supportsERC165-address-
- :xref-ERC165Checker-supportsInterface-address-bytes4-: xref:utils.adoc#ERC165Checker-supportsInterface-address-bytes4-
- :xref-ERC165Checker-getSupportedInterfaces-address-bytes4---: xref:utils.adoc#ERC165Checker-getSupportedInterfaces-address-bytes4---
- :xref-ERC165Checker-supportsAllInterfaces-address-bytes4---: xref:utils.adoc#ERC165Checker-supportsAllInterfaces-address-bytes4---
- :xref-ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-: xref:utils.adoc#ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :xref-BitMaps-get-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-get-struct-BitMaps-BitMap-uint256-
- :xref-BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-: xref:utils.adoc#BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-
- :xref-BitMaps-set-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-set-struct-BitMaps-BitMap-uint256-
- :xref-BitMaps-unset-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-unset-struct-BitMaps-BitMap-uint256-
- :xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-
- :xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
- :xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
- :xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-
- :xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
- :xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
- :xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-
- :xref-EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-
- :xref-EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-length-struct-EnumerableMap-UintToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-UintToUintMap-
- :xref-EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-
- :xref-EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-
- :xref-EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-
- :xref-EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-
- :xref-EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-
- :xref-EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-
- :xref-EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-
- :xref-EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-
- :xref-EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-
- :xref-EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-
- :xref-EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-
- :xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-
- :xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
- :xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
- :xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-
- :xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
- :xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
- :xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-
- :xref-EnumerableMap-EnumerableMapNonexistentKey-bytes32-: xref:utils.adoc#EnumerableMap-EnumerableMapNonexistentKey-bytes32-
- :xref-EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-
- :xref-EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-
- :xref-EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-
- :xref-EnumerableSet-length-struct-EnumerableSet-Bytes32Set-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-Bytes32Set-
- :xref-EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-
- :xref-EnumerableSet-values-struct-EnumerableSet-Bytes32Set-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-Bytes32Set-
- :xref-EnumerableSet-add-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-AddressSet-address-
- :xref-EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-
- :xref-EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-
- :xref-EnumerableSet-length-struct-EnumerableSet-AddressSet-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-AddressSet-
- :xref-EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-
- :xref-EnumerableSet-values-struct-EnumerableSet-AddressSet-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-AddressSet-
- :xref-EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-
- :xref-EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-
- :xref-EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-
- :xref-EnumerableSet-length-struct-EnumerableSet-UintSet-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-UintSet-
- :xref-EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-
- :xref-EnumerableSet-values-struct-EnumerableSet-UintSet-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-UintSet-
- :xref-DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-: xref:utils.adoc#DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-
- :xref-DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-: xref:utils.adoc#DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-
- :xref-DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-: xref:utils.adoc#DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-
- :xref-DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-QueueEmpty--: xref:utils.adoc#DoubleEndedQueue-QueueEmpty--
- :xref-DoubleEndedQueue-QueueFull--: xref:utils.adoc#DoubleEndedQueue-QueueFull--
- :xref-DoubleEndedQueue-QueueOutOfBounds--: xref:utils.adoc#DoubleEndedQueue-QueueOutOfBounds--
- :Votes: pass:normal[xref:governance.adoc#Votes[`Votes`]]
- :xref-Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-
- :xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-
- :xref-Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-
- :xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-
- :xref-Checkpoints-latest-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-Trace224-
- :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-
- :xref-Checkpoints-length-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-Trace224-
- :xref-Checkpoints-at-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-at-struct-Checkpoints-Trace224-uint32-
- :xref-Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-
- :xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-: xref:utils.adoc#Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-
- :xref-Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-: xref:utils.adoc#Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-
- :xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-: xref:utils.adoc#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-
- :xref-Checkpoints-latest-struct-Checkpoints-Trace208-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-Trace208-
- :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-
- :xref-Checkpoints-length-struct-Checkpoints-Trace208-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-Trace208-
- :xref-Checkpoints-at-struct-Checkpoints-Trace208-uint32-: xref:utils.adoc#Checkpoints-at-struct-Checkpoints-Trace208-uint32-
- :xref-Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-
- :xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-
- :xref-Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-
- :xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-
- :xref-Checkpoints-latest-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-Trace160-
- :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-
- :xref-Checkpoints-length-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-Trace160-
- :xref-Checkpoints-at-struct-Checkpoints-Trace160-uint32-: xref:utils.adoc#Checkpoints-at-struct-Checkpoints-Trace160-uint32-
- :xref-Checkpoints-CheckpointUnorderedInsertion--: xref:utils.adoc#Checkpoints-CheckpointUnorderedInsertion--
- :xref-Create2-deploy-uint256-bytes32-bytes-: xref:utils.adoc#Create2-deploy-uint256-bytes32-bytes-
- :xref-Create2-computeAddress-bytes32-bytes32-: xref:utils.adoc#Create2-computeAddress-bytes32-bytes32-
- :xref-Create2-computeAddress-bytes32-bytes32-address-: xref:utils.adoc#Create2-computeAddress-bytes32-bytes32-address-
- :xref-Create2-Create2InsufficientBalance-uint256-uint256-: xref:utils.adoc#Create2-Create2InsufficientBalance-uint256-uint256-
- :xref-Create2-Create2EmptyBytecode--: xref:utils.adoc#Create2-Create2EmptyBytecode--
- :xref-Create2-Create2FailedDeployment--: xref:utils.adoc#Create2-Create2FailedDeployment--
- :xref-Address-sendValue-address-payable-uint256-: xref:utils.adoc#Address-sendValue-address-payable-uint256-
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Address-functionCallWithValue-address-bytes-uint256-: xref:utils.adoc#Address-functionCallWithValue-address-bytes-uint256-
- :xref-Address-functionStaticCall-address-bytes-: xref:utils.adoc#Address-functionStaticCall-address-bytes-
- :xref-Address-functionDelegateCall-address-bytes-: xref:utils.adoc#Address-functionDelegateCall-address-bytes-
- :xref-Address-verifyCallResultFromTarget-address-bool-bytes-: xref:utils.adoc#Address-verifyCallResultFromTarget-address-bool-bytes-
- :xref-Address-verifyCallResult-bool-bytes-: xref:utils.adoc#Address-verifyCallResult-bool-bytes-
- :xref-Address-AddressInsufficientBalance-address-: xref:utils.adoc#Address-AddressInsufficientBalance-address-
- :xref-Address-AddressEmptyCode-address-: xref:utils.adoc#Address-AddressEmptyCode-address-
- :xref-Address-FailedInnerCall--: xref:utils.adoc#Address-FailedInnerCall--
- :ReentrancyGuard: pass:normal[xref:utils.adoc#ReentrancyGuard[`ReentrancyGuard`]]
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Arrays-findUpperBound-uint256---uint256-: xref:utils.adoc#Arrays-findUpperBound-uint256---uint256-
- :xref-Arrays-unsafeAccess-address---uint256-: xref:utils.adoc#Arrays-unsafeAccess-address---uint256-
- :xref-Arrays-unsafeAccess-bytes32---uint256-: xref:utils.adoc#Arrays-unsafeAccess-bytes32---uint256-
- :xref-Arrays-unsafeAccess-uint256---uint256-: xref:utils.adoc#Arrays-unsafeAccess-uint256---uint256-
- :xref-Arrays-unsafeMemoryAccess-uint256---uint256-: xref:utils.adoc#Arrays-unsafeMemoryAccess-uint256---uint256-
- :xref-Arrays-unsafeMemoryAccess-address---uint256-: xref:utils.adoc#Arrays-unsafeMemoryAccess-address---uint256-
- :xref-Base64-encode-bytes-: xref:utils.adoc#Base64-encode-bytes-
- :xref-Strings-toString-uint256-: xref:utils.adoc#Strings-toString-uint256-
- :xref-Strings-toStringSigned-int256-: xref:utils.adoc#Strings-toStringSigned-int256-
- :xref-Strings-toHexString-uint256-: xref:utils.adoc#Strings-toHexString-uint256-
- :xref-Strings-toHexString-uint256-uint256-: xref:utils.adoc#Strings-toHexString-uint256-uint256-
- :xref-Strings-toHexString-address-: xref:utils.adoc#Strings-toHexString-address-
- :xref-Strings-equal-string-string-: xref:utils.adoc#Strings-equal-string-string-
- :xref-Strings-StringsInsufficientHexLength-uint256-uint256-: xref:utils.adoc#Strings-StringsInsufficientHexLength-uint256-uint256-
- :xref-ShortStrings-toShortString-string-: xref:utils.adoc#ShortStrings-toShortString-string-
- :xref-ShortStrings-toString-ShortString-: xref:utils.adoc#ShortStrings-toString-ShortString-
- :xref-ShortStrings-byteLength-ShortString-: xref:utils.adoc#ShortStrings-byteLength-ShortString-
- :xref-ShortStrings-toShortStringWithFallback-string-string-: xref:utils.adoc#ShortStrings-toShortStringWithFallback-string-string-
- :xref-ShortStrings-toStringWithFallback-ShortString-string-: xref:utils.adoc#ShortStrings-toStringWithFallback-ShortString-string-
- :xref-ShortStrings-byteLengthWithFallback-ShortString-string-: xref:utils.adoc#ShortStrings-byteLengthWithFallback-ShortString-string-
- :xref-ShortStrings-StringTooLong-string-: xref:utils.adoc#ShortStrings-StringTooLong-string-
- :xref-ShortStrings-InvalidShortString--: xref:utils.adoc#ShortStrings-InvalidShortString--
- :xref-StorageSlot-getAddressSlot-bytes32-: xref:utils.adoc#StorageSlot-getAddressSlot-bytes32-
- :xref-StorageSlot-getBooleanSlot-bytes32-: xref:utils.adoc#StorageSlot-getBooleanSlot-bytes32-
- :xref-StorageSlot-getBytes32Slot-bytes32-: xref:utils.adoc#StorageSlot-getBytes32Slot-bytes32-
- :xref-StorageSlot-getUint256Slot-bytes32-: xref:utils.adoc#StorageSlot-getUint256Slot-bytes32-
- :xref-StorageSlot-getStringSlot-bytes32-: xref:utils.adoc#StorageSlot-getStringSlot-bytes32-
- :xref-StorageSlot-getStringSlot-string-: xref:utils.adoc#StorageSlot-getStringSlot-string-
- :xref-StorageSlot-getBytesSlot-bytes32-: xref:utils.adoc#StorageSlot-getBytesSlot-bytes32-
- :xref-StorageSlot-getBytesSlot-bytes-: xref:utils.adoc#StorageSlot-getBytesSlot-bytes-
- :ERC2771Context: pass:normal[xref:metatx.adoc#ERC2771Context[`ERC2771Context`]]
- :xref-Multicall-multicall-bytes---: xref:utils.adoc#Multicall-multicall-bytes---
- :xref-Context-_msgSender--: xref:utils.adoc#Context-_msgSender--
- :xref-Context-_msgData--: xref:utils.adoc#Context-_msgData--
- :xref-Context-_contextSuffixLength--: xref:utils.adoc#Context-_contextSuffixLength--
- = Utilities
- [.readme-notice]
- NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils
- Miscellaneous contracts and libraries containing utility functions you can use to improve security, work with new data types, or safely use low-level primitives.
- * {Math}, {SignedMath}: Implementation of various arithmetic functions.
- * {SafeCast}: Checked downcasting functions to avoid silent truncation.
- * {ECDSA}, {MessageHashUtils}: Libraries for interacting with ECDSA signatures.
- * {SignatureChecker}: A library helper to support regular ECDSA from EOAs as well as ERC-1271 signatures for smart contracts.
- * {MerkleProof}: Functions for verifying https://en.wikipedia.org/wiki/Merkle_tree[Merkle Tree] proofs.
- * {EIP712}: Contract with functions to allow processing signed typed structure data according to https://eips.ethereum.org/EIPS/eip-712[EIP-712].
- * {ReentrancyGuard}: A modifier that can prevent reentrancy during certain functions.
- * {Pausable}: A common emergency response mechanism that can pause functionality while a remediation is pending.
- * {Nonces}: Utility for tracking and verifying address nonces that only increment.
- * {ERC165, ERC165Checker}: Utilities for inspecting interfaces supported by contracts.
- * {BitMaps}: A simple library to manage boolean value mapped to a numerical index in an efficient way.
- * {EnumerableMap}: A type like Solidity's https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`], but with key-value _enumeration_: this will let you know how many entries a mapping has, and iterate over them (which is not possible with `mapping`).
- * {EnumerableSet}: Like {EnumerableMap}, but for https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets]. Can be used to store privileged accounts, issued IDs, etc.
- * {DoubleEndedQueue}: An implementation of a https://en.wikipedia.org/wiki/Double-ended_queue[double ended queue] whose values can be removed added or remove from both sides. Useful for FIFO and LIFO structures.
- * {Checkpoints}: A data structure to store values mapped to an strictly increasing key. Can be used for storing and accessing values over time.
- * {Create2}: Wrapper around the https://blog.openzeppelin.com/getting-the-most-out-of-create2/[`CREATE2` EVM opcode] for safe use without having to deal with low-level assembly.
- * {Address}: Collection of functions for overloading Solidity's https://docs.soliditylang.org/en/latest/types.html#address[`address`] type.
- * {Arrays}: Collection of functions that operate on https://docs.soliditylang.org/en/latest/types.html#arrays[`arrays`].
- * {Base64}: On-chain base64 and base64URL encoding according to https://datatracker.ietf.org/doc/html/rfc4648[RFC-4648].
- * {Strings}: Common operations for strings formatting.
- * {ShortString}: Library to encode (and decode) short strings into (or from) a single bytes32 slot for optimizing costs. Short strings are limited to 31 characters.
- * {StorageSlot}: Methods for accessing specific storage slots formatted as common primitive types.
- * {Multicall}: Abstract contract with an utility to allow batching together multiple calls in a single transaction. Useful for allowing EOAs to perform multiple operations at once.
- * {Context}: An utility for abstracting the sender and calldata in the current execution context.
- [NOTE]
- ====
- Because Solidity does not support generic types, {EnumerableMap} and {EnumerableSet} are specialized to a limited number of key-value types.
- ====
- == Math
- :MathOverflowedMulDiv: pass:normal[xref:#Math-MathOverflowedMulDiv--[`++MathOverflowedMulDiv++`]]
- :Rounding: pass:normal[xref:#Math-Rounding[`++Rounding++`]]
- :tryAdd: pass:normal[xref:#Math-tryAdd-uint256-uint256-[`++tryAdd++`]]
- :trySub: pass:normal[xref:#Math-trySub-uint256-uint256-[`++trySub++`]]
- :tryMul: pass:normal[xref:#Math-tryMul-uint256-uint256-[`++tryMul++`]]
- :tryDiv: pass:normal[xref:#Math-tryDiv-uint256-uint256-[`++tryDiv++`]]
- :tryMod: pass:normal[xref:#Math-tryMod-uint256-uint256-[`++tryMod++`]]
- :max: pass:normal[xref:#Math-max-uint256-uint256-[`++max++`]]
- :min: pass:normal[xref:#Math-min-uint256-uint256-[`++min++`]]
- :average: pass:normal[xref:#Math-average-uint256-uint256-[`++average++`]]
- :ceilDiv: pass:normal[xref:#Math-ceilDiv-uint256-uint256-[`++ceilDiv++`]]
- :mulDiv: pass:normal[xref:#Math-mulDiv-uint256-uint256-uint256-[`++mulDiv++`]]
- :mulDiv: pass:normal[xref:#Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-[`++mulDiv++`]]
- :sqrt: pass:normal[xref:#Math-sqrt-uint256-[`++sqrt++`]]
- :sqrt: pass:normal[xref:#Math-sqrt-uint256-enum-Math-Rounding-[`++sqrt++`]]
- :log2: pass:normal[xref:#Math-log2-uint256-[`++log2++`]]
- :log2: pass:normal[xref:#Math-log2-uint256-enum-Math-Rounding-[`++log2++`]]
- :log10: pass:normal[xref:#Math-log10-uint256-[`++log10++`]]
- :log10: pass:normal[xref:#Math-log10-uint256-enum-Math-Rounding-[`++log10++`]]
- :log256: pass:normal[xref:#Math-log256-uint256-[`++log256++`]]
- :log256: pass:normal[xref:#Math-log256-uint256-enum-Math-Rounding-[`++log256++`]]
- :unsignedRoundsUp: pass:normal[xref:#Math-unsignedRoundsUp-enum-Math-Rounding-[`++unsignedRoundsUp++`]]
- [.contract]
- [[Math]]
- === `++Math++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/math/Math.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/math/Math.sol";
- ```
- Standard math utilities missing in the Solidity language.
- [.contract-index]
- .Functions
- --
- * {xref-Math-tryAdd-uint256-uint256-}[`++tryAdd(a, b)++`]
- * {xref-Math-trySub-uint256-uint256-}[`++trySub(a, b)++`]
- * {xref-Math-tryMul-uint256-uint256-}[`++tryMul(a, b)++`]
- * {xref-Math-tryDiv-uint256-uint256-}[`++tryDiv(a, b)++`]
- * {xref-Math-tryMod-uint256-uint256-}[`++tryMod(a, b)++`]
- * {xref-Math-max-uint256-uint256-}[`++max(a, b)++`]
- * {xref-Math-min-uint256-uint256-}[`++min(a, b)++`]
- * {xref-Math-average-uint256-uint256-}[`++average(a, b)++`]
- * {xref-Math-ceilDiv-uint256-uint256-}[`++ceilDiv(a, b)++`]
- * {xref-Math-mulDiv-uint256-uint256-uint256-}[`++mulDiv(x, y, denominator)++`]
- * {xref-Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-}[`++mulDiv(x, y, denominator, rounding)++`]
- * {xref-Math-sqrt-uint256-}[`++sqrt(a)++`]
- * {xref-Math-sqrt-uint256-enum-Math-Rounding-}[`++sqrt(a, rounding)++`]
- * {xref-Math-log2-uint256-}[`++log2(value)++`]
- * {xref-Math-log2-uint256-enum-Math-Rounding-}[`++log2(value, rounding)++`]
- * {xref-Math-log10-uint256-}[`++log10(value)++`]
- * {xref-Math-log10-uint256-enum-Math-Rounding-}[`++log10(value, rounding)++`]
- * {xref-Math-log256-uint256-}[`++log256(value)++`]
- * {xref-Math-log256-uint256-enum-Math-Rounding-}[`++log256(value, rounding)++`]
- * {xref-Math-unsignedRoundsUp-enum-Math-Rounding-}[`++unsignedRoundsUp(rounding)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-Math-MathOverflowedMulDiv--}[`++MathOverflowedMulDiv()++`]
- --
- [.contract-item]
- [[Math-tryAdd-uint256-uint256-]]
- ==== `[.contract-item-name]#++tryAdd++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the addition of two unsigned integers, with an overflow flag.
- [.contract-item]
- [[Math-trySub-uint256-uint256-]]
- ==== `[.contract-item-name]#++trySub++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the subtraction of two unsigned integers, with an overflow flag.
- [.contract-item]
- [[Math-tryMul-uint256-uint256-]]
- ==== `[.contract-item-name]#++tryMul++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the multiplication of two unsigned integers, with an overflow flag.
- [.contract-item]
- [[Math-tryDiv-uint256-uint256-]]
- ==== `[.contract-item-name]#++tryDiv++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the division of two unsigned integers, with a division by zero flag.
- [.contract-item]
- [[Math-tryMod-uint256-uint256-]]
- ==== `[.contract-item-name]#++tryMod++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the remainder of dividing two unsigned integers, with a division by zero flag.
- [.contract-item]
- [[Math-max-uint256-uint256-]]
- ==== `[.contract-item-name]#++max++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the largest of two numbers.
- [.contract-item]
- [[Math-min-uint256-uint256-]]
- ==== `[.contract-item-name]#++min++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the smallest of two numbers.
- [.contract-item]
- [[Math-average-uint256-uint256-]]
- ==== `[.contract-item-name]#++average++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the average of two numbers. The result is rounded towards
- zero.
- [.contract-item]
- [[Math-ceilDiv-uint256-uint256-]]
- ==== `[.contract-item-name]#++ceilDiv++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the ceiling of the division of two numbers.
- This differs from standard division with `/` in that it rounds towards infinity instead
- of rounding towards zero.
- [.contract-item]
- [[Math-mulDiv-uint256-uint256-uint256-]]
- ==== `[.contract-item-name]#++mulDiv++#++(uint256 x, uint256 y, uint256 denominator) → uint256 result++` [.item-kind]#internal#
- Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
- Uniswap Labs also under MIT license.
- [.contract-item]
- [[Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++mulDiv++#++(uint256 x, uint256 y, uint256 denominator, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- [.contract-item]
- [[Math-sqrt-uint256-]]
- ==== `[.contract-item-name]#++sqrt++#++(uint256 a) → uint256++` [.item-kind]#internal#
- Returns the square root of a number. If the number is not a perfect square, the value is rounded
- towards zero.
- Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
- [.contract-item]
- [[Math-sqrt-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++sqrt++#++(uint256 a, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- [.contract-item]
- [[Math-log2-uint256-]]
- ==== `[.contract-item-name]#++log2++#++(uint256 value) → uint256++` [.item-kind]#internal#
- Return the log in base 2 of a positive value rounded towards zero.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-log2-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++log2++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- Return the log in base 2, following the selected rounding direction, of a positive value.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-log10-uint256-]]
- ==== `[.contract-item-name]#++log10++#++(uint256 value) → uint256++` [.item-kind]#internal#
- Return the log in base 10 of a positive value rounded towards zero.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-log10-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++log10++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- Return the log in base 10, following the selected rounding direction, of a positive value.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-log256-uint256-]]
- ==== `[.contract-item-name]#++log256++#++(uint256 value) → uint256++` [.item-kind]#internal#
- Return the log in base 256 of a positive value rounded towards zero.
- Returns 0 if given 0.
- Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
- [.contract-item]
- [[Math-log256-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++log256++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- Return the log in base 256, following the selected rounding direction, of a positive value.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-unsignedRoundsUp-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++unsignedRoundsUp++#++(enum Math.Rounding rounding) → bool++` [.item-kind]#internal#
- Returns whether a provided rounding mode is considered rounding up for unsigned integers.
- [.contract-item]
- [[Math-MathOverflowedMulDiv--]]
- ==== `[.contract-item-name]#++MathOverflowedMulDiv++#++()++` [.item-kind]#error#
- Muldiv operation overflow.
- :max: pass:normal[xref:#SignedMath-max-int256-int256-[`++max++`]]
- :min: pass:normal[xref:#SignedMath-min-int256-int256-[`++min++`]]
- :average: pass:normal[xref:#SignedMath-average-int256-int256-[`++average++`]]
- :abs: pass:normal[xref:#SignedMath-abs-int256-[`++abs++`]]
- [.contract]
- [[SignedMath]]
- === `++SignedMath++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/math/SignedMath.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/math/SignedMath.sol";
- ```
- Standard signed math utilities missing in the Solidity language.
- [.contract-index]
- .Functions
- --
- * {xref-SignedMath-max-int256-int256-}[`++max(a, b)++`]
- * {xref-SignedMath-min-int256-int256-}[`++min(a, b)++`]
- * {xref-SignedMath-average-int256-int256-}[`++average(a, b)++`]
- * {xref-SignedMath-abs-int256-}[`++abs(n)++`]
- --
- [.contract-item]
- [[SignedMath-max-int256-int256-]]
- ==== `[.contract-item-name]#++max++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the largest of two signed numbers.
- [.contract-item]
- [[SignedMath-min-int256-int256-]]
- ==== `[.contract-item-name]#++min++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the smallest of two signed numbers.
- [.contract-item]
- [[SignedMath-average-int256-int256-]]
- ==== `[.contract-item-name]#++average++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the average of two signed numbers without overflow.
- The result is rounded towards zero.
- [.contract-item]
- [[SignedMath-abs-int256-]]
- ==== `[.contract-item-name]#++abs++#++(int256 n) → uint256++` [.item-kind]#internal#
- Returns the absolute unsigned value of a signed value.
- :SafeCastOverflowedUintDowncast: pass:normal[xref:#SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-[`++SafeCastOverflowedUintDowncast++`]]
- :SafeCastOverflowedIntToUint: pass:normal[xref:#SafeCast-SafeCastOverflowedIntToUint-int256-[`++SafeCastOverflowedIntToUint++`]]
- :SafeCastOverflowedIntDowncast: pass:normal[xref:#SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-[`++SafeCastOverflowedIntDowncast++`]]
- :SafeCastOverflowedUintToInt: pass:normal[xref:#SafeCast-SafeCastOverflowedUintToInt-uint256-[`++SafeCastOverflowedUintToInt++`]]
- :toUint248: pass:normal[xref:#SafeCast-toUint248-uint256-[`++toUint248++`]]
- :toUint240: pass:normal[xref:#SafeCast-toUint240-uint256-[`++toUint240++`]]
- :toUint232: pass:normal[xref:#SafeCast-toUint232-uint256-[`++toUint232++`]]
- :toUint224: pass:normal[xref:#SafeCast-toUint224-uint256-[`++toUint224++`]]
- :toUint216: pass:normal[xref:#SafeCast-toUint216-uint256-[`++toUint216++`]]
- :toUint208: pass:normal[xref:#SafeCast-toUint208-uint256-[`++toUint208++`]]
- :toUint200: pass:normal[xref:#SafeCast-toUint200-uint256-[`++toUint200++`]]
- :toUint192: pass:normal[xref:#SafeCast-toUint192-uint256-[`++toUint192++`]]
- :toUint184: pass:normal[xref:#SafeCast-toUint184-uint256-[`++toUint184++`]]
- :toUint176: pass:normal[xref:#SafeCast-toUint176-uint256-[`++toUint176++`]]
- :toUint168: pass:normal[xref:#SafeCast-toUint168-uint256-[`++toUint168++`]]
- :toUint160: pass:normal[xref:#SafeCast-toUint160-uint256-[`++toUint160++`]]
- :toUint152: pass:normal[xref:#SafeCast-toUint152-uint256-[`++toUint152++`]]
- :toUint144: pass:normal[xref:#SafeCast-toUint144-uint256-[`++toUint144++`]]
- :toUint136: pass:normal[xref:#SafeCast-toUint136-uint256-[`++toUint136++`]]
- :toUint128: pass:normal[xref:#SafeCast-toUint128-uint256-[`++toUint128++`]]
- :toUint120: pass:normal[xref:#SafeCast-toUint120-uint256-[`++toUint120++`]]
- :toUint112: pass:normal[xref:#SafeCast-toUint112-uint256-[`++toUint112++`]]
- :toUint104: pass:normal[xref:#SafeCast-toUint104-uint256-[`++toUint104++`]]
- :toUint96: pass:normal[xref:#SafeCast-toUint96-uint256-[`++toUint96++`]]
- :toUint88: pass:normal[xref:#SafeCast-toUint88-uint256-[`++toUint88++`]]
- :toUint80: pass:normal[xref:#SafeCast-toUint80-uint256-[`++toUint80++`]]
- :toUint72: pass:normal[xref:#SafeCast-toUint72-uint256-[`++toUint72++`]]
- :toUint64: pass:normal[xref:#SafeCast-toUint64-uint256-[`++toUint64++`]]
- :toUint56: pass:normal[xref:#SafeCast-toUint56-uint256-[`++toUint56++`]]
- :toUint48: pass:normal[xref:#SafeCast-toUint48-uint256-[`++toUint48++`]]
- :toUint40: pass:normal[xref:#SafeCast-toUint40-uint256-[`++toUint40++`]]
- :toUint32: pass:normal[xref:#SafeCast-toUint32-uint256-[`++toUint32++`]]
- :toUint24: pass:normal[xref:#SafeCast-toUint24-uint256-[`++toUint24++`]]
- :toUint16: pass:normal[xref:#SafeCast-toUint16-uint256-[`++toUint16++`]]
- :toUint8: pass:normal[xref:#SafeCast-toUint8-uint256-[`++toUint8++`]]
- :toUint256: pass:normal[xref:#SafeCast-toUint256-int256-[`++toUint256++`]]
- :toInt248: pass:normal[xref:#SafeCast-toInt248-int256-[`++toInt248++`]]
- :toInt240: pass:normal[xref:#SafeCast-toInt240-int256-[`++toInt240++`]]
- :toInt232: pass:normal[xref:#SafeCast-toInt232-int256-[`++toInt232++`]]
- :toInt224: pass:normal[xref:#SafeCast-toInt224-int256-[`++toInt224++`]]
- :toInt216: pass:normal[xref:#SafeCast-toInt216-int256-[`++toInt216++`]]
- :toInt208: pass:normal[xref:#SafeCast-toInt208-int256-[`++toInt208++`]]
- :toInt200: pass:normal[xref:#SafeCast-toInt200-int256-[`++toInt200++`]]
- :toInt192: pass:normal[xref:#SafeCast-toInt192-int256-[`++toInt192++`]]
- :toInt184: pass:normal[xref:#SafeCast-toInt184-int256-[`++toInt184++`]]
- :toInt176: pass:normal[xref:#SafeCast-toInt176-int256-[`++toInt176++`]]
- :toInt168: pass:normal[xref:#SafeCast-toInt168-int256-[`++toInt168++`]]
- :toInt160: pass:normal[xref:#SafeCast-toInt160-int256-[`++toInt160++`]]
- :toInt152: pass:normal[xref:#SafeCast-toInt152-int256-[`++toInt152++`]]
- :toInt144: pass:normal[xref:#SafeCast-toInt144-int256-[`++toInt144++`]]
- :toInt136: pass:normal[xref:#SafeCast-toInt136-int256-[`++toInt136++`]]
- :toInt128: pass:normal[xref:#SafeCast-toInt128-int256-[`++toInt128++`]]
- :toInt120: pass:normal[xref:#SafeCast-toInt120-int256-[`++toInt120++`]]
- :toInt112: pass:normal[xref:#SafeCast-toInt112-int256-[`++toInt112++`]]
- :toInt104: pass:normal[xref:#SafeCast-toInt104-int256-[`++toInt104++`]]
- :toInt96: pass:normal[xref:#SafeCast-toInt96-int256-[`++toInt96++`]]
- :toInt88: pass:normal[xref:#SafeCast-toInt88-int256-[`++toInt88++`]]
- :toInt80: pass:normal[xref:#SafeCast-toInt80-int256-[`++toInt80++`]]
- :toInt72: pass:normal[xref:#SafeCast-toInt72-int256-[`++toInt72++`]]
- :toInt64: pass:normal[xref:#SafeCast-toInt64-int256-[`++toInt64++`]]
- :toInt56: pass:normal[xref:#SafeCast-toInt56-int256-[`++toInt56++`]]
- :toInt48: pass:normal[xref:#SafeCast-toInt48-int256-[`++toInt48++`]]
- :toInt40: pass:normal[xref:#SafeCast-toInt40-int256-[`++toInt40++`]]
- :toInt32: pass:normal[xref:#SafeCast-toInt32-int256-[`++toInt32++`]]
- :toInt24: pass:normal[xref:#SafeCast-toInt24-int256-[`++toInt24++`]]
- :toInt16: pass:normal[xref:#SafeCast-toInt16-int256-[`++toInt16++`]]
- :toInt8: pass:normal[xref:#SafeCast-toInt8-int256-[`++toInt8++`]]
- :toInt256: pass:normal[xref:#SafeCast-toInt256-uint256-[`++toInt256++`]]
- [.contract]
- [[SafeCast]]
- === `++SafeCast++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/math/SafeCast.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/math/SafeCast.sol";
- ```
- Wrappers over Solidity's uintXX/intXX casting operators with added overflow
- checks.
- Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
- easily result in undesired exploitation or bugs, since developers usually
- assume that overflows raise errors. `SafeCast` restores this intuition by
- reverting the transaction when such an operation overflows.
- Using this library instead of the unchecked operations eliminates an entire
- class of bugs, so it's recommended to use it always.
- [.contract-index]
- .Functions
- --
- * {xref-SafeCast-toUint248-uint256-}[`++toUint248(value)++`]
- * {xref-SafeCast-toUint240-uint256-}[`++toUint240(value)++`]
- * {xref-SafeCast-toUint232-uint256-}[`++toUint232(value)++`]
- * {xref-SafeCast-toUint224-uint256-}[`++toUint224(value)++`]
- * {xref-SafeCast-toUint216-uint256-}[`++toUint216(value)++`]
- * {xref-SafeCast-toUint208-uint256-}[`++toUint208(value)++`]
- * {xref-SafeCast-toUint200-uint256-}[`++toUint200(value)++`]
- * {xref-SafeCast-toUint192-uint256-}[`++toUint192(value)++`]
- * {xref-SafeCast-toUint184-uint256-}[`++toUint184(value)++`]
- * {xref-SafeCast-toUint176-uint256-}[`++toUint176(value)++`]
- * {xref-SafeCast-toUint168-uint256-}[`++toUint168(value)++`]
- * {xref-SafeCast-toUint160-uint256-}[`++toUint160(value)++`]
- * {xref-SafeCast-toUint152-uint256-}[`++toUint152(value)++`]
- * {xref-SafeCast-toUint144-uint256-}[`++toUint144(value)++`]
- * {xref-SafeCast-toUint136-uint256-}[`++toUint136(value)++`]
- * {xref-SafeCast-toUint128-uint256-}[`++toUint128(value)++`]
- * {xref-SafeCast-toUint120-uint256-}[`++toUint120(value)++`]
- * {xref-SafeCast-toUint112-uint256-}[`++toUint112(value)++`]
- * {xref-SafeCast-toUint104-uint256-}[`++toUint104(value)++`]
- * {xref-SafeCast-toUint96-uint256-}[`++toUint96(value)++`]
- * {xref-SafeCast-toUint88-uint256-}[`++toUint88(value)++`]
- * {xref-SafeCast-toUint80-uint256-}[`++toUint80(value)++`]
- * {xref-SafeCast-toUint72-uint256-}[`++toUint72(value)++`]
- * {xref-SafeCast-toUint64-uint256-}[`++toUint64(value)++`]
- * {xref-SafeCast-toUint56-uint256-}[`++toUint56(value)++`]
- * {xref-SafeCast-toUint48-uint256-}[`++toUint48(value)++`]
- * {xref-SafeCast-toUint40-uint256-}[`++toUint40(value)++`]
- * {xref-SafeCast-toUint32-uint256-}[`++toUint32(value)++`]
- * {xref-SafeCast-toUint24-uint256-}[`++toUint24(value)++`]
- * {xref-SafeCast-toUint16-uint256-}[`++toUint16(value)++`]
- * {xref-SafeCast-toUint8-uint256-}[`++toUint8(value)++`]
- * {xref-SafeCast-toUint256-int256-}[`++toUint256(value)++`]
- * {xref-SafeCast-toInt248-int256-}[`++toInt248(value)++`]
- * {xref-SafeCast-toInt240-int256-}[`++toInt240(value)++`]
- * {xref-SafeCast-toInt232-int256-}[`++toInt232(value)++`]
- * {xref-SafeCast-toInt224-int256-}[`++toInt224(value)++`]
- * {xref-SafeCast-toInt216-int256-}[`++toInt216(value)++`]
- * {xref-SafeCast-toInt208-int256-}[`++toInt208(value)++`]
- * {xref-SafeCast-toInt200-int256-}[`++toInt200(value)++`]
- * {xref-SafeCast-toInt192-int256-}[`++toInt192(value)++`]
- * {xref-SafeCast-toInt184-int256-}[`++toInt184(value)++`]
- * {xref-SafeCast-toInt176-int256-}[`++toInt176(value)++`]
- * {xref-SafeCast-toInt168-int256-}[`++toInt168(value)++`]
- * {xref-SafeCast-toInt160-int256-}[`++toInt160(value)++`]
- * {xref-SafeCast-toInt152-int256-}[`++toInt152(value)++`]
- * {xref-SafeCast-toInt144-int256-}[`++toInt144(value)++`]
- * {xref-SafeCast-toInt136-int256-}[`++toInt136(value)++`]
- * {xref-SafeCast-toInt128-int256-}[`++toInt128(value)++`]
- * {xref-SafeCast-toInt120-int256-}[`++toInt120(value)++`]
- * {xref-SafeCast-toInt112-int256-}[`++toInt112(value)++`]
- * {xref-SafeCast-toInt104-int256-}[`++toInt104(value)++`]
- * {xref-SafeCast-toInt96-int256-}[`++toInt96(value)++`]
- * {xref-SafeCast-toInt88-int256-}[`++toInt88(value)++`]
- * {xref-SafeCast-toInt80-int256-}[`++toInt80(value)++`]
- * {xref-SafeCast-toInt72-int256-}[`++toInt72(value)++`]
- * {xref-SafeCast-toInt64-int256-}[`++toInt64(value)++`]
- * {xref-SafeCast-toInt56-int256-}[`++toInt56(value)++`]
- * {xref-SafeCast-toInt48-int256-}[`++toInt48(value)++`]
- * {xref-SafeCast-toInt40-int256-}[`++toInt40(value)++`]
- * {xref-SafeCast-toInt32-int256-}[`++toInt32(value)++`]
- * {xref-SafeCast-toInt24-int256-}[`++toInt24(value)++`]
- * {xref-SafeCast-toInt16-int256-}[`++toInt16(value)++`]
- * {xref-SafeCast-toInt8-int256-}[`++toInt8(value)++`]
- * {xref-SafeCast-toInt256-uint256-}[`++toInt256(value)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-}[`++SafeCastOverflowedUintDowncast(bits, value)++`]
- * {xref-SafeCast-SafeCastOverflowedIntToUint-int256-}[`++SafeCastOverflowedIntToUint(value)++`]
- * {xref-SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-}[`++SafeCastOverflowedIntDowncast(bits, value)++`]
- * {xref-SafeCast-SafeCastOverflowedUintToInt-uint256-}[`++SafeCastOverflowedUintToInt(value)++`]
- --
- [.contract-item]
- [[SafeCast-toUint248-uint256-]]
- ==== `[.contract-item-name]#++toUint248++#++(uint256 value) → uint248++` [.item-kind]#internal#
- Returns the downcasted uint248 from uint256, reverting on
- overflow (when the input is greater than largest uint248).
- Counterpart to Solidity's `uint248` operator.
- Requirements:
- - input must fit into 248 bits
- [.contract-item]
- [[SafeCast-toUint240-uint256-]]
- ==== `[.contract-item-name]#++toUint240++#++(uint256 value) → uint240++` [.item-kind]#internal#
- Returns the downcasted uint240 from uint256, reverting on
- overflow (when the input is greater than largest uint240).
- Counterpart to Solidity's `uint240` operator.
- Requirements:
- - input must fit into 240 bits
- [.contract-item]
- [[SafeCast-toUint232-uint256-]]
- ==== `[.contract-item-name]#++toUint232++#++(uint256 value) → uint232++` [.item-kind]#internal#
- Returns the downcasted uint232 from uint256, reverting on
- overflow (when the input is greater than largest uint232).
- Counterpart to Solidity's `uint232` operator.
- Requirements:
- - input must fit into 232 bits
- [.contract-item]
- [[SafeCast-toUint224-uint256-]]
- ==== `[.contract-item-name]#++toUint224++#++(uint256 value) → uint224++` [.item-kind]#internal#
- Returns the downcasted uint224 from uint256, reverting on
- overflow (when the input is greater than largest uint224).
- Counterpart to Solidity's `uint224` operator.
- Requirements:
- - input must fit into 224 bits
- [.contract-item]
- [[SafeCast-toUint216-uint256-]]
- ==== `[.contract-item-name]#++toUint216++#++(uint256 value) → uint216++` [.item-kind]#internal#
- Returns the downcasted uint216 from uint256, reverting on
- overflow (when the input is greater than largest uint216).
- Counterpart to Solidity's `uint216` operator.
- Requirements:
- - input must fit into 216 bits
- [.contract-item]
- [[SafeCast-toUint208-uint256-]]
- ==== `[.contract-item-name]#++toUint208++#++(uint256 value) → uint208++` [.item-kind]#internal#
- Returns the downcasted uint208 from uint256, reverting on
- overflow (when the input is greater than largest uint208).
- Counterpart to Solidity's `uint208` operator.
- Requirements:
- - input must fit into 208 bits
- [.contract-item]
- [[SafeCast-toUint200-uint256-]]
- ==== `[.contract-item-name]#++toUint200++#++(uint256 value) → uint200++` [.item-kind]#internal#
- Returns the downcasted uint200 from uint256, reverting on
- overflow (when the input is greater than largest uint200).
- Counterpart to Solidity's `uint200` operator.
- Requirements:
- - input must fit into 200 bits
- [.contract-item]
- [[SafeCast-toUint192-uint256-]]
- ==== `[.contract-item-name]#++toUint192++#++(uint256 value) → uint192++` [.item-kind]#internal#
- Returns the downcasted uint192 from uint256, reverting on
- overflow (when the input is greater than largest uint192).
- Counterpart to Solidity's `uint192` operator.
- Requirements:
- - input must fit into 192 bits
- [.contract-item]
- [[SafeCast-toUint184-uint256-]]
- ==== `[.contract-item-name]#++toUint184++#++(uint256 value) → uint184++` [.item-kind]#internal#
- Returns the downcasted uint184 from uint256, reverting on
- overflow (when the input is greater than largest uint184).
- Counterpart to Solidity's `uint184` operator.
- Requirements:
- - input must fit into 184 bits
- [.contract-item]
- [[SafeCast-toUint176-uint256-]]
- ==== `[.contract-item-name]#++toUint176++#++(uint256 value) → uint176++` [.item-kind]#internal#
- Returns the downcasted uint176 from uint256, reverting on
- overflow (when the input is greater than largest uint176).
- Counterpart to Solidity's `uint176` operator.
- Requirements:
- - input must fit into 176 bits
- [.contract-item]
- [[SafeCast-toUint168-uint256-]]
- ==== `[.contract-item-name]#++toUint168++#++(uint256 value) → uint168++` [.item-kind]#internal#
- Returns the downcasted uint168 from uint256, reverting on
- overflow (when the input is greater than largest uint168).
- Counterpart to Solidity's `uint168` operator.
- Requirements:
- - input must fit into 168 bits
- [.contract-item]
- [[SafeCast-toUint160-uint256-]]
- ==== `[.contract-item-name]#++toUint160++#++(uint256 value) → uint160++` [.item-kind]#internal#
- Returns the downcasted uint160 from uint256, reverting on
- overflow (when the input is greater than largest uint160).
- Counterpart to Solidity's `uint160` operator.
- Requirements:
- - input must fit into 160 bits
- [.contract-item]
- [[SafeCast-toUint152-uint256-]]
- ==== `[.contract-item-name]#++toUint152++#++(uint256 value) → uint152++` [.item-kind]#internal#
- Returns the downcasted uint152 from uint256, reverting on
- overflow (when the input is greater than largest uint152).
- Counterpart to Solidity's `uint152` operator.
- Requirements:
- - input must fit into 152 bits
- [.contract-item]
- [[SafeCast-toUint144-uint256-]]
- ==== `[.contract-item-name]#++toUint144++#++(uint256 value) → uint144++` [.item-kind]#internal#
- Returns the downcasted uint144 from uint256, reverting on
- overflow (when the input is greater than largest uint144).
- Counterpart to Solidity's `uint144` operator.
- Requirements:
- - input must fit into 144 bits
- [.contract-item]
- [[SafeCast-toUint136-uint256-]]
- ==== `[.contract-item-name]#++toUint136++#++(uint256 value) → uint136++` [.item-kind]#internal#
- Returns the downcasted uint136 from uint256, reverting on
- overflow (when the input is greater than largest uint136).
- Counterpart to Solidity's `uint136` operator.
- Requirements:
- - input must fit into 136 bits
- [.contract-item]
- [[SafeCast-toUint128-uint256-]]
- ==== `[.contract-item-name]#++toUint128++#++(uint256 value) → uint128++` [.item-kind]#internal#
- Returns the downcasted uint128 from uint256, reverting on
- overflow (when the input is greater than largest uint128).
- Counterpart to Solidity's `uint128` operator.
- Requirements:
- - input must fit into 128 bits
- [.contract-item]
- [[SafeCast-toUint120-uint256-]]
- ==== `[.contract-item-name]#++toUint120++#++(uint256 value) → uint120++` [.item-kind]#internal#
- Returns the downcasted uint120 from uint256, reverting on
- overflow (when the input is greater than largest uint120).
- Counterpart to Solidity's `uint120` operator.
- Requirements:
- - input must fit into 120 bits
- [.contract-item]
- [[SafeCast-toUint112-uint256-]]
- ==== `[.contract-item-name]#++toUint112++#++(uint256 value) → uint112++` [.item-kind]#internal#
- Returns the downcasted uint112 from uint256, reverting on
- overflow (when the input is greater than largest uint112).
- Counterpart to Solidity's `uint112` operator.
- Requirements:
- - input must fit into 112 bits
- [.contract-item]
- [[SafeCast-toUint104-uint256-]]
- ==== `[.contract-item-name]#++toUint104++#++(uint256 value) → uint104++` [.item-kind]#internal#
- Returns the downcasted uint104 from uint256, reverting on
- overflow (when the input is greater than largest uint104).
- Counterpart to Solidity's `uint104` operator.
- Requirements:
- - input must fit into 104 bits
- [.contract-item]
- [[SafeCast-toUint96-uint256-]]
- ==== `[.contract-item-name]#++toUint96++#++(uint256 value) → uint96++` [.item-kind]#internal#
- Returns the downcasted uint96 from uint256, reverting on
- overflow (when the input is greater than largest uint96).
- Counterpart to Solidity's `uint96` operator.
- Requirements:
- - input must fit into 96 bits
- [.contract-item]
- [[SafeCast-toUint88-uint256-]]
- ==== `[.contract-item-name]#++toUint88++#++(uint256 value) → uint88++` [.item-kind]#internal#
- Returns the downcasted uint88 from uint256, reverting on
- overflow (when the input is greater than largest uint88).
- Counterpart to Solidity's `uint88` operator.
- Requirements:
- - input must fit into 88 bits
- [.contract-item]
- [[SafeCast-toUint80-uint256-]]
- ==== `[.contract-item-name]#++toUint80++#++(uint256 value) → uint80++` [.item-kind]#internal#
- Returns the downcasted uint80 from uint256, reverting on
- overflow (when the input is greater than largest uint80).
- Counterpart to Solidity's `uint80` operator.
- Requirements:
- - input must fit into 80 bits
- [.contract-item]
- [[SafeCast-toUint72-uint256-]]
- ==== `[.contract-item-name]#++toUint72++#++(uint256 value) → uint72++` [.item-kind]#internal#
- Returns the downcasted uint72 from uint256, reverting on
- overflow (when the input is greater than largest uint72).
- Counterpart to Solidity's `uint72` operator.
- Requirements:
- - input must fit into 72 bits
- [.contract-item]
- [[SafeCast-toUint64-uint256-]]
- ==== `[.contract-item-name]#++toUint64++#++(uint256 value) → uint64++` [.item-kind]#internal#
- Returns the downcasted uint64 from uint256, reverting on
- overflow (when the input is greater than largest uint64).
- Counterpart to Solidity's `uint64` operator.
- Requirements:
- - input must fit into 64 bits
- [.contract-item]
- [[SafeCast-toUint56-uint256-]]
- ==== `[.contract-item-name]#++toUint56++#++(uint256 value) → uint56++` [.item-kind]#internal#
- Returns the downcasted uint56 from uint256, reverting on
- overflow (when the input is greater than largest uint56).
- Counterpart to Solidity's `uint56` operator.
- Requirements:
- - input must fit into 56 bits
- [.contract-item]
- [[SafeCast-toUint48-uint256-]]
- ==== `[.contract-item-name]#++toUint48++#++(uint256 value) → uint48++` [.item-kind]#internal#
- Returns the downcasted uint48 from uint256, reverting on
- overflow (when the input is greater than largest uint48).
- Counterpart to Solidity's `uint48` operator.
- Requirements:
- - input must fit into 48 bits
- [.contract-item]
- [[SafeCast-toUint40-uint256-]]
- ==== `[.contract-item-name]#++toUint40++#++(uint256 value) → uint40++` [.item-kind]#internal#
- Returns the downcasted uint40 from uint256, reverting on
- overflow (when the input is greater than largest uint40).
- Counterpart to Solidity's `uint40` operator.
- Requirements:
- - input must fit into 40 bits
- [.contract-item]
- [[SafeCast-toUint32-uint256-]]
- ==== `[.contract-item-name]#++toUint32++#++(uint256 value) → uint32++` [.item-kind]#internal#
- Returns the downcasted uint32 from uint256, reverting on
- overflow (when the input is greater than largest uint32).
- Counterpart to Solidity's `uint32` operator.
- Requirements:
- - input must fit into 32 bits
- [.contract-item]
- [[SafeCast-toUint24-uint256-]]
- ==== `[.contract-item-name]#++toUint24++#++(uint256 value) → uint24++` [.item-kind]#internal#
- Returns the downcasted uint24 from uint256, reverting on
- overflow (when the input is greater than largest uint24).
- Counterpart to Solidity's `uint24` operator.
- Requirements:
- - input must fit into 24 bits
- [.contract-item]
- [[SafeCast-toUint16-uint256-]]
- ==== `[.contract-item-name]#++toUint16++#++(uint256 value) → uint16++` [.item-kind]#internal#
- Returns the downcasted uint16 from uint256, reverting on
- overflow (when the input is greater than largest uint16).
- Counterpart to Solidity's `uint16` operator.
- Requirements:
- - input must fit into 16 bits
- [.contract-item]
- [[SafeCast-toUint8-uint256-]]
- ==== `[.contract-item-name]#++toUint8++#++(uint256 value) → uint8++` [.item-kind]#internal#
- Returns the downcasted uint8 from uint256, reverting on
- overflow (when the input is greater than largest uint8).
- Counterpart to Solidity's `uint8` operator.
- Requirements:
- - input must fit into 8 bits
- [.contract-item]
- [[SafeCast-toUint256-int256-]]
- ==== `[.contract-item-name]#++toUint256++#++(int256 value) → uint256++` [.item-kind]#internal#
- Converts a signed int256 into an unsigned uint256.
- Requirements:
- - input must be greater than or equal to 0.
- [.contract-item]
- [[SafeCast-toInt248-int256-]]
- ==== `[.contract-item-name]#++toInt248++#++(int256 value) → int248 downcasted++` [.item-kind]#internal#
- Returns the downcasted int248 from int256, reverting on
- overflow (when the input is less than smallest int248 or
- greater than largest int248).
- Counterpart to Solidity's `int248` operator.
- Requirements:
- - input must fit into 248 bits
- [.contract-item]
- [[SafeCast-toInt240-int256-]]
- ==== `[.contract-item-name]#++toInt240++#++(int256 value) → int240 downcasted++` [.item-kind]#internal#
- Returns the downcasted int240 from int256, reverting on
- overflow (when the input is less than smallest int240 or
- greater than largest int240).
- Counterpart to Solidity's `int240` operator.
- Requirements:
- - input must fit into 240 bits
- [.contract-item]
- [[SafeCast-toInt232-int256-]]
- ==== `[.contract-item-name]#++toInt232++#++(int256 value) → int232 downcasted++` [.item-kind]#internal#
- Returns the downcasted int232 from int256, reverting on
- overflow (when the input is less than smallest int232 or
- greater than largest int232).
- Counterpart to Solidity's `int232` operator.
- Requirements:
- - input must fit into 232 bits
- [.contract-item]
- [[SafeCast-toInt224-int256-]]
- ==== `[.contract-item-name]#++toInt224++#++(int256 value) → int224 downcasted++` [.item-kind]#internal#
- Returns the downcasted int224 from int256, reverting on
- overflow (when the input is less than smallest int224 or
- greater than largest int224).
- Counterpart to Solidity's `int224` operator.
- Requirements:
- - input must fit into 224 bits
- [.contract-item]
- [[SafeCast-toInt216-int256-]]
- ==== `[.contract-item-name]#++toInt216++#++(int256 value) → int216 downcasted++` [.item-kind]#internal#
- Returns the downcasted int216 from int256, reverting on
- overflow (when the input is less than smallest int216 or
- greater than largest int216).
- Counterpart to Solidity's `int216` operator.
- Requirements:
- - input must fit into 216 bits
- [.contract-item]
- [[SafeCast-toInt208-int256-]]
- ==== `[.contract-item-name]#++toInt208++#++(int256 value) → int208 downcasted++` [.item-kind]#internal#
- Returns the downcasted int208 from int256, reverting on
- overflow (when the input is less than smallest int208 or
- greater than largest int208).
- Counterpart to Solidity's `int208` operator.
- Requirements:
- - input must fit into 208 bits
- [.contract-item]
- [[SafeCast-toInt200-int256-]]
- ==== `[.contract-item-name]#++toInt200++#++(int256 value) → int200 downcasted++` [.item-kind]#internal#
- Returns the downcasted int200 from int256, reverting on
- overflow (when the input is less than smallest int200 or
- greater than largest int200).
- Counterpart to Solidity's `int200` operator.
- Requirements:
- - input must fit into 200 bits
- [.contract-item]
- [[SafeCast-toInt192-int256-]]
- ==== `[.contract-item-name]#++toInt192++#++(int256 value) → int192 downcasted++` [.item-kind]#internal#
- Returns the downcasted int192 from int256, reverting on
- overflow (when the input is less than smallest int192 or
- greater than largest int192).
- Counterpart to Solidity's `int192` operator.
- Requirements:
- - input must fit into 192 bits
- [.contract-item]
- [[SafeCast-toInt184-int256-]]
- ==== `[.contract-item-name]#++toInt184++#++(int256 value) → int184 downcasted++` [.item-kind]#internal#
- Returns the downcasted int184 from int256, reverting on
- overflow (when the input is less than smallest int184 or
- greater than largest int184).
- Counterpart to Solidity's `int184` operator.
- Requirements:
- - input must fit into 184 bits
- [.contract-item]
- [[SafeCast-toInt176-int256-]]
- ==== `[.contract-item-name]#++toInt176++#++(int256 value) → int176 downcasted++` [.item-kind]#internal#
- Returns the downcasted int176 from int256, reverting on
- overflow (when the input is less than smallest int176 or
- greater than largest int176).
- Counterpart to Solidity's `int176` operator.
- Requirements:
- - input must fit into 176 bits
- [.contract-item]
- [[SafeCast-toInt168-int256-]]
- ==== `[.contract-item-name]#++toInt168++#++(int256 value) → int168 downcasted++` [.item-kind]#internal#
- Returns the downcasted int168 from int256, reverting on
- overflow (when the input is less than smallest int168 or
- greater than largest int168).
- Counterpart to Solidity's `int168` operator.
- Requirements:
- - input must fit into 168 bits
- [.contract-item]
- [[SafeCast-toInt160-int256-]]
- ==== `[.contract-item-name]#++toInt160++#++(int256 value) → int160 downcasted++` [.item-kind]#internal#
- Returns the downcasted int160 from int256, reverting on
- overflow (when the input is less than smallest int160 or
- greater than largest int160).
- Counterpart to Solidity's `int160` operator.
- Requirements:
- - input must fit into 160 bits
- [.contract-item]
- [[SafeCast-toInt152-int256-]]
- ==== `[.contract-item-name]#++toInt152++#++(int256 value) → int152 downcasted++` [.item-kind]#internal#
- Returns the downcasted int152 from int256, reverting on
- overflow (when the input is less than smallest int152 or
- greater than largest int152).
- Counterpart to Solidity's `int152` operator.
- Requirements:
- - input must fit into 152 bits
- [.contract-item]
- [[SafeCast-toInt144-int256-]]
- ==== `[.contract-item-name]#++toInt144++#++(int256 value) → int144 downcasted++` [.item-kind]#internal#
- Returns the downcasted int144 from int256, reverting on
- overflow (when the input is less than smallest int144 or
- greater than largest int144).
- Counterpart to Solidity's `int144` operator.
- Requirements:
- - input must fit into 144 bits
- [.contract-item]
- [[SafeCast-toInt136-int256-]]
- ==== `[.contract-item-name]#++toInt136++#++(int256 value) → int136 downcasted++` [.item-kind]#internal#
- Returns the downcasted int136 from int256, reverting on
- overflow (when the input is less than smallest int136 or
- greater than largest int136).
- Counterpart to Solidity's `int136` operator.
- Requirements:
- - input must fit into 136 bits
- [.contract-item]
- [[SafeCast-toInt128-int256-]]
- ==== `[.contract-item-name]#++toInt128++#++(int256 value) → int128 downcasted++` [.item-kind]#internal#
- Returns the downcasted int128 from int256, reverting on
- overflow (when the input is less than smallest int128 or
- greater than largest int128).
- Counterpart to Solidity's `int128` operator.
- Requirements:
- - input must fit into 128 bits
- [.contract-item]
- [[SafeCast-toInt120-int256-]]
- ==== `[.contract-item-name]#++toInt120++#++(int256 value) → int120 downcasted++` [.item-kind]#internal#
- Returns the downcasted int120 from int256, reverting on
- overflow (when the input is less than smallest int120 or
- greater than largest int120).
- Counterpart to Solidity's `int120` operator.
- Requirements:
- - input must fit into 120 bits
- [.contract-item]
- [[SafeCast-toInt112-int256-]]
- ==== `[.contract-item-name]#++toInt112++#++(int256 value) → int112 downcasted++` [.item-kind]#internal#
- Returns the downcasted int112 from int256, reverting on
- overflow (when the input is less than smallest int112 or
- greater than largest int112).
- Counterpart to Solidity's `int112` operator.
- Requirements:
- - input must fit into 112 bits
- [.contract-item]
- [[SafeCast-toInt104-int256-]]
- ==== `[.contract-item-name]#++toInt104++#++(int256 value) → int104 downcasted++` [.item-kind]#internal#
- Returns the downcasted int104 from int256, reverting on
- overflow (when the input is less than smallest int104 or
- greater than largest int104).
- Counterpart to Solidity's `int104` operator.
- Requirements:
- - input must fit into 104 bits
- [.contract-item]
- [[SafeCast-toInt96-int256-]]
- ==== `[.contract-item-name]#++toInt96++#++(int256 value) → int96 downcasted++` [.item-kind]#internal#
- Returns the downcasted int96 from int256, reverting on
- overflow (when the input is less than smallest int96 or
- greater than largest int96).
- Counterpart to Solidity's `int96` operator.
- Requirements:
- - input must fit into 96 bits
- [.contract-item]
- [[SafeCast-toInt88-int256-]]
- ==== `[.contract-item-name]#++toInt88++#++(int256 value) → int88 downcasted++` [.item-kind]#internal#
- Returns the downcasted int88 from int256, reverting on
- overflow (when the input is less than smallest int88 or
- greater than largest int88).
- Counterpart to Solidity's `int88` operator.
- Requirements:
- - input must fit into 88 bits
- [.contract-item]
- [[SafeCast-toInt80-int256-]]
- ==== `[.contract-item-name]#++toInt80++#++(int256 value) → int80 downcasted++` [.item-kind]#internal#
- Returns the downcasted int80 from int256, reverting on
- overflow (when the input is less than smallest int80 or
- greater than largest int80).
- Counterpart to Solidity's `int80` operator.
- Requirements:
- - input must fit into 80 bits
- [.contract-item]
- [[SafeCast-toInt72-int256-]]
- ==== `[.contract-item-name]#++toInt72++#++(int256 value) → int72 downcasted++` [.item-kind]#internal#
- Returns the downcasted int72 from int256, reverting on
- overflow (when the input is less than smallest int72 or
- greater than largest int72).
- Counterpart to Solidity's `int72` operator.
- Requirements:
- - input must fit into 72 bits
- [.contract-item]
- [[SafeCast-toInt64-int256-]]
- ==== `[.contract-item-name]#++toInt64++#++(int256 value) → int64 downcasted++` [.item-kind]#internal#
- Returns the downcasted int64 from int256, reverting on
- overflow (when the input is less than smallest int64 or
- greater than largest int64).
- Counterpart to Solidity's `int64` operator.
- Requirements:
- - input must fit into 64 bits
- [.contract-item]
- [[SafeCast-toInt56-int256-]]
- ==== `[.contract-item-name]#++toInt56++#++(int256 value) → int56 downcasted++` [.item-kind]#internal#
- Returns the downcasted int56 from int256, reverting on
- overflow (when the input is less than smallest int56 or
- greater than largest int56).
- Counterpart to Solidity's `int56` operator.
- Requirements:
- - input must fit into 56 bits
- [.contract-item]
- [[SafeCast-toInt48-int256-]]
- ==== `[.contract-item-name]#++toInt48++#++(int256 value) → int48 downcasted++` [.item-kind]#internal#
- Returns the downcasted int48 from int256, reverting on
- overflow (when the input is less than smallest int48 or
- greater than largest int48).
- Counterpart to Solidity's `int48` operator.
- Requirements:
- - input must fit into 48 bits
- [.contract-item]
- [[SafeCast-toInt40-int256-]]
- ==== `[.contract-item-name]#++toInt40++#++(int256 value) → int40 downcasted++` [.item-kind]#internal#
- Returns the downcasted int40 from int256, reverting on
- overflow (when the input is less than smallest int40 or
- greater than largest int40).
- Counterpart to Solidity's `int40` operator.
- Requirements:
- - input must fit into 40 bits
- [.contract-item]
- [[SafeCast-toInt32-int256-]]
- ==== `[.contract-item-name]#++toInt32++#++(int256 value) → int32 downcasted++` [.item-kind]#internal#
- Returns the downcasted int32 from int256, reverting on
- overflow (when the input is less than smallest int32 or
- greater than largest int32).
- Counterpart to Solidity's `int32` operator.
- Requirements:
- - input must fit into 32 bits
- [.contract-item]
- [[SafeCast-toInt24-int256-]]
- ==== `[.contract-item-name]#++toInt24++#++(int256 value) → int24 downcasted++` [.item-kind]#internal#
- Returns the downcasted int24 from int256, reverting on
- overflow (when the input is less than smallest int24 or
- greater than largest int24).
- Counterpart to Solidity's `int24` operator.
- Requirements:
- - input must fit into 24 bits
- [.contract-item]
- [[SafeCast-toInt16-int256-]]
- ==== `[.contract-item-name]#++toInt16++#++(int256 value) → int16 downcasted++` [.item-kind]#internal#
- Returns the downcasted int16 from int256, reverting on
- overflow (when the input is less than smallest int16 or
- greater than largest int16).
- Counterpart to Solidity's `int16` operator.
- Requirements:
- - input must fit into 16 bits
- [.contract-item]
- [[SafeCast-toInt8-int256-]]
- ==== `[.contract-item-name]#++toInt8++#++(int256 value) → int8 downcasted++` [.item-kind]#internal#
- Returns the downcasted int8 from int256, reverting on
- overflow (when the input is less than smallest int8 or
- greater than largest int8).
- Counterpart to Solidity's `int8` operator.
- Requirements:
- - input must fit into 8 bits
- [.contract-item]
- [[SafeCast-toInt256-uint256-]]
- ==== `[.contract-item-name]#++toInt256++#++(uint256 value) → int256++` [.item-kind]#internal#
- Converts an unsigned uint256 into a signed int256.
- Requirements:
- - input must be less than or equal to maxInt256.
- [.contract-item]
- [[SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-]]
- ==== `[.contract-item-name]#++SafeCastOverflowedUintDowncast++#++(uint8 bits, uint256 value)++` [.item-kind]#error#
- Value doesn't fit in an uint of `bits` size.
- [.contract-item]
- [[SafeCast-SafeCastOverflowedIntToUint-int256-]]
- ==== `[.contract-item-name]#++SafeCastOverflowedIntToUint++#++(int256 value)++` [.item-kind]#error#
- An int value doesn't fit in an uint of `bits` size.
- [.contract-item]
- [[SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-]]
- ==== `[.contract-item-name]#++SafeCastOverflowedIntDowncast++#++(uint8 bits, int256 value)++` [.item-kind]#error#
- Value doesn't fit in an int of `bits` size.
- [.contract-item]
- [[SafeCast-SafeCastOverflowedUintToInt-uint256-]]
- ==== `[.contract-item-name]#++SafeCastOverflowedUintToInt++#++(uint256 value)++` [.item-kind]#error#
- An uint value doesn't fit in an int of `bits` size.
- == Cryptography
- :RecoverError: pass:normal[xref:#ECDSA-RecoverError[`++RecoverError++`]]
- :ECDSAInvalidSignature: pass:normal[xref:#ECDSA-ECDSAInvalidSignature--[`++ECDSAInvalidSignature++`]]
- :ECDSAInvalidSignatureLength: pass:normal[xref:#ECDSA-ECDSAInvalidSignatureLength-uint256-[`++ECDSAInvalidSignatureLength++`]]
- :ECDSAInvalidSignatureS: pass:normal[xref:#ECDSA-ECDSAInvalidSignatureS-bytes32-[`++ECDSAInvalidSignatureS++`]]
- :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-bytes-[`++tryRecover++`]]
- :recover: pass:normal[xref:#ECDSA-recover-bytes32-bytes-[`++recover++`]]
- :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-bytes32-bytes32-[`++tryRecover++`]]
- :recover: pass:normal[xref:#ECDSA-recover-bytes32-bytes32-bytes32-[`++recover++`]]
- :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`++tryRecover++`]]
- :recover: pass:normal[xref:#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`++recover++`]]
- [.contract]
- [[ECDSA]]
- === `++ECDSA++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/cryptography/ECDSA.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
- ```
- Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
- These functions can be used to verify that a message was signed by the holder
- of the private keys of a given address.
- [.contract-index]
- .Functions
- --
- * {xref-ECDSA-tryRecover-bytes32-bytes-}[`++tryRecover(hash, signature)++`]
- * {xref-ECDSA-recover-bytes32-bytes-}[`++recover(hash, signature)++`]
- * {xref-ECDSA-tryRecover-bytes32-bytes32-bytes32-}[`++tryRecover(hash, r, vs)++`]
- * {xref-ECDSA-recover-bytes32-bytes32-bytes32-}[`++recover(hash, r, vs)++`]
- * {xref-ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-}[`++tryRecover(hash, v, r, s)++`]
- * {xref-ECDSA-recover-bytes32-uint8-bytes32-bytes32-}[`++recover(hash, v, r, s)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-ECDSA-ECDSAInvalidSignature--}[`++ECDSAInvalidSignature()++`]
- * {xref-ECDSA-ECDSAInvalidSignatureLength-uint256-}[`++ECDSAInvalidSignatureLength(length)++`]
- * {xref-ECDSA-ECDSAInvalidSignatureS-bytes32-}[`++ECDSAInvalidSignatureS(s)++`]
- --
- [.contract-item]
- [[ECDSA-tryRecover-bytes32-bytes-]]
- ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, bytes signature) → address, enum ECDSA.RecoverError, bytes32++` [.item-kind]#internal#
- Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
- return address(0) without also returning an error description. Errors are documented using an enum (error type)
- and a bytes32 providing additional information about the error.
- If no error is returned, then the address can be used for verification purposes.
- The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
- this function rejects them by requiring the `s` value to be in the lower
- half order, and the `v` value to be either 27 or 28.
- IMPORTANT: `hash` _must_ be the result of a hash operation for the
- verification to be secure: it is possible to craft signatures that
- recover to arbitrary addresses for non-hashed data. A safe way to ensure
- this is by receiving a hash of the original message (which may otherwise
- be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
- Documentation for signature generation:
- - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
- - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
- [.contract-item]
- [[ECDSA-recover-bytes32-bytes-]]
- ==== `[.contract-item-name]#++recover++#++(bytes32 hash, bytes signature) → address++` [.item-kind]#internal#
- Returns the address that signed a hashed message (`hash`) with
- `signature`. This address can then be used for verification purposes.
- The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
- this function rejects them by requiring the `s` value to be in the lower
- half order, and the `v` value to be either 27 or 28.
- IMPORTANT: `hash` _must_ be the result of a hash operation for the
- verification to be secure: it is possible to craft signatures that
- recover to arbitrary addresses for non-hashed data. A safe way to ensure
- this is by receiving a hash of the original message (which may otherwise
- be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
- [.contract-item]
- [[ECDSA-tryRecover-bytes32-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, bytes32 r, bytes32 vs) → address, enum ECDSA.RecoverError, bytes32++` [.item-kind]#internal#
- Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
- See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
- [.contract-item]
- [[ECDSA-recover-bytes32-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++recover++#++(bytes32 hash, bytes32 r, bytes32 vs) → address++` [.item-kind]#internal#
- Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
- [.contract-item]
- [[ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, uint8 v, bytes32 r, bytes32 s) → address, enum ECDSA.RecoverError, bytes32++` [.item-kind]#internal#
- Overload of {ECDSA-tryRecover} that receives the `v`,
- `r` and `s` signature fields separately.
- [.contract-item]
- [[ECDSA-recover-bytes32-uint8-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++recover++#++(bytes32 hash, uint8 v, bytes32 r, bytes32 s) → address++` [.item-kind]#internal#
- Overload of {ECDSA-recover} that receives the `v`,
- `r` and `s` signature fields separately.
- [.contract-item]
- [[ECDSA-ECDSAInvalidSignature--]]
- ==== `[.contract-item-name]#++ECDSAInvalidSignature++#++()++` [.item-kind]#error#
- The signature derives the `address(0)`.
- [.contract-item]
- [[ECDSA-ECDSAInvalidSignatureLength-uint256-]]
- ==== `[.contract-item-name]#++ECDSAInvalidSignatureLength++#++(uint256 length)++` [.item-kind]#error#
- The signature has an invalid length.
- [.contract-item]
- [[ECDSA-ECDSAInvalidSignatureS-bytes32-]]
- ==== `[.contract-item-name]#++ECDSAInvalidSignatureS++#++(bytes32 s)++` [.item-kind]#error#
- The signature has an S value that is in the upper half order.
- :toEthSignedMessageHash: pass:normal[xref:#MessageHashUtils-toEthSignedMessageHash-bytes32-[`++toEthSignedMessageHash++`]]
- :toEthSignedMessageHash: pass:normal[xref:#MessageHashUtils-toEthSignedMessageHash-bytes-[`++toEthSignedMessageHash++`]]
- :toDataWithIntendedValidatorHash: pass:normal[xref:#MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-[`++toDataWithIntendedValidatorHash++`]]
- :toTypedDataHash: pass:normal[xref:#MessageHashUtils-toTypedDataHash-bytes32-bytes32-[`++toTypedDataHash++`]]
- [.contract]
- [[MessageHashUtils]]
- === `++MessageHashUtils++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/cryptography/MessageHashUtils.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
- ```
- Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
- The library provides methods for generating a hash of a message that conforms to the
- https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
- specifications.
- [.contract-index]
- .Functions
- --
- * {xref-MessageHashUtils-toEthSignedMessageHash-bytes32-}[`++toEthSignedMessageHash(messageHash)++`]
- * {xref-MessageHashUtils-toEthSignedMessageHash-bytes-}[`++toEthSignedMessageHash(message)++`]
- * {xref-MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-}[`++toDataWithIntendedValidatorHash(validator, data)++`]
- * {xref-MessageHashUtils-toTypedDataHash-bytes32-bytes32-}[`++toTypedDataHash(domainSeparator, structHash)++`]
- --
- [.contract-item]
- [[MessageHashUtils-toEthSignedMessageHash-bytes32-]]
- ==== `[.contract-item-name]#++toEthSignedMessageHash++#++(bytes32 messageHash) → bytes32 digest++` [.item-kind]#internal#
- Returns the keccak256 digest of an EIP-191 signed data with version
- `0x45` (`personal_sign` messages).
- The digest is calculated by prefixing a bytes32 `messageHash` with
- `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
- hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
- NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
- keccak256, although any bytes32 value can be safely used because the final digest will
- be re-hashed.
- See {ECDSA-recover}.
- [.contract-item]
- [[MessageHashUtils-toEthSignedMessageHash-bytes-]]
- ==== `[.contract-item-name]#++toEthSignedMessageHash++#++(bytes message) → bytes32++` [.item-kind]#internal#
- Returns the keccak256 digest of an EIP-191 signed data with version
- `0x45` (`personal_sign` messages).
- The digest is calculated by prefixing an arbitrary `message` with
- `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
- hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
- See {ECDSA-recover}.
- [.contract-item]
- [[MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-]]
- ==== `[.contract-item-name]#++toDataWithIntendedValidatorHash++#++(address validator, bytes data) → bytes32++` [.item-kind]#internal#
- Returns the keccak256 digest of an EIP-191 signed data with version
- `0x00` (data with intended validator).
- The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
- `validator` address. Then hashing the result.
- See {ECDSA-recover}.
- [.contract-item]
- [[MessageHashUtils-toTypedDataHash-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++toTypedDataHash++#++(bytes32 domainSeparator, bytes32 structHash) → bytes32 digest++` [.item-kind]#internal#
- Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
- The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
- `\x19\x01` and hashing the result. It corresponds to the hash signed by the
- https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
- See {ECDSA-recover}.
- :isValidSignatureNow: pass:normal[xref:#SignatureChecker-isValidSignatureNow-address-bytes32-bytes-[`++isValidSignatureNow++`]]
- :isValidERC1271SignatureNow: pass:normal[xref:#SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-[`++isValidERC1271SignatureNow++`]]
- [.contract]
- [[SignatureChecker]]
- === `++SignatureChecker++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/cryptography/SignatureChecker.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
- ```
- Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
- signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
- Argent and Safe Wallet (previously Gnosis Safe).
- [.contract-index]
- .Functions
- --
- * {xref-SignatureChecker-isValidSignatureNow-address-bytes32-bytes-}[`++isValidSignatureNow(signer, hash, signature)++`]
- * {xref-SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-}[`++isValidERC1271SignatureNow(signer, hash, signature)++`]
- --
- [.contract-item]
- [[SignatureChecker-isValidSignatureNow-address-bytes32-bytes-]]
- ==== `[.contract-item-name]#++isValidSignatureNow++#++(address signer, bytes32 hash, bytes signature) → bool++` [.item-kind]#internal#
- Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
- signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
- NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
- change through time. It could return true at block N and false at block N+1 (or the opposite).
- [.contract-item]
- [[SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-]]
- ==== `[.contract-item-name]#++isValidERC1271SignatureNow++#++(address signer, bytes32 hash, bytes signature) → bool++` [.item-kind]#internal#
- Checks if a signature is valid for a given signer and data hash. The signature is validated
- against the signer smart contract using ERC1271.
- NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
- change through time. It could return true at block N and false at block N+1 (or the opposite).
- :MerkleProofInvalidMultiproof: pass:normal[xref:#MerkleProof-MerkleProofInvalidMultiproof--[`++MerkleProofInvalidMultiproof++`]]
- :verify: pass:normal[xref:#MerkleProof-verify-bytes32---bytes32-bytes32-[`++verify++`]]
- :verifyCalldata: pass:normal[xref:#MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-[`++verifyCalldata++`]]
- :processProof: pass:normal[xref:#MerkleProof-processProof-bytes32---bytes32-[`++processProof++`]]
- :processProofCalldata: pass:normal[xref:#MerkleProof-processProofCalldata-bytes32---bytes32-[`++processProofCalldata++`]]
- :multiProofVerify: pass:normal[xref:#MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---[`++multiProofVerify++`]]
- :multiProofVerifyCalldata: pass:normal[xref:#MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---[`++multiProofVerifyCalldata++`]]
- :processMultiProof: pass:normal[xref:#MerkleProof-processMultiProof-bytes32---bool---bytes32---[`++processMultiProof++`]]
- :processMultiProofCalldata: pass:normal[xref:#MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---[`++processMultiProofCalldata++`]]
- [.contract]
- [[MerkleProof]]
- === `++MerkleProof++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/cryptography/MerkleProof.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
- ```
- These functions deal with verification of Merkle Tree proofs.
- The tree and the proofs can be generated using our
- https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
- You will find a quickstart guide in the readme.
- WARNING: You should avoid using leaf values that are 64 bytes long prior to
- hashing, or use a hash function other than keccak256 for hashing leaves.
- This is because the concatenation of a sorted pair of internal nodes in
- the Merkle tree could be reinterpreted as a leaf value.
- OpenZeppelin's JavaScript library generates Merkle trees that are safe
- against this attack out of the box.
- [.contract-index]
- .Functions
- --
- * {xref-MerkleProof-verify-bytes32---bytes32-bytes32-}[`++verify(proof, root, leaf)++`]
- * {xref-MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-}[`++verifyCalldata(proof, root, leaf)++`]
- * {xref-MerkleProof-processProof-bytes32---bytes32-}[`++processProof(proof, leaf)++`]
- * {xref-MerkleProof-processProofCalldata-bytes32---bytes32-}[`++processProofCalldata(proof, leaf)++`]
- * {xref-MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---}[`++multiProofVerify(proof, proofFlags, root, leaves)++`]
- * {xref-MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---}[`++multiProofVerifyCalldata(proof, proofFlags, root, leaves)++`]
- * {xref-MerkleProof-processMultiProof-bytes32---bool---bytes32---}[`++processMultiProof(proof, proofFlags, leaves)++`]
- * {xref-MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---}[`++processMultiProofCalldata(proof, proofFlags, leaves)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-MerkleProof-MerkleProofInvalidMultiproof--}[`++MerkleProofInvalidMultiproof()++`]
- --
- [.contract-item]
- [[MerkleProof-verify-bytes32---bytes32-bytes32-]]
- ==== `[.contract-item-name]#++verify++#++(bytes32[] proof, bytes32 root, bytes32 leaf) → bool++` [.item-kind]#internal#
- Returns true if a `leaf` can be proved to be a part of a Merkle tree
- defined by `root`. For this, a `proof` must be provided, containing
- sibling hashes on the branch from the leaf to the root of the tree. Each
- pair of leaves and each pair of pre-images are assumed to be sorted.
- [.contract-item]
- [[MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-]]
- ==== `[.contract-item-name]#++verifyCalldata++#++(bytes32[] proof, bytes32 root, bytes32 leaf) → bool++` [.item-kind]#internal#
- Calldata version of {verify}
- [.contract-item]
- [[MerkleProof-processProof-bytes32---bytes32-]]
- ==== `[.contract-item-name]#++processProof++#++(bytes32[] proof, bytes32 leaf) → bytes32++` [.item-kind]#internal#
- Returns the rebuilt hash obtained by traversing a Merkle tree up
- from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
- hash matches the root of the tree. When processing the proof, the pairs
- of leafs & pre-images are assumed to be sorted.
- [.contract-item]
- [[MerkleProof-processProofCalldata-bytes32---bytes32-]]
- ==== `[.contract-item-name]#++processProofCalldata++#++(bytes32[] proof, bytes32 leaf) → bytes32++` [.item-kind]#internal#
- Calldata version of {processProof}
- [.contract-item]
- [[MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---]]
- ==== `[.contract-item-name]#++multiProofVerify++#++(bytes32[] proof, bool[] proofFlags, bytes32 root, bytes32[] leaves) → bool++` [.item-kind]#internal#
- Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
- `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
- CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
- [.contract-item]
- [[MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---]]
- ==== `[.contract-item-name]#++multiProofVerifyCalldata++#++(bytes32[] proof, bool[] proofFlags, bytes32 root, bytes32[] leaves) → bool++` [.item-kind]#internal#
- Calldata version of {multiProofVerify}
- CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
- [.contract-item]
- [[MerkleProof-processMultiProof-bytes32---bool---bytes32---]]
- ==== `[.contract-item-name]#++processMultiProof++#++(bytes32[] proof, bool[] proofFlags, bytes32[] leaves) → bytes32 merkleRoot++` [.item-kind]#internal#
- Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
- proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
- leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
- respectively.
- CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
- is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
- tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
- [.contract-item]
- [[MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---]]
- ==== `[.contract-item-name]#++processMultiProofCalldata++#++(bytes32[] proof, bool[] proofFlags, bytes32[] leaves) → bytes32 merkleRoot++` [.item-kind]#internal#
- Calldata version of {processMultiProof}.
- CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
- [.contract-item]
- [[MerkleProof-MerkleProofInvalidMultiproof--]]
- ==== `[.contract-item-name]#++MerkleProofInvalidMultiproof++#++()++` [.item-kind]#error#
- The multiproof provided is not valid.
- :constructor: pass:normal[xref:#EIP712-constructor-string-string-[`++constructor++`]]
- :_domainSeparatorV4: pass:normal[xref:#EIP712-_domainSeparatorV4--[`++_domainSeparatorV4++`]]
- :_hashTypedDataV4: pass:normal[xref:#EIP712-_hashTypedDataV4-bytes32-[`++_hashTypedDataV4++`]]
- :eip712Domain: pass:normal[xref:#EIP712-eip712Domain--[`++eip712Domain++`]]
- :_EIP712Name: pass:normal[xref:#EIP712-_EIP712Name--[`++_EIP712Name++`]]
- :_EIP712Version: pass:normal[xref:#EIP712-_EIP712Version--[`++_EIP712Version++`]]
- [.contract]
- [[EIP712]]
- === `++EIP712++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/cryptography/EIP712.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
- ```
- https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
- The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
- encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
- does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
- produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
- This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
- scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
- ({_hashTypedDataV4}).
- The implementation of the domain separator was designed to be as efficient as possible while still properly updating
- the chain id to protect against replay attacks on an eventual fork of the chain.
- NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
- https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
- NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
- separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
- separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
- [.contract-index]
- .Functions
- --
- * {xref-EIP712-constructor-string-string-}[`++constructor(name, version)++`]
- * {xref-EIP712-_domainSeparatorV4--}[`++_domainSeparatorV4()++`]
- * {xref-EIP712-_hashTypedDataV4-bytes32-}[`++_hashTypedDataV4(structHash)++`]
- * {xref-EIP712-eip712Domain--}[`++eip712Domain()++`]
- * {xref-EIP712-_EIP712Name--}[`++_EIP712Name()++`]
- * {xref-EIP712-_EIP712Version--}[`++_EIP712Version()++`]
- [.contract-subindex-inherited]
- .IERC5267
- --
- [.contract-index]
- .Events
- --
- [.contract-subindex-inherited]
- .IERC5267
- * {xref-IERC5267-EIP712DomainChanged--}[`++EIP712DomainChanged()++`]
- --
- [.contract-item]
- [[EIP712-constructor-string-string-]]
- ==== `[.contract-item-name]#++constructor++#++(string name, string version)++` [.item-kind]#internal#
- Initializes the domain separator and parameter caches.
- The meaning of `name` and `version` is specified in
- https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
- - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
- - `version`: the current major version of the signing domain.
- NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
- contract upgrade].
- [.contract-item]
- [[EIP712-_domainSeparatorV4--]]
- ==== `[.contract-item-name]#++_domainSeparatorV4++#++() → bytes32++` [.item-kind]#internal#
- Returns the domain separator for the current chain.
- [.contract-item]
- [[EIP712-_hashTypedDataV4-bytes32-]]
- ==== `[.contract-item-name]#++_hashTypedDataV4++#++(bytes32 structHash) → bytes32++` [.item-kind]#internal#
- Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
- function returns the hash of the fully encoded EIP712 message for this domain.
- This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
- ```solidity
- bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
- keccak256("Mail(address to,string contents)"),
- mailTo,
- keccak256(bytes(mailContents))
- )));
- address signer = ECDSA.recover(digest, signature);
- ```
- [.contract-item]
- [[EIP712-eip712Domain--]]
- ==== `[.contract-item-name]#++eip712Domain++#++() → bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions++` [.item-kind]#public#
- See {IERC-5267}.
- [.contract-item]
- [[EIP712-_EIP712Name--]]
- ==== `[.contract-item-name]#++_EIP712Name++#++() → string++` [.item-kind]#internal#
- The name parameter for the EIP712 domain.
- NOTE: By default this function reads _name which is an immutable value.
- It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
- [.contract-item]
- [[EIP712-_EIP712Version--]]
- ==== `[.contract-item-name]#++_EIP712Version++#++() → string++` [.item-kind]#internal#
- The version parameter for the EIP712 domain.
- NOTE: By default this function reads _version which is an immutable value.
- It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
- == Security
- :ReentrancyGuardReentrantCall: pass:normal[xref:#ReentrancyGuard-ReentrancyGuardReentrantCall--[`++ReentrancyGuardReentrantCall++`]]
- :constructor: pass:normal[xref:#ReentrancyGuard-constructor--[`++constructor++`]]
- :nonReentrant: pass:normal[xref:#ReentrancyGuard-nonReentrant--[`++nonReentrant++`]]
- :_reentrancyGuardEntered: pass:normal[xref:#ReentrancyGuard-_reentrancyGuardEntered--[`++_reentrancyGuardEntered++`]]
- [.contract]
- [[ReentrancyGuard]]
- === `++ReentrancyGuard++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/ReentrancyGuard.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
- ```
- Contract module that helps prevent reentrant calls to a function.
- Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
- available, which can be applied to functions to make sure there are no nested
- (reentrant) calls to them.
- Note that because there is a single `nonReentrant` guard, functions marked as
- `nonReentrant` may not call one another. This can be worked around by making
- those functions `private`, and then adding `external` `nonReentrant` entry
- points to them.
- TIP: If you would like to learn more about reentrancy and alternative ways
- to protect against it, check out our blog post
- https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
- [.contract-index]
- .Modifiers
- --
- * {xref-ReentrancyGuard-nonReentrant--}[`++nonReentrant()++`]
- --
- [.contract-index]
- .Functions
- --
- * {xref-ReentrancyGuard-constructor--}[`++constructor()++`]
- * {xref-ReentrancyGuard-_reentrancyGuardEntered--}[`++_reentrancyGuardEntered()++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-ReentrancyGuard-ReentrancyGuardReentrantCall--}[`++ReentrancyGuardReentrantCall()++`]
- --
- [.contract-item]
- [[ReentrancyGuard-nonReentrant--]]
- ==== `[.contract-item-name]#++nonReentrant++#++()++` [.item-kind]#modifier#
- Prevents a contract from calling itself, directly or indirectly.
- Calling a `nonReentrant` function from another `nonReentrant`
- function is not supported. It is possible to prevent this from happening
- by making the `nonReentrant` function external, and making it call a
- `private` function that does the actual work.
- [.contract-item]
- [[ReentrancyGuard-constructor--]]
- ==== `[.contract-item-name]#++constructor++#++()++` [.item-kind]#internal#
- [.contract-item]
- [[ReentrancyGuard-_reentrancyGuardEntered--]]
- ==== `[.contract-item-name]#++_reentrancyGuardEntered++#++() → bool++` [.item-kind]#internal#
- Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
- `nonReentrant` function in the call stack.
- [.contract-item]
- [[ReentrancyGuard-ReentrancyGuardReentrantCall--]]
- ==== `[.contract-item-name]#++ReentrancyGuardReentrantCall++#++()++` [.item-kind]#error#
- Unauthorized reentrant call.
- :Paused: pass:normal[xref:#Pausable-Paused-address-[`++Paused++`]]
- :Unpaused: pass:normal[xref:#Pausable-Unpaused-address-[`++Unpaused++`]]
- :EnforcedPause: pass:normal[xref:#Pausable-EnforcedPause--[`++EnforcedPause++`]]
- :ExpectedPause: pass:normal[xref:#Pausable-ExpectedPause--[`++ExpectedPause++`]]
- :constructor: pass:normal[xref:#Pausable-constructor--[`++constructor++`]]
- :whenNotPaused: pass:normal[xref:#Pausable-whenNotPaused--[`++whenNotPaused++`]]
- :whenPaused: pass:normal[xref:#Pausable-whenPaused--[`++whenPaused++`]]
- :paused: pass:normal[xref:#Pausable-paused--[`++paused++`]]
- :_requireNotPaused: pass:normal[xref:#Pausable-_requireNotPaused--[`++_requireNotPaused++`]]
- :_requirePaused: pass:normal[xref:#Pausable-_requirePaused--[`++_requirePaused++`]]
- :_pause: pass:normal[xref:#Pausable-_pause--[`++_pause++`]]
- :_unpause: pass:normal[xref:#Pausable-_unpause--[`++_unpause++`]]
- [.contract]
- [[Pausable]]
- === `++Pausable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Pausable.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Pausable.sol";
- ```
- 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.
- [.contract-index]
- .Modifiers
- --
- * {xref-Pausable-whenNotPaused--}[`++whenNotPaused()++`]
- * {xref-Pausable-whenPaused--}[`++whenPaused()++`]
- --
- [.contract-index]
- .Functions
- --
- * {xref-Pausable-constructor--}[`++constructor()++`]
- * {xref-Pausable-paused--}[`++paused()++`]
- * {xref-Pausable-_requireNotPaused--}[`++_requireNotPaused()++`]
- * {xref-Pausable-_requirePaused--}[`++_requirePaused()++`]
- * {xref-Pausable-_pause--}[`++_pause()++`]
- * {xref-Pausable-_unpause--}[`++_unpause()++`]
- --
- [.contract-index]
- .Events
- --
- * {xref-Pausable-Paused-address-}[`++Paused(account)++`]
- * {xref-Pausable-Unpaused-address-}[`++Unpaused(account)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-Pausable-EnforcedPause--}[`++EnforcedPause()++`]
- * {xref-Pausable-ExpectedPause--}[`++ExpectedPause()++`]
- --
- [.contract-item]
- [[Pausable-whenNotPaused--]]
- ==== `[.contract-item-name]#++whenNotPaused++#++()++` [.item-kind]#modifier#
- Modifier to make a function callable only when the contract is not paused.
- Requirements:
- - The contract must not be paused.
- [.contract-item]
- [[Pausable-whenPaused--]]
- ==== `[.contract-item-name]#++whenPaused++#++()++` [.item-kind]#modifier#
- Modifier to make a function callable only when the contract is paused.
- Requirements:
- - The contract must be paused.
- [.contract-item]
- [[Pausable-constructor--]]
- ==== `[.contract-item-name]#++constructor++#++()++` [.item-kind]#internal#
- Initializes the contract in unpaused state.
- [.contract-item]
- [[Pausable-paused--]]
- ==== `[.contract-item-name]#++paused++#++() → bool++` [.item-kind]#public#
- Returns true if the contract is paused, and false otherwise.
- [.contract-item]
- [[Pausable-_requireNotPaused--]]
- ==== `[.contract-item-name]#++_requireNotPaused++#++()++` [.item-kind]#internal#
- Throws if the contract is paused.
- [.contract-item]
- [[Pausable-_requirePaused--]]
- ==== `[.contract-item-name]#++_requirePaused++#++()++` [.item-kind]#internal#
- Throws if the contract is not paused.
- [.contract-item]
- [[Pausable-_pause--]]
- ==== `[.contract-item-name]#++_pause++#++()++` [.item-kind]#internal#
- Triggers stopped state.
- Requirements:
- - The contract must not be paused.
- [.contract-item]
- [[Pausable-_unpause--]]
- ==== `[.contract-item-name]#++_unpause++#++()++` [.item-kind]#internal#
- Returns to normal state.
- Requirements:
- - The contract must be paused.
- [.contract-item]
- [[Pausable-Paused-address-]]
- ==== `[.contract-item-name]#++Paused++#++(address account)++` [.item-kind]#event#
- Emitted when the pause is triggered by `account`.
- [.contract-item]
- [[Pausable-Unpaused-address-]]
- ==== `[.contract-item-name]#++Unpaused++#++(address account)++` [.item-kind]#event#
- Emitted when the pause is lifted by `account`.
- [.contract-item]
- [[Pausable-EnforcedPause--]]
- ==== `[.contract-item-name]#++EnforcedPause++#++()++` [.item-kind]#error#
- The operation failed because the contract is paused.
- [.contract-item]
- [[Pausable-ExpectedPause--]]
- ==== `[.contract-item-name]#++ExpectedPause++#++()++` [.item-kind]#error#
- The operation failed because the contract is not paused.
- :InvalidAccountNonce: pass:normal[xref:#Nonces-InvalidAccountNonce-address-uint256-[`++InvalidAccountNonce++`]]
- :nonces: pass:normal[xref:#Nonces-nonces-address-[`++nonces++`]]
- :_useNonce: pass:normal[xref:#Nonces-_useNonce-address-[`++_useNonce++`]]
- :_useCheckedNonce: pass:normal[xref:#Nonces-_useCheckedNonce-address-uint256-[`++_useCheckedNonce++`]]
- [.contract]
- [[Nonces]]
- === `++Nonces++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Nonces.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Nonces.sol";
- ```
- Provides tracking nonces for addresses. Nonces will only increment.
- [.contract-index]
- .Functions
- --
- * {xref-Nonces-nonces-address-}[`++nonces(owner)++`]
- * {xref-Nonces-_useNonce-address-}[`++_useNonce(owner)++`]
- * {xref-Nonces-_useCheckedNonce-address-uint256-}[`++_useCheckedNonce(owner, nonce)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-Nonces-InvalidAccountNonce-address-uint256-}[`++InvalidAccountNonce(account, currentNonce)++`]
- --
- [.contract-item]
- [[Nonces-nonces-address-]]
- ==== `[.contract-item-name]#++nonces++#++(address owner) → uint256++` [.item-kind]#public#
- Returns the next unused nonce for an address.
- [.contract-item]
- [[Nonces-_useNonce-address-]]
- ==== `[.contract-item-name]#++_useNonce++#++(address owner) → uint256++` [.item-kind]#internal#
- Consumes a nonce.
- Returns the current value and increments nonce.
- [.contract-item]
- [[Nonces-_useCheckedNonce-address-uint256-]]
- ==== `[.contract-item-name]#++_useCheckedNonce++#++(address owner, uint256 nonce)++` [.item-kind]#internal#
- Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.
- [.contract-item]
- [[Nonces-InvalidAccountNonce-address-uint256-]]
- ==== `[.contract-item-name]#++InvalidAccountNonce++#++(address account, uint256 currentNonce)++` [.item-kind]#error#
- The nonce used for an `account` is not the expected current nonce.
- == Introspection
- This set of interfaces and contracts deal with https://en.wikipedia.org/wiki/Type_introspection[type introspection] of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_.
- Ethereum contracts have no native concept of an interface, so applications must usually simply trust they are not making an incorrect call. For trusted setups this is a non-issue, but often unknown and untrusted third-party addresses need to be interacted with. There may even not be any direct calls to them! (e.g. `ERC20` tokens may be sent to a contract that lacks a way to transfer them out of it, locking them forever). In these cases, a contract _declaring_ its interface can be very helpful in preventing errors.
- :supportsInterface: pass:normal[xref:#IERC165-supportsInterface-bytes4-[`++supportsInterface++`]]
- [.contract]
- [[IERC165]]
- === `++IERC165++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/introspection/IERC165.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
- ```
- 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}.
- [.contract-index]
- .Functions
- --
- * {xref-IERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
- --
- [.contract-item]
- [[IERC165-supportsInterface-bytes4-]]
- ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#external#
- 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.
- :supportsInterface: pass:normal[xref:#ERC165-supportsInterface-bytes4-[`++supportsInterface++`]]
- [.contract]
- [[ERC165]]
- === `++ERC165++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/introspection/ERC165.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
- ```
- 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);
- }
- ```
- [.contract-index]
- .Functions
- --
- * {xref-ERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
- [.contract-subindex-inherited]
- .IERC165
- --
- [.contract-item]
- [[ERC165-supportsInterface-bytes4-]]
- ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#public#
- See {IERC165-supportsInterface}.
- :supportsERC165: pass:normal[xref:#ERC165Checker-supportsERC165-address-[`++supportsERC165++`]]
- :supportsInterface: pass:normal[xref:#ERC165Checker-supportsInterface-address-bytes4-[`++supportsInterface++`]]
- :getSupportedInterfaces: pass:normal[xref:#ERC165Checker-getSupportedInterfaces-address-bytes4---[`++getSupportedInterfaces++`]]
- :supportsAllInterfaces: pass:normal[xref:#ERC165Checker-supportsAllInterfaces-address-bytes4---[`++supportsAllInterfaces++`]]
- :supportsERC165InterfaceUnchecked: pass:normal[xref:#ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-[`++supportsERC165InterfaceUnchecked++`]]
- [.contract]
- [[ERC165Checker]]
- === `++ERC165Checker++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/introspection/ERC165Checker.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
- ```
- Library used to query support of an interface declared via {IERC165}.
- Note that these functions return the actual result of the query: they do not
- `revert` if an interface is not supported. It is up to the caller to decide
- what to do in these cases.
- [.contract-index]
- .Functions
- --
- * {xref-ERC165Checker-supportsERC165-address-}[`++supportsERC165(account)++`]
- * {xref-ERC165Checker-supportsInterface-address-bytes4-}[`++supportsInterface(account, interfaceId)++`]
- * {xref-ERC165Checker-getSupportedInterfaces-address-bytes4---}[`++getSupportedInterfaces(account, interfaceIds)++`]
- * {xref-ERC165Checker-supportsAllInterfaces-address-bytes4---}[`++supportsAllInterfaces(account, interfaceIds)++`]
- * {xref-ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-}[`++supportsERC165InterfaceUnchecked(account, interfaceId)++`]
- --
- [.contract-item]
- [[ERC165Checker-supportsERC165-address-]]
- ==== `[.contract-item-name]#++supportsERC165++#++(address account) → bool++` [.item-kind]#internal#
- Returns true if `account` supports the {IERC165} interface.
- [.contract-item]
- [[ERC165Checker-supportsInterface-address-bytes4-]]
- ==== `[.contract-item-name]#++supportsInterface++#++(address account, bytes4 interfaceId) → bool++` [.item-kind]#internal#
- Returns true if `account` supports the interface defined by
- `interfaceId`. Support for {IERC165} itself is queried automatically.
- See {IERC165-supportsInterface}.
- [.contract-item]
- [[ERC165Checker-getSupportedInterfaces-address-bytes4---]]
- ==== `[.contract-item-name]#++getSupportedInterfaces++#++(address account, bytes4[] interfaceIds) → bool[]++` [.item-kind]#internal#
- Returns a boolean array where each value corresponds to the
- interfaces passed in and whether they're supported or not. This allows
- you to batch check interfaces for a contract where your expectation
- is that some interfaces may not be supported.
- See {IERC165-supportsInterface}.
- [.contract-item]
- [[ERC165Checker-supportsAllInterfaces-address-bytes4---]]
- ==== `[.contract-item-name]#++supportsAllInterfaces++#++(address account, bytes4[] interfaceIds) → bool++` [.item-kind]#internal#
- Returns true if `account` supports all the interfaces defined in
- `interfaceIds`. Support for {IERC165} itself is queried automatically.
- Batch-querying can lead to gas savings by skipping repeated checks for
- {IERC165} support.
- See {IERC165-supportsInterface}.
- [.contract-item]
- [[ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-]]
- ==== `[.contract-item-name]#++supportsERC165InterfaceUnchecked++#++(address account, bytes4 interfaceId) → bool++` [.item-kind]#internal#
- Assumes that account contains a contract that supports ERC165, otherwise
- the behavior of this method is undefined. This precondition can be checked
- with {supportsERC165}.
- Some precompiled contracts will falsely indicate support for a given interface, so caution
- should be exercised when using this function.
- Interface identification is specified in ERC-165.
- == Data Structures
- :BitMap: pass:normal[xref:#BitMaps-BitMap[`++BitMap++`]]
- :get: pass:normal[xref:#BitMaps-get-struct-BitMaps-BitMap-uint256-[`++get++`]]
- :setTo: pass:normal[xref:#BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-[`++setTo++`]]
- :set: pass:normal[xref:#BitMaps-set-struct-BitMaps-BitMap-uint256-[`++set++`]]
- :unset: pass:normal[xref:#BitMaps-unset-struct-BitMaps-BitMap-uint256-[`++unset++`]]
- [.contract]
- [[BitMaps]]
- === `++BitMaps++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/structs/BitMaps.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
- ```
- Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.
- Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
- BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.
- Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,
- unlike the regular `bool` which would consume an entire slot for a single value.
- This results in gas savings in two ways:
- - Setting a zero value to non-zero only once every 256 times
- - Accessing the same warm slot for every 256 _sequential_ indices
- [.contract-index]
- .Functions
- --
- * {xref-BitMaps-get-struct-BitMaps-BitMap-uint256-}[`++get(bitmap, index)++`]
- * {xref-BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-}[`++setTo(bitmap, index, value)++`]
- * {xref-BitMaps-set-struct-BitMaps-BitMap-uint256-}[`++set(bitmap, index)++`]
- * {xref-BitMaps-unset-struct-BitMaps-BitMap-uint256-}[`++unset(bitmap, index)++`]
- --
- [.contract-item]
- [[BitMaps-get-struct-BitMaps-BitMap-uint256-]]
- ==== `[.contract-item-name]#++get++#++(struct BitMaps.BitMap bitmap, uint256 index) → bool++` [.item-kind]#internal#
- Returns whether the bit at `index` is set.
- [.contract-item]
- [[BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-]]
- ==== `[.contract-item-name]#++setTo++#++(struct BitMaps.BitMap bitmap, uint256 index, bool value)++` [.item-kind]#internal#
- Sets the bit at `index` to the boolean `value`.
- [.contract-item]
- [[BitMaps-set-struct-BitMaps-BitMap-uint256-]]
- ==== `[.contract-item-name]#++set++#++(struct BitMaps.BitMap bitmap, uint256 index)++` [.item-kind]#internal#
- Sets the bit at `index`.
- [.contract-item]
- [[BitMaps-unset-struct-BitMaps-BitMap-uint256-]]
- ==== `[.contract-item-name]#++unset++#++(struct BitMaps.BitMap bitmap, uint256 index)++` [.item-kind]#internal#
- Unsets the bit at `index`.
- :EnumerableMapNonexistentKey: pass:normal[xref:#EnumerableMap-EnumerableMapNonexistentKey-bytes32-[`++EnumerableMapNonexistentKey++`]]
- :Bytes32ToBytes32Map: pass:normal[xref:#EnumerableMap-Bytes32ToBytes32Map[`++Bytes32ToBytes32Map++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-[`++keys++`]]
- :UintToUintMap: pass:normal[xref:#EnumerableMap-UintToUintMap[`++UintToUintMap++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-UintToUintMap-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-[`++keys++`]]
- :UintToAddressMap: pass:normal[xref:#EnumerableMap-UintToAddressMap[`++UintToAddressMap++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-[`++keys++`]]
- :AddressToUintMap: pass:normal[xref:#EnumerableMap-AddressToUintMap[`++AddressToUintMap++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-[`++keys++`]]
- :Bytes32ToUintMap: pass:normal[xref:#EnumerableMap-Bytes32ToUintMap[`++Bytes32ToUintMap++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-[`++keys++`]]
- [.contract]
- [[EnumerableMap]]
- === `++EnumerableMap++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/structs/EnumerableMap.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
- ```
- Library for managing an enumerable variant of Solidity's
- https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
- type.
- Maps have the following properties:
- - Entries are added, removed, and checked for existence in constant time
- (O(1)).
- - Entries are enumerated in O(n). No guarantees are made on the ordering.
- ```solidity
- contract Example {
- // Add the library methods
- using EnumerableMap for EnumerableMap.UintToAddressMap;
- // Declare a set state variable
- EnumerableMap.UintToAddressMap private myMap;
- }
- ```
- The following map types are supported:
- - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
- - `address -> uint256` (`AddressToUintMap`) since v4.6.0
- - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
- - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
- - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
- [WARNING]
- ====
- Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
- unusable.
- See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
- In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
- array of EnumerableMap.
- ====
- [.contract-index]
- .Functions
- --
- * {xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++get(map, key)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-}[`++keys(map)++`]
- * {xref-EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-UintToUintMap-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-}[`++get(map, key)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-}[`++keys(map)++`]
- * {xref-EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-}[`++get(map, key)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-}[`++keys(map)++`]
- * {xref-EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-}[`++get(map, key)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-}[`++keys(map)++`]
- * {xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++get(map, key)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-}[`++keys(map)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-EnumerableMap-EnumerableMapNonexistentKey-bytes32-}[`++EnumerableMapNonexistentKey(key)++`]
- --
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key, bytes32 value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool++` [.item-kind]#internal#
- Removes a key-value pair from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.Bytes32ToBytes32Map map) → uint256++` [.item-kind]#internal#
- Returns the number of key-value pairs in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.Bytes32ToBytes32Map map, uint256 index) → bytes32, bytes32++` [.item-kind]#internal#
- Returns the key-value pair stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of entries inside the
- array, and it may change when more entries are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool, bytes32++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bytes32++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.Bytes32ToBytes32Map map) → bytes32[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.UintToUintMap map, uint256 key, uint256 value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool++` [.item-kind]#internal#
- Removes a value from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-UintToUintMap-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.UintToUintMap map) → uint256++` [.item-kind]#internal#
- Returns the number of elements in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.UintToUintMap map, uint256 index) → uint256, uint256++` [.item-kind]#internal#
- Returns the element stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool, uint256++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → uint256++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.UintToUintMap map) → uint256[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.UintToAddressMap map, uint256 key, address value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool++` [.item-kind]#internal#
- Removes a value from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.UintToAddressMap map) → uint256++` [.item-kind]#internal#
- Returns the number of elements in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.UintToAddressMap map, uint256 index) → uint256, address++` [.item-kind]#internal#
- Returns the element stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool, address++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → address++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.UintToAddressMap map) → uint256[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.AddressToUintMap map, address key, uint256 value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool++` [.item-kind]#internal#
- Removes a value from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.AddressToUintMap map) → uint256++` [.item-kind]#internal#
- Returns the number of elements in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.AddressToUintMap map, uint256 index) → address, uint256++` [.item-kind]#internal#
- Returns the element stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool, uint256++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.AddressToUintMap map, address key) → uint256++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.AddressToUintMap map) → address[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key, uint256 value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool++` [.item-kind]#internal#
- Removes a value from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.Bytes32ToUintMap map) → uint256++` [.item-kind]#internal#
- Returns the number of elements in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.Bytes32ToUintMap map, uint256 index) → bytes32, uint256++` [.item-kind]#internal#
- Returns the element stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool, uint256++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → uint256++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.Bytes32ToUintMap map) → bytes32[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-EnumerableMapNonexistentKey-bytes32-]]
- ==== `[.contract-item-name]#++EnumerableMapNonexistentKey++#++(bytes32 key)++` [.item-kind]#error#
- Query for a nonexistent map key.
- :Set: pass:normal[xref:#EnumerableSet-Set[`++Set++`]]
- :Bytes32Set: pass:normal[xref:#EnumerableSet-Bytes32Set[`++Bytes32Set++`]]
- :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-[`++add++`]]
- :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-Bytes32Set-[`++length++`]]
- :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-[`++at++`]]
- :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-Bytes32Set-[`++values++`]]
- :AddressSet: pass:normal[xref:#EnumerableSet-AddressSet[`++AddressSet++`]]
- :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-AddressSet-address-[`++add++`]]
- :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-AddressSet-[`++length++`]]
- :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-[`++at++`]]
- :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-AddressSet-[`++values++`]]
- :UintSet: pass:normal[xref:#EnumerableSet-UintSet[`++UintSet++`]]
- :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-[`++add++`]]
- :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-UintSet-[`++length++`]]
- :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-[`++at++`]]
- :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-UintSet-[`++values++`]]
- [.contract]
- [[EnumerableSet]]
- === `++EnumerableSet++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/structs/EnumerableSet.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
- ```
- Library for managing
- https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
- types.
- Sets have the following properties:
- - Elements are added, removed, and checked for existence in constant time
- (O(1)).
- - Elements are enumerated in O(n). No guarantees are made on the ordering.
- ```solidity
- contract Example {
- // Add the library methods
- using EnumerableSet for EnumerableSet.AddressSet;
- // Declare a set state variable
- EnumerableSet.AddressSet private mySet;
- }
- ```
- As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
- and `uint256` (`UintSet`) are supported.
- [WARNING]
- ====
- Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
- unusable.
- See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
- In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
- array of EnumerableSet.
- ====
- [.contract-index]
- .Functions
- --
- * {xref-EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-}[`++add(set, value)++`]
- * {xref-EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-}[`++remove(set, value)++`]
- * {xref-EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-}[`++contains(set, value)++`]
- * {xref-EnumerableSet-length-struct-EnumerableSet-Bytes32Set-}[`++length(set)++`]
- * {xref-EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-}[`++at(set, index)++`]
- * {xref-EnumerableSet-values-struct-EnumerableSet-Bytes32Set-}[`++values(set)++`]
- * {xref-EnumerableSet-add-struct-EnumerableSet-AddressSet-address-}[`++add(set, value)++`]
- * {xref-EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-}[`++remove(set, value)++`]
- * {xref-EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-}[`++contains(set, value)++`]
- * {xref-EnumerableSet-length-struct-EnumerableSet-AddressSet-}[`++length(set)++`]
- * {xref-EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-}[`++at(set, index)++`]
- * {xref-EnumerableSet-values-struct-EnumerableSet-AddressSet-}[`++values(set)++`]
- * {xref-EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-}[`++add(set, value)++`]
- * {xref-EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-}[`++remove(set, value)++`]
- * {xref-EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-}[`++contains(set, value)++`]
- * {xref-EnumerableSet-length-struct-EnumerableSet-UintSet-}[`++length(set)++`]
- * {xref-EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-}[`++at(set, index)++`]
- * {xref-EnumerableSet-values-struct-EnumerableSet-UintSet-}[`++values(set)++`]
- --
- [.contract-item]
- [[EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-]]
- ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
- Add a value to a set. O(1).
- Returns true if the value was added to the set, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
- Removes a value from a set. O(1).
- Returns true if the value was removed from the set, that is if it was
- present.
- [.contract-item]
- [[EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
- Returns true if the value is in the set. O(1).
- [.contract-item]
- [[EnumerableSet-length-struct-EnumerableSet-Bytes32Set-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.Bytes32Set set) → uint256++` [.item-kind]#internal#
- Returns the number of values in the set. O(1).
- [.contract-item]
- [[EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.Bytes32Set set, uint256 index) → bytes32++` [.item-kind]#internal#
- Returns the value stored at position `index` in the set. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableSet-values-struct-EnumerableSet-Bytes32Set-]]
- ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.Bytes32Set set) → bytes32[]++` [.item-kind]#internal#
- Return the entire set in an array
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableSet-add-struct-EnumerableSet-AddressSet-address-]]
- ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
- Add a value to a set. O(1).
- Returns true if the value was added to the set, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
- Removes a value from a set. O(1).
- Returns true if the value was removed from the set, that is if it was
- present.
- [.contract-item]
- [[EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
- Returns true if the value is in the set. O(1).
- [.contract-item]
- [[EnumerableSet-length-struct-EnumerableSet-AddressSet-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.AddressSet set) → uint256++` [.item-kind]#internal#
- Returns the number of values in the set. O(1).
- [.contract-item]
- [[EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.AddressSet set, uint256 index) → address++` [.item-kind]#internal#
- Returns the value stored at position `index` in the set. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableSet-values-struct-EnumerableSet-AddressSet-]]
- ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.AddressSet set) → address[]++` [.item-kind]#internal#
- Return the entire set in an array
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-]]
- ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
- Add a value to a set. O(1).
- Returns true if the value was added to the set, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
- Removes a value from a set. O(1).
- Returns true if the value was removed from the set, that is if it was
- present.
- [.contract-item]
- [[EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
- Returns true if the value is in the set. O(1).
- [.contract-item]
- [[EnumerableSet-length-struct-EnumerableSet-UintSet-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.UintSet set) → uint256++` [.item-kind]#internal#
- Returns the number of values in the set. O(1).
- [.contract-item]
- [[EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.UintSet set, uint256 index) → uint256++` [.item-kind]#internal#
- Returns the value stored at position `index` in the set. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableSet-values-struct-EnumerableSet-UintSet-]]
- ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.UintSet set) → uint256[]++` [.item-kind]#internal#
- Return the entire set in an array
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- :QueueEmpty: pass:normal[xref:#DoubleEndedQueue-QueueEmpty--[`++QueueEmpty++`]]
- :QueueFull: pass:normal[xref:#DoubleEndedQueue-QueueFull--[`++QueueFull++`]]
- :QueueOutOfBounds: pass:normal[xref:#DoubleEndedQueue-QueueOutOfBounds--[`++QueueOutOfBounds++`]]
- :Bytes32Deque: pass:normal[xref:#DoubleEndedQueue-Bytes32Deque[`++Bytes32Deque++`]]
- :pushBack: pass:normal[xref:#DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-[`++pushBack++`]]
- :popBack: pass:normal[xref:#DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-[`++popBack++`]]
- :pushFront: pass:normal[xref:#DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-[`++pushFront++`]]
- :popFront: pass:normal[xref:#DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-[`++popFront++`]]
- :front: pass:normal[xref:#DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-[`++front++`]]
- :back: pass:normal[xref:#DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-[`++back++`]]
- :at: pass:normal[xref:#DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-[`++at++`]]
- :clear: pass:normal[xref:#DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-[`++clear++`]]
- :length: pass:normal[xref:#DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-[`++length++`]]
- :empty: pass:normal[xref:#DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-[`++empty++`]]
- [.contract]
- [[DoubleEndedQueue]]
- === `++DoubleEndedQueue++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/structs/DoubleEndedQueue.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/DoubleEndedQueue.sol";
- ```
- A sequence of items with the ability to efficiently push and pop items (i.e. insert and remove) on both ends of
- the sequence (called front and back). Among other access patterns, it can be used to implement efficient LIFO and
- FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that
- the existing queue contents are left in storage.
- The struct is called `Bytes32Deque`. Other types can be cast to and from `bytes32`. This data structure can only be
- used in storage, and not in memory.
- ```solidity
- DoubleEndedQueue.Bytes32Deque queue;
- ```
- [.contract-index]
- .Functions
- --
- * {xref-DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-}[`++pushBack(deque, value)++`]
- * {xref-DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-}[`++popBack(deque)++`]
- * {xref-DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-}[`++pushFront(deque, value)++`]
- * {xref-DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-}[`++popFront(deque)++`]
- * {xref-DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-}[`++front(deque)++`]
- * {xref-DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-}[`++back(deque)++`]
- * {xref-DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-}[`++at(deque, index)++`]
- * {xref-DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-}[`++clear(deque)++`]
- * {xref-DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-}[`++length(deque)++`]
- * {xref-DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-}[`++empty(deque)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-DoubleEndedQueue-QueueEmpty--}[`++QueueEmpty()++`]
- * {xref-DoubleEndedQueue-QueueFull--}[`++QueueFull()++`]
- * {xref-DoubleEndedQueue-QueueOutOfBounds--}[`++QueueOutOfBounds()++`]
- --
- [.contract-item]
- [[DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-]]
- ==== `[.contract-item-name]#++pushBack++#++(struct DoubleEndedQueue.Bytes32Deque deque, bytes32 value)++` [.item-kind]#internal#
- Inserts an item at the end of the queue.
- Reverts with {QueueFull} if the queue is full.
- [.contract-item]
- [[DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++popBack++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
- Removes the item at the end of the queue and returns it.
- Reverts with {QueueEmpty} if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-]]
- ==== `[.contract-item-name]#++pushFront++#++(struct DoubleEndedQueue.Bytes32Deque deque, bytes32 value)++` [.item-kind]#internal#
- Inserts an item at the beginning of the queue.
- Reverts with {QueueFull} if the queue is full.
- [.contract-item]
- [[DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++popFront++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
- Removes the item at the beginning of the queue and returns it.
- Reverts with `QueueEmpty` if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++front++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
- Returns the item at the beginning of the queue.
- Reverts with `QueueEmpty` if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++back++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
- Returns the item at the end of the queue.
- Reverts with `QueueEmpty` if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct DoubleEndedQueue.Bytes32Deque deque, uint256 index) → bytes32 value++` [.item-kind]#internal#
- Return the item at a position in the queue given by `index`, with the first item at 0 and last item at
- `length(deque) - 1`.
- Reverts with `QueueOutOfBounds` if the index is out of bounds.
- [.contract-item]
- [[DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++clear++#++(struct DoubleEndedQueue.Bytes32Deque deque)++` [.item-kind]#internal#
- Resets the queue back to being empty.
- NOTE: The current items are left behind in storage. This does not affect the functioning of the queue, but misses
- out on potential gas refunds.
- [.contract-item]
- [[DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++length++#++(struct DoubleEndedQueue.Bytes32Deque deque) → uint256++` [.item-kind]#internal#
- Returns the number of items in the queue.
- [.contract-item]
- [[DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++empty++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bool++` [.item-kind]#internal#
- Returns true if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-QueueEmpty--]]
- ==== `[.contract-item-name]#++QueueEmpty++#++()++` [.item-kind]#error#
- An operation (e.g. {front}) couldn't be completed due to the queue being empty.
- [.contract-item]
- [[DoubleEndedQueue-QueueFull--]]
- ==== `[.contract-item-name]#++QueueFull++#++()++` [.item-kind]#error#
- A push operation couldn't be completed due to the queue being full.
- [.contract-item]
- [[DoubleEndedQueue-QueueOutOfBounds--]]
- ==== `[.contract-item-name]#++QueueOutOfBounds++#++()++` [.item-kind]#error#
- An operation (e.g. {at}) couldn't be completed due to an index being out of bounds.
- :CheckpointUnorderedInsertion: pass:normal[xref:#Checkpoints-CheckpointUnorderedInsertion--[`++CheckpointUnorderedInsertion++`]]
- :Trace224: pass:normal[xref:#Checkpoints-Trace224[`++Trace224++`]]
- :Checkpoint224: pass:normal[xref:#Checkpoints-Checkpoint224[`++Checkpoint224++`]]
- :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-[`++push++`]]
- :lowerLookup: pass:normal[xref:#Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-[`++lowerLookup++`]]
- :upperLookup: pass:normal[xref:#Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-[`++upperLookup++`]]
- :upperLookupRecent: pass:normal[xref:#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-[`++upperLookupRecent++`]]
- :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-Trace224-[`++latest++`]]
- :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-[`++latestCheckpoint++`]]
- :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-Trace224-[`++length++`]]
- :at: pass:normal[xref:#Checkpoints-at-struct-Checkpoints-Trace224-uint32-[`++at++`]]
- :Trace208: pass:normal[xref:#Checkpoints-Trace208[`++Trace208++`]]
- :Checkpoint208: pass:normal[xref:#Checkpoints-Checkpoint208[`++Checkpoint208++`]]
- :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-[`++push++`]]
- :lowerLookup: pass:normal[xref:#Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-[`++lowerLookup++`]]
- :upperLookup: pass:normal[xref:#Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-[`++upperLookup++`]]
- :upperLookupRecent: pass:normal[xref:#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-[`++upperLookupRecent++`]]
- :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-Trace208-[`++latest++`]]
- :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-[`++latestCheckpoint++`]]
- :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-Trace208-[`++length++`]]
- :at: pass:normal[xref:#Checkpoints-at-struct-Checkpoints-Trace208-uint32-[`++at++`]]
- :Trace160: pass:normal[xref:#Checkpoints-Trace160[`++Trace160++`]]
- :Checkpoint160: pass:normal[xref:#Checkpoints-Checkpoint160[`++Checkpoint160++`]]
- :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-[`++push++`]]
- :lowerLookup: pass:normal[xref:#Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-[`++lowerLookup++`]]
- :upperLookup: pass:normal[xref:#Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-[`++upperLookup++`]]
- :upperLookupRecent: pass:normal[xref:#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-[`++upperLookupRecent++`]]
- :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-Trace160-[`++latest++`]]
- :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-[`++latestCheckpoint++`]]
- :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-Trace160-[`++length++`]]
- :at: pass:normal[xref:#Checkpoints-at-struct-Checkpoints-Trace160-uint32-[`++at++`]]
- [.contract]
- [[Checkpoints]]
- === `++Checkpoints++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/structs/Checkpoints.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/Checkpoints.sol";
- ```
- This library defines the `Trace*` struct, for checkpointing values as they change at different points in
- time, and later looking up past values by block number. See {Votes} as an example.
- To create a history of checkpoints define a variable type `Checkpoints.Trace*` in your contract, and store a new
- checkpoint for the current transaction block using the {push} function.
- [.contract-index]
- .Functions
- --
- * {xref-Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-}[`++push(self, key, value)++`]
- * {xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-}[`++lowerLookup(self, key)++`]
- * {xref-Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-}[`++upperLookup(self, key)++`]
- * {xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-}[`++upperLookupRecent(self, key)++`]
- * {xref-Checkpoints-latest-struct-Checkpoints-Trace224-}[`++latest(self)++`]
- * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-}[`++latestCheckpoint(self)++`]
- * {xref-Checkpoints-length-struct-Checkpoints-Trace224-}[`++length(self)++`]
- * {xref-Checkpoints-at-struct-Checkpoints-Trace224-uint32-}[`++at(self, pos)++`]
- * {xref-Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-}[`++push(self, key, value)++`]
- * {xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-}[`++lowerLookup(self, key)++`]
- * {xref-Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-}[`++upperLookup(self, key)++`]
- * {xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-}[`++upperLookupRecent(self, key)++`]
- * {xref-Checkpoints-latest-struct-Checkpoints-Trace208-}[`++latest(self)++`]
- * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-}[`++latestCheckpoint(self)++`]
- * {xref-Checkpoints-length-struct-Checkpoints-Trace208-}[`++length(self)++`]
- * {xref-Checkpoints-at-struct-Checkpoints-Trace208-uint32-}[`++at(self, pos)++`]
- * {xref-Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-}[`++push(self, key, value)++`]
- * {xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-}[`++lowerLookup(self, key)++`]
- * {xref-Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-}[`++upperLookup(self, key)++`]
- * {xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-}[`++upperLookupRecent(self, key)++`]
- * {xref-Checkpoints-latest-struct-Checkpoints-Trace160-}[`++latest(self)++`]
- * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-}[`++latestCheckpoint(self)++`]
- * {xref-Checkpoints-length-struct-Checkpoints-Trace160-}[`++length(self)++`]
- * {xref-Checkpoints-at-struct-Checkpoints-Trace160-uint32-}[`++at(self, pos)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-Checkpoints-CheckpointUnorderedInsertion--}[`++CheckpointUnorderedInsertion()++`]
- --
- [.contract-item]
- [[Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-]]
- ==== `[.contract-item-name]#++push++#++(struct Checkpoints.Trace224 self, uint32 key, uint224 value) → uint224, uint224++` [.item-kind]#internal#
- Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.
- Returns previous value and new value.
- IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint32).max` key set will disable the
- library.
- [.contract-item]
- [[Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-]]
- ==== `[.contract-item-name]#++lowerLookup++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
- Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
- there is none.
- [.contract-item]
- [[Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-]]
- ==== `[.contract-item-name]#++upperLookup++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
- if there is none.
- [.contract-item]
- [[Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-]]
- ==== `[.contract-item-name]#++upperLookupRecent++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
- if there is none.
- NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high
- keys).
- [.contract-item]
- [[Checkpoints-latest-struct-Checkpoints-Trace224-]]
- ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.Trace224 self) → uint224++` [.item-kind]#internal#
- Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
- [.contract-item]
- [[Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-]]
- ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.Trace224 self) → bool exists, uint32 _key, uint224 _value++` [.item-kind]#internal#
- Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
- in the most recent checkpoint.
- [.contract-item]
- [[Checkpoints-length-struct-Checkpoints-Trace224-]]
- ==== `[.contract-item-name]#++length++#++(struct Checkpoints.Trace224 self) → uint256++` [.item-kind]#internal#
- Returns the number of checkpoint.
- [.contract-item]
- [[Checkpoints-at-struct-Checkpoints-Trace224-uint32-]]
- ==== `[.contract-item-name]#++at++#++(struct Checkpoints.Trace224 self, uint32 pos) → struct Checkpoints.Checkpoint224++` [.item-kind]#internal#
- Returns checkpoint at given position.
- [.contract-item]
- [[Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-]]
- ==== `[.contract-item-name]#++push++#++(struct Checkpoints.Trace208 self, uint48 key, uint208 value) → uint208, uint208++` [.item-kind]#internal#
- Pushes a (`key`, `value`) pair into a Trace208 so that it is stored as the checkpoint.
- Returns previous value and new value.
- IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint48).max` key set will disable the
- library.
- [.contract-item]
- [[Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-]]
- ==== `[.contract-item-name]#++lowerLookup++#++(struct Checkpoints.Trace208 self, uint48 key) → uint208++` [.item-kind]#internal#
- Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
- there is none.
- [.contract-item]
- [[Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-]]
- ==== `[.contract-item-name]#++upperLookup++#++(struct Checkpoints.Trace208 self, uint48 key) → uint208++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
- if there is none.
- [.contract-item]
- [[Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-]]
- ==== `[.contract-item-name]#++upperLookupRecent++#++(struct Checkpoints.Trace208 self, uint48 key) → uint208++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
- if there is none.
- NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high
- keys).
- [.contract-item]
- [[Checkpoints-latest-struct-Checkpoints-Trace208-]]
- ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.Trace208 self) → uint208++` [.item-kind]#internal#
- Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
- [.contract-item]
- [[Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-]]
- ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.Trace208 self) → bool exists, uint48 _key, uint208 _value++` [.item-kind]#internal#
- Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
- in the most recent checkpoint.
- [.contract-item]
- [[Checkpoints-length-struct-Checkpoints-Trace208-]]
- ==== `[.contract-item-name]#++length++#++(struct Checkpoints.Trace208 self) → uint256++` [.item-kind]#internal#
- Returns the number of checkpoint.
- [.contract-item]
- [[Checkpoints-at-struct-Checkpoints-Trace208-uint32-]]
- ==== `[.contract-item-name]#++at++#++(struct Checkpoints.Trace208 self, uint32 pos) → struct Checkpoints.Checkpoint208++` [.item-kind]#internal#
- Returns checkpoint at given position.
- [.contract-item]
- [[Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-]]
- ==== `[.contract-item-name]#++push++#++(struct Checkpoints.Trace160 self, uint96 key, uint160 value) → uint160, uint160++` [.item-kind]#internal#
- Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.
- Returns previous value and new value.
- IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint96).max` key set will disable the
- library.
- [.contract-item]
- [[Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-]]
- ==== `[.contract-item-name]#++lowerLookup++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
- Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
- there is none.
- [.contract-item]
- [[Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-]]
- ==== `[.contract-item-name]#++upperLookup++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
- if there is none.
- [.contract-item]
- [[Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-]]
- ==== `[.contract-item-name]#++upperLookupRecent++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
- if there is none.
- NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high
- keys).
- [.contract-item]
- [[Checkpoints-latest-struct-Checkpoints-Trace160-]]
- ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.Trace160 self) → uint160++` [.item-kind]#internal#
- Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
- [.contract-item]
- [[Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-]]
- ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.Trace160 self) → bool exists, uint96 _key, uint160 _value++` [.item-kind]#internal#
- Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
- in the most recent checkpoint.
- [.contract-item]
- [[Checkpoints-length-struct-Checkpoints-Trace160-]]
- ==== `[.contract-item-name]#++length++#++(struct Checkpoints.Trace160 self) → uint256++` [.item-kind]#internal#
- Returns the number of checkpoint.
- [.contract-item]
- [[Checkpoints-at-struct-Checkpoints-Trace160-uint32-]]
- ==== `[.contract-item-name]#++at++#++(struct Checkpoints.Trace160 self, uint32 pos) → struct Checkpoints.Checkpoint160++` [.item-kind]#internal#
- Returns checkpoint at given position.
- [.contract-item]
- [[Checkpoints-CheckpointUnorderedInsertion--]]
- ==== `[.contract-item-name]#++CheckpointUnorderedInsertion++#++()++` [.item-kind]#error#
- A value was attempted to be inserted on a past checkpoint.
- == Libraries
- :Create2InsufficientBalance: pass:normal[xref:#Create2-Create2InsufficientBalance-uint256-uint256-[`++Create2InsufficientBalance++`]]
- :Create2EmptyBytecode: pass:normal[xref:#Create2-Create2EmptyBytecode--[`++Create2EmptyBytecode++`]]
- :Create2FailedDeployment: pass:normal[xref:#Create2-Create2FailedDeployment--[`++Create2FailedDeployment++`]]
- :deploy: pass:normal[xref:#Create2-deploy-uint256-bytes32-bytes-[`++deploy++`]]
- :computeAddress: pass:normal[xref:#Create2-computeAddress-bytes32-bytes32-[`++computeAddress++`]]
- :computeAddress: pass:normal[xref:#Create2-computeAddress-bytes32-bytes32-address-[`++computeAddress++`]]
- [.contract]
- [[Create2]]
- === `++Create2++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Create2.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Create2.sol";
- ```
- Helper to make usage of the `CREATE2` EVM opcode easier and safer.
- `CREATE2` can be used to compute in advance the address where a smart
- contract will be deployed, which allows for interesting new mechanisms known
- as 'counterfactual interactions'.
- See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
- information.
- [.contract-index]
- .Functions
- --
- * {xref-Create2-deploy-uint256-bytes32-bytes-}[`++deploy(amount, salt, bytecode)++`]
- * {xref-Create2-computeAddress-bytes32-bytes32-}[`++computeAddress(salt, bytecodeHash)++`]
- * {xref-Create2-computeAddress-bytes32-bytes32-address-}[`++computeAddress(salt, bytecodeHash, deployer)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-Create2-Create2InsufficientBalance-uint256-uint256-}[`++Create2InsufficientBalance(balance, needed)++`]
- * {xref-Create2-Create2EmptyBytecode--}[`++Create2EmptyBytecode()++`]
- * {xref-Create2-Create2FailedDeployment--}[`++Create2FailedDeployment()++`]
- --
- [.contract-item]
- [[Create2-deploy-uint256-bytes32-bytes-]]
- ==== `[.contract-item-name]#++deploy++#++(uint256 amount, bytes32 salt, bytes bytecode) → address addr++` [.item-kind]#internal#
- Deploys a contract using `CREATE2`. The address where the contract
- will be deployed can be known in advance via {computeAddress}.
- The bytecode for a contract can be obtained from Solidity with
- `type(contractName).creationCode`.
- Requirements:
- - `bytecode` must not be empty.
- - `salt` must have not been used for `bytecode` already.
- - the factory must have a balance of at least `amount`.
- - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
- [.contract-item]
- [[Create2-computeAddress-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++computeAddress++#++(bytes32 salt, bytes32 bytecodeHash) → address++` [.item-kind]#internal#
- Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
- `bytecodeHash` or `salt` will result in a new destination address.
- [.contract-item]
- [[Create2-computeAddress-bytes32-bytes32-address-]]
- ==== `[.contract-item-name]#++computeAddress++#++(bytes32 salt, bytes32 bytecodeHash, address deployer) → address addr++` [.item-kind]#internal#
- Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
- `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
- [.contract-item]
- [[Create2-Create2InsufficientBalance-uint256-uint256-]]
- ==== `[.contract-item-name]#++Create2InsufficientBalance++#++(uint256 balance, uint256 needed)++` [.item-kind]#error#
- Not enough balance for performing a CREATE2 deploy.
- [.contract-item]
- [[Create2-Create2EmptyBytecode--]]
- ==== `[.contract-item-name]#++Create2EmptyBytecode++#++()++` [.item-kind]#error#
- There's no code to deploy.
- [.contract-item]
- [[Create2-Create2FailedDeployment--]]
- ==== `[.contract-item-name]#++Create2FailedDeployment++#++()++` [.item-kind]#error#
- The deployment failed.
- :AddressInsufficientBalance: pass:normal[xref:#Address-AddressInsufficientBalance-address-[`++AddressInsufficientBalance++`]]
- :AddressEmptyCode: pass:normal[xref:#Address-AddressEmptyCode-address-[`++AddressEmptyCode++`]]
- :FailedInnerCall: pass:normal[xref:#Address-FailedInnerCall--[`++FailedInnerCall++`]]
- :sendValue: pass:normal[xref:#Address-sendValue-address-payable-uint256-[`++sendValue++`]]
- :functionCall: pass:normal[xref:#Address-functionCall-address-bytes-[`++functionCall++`]]
- :functionCallWithValue: pass:normal[xref:#Address-functionCallWithValue-address-bytes-uint256-[`++functionCallWithValue++`]]
- :functionStaticCall: pass:normal[xref:#Address-functionStaticCall-address-bytes-[`++functionStaticCall++`]]
- :functionDelegateCall: pass:normal[xref:#Address-functionDelegateCall-address-bytes-[`++functionDelegateCall++`]]
- :verifyCallResultFromTarget: pass:normal[xref:#Address-verifyCallResultFromTarget-address-bool-bytes-[`++verifyCallResultFromTarget++`]]
- :verifyCallResult: pass:normal[xref:#Address-verifyCallResult-bool-bytes-[`++verifyCallResult++`]]
- [.contract]
- [[Address]]
- === `++Address++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Address.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Address.sol";
- ```
- Collection of functions related to the address type
- [.contract-index]
- .Functions
- --
- * {xref-Address-sendValue-address-payable-uint256-}[`++sendValue(recipient, amount)++`]
- * {xref-Address-functionCall-address-bytes-}[`++functionCall(target, data)++`]
- * {xref-Address-functionCallWithValue-address-bytes-uint256-}[`++functionCallWithValue(target, data, value)++`]
- * {xref-Address-functionStaticCall-address-bytes-}[`++functionStaticCall(target, data)++`]
- * {xref-Address-functionDelegateCall-address-bytes-}[`++functionDelegateCall(target, data)++`]
- * {xref-Address-verifyCallResultFromTarget-address-bool-bytes-}[`++verifyCallResultFromTarget(target, success, returndata)++`]
- * {xref-Address-verifyCallResult-bool-bytes-}[`++verifyCallResult(success, returndata)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-Address-AddressInsufficientBalance-address-}[`++AddressInsufficientBalance(account)++`]
- * {xref-Address-AddressEmptyCode-address-}[`++AddressEmptyCode(target)++`]
- * {xref-Address-FailedInnerCall--}[`++FailedInnerCall()++`]
- --
- [.contract-item]
- [[Address-sendValue-address-payable-uint256-]]
- ==== `[.contract-item-name]#++sendValue++#++(address payable recipient, uint256 amount)++` [.item-kind]#internal#
- 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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
- [.contract-item]
- [[Address-functionCall-address-bytes-]]
- ==== `[.contract-item-name]#++functionCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
- 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 or custom error, it is bubbled
- up by this function (like regular Solidity function calls). However, if
- the call reverted with no returned reason, this function reverts with a
- {FailedInnerCall} error.
- 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.
- [.contract-item]
- [[Address-functionCallWithValue-address-bytes-uint256-]]
- ==== `[.contract-item-name]#++functionCallWithValue++#++(address target, bytes data, uint256 value) → bytes++` [.item-kind]#internal#
- 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`.
- [.contract-item]
- [[Address-functionStaticCall-address-bytes-]]
- ==== `[.contract-item-name]#++functionStaticCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
- but performing a static call.
- [.contract-item]
- [[Address-functionDelegateCall-address-bytes-]]
- ==== `[.contract-item-name]#++functionDelegateCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
- but performing a delegate call.
- [.contract-item]
- [[Address-verifyCallResultFromTarget-address-bool-bytes-]]
- ==== `[.contract-item-name]#++verifyCallResultFromTarget++#++(address target, bool success, bytes returndata) → bytes++` [.item-kind]#internal#
- Tool to verify that a low level call to smart-contract was successful, and reverts if the target
- was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
- unsuccessful call.
- [.contract-item]
- [[Address-verifyCallResult-bool-bytes-]]
- ==== `[.contract-item-name]#++verifyCallResult++#++(bool success, bytes returndata) → bytes++` [.item-kind]#internal#
- Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
- revert reason or with a default {FailedInnerCall} error.
- [.contract-item]
- [[Address-AddressInsufficientBalance-address-]]
- ==== `[.contract-item-name]#++AddressInsufficientBalance++#++(address account)++` [.item-kind]#error#
- The ETH balance of the account is not enough to perform the operation.
- [.contract-item]
- [[Address-AddressEmptyCode-address-]]
- ==== `[.contract-item-name]#++AddressEmptyCode++#++(address target)++` [.item-kind]#error#
- There's no code at `target` (it is not a contract).
- [.contract-item]
- [[Address-FailedInnerCall--]]
- ==== `[.contract-item-name]#++FailedInnerCall++#++()++` [.item-kind]#error#
- A call to an address target failed. The target may have reverted.
- :findUpperBound: pass:normal[xref:#Arrays-findUpperBound-uint256---uint256-[`++findUpperBound++`]]
- :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-address---uint256-[`++unsafeAccess++`]]
- :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-bytes32---uint256-[`++unsafeAccess++`]]
- :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-uint256---uint256-[`++unsafeAccess++`]]
- :unsafeMemoryAccess: pass:normal[xref:#Arrays-unsafeMemoryAccess-uint256---uint256-[`++unsafeMemoryAccess++`]]
- :unsafeMemoryAccess: pass:normal[xref:#Arrays-unsafeMemoryAccess-address---uint256-[`++unsafeMemoryAccess++`]]
- [.contract]
- [[Arrays]]
- === `++Arrays++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Arrays.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Arrays.sol";
- ```
- Collection of functions related to array types.
- [.contract-index]
- .Functions
- --
- * {xref-Arrays-findUpperBound-uint256---uint256-}[`++findUpperBound(array, element)++`]
- * {xref-Arrays-unsafeAccess-address---uint256-}[`++unsafeAccess(arr, pos)++`]
- * {xref-Arrays-unsafeAccess-bytes32---uint256-}[`++unsafeAccess(arr, pos)++`]
- * {xref-Arrays-unsafeAccess-uint256---uint256-}[`++unsafeAccess(arr, pos)++`]
- * {xref-Arrays-unsafeMemoryAccess-uint256---uint256-}[`++unsafeMemoryAccess(arr, pos)++`]
- * {xref-Arrays-unsafeMemoryAccess-address---uint256-}[`++unsafeMemoryAccess(arr, pos)++`]
- --
- [.contract-item]
- [[Arrays-findUpperBound-uint256---uint256-]]
- ==== `[.contract-item-name]#++findUpperBound++#++(uint256[] array, uint256 element) → uint256++` [.item-kind]#internal#
- Searches a sorted `array` and returns the first index that contains
- a value greater or equal to `element`. If no such index exists (i.e. all
- values in the array are strictly less than `element`), the array length is
- returned. Time complexity O(log n).
- `array` is expected to be sorted in ascending order, and to contain no
- repeated elements.
- [.contract-item]
- [[Arrays-unsafeAccess-address---uint256-]]
- ==== `[.contract-item-name]#++unsafeAccess++#++(address[] arr, uint256 pos) → struct StorageSlot.AddressSlot++` [.item-kind]#internal#
- Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
- WARNING: Only use if you are certain `pos` is lower than the array length.
- [.contract-item]
- [[Arrays-unsafeAccess-bytes32---uint256-]]
- ==== `[.contract-item-name]#++unsafeAccess++#++(bytes32[] arr, uint256 pos) → struct StorageSlot.Bytes32Slot++` [.item-kind]#internal#
- Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
- WARNING: Only use if you are certain `pos` is lower than the array length.
- [.contract-item]
- [[Arrays-unsafeAccess-uint256---uint256-]]
- ==== `[.contract-item-name]#++unsafeAccess++#++(uint256[] arr, uint256 pos) → struct StorageSlot.Uint256Slot++` [.item-kind]#internal#
- Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
- WARNING: Only use if you are certain `pos` is lower than the array length.
- [.contract-item]
- [[Arrays-unsafeMemoryAccess-uint256---uint256-]]
- ==== `[.contract-item-name]#++unsafeMemoryAccess++#++(uint256[] arr, uint256 pos) → uint256 res++` [.item-kind]#internal#
- Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
- WARNING: Only use if you are certain `pos` is lower than the array length.
- [.contract-item]
- [[Arrays-unsafeMemoryAccess-address---uint256-]]
- ==== `[.contract-item-name]#++unsafeMemoryAccess++#++(address[] arr, uint256 pos) → address res++` [.item-kind]#internal#
- Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
- WARNING: Only use if you are certain `pos` is lower than the array length.
- :_TABLE: pass:normal[xref:#Base64-_TABLE-string[`++_TABLE++`]]
- :encode: pass:normal[xref:#Base64-encode-bytes-[`++encode++`]]
- [.contract]
- [[Base64]]
- === `++Base64++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Base64.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Base64.sol";
- ```
- Provides a set of functions to operate with Base64 strings.
- [.contract-index]
- .Functions
- --
- * {xref-Base64-encode-bytes-}[`++encode(data)++`]
- --
- [.contract-item]
- [[Base64-encode-bytes-]]
- ==== `[.contract-item-name]#++encode++#++(bytes data) → string++` [.item-kind]#internal#
- Converts a `bytes` to its Bytes64 `string` representation.
- :StringsInsufficientHexLength: pass:normal[xref:#Strings-StringsInsufficientHexLength-uint256-uint256-[`++StringsInsufficientHexLength++`]]
- :toString: pass:normal[xref:#Strings-toString-uint256-[`++toString++`]]
- :toStringSigned: pass:normal[xref:#Strings-toStringSigned-int256-[`++toStringSigned++`]]
- :toHexString: pass:normal[xref:#Strings-toHexString-uint256-[`++toHexString++`]]
- :toHexString: pass:normal[xref:#Strings-toHexString-uint256-uint256-[`++toHexString++`]]
- :toHexString: pass:normal[xref:#Strings-toHexString-address-[`++toHexString++`]]
- :equal: pass:normal[xref:#Strings-equal-string-string-[`++equal++`]]
- [.contract]
- [[Strings]]
- === `++Strings++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Strings.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Strings.sol";
- ```
- String operations.
- [.contract-index]
- .Functions
- --
- * {xref-Strings-toString-uint256-}[`++toString(value)++`]
- * {xref-Strings-toStringSigned-int256-}[`++toStringSigned(value)++`]
- * {xref-Strings-toHexString-uint256-}[`++toHexString(value)++`]
- * {xref-Strings-toHexString-uint256-uint256-}[`++toHexString(value, length)++`]
- * {xref-Strings-toHexString-address-}[`++toHexString(addr)++`]
- * {xref-Strings-equal-string-string-}[`++equal(a, b)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-Strings-StringsInsufficientHexLength-uint256-uint256-}[`++StringsInsufficientHexLength(value, length)++`]
- --
- [.contract-item]
- [[Strings-toString-uint256-]]
- ==== `[.contract-item-name]#++toString++#++(uint256 value) → string++` [.item-kind]#internal#
- Converts a `uint256` to its ASCII `string` decimal representation.
- [.contract-item]
- [[Strings-toStringSigned-int256-]]
- ==== `[.contract-item-name]#++toStringSigned++#++(int256 value) → string++` [.item-kind]#internal#
- Converts a `int256` to its ASCII `string` decimal representation.
- [.contract-item]
- [[Strings-toHexString-uint256-]]
- ==== `[.contract-item-name]#++toHexString++#++(uint256 value) → string++` [.item-kind]#internal#
- Converts a `uint256` to its ASCII `string` hexadecimal representation.
- [.contract-item]
- [[Strings-toHexString-uint256-uint256-]]
- ==== `[.contract-item-name]#++toHexString++#++(uint256 value, uint256 length) → string++` [.item-kind]#internal#
- Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
- [.contract-item]
- [[Strings-toHexString-address-]]
- ==== `[.contract-item-name]#++toHexString++#++(address addr) → string++` [.item-kind]#internal#
- Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
- representation.
- [.contract-item]
- [[Strings-equal-string-string-]]
- ==== `[.contract-item-name]#++equal++#++(string a, string b) → bool++` [.item-kind]#internal#
- Returns true if the two strings are equal.
- [.contract-item]
- [[Strings-StringsInsufficientHexLength-uint256-uint256-]]
- ==== `[.contract-item-name]#++StringsInsufficientHexLength++#++(uint256 value, uint256 length)++` [.item-kind]#error#
- The `value` string doesn't fit in the specified `length`.
- :StringTooLong: pass:normal[xref:#ShortStrings-StringTooLong-string-[`++StringTooLong++`]]
- :InvalidShortString: pass:normal[xref:#ShortStrings-InvalidShortString--[`++InvalidShortString++`]]
- :toShortString: pass:normal[xref:#ShortStrings-toShortString-string-[`++toShortString++`]]
- :toString: pass:normal[xref:#ShortStrings-toString-ShortString-[`++toString++`]]
- :byteLength: pass:normal[xref:#ShortStrings-byteLength-ShortString-[`++byteLength++`]]
- :toShortStringWithFallback: pass:normal[xref:#ShortStrings-toShortStringWithFallback-string-string-[`++toShortStringWithFallback++`]]
- :toStringWithFallback: pass:normal[xref:#ShortStrings-toStringWithFallback-ShortString-string-[`++toStringWithFallback++`]]
- :byteLengthWithFallback: pass:normal[xref:#ShortStrings-byteLengthWithFallback-ShortString-string-[`++byteLengthWithFallback++`]]
- [.contract]
- [[ShortStrings]]
- === `++ShortStrings++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/ShortStrings.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/ShortStrings.sol";
- ```
- This library provides functions to convert short memory strings
- into a `ShortString` type that can be used as an immutable variable.
- Strings of arbitrary length can be optimized using this library if
- they are short enough (up to 31 bytes) by packing them with their
- length (1 byte) in a single EVM word (32 bytes). Additionally, a
- fallback mechanism can be used for every other case.
- Usage example:
- ```solidity
- contract Named {
- using ShortStrings for *;
- ShortString private immutable _name;
- string private _nameFallback;
- constructor(string memory contractName) {
- _name = contractName.toShortStringWithFallback(_nameFallback);
- }
- function name() external view returns (string memory) {
- return _name.toStringWithFallback(_nameFallback);
- }
- }
- ```
- [.contract-index]
- .Functions
- --
- * {xref-ShortStrings-toShortString-string-}[`++toShortString(str)++`]
- * {xref-ShortStrings-toString-ShortString-}[`++toString(sstr)++`]
- * {xref-ShortStrings-byteLength-ShortString-}[`++byteLength(sstr)++`]
- * {xref-ShortStrings-toShortStringWithFallback-string-string-}[`++toShortStringWithFallback(value, store)++`]
- * {xref-ShortStrings-toStringWithFallback-ShortString-string-}[`++toStringWithFallback(value, store)++`]
- * {xref-ShortStrings-byteLengthWithFallback-ShortString-string-}[`++byteLengthWithFallback(value, store)++`]
- --
- [.contract-index]
- .Errors
- --
- * {xref-ShortStrings-StringTooLong-string-}[`++StringTooLong(str)++`]
- * {xref-ShortStrings-InvalidShortString--}[`++InvalidShortString()++`]
- --
- [.contract-item]
- [[ShortStrings-toShortString-string-]]
- ==== `[.contract-item-name]#++toShortString++#++(string str) → ShortString++` [.item-kind]#internal#
- Encode a string of at most 31 chars into a `ShortString`.
- This will trigger a `StringTooLong` error is the input string is too long.
- [.contract-item]
- [[ShortStrings-toString-ShortString-]]
- ==== `[.contract-item-name]#++toString++#++(ShortString sstr) → string++` [.item-kind]#internal#
- Decode a `ShortString` back to a "normal" string.
- [.contract-item]
- [[ShortStrings-byteLength-ShortString-]]
- ==== `[.contract-item-name]#++byteLength++#++(ShortString sstr) → uint256++` [.item-kind]#internal#
- Return the length of a `ShortString`.
- [.contract-item]
- [[ShortStrings-toShortStringWithFallback-string-string-]]
- ==== `[.contract-item-name]#++toShortStringWithFallback++#++(string value, string store) → ShortString++` [.item-kind]#internal#
- Encode a string into a `ShortString`, or write it to storage if it is too long.
- [.contract-item]
- [[ShortStrings-toStringWithFallback-ShortString-string-]]
- ==== `[.contract-item-name]#++toStringWithFallback++#++(ShortString value, string store) → string++` [.item-kind]#internal#
- Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
- [.contract-item]
- [[ShortStrings-byteLengthWithFallback-ShortString-string-]]
- ==== `[.contract-item-name]#++byteLengthWithFallback++#++(ShortString value, string store) → uint256++` [.item-kind]#internal#
- Return the length of a string that was encoded to `ShortString` or written to storage using
- {setWithFallback}.
- WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
- actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
- [.contract-item]
- [[ShortStrings-StringTooLong-string-]]
- ==== `[.contract-item-name]#++StringTooLong++#++(string str)++` [.item-kind]#error#
- [.contract-item]
- [[ShortStrings-InvalidShortString--]]
- ==== `[.contract-item-name]#++InvalidShortString++#++()++` [.item-kind]#error#
- :AddressSlot: pass:normal[xref:#StorageSlot-AddressSlot[`++AddressSlot++`]]
- :BooleanSlot: pass:normal[xref:#StorageSlot-BooleanSlot[`++BooleanSlot++`]]
- :Bytes32Slot: pass:normal[xref:#StorageSlot-Bytes32Slot[`++Bytes32Slot++`]]
- :Uint256Slot: pass:normal[xref:#StorageSlot-Uint256Slot[`++Uint256Slot++`]]
- :StringSlot: pass:normal[xref:#StorageSlot-StringSlot[`++StringSlot++`]]
- :BytesSlot: pass:normal[xref:#StorageSlot-BytesSlot[`++BytesSlot++`]]
- :getAddressSlot: pass:normal[xref:#StorageSlot-getAddressSlot-bytes32-[`++getAddressSlot++`]]
- :getBooleanSlot: pass:normal[xref:#StorageSlot-getBooleanSlot-bytes32-[`++getBooleanSlot++`]]
- :getBytes32Slot: pass:normal[xref:#StorageSlot-getBytes32Slot-bytes32-[`++getBytes32Slot++`]]
- :getUint256Slot: pass:normal[xref:#StorageSlot-getUint256Slot-bytes32-[`++getUint256Slot++`]]
- :getStringSlot: pass:normal[xref:#StorageSlot-getStringSlot-bytes32-[`++getStringSlot++`]]
- :getStringSlot: pass:normal[xref:#StorageSlot-getStringSlot-string-[`++getStringSlot++`]]
- :getBytesSlot: pass:normal[xref:#StorageSlot-getBytesSlot-bytes32-[`++getBytesSlot++`]]
- :getBytesSlot: pass:normal[xref:#StorageSlot-getBytesSlot-bytes-[`++getBytesSlot++`]]
- [.contract]
- [[StorageSlot]]
- === `++StorageSlot++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/StorageSlot.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/StorageSlot.sol";
- ```
- Library for reading and writing primitive types to specific storage slots.
- Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
- This library helps with reading and writing to such slots without the need for inline assembly.
- The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
- Example usage to set ERC1967 implementation slot:
- ```solidity
- contract ERC1967 {
- bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
- function _getImplementation() internal view returns (address) {
- return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
- }
- function _setImplementation(address newImplementation) internal {
- require(newImplementation.code.length > 0);
- StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
- }
- }
- ```
- [.contract-index]
- .Functions
- --
- * {xref-StorageSlot-getAddressSlot-bytes32-}[`++getAddressSlot(slot)++`]
- * {xref-StorageSlot-getBooleanSlot-bytes32-}[`++getBooleanSlot(slot)++`]
- * {xref-StorageSlot-getBytes32Slot-bytes32-}[`++getBytes32Slot(slot)++`]
- * {xref-StorageSlot-getUint256Slot-bytes32-}[`++getUint256Slot(slot)++`]
- * {xref-StorageSlot-getStringSlot-bytes32-}[`++getStringSlot(slot)++`]
- * {xref-StorageSlot-getStringSlot-string-}[`++getStringSlot(store)++`]
- * {xref-StorageSlot-getBytesSlot-bytes32-}[`++getBytesSlot(slot)++`]
- * {xref-StorageSlot-getBytesSlot-bytes-}[`++getBytesSlot(store)++`]
- --
- [.contract-item]
- [[StorageSlot-getAddressSlot-bytes32-]]
- ==== `[.contract-item-name]#++getAddressSlot++#++(bytes32 slot) → struct StorageSlot.AddressSlot r++` [.item-kind]#internal#
- Returns an `AddressSlot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getBooleanSlot-bytes32-]]
- ==== `[.contract-item-name]#++getBooleanSlot++#++(bytes32 slot) → struct StorageSlot.BooleanSlot r++` [.item-kind]#internal#
- Returns an `BooleanSlot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getBytes32Slot-bytes32-]]
- ==== `[.contract-item-name]#++getBytes32Slot++#++(bytes32 slot) → struct StorageSlot.Bytes32Slot r++` [.item-kind]#internal#
- Returns an `Bytes32Slot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getUint256Slot-bytes32-]]
- ==== `[.contract-item-name]#++getUint256Slot++#++(bytes32 slot) → struct StorageSlot.Uint256Slot r++` [.item-kind]#internal#
- Returns an `Uint256Slot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getStringSlot-bytes32-]]
- ==== `[.contract-item-name]#++getStringSlot++#++(bytes32 slot) → struct StorageSlot.StringSlot r++` [.item-kind]#internal#
- Returns an `StringSlot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getStringSlot-string-]]
- ==== `[.contract-item-name]#++getStringSlot++#++(string store) → struct StorageSlot.StringSlot r++` [.item-kind]#internal#
- Returns an `StringSlot` representation of the string storage pointer `store`.
- [.contract-item]
- [[StorageSlot-getBytesSlot-bytes32-]]
- ==== `[.contract-item-name]#++getBytesSlot++#++(bytes32 slot) → struct StorageSlot.BytesSlot r++` [.item-kind]#internal#
- Returns an `BytesSlot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getBytesSlot-bytes-]]
- ==== `[.contract-item-name]#++getBytesSlot++#++(bytes store) → struct StorageSlot.BytesSlot r++` [.item-kind]#internal#
- Returns an `BytesSlot` representation of the bytes storage pointer `store`.
- :multicall: pass:normal[xref:#Multicall-multicall-bytes---[`++multicall++`]]
- [.contract]
- [[Multicall]]
- === `++Multicall++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Multicall.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Multicall.sol";
- ```
- Provides a function to batch together multiple calls in a single external call.
- Consider any assumption about calldata validation performed by the sender may be violated if it's not especially
- careful about sending transactions invoking {multicall}. For example, a relay address that filters function
- selectors won't filter calls nested within a {multicall} operation.
- NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}).
- If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data`
- to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of
- {_msgSender} are not propagated to subcalls.
- [.contract-index]
- .Functions
- --
- * {xref-Multicall-multicall-bytes---}[`++multicall(data)++`]
- --
- [.contract-item]
- [[Multicall-multicall-bytes---]]
- ==== `[.contract-item-name]#++multicall++#++(bytes[] data) → bytes[] results++` [.item-kind]#external#
- Receives and executes a batch of function calls on this contract.
- :_msgSender: pass:normal[xref:#Context-_msgSender--[`++_msgSender++`]]
- :_msgData: pass:normal[xref:#Context-_msgData--[`++_msgData++`]]
- :_contextSuffixLength: pass:normal[xref:#Context-_contextSuffixLength--[`++_contextSuffixLength++`]]
- [.contract]
- [[Context]]
- === `++Context++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/utils/Context.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Context.sol";
- ```
- 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.
- [.contract-index]
- .Functions
- --
- * {xref-Context-_msgSender--}[`++_msgSender()++`]
- * {xref-Context-_msgData--}[`++_msgData()++`]
- * {xref-Context-_contextSuffixLength--}[`++_contextSuffixLength()++`]
- --
- [.contract-item]
- [[Context-_msgSender--]]
- ==== `[.contract-item-name]#++_msgSender++#++() → address++` [.item-kind]#internal#
- [.contract-item]
- [[Context-_msgData--]]
- ==== `[.contract-item-name]#++_msgData++#++() → bytes++` [.item-kind]#internal#
- [.contract-item]
- [[Context-_contextSuffixLength--]]
- ==== `[.contract-item-name]#++_contextSuffixLength++#++() → uint256++` [.item-kind]#internal#
|