utils.adoc 209 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507
  1. :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
  2. :ReentrancyGuard: pass:normal[xref:utils.adoc#ReentrancyGuard[`ReentrancyGuard`]]
  3. :Pausable: pass:normal[xref:utils.adoc#Pausable[`Pausable`]]
  4. :SafeCast: pass:normal[xref:utils.adoc#SafeCast[`SafeCast`]]
  5. :Math: pass:normal[xref:utils.adoc#Math[`Math`]]
  6. :SignedMath: pass:normal[xref:utils.adoc#SignedMath[`SignedMath`]]
  7. :Multicall: pass:normal[xref:utils.adoc#Multicall[`Multicall`]]
  8. :Create2: pass:normal[xref:utils.adoc#Create2[`Create2`]]
  9. :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
  10. :EnumerableSet: pass:normal[xref:utils.adoc#EnumerableSet[`EnumerableSet`]]
  11. :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
  12. :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
  13. :EnumerableSet: pass:normal[xref:utils.adoc#EnumerableSet[`EnumerableSet`]]
  14. :xref-Math-tryAdd-uint256-uint256-: xref:utils.adoc#Math-tryAdd-uint256-uint256-
  15. :xref-Math-trySub-uint256-uint256-: xref:utils.adoc#Math-trySub-uint256-uint256-
  16. :xref-Math-tryMul-uint256-uint256-: xref:utils.adoc#Math-tryMul-uint256-uint256-
  17. :xref-Math-tryDiv-uint256-uint256-: xref:utils.adoc#Math-tryDiv-uint256-uint256-
  18. :xref-Math-tryMod-uint256-uint256-: xref:utils.adoc#Math-tryMod-uint256-uint256-
  19. :xref-Math-max-uint256-uint256-: xref:utils.adoc#Math-max-uint256-uint256-
  20. :xref-Math-min-uint256-uint256-: xref:utils.adoc#Math-min-uint256-uint256-
  21. :xref-Math-average-uint256-uint256-: xref:utils.adoc#Math-average-uint256-uint256-
  22. :xref-Math-ceilDiv-uint256-uint256-: xref:utils.adoc#Math-ceilDiv-uint256-uint256-
  23. :xref-Math-mulDiv-uint256-uint256-uint256-: xref:utils.adoc#Math-mulDiv-uint256-uint256-uint256-
  24. :xref-Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-
  25. :xref-Math-sqrt-uint256-: xref:utils.adoc#Math-sqrt-uint256-
  26. :xref-Math-sqrt-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-sqrt-uint256-enum-Math-Rounding-
  27. :xref-Math-log2-uint256-: xref:utils.adoc#Math-log2-uint256-
  28. :xref-Math-log2-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log2-uint256-enum-Math-Rounding-
  29. :xref-Math-log10-uint256-: xref:utils.adoc#Math-log10-uint256-
  30. :xref-Math-log10-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log10-uint256-enum-Math-Rounding-
  31. :xref-Math-log256-uint256-: xref:utils.adoc#Math-log256-uint256-
  32. :xref-Math-log256-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log256-uint256-enum-Math-Rounding-
  33. :xref-Math-unsignedRoundsUp-enum-Math-Rounding-: xref:utils.adoc#Math-unsignedRoundsUp-enum-Math-Rounding-
  34. :xref-Math-MathOverflowedMulDiv--: xref:utils.adoc#Math-MathOverflowedMulDiv--
  35. :xref-SignedMath-max-int256-int256-: xref:utils.adoc#SignedMath-max-int256-int256-
  36. :xref-SignedMath-min-int256-int256-: xref:utils.adoc#SignedMath-min-int256-int256-
  37. :xref-SignedMath-average-int256-int256-: xref:utils.adoc#SignedMath-average-int256-int256-
  38. :xref-SignedMath-abs-int256-: xref:utils.adoc#SignedMath-abs-int256-
  39. :xref-SafeCast-toUint248-uint256-: xref:utils.adoc#SafeCast-toUint248-uint256-
  40. :xref-SafeCast-toUint240-uint256-: xref:utils.adoc#SafeCast-toUint240-uint256-
  41. :xref-SafeCast-toUint232-uint256-: xref:utils.adoc#SafeCast-toUint232-uint256-
  42. :xref-SafeCast-toUint224-uint256-: xref:utils.adoc#SafeCast-toUint224-uint256-
  43. :xref-SafeCast-toUint216-uint256-: xref:utils.adoc#SafeCast-toUint216-uint256-
  44. :xref-SafeCast-toUint208-uint256-: xref:utils.adoc#SafeCast-toUint208-uint256-
  45. :xref-SafeCast-toUint200-uint256-: xref:utils.adoc#SafeCast-toUint200-uint256-
  46. :xref-SafeCast-toUint192-uint256-: xref:utils.adoc#SafeCast-toUint192-uint256-
  47. :xref-SafeCast-toUint184-uint256-: xref:utils.adoc#SafeCast-toUint184-uint256-
  48. :xref-SafeCast-toUint176-uint256-: xref:utils.adoc#SafeCast-toUint176-uint256-
  49. :xref-SafeCast-toUint168-uint256-: xref:utils.adoc#SafeCast-toUint168-uint256-
  50. :xref-SafeCast-toUint160-uint256-: xref:utils.adoc#SafeCast-toUint160-uint256-
  51. :xref-SafeCast-toUint152-uint256-: xref:utils.adoc#SafeCast-toUint152-uint256-
  52. :xref-SafeCast-toUint144-uint256-: xref:utils.adoc#SafeCast-toUint144-uint256-
  53. :xref-SafeCast-toUint136-uint256-: xref:utils.adoc#SafeCast-toUint136-uint256-
  54. :xref-SafeCast-toUint128-uint256-: xref:utils.adoc#SafeCast-toUint128-uint256-
  55. :xref-SafeCast-toUint120-uint256-: xref:utils.adoc#SafeCast-toUint120-uint256-
  56. :xref-SafeCast-toUint112-uint256-: xref:utils.adoc#SafeCast-toUint112-uint256-
  57. :xref-SafeCast-toUint104-uint256-: xref:utils.adoc#SafeCast-toUint104-uint256-
  58. :xref-SafeCast-toUint96-uint256-: xref:utils.adoc#SafeCast-toUint96-uint256-
  59. :xref-SafeCast-toUint88-uint256-: xref:utils.adoc#SafeCast-toUint88-uint256-
  60. :xref-SafeCast-toUint80-uint256-: xref:utils.adoc#SafeCast-toUint80-uint256-
  61. :xref-SafeCast-toUint72-uint256-: xref:utils.adoc#SafeCast-toUint72-uint256-
  62. :xref-SafeCast-toUint64-uint256-: xref:utils.adoc#SafeCast-toUint64-uint256-
  63. :xref-SafeCast-toUint56-uint256-: xref:utils.adoc#SafeCast-toUint56-uint256-
  64. :xref-SafeCast-toUint48-uint256-: xref:utils.adoc#SafeCast-toUint48-uint256-
  65. :xref-SafeCast-toUint40-uint256-: xref:utils.adoc#SafeCast-toUint40-uint256-
  66. :xref-SafeCast-toUint32-uint256-: xref:utils.adoc#SafeCast-toUint32-uint256-
  67. :xref-SafeCast-toUint24-uint256-: xref:utils.adoc#SafeCast-toUint24-uint256-
  68. :xref-SafeCast-toUint16-uint256-: xref:utils.adoc#SafeCast-toUint16-uint256-
  69. :xref-SafeCast-toUint8-uint256-: xref:utils.adoc#SafeCast-toUint8-uint256-
  70. :xref-SafeCast-toUint256-int256-: xref:utils.adoc#SafeCast-toUint256-int256-
  71. :xref-SafeCast-toInt248-int256-: xref:utils.adoc#SafeCast-toInt248-int256-
  72. :xref-SafeCast-toInt240-int256-: xref:utils.adoc#SafeCast-toInt240-int256-
  73. :xref-SafeCast-toInt232-int256-: xref:utils.adoc#SafeCast-toInt232-int256-
  74. :xref-SafeCast-toInt224-int256-: xref:utils.adoc#SafeCast-toInt224-int256-
  75. :xref-SafeCast-toInt216-int256-: xref:utils.adoc#SafeCast-toInt216-int256-
  76. :xref-SafeCast-toInt208-int256-: xref:utils.adoc#SafeCast-toInt208-int256-
  77. :xref-SafeCast-toInt200-int256-: xref:utils.adoc#SafeCast-toInt200-int256-
  78. :xref-SafeCast-toInt192-int256-: xref:utils.adoc#SafeCast-toInt192-int256-
  79. :xref-SafeCast-toInt184-int256-: xref:utils.adoc#SafeCast-toInt184-int256-
  80. :xref-SafeCast-toInt176-int256-: xref:utils.adoc#SafeCast-toInt176-int256-
  81. :xref-SafeCast-toInt168-int256-: xref:utils.adoc#SafeCast-toInt168-int256-
  82. :xref-SafeCast-toInt160-int256-: xref:utils.adoc#SafeCast-toInt160-int256-
  83. :xref-SafeCast-toInt152-int256-: xref:utils.adoc#SafeCast-toInt152-int256-
  84. :xref-SafeCast-toInt144-int256-: xref:utils.adoc#SafeCast-toInt144-int256-
  85. :xref-SafeCast-toInt136-int256-: xref:utils.adoc#SafeCast-toInt136-int256-
  86. :xref-SafeCast-toInt128-int256-: xref:utils.adoc#SafeCast-toInt128-int256-
  87. :xref-SafeCast-toInt120-int256-: xref:utils.adoc#SafeCast-toInt120-int256-
  88. :xref-SafeCast-toInt112-int256-: xref:utils.adoc#SafeCast-toInt112-int256-
  89. :xref-SafeCast-toInt104-int256-: xref:utils.adoc#SafeCast-toInt104-int256-
  90. :xref-SafeCast-toInt96-int256-: xref:utils.adoc#SafeCast-toInt96-int256-
  91. :xref-SafeCast-toInt88-int256-: xref:utils.adoc#SafeCast-toInt88-int256-
  92. :xref-SafeCast-toInt80-int256-: xref:utils.adoc#SafeCast-toInt80-int256-
  93. :xref-SafeCast-toInt72-int256-: xref:utils.adoc#SafeCast-toInt72-int256-
  94. :xref-SafeCast-toInt64-int256-: xref:utils.adoc#SafeCast-toInt64-int256-
  95. :xref-SafeCast-toInt56-int256-: xref:utils.adoc#SafeCast-toInt56-int256-
  96. :xref-SafeCast-toInt48-int256-: xref:utils.adoc#SafeCast-toInt48-int256-
  97. :xref-SafeCast-toInt40-int256-: xref:utils.adoc#SafeCast-toInt40-int256-
  98. :xref-SafeCast-toInt32-int256-: xref:utils.adoc#SafeCast-toInt32-int256-
  99. :xref-SafeCast-toInt24-int256-: xref:utils.adoc#SafeCast-toInt24-int256-
  100. :xref-SafeCast-toInt16-int256-: xref:utils.adoc#SafeCast-toInt16-int256-
  101. :xref-SafeCast-toInt8-int256-: xref:utils.adoc#SafeCast-toInt8-int256-
  102. :xref-SafeCast-toInt256-uint256-: xref:utils.adoc#SafeCast-toInt256-uint256-
  103. :xref-SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-: xref:utils.adoc#SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-
  104. :xref-SafeCast-SafeCastOverflowedIntToUint-int256-: xref:utils.adoc#SafeCast-SafeCastOverflowedIntToUint-int256-
  105. :xref-SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-: xref:utils.adoc#SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-
  106. :xref-SafeCast-SafeCastOverflowedUintToInt-uint256-: xref:utils.adoc#SafeCast-SafeCastOverflowedUintToInt-uint256-
  107. :xref-ECDSA-tryRecover-bytes32-bytes-: xref:utils.adoc#ECDSA-tryRecover-bytes32-bytes-
  108. :xref-ECDSA-recover-bytes32-bytes-: xref:utils.adoc#ECDSA-recover-bytes32-bytes-
  109. :xref-ECDSA-tryRecover-bytes32-bytes32-bytes32-: xref:utils.adoc#ECDSA-tryRecover-bytes32-bytes32-bytes32-
  110. :xref-ECDSA-recover-bytes32-bytes32-bytes32-: xref:utils.adoc#ECDSA-recover-bytes32-bytes32-bytes32-
  111. :xref-ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-: xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-
  112. :xref-ECDSA-recover-bytes32-uint8-bytes32-bytes32-: xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-
  113. :xref-ECDSA-ECDSAInvalidSignature--: xref:utils.adoc#ECDSA-ECDSAInvalidSignature--
  114. :xref-ECDSA-ECDSAInvalidSignatureLength-uint256-: xref:utils.adoc#ECDSA-ECDSAInvalidSignatureLength-uint256-
  115. :xref-ECDSA-ECDSAInvalidSignatureS-bytes32-: xref:utils.adoc#ECDSA-ECDSAInvalidSignatureS-bytes32-
  116. :MessageHashUtils-toEthSignedMessageHash: pass:normal[xref:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes-[`MessageHashUtils.toEthSignedMessageHash`]]
  117. :MessageHashUtils-toEthSignedMessageHash: pass:normal[xref:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes-[`MessageHashUtils.toEthSignedMessageHash`]]
  118. :ECDSA-tryRecover: pass:normal[xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`ECDSA.tryRecover`]]
  119. :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
  120. :ECDSA-tryRecover: pass:normal[xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`ECDSA.tryRecover`]]
  121. :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
  122. :ECDSA: pass:normal[xref:utils.adoc#ECDSA[`ECDSA`]]
  123. :xref-MessageHashUtils-toEthSignedMessageHash-bytes32-: xref:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes32-
  124. :xref-MessageHashUtils-toEthSignedMessageHash-bytes-: xref:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes-
  125. :xref-MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-: xref:utils.adoc#MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-
  126. :xref-MessageHashUtils-toTypedDataHash-bytes32-bytes32-: xref:utils.adoc#MessageHashUtils-toTypedDataHash-bytes32-bytes32-
  127. :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
  128. :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
  129. :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
  130. :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
  131. :xref-SignatureChecker-isValidSignatureNow-address-bytes32-bytes-: xref:utils.adoc#SignatureChecker-isValidSignatureNow-address-bytes32-bytes-
  132. :xref-SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-: xref:utils.adoc#SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-
  133. :xref-MerkleProof-verify-bytes32---bytes32-bytes32-: xref:utils.adoc#MerkleProof-verify-bytes32---bytes32-bytes32-
  134. :xref-MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-: xref:utils.adoc#MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-
  135. :xref-MerkleProof-processProof-bytes32---bytes32-: xref:utils.adoc#MerkleProof-processProof-bytes32---bytes32-
  136. :xref-MerkleProof-processProofCalldata-bytes32---bytes32-: xref:utils.adoc#MerkleProof-processProofCalldata-bytes32---bytes32-
  137. :xref-MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---: xref:utils.adoc#MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---
  138. :xref-MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---: xref:utils.adoc#MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---
  139. :xref-MerkleProof-processMultiProof-bytes32---bool---bytes32---: xref:utils.adoc#MerkleProof-processMultiProof-bytes32---bool---bytes32---
  140. :xref-MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---: xref:utils.adoc#MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---
  141. :xref-MerkleProof-MerkleProofInvalidMultiproof--: xref:utils.adoc#MerkleProof-MerkleProofInvalidMultiproof--
  142. :xref-EIP712-constructor-string-string-: xref:utils.adoc#EIP712-constructor-string-string-
  143. :xref-EIP712-_domainSeparatorV4--: xref:utils.adoc#EIP712-_domainSeparatorV4--
  144. :xref-EIP712-_hashTypedDataV4-bytes32-: xref:utils.adoc#EIP712-_hashTypedDataV4-bytes32-
  145. :xref-EIP712-eip712Domain--: xref:utils.adoc#EIP712-eip712Domain--
  146. :xref-EIP712-_EIP712Name--: xref:utils.adoc#EIP712-_EIP712Name--
  147. :xref-EIP712-_EIP712Version--: xref:utils.adoc#EIP712-_EIP712Version--
  148. :xref-IERC5267-EIP712DomainChanged--: xref:interfaces.adoc#IERC5267-EIP712DomainChanged--
  149. :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
  150. :xref-ReentrancyGuard-nonReentrant--: xref:utils.adoc#ReentrancyGuard-nonReentrant--
  151. :xref-ReentrancyGuard-constructor--: xref:utils.adoc#ReentrancyGuard-constructor--
  152. :xref-ReentrancyGuard-_reentrancyGuardEntered--: xref:utils.adoc#ReentrancyGuard-_reentrancyGuardEntered--
  153. :xref-ReentrancyGuard-ReentrancyGuardReentrantCall--: xref:utils.adoc#ReentrancyGuard-ReentrancyGuardReentrantCall--
  154. :xref-Pausable-whenNotPaused--: xref:utils.adoc#Pausable-whenNotPaused--
  155. :xref-Pausable-whenPaused--: xref:utils.adoc#Pausable-whenPaused--
  156. :xref-Pausable-constructor--: xref:utils.adoc#Pausable-constructor--
  157. :xref-Pausable-paused--: xref:utils.adoc#Pausable-paused--
  158. :xref-Pausable-_requireNotPaused--: xref:utils.adoc#Pausable-_requireNotPaused--
  159. :xref-Pausable-_requirePaused--: xref:utils.adoc#Pausable-_requirePaused--
  160. :xref-Pausable-_pause--: xref:utils.adoc#Pausable-_pause--
  161. :xref-Pausable-_unpause--: xref:utils.adoc#Pausable-_unpause--
  162. :xref-Pausable-Paused-address-: xref:utils.adoc#Pausable-Paused-address-
  163. :xref-Pausable-Unpaused-address-: xref:utils.adoc#Pausable-Unpaused-address-
  164. :xref-Pausable-EnforcedPause--: xref:utils.adoc#Pausable-EnforcedPause--
  165. :xref-Pausable-ExpectedPause--: xref:utils.adoc#Pausable-ExpectedPause--
  166. :ERC165Checker: pass:normal[xref:utils.adoc#ERC165Checker[`ERC165Checker`]]
  167. :ERC165: pass:normal[xref:utils.adoc#ERC165[`ERC165`]]
  168. :xref-IERC165-supportsInterface-bytes4-: xref:utils.adoc#IERC165-supportsInterface-bytes4-
  169. :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
  170. :xref-ERC165-supportsInterface-bytes4-: xref:utils.adoc#ERC165-supportsInterface-bytes4-
  171. :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
  172. :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
  173. :xref-ERC165Checker-supportsERC165-address-: xref:utils.adoc#ERC165Checker-supportsERC165-address-
  174. :xref-ERC165Checker-supportsInterface-address-bytes4-: xref:utils.adoc#ERC165Checker-supportsInterface-address-bytes4-
  175. :xref-ERC165Checker-getSupportedInterfaces-address-bytes4---: xref:utils.adoc#ERC165Checker-getSupportedInterfaces-address-bytes4---
  176. :xref-ERC165Checker-supportsAllInterfaces-address-bytes4---: xref:utils.adoc#ERC165Checker-supportsAllInterfaces-address-bytes4---
  177. :xref-ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-: xref:utils.adoc#ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-
  178. :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
  179. :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
  180. :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
  181. :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
  182. :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
  183. :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
  184. :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
  185. :xref-BitMaps-get-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-get-struct-BitMaps-BitMap-uint256-
  186. :xref-BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-: xref:utils.adoc#BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-
  187. :xref-BitMaps-set-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-set-struct-BitMaps-BitMap-uint256-
  188. :xref-BitMaps-unset-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-unset-struct-BitMaps-BitMap-uint256-
  189. :xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-
  190. :xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
  191. :xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
  192. :xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-
  193. :xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-
  194. :xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
  195. :xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
  196. :xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-
  197. :xref-EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-
  198. :xref-EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-
  199. :xref-EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-
  200. :xref-EnumerableMap-length-struct-EnumerableMap-UintToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-UintToUintMap-
  201. :xref-EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-
  202. :xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-
  203. :xref-EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-
  204. :xref-EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-
  205. :xref-EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-
  206. :xref-EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-
  207. :xref-EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-
  208. :xref-EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-
  209. :xref-EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-
  210. :xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-
  211. :xref-EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-
  212. :xref-EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-
  213. :xref-EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-
  214. :xref-EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-
  215. :xref-EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-
  216. :xref-EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-
  217. :xref-EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-
  218. :xref-EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-
  219. :xref-EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-
  220. :xref-EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-
  221. :xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-
  222. :xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
  223. :xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
  224. :xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-
  225. :xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-
  226. :xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
  227. :xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
  228. :xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-
  229. :xref-EnumerableMap-EnumerableMapNonexistentKey-bytes32-: xref:utils.adoc#EnumerableMap-EnumerableMapNonexistentKey-bytes32-
  230. :xref-EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-
  231. :xref-EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-
  232. :xref-EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-
  233. :xref-EnumerableSet-length-struct-EnumerableSet-Bytes32Set-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-Bytes32Set-
  234. :xref-EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-
  235. :xref-EnumerableSet-values-struct-EnumerableSet-Bytes32Set-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-Bytes32Set-
  236. :xref-EnumerableSet-add-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-AddressSet-address-
  237. :xref-EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-
  238. :xref-EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-
  239. :xref-EnumerableSet-length-struct-EnumerableSet-AddressSet-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-AddressSet-
  240. :xref-EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-
  241. :xref-EnumerableSet-values-struct-EnumerableSet-AddressSet-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-AddressSet-
  242. :xref-EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-
  243. :xref-EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-
  244. :xref-EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-
  245. :xref-EnumerableSet-length-struct-EnumerableSet-UintSet-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-UintSet-
  246. :xref-EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-
  247. :xref-EnumerableSet-values-struct-EnumerableSet-UintSet-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-UintSet-
  248. :xref-DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-: xref:utils.adoc#DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-
  249. :xref-DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-
  250. :xref-DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-: xref:utils.adoc#DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-
  251. :xref-DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-
  252. :xref-DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-
  253. :xref-DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-
  254. :xref-DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-: xref:utils.adoc#DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-
  255. :xref-DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-
  256. :xref-DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-
  257. :xref-DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-
  258. :xref-DoubleEndedQueue-QueueEmpty--: xref:utils.adoc#DoubleEndedQueue-QueueEmpty--
  259. :xref-DoubleEndedQueue-QueueFull--: xref:utils.adoc#DoubleEndedQueue-QueueFull--
  260. :xref-DoubleEndedQueue-QueueOutOfBounds--: xref:utils.adoc#DoubleEndedQueue-QueueOutOfBounds--
  261. :Votes: pass:normal[xref:governance.adoc#Votes[`Votes`]]
  262. :xref-Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-
  263. :xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-
  264. :xref-Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-
  265. :xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-
  266. :xref-Checkpoints-latest-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-Trace224-
  267. :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-
  268. :xref-Checkpoints-length-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-Trace224-
  269. :xref-Checkpoints-at-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-at-struct-Checkpoints-Trace224-uint32-
  270. :xref-Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-
  271. :xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-: xref:utils.adoc#Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-
  272. :xref-Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-: xref:utils.adoc#Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-
  273. :xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-: xref:utils.adoc#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-
  274. :xref-Checkpoints-latest-struct-Checkpoints-Trace208-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-Trace208-
  275. :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-
  276. :xref-Checkpoints-length-struct-Checkpoints-Trace208-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-Trace208-
  277. :xref-Checkpoints-at-struct-Checkpoints-Trace208-uint32-: xref:utils.adoc#Checkpoints-at-struct-Checkpoints-Trace208-uint32-
  278. :xref-Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-
  279. :xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-
  280. :xref-Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-
  281. :xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-
  282. :xref-Checkpoints-latest-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-Trace160-
  283. :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-
  284. :xref-Checkpoints-length-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-Trace160-
  285. :xref-Checkpoints-at-struct-Checkpoints-Trace160-uint32-: xref:utils.adoc#Checkpoints-at-struct-Checkpoints-Trace160-uint32-
  286. :xref-Checkpoints-CheckpointUnorderedInsertion--: xref:utils.adoc#Checkpoints-CheckpointUnorderedInsertion--
  287. :xref-Create2-deploy-uint256-bytes32-bytes-: xref:utils.adoc#Create2-deploy-uint256-bytes32-bytes-
  288. :xref-Create2-computeAddress-bytes32-bytes32-: xref:utils.adoc#Create2-computeAddress-bytes32-bytes32-
  289. :xref-Create2-computeAddress-bytes32-bytes32-address-: xref:utils.adoc#Create2-computeAddress-bytes32-bytes32-address-
  290. :xref-Create2-Create2InsufficientBalance-uint256-uint256-: xref:utils.adoc#Create2-Create2InsufficientBalance-uint256-uint256-
  291. :xref-Create2-Create2EmptyBytecode--: xref:utils.adoc#Create2-Create2EmptyBytecode--
  292. :xref-Create2-Create2FailedDeployment--: xref:utils.adoc#Create2-Create2FailedDeployment--
  293. :xref-Address-sendValue-address-payable-uint256-: xref:utils.adoc#Address-sendValue-address-payable-uint256-
  294. :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
  295. :xref-Address-functionCallWithValue-address-bytes-uint256-: xref:utils.adoc#Address-functionCallWithValue-address-bytes-uint256-
  296. :xref-Address-functionStaticCall-address-bytes-: xref:utils.adoc#Address-functionStaticCall-address-bytes-
  297. :xref-Address-functionDelegateCall-address-bytes-: xref:utils.adoc#Address-functionDelegateCall-address-bytes-
  298. :xref-Address-verifyCallResultFromTarget-address-bool-bytes-: xref:utils.adoc#Address-verifyCallResultFromTarget-address-bool-bytes-
  299. :xref-Address-verifyCallResult-bool-bytes-: xref:utils.adoc#Address-verifyCallResult-bool-bytes-
  300. :xref-Address-AddressInsufficientBalance-address-: xref:utils.adoc#Address-AddressInsufficientBalance-address-
  301. :xref-Address-AddressEmptyCode-address-: xref:utils.adoc#Address-AddressEmptyCode-address-
  302. :xref-Address-FailedInnerCall--: xref:utils.adoc#Address-FailedInnerCall--
  303. :ReentrancyGuard: pass:normal[xref:utils.adoc#ReentrancyGuard[`ReentrancyGuard`]]
  304. :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
  305. :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
  306. :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
  307. :xref-Arrays-findUpperBound-uint256---uint256-: xref:utils.adoc#Arrays-findUpperBound-uint256---uint256-
  308. :xref-Arrays-unsafeAccess-address---uint256-: xref:utils.adoc#Arrays-unsafeAccess-address---uint256-
  309. :xref-Arrays-unsafeAccess-bytes32---uint256-: xref:utils.adoc#Arrays-unsafeAccess-bytes32---uint256-
  310. :xref-Arrays-unsafeAccess-uint256---uint256-: xref:utils.adoc#Arrays-unsafeAccess-uint256---uint256-
  311. :xref-Arrays-unsafeMemoryAccess-uint256---uint256-: xref:utils.adoc#Arrays-unsafeMemoryAccess-uint256---uint256-
  312. :xref-Arrays-unsafeMemoryAccess-address---uint256-: xref:utils.adoc#Arrays-unsafeMemoryAccess-address---uint256-
  313. :xref-Base64-encode-bytes-: xref:utils.adoc#Base64-encode-bytes-
  314. :xref-Strings-toString-uint256-: xref:utils.adoc#Strings-toString-uint256-
  315. :xref-Strings-toStringSigned-int256-: xref:utils.adoc#Strings-toStringSigned-int256-
  316. :xref-Strings-toHexString-uint256-: xref:utils.adoc#Strings-toHexString-uint256-
  317. :xref-Strings-toHexString-uint256-uint256-: xref:utils.adoc#Strings-toHexString-uint256-uint256-
  318. :xref-Strings-toHexString-address-: xref:utils.adoc#Strings-toHexString-address-
  319. :xref-Strings-equal-string-string-: xref:utils.adoc#Strings-equal-string-string-
  320. :xref-Strings-StringsInsufficientHexLength-uint256-uint256-: xref:utils.adoc#Strings-StringsInsufficientHexLength-uint256-uint256-
  321. :xref-ShortStrings-toShortString-string-: xref:utils.adoc#ShortStrings-toShortString-string-
  322. :xref-ShortStrings-toString-ShortString-: xref:utils.adoc#ShortStrings-toString-ShortString-
  323. :xref-ShortStrings-byteLength-ShortString-: xref:utils.adoc#ShortStrings-byteLength-ShortString-
  324. :xref-ShortStrings-toShortStringWithFallback-string-string-: xref:utils.adoc#ShortStrings-toShortStringWithFallback-string-string-
  325. :xref-ShortStrings-toStringWithFallback-ShortString-string-: xref:utils.adoc#ShortStrings-toStringWithFallback-ShortString-string-
  326. :xref-ShortStrings-byteLengthWithFallback-ShortString-string-: xref:utils.adoc#ShortStrings-byteLengthWithFallback-ShortString-string-
  327. :xref-ShortStrings-StringTooLong-string-: xref:utils.adoc#ShortStrings-StringTooLong-string-
  328. :xref-ShortStrings-InvalidShortString--: xref:utils.adoc#ShortStrings-InvalidShortString--
  329. :xref-StorageSlot-getAddressSlot-bytes32-: xref:utils.adoc#StorageSlot-getAddressSlot-bytes32-
  330. :xref-StorageSlot-getBooleanSlot-bytes32-: xref:utils.adoc#StorageSlot-getBooleanSlot-bytes32-
  331. :xref-StorageSlot-getBytes32Slot-bytes32-: xref:utils.adoc#StorageSlot-getBytes32Slot-bytes32-
  332. :xref-StorageSlot-getUint256Slot-bytes32-: xref:utils.adoc#StorageSlot-getUint256Slot-bytes32-
  333. :xref-StorageSlot-getStringSlot-bytes32-: xref:utils.adoc#StorageSlot-getStringSlot-bytes32-
  334. :xref-StorageSlot-getStringSlot-string-: xref:utils.adoc#StorageSlot-getStringSlot-string-
  335. :xref-StorageSlot-getBytesSlot-bytes32-: xref:utils.adoc#StorageSlot-getBytesSlot-bytes32-
  336. :xref-StorageSlot-getBytesSlot-bytes-: xref:utils.adoc#StorageSlot-getBytesSlot-bytes-
  337. :ERC2771Context: pass:normal[xref:metatx.adoc#ERC2771Context[`ERC2771Context`]]
  338. :xref-Multicall-multicall-bytes---: xref:utils.adoc#Multicall-multicall-bytes---
  339. = Utilities
  340. [.readme-notice]
  341. NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils
  342. Miscellaneous contracts and libraries containing utility functions you can use to improve security, work with new data types, or safely use low-level primitives.
  343. * {ReentrancyGuard}: A modifier that can prevent reentrancy during certain functions.
  344. * {Pausable}: A common emergency response mechanism that can pause functionality while a remediation is pending.
  345. * {SafeCast}: Checked downcasting functions to avoid silent truncation.
  346. * {Math}, {SignedMath}: Implementation of various arithmetic functions.
  347. * {Multicall}: Simple way to batch together multiple calls in a single external call.
  348. * {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.
  349. * {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`).
  350. * {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.
  351. [NOTE]
  352. ====
  353. Because Solidity does not support generic types, {EnumerableMap} and {EnumerableSet} are specialized to a limited number of key-value types.
  354. ====
  355. == Math
  356. :MathOverflowedMulDiv: pass:normal[xref:#Math-MathOverflowedMulDiv--[`++MathOverflowedMulDiv++`]]
  357. :Rounding: pass:normal[xref:#Math-Rounding[`++Rounding++`]]
  358. :tryAdd: pass:normal[xref:#Math-tryAdd-uint256-uint256-[`++tryAdd++`]]
  359. :trySub: pass:normal[xref:#Math-trySub-uint256-uint256-[`++trySub++`]]
  360. :tryMul: pass:normal[xref:#Math-tryMul-uint256-uint256-[`++tryMul++`]]
  361. :tryDiv: pass:normal[xref:#Math-tryDiv-uint256-uint256-[`++tryDiv++`]]
  362. :tryMod: pass:normal[xref:#Math-tryMod-uint256-uint256-[`++tryMod++`]]
  363. :max: pass:normal[xref:#Math-max-uint256-uint256-[`++max++`]]
  364. :min: pass:normal[xref:#Math-min-uint256-uint256-[`++min++`]]
  365. :average: pass:normal[xref:#Math-average-uint256-uint256-[`++average++`]]
  366. :ceilDiv: pass:normal[xref:#Math-ceilDiv-uint256-uint256-[`++ceilDiv++`]]
  367. :mulDiv: pass:normal[xref:#Math-mulDiv-uint256-uint256-uint256-[`++mulDiv++`]]
  368. :mulDiv: pass:normal[xref:#Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-[`++mulDiv++`]]
  369. :sqrt: pass:normal[xref:#Math-sqrt-uint256-[`++sqrt++`]]
  370. :sqrt: pass:normal[xref:#Math-sqrt-uint256-enum-Math-Rounding-[`++sqrt++`]]
  371. :log2: pass:normal[xref:#Math-log2-uint256-[`++log2++`]]
  372. :log2: pass:normal[xref:#Math-log2-uint256-enum-Math-Rounding-[`++log2++`]]
  373. :log10: pass:normal[xref:#Math-log10-uint256-[`++log10++`]]
  374. :log10: pass:normal[xref:#Math-log10-uint256-enum-Math-Rounding-[`++log10++`]]
  375. :log256: pass:normal[xref:#Math-log256-uint256-[`++log256++`]]
  376. :log256: pass:normal[xref:#Math-log256-uint256-enum-Math-Rounding-[`++log256++`]]
  377. :unsignedRoundsUp: pass:normal[xref:#Math-unsignedRoundsUp-enum-Math-Rounding-[`++unsignedRoundsUp++`]]
  378. [.contract]
  379. [[Math]]
  380. === `++Math++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/math/Math.sol[{github-icon},role=heading-link]
  381. [.hljs-theme-light.nopadding]
  382. ```solidity
  383. import "@openzeppelin/contracts/utils/math/Math.sol";
  384. ```
  385. Standard math utilities missing in the Solidity language.
  386. [.contract-index]
  387. .Functions
  388. --
  389. * {xref-Math-tryAdd-uint256-uint256-}[`++tryAdd(a, b)++`]
  390. * {xref-Math-trySub-uint256-uint256-}[`++trySub(a, b)++`]
  391. * {xref-Math-tryMul-uint256-uint256-}[`++tryMul(a, b)++`]
  392. * {xref-Math-tryDiv-uint256-uint256-}[`++tryDiv(a, b)++`]
  393. * {xref-Math-tryMod-uint256-uint256-}[`++tryMod(a, b)++`]
  394. * {xref-Math-max-uint256-uint256-}[`++max(a, b)++`]
  395. * {xref-Math-min-uint256-uint256-}[`++min(a, b)++`]
  396. * {xref-Math-average-uint256-uint256-}[`++average(a, b)++`]
  397. * {xref-Math-ceilDiv-uint256-uint256-}[`++ceilDiv(a, b)++`]
  398. * {xref-Math-mulDiv-uint256-uint256-uint256-}[`++mulDiv(x, y, denominator)++`]
  399. * {xref-Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-}[`++mulDiv(x, y, denominator, rounding)++`]
  400. * {xref-Math-sqrt-uint256-}[`++sqrt(a)++`]
  401. * {xref-Math-sqrt-uint256-enum-Math-Rounding-}[`++sqrt(a, rounding)++`]
  402. * {xref-Math-log2-uint256-}[`++log2(value)++`]
  403. * {xref-Math-log2-uint256-enum-Math-Rounding-}[`++log2(value, rounding)++`]
  404. * {xref-Math-log10-uint256-}[`++log10(value)++`]
  405. * {xref-Math-log10-uint256-enum-Math-Rounding-}[`++log10(value, rounding)++`]
  406. * {xref-Math-log256-uint256-}[`++log256(value)++`]
  407. * {xref-Math-log256-uint256-enum-Math-Rounding-}[`++log256(value, rounding)++`]
  408. * {xref-Math-unsignedRoundsUp-enum-Math-Rounding-}[`++unsignedRoundsUp(rounding)++`]
  409. --
  410. [.contract-index]
  411. .Errors
  412. --
  413. * {xref-Math-MathOverflowedMulDiv--}[`++MathOverflowedMulDiv()++`]
  414. --
  415. [.contract-item]
  416. [[Math-tryAdd-uint256-uint256-]]
  417. ==== `[.contract-item-name]#++tryAdd++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
  418. Returns the addition of two unsigned integers, with an overflow flag.
  419. [.contract-item]
  420. [[Math-trySub-uint256-uint256-]]
  421. ==== `[.contract-item-name]#++trySub++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
  422. Returns the subtraction of two unsigned integers, with an overflow flag.
  423. [.contract-item]
  424. [[Math-tryMul-uint256-uint256-]]
  425. ==== `[.contract-item-name]#++tryMul++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
  426. Returns the multiplication of two unsigned integers, with an overflow flag.
  427. [.contract-item]
  428. [[Math-tryDiv-uint256-uint256-]]
  429. ==== `[.contract-item-name]#++tryDiv++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
  430. Returns the division of two unsigned integers, with a division by zero flag.
  431. [.contract-item]
  432. [[Math-tryMod-uint256-uint256-]]
  433. ==== `[.contract-item-name]#++tryMod++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
  434. Returns the remainder of dividing two unsigned integers, with a division by zero flag.
  435. [.contract-item]
  436. [[Math-max-uint256-uint256-]]
  437. ==== `[.contract-item-name]#++max++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
  438. Returns the largest of two numbers.
  439. [.contract-item]
  440. [[Math-min-uint256-uint256-]]
  441. ==== `[.contract-item-name]#++min++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
  442. Returns the smallest of two numbers.
  443. [.contract-item]
  444. [[Math-average-uint256-uint256-]]
  445. ==== `[.contract-item-name]#++average++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
  446. Returns the average of two numbers. The result is rounded towards
  447. zero.
  448. [.contract-item]
  449. [[Math-ceilDiv-uint256-uint256-]]
  450. ==== `[.contract-item-name]#++ceilDiv++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
  451. Returns the ceiling of the division of two numbers.
  452. This differs from standard division with `/` in that it rounds towards infinity instead
  453. of rounding towards zero.
  454. [.contract-item]
  455. [[Math-mulDiv-uint256-uint256-uint256-]]
  456. ==== `[.contract-item-name]#++mulDiv++#++(uint256 x, uint256 y, uint256 denominator) → uint256 result++` [.item-kind]#internal#
  457. Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
  458. Uniswap Labs also under MIT license.
  459. [.contract-item]
  460. [[Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-]]
  461. ==== `[.contract-item-name]#++mulDiv++#++(uint256 x, uint256 y, uint256 denominator, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
  462. [.contract-item]
  463. [[Math-sqrt-uint256-]]
  464. ==== `[.contract-item-name]#++sqrt++#++(uint256 a) → uint256++` [.item-kind]#internal#
  465. Returns the square root of a number. If the number is not a perfect square, the value is rounded
  466. towards zero.
  467. Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
  468. [.contract-item]
  469. [[Math-sqrt-uint256-enum-Math-Rounding-]]
  470. ==== `[.contract-item-name]#++sqrt++#++(uint256 a, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
  471. [.contract-item]
  472. [[Math-log2-uint256-]]
  473. ==== `[.contract-item-name]#++log2++#++(uint256 value) → uint256++` [.item-kind]#internal#
  474. Return the log in base 2 of a positive value rounded towards zero.
  475. Returns 0 if given 0.
  476. [.contract-item]
  477. [[Math-log2-uint256-enum-Math-Rounding-]]
  478. ==== `[.contract-item-name]#++log2++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
  479. Return the log in base 2, following the selected rounding direction, of a positive value.
  480. Returns 0 if given 0.
  481. [.contract-item]
  482. [[Math-log10-uint256-]]
  483. ==== `[.contract-item-name]#++log10++#++(uint256 value) → uint256++` [.item-kind]#internal#
  484. Return the log in base 10 of a positive value rounded towards zero.
  485. Returns 0 if given 0.
  486. [.contract-item]
  487. [[Math-log10-uint256-enum-Math-Rounding-]]
  488. ==== `[.contract-item-name]#++log10++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
  489. Return the log in base 10, following the selected rounding direction, of a positive value.
  490. Returns 0 if given 0.
  491. [.contract-item]
  492. [[Math-log256-uint256-]]
  493. ==== `[.contract-item-name]#++log256++#++(uint256 value) → uint256++` [.item-kind]#internal#
  494. Return the log in base 256 of a positive value rounded towards zero.
  495. Returns 0 if given 0.
  496. Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
  497. [.contract-item]
  498. [[Math-log256-uint256-enum-Math-Rounding-]]
  499. ==== `[.contract-item-name]#++log256++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
  500. Return the log in base 256, following the selected rounding direction, of a positive value.
  501. Returns 0 if given 0.
  502. [.contract-item]
  503. [[Math-unsignedRoundsUp-enum-Math-Rounding-]]
  504. ==== `[.contract-item-name]#++unsignedRoundsUp++#++(enum Math.Rounding rounding) → bool++` [.item-kind]#internal#
  505. Returns whether a provided rounding mode is considered rounding up for unsigned integers.
  506. [.contract-item]
  507. [[Math-MathOverflowedMulDiv--]]
  508. ==== `[.contract-item-name]#++MathOverflowedMulDiv++#++()++` [.item-kind]#error#
  509. Muldiv operation overflow.
  510. :max: pass:normal[xref:#SignedMath-max-int256-int256-[`++max++`]]
  511. :min: pass:normal[xref:#SignedMath-min-int256-int256-[`++min++`]]
  512. :average: pass:normal[xref:#SignedMath-average-int256-int256-[`++average++`]]
  513. :abs: pass:normal[xref:#SignedMath-abs-int256-[`++abs++`]]
  514. [.contract]
  515. [[SignedMath]]
  516. === `++SignedMath++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/math/SignedMath.sol[{github-icon},role=heading-link]
  517. [.hljs-theme-light.nopadding]
  518. ```solidity
  519. import "@openzeppelin/contracts/utils/math/SignedMath.sol";
  520. ```
  521. Standard signed math utilities missing in the Solidity language.
  522. [.contract-index]
  523. .Functions
  524. --
  525. * {xref-SignedMath-max-int256-int256-}[`++max(a, b)++`]
  526. * {xref-SignedMath-min-int256-int256-}[`++min(a, b)++`]
  527. * {xref-SignedMath-average-int256-int256-}[`++average(a, b)++`]
  528. * {xref-SignedMath-abs-int256-}[`++abs(n)++`]
  529. --
  530. [.contract-item]
  531. [[SignedMath-max-int256-int256-]]
  532. ==== `[.contract-item-name]#++max++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
  533. Returns the largest of two signed numbers.
  534. [.contract-item]
  535. [[SignedMath-min-int256-int256-]]
  536. ==== `[.contract-item-name]#++min++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
  537. Returns the smallest of two signed numbers.
  538. [.contract-item]
  539. [[SignedMath-average-int256-int256-]]
  540. ==== `[.contract-item-name]#++average++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
  541. Returns the average of two signed numbers without overflow.
  542. The result is rounded towards zero.
  543. [.contract-item]
  544. [[SignedMath-abs-int256-]]
  545. ==== `[.contract-item-name]#++abs++#++(int256 n) → uint256++` [.item-kind]#internal#
  546. Returns the absolute unsigned value of a signed value.
  547. :SafeCastOverflowedUintDowncast: pass:normal[xref:#SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-[`++SafeCastOverflowedUintDowncast++`]]
  548. :SafeCastOverflowedIntToUint: pass:normal[xref:#SafeCast-SafeCastOverflowedIntToUint-int256-[`++SafeCastOverflowedIntToUint++`]]
  549. :SafeCastOverflowedIntDowncast: pass:normal[xref:#SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-[`++SafeCastOverflowedIntDowncast++`]]
  550. :SafeCastOverflowedUintToInt: pass:normal[xref:#SafeCast-SafeCastOverflowedUintToInt-uint256-[`++SafeCastOverflowedUintToInt++`]]
  551. :toUint248: pass:normal[xref:#SafeCast-toUint248-uint256-[`++toUint248++`]]
  552. :toUint240: pass:normal[xref:#SafeCast-toUint240-uint256-[`++toUint240++`]]
  553. :toUint232: pass:normal[xref:#SafeCast-toUint232-uint256-[`++toUint232++`]]
  554. :toUint224: pass:normal[xref:#SafeCast-toUint224-uint256-[`++toUint224++`]]
  555. :toUint216: pass:normal[xref:#SafeCast-toUint216-uint256-[`++toUint216++`]]
  556. :toUint208: pass:normal[xref:#SafeCast-toUint208-uint256-[`++toUint208++`]]
  557. :toUint200: pass:normal[xref:#SafeCast-toUint200-uint256-[`++toUint200++`]]
  558. :toUint192: pass:normal[xref:#SafeCast-toUint192-uint256-[`++toUint192++`]]
  559. :toUint184: pass:normal[xref:#SafeCast-toUint184-uint256-[`++toUint184++`]]
  560. :toUint176: pass:normal[xref:#SafeCast-toUint176-uint256-[`++toUint176++`]]
  561. :toUint168: pass:normal[xref:#SafeCast-toUint168-uint256-[`++toUint168++`]]
  562. :toUint160: pass:normal[xref:#SafeCast-toUint160-uint256-[`++toUint160++`]]
  563. :toUint152: pass:normal[xref:#SafeCast-toUint152-uint256-[`++toUint152++`]]
  564. :toUint144: pass:normal[xref:#SafeCast-toUint144-uint256-[`++toUint144++`]]
  565. :toUint136: pass:normal[xref:#SafeCast-toUint136-uint256-[`++toUint136++`]]
  566. :toUint128: pass:normal[xref:#SafeCast-toUint128-uint256-[`++toUint128++`]]
  567. :toUint120: pass:normal[xref:#SafeCast-toUint120-uint256-[`++toUint120++`]]
  568. :toUint112: pass:normal[xref:#SafeCast-toUint112-uint256-[`++toUint112++`]]
  569. :toUint104: pass:normal[xref:#SafeCast-toUint104-uint256-[`++toUint104++`]]
  570. :toUint96: pass:normal[xref:#SafeCast-toUint96-uint256-[`++toUint96++`]]
  571. :toUint88: pass:normal[xref:#SafeCast-toUint88-uint256-[`++toUint88++`]]
  572. :toUint80: pass:normal[xref:#SafeCast-toUint80-uint256-[`++toUint80++`]]
  573. :toUint72: pass:normal[xref:#SafeCast-toUint72-uint256-[`++toUint72++`]]
  574. :toUint64: pass:normal[xref:#SafeCast-toUint64-uint256-[`++toUint64++`]]
  575. :toUint56: pass:normal[xref:#SafeCast-toUint56-uint256-[`++toUint56++`]]
  576. :toUint48: pass:normal[xref:#SafeCast-toUint48-uint256-[`++toUint48++`]]
  577. :toUint40: pass:normal[xref:#SafeCast-toUint40-uint256-[`++toUint40++`]]
  578. :toUint32: pass:normal[xref:#SafeCast-toUint32-uint256-[`++toUint32++`]]
  579. :toUint24: pass:normal[xref:#SafeCast-toUint24-uint256-[`++toUint24++`]]
  580. :toUint16: pass:normal[xref:#SafeCast-toUint16-uint256-[`++toUint16++`]]
  581. :toUint8: pass:normal[xref:#SafeCast-toUint8-uint256-[`++toUint8++`]]
  582. :toUint256: pass:normal[xref:#SafeCast-toUint256-int256-[`++toUint256++`]]
  583. :toInt248: pass:normal[xref:#SafeCast-toInt248-int256-[`++toInt248++`]]
  584. :toInt240: pass:normal[xref:#SafeCast-toInt240-int256-[`++toInt240++`]]
  585. :toInt232: pass:normal[xref:#SafeCast-toInt232-int256-[`++toInt232++`]]
  586. :toInt224: pass:normal[xref:#SafeCast-toInt224-int256-[`++toInt224++`]]
  587. :toInt216: pass:normal[xref:#SafeCast-toInt216-int256-[`++toInt216++`]]
  588. :toInt208: pass:normal[xref:#SafeCast-toInt208-int256-[`++toInt208++`]]
  589. :toInt200: pass:normal[xref:#SafeCast-toInt200-int256-[`++toInt200++`]]
  590. :toInt192: pass:normal[xref:#SafeCast-toInt192-int256-[`++toInt192++`]]
  591. :toInt184: pass:normal[xref:#SafeCast-toInt184-int256-[`++toInt184++`]]
  592. :toInt176: pass:normal[xref:#SafeCast-toInt176-int256-[`++toInt176++`]]
  593. :toInt168: pass:normal[xref:#SafeCast-toInt168-int256-[`++toInt168++`]]
  594. :toInt160: pass:normal[xref:#SafeCast-toInt160-int256-[`++toInt160++`]]
  595. :toInt152: pass:normal[xref:#SafeCast-toInt152-int256-[`++toInt152++`]]
  596. :toInt144: pass:normal[xref:#SafeCast-toInt144-int256-[`++toInt144++`]]
  597. :toInt136: pass:normal[xref:#SafeCast-toInt136-int256-[`++toInt136++`]]
  598. :toInt128: pass:normal[xref:#SafeCast-toInt128-int256-[`++toInt128++`]]
  599. :toInt120: pass:normal[xref:#SafeCast-toInt120-int256-[`++toInt120++`]]
  600. :toInt112: pass:normal[xref:#SafeCast-toInt112-int256-[`++toInt112++`]]
  601. :toInt104: pass:normal[xref:#SafeCast-toInt104-int256-[`++toInt104++`]]
  602. :toInt96: pass:normal[xref:#SafeCast-toInt96-int256-[`++toInt96++`]]
  603. :toInt88: pass:normal[xref:#SafeCast-toInt88-int256-[`++toInt88++`]]
  604. :toInt80: pass:normal[xref:#SafeCast-toInt80-int256-[`++toInt80++`]]
  605. :toInt72: pass:normal[xref:#SafeCast-toInt72-int256-[`++toInt72++`]]
  606. :toInt64: pass:normal[xref:#SafeCast-toInt64-int256-[`++toInt64++`]]
  607. :toInt56: pass:normal[xref:#SafeCast-toInt56-int256-[`++toInt56++`]]
  608. :toInt48: pass:normal[xref:#SafeCast-toInt48-int256-[`++toInt48++`]]
  609. :toInt40: pass:normal[xref:#SafeCast-toInt40-int256-[`++toInt40++`]]
  610. :toInt32: pass:normal[xref:#SafeCast-toInt32-int256-[`++toInt32++`]]
  611. :toInt24: pass:normal[xref:#SafeCast-toInt24-int256-[`++toInt24++`]]
  612. :toInt16: pass:normal[xref:#SafeCast-toInt16-int256-[`++toInt16++`]]
  613. :toInt8: pass:normal[xref:#SafeCast-toInt8-int256-[`++toInt8++`]]
  614. :toInt256: pass:normal[xref:#SafeCast-toInt256-uint256-[`++toInt256++`]]
  615. [.contract]
  616. [[SafeCast]]
  617. === `++SafeCast++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/math/SafeCast.sol[{github-icon},role=heading-link]
  618. [.hljs-theme-light.nopadding]
  619. ```solidity
  620. import "@openzeppelin/contracts/utils/math/SafeCast.sol";
  621. ```
  622. Wrappers over Solidity's uintXX/intXX casting operators with added overflow
  623. checks.
  624. Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
  625. easily result in undesired exploitation or bugs, since developers usually
  626. assume that overflows raise errors. `SafeCast` restores this intuition by
  627. reverting the transaction when such an operation overflows.
  628. Using this library instead of the unchecked operations eliminates an entire
  629. class of bugs, so it's recommended to use it always.
  630. [.contract-index]
  631. .Functions
  632. --
  633. * {xref-SafeCast-toUint248-uint256-}[`++toUint248(value)++`]
  634. * {xref-SafeCast-toUint240-uint256-}[`++toUint240(value)++`]
  635. * {xref-SafeCast-toUint232-uint256-}[`++toUint232(value)++`]
  636. * {xref-SafeCast-toUint224-uint256-}[`++toUint224(value)++`]
  637. * {xref-SafeCast-toUint216-uint256-}[`++toUint216(value)++`]
  638. * {xref-SafeCast-toUint208-uint256-}[`++toUint208(value)++`]
  639. * {xref-SafeCast-toUint200-uint256-}[`++toUint200(value)++`]
  640. * {xref-SafeCast-toUint192-uint256-}[`++toUint192(value)++`]
  641. * {xref-SafeCast-toUint184-uint256-}[`++toUint184(value)++`]
  642. * {xref-SafeCast-toUint176-uint256-}[`++toUint176(value)++`]
  643. * {xref-SafeCast-toUint168-uint256-}[`++toUint168(value)++`]
  644. * {xref-SafeCast-toUint160-uint256-}[`++toUint160(value)++`]
  645. * {xref-SafeCast-toUint152-uint256-}[`++toUint152(value)++`]
  646. * {xref-SafeCast-toUint144-uint256-}[`++toUint144(value)++`]
  647. * {xref-SafeCast-toUint136-uint256-}[`++toUint136(value)++`]
  648. * {xref-SafeCast-toUint128-uint256-}[`++toUint128(value)++`]
  649. * {xref-SafeCast-toUint120-uint256-}[`++toUint120(value)++`]
  650. * {xref-SafeCast-toUint112-uint256-}[`++toUint112(value)++`]
  651. * {xref-SafeCast-toUint104-uint256-}[`++toUint104(value)++`]
  652. * {xref-SafeCast-toUint96-uint256-}[`++toUint96(value)++`]
  653. * {xref-SafeCast-toUint88-uint256-}[`++toUint88(value)++`]
  654. * {xref-SafeCast-toUint80-uint256-}[`++toUint80(value)++`]
  655. * {xref-SafeCast-toUint72-uint256-}[`++toUint72(value)++`]
  656. * {xref-SafeCast-toUint64-uint256-}[`++toUint64(value)++`]
  657. * {xref-SafeCast-toUint56-uint256-}[`++toUint56(value)++`]
  658. * {xref-SafeCast-toUint48-uint256-}[`++toUint48(value)++`]
  659. * {xref-SafeCast-toUint40-uint256-}[`++toUint40(value)++`]
  660. * {xref-SafeCast-toUint32-uint256-}[`++toUint32(value)++`]
  661. * {xref-SafeCast-toUint24-uint256-}[`++toUint24(value)++`]
  662. * {xref-SafeCast-toUint16-uint256-}[`++toUint16(value)++`]
  663. * {xref-SafeCast-toUint8-uint256-}[`++toUint8(value)++`]
  664. * {xref-SafeCast-toUint256-int256-}[`++toUint256(value)++`]
  665. * {xref-SafeCast-toInt248-int256-}[`++toInt248(value)++`]
  666. * {xref-SafeCast-toInt240-int256-}[`++toInt240(value)++`]
  667. * {xref-SafeCast-toInt232-int256-}[`++toInt232(value)++`]
  668. * {xref-SafeCast-toInt224-int256-}[`++toInt224(value)++`]
  669. * {xref-SafeCast-toInt216-int256-}[`++toInt216(value)++`]
  670. * {xref-SafeCast-toInt208-int256-}[`++toInt208(value)++`]
  671. * {xref-SafeCast-toInt200-int256-}[`++toInt200(value)++`]
  672. * {xref-SafeCast-toInt192-int256-}[`++toInt192(value)++`]
  673. * {xref-SafeCast-toInt184-int256-}[`++toInt184(value)++`]
  674. * {xref-SafeCast-toInt176-int256-}[`++toInt176(value)++`]
  675. * {xref-SafeCast-toInt168-int256-}[`++toInt168(value)++`]
  676. * {xref-SafeCast-toInt160-int256-}[`++toInt160(value)++`]
  677. * {xref-SafeCast-toInt152-int256-}[`++toInt152(value)++`]
  678. * {xref-SafeCast-toInt144-int256-}[`++toInt144(value)++`]
  679. * {xref-SafeCast-toInt136-int256-}[`++toInt136(value)++`]
  680. * {xref-SafeCast-toInt128-int256-}[`++toInt128(value)++`]
  681. * {xref-SafeCast-toInt120-int256-}[`++toInt120(value)++`]
  682. * {xref-SafeCast-toInt112-int256-}[`++toInt112(value)++`]
  683. * {xref-SafeCast-toInt104-int256-}[`++toInt104(value)++`]
  684. * {xref-SafeCast-toInt96-int256-}[`++toInt96(value)++`]
  685. * {xref-SafeCast-toInt88-int256-}[`++toInt88(value)++`]
  686. * {xref-SafeCast-toInt80-int256-}[`++toInt80(value)++`]
  687. * {xref-SafeCast-toInt72-int256-}[`++toInt72(value)++`]
  688. * {xref-SafeCast-toInt64-int256-}[`++toInt64(value)++`]
  689. * {xref-SafeCast-toInt56-int256-}[`++toInt56(value)++`]
  690. * {xref-SafeCast-toInt48-int256-}[`++toInt48(value)++`]
  691. * {xref-SafeCast-toInt40-int256-}[`++toInt40(value)++`]
  692. * {xref-SafeCast-toInt32-int256-}[`++toInt32(value)++`]
  693. * {xref-SafeCast-toInt24-int256-}[`++toInt24(value)++`]
  694. * {xref-SafeCast-toInt16-int256-}[`++toInt16(value)++`]
  695. * {xref-SafeCast-toInt8-int256-}[`++toInt8(value)++`]
  696. * {xref-SafeCast-toInt256-uint256-}[`++toInt256(value)++`]
  697. --
  698. [.contract-index]
  699. .Errors
  700. --
  701. * {xref-SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-}[`++SafeCastOverflowedUintDowncast(bits, value)++`]
  702. * {xref-SafeCast-SafeCastOverflowedIntToUint-int256-}[`++SafeCastOverflowedIntToUint(value)++`]
  703. * {xref-SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-}[`++SafeCastOverflowedIntDowncast(bits, value)++`]
  704. * {xref-SafeCast-SafeCastOverflowedUintToInt-uint256-}[`++SafeCastOverflowedUintToInt(value)++`]
  705. --
  706. [.contract-item]
  707. [[SafeCast-toUint248-uint256-]]
  708. ==== `[.contract-item-name]#++toUint248++#++(uint256 value) → uint248++` [.item-kind]#internal#
  709. Returns the downcasted uint248 from uint256, reverting on
  710. overflow (when the input is greater than largest uint248).
  711. Counterpart to Solidity's `uint248` operator.
  712. Requirements:
  713. - input must fit into 248 bits
  714. [.contract-item]
  715. [[SafeCast-toUint240-uint256-]]
  716. ==== `[.contract-item-name]#++toUint240++#++(uint256 value) → uint240++` [.item-kind]#internal#
  717. Returns the downcasted uint240 from uint256, reverting on
  718. overflow (when the input is greater than largest uint240).
  719. Counterpart to Solidity's `uint240` operator.
  720. Requirements:
  721. - input must fit into 240 bits
  722. [.contract-item]
  723. [[SafeCast-toUint232-uint256-]]
  724. ==== `[.contract-item-name]#++toUint232++#++(uint256 value) → uint232++` [.item-kind]#internal#
  725. Returns the downcasted uint232 from uint256, reverting on
  726. overflow (when the input is greater than largest uint232).
  727. Counterpart to Solidity's `uint232` operator.
  728. Requirements:
  729. - input must fit into 232 bits
  730. [.contract-item]
  731. [[SafeCast-toUint224-uint256-]]
  732. ==== `[.contract-item-name]#++toUint224++#++(uint256 value) → uint224++` [.item-kind]#internal#
  733. Returns the downcasted uint224 from uint256, reverting on
  734. overflow (when the input is greater than largest uint224).
  735. Counterpart to Solidity's `uint224` operator.
  736. Requirements:
  737. - input must fit into 224 bits
  738. [.contract-item]
  739. [[SafeCast-toUint216-uint256-]]
  740. ==== `[.contract-item-name]#++toUint216++#++(uint256 value) → uint216++` [.item-kind]#internal#
  741. Returns the downcasted uint216 from uint256, reverting on
  742. overflow (when the input is greater than largest uint216).
  743. Counterpart to Solidity's `uint216` operator.
  744. Requirements:
  745. - input must fit into 216 bits
  746. [.contract-item]
  747. [[SafeCast-toUint208-uint256-]]
  748. ==== `[.contract-item-name]#++toUint208++#++(uint256 value) → uint208++` [.item-kind]#internal#
  749. Returns the downcasted uint208 from uint256, reverting on
  750. overflow (when the input is greater than largest uint208).
  751. Counterpart to Solidity's `uint208` operator.
  752. Requirements:
  753. - input must fit into 208 bits
  754. [.contract-item]
  755. [[SafeCast-toUint200-uint256-]]
  756. ==== `[.contract-item-name]#++toUint200++#++(uint256 value) → uint200++` [.item-kind]#internal#
  757. Returns the downcasted uint200 from uint256, reverting on
  758. overflow (when the input is greater than largest uint200).
  759. Counterpart to Solidity's `uint200` operator.
  760. Requirements:
  761. - input must fit into 200 bits
  762. [.contract-item]
  763. [[SafeCast-toUint192-uint256-]]
  764. ==== `[.contract-item-name]#++toUint192++#++(uint256 value) → uint192++` [.item-kind]#internal#
  765. Returns the downcasted uint192 from uint256, reverting on
  766. overflow (when the input is greater than largest uint192).
  767. Counterpart to Solidity's `uint192` operator.
  768. Requirements:
  769. - input must fit into 192 bits
  770. [.contract-item]
  771. [[SafeCast-toUint184-uint256-]]
  772. ==== `[.contract-item-name]#++toUint184++#++(uint256 value) → uint184++` [.item-kind]#internal#
  773. Returns the downcasted uint184 from uint256, reverting on
  774. overflow (when the input is greater than largest uint184).
  775. Counterpart to Solidity's `uint184` operator.
  776. Requirements:
  777. - input must fit into 184 bits
  778. [.contract-item]
  779. [[SafeCast-toUint176-uint256-]]
  780. ==== `[.contract-item-name]#++toUint176++#++(uint256 value) → uint176++` [.item-kind]#internal#
  781. Returns the downcasted uint176 from uint256, reverting on
  782. overflow (when the input is greater than largest uint176).
  783. Counterpart to Solidity's `uint176` operator.
  784. Requirements:
  785. - input must fit into 176 bits
  786. [.contract-item]
  787. [[SafeCast-toUint168-uint256-]]
  788. ==== `[.contract-item-name]#++toUint168++#++(uint256 value) → uint168++` [.item-kind]#internal#
  789. Returns the downcasted uint168 from uint256, reverting on
  790. overflow (when the input is greater than largest uint168).
  791. Counterpart to Solidity's `uint168` operator.
  792. Requirements:
  793. - input must fit into 168 bits
  794. [.contract-item]
  795. [[SafeCast-toUint160-uint256-]]
  796. ==== `[.contract-item-name]#++toUint160++#++(uint256 value) → uint160++` [.item-kind]#internal#
  797. Returns the downcasted uint160 from uint256, reverting on
  798. overflow (when the input is greater than largest uint160).
  799. Counterpart to Solidity's `uint160` operator.
  800. Requirements:
  801. - input must fit into 160 bits
  802. [.contract-item]
  803. [[SafeCast-toUint152-uint256-]]
  804. ==== `[.contract-item-name]#++toUint152++#++(uint256 value) → uint152++` [.item-kind]#internal#
  805. Returns the downcasted uint152 from uint256, reverting on
  806. overflow (when the input is greater than largest uint152).
  807. Counterpart to Solidity's `uint152` operator.
  808. Requirements:
  809. - input must fit into 152 bits
  810. [.contract-item]
  811. [[SafeCast-toUint144-uint256-]]
  812. ==== `[.contract-item-name]#++toUint144++#++(uint256 value) → uint144++` [.item-kind]#internal#
  813. Returns the downcasted uint144 from uint256, reverting on
  814. overflow (when the input is greater than largest uint144).
  815. Counterpart to Solidity's `uint144` operator.
  816. Requirements:
  817. - input must fit into 144 bits
  818. [.contract-item]
  819. [[SafeCast-toUint136-uint256-]]
  820. ==== `[.contract-item-name]#++toUint136++#++(uint256 value) → uint136++` [.item-kind]#internal#
  821. Returns the downcasted uint136 from uint256, reverting on
  822. overflow (when the input is greater than largest uint136).
  823. Counterpart to Solidity's `uint136` operator.
  824. Requirements:
  825. - input must fit into 136 bits
  826. [.contract-item]
  827. [[SafeCast-toUint128-uint256-]]
  828. ==== `[.contract-item-name]#++toUint128++#++(uint256 value) → uint128++` [.item-kind]#internal#
  829. Returns the downcasted uint128 from uint256, reverting on
  830. overflow (when the input is greater than largest uint128).
  831. Counterpart to Solidity's `uint128` operator.
  832. Requirements:
  833. - input must fit into 128 bits
  834. [.contract-item]
  835. [[SafeCast-toUint120-uint256-]]
  836. ==== `[.contract-item-name]#++toUint120++#++(uint256 value) → uint120++` [.item-kind]#internal#
  837. Returns the downcasted uint120 from uint256, reverting on
  838. overflow (when the input is greater than largest uint120).
  839. Counterpart to Solidity's `uint120` operator.
  840. Requirements:
  841. - input must fit into 120 bits
  842. [.contract-item]
  843. [[SafeCast-toUint112-uint256-]]
  844. ==== `[.contract-item-name]#++toUint112++#++(uint256 value) → uint112++` [.item-kind]#internal#
  845. Returns the downcasted uint112 from uint256, reverting on
  846. overflow (when the input is greater than largest uint112).
  847. Counterpart to Solidity's `uint112` operator.
  848. Requirements:
  849. - input must fit into 112 bits
  850. [.contract-item]
  851. [[SafeCast-toUint104-uint256-]]
  852. ==== `[.contract-item-name]#++toUint104++#++(uint256 value) → uint104++` [.item-kind]#internal#
  853. Returns the downcasted uint104 from uint256, reverting on
  854. overflow (when the input is greater than largest uint104).
  855. Counterpart to Solidity's `uint104` operator.
  856. Requirements:
  857. - input must fit into 104 bits
  858. [.contract-item]
  859. [[SafeCast-toUint96-uint256-]]
  860. ==== `[.contract-item-name]#++toUint96++#++(uint256 value) → uint96++` [.item-kind]#internal#
  861. Returns the downcasted uint96 from uint256, reverting on
  862. overflow (when the input is greater than largest uint96).
  863. Counterpart to Solidity's `uint96` operator.
  864. Requirements:
  865. - input must fit into 96 bits
  866. [.contract-item]
  867. [[SafeCast-toUint88-uint256-]]
  868. ==== `[.contract-item-name]#++toUint88++#++(uint256 value) → uint88++` [.item-kind]#internal#
  869. Returns the downcasted uint88 from uint256, reverting on
  870. overflow (when the input is greater than largest uint88).
  871. Counterpart to Solidity's `uint88` operator.
  872. Requirements:
  873. - input must fit into 88 bits
  874. [.contract-item]
  875. [[SafeCast-toUint80-uint256-]]
  876. ==== `[.contract-item-name]#++toUint80++#++(uint256 value) → uint80++` [.item-kind]#internal#
  877. Returns the downcasted uint80 from uint256, reverting on
  878. overflow (when the input is greater than largest uint80).
  879. Counterpart to Solidity's `uint80` operator.
  880. Requirements:
  881. - input must fit into 80 bits
  882. [.contract-item]
  883. [[SafeCast-toUint72-uint256-]]
  884. ==== `[.contract-item-name]#++toUint72++#++(uint256 value) → uint72++` [.item-kind]#internal#
  885. Returns the downcasted uint72 from uint256, reverting on
  886. overflow (when the input is greater than largest uint72).
  887. Counterpart to Solidity's `uint72` operator.
  888. Requirements:
  889. - input must fit into 72 bits
  890. [.contract-item]
  891. [[SafeCast-toUint64-uint256-]]
  892. ==== `[.contract-item-name]#++toUint64++#++(uint256 value) → uint64++` [.item-kind]#internal#
  893. Returns the downcasted uint64 from uint256, reverting on
  894. overflow (when the input is greater than largest uint64).
  895. Counterpart to Solidity's `uint64` operator.
  896. Requirements:
  897. - input must fit into 64 bits
  898. [.contract-item]
  899. [[SafeCast-toUint56-uint256-]]
  900. ==== `[.contract-item-name]#++toUint56++#++(uint256 value) → uint56++` [.item-kind]#internal#
  901. Returns the downcasted uint56 from uint256, reverting on
  902. overflow (when the input is greater than largest uint56).
  903. Counterpart to Solidity's `uint56` operator.
  904. Requirements:
  905. - input must fit into 56 bits
  906. [.contract-item]
  907. [[SafeCast-toUint48-uint256-]]
  908. ==== `[.contract-item-name]#++toUint48++#++(uint256 value) → uint48++` [.item-kind]#internal#
  909. Returns the downcasted uint48 from uint256, reverting on
  910. overflow (when the input is greater than largest uint48).
  911. Counterpart to Solidity's `uint48` operator.
  912. Requirements:
  913. - input must fit into 48 bits
  914. [.contract-item]
  915. [[SafeCast-toUint40-uint256-]]
  916. ==== `[.contract-item-name]#++toUint40++#++(uint256 value) → uint40++` [.item-kind]#internal#
  917. Returns the downcasted uint40 from uint256, reverting on
  918. overflow (when the input is greater than largest uint40).
  919. Counterpart to Solidity's `uint40` operator.
  920. Requirements:
  921. - input must fit into 40 bits
  922. [.contract-item]
  923. [[SafeCast-toUint32-uint256-]]
  924. ==== `[.contract-item-name]#++toUint32++#++(uint256 value) → uint32++` [.item-kind]#internal#
  925. Returns the downcasted uint32 from uint256, reverting on
  926. overflow (when the input is greater than largest uint32).
  927. Counterpart to Solidity's `uint32` operator.
  928. Requirements:
  929. - input must fit into 32 bits
  930. [.contract-item]
  931. [[SafeCast-toUint24-uint256-]]
  932. ==== `[.contract-item-name]#++toUint24++#++(uint256 value) → uint24++` [.item-kind]#internal#
  933. Returns the downcasted uint24 from uint256, reverting on
  934. overflow (when the input is greater than largest uint24).
  935. Counterpart to Solidity's `uint24` operator.
  936. Requirements:
  937. - input must fit into 24 bits
  938. [.contract-item]
  939. [[SafeCast-toUint16-uint256-]]
  940. ==== `[.contract-item-name]#++toUint16++#++(uint256 value) → uint16++` [.item-kind]#internal#
  941. Returns the downcasted uint16 from uint256, reverting on
  942. overflow (when the input is greater than largest uint16).
  943. Counterpart to Solidity's `uint16` operator.
  944. Requirements:
  945. - input must fit into 16 bits
  946. [.contract-item]
  947. [[SafeCast-toUint8-uint256-]]
  948. ==== `[.contract-item-name]#++toUint8++#++(uint256 value) → uint8++` [.item-kind]#internal#
  949. Returns the downcasted uint8 from uint256, reverting on
  950. overflow (when the input is greater than largest uint8).
  951. Counterpart to Solidity's `uint8` operator.
  952. Requirements:
  953. - input must fit into 8 bits
  954. [.contract-item]
  955. [[SafeCast-toUint256-int256-]]
  956. ==== `[.contract-item-name]#++toUint256++#++(int256 value) → uint256++` [.item-kind]#internal#
  957. Converts a signed int256 into an unsigned uint256.
  958. Requirements:
  959. - input must be greater than or equal to 0.
  960. [.contract-item]
  961. [[SafeCast-toInt248-int256-]]
  962. ==== `[.contract-item-name]#++toInt248++#++(int256 value) → int248 downcasted++` [.item-kind]#internal#
  963. Returns the downcasted int248 from int256, reverting on
  964. overflow (when the input is less than smallest int248 or
  965. greater than largest int248).
  966. Counterpart to Solidity's `int248` operator.
  967. Requirements:
  968. - input must fit into 248 bits
  969. [.contract-item]
  970. [[SafeCast-toInt240-int256-]]
  971. ==== `[.contract-item-name]#++toInt240++#++(int256 value) → int240 downcasted++` [.item-kind]#internal#
  972. Returns the downcasted int240 from int256, reverting on
  973. overflow (when the input is less than smallest int240 or
  974. greater than largest int240).
  975. Counterpart to Solidity's `int240` operator.
  976. Requirements:
  977. - input must fit into 240 bits
  978. [.contract-item]
  979. [[SafeCast-toInt232-int256-]]
  980. ==== `[.contract-item-name]#++toInt232++#++(int256 value) → int232 downcasted++` [.item-kind]#internal#
  981. Returns the downcasted int232 from int256, reverting on
  982. overflow (when the input is less than smallest int232 or
  983. greater than largest int232).
  984. Counterpart to Solidity's `int232` operator.
  985. Requirements:
  986. - input must fit into 232 bits
  987. [.contract-item]
  988. [[SafeCast-toInt224-int256-]]
  989. ==== `[.contract-item-name]#++toInt224++#++(int256 value) → int224 downcasted++` [.item-kind]#internal#
  990. Returns the downcasted int224 from int256, reverting on
  991. overflow (when the input is less than smallest int224 or
  992. greater than largest int224).
  993. Counterpart to Solidity's `int224` operator.
  994. Requirements:
  995. - input must fit into 224 bits
  996. [.contract-item]
  997. [[SafeCast-toInt216-int256-]]
  998. ==== `[.contract-item-name]#++toInt216++#++(int256 value) → int216 downcasted++` [.item-kind]#internal#
  999. Returns the downcasted int216 from int256, reverting on
  1000. overflow (when the input is less than smallest int216 or
  1001. greater than largest int216).
  1002. Counterpart to Solidity's `int216` operator.
  1003. Requirements:
  1004. - input must fit into 216 bits
  1005. [.contract-item]
  1006. [[SafeCast-toInt208-int256-]]
  1007. ==== `[.contract-item-name]#++toInt208++#++(int256 value) → int208 downcasted++` [.item-kind]#internal#
  1008. Returns the downcasted int208 from int256, reverting on
  1009. overflow (when the input is less than smallest int208 or
  1010. greater than largest int208).
  1011. Counterpart to Solidity's `int208` operator.
  1012. Requirements:
  1013. - input must fit into 208 bits
  1014. [.contract-item]
  1015. [[SafeCast-toInt200-int256-]]
  1016. ==== `[.contract-item-name]#++toInt200++#++(int256 value) → int200 downcasted++` [.item-kind]#internal#
  1017. Returns the downcasted int200 from int256, reverting on
  1018. overflow (when the input is less than smallest int200 or
  1019. greater than largest int200).
  1020. Counterpart to Solidity's `int200` operator.
  1021. Requirements:
  1022. - input must fit into 200 bits
  1023. [.contract-item]
  1024. [[SafeCast-toInt192-int256-]]
  1025. ==== `[.contract-item-name]#++toInt192++#++(int256 value) → int192 downcasted++` [.item-kind]#internal#
  1026. Returns the downcasted int192 from int256, reverting on
  1027. overflow (when the input is less than smallest int192 or
  1028. greater than largest int192).
  1029. Counterpart to Solidity's `int192` operator.
  1030. Requirements:
  1031. - input must fit into 192 bits
  1032. [.contract-item]
  1033. [[SafeCast-toInt184-int256-]]
  1034. ==== `[.contract-item-name]#++toInt184++#++(int256 value) → int184 downcasted++` [.item-kind]#internal#
  1035. Returns the downcasted int184 from int256, reverting on
  1036. overflow (when the input is less than smallest int184 or
  1037. greater than largest int184).
  1038. Counterpart to Solidity's `int184` operator.
  1039. Requirements:
  1040. - input must fit into 184 bits
  1041. [.contract-item]
  1042. [[SafeCast-toInt176-int256-]]
  1043. ==== `[.contract-item-name]#++toInt176++#++(int256 value) → int176 downcasted++` [.item-kind]#internal#
  1044. Returns the downcasted int176 from int256, reverting on
  1045. overflow (when the input is less than smallest int176 or
  1046. greater than largest int176).
  1047. Counterpart to Solidity's `int176` operator.
  1048. Requirements:
  1049. - input must fit into 176 bits
  1050. [.contract-item]
  1051. [[SafeCast-toInt168-int256-]]
  1052. ==== `[.contract-item-name]#++toInt168++#++(int256 value) → int168 downcasted++` [.item-kind]#internal#
  1053. Returns the downcasted int168 from int256, reverting on
  1054. overflow (when the input is less than smallest int168 or
  1055. greater than largest int168).
  1056. Counterpart to Solidity's `int168` operator.
  1057. Requirements:
  1058. - input must fit into 168 bits
  1059. [.contract-item]
  1060. [[SafeCast-toInt160-int256-]]
  1061. ==== `[.contract-item-name]#++toInt160++#++(int256 value) → int160 downcasted++` [.item-kind]#internal#
  1062. Returns the downcasted int160 from int256, reverting on
  1063. overflow (when the input is less than smallest int160 or
  1064. greater than largest int160).
  1065. Counterpart to Solidity's `int160` operator.
  1066. Requirements:
  1067. - input must fit into 160 bits
  1068. [.contract-item]
  1069. [[SafeCast-toInt152-int256-]]
  1070. ==== `[.contract-item-name]#++toInt152++#++(int256 value) → int152 downcasted++` [.item-kind]#internal#
  1071. Returns the downcasted int152 from int256, reverting on
  1072. overflow (when the input is less than smallest int152 or
  1073. greater than largest int152).
  1074. Counterpart to Solidity's `int152` operator.
  1075. Requirements:
  1076. - input must fit into 152 bits
  1077. [.contract-item]
  1078. [[SafeCast-toInt144-int256-]]
  1079. ==== `[.contract-item-name]#++toInt144++#++(int256 value) → int144 downcasted++` [.item-kind]#internal#
  1080. Returns the downcasted int144 from int256, reverting on
  1081. overflow (when the input is less than smallest int144 or
  1082. greater than largest int144).
  1083. Counterpart to Solidity's `int144` operator.
  1084. Requirements:
  1085. - input must fit into 144 bits
  1086. [.contract-item]
  1087. [[SafeCast-toInt136-int256-]]
  1088. ==== `[.contract-item-name]#++toInt136++#++(int256 value) → int136 downcasted++` [.item-kind]#internal#
  1089. Returns the downcasted int136 from int256, reverting on
  1090. overflow (when the input is less than smallest int136 or
  1091. greater than largest int136).
  1092. Counterpart to Solidity's `int136` operator.
  1093. Requirements:
  1094. - input must fit into 136 bits
  1095. [.contract-item]
  1096. [[SafeCast-toInt128-int256-]]
  1097. ==== `[.contract-item-name]#++toInt128++#++(int256 value) → int128 downcasted++` [.item-kind]#internal#
  1098. Returns the downcasted int128 from int256, reverting on
  1099. overflow (when the input is less than smallest int128 or
  1100. greater than largest int128).
  1101. Counterpart to Solidity's `int128` operator.
  1102. Requirements:
  1103. - input must fit into 128 bits
  1104. [.contract-item]
  1105. [[SafeCast-toInt120-int256-]]
  1106. ==== `[.contract-item-name]#++toInt120++#++(int256 value) → int120 downcasted++` [.item-kind]#internal#
  1107. Returns the downcasted int120 from int256, reverting on
  1108. overflow (when the input is less than smallest int120 or
  1109. greater than largest int120).
  1110. Counterpart to Solidity's `int120` operator.
  1111. Requirements:
  1112. - input must fit into 120 bits
  1113. [.contract-item]
  1114. [[SafeCast-toInt112-int256-]]
  1115. ==== `[.contract-item-name]#++toInt112++#++(int256 value) → int112 downcasted++` [.item-kind]#internal#
  1116. Returns the downcasted int112 from int256, reverting on
  1117. overflow (when the input is less than smallest int112 or
  1118. greater than largest int112).
  1119. Counterpart to Solidity's `int112` operator.
  1120. Requirements:
  1121. - input must fit into 112 bits
  1122. [.contract-item]
  1123. [[SafeCast-toInt104-int256-]]
  1124. ==== `[.contract-item-name]#++toInt104++#++(int256 value) → int104 downcasted++` [.item-kind]#internal#
  1125. Returns the downcasted int104 from int256, reverting on
  1126. overflow (when the input is less than smallest int104 or
  1127. greater than largest int104).
  1128. Counterpart to Solidity's `int104` operator.
  1129. Requirements:
  1130. - input must fit into 104 bits
  1131. [.contract-item]
  1132. [[SafeCast-toInt96-int256-]]
  1133. ==== `[.contract-item-name]#++toInt96++#++(int256 value) → int96 downcasted++` [.item-kind]#internal#
  1134. Returns the downcasted int96 from int256, reverting on
  1135. overflow (when the input is less than smallest int96 or
  1136. greater than largest int96).
  1137. Counterpart to Solidity's `int96` operator.
  1138. Requirements:
  1139. - input must fit into 96 bits
  1140. [.contract-item]
  1141. [[SafeCast-toInt88-int256-]]
  1142. ==== `[.contract-item-name]#++toInt88++#++(int256 value) → int88 downcasted++` [.item-kind]#internal#
  1143. Returns the downcasted int88 from int256, reverting on
  1144. overflow (when the input is less than smallest int88 or
  1145. greater than largest int88).
  1146. Counterpart to Solidity's `int88` operator.
  1147. Requirements:
  1148. - input must fit into 88 bits
  1149. [.contract-item]
  1150. [[SafeCast-toInt80-int256-]]
  1151. ==== `[.contract-item-name]#++toInt80++#++(int256 value) → int80 downcasted++` [.item-kind]#internal#
  1152. Returns the downcasted int80 from int256, reverting on
  1153. overflow (when the input is less than smallest int80 or
  1154. greater than largest int80).
  1155. Counterpart to Solidity's `int80` operator.
  1156. Requirements:
  1157. - input must fit into 80 bits
  1158. [.contract-item]
  1159. [[SafeCast-toInt72-int256-]]
  1160. ==== `[.contract-item-name]#++toInt72++#++(int256 value) → int72 downcasted++` [.item-kind]#internal#
  1161. Returns the downcasted int72 from int256, reverting on
  1162. overflow (when the input is less than smallest int72 or
  1163. greater than largest int72).
  1164. Counterpart to Solidity's `int72` operator.
  1165. Requirements:
  1166. - input must fit into 72 bits
  1167. [.contract-item]
  1168. [[SafeCast-toInt64-int256-]]
  1169. ==== `[.contract-item-name]#++toInt64++#++(int256 value) → int64 downcasted++` [.item-kind]#internal#
  1170. Returns the downcasted int64 from int256, reverting on
  1171. overflow (when the input is less than smallest int64 or
  1172. greater than largest int64).
  1173. Counterpart to Solidity's `int64` operator.
  1174. Requirements:
  1175. - input must fit into 64 bits
  1176. [.contract-item]
  1177. [[SafeCast-toInt56-int256-]]
  1178. ==== `[.contract-item-name]#++toInt56++#++(int256 value) → int56 downcasted++` [.item-kind]#internal#
  1179. Returns the downcasted int56 from int256, reverting on
  1180. overflow (when the input is less than smallest int56 or
  1181. greater than largest int56).
  1182. Counterpart to Solidity's `int56` operator.
  1183. Requirements:
  1184. - input must fit into 56 bits
  1185. [.contract-item]
  1186. [[SafeCast-toInt48-int256-]]
  1187. ==== `[.contract-item-name]#++toInt48++#++(int256 value) → int48 downcasted++` [.item-kind]#internal#
  1188. Returns the downcasted int48 from int256, reverting on
  1189. overflow (when the input is less than smallest int48 or
  1190. greater than largest int48).
  1191. Counterpart to Solidity's `int48` operator.
  1192. Requirements:
  1193. - input must fit into 48 bits
  1194. [.contract-item]
  1195. [[SafeCast-toInt40-int256-]]
  1196. ==== `[.contract-item-name]#++toInt40++#++(int256 value) → int40 downcasted++` [.item-kind]#internal#
  1197. Returns the downcasted int40 from int256, reverting on
  1198. overflow (when the input is less than smallest int40 or
  1199. greater than largest int40).
  1200. Counterpart to Solidity's `int40` operator.
  1201. Requirements:
  1202. - input must fit into 40 bits
  1203. [.contract-item]
  1204. [[SafeCast-toInt32-int256-]]
  1205. ==== `[.contract-item-name]#++toInt32++#++(int256 value) → int32 downcasted++` [.item-kind]#internal#
  1206. Returns the downcasted int32 from int256, reverting on
  1207. overflow (when the input is less than smallest int32 or
  1208. greater than largest int32).
  1209. Counterpart to Solidity's `int32` operator.
  1210. Requirements:
  1211. - input must fit into 32 bits
  1212. [.contract-item]
  1213. [[SafeCast-toInt24-int256-]]
  1214. ==== `[.contract-item-name]#++toInt24++#++(int256 value) → int24 downcasted++` [.item-kind]#internal#
  1215. Returns the downcasted int24 from int256, reverting on
  1216. overflow (when the input is less than smallest int24 or
  1217. greater than largest int24).
  1218. Counterpart to Solidity's `int24` operator.
  1219. Requirements:
  1220. - input must fit into 24 bits
  1221. [.contract-item]
  1222. [[SafeCast-toInt16-int256-]]
  1223. ==== `[.contract-item-name]#++toInt16++#++(int256 value) → int16 downcasted++` [.item-kind]#internal#
  1224. Returns the downcasted int16 from int256, reverting on
  1225. overflow (when the input is less than smallest int16 or
  1226. greater than largest int16).
  1227. Counterpart to Solidity's `int16` operator.
  1228. Requirements:
  1229. - input must fit into 16 bits
  1230. [.contract-item]
  1231. [[SafeCast-toInt8-int256-]]
  1232. ==== `[.contract-item-name]#++toInt8++#++(int256 value) → int8 downcasted++` [.item-kind]#internal#
  1233. Returns the downcasted int8 from int256, reverting on
  1234. overflow (when the input is less than smallest int8 or
  1235. greater than largest int8).
  1236. Counterpart to Solidity's `int8` operator.
  1237. Requirements:
  1238. - input must fit into 8 bits
  1239. [.contract-item]
  1240. [[SafeCast-toInt256-uint256-]]
  1241. ==== `[.contract-item-name]#++toInt256++#++(uint256 value) → int256++` [.item-kind]#internal#
  1242. Converts an unsigned uint256 into a signed int256.
  1243. Requirements:
  1244. - input must be less than or equal to maxInt256.
  1245. [.contract-item]
  1246. [[SafeCast-SafeCastOverflowedUintDowncast-uint8-uint256-]]
  1247. ==== `[.contract-item-name]#++SafeCastOverflowedUintDowncast++#++(uint8 bits, uint256 value)++` [.item-kind]#error#
  1248. Value doesn't fit in an uint of `bits` size.
  1249. [.contract-item]
  1250. [[SafeCast-SafeCastOverflowedIntToUint-int256-]]
  1251. ==== `[.contract-item-name]#++SafeCastOverflowedIntToUint++#++(int256 value)++` [.item-kind]#error#
  1252. An int value doesn't fit in an uint of `bits` size.
  1253. [.contract-item]
  1254. [[SafeCast-SafeCastOverflowedIntDowncast-uint8-int256-]]
  1255. ==== `[.contract-item-name]#++SafeCastOverflowedIntDowncast++#++(uint8 bits, int256 value)++` [.item-kind]#error#
  1256. Value doesn't fit in an int of `bits` size.
  1257. [.contract-item]
  1258. [[SafeCast-SafeCastOverflowedUintToInt-uint256-]]
  1259. ==== `[.contract-item-name]#++SafeCastOverflowedUintToInt++#++(uint256 value)++` [.item-kind]#error#
  1260. An uint value doesn't fit in an int of `bits` size.
  1261. == Cryptography
  1262. :RecoverError: pass:normal[xref:#ECDSA-RecoverError[`++RecoverError++`]]
  1263. :ECDSAInvalidSignature: pass:normal[xref:#ECDSA-ECDSAInvalidSignature--[`++ECDSAInvalidSignature++`]]
  1264. :ECDSAInvalidSignatureLength: pass:normal[xref:#ECDSA-ECDSAInvalidSignatureLength-uint256-[`++ECDSAInvalidSignatureLength++`]]
  1265. :ECDSAInvalidSignatureS: pass:normal[xref:#ECDSA-ECDSAInvalidSignatureS-bytes32-[`++ECDSAInvalidSignatureS++`]]
  1266. :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-bytes-[`++tryRecover++`]]
  1267. :recover: pass:normal[xref:#ECDSA-recover-bytes32-bytes-[`++recover++`]]
  1268. :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-bytes32-bytes32-[`++tryRecover++`]]
  1269. :recover: pass:normal[xref:#ECDSA-recover-bytes32-bytes32-bytes32-[`++recover++`]]
  1270. :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`++tryRecover++`]]
  1271. :recover: pass:normal[xref:#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`++recover++`]]
  1272. [.contract]
  1273. [[ECDSA]]
  1274. === `++ECDSA++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/cryptography/ECDSA.sol[{github-icon},role=heading-link]
  1275. [.hljs-theme-light.nopadding]
  1276. ```solidity
  1277. import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
  1278. ```
  1279. Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
  1280. These functions can be used to verify that a message was signed by the holder
  1281. of the private keys of a given address.
  1282. [.contract-index]
  1283. .Functions
  1284. --
  1285. * {xref-ECDSA-tryRecover-bytes32-bytes-}[`++tryRecover(hash, signature)++`]
  1286. * {xref-ECDSA-recover-bytes32-bytes-}[`++recover(hash, signature)++`]
  1287. * {xref-ECDSA-tryRecover-bytes32-bytes32-bytes32-}[`++tryRecover(hash, r, vs)++`]
  1288. * {xref-ECDSA-recover-bytes32-bytes32-bytes32-}[`++recover(hash, r, vs)++`]
  1289. * {xref-ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-}[`++tryRecover(hash, v, r, s)++`]
  1290. * {xref-ECDSA-recover-bytes32-uint8-bytes32-bytes32-}[`++recover(hash, v, r, s)++`]
  1291. --
  1292. [.contract-index]
  1293. .Errors
  1294. --
  1295. * {xref-ECDSA-ECDSAInvalidSignature--}[`++ECDSAInvalidSignature()++`]
  1296. * {xref-ECDSA-ECDSAInvalidSignatureLength-uint256-}[`++ECDSAInvalidSignatureLength(length)++`]
  1297. * {xref-ECDSA-ECDSAInvalidSignatureS-bytes32-}[`++ECDSAInvalidSignatureS(s)++`]
  1298. --
  1299. [.contract-item]
  1300. [[ECDSA-tryRecover-bytes32-bytes-]]
  1301. ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, bytes signature) → address, enum ECDSA.RecoverError, bytes32++` [.item-kind]#internal#
  1302. Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
  1303. return address(0) without also returning an error description. Errors are documented using an enum (error type)
  1304. and a bytes32 providing additional information about the error.
  1305. If no error is returned, then the address can be used for verification purposes.
  1306. The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
  1307. this function rejects them by requiring the `s` value to be in the lower
  1308. half order, and the `v` value to be either 27 or 28.
  1309. IMPORTANT: `hash` _must_ be the result of a hash operation for the
  1310. verification to be secure: it is possible to craft signatures that
  1311. recover to arbitrary addresses for non-hashed data. A safe way to ensure
  1312. this is by receiving a hash of the original message (which may otherwise
  1313. be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
  1314. Documentation for signature generation:
  1315. - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
  1316. - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
  1317. [.contract-item]
  1318. [[ECDSA-recover-bytes32-bytes-]]
  1319. ==== `[.contract-item-name]#++recover++#++(bytes32 hash, bytes signature) → address++` [.item-kind]#internal#
  1320. Returns the address that signed a hashed message (`hash`) with
  1321. `signature`. This address can then be used for verification purposes.
  1322. The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
  1323. this function rejects them by requiring the `s` value to be in the lower
  1324. half order, and the `v` value to be either 27 or 28.
  1325. IMPORTANT: `hash` _must_ be the result of a hash operation for the
  1326. verification to be secure: it is possible to craft signatures that
  1327. recover to arbitrary addresses for non-hashed data. A safe way to ensure
  1328. this is by receiving a hash of the original message (which may otherwise
  1329. be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
  1330. [.contract-item]
  1331. [[ECDSA-tryRecover-bytes32-bytes32-bytes32-]]
  1332. ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, bytes32 r, bytes32 vs) → address, enum ECDSA.RecoverError, bytes32++` [.item-kind]#internal#
  1333. Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
  1334. See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
  1335. [.contract-item]
  1336. [[ECDSA-recover-bytes32-bytes32-bytes32-]]
  1337. ==== `[.contract-item-name]#++recover++#++(bytes32 hash, bytes32 r, bytes32 vs) → address++` [.item-kind]#internal#
  1338. Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
  1339. [.contract-item]
  1340. [[ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-]]
  1341. ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, uint8 v, bytes32 r, bytes32 s) → address, enum ECDSA.RecoverError, bytes32++` [.item-kind]#internal#
  1342. Overload of {ECDSA-tryRecover} that receives the `v`,
  1343. `r` and `s` signature fields separately.
  1344. [.contract-item]
  1345. [[ECDSA-recover-bytes32-uint8-bytes32-bytes32-]]
  1346. ==== `[.contract-item-name]#++recover++#++(bytes32 hash, uint8 v, bytes32 r, bytes32 s) → address++` [.item-kind]#internal#
  1347. Overload of {ECDSA-recover} that receives the `v`,
  1348. `r` and `s` signature fields separately.
  1349. [.contract-item]
  1350. [[ECDSA-ECDSAInvalidSignature--]]
  1351. ==== `[.contract-item-name]#++ECDSAInvalidSignature++#++()++` [.item-kind]#error#
  1352. The signature derives the `address(0)`.
  1353. [.contract-item]
  1354. [[ECDSA-ECDSAInvalidSignatureLength-uint256-]]
  1355. ==== `[.contract-item-name]#++ECDSAInvalidSignatureLength++#++(uint256 length)++` [.item-kind]#error#
  1356. The signature has an invalid length.
  1357. [.contract-item]
  1358. [[ECDSA-ECDSAInvalidSignatureS-bytes32-]]
  1359. ==== `[.contract-item-name]#++ECDSAInvalidSignatureS++#++(bytes32 s)++` [.item-kind]#error#
  1360. The signature has an S value that is in the upper half order.
  1361. :toEthSignedMessageHash: pass:normal[xref:#MessageHashUtils-toEthSignedMessageHash-bytes32-[`++toEthSignedMessageHash++`]]
  1362. :toEthSignedMessageHash: pass:normal[xref:#MessageHashUtils-toEthSignedMessageHash-bytes-[`++toEthSignedMessageHash++`]]
  1363. :toDataWithIntendedValidatorHash: pass:normal[xref:#MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-[`++toDataWithIntendedValidatorHash++`]]
  1364. :toTypedDataHash: pass:normal[xref:#MessageHashUtils-toTypedDataHash-bytes32-bytes32-[`++toTypedDataHash++`]]
  1365. [.contract]
  1366. [[MessageHashUtils]]
  1367. === `++MessageHashUtils++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/cryptography/MessageHashUtils.sol[{github-icon},role=heading-link]
  1368. [.hljs-theme-light.nopadding]
  1369. ```solidity
  1370. import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
  1371. ```
  1372. Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
  1373. The library provides methods for generating a hash of a message that conforms to the
  1374. https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
  1375. specifications.
  1376. [.contract-index]
  1377. .Functions
  1378. --
  1379. * {xref-MessageHashUtils-toEthSignedMessageHash-bytes32-}[`++toEthSignedMessageHash(messageHash)++`]
  1380. * {xref-MessageHashUtils-toEthSignedMessageHash-bytes-}[`++toEthSignedMessageHash(message)++`]
  1381. * {xref-MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-}[`++toDataWithIntendedValidatorHash(validator, data)++`]
  1382. * {xref-MessageHashUtils-toTypedDataHash-bytes32-bytes32-}[`++toTypedDataHash(domainSeparator, structHash)++`]
  1383. --
  1384. [.contract-item]
  1385. [[MessageHashUtils-toEthSignedMessageHash-bytes32-]]
  1386. ==== `[.contract-item-name]#++toEthSignedMessageHash++#++(bytes32 messageHash) → bytes32 digest++` [.item-kind]#internal#
  1387. Returns the keccak256 digest of an EIP-191 signed data with version
  1388. `0x45` (`personal_sign` messages).
  1389. The digest is calculated by prefixing a bytes32 `messageHash` with
  1390. `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
  1391. hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
  1392. NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
  1393. keccak256, although any bytes32 value can be safely used because the final digest will
  1394. be re-hashed.
  1395. See {ECDSA-recover}.
  1396. [.contract-item]
  1397. [[MessageHashUtils-toEthSignedMessageHash-bytes-]]
  1398. ==== `[.contract-item-name]#++toEthSignedMessageHash++#++(bytes message) → bytes32++` [.item-kind]#internal#
  1399. Returns the keccak256 digest of an EIP-191 signed data with version
  1400. `0x45` (`personal_sign` messages).
  1401. The digest is calculated by prefixing an arbitrary `message` with
  1402. `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
  1403. hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
  1404. See {ECDSA-recover}.
  1405. [.contract-item]
  1406. [[MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes-]]
  1407. ==== `[.contract-item-name]#++toDataWithIntendedValidatorHash++#++(address validator, bytes data) → bytes32++` [.item-kind]#internal#
  1408. Returns the keccak256 digest of an EIP-191 signed data with version
  1409. `0x00` (data with intended validator).
  1410. The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
  1411. `validator` address. Then hashing the result.
  1412. See {ECDSA-recover}.
  1413. [.contract-item]
  1414. [[MessageHashUtils-toTypedDataHash-bytes32-bytes32-]]
  1415. ==== `[.contract-item-name]#++toTypedDataHash++#++(bytes32 domainSeparator, bytes32 structHash) → bytes32 digest++` [.item-kind]#internal#
  1416. Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
  1417. The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
  1418. `\x19\x01` and hashing the result. It corresponds to the hash signed by the
  1419. https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
  1420. See {ECDSA-recover}.
  1421. :isValidSignatureNow: pass:normal[xref:#SignatureChecker-isValidSignatureNow-address-bytes32-bytes-[`++isValidSignatureNow++`]]
  1422. :isValidERC1271SignatureNow: pass:normal[xref:#SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-[`++isValidERC1271SignatureNow++`]]
  1423. [.contract]
  1424. [[SignatureChecker]]
  1425. === `++SignatureChecker++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/cryptography/SignatureChecker.sol[{github-icon},role=heading-link]
  1426. [.hljs-theme-light.nopadding]
  1427. ```solidity
  1428. import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
  1429. ```
  1430. Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
  1431. signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
  1432. Argent and Safe Wallet (previously Gnosis Safe).
  1433. [.contract-index]
  1434. .Functions
  1435. --
  1436. * {xref-SignatureChecker-isValidSignatureNow-address-bytes32-bytes-}[`++isValidSignatureNow(signer, hash, signature)++`]
  1437. * {xref-SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-}[`++isValidERC1271SignatureNow(signer, hash, signature)++`]
  1438. --
  1439. [.contract-item]
  1440. [[SignatureChecker-isValidSignatureNow-address-bytes32-bytes-]]
  1441. ==== `[.contract-item-name]#++isValidSignatureNow++#++(address signer, bytes32 hash, bytes signature) → bool++` [.item-kind]#internal#
  1442. Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
  1443. signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
  1444. NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
  1445. change through time. It could return true at block N and false at block N+1 (or the opposite).
  1446. [.contract-item]
  1447. [[SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-]]
  1448. ==== `[.contract-item-name]#++isValidERC1271SignatureNow++#++(address signer, bytes32 hash, bytes signature) → bool++` [.item-kind]#internal#
  1449. Checks if a signature is valid for a given signer and data hash. The signature is validated
  1450. against the signer smart contract using ERC1271.
  1451. NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
  1452. change through time. It could return true at block N and false at block N+1 (or the opposite).
  1453. :MerkleProofInvalidMultiproof: pass:normal[xref:#MerkleProof-MerkleProofInvalidMultiproof--[`++MerkleProofInvalidMultiproof++`]]
  1454. :verify: pass:normal[xref:#MerkleProof-verify-bytes32---bytes32-bytes32-[`++verify++`]]
  1455. :verifyCalldata: pass:normal[xref:#MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-[`++verifyCalldata++`]]
  1456. :processProof: pass:normal[xref:#MerkleProof-processProof-bytes32---bytes32-[`++processProof++`]]
  1457. :processProofCalldata: pass:normal[xref:#MerkleProof-processProofCalldata-bytes32---bytes32-[`++processProofCalldata++`]]
  1458. :multiProofVerify: pass:normal[xref:#MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---[`++multiProofVerify++`]]
  1459. :multiProofVerifyCalldata: pass:normal[xref:#MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---[`++multiProofVerifyCalldata++`]]
  1460. :processMultiProof: pass:normal[xref:#MerkleProof-processMultiProof-bytes32---bool---bytes32---[`++processMultiProof++`]]
  1461. :processMultiProofCalldata: pass:normal[xref:#MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---[`++processMultiProofCalldata++`]]
  1462. [.contract]
  1463. [[MerkleProof]]
  1464. === `++MerkleProof++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/cryptography/MerkleProof.sol[{github-icon},role=heading-link]
  1465. [.hljs-theme-light.nopadding]
  1466. ```solidity
  1467. import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
  1468. ```
  1469. These functions deal with verification of Merkle Tree proofs.
  1470. The tree and the proofs can be generated using our
  1471. https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
  1472. You will find a quickstart guide in the readme.
  1473. WARNING: You should avoid using leaf values that are 64 bytes long prior to
  1474. hashing, or use a hash function other than keccak256 for hashing leaves.
  1475. This is because the concatenation of a sorted pair of internal nodes in
  1476. the Merkle tree could be reinterpreted as a leaf value.
  1477. OpenZeppelin's JavaScript library generates Merkle trees that are safe
  1478. against this attack out of the box.
  1479. [.contract-index]
  1480. .Functions
  1481. --
  1482. * {xref-MerkleProof-verify-bytes32---bytes32-bytes32-}[`++verify(proof, root, leaf)++`]
  1483. * {xref-MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-}[`++verifyCalldata(proof, root, leaf)++`]
  1484. * {xref-MerkleProof-processProof-bytes32---bytes32-}[`++processProof(proof, leaf)++`]
  1485. * {xref-MerkleProof-processProofCalldata-bytes32---bytes32-}[`++processProofCalldata(proof, leaf)++`]
  1486. * {xref-MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---}[`++multiProofVerify(proof, proofFlags, root, leaves)++`]
  1487. * {xref-MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---}[`++multiProofVerifyCalldata(proof, proofFlags, root, leaves)++`]
  1488. * {xref-MerkleProof-processMultiProof-bytes32---bool---bytes32---}[`++processMultiProof(proof, proofFlags, leaves)++`]
  1489. * {xref-MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---}[`++processMultiProofCalldata(proof, proofFlags, leaves)++`]
  1490. --
  1491. [.contract-index]
  1492. .Errors
  1493. --
  1494. * {xref-MerkleProof-MerkleProofInvalidMultiproof--}[`++MerkleProofInvalidMultiproof()++`]
  1495. --
  1496. [.contract-item]
  1497. [[MerkleProof-verify-bytes32---bytes32-bytes32-]]
  1498. ==== `[.contract-item-name]#++verify++#++(bytes32[] proof, bytes32 root, bytes32 leaf) → bool++` [.item-kind]#internal#
  1499. Returns true if a `leaf` can be proved to be a part of a Merkle tree
  1500. defined by `root`. For this, a `proof` must be provided, containing
  1501. sibling hashes on the branch from the leaf to the root of the tree. Each
  1502. pair of leaves and each pair of pre-images are assumed to be sorted.
  1503. [.contract-item]
  1504. [[MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-]]
  1505. ==== `[.contract-item-name]#++verifyCalldata++#++(bytes32[] proof, bytes32 root, bytes32 leaf) → bool++` [.item-kind]#internal#
  1506. Calldata version of {verify}
  1507. [.contract-item]
  1508. [[MerkleProof-processProof-bytes32---bytes32-]]
  1509. ==== `[.contract-item-name]#++processProof++#++(bytes32[] proof, bytes32 leaf) → bytes32++` [.item-kind]#internal#
  1510. Returns the rebuilt hash obtained by traversing a Merkle tree up
  1511. from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
  1512. hash matches the root of the tree. When processing the proof, the pairs
  1513. of leafs & pre-images are assumed to be sorted.
  1514. [.contract-item]
  1515. [[MerkleProof-processProofCalldata-bytes32---bytes32-]]
  1516. ==== `[.contract-item-name]#++processProofCalldata++#++(bytes32[] proof, bytes32 leaf) → bytes32++` [.item-kind]#internal#
  1517. Calldata version of {processProof}
  1518. [.contract-item]
  1519. [[MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---]]
  1520. ==== `[.contract-item-name]#++multiProofVerify++#++(bytes32[] proof, bool[] proofFlags, bytes32 root, bytes32[] leaves) → bool++` [.item-kind]#internal#
  1521. Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
  1522. `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
  1523. CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
  1524. [.contract-item]
  1525. [[MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---]]
  1526. ==== `[.contract-item-name]#++multiProofVerifyCalldata++#++(bytes32[] proof, bool[] proofFlags, bytes32 root, bytes32[] leaves) → bool++` [.item-kind]#internal#
  1527. Calldata version of {multiProofVerify}
  1528. CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
  1529. [.contract-item]
  1530. [[MerkleProof-processMultiProof-bytes32---bool---bytes32---]]
  1531. ==== `[.contract-item-name]#++processMultiProof++#++(bytes32[] proof, bool[] proofFlags, bytes32[] leaves) → bytes32 merkleRoot++` [.item-kind]#internal#
  1532. Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
  1533. proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
  1534. leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
  1535. respectively.
  1536. CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
  1537. is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
  1538. tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
  1539. [.contract-item]
  1540. [[MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---]]
  1541. ==== `[.contract-item-name]#++processMultiProofCalldata++#++(bytes32[] proof, bool[] proofFlags, bytes32[] leaves) → bytes32 merkleRoot++` [.item-kind]#internal#
  1542. Calldata version of {processMultiProof}.
  1543. CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
  1544. [.contract-item]
  1545. [[MerkleProof-MerkleProofInvalidMultiproof--]]
  1546. ==== `[.contract-item-name]#++MerkleProofInvalidMultiproof++#++()++` [.item-kind]#error#
  1547. The multiproof provided is not valid.
  1548. :constructor: pass:normal[xref:#EIP712-constructor-string-string-[`++constructor++`]]
  1549. :_domainSeparatorV4: pass:normal[xref:#EIP712-_domainSeparatorV4--[`++_domainSeparatorV4++`]]
  1550. :_hashTypedDataV4: pass:normal[xref:#EIP712-_hashTypedDataV4-bytes32-[`++_hashTypedDataV4++`]]
  1551. :eip712Domain: pass:normal[xref:#EIP712-eip712Domain--[`++eip712Domain++`]]
  1552. :_EIP712Name: pass:normal[xref:#EIP712-_EIP712Name--[`++_EIP712Name++`]]
  1553. :_EIP712Version: pass:normal[xref:#EIP712-_EIP712Version--[`++_EIP712Version++`]]
  1554. [.contract]
  1555. [[EIP712]]
  1556. === `++EIP712++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/cryptography/EIP712.sol[{github-icon},role=heading-link]
  1557. [.hljs-theme-light.nopadding]
  1558. ```solidity
  1559. import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
  1560. ```
  1561. https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
  1562. The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
  1563. encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
  1564. does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
  1565. produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
  1566. This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
  1567. scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
  1568. ({_hashTypedDataV4}).
  1569. The implementation of the domain separator was designed to be as efficient as possible while still properly updating
  1570. the chain id to protect against replay attacks on an eventual fork of the chain.
  1571. NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
  1572. https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
  1573. NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
  1574. separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
  1575. separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
  1576. [.contract-index]
  1577. .Functions
  1578. --
  1579. * {xref-EIP712-constructor-string-string-}[`++constructor(name, version)++`]
  1580. * {xref-EIP712-_domainSeparatorV4--}[`++_domainSeparatorV4()++`]
  1581. * {xref-EIP712-_hashTypedDataV4-bytes32-}[`++_hashTypedDataV4(structHash)++`]
  1582. * {xref-EIP712-eip712Domain--}[`++eip712Domain()++`]
  1583. * {xref-EIP712-_EIP712Name--}[`++_EIP712Name()++`]
  1584. * {xref-EIP712-_EIP712Version--}[`++_EIP712Version()++`]
  1585. [.contract-subindex-inherited]
  1586. .IERC5267
  1587. --
  1588. [.contract-index]
  1589. .Events
  1590. --
  1591. [.contract-subindex-inherited]
  1592. .IERC5267
  1593. * {xref-IERC5267-EIP712DomainChanged--}[`++EIP712DomainChanged()++`]
  1594. --
  1595. [.contract-item]
  1596. [[EIP712-constructor-string-string-]]
  1597. ==== `[.contract-item-name]#++constructor++#++(string name, string version)++` [.item-kind]#internal#
  1598. Initializes the domain separator and parameter caches.
  1599. The meaning of `name` and `version` is specified in
  1600. https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
  1601. - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
  1602. - `version`: the current major version of the signing domain.
  1603. NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
  1604. contract upgrade].
  1605. [.contract-item]
  1606. [[EIP712-_domainSeparatorV4--]]
  1607. ==== `[.contract-item-name]#++_domainSeparatorV4++#++() → bytes32++` [.item-kind]#internal#
  1608. Returns the domain separator for the current chain.
  1609. [.contract-item]
  1610. [[EIP712-_hashTypedDataV4-bytes32-]]
  1611. ==== `[.contract-item-name]#++_hashTypedDataV4++#++(bytes32 structHash) → bytes32++` [.item-kind]#internal#
  1612. Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
  1613. function returns the hash of the fully encoded EIP712 message for this domain.
  1614. This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
  1615. ```solidity
  1616. bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
  1617. keccak256("Mail(address to,string contents)"),
  1618. mailTo,
  1619. keccak256(bytes(mailContents))
  1620. )));
  1621. address signer = ECDSA.recover(digest, signature);
  1622. ```
  1623. [.contract-item]
  1624. [[EIP712-eip712Domain--]]
  1625. ==== `[.contract-item-name]#++eip712Domain++#++() → bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions++` [.item-kind]#public#
  1626. See {IERC-5267}.
  1627. [.contract-item]
  1628. [[EIP712-_EIP712Name--]]
  1629. ==== `[.contract-item-name]#++_EIP712Name++#++() → string++` [.item-kind]#internal#
  1630. The name parameter for the EIP712 domain.
  1631. NOTE: By default this function reads _name which is an immutable value.
  1632. It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
  1633. [.contract-item]
  1634. [[EIP712-_EIP712Version--]]
  1635. ==== `[.contract-item-name]#++_EIP712Version++#++() → string++` [.item-kind]#internal#
  1636. The version parameter for the EIP712 domain.
  1637. NOTE: By default this function reads _version which is an immutable value.
  1638. It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
  1639. == Security
  1640. :ReentrancyGuardReentrantCall: pass:normal[xref:#ReentrancyGuard-ReentrancyGuardReentrantCall--[`++ReentrancyGuardReentrantCall++`]]
  1641. :constructor: pass:normal[xref:#ReentrancyGuard-constructor--[`++constructor++`]]
  1642. :nonReentrant: pass:normal[xref:#ReentrancyGuard-nonReentrant--[`++nonReentrant++`]]
  1643. :_reentrancyGuardEntered: pass:normal[xref:#ReentrancyGuard-_reentrancyGuardEntered--[`++_reentrancyGuardEntered++`]]
  1644. [.contract]
  1645. [[ReentrancyGuard]]
  1646. === `++ReentrancyGuard++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/ReentrancyGuard.sol[{github-icon},role=heading-link]
  1647. [.hljs-theme-light.nopadding]
  1648. ```solidity
  1649. import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
  1650. ```
  1651. Contract module that helps prevent reentrant calls to a function.
  1652. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
  1653. available, which can be applied to functions to make sure there are no nested
  1654. (reentrant) calls to them.
  1655. Note that because there is a single `nonReentrant` guard, functions marked as
  1656. `nonReentrant` may not call one another. This can be worked around by making
  1657. those functions `private`, and then adding `external` `nonReentrant` entry
  1658. points to them.
  1659. TIP: If you would like to learn more about reentrancy and alternative ways
  1660. to protect against it, check out our blog post
  1661. https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
  1662. [.contract-index]
  1663. .Modifiers
  1664. --
  1665. * {xref-ReentrancyGuard-nonReentrant--}[`++nonReentrant()++`]
  1666. --
  1667. [.contract-index]
  1668. .Functions
  1669. --
  1670. * {xref-ReentrancyGuard-constructor--}[`++constructor()++`]
  1671. * {xref-ReentrancyGuard-_reentrancyGuardEntered--}[`++_reentrancyGuardEntered()++`]
  1672. --
  1673. [.contract-index]
  1674. .Errors
  1675. --
  1676. * {xref-ReentrancyGuard-ReentrancyGuardReentrantCall--}[`++ReentrancyGuardReentrantCall()++`]
  1677. --
  1678. [.contract-item]
  1679. [[ReentrancyGuard-nonReentrant--]]
  1680. ==== `[.contract-item-name]#++nonReentrant++#++()++` [.item-kind]#modifier#
  1681. Prevents a contract from calling itself, directly or indirectly.
  1682. Calling a `nonReentrant` function from another `nonReentrant`
  1683. function is not supported. It is possible to prevent this from happening
  1684. by making the `nonReentrant` function external, and making it call a
  1685. `private` function that does the actual work.
  1686. [.contract-item]
  1687. [[ReentrancyGuard-constructor--]]
  1688. ==== `[.contract-item-name]#++constructor++#++()++` [.item-kind]#internal#
  1689. [.contract-item]
  1690. [[ReentrancyGuard-_reentrancyGuardEntered--]]
  1691. ==== `[.contract-item-name]#++_reentrancyGuardEntered++#++() → bool++` [.item-kind]#internal#
  1692. Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
  1693. `nonReentrant` function in the call stack.
  1694. [.contract-item]
  1695. [[ReentrancyGuard-ReentrancyGuardReentrantCall--]]
  1696. ==== `[.contract-item-name]#++ReentrancyGuardReentrantCall++#++()++` [.item-kind]#error#
  1697. Unauthorized reentrant call.
  1698. :Paused: pass:normal[xref:#Pausable-Paused-address-[`++Paused++`]]
  1699. :Unpaused: pass:normal[xref:#Pausable-Unpaused-address-[`++Unpaused++`]]
  1700. :EnforcedPause: pass:normal[xref:#Pausable-EnforcedPause--[`++EnforcedPause++`]]
  1701. :ExpectedPause: pass:normal[xref:#Pausable-ExpectedPause--[`++ExpectedPause++`]]
  1702. :constructor: pass:normal[xref:#Pausable-constructor--[`++constructor++`]]
  1703. :whenNotPaused: pass:normal[xref:#Pausable-whenNotPaused--[`++whenNotPaused++`]]
  1704. :whenPaused: pass:normal[xref:#Pausable-whenPaused--[`++whenPaused++`]]
  1705. :paused: pass:normal[xref:#Pausable-paused--[`++paused++`]]
  1706. :_requireNotPaused: pass:normal[xref:#Pausable-_requireNotPaused--[`++_requireNotPaused++`]]
  1707. :_requirePaused: pass:normal[xref:#Pausable-_requirePaused--[`++_requirePaused++`]]
  1708. :_pause: pass:normal[xref:#Pausable-_pause--[`++_pause++`]]
  1709. :_unpause: pass:normal[xref:#Pausable-_unpause--[`++_unpause++`]]
  1710. [.contract]
  1711. [[Pausable]]
  1712. === `++Pausable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/Pausable.sol[{github-icon},role=heading-link]
  1713. [.hljs-theme-light.nopadding]
  1714. ```solidity
  1715. import "@openzeppelin/contracts/utils/Pausable.sol";
  1716. ```
  1717. Contract module which allows children to implement an emergency stop
  1718. mechanism that can be triggered by an authorized account.
  1719. This module is used through inheritance. It will make available the
  1720. modifiers `whenNotPaused` and `whenPaused`, which can be applied to
  1721. the functions of your contract. Note that they will not be pausable by
  1722. simply including this module, only once the modifiers are put in place.
  1723. [.contract-index]
  1724. .Modifiers
  1725. --
  1726. * {xref-Pausable-whenNotPaused--}[`++whenNotPaused()++`]
  1727. * {xref-Pausable-whenPaused--}[`++whenPaused()++`]
  1728. --
  1729. [.contract-index]
  1730. .Functions
  1731. --
  1732. * {xref-Pausable-constructor--}[`++constructor()++`]
  1733. * {xref-Pausable-paused--}[`++paused()++`]
  1734. * {xref-Pausable-_requireNotPaused--}[`++_requireNotPaused()++`]
  1735. * {xref-Pausable-_requirePaused--}[`++_requirePaused()++`]
  1736. * {xref-Pausable-_pause--}[`++_pause()++`]
  1737. * {xref-Pausable-_unpause--}[`++_unpause()++`]
  1738. --
  1739. [.contract-index]
  1740. .Events
  1741. --
  1742. * {xref-Pausable-Paused-address-}[`++Paused(account)++`]
  1743. * {xref-Pausable-Unpaused-address-}[`++Unpaused(account)++`]
  1744. --
  1745. [.contract-index]
  1746. .Errors
  1747. --
  1748. * {xref-Pausable-EnforcedPause--}[`++EnforcedPause()++`]
  1749. * {xref-Pausable-ExpectedPause--}[`++ExpectedPause()++`]
  1750. --
  1751. [.contract-item]
  1752. [[Pausable-whenNotPaused--]]
  1753. ==== `[.contract-item-name]#++whenNotPaused++#++()++` [.item-kind]#modifier#
  1754. Modifier to make a function callable only when the contract is not paused.
  1755. Requirements:
  1756. - The contract must not be paused.
  1757. [.contract-item]
  1758. [[Pausable-whenPaused--]]
  1759. ==== `[.contract-item-name]#++whenPaused++#++()++` [.item-kind]#modifier#
  1760. Modifier to make a function callable only when the contract is paused.
  1761. Requirements:
  1762. - The contract must be paused.
  1763. [.contract-item]
  1764. [[Pausable-constructor--]]
  1765. ==== `[.contract-item-name]#++constructor++#++()++` [.item-kind]#internal#
  1766. Initializes the contract in unpaused state.
  1767. [.contract-item]
  1768. [[Pausable-paused--]]
  1769. ==== `[.contract-item-name]#++paused++#++() → bool++` [.item-kind]#public#
  1770. Returns true if the contract is paused, and false otherwise.
  1771. [.contract-item]
  1772. [[Pausable-_requireNotPaused--]]
  1773. ==== `[.contract-item-name]#++_requireNotPaused++#++()++` [.item-kind]#internal#
  1774. Throws if the contract is paused.
  1775. [.contract-item]
  1776. [[Pausable-_requirePaused--]]
  1777. ==== `[.contract-item-name]#++_requirePaused++#++()++` [.item-kind]#internal#
  1778. Throws if the contract is not paused.
  1779. [.contract-item]
  1780. [[Pausable-_pause--]]
  1781. ==== `[.contract-item-name]#++_pause++#++()++` [.item-kind]#internal#
  1782. Triggers stopped state.
  1783. Requirements:
  1784. - The contract must not be paused.
  1785. [.contract-item]
  1786. [[Pausable-_unpause--]]
  1787. ==== `[.contract-item-name]#++_unpause++#++()++` [.item-kind]#internal#
  1788. Returns to normal state.
  1789. Requirements:
  1790. - The contract must be paused.
  1791. [.contract-item]
  1792. [[Pausable-Paused-address-]]
  1793. ==== `[.contract-item-name]#++Paused++#++(address account)++` [.item-kind]#event#
  1794. Emitted when the pause is triggered by `account`.
  1795. [.contract-item]
  1796. [[Pausable-Unpaused-address-]]
  1797. ==== `[.contract-item-name]#++Unpaused++#++(address account)++` [.item-kind]#event#
  1798. Emitted when the pause is lifted by `account`.
  1799. [.contract-item]
  1800. [[Pausable-EnforcedPause--]]
  1801. ==== `[.contract-item-name]#++EnforcedPause++#++()++` [.item-kind]#error#
  1802. The operation failed because the contract is paused.
  1803. [.contract-item]
  1804. [[Pausable-ExpectedPause--]]
  1805. ==== `[.contract-item-name]#++ExpectedPause++#++()++` [.item-kind]#error#
  1806. The operation failed because the contract is not paused.
  1807. == Introspection
  1808. 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_.
  1809. 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.
  1810. :supportsInterface: pass:normal[xref:#IERC165-supportsInterface-bytes4-[`++supportsInterface++`]]
  1811. [.contract]
  1812. [[IERC165]]
  1813. === `++IERC165++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/introspection/IERC165.sol[{github-icon},role=heading-link]
  1814. [.hljs-theme-light.nopadding]
  1815. ```solidity
  1816. import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
  1817. ```
  1818. Interface of the ERC165 standard, as defined in the
  1819. https://eips.ethereum.org/EIPS/eip-165[EIP].
  1820. Implementers can declare support of contract interfaces, which can then be
  1821. queried by others ({ERC165Checker}).
  1822. For an implementation, see {ERC165}.
  1823. [.contract-index]
  1824. .Functions
  1825. --
  1826. * {xref-IERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
  1827. --
  1828. [.contract-item]
  1829. [[IERC165-supportsInterface-bytes4-]]
  1830. ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#external#
  1831. Returns true if this contract implements the interface defined by
  1832. `interfaceId`. See the corresponding
  1833. https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
  1834. to learn more about how these ids are created.
  1835. This function call must use less than 30 000 gas.
  1836. :supportsInterface: pass:normal[xref:#ERC165-supportsInterface-bytes4-[`++supportsInterface++`]]
  1837. [.contract]
  1838. [[ERC165]]
  1839. === `++ERC165++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/introspection/ERC165.sol[{github-icon},role=heading-link]
  1840. [.hljs-theme-light.nopadding]
  1841. ```solidity
  1842. import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
  1843. ```
  1844. Implementation of the {IERC165} interface.
  1845. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
  1846. for the additional interface id that will be supported. For example:
  1847. ```solidity
  1848. function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
  1849. return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
  1850. }
  1851. ```
  1852. [.contract-index]
  1853. .Functions
  1854. --
  1855. * {xref-ERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
  1856. [.contract-subindex-inherited]
  1857. .IERC165
  1858. --
  1859. [.contract-item]
  1860. [[ERC165-supportsInterface-bytes4-]]
  1861. ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#public#
  1862. See {IERC165-supportsInterface}.
  1863. :supportsERC165: pass:normal[xref:#ERC165Checker-supportsERC165-address-[`++supportsERC165++`]]
  1864. :supportsInterface: pass:normal[xref:#ERC165Checker-supportsInterface-address-bytes4-[`++supportsInterface++`]]
  1865. :getSupportedInterfaces: pass:normal[xref:#ERC165Checker-getSupportedInterfaces-address-bytes4---[`++getSupportedInterfaces++`]]
  1866. :supportsAllInterfaces: pass:normal[xref:#ERC165Checker-supportsAllInterfaces-address-bytes4---[`++supportsAllInterfaces++`]]
  1867. :supportsERC165InterfaceUnchecked: pass:normal[xref:#ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-[`++supportsERC165InterfaceUnchecked++`]]
  1868. [.contract]
  1869. [[ERC165Checker]]
  1870. === `++ERC165Checker++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/introspection/ERC165Checker.sol[{github-icon},role=heading-link]
  1871. [.hljs-theme-light.nopadding]
  1872. ```solidity
  1873. import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
  1874. ```
  1875. Library used to query support of an interface declared via {IERC165}.
  1876. Note that these functions return the actual result of the query: they do not
  1877. `revert` if an interface is not supported. It is up to the caller to decide
  1878. what to do in these cases.
  1879. [.contract-index]
  1880. .Functions
  1881. --
  1882. * {xref-ERC165Checker-supportsERC165-address-}[`++supportsERC165(account)++`]
  1883. * {xref-ERC165Checker-supportsInterface-address-bytes4-}[`++supportsInterface(account, interfaceId)++`]
  1884. * {xref-ERC165Checker-getSupportedInterfaces-address-bytes4---}[`++getSupportedInterfaces(account, interfaceIds)++`]
  1885. * {xref-ERC165Checker-supportsAllInterfaces-address-bytes4---}[`++supportsAllInterfaces(account, interfaceIds)++`]
  1886. * {xref-ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-}[`++supportsERC165InterfaceUnchecked(account, interfaceId)++`]
  1887. --
  1888. [.contract-item]
  1889. [[ERC165Checker-supportsERC165-address-]]
  1890. ==== `[.contract-item-name]#++supportsERC165++#++(address account) → bool++` [.item-kind]#internal#
  1891. Returns true if `account` supports the {IERC165} interface.
  1892. [.contract-item]
  1893. [[ERC165Checker-supportsInterface-address-bytes4-]]
  1894. ==== `[.contract-item-name]#++supportsInterface++#++(address account, bytes4 interfaceId) → bool++` [.item-kind]#internal#
  1895. Returns true if `account` supports the interface defined by
  1896. `interfaceId`. Support for {IERC165} itself is queried automatically.
  1897. See {IERC165-supportsInterface}.
  1898. [.contract-item]
  1899. [[ERC165Checker-getSupportedInterfaces-address-bytes4---]]
  1900. ==== `[.contract-item-name]#++getSupportedInterfaces++#++(address account, bytes4[] interfaceIds) → bool[]++` [.item-kind]#internal#
  1901. Returns a boolean array where each value corresponds to the
  1902. interfaces passed in and whether they're supported or not. This allows
  1903. you to batch check interfaces for a contract where your expectation
  1904. is that some interfaces may not be supported.
  1905. See {IERC165-supportsInterface}.
  1906. [.contract-item]
  1907. [[ERC165Checker-supportsAllInterfaces-address-bytes4---]]
  1908. ==== `[.contract-item-name]#++supportsAllInterfaces++#++(address account, bytes4[] interfaceIds) → bool++` [.item-kind]#internal#
  1909. Returns true if `account` supports all the interfaces defined in
  1910. `interfaceIds`. Support for {IERC165} itself is queried automatically.
  1911. Batch-querying can lead to gas savings by skipping repeated checks for
  1912. {IERC165} support.
  1913. See {IERC165-supportsInterface}.
  1914. [.contract-item]
  1915. [[ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-]]
  1916. ==== `[.contract-item-name]#++supportsERC165InterfaceUnchecked++#++(address account, bytes4 interfaceId) → bool++` [.item-kind]#internal#
  1917. Assumes that account contains a contract that supports ERC165, otherwise
  1918. the behavior of this method is undefined. This precondition can be checked
  1919. with {supportsERC165}.
  1920. Some precompiled contracts will falsely indicate support for a given interface, so caution
  1921. should be exercised when using this function.
  1922. Interface identification is specified in ERC-165.
  1923. == Data Structures
  1924. :BitMap: pass:normal[xref:#BitMaps-BitMap[`++BitMap++`]]
  1925. :get: pass:normal[xref:#BitMaps-get-struct-BitMaps-BitMap-uint256-[`++get++`]]
  1926. :setTo: pass:normal[xref:#BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-[`++setTo++`]]
  1927. :set: pass:normal[xref:#BitMaps-set-struct-BitMaps-BitMap-uint256-[`++set++`]]
  1928. :unset: pass:normal[xref:#BitMaps-unset-struct-BitMaps-BitMap-uint256-[`++unset++`]]
  1929. [.contract]
  1930. [[BitMaps]]
  1931. === `++BitMaps++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/structs/BitMaps.sol[{github-icon},role=heading-link]
  1932. [.hljs-theme-light.nopadding]
  1933. ```solidity
  1934. import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
  1935. ```
  1936. Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.
  1937. Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
  1938. BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.
  1939. Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,
  1940. unlike the regular `bool` which would consume an entire slot for a single value.
  1941. This results in gas savings in two ways:
  1942. - Setting a zero value to non-zero only once every 256 times
  1943. - Accessing the same warm slot for every 256 _sequential_ indices
  1944. [.contract-index]
  1945. .Functions
  1946. --
  1947. * {xref-BitMaps-get-struct-BitMaps-BitMap-uint256-}[`++get(bitmap, index)++`]
  1948. * {xref-BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-}[`++setTo(bitmap, index, value)++`]
  1949. * {xref-BitMaps-set-struct-BitMaps-BitMap-uint256-}[`++set(bitmap, index)++`]
  1950. * {xref-BitMaps-unset-struct-BitMaps-BitMap-uint256-}[`++unset(bitmap, index)++`]
  1951. --
  1952. [.contract-item]
  1953. [[BitMaps-get-struct-BitMaps-BitMap-uint256-]]
  1954. ==== `[.contract-item-name]#++get++#++(struct BitMaps.BitMap bitmap, uint256 index) → bool++` [.item-kind]#internal#
  1955. Returns whether the bit at `index` is set.
  1956. [.contract-item]
  1957. [[BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-]]
  1958. ==== `[.contract-item-name]#++setTo++#++(struct BitMaps.BitMap bitmap, uint256 index, bool value)++` [.item-kind]#internal#
  1959. Sets the bit at `index` to the boolean `value`.
  1960. [.contract-item]
  1961. [[BitMaps-set-struct-BitMaps-BitMap-uint256-]]
  1962. ==== `[.contract-item-name]#++set++#++(struct BitMaps.BitMap bitmap, uint256 index)++` [.item-kind]#internal#
  1963. Sets the bit at `index`.
  1964. [.contract-item]
  1965. [[BitMaps-unset-struct-BitMaps-BitMap-uint256-]]
  1966. ==== `[.contract-item-name]#++unset++#++(struct BitMaps.BitMap bitmap, uint256 index)++` [.item-kind]#internal#
  1967. Unsets the bit at `index`.
  1968. :EnumerableMapNonexistentKey: pass:normal[xref:#EnumerableMap-EnumerableMapNonexistentKey-bytes32-[`++EnumerableMapNonexistentKey++`]]
  1969. :Bytes32ToBytes32Map: pass:normal[xref:#EnumerableMap-Bytes32ToBytes32Map[`++Bytes32ToBytes32Map++`]]
  1970. :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-[`++set++`]]
  1971. :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++remove++`]]
  1972. :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++contains++`]]
  1973. :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-[`++length++`]]
  1974. :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-[`++at++`]]
  1975. :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++tryGet++`]]
  1976. :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++get++`]]
  1977. :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-[`++keys++`]]
  1978. :UintToUintMap: pass:normal[xref:#EnumerableMap-UintToUintMap[`++UintToUintMap++`]]
  1979. :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-[`++set++`]]
  1980. :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-[`++remove++`]]
  1981. :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-[`++contains++`]]
  1982. :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-UintToUintMap-[`++length++`]]
  1983. :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-[`++at++`]]
  1984. :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-[`++tryGet++`]]
  1985. :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-[`++get++`]]
  1986. :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-[`++keys++`]]
  1987. :UintToAddressMap: pass:normal[xref:#EnumerableMap-UintToAddressMap[`++UintToAddressMap++`]]
  1988. :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-[`++set++`]]
  1989. :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-[`++remove++`]]
  1990. :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-[`++contains++`]]
  1991. :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-[`++length++`]]
  1992. :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-[`++at++`]]
  1993. :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-[`++tryGet++`]]
  1994. :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-[`++get++`]]
  1995. :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-[`++keys++`]]
  1996. :AddressToUintMap: pass:normal[xref:#EnumerableMap-AddressToUintMap[`++AddressToUintMap++`]]
  1997. :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-[`++set++`]]
  1998. :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-[`++remove++`]]
  1999. :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-[`++contains++`]]
  2000. :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-[`++length++`]]
  2001. :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-[`++at++`]]
  2002. :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-[`++tryGet++`]]
  2003. :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-[`++get++`]]
  2004. :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-[`++keys++`]]
  2005. :Bytes32ToUintMap: pass:normal[xref:#EnumerableMap-Bytes32ToUintMap[`++Bytes32ToUintMap++`]]
  2006. :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-[`++set++`]]
  2007. :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++remove++`]]
  2008. :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++contains++`]]
  2009. :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-[`++length++`]]
  2010. :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-[`++at++`]]
  2011. :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++tryGet++`]]
  2012. :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++get++`]]
  2013. :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-[`++keys++`]]
  2014. [.contract]
  2015. [[EnumerableMap]]
  2016. === `++EnumerableMap++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/structs/EnumerableMap.sol[{github-icon},role=heading-link]
  2017. [.hljs-theme-light.nopadding]
  2018. ```solidity
  2019. import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
  2020. ```
  2021. Library for managing an enumerable variant of Solidity's
  2022. https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
  2023. type.
  2024. Maps have the following properties:
  2025. - Entries are added, removed, and checked for existence in constant time
  2026. (O(1)).
  2027. - Entries are enumerated in O(n). No guarantees are made on the ordering.
  2028. ```solidity
  2029. contract Example {
  2030. // Add the library methods
  2031. using EnumerableMap for EnumerableMap.UintToAddressMap;
  2032. // Declare a set state variable
  2033. EnumerableMap.UintToAddressMap private myMap;
  2034. }
  2035. ```
  2036. The following map types are supported:
  2037. - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
  2038. - `address -> uint256` (`AddressToUintMap`) since v4.6.0
  2039. - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
  2040. - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
  2041. - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
  2042. [WARNING]
  2043. ====
  2044. Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
  2045. unusable.
  2046. See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
  2047. In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
  2048. array of EnumerableMap.
  2049. ====
  2050. [.contract-index]
  2051. .Functions
  2052. --
  2053. * {xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-}[`++set(map, key, value)++`]
  2054. * {xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++remove(map, key)++`]
  2055. * {xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++contains(map, key)++`]
  2056. * {xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-}[`++length(map)++`]
  2057. * {xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-}[`++at(map, index)++`]
  2058. * {xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++tryGet(map, key)++`]
  2059. * {xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++get(map, key)++`]
  2060. * {xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-}[`++keys(map)++`]
  2061. * {xref-EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-}[`++set(map, key, value)++`]
  2062. * {xref-EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-}[`++remove(map, key)++`]
  2063. * {xref-EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-}[`++contains(map, key)++`]
  2064. * {xref-EnumerableMap-length-struct-EnumerableMap-UintToUintMap-}[`++length(map)++`]
  2065. * {xref-EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-}[`++at(map, index)++`]
  2066. * {xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-}[`++tryGet(map, key)++`]
  2067. * {xref-EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-}[`++get(map, key)++`]
  2068. * {xref-EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-}[`++keys(map)++`]
  2069. * {xref-EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-}[`++set(map, key, value)++`]
  2070. * {xref-EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-}[`++remove(map, key)++`]
  2071. * {xref-EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-}[`++contains(map, key)++`]
  2072. * {xref-EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-}[`++length(map)++`]
  2073. * {xref-EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-}[`++at(map, index)++`]
  2074. * {xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-}[`++tryGet(map, key)++`]
  2075. * {xref-EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-}[`++get(map, key)++`]
  2076. * {xref-EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-}[`++keys(map)++`]
  2077. * {xref-EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-}[`++set(map, key, value)++`]
  2078. * {xref-EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-}[`++remove(map, key)++`]
  2079. * {xref-EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-}[`++contains(map, key)++`]
  2080. * {xref-EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-}[`++length(map)++`]
  2081. * {xref-EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-}[`++at(map, index)++`]
  2082. * {xref-EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-}[`++tryGet(map, key)++`]
  2083. * {xref-EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-}[`++get(map, key)++`]
  2084. * {xref-EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-}[`++keys(map)++`]
  2085. * {xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-}[`++set(map, key, value)++`]
  2086. * {xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++remove(map, key)++`]
  2087. * {xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++contains(map, key)++`]
  2088. * {xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-}[`++length(map)++`]
  2089. * {xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-}[`++at(map, index)++`]
  2090. * {xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++tryGet(map, key)++`]
  2091. * {xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++get(map, key)++`]
  2092. * {xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-}[`++keys(map)++`]
  2093. --
  2094. [.contract-index]
  2095. .Errors
  2096. --
  2097. * {xref-EnumerableMap-EnumerableMapNonexistentKey-bytes32-}[`++EnumerableMapNonexistentKey(key)++`]
  2098. --
  2099. [.contract-item]
  2100. [[EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-]]
  2101. ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key, bytes32 value) → bool++` [.item-kind]#internal#
  2102. Adds a key-value pair to a map, or updates the value for an existing
  2103. key. O(1).
  2104. Returns true if the key was added to the map, that is if it was not
  2105. already present.
  2106. [.contract-item]
  2107. [[EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
  2108. ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool++` [.item-kind]#internal#
  2109. Removes a key-value pair from a map. O(1).
  2110. Returns true if the key was removed from the map, that is if it was present.
  2111. [.contract-item]
  2112. [[EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
  2113. ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool++` [.item-kind]#internal#
  2114. Returns true if the key is in the map. O(1).
  2115. [.contract-item]
  2116. [[EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-]]
  2117. ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.Bytes32ToBytes32Map map) → uint256++` [.item-kind]#internal#
  2118. Returns the number of key-value pairs in the map. O(1).
  2119. [.contract-item]
  2120. [[EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-]]
  2121. ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.Bytes32ToBytes32Map map, uint256 index) → bytes32, bytes32++` [.item-kind]#internal#
  2122. Returns the key-value pair stored at position `index` in the map. O(1).
  2123. Note that there are no guarantees on the ordering of entries inside the
  2124. array, and it may change when more entries are added or removed.
  2125. Requirements:
  2126. - `index` must be strictly less than {length}.
  2127. [.contract-item]
  2128. [[EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
  2129. ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool, bytes32++` [.item-kind]#internal#
  2130. Tries to returns the value associated with `key`. O(1).
  2131. Does not revert if `key` is not in the map.
  2132. [.contract-item]
  2133. [[EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
  2134. ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bytes32++` [.item-kind]#internal#
  2135. Returns the value associated with `key`. O(1).
  2136. Requirements:
  2137. - `key` must be in the map.
  2138. [.contract-item]
  2139. [[EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-]]
  2140. ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.Bytes32ToBytes32Map map) → bytes32[]++` [.item-kind]#internal#
  2141. Return the an array containing all the keys
  2142. WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
  2143. to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
  2144. this function has an unbounded cost, and using it as part of a state-changing function may render the function
  2145. uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
  2146. [.contract-item]
  2147. [[EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-]]
  2148. ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.UintToUintMap map, uint256 key, uint256 value) → bool++` [.item-kind]#internal#
  2149. Adds a key-value pair to a map, or updates the value for an existing
  2150. key. O(1).
  2151. Returns true if the key was added to the map, that is if it was not
  2152. already present.
  2153. [.contract-item]
  2154. [[EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-]]
  2155. ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool++` [.item-kind]#internal#
  2156. Removes a value from a map. O(1).
  2157. Returns true if the key was removed from the map, that is if it was present.
  2158. [.contract-item]
  2159. [[EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-]]
  2160. ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool++` [.item-kind]#internal#
  2161. Returns true if the key is in the map. O(1).
  2162. [.contract-item]
  2163. [[EnumerableMap-length-struct-EnumerableMap-UintToUintMap-]]
  2164. ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.UintToUintMap map) → uint256++` [.item-kind]#internal#
  2165. Returns the number of elements in the map. O(1).
  2166. [.contract-item]
  2167. [[EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-]]
  2168. ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.UintToUintMap map, uint256 index) → uint256, uint256++` [.item-kind]#internal#
  2169. Returns the element stored at position `index` in the map. O(1).
  2170. Note that there are no guarantees on the ordering of values inside the
  2171. array, and it may change when more values are added or removed.
  2172. Requirements:
  2173. - `index` must be strictly less than {length}.
  2174. [.contract-item]
  2175. [[EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-]]
  2176. ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool, uint256++` [.item-kind]#internal#
  2177. Tries to returns the value associated with `key`. O(1).
  2178. Does not revert if `key` is not in the map.
  2179. [.contract-item]
  2180. [[EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-]]
  2181. ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → uint256++` [.item-kind]#internal#
  2182. Returns the value associated with `key`. O(1).
  2183. Requirements:
  2184. - `key` must be in the map.
  2185. [.contract-item]
  2186. [[EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-]]
  2187. ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.UintToUintMap map) → uint256[]++` [.item-kind]#internal#
  2188. Return the an array containing all the keys
  2189. WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
  2190. to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
  2191. this function has an unbounded cost, and using it as part of a state-changing function may render the function
  2192. uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
  2193. [.contract-item]
  2194. [[EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-]]
  2195. ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.UintToAddressMap map, uint256 key, address value) → bool++` [.item-kind]#internal#
  2196. Adds a key-value pair to a map, or updates the value for an existing
  2197. key. O(1).
  2198. Returns true if the key was added to the map, that is if it was not
  2199. already present.
  2200. [.contract-item]
  2201. [[EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-]]
  2202. ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool++` [.item-kind]#internal#
  2203. Removes a value from a map. O(1).
  2204. Returns true if the key was removed from the map, that is if it was present.
  2205. [.contract-item]
  2206. [[EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-]]
  2207. ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool++` [.item-kind]#internal#
  2208. Returns true if the key is in the map. O(1).
  2209. [.contract-item]
  2210. [[EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-]]
  2211. ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.UintToAddressMap map) → uint256++` [.item-kind]#internal#
  2212. Returns the number of elements in the map. O(1).
  2213. [.contract-item]
  2214. [[EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-]]
  2215. ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.UintToAddressMap map, uint256 index) → uint256, address++` [.item-kind]#internal#
  2216. Returns the element stored at position `index` in the map. O(1).
  2217. Note that there are no guarantees on the ordering of values inside the
  2218. array, and it may change when more values are added or removed.
  2219. Requirements:
  2220. - `index` must be strictly less than {length}.
  2221. [.contract-item]
  2222. [[EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-]]
  2223. ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool, address++` [.item-kind]#internal#
  2224. Tries to returns the value associated with `key`. O(1).
  2225. Does not revert if `key` is not in the map.
  2226. [.contract-item]
  2227. [[EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-]]
  2228. ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → address++` [.item-kind]#internal#
  2229. Returns the value associated with `key`. O(1).
  2230. Requirements:
  2231. - `key` must be in the map.
  2232. [.contract-item]
  2233. [[EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-]]
  2234. ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.UintToAddressMap map) → uint256[]++` [.item-kind]#internal#
  2235. Return the an array containing all the keys
  2236. WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
  2237. to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
  2238. this function has an unbounded cost, and using it as part of a state-changing function may render the function
  2239. uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
  2240. [.contract-item]
  2241. [[EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-]]
  2242. ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.AddressToUintMap map, address key, uint256 value) → bool++` [.item-kind]#internal#
  2243. Adds a key-value pair to a map, or updates the value for an existing
  2244. key. O(1).
  2245. Returns true if the key was added to the map, that is if it was not
  2246. already present.
  2247. [.contract-item]
  2248. [[EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-]]
  2249. ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool++` [.item-kind]#internal#
  2250. Removes a value from a map. O(1).
  2251. Returns true if the key was removed from the map, that is if it was present.
  2252. [.contract-item]
  2253. [[EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-]]
  2254. ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool++` [.item-kind]#internal#
  2255. Returns true if the key is in the map. O(1).
  2256. [.contract-item]
  2257. [[EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-]]
  2258. ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.AddressToUintMap map) → uint256++` [.item-kind]#internal#
  2259. Returns the number of elements in the map. O(1).
  2260. [.contract-item]
  2261. [[EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-]]
  2262. ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.AddressToUintMap map, uint256 index) → address, uint256++` [.item-kind]#internal#
  2263. Returns the element stored at position `index` in the map. O(1).
  2264. Note that there are no guarantees on the ordering of values inside the
  2265. array, and it may change when more values are added or removed.
  2266. Requirements:
  2267. - `index` must be strictly less than {length}.
  2268. [.contract-item]
  2269. [[EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-]]
  2270. ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool, uint256++` [.item-kind]#internal#
  2271. Tries to returns the value associated with `key`. O(1).
  2272. Does not revert if `key` is not in the map.
  2273. [.contract-item]
  2274. [[EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-]]
  2275. ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.AddressToUintMap map, address key) → uint256++` [.item-kind]#internal#
  2276. Returns the value associated with `key`. O(1).
  2277. Requirements:
  2278. - `key` must be in the map.
  2279. [.contract-item]
  2280. [[EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-]]
  2281. ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.AddressToUintMap map) → address[]++` [.item-kind]#internal#
  2282. Return the an array containing all the keys
  2283. WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
  2284. to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
  2285. this function has an unbounded cost, and using it as part of a state-changing function may render the function
  2286. uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
  2287. [.contract-item]
  2288. [[EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-]]
  2289. ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key, uint256 value) → bool++` [.item-kind]#internal#
  2290. Adds a key-value pair to a map, or updates the value for an existing
  2291. key. O(1).
  2292. Returns true if the key was added to the map, that is if it was not
  2293. already present.
  2294. [.contract-item]
  2295. [[EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
  2296. ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool++` [.item-kind]#internal#
  2297. Removes a value from a map. O(1).
  2298. Returns true if the key was removed from the map, that is if it was present.
  2299. [.contract-item]
  2300. [[EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
  2301. ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool++` [.item-kind]#internal#
  2302. Returns true if the key is in the map. O(1).
  2303. [.contract-item]
  2304. [[EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-]]
  2305. ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.Bytes32ToUintMap map) → uint256++` [.item-kind]#internal#
  2306. Returns the number of elements in the map. O(1).
  2307. [.contract-item]
  2308. [[EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-]]
  2309. ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.Bytes32ToUintMap map, uint256 index) → bytes32, uint256++` [.item-kind]#internal#
  2310. Returns the element stored at position `index` in the map. O(1).
  2311. Note that there are no guarantees on the ordering of values inside the
  2312. array, and it may change when more values are added or removed.
  2313. Requirements:
  2314. - `index` must be strictly less than {length}.
  2315. [.contract-item]
  2316. [[EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
  2317. ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool, uint256++` [.item-kind]#internal#
  2318. Tries to returns the value associated with `key`. O(1).
  2319. Does not revert if `key` is not in the map.
  2320. [.contract-item]
  2321. [[EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
  2322. ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → uint256++` [.item-kind]#internal#
  2323. Returns the value associated with `key`. O(1).
  2324. Requirements:
  2325. - `key` must be in the map.
  2326. [.contract-item]
  2327. [[EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-]]
  2328. ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.Bytes32ToUintMap map) → bytes32[]++` [.item-kind]#internal#
  2329. Return the an array containing all the keys
  2330. WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
  2331. to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
  2332. this function has an unbounded cost, and using it as part of a state-changing function may render the function
  2333. uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
  2334. [.contract-item]
  2335. [[EnumerableMap-EnumerableMapNonexistentKey-bytes32-]]
  2336. ==== `[.contract-item-name]#++EnumerableMapNonexistentKey++#++(bytes32 key)++` [.item-kind]#error#
  2337. Query for a nonexistent map key.
  2338. :Set: pass:normal[xref:#EnumerableSet-Set[`++Set++`]]
  2339. :Bytes32Set: pass:normal[xref:#EnumerableSet-Bytes32Set[`++Bytes32Set++`]]
  2340. :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-[`++add++`]]
  2341. :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-[`++remove++`]]
  2342. :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-[`++contains++`]]
  2343. :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-Bytes32Set-[`++length++`]]
  2344. :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-[`++at++`]]
  2345. :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-Bytes32Set-[`++values++`]]
  2346. :AddressSet: pass:normal[xref:#EnumerableSet-AddressSet[`++AddressSet++`]]
  2347. :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-AddressSet-address-[`++add++`]]
  2348. :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-[`++remove++`]]
  2349. :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-[`++contains++`]]
  2350. :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-AddressSet-[`++length++`]]
  2351. :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-[`++at++`]]
  2352. :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-AddressSet-[`++values++`]]
  2353. :UintSet: pass:normal[xref:#EnumerableSet-UintSet[`++UintSet++`]]
  2354. :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-[`++add++`]]
  2355. :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-[`++remove++`]]
  2356. :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-[`++contains++`]]
  2357. :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-UintSet-[`++length++`]]
  2358. :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-[`++at++`]]
  2359. :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-UintSet-[`++values++`]]
  2360. [.contract]
  2361. [[EnumerableSet]]
  2362. === `++EnumerableSet++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/structs/EnumerableSet.sol[{github-icon},role=heading-link]
  2363. [.hljs-theme-light.nopadding]
  2364. ```solidity
  2365. import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
  2366. ```
  2367. Library for managing
  2368. https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
  2369. types.
  2370. Sets have the following properties:
  2371. - Elements are added, removed, and checked for existence in constant time
  2372. (O(1)).
  2373. - Elements are enumerated in O(n). No guarantees are made on the ordering.
  2374. ```solidity
  2375. contract Example {
  2376. // Add the library methods
  2377. using EnumerableSet for EnumerableSet.AddressSet;
  2378. // Declare a set state variable
  2379. EnumerableSet.AddressSet private mySet;
  2380. }
  2381. ```
  2382. As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
  2383. and `uint256` (`UintSet`) are supported.
  2384. [WARNING]
  2385. ====
  2386. Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
  2387. unusable.
  2388. See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
  2389. In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
  2390. array of EnumerableSet.
  2391. ====
  2392. [.contract-index]
  2393. .Functions
  2394. --
  2395. * {xref-EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-}[`++add(set, value)++`]
  2396. * {xref-EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-}[`++remove(set, value)++`]
  2397. * {xref-EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-}[`++contains(set, value)++`]
  2398. * {xref-EnumerableSet-length-struct-EnumerableSet-Bytes32Set-}[`++length(set)++`]
  2399. * {xref-EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-}[`++at(set, index)++`]
  2400. * {xref-EnumerableSet-values-struct-EnumerableSet-Bytes32Set-}[`++values(set)++`]
  2401. * {xref-EnumerableSet-add-struct-EnumerableSet-AddressSet-address-}[`++add(set, value)++`]
  2402. * {xref-EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-}[`++remove(set, value)++`]
  2403. * {xref-EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-}[`++contains(set, value)++`]
  2404. * {xref-EnumerableSet-length-struct-EnumerableSet-AddressSet-}[`++length(set)++`]
  2405. * {xref-EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-}[`++at(set, index)++`]
  2406. * {xref-EnumerableSet-values-struct-EnumerableSet-AddressSet-}[`++values(set)++`]
  2407. * {xref-EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-}[`++add(set, value)++`]
  2408. * {xref-EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-}[`++remove(set, value)++`]
  2409. * {xref-EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-}[`++contains(set, value)++`]
  2410. * {xref-EnumerableSet-length-struct-EnumerableSet-UintSet-}[`++length(set)++`]
  2411. * {xref-EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-}[`++at(set, index)++`]
  2412. * {xref-EnumerableSet-values-struct-EnumerableSet-UintSet-}[`++values(set)++`]
  2413. --
  2414. [.contract-item]
  2415. [[EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-]]
  2416. ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
  2417. Add a value to a set. O(1).
  2418. Returns true if the value was added to the set, that is if it was not
  2419. already present.
  2420. [.contract-item]
  2421. [[EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-]]
  2422. ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
  2423. Removes a value from a set. O(1).
  2424. Returns true if the value was removed from the set, that is if it was
  2425. present.
  2426. [.contract-item]
  2427. [[EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-]]
  2428. ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
  2429. Returns true if the value is in the set. O(1).
  2430. [.contract-item]
  2431. [[EnumerableSet-length-struct-EnumerableSet-Bytes32Set-]]
  2432. ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.Bytes32Set set) → uint256++` [.item-kind]#internal#
  2433. Returns the number of values in the set. O(1).
  2434. [.contract-item]
  2435. [[EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-]]
  2436. ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.Bytes32Set set, uint256 index) → bytes32++` [.item-kind]#internal#
  2437. Returns the value stored at position `index` in the set. O(1).
  2438. Note that there are no guarantees on the ordering of values inside the
  2439. array, and it may change when more values are added or removed.
  2440. Requirements:
  2441. - `index` must be strictly less than {length}.
  2442. [.contract-item]
  2443. [[EnumerableSet-values-struct-EnumerableSet-Bytes32Set-]]
  2444. ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.Bytes32Set set) → bytes32[]++` [.item-kind]#internal#
  2445. Return the entire set in an array
  2446. WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
  2447. to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
  2448. this function has an unbounded cost, and using it as part of a state-changing function may render the function
  2449. uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
  2450. [.contract-item]
  2451. [[EnumerableSet-add-struct-EnumerableSet-AddressSet-address-]]
  2452. ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
  2453. Add a value to a set. O(1).
  2454. Returns true if the value was added to the set, that is if it was not
  2455. already present.
  2456. [.contract-item]
  2457. [[EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-]]
  2458. ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
  2459. Removes a value from a set. O(1).
  2460. Returns true if the value was removed from the set, that is if it was
  2461. present.
  2462. [.contract-item]
  2463. [[EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-]]
  2464. ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
  2465. Returns true if the value is in the set. O(1).
  2466. [.contract-item]
  2467. [[EnumerableSet-length-struct-EnumerableSet-AddressSet-]]
  2468. ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.AddressSet set) → uint256++` [.item-kind]#internal#
  2469. Returns the number of values in the set. O(1).
  2470. [.contract-item]
  2471. [[EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-]]
  2472. ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.AddressSet set, uint256 index) → address++` [.item-kind]#internal#
  2473. Returns the value stored at position `index` in the set. O(1).
  2474. Note that there are no guarantees on the ordering of values inside the
  2475. array, and it may change when more values are added or removed.
  2476. Requirements:
  2477. - `index` must be strictly less than {length}.
  2478. [.contract-item]
  2479. [[EnumerableSet-values-struct-EnumerableSet-AddressSet-]]
  2480. ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.AddressSet set) → address[]++` [.item-kind]#internal#
  2481. Return the entire set in an array
  2482. WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
  2483. to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
  2484. this function has an unbounded cost, and using it as part of a state-changing function may render the function
  2485. uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
  2486. [.contract-item]
  2487. [[EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-]]
  2488. ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
  2489. Add a value to a set. O(1).
  2490. Returns true if the value was added to the set, that is if it was not
  2491. already present.
  2492. [.contract-item]
  2493. [[EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-]]
  2494. ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
  2495. Removes a value from a set. O(1).
  2496. Returns true if the value was removed from the set, that is if it was
  2497. present.
  2498. [.contract-item]
  2499. [[EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-]]
  2500. ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
  2501. Returns true if the value is in the set. O(1).
  2502. [.contract-item]
  2503. [[EnumerableSet-length-struct-EnumerableSet-UintSet-]]
  2504. ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.UintSet set) → uint256++` [.item-kind]#internal#
  2505. Returns the number of values in the set. O(1).
  2506. [.contract-item]
  2507. [[EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-]]
  2508. ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.UintSet set, uint256 index) → uint256++` [.item-kind]#internal#
  2509. Returns the value stored at position `index` in the set. O(1).
  2510. Note that there are no guarantees on the ordering of values inside the
  2511. array, and it may change when more values are added or removed.
  2512. Requirements:
  2513. - `index` must be strictly less than {length}.
  2514. [.contract-item]
  2515. [[EnumerableSet-values-struct-EnumerableSet-UintSet-]]
  2516. ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.UintSet set) → uint256[]++` [.item-kind]#internal#
  2517. Return the entire set in an array
  2518. WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
  2519. to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
  2520. this function has an unbounded cost, and using it as part of a state-changing function may render the function
  2521. uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
  2522. :QueueEmpty: pass:normal[xref:#DoubleEndedQueue-QueueEmpty--[`++QueueEmpty++`]]
  2523. :QueueFull: pass:normal[xref:#DoubleEndedQueue-QueueFull--[`++QueueFull++`]]
  2524. :QueueOutOfBounds: pass:normal[xref:#DoubleEndedQueue-QueueOutOfBounds--[`++QueueOutOfBounds++`]]
  2525. :Bytes32Deque: pass:normal[xref:#DoubleEndedQueue-Bytes32Deque[`++Bytes32Deque++`]]
  2526. :pushBack: pass:normal[xref:#DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-[`++pushBack++`]]
  2527. :popBack: pass:normal[xref:#DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-[`++popBack++`]]
  2528. :pushFront: pass:normal[xref:#DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-[`++pushFront++`]]
  2529. :popFront: pass:normal[xref:#DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-[`++popFront++`]]
  2530. :front: pass:normal[xref:#DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-[`++front++`]]
  2531. :back: pass:normal[xref:#DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-[`++back++`]]
  2532. :at: pass:normal[xref:#DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-[`++at++`]]
  2533. :clear: pass:normal[xref:#DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-[`++clear++`]]
  2534. :length: pass:normal[xref:#DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-[`++length++`]]
  2535. :empty: pass:normal[xref:#DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-[`++empty++`]]
  2536. [.contract]
  2537. [[DoubleEndedQueue]]
  2538. === `++DoubleEndedQueue++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/structs/DoubleEndedQueue.sol[{github-icon},role=heading-link]
  2539. [.hljs-theme-light.nopadding]
  2540. ```solidity
  2541. import "@openzeppelin/contracts/utils/structs/DoubleEndedQueue.sol";
  2542. ```
  2543. A sequence of items with the ability to efficiently push and pop items (i.e. insert and remove) on both ends of
  2544. the sequence (called front and back). Among other access patterns, it can be used to implement efficient LIFO and
  2545. FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that
  2546. the existing queue contents are left in storage.
  2547. The struct is called `Bytes32Deque`. Other types can be cast to and from `bytes32`. This data structure can only be
  2548. used in storage, and not in memory.
  2549. ```solidity
  2550. DoubleEndedQueue.Bytes32Deque queue;
  2551. ```
  2552. [.contract-index]
  2553. .Functions
  2554. --
  2555. * {xref-DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-}[`++pushBack(deque, value)++`]
  2556. * {xref-DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-}[`++popBack(deque)++`]
  2557. * {xref-DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-}[`++pushFront(deque, value)++`]
  2558. * {xref-DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-}[`++popFront(deque)++`]
  2559. * {xref-DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-}[`++front(deque)++`]
  2560. * {xref-DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-}[`++back(deque)++`]
  2561. * {xref-DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-}[`++at(deque, index)++`]
  2562. * {xref-DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-}[`++clear(deque)++`]
  2563. * {xref-DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-}[`++length(deque)++`]
  2564. * {xref-DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-}[`++empty(deque)++`]
  2565. --
  2566. [.contract-index]
  2567. .Errors
  2568. --
  2569. * {xref-DoubleEndedQueue-QueueEmpty--}[`++QueueEmpty()++`]
  2570. * {xref-DoubleEndedQueue-QueueFull--}[`++QueueFull()++`]
  2571. * {xref-DoubleEndedQueue-QueueOutOfBounds--}[`++QueueOutOfBounds()++`]
  2572. --
  2573. [.contract-item]
  2574. [[DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-]]
  2575. ==== `[.contract-item-name]#++pushBack++#++(struct DoubleEndedQueue.Bytes32Deque deque, bytes32 value)++` [.item-kind]#internal#
  2576. Inserts an item at the end of the queue.
  2577. Reverts with {QueueFull} if the queue is full.
  2578. [.contract-item]
  2579. [[DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-]]
  2580. ==== `[.contract-item-name]#++popBack++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
  2581. Removes the item at the end of the queue and returns it.
  2582. Reverts with {QueueEmpty} if the queue is empty.
  2583. [.contract-item]
  2584. [[DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-]]
  2585. ==== `[.contract-item-name]#++pushFront++#++(struct DoubleEndedQueue.Bytes32Deque deque, bytes32 value)++` [.item-kind]#internal#
  2586. Inserts an item at the beginning of the queue.
  2587. Reverts with {QueueFull} if the queue is full.
  2588. [.contract-item]
  2589. [[DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-]]
  2590. ==== `[.contract-item-name]#++popFront++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
  2591. Removes the item at the beginning of the queue and returns it.
  2592. Reverts with `QueueEmpty` if the queue is empty.
  2593. [.contract-item]
  2594. [[DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-]]
  2595. ==== `[.contract-item-name]#++front++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
  2596. Returns the item at the beginning of the queue.
  2597. Reverts with `QueueEmpty` if the queue is empty.
  2598. [.contract-item]
  2599. [[DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-]]
  2600. ==== `[.contract-item-name]#++back++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
  2601. Returns the item at the end of the queue.
  2602. Reverts with `QueueEmpty` if the queue is empty.
  2603. [.contract-item]
  2604. [[DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-]]
  2605. ==== `[.contract-item-name]#++at++#++(struct DoubleEndedQueue.Bytes32Deque deque, uint256 index) → bytes32 value++` [.item-kind]#internal#
  2606. Return the item at a position in the queue given by `index`, with the first item at 0 and last item at
  2607. `length(deque) - 1`.
  2608. Reverts with `QueueOutOfBounds` if the index is out of bounds.
  2609. [.contract-item]
  2610. [[DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-]]
  2611. ==== `[.contract-item-name]#++clear++#++(struct DoubleEndedQueue.Bytes32Deque deque)++` [.item-kind]#internal#
  2612. Resets the queue back to being empty.
  2613. NOTE: The current items are left behind in storage. This does not affect the functioning of the queue, but misses
  2614. out on potential gas refunds.
  2615. [.contract-item]
  2616. [[DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-]]
  2617. ==== `[.contract-item-name]#++length++#++(struct DoubleEndedQueue.Bytes32Deque deque) → uint256++` [.item-kind]#internal#
  2618. Returns the number of items in the queue.
  2619. [.contract-item]
  2620. [[DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-]]
  2621. ==== `[.contract-item-name]#++empty++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bool++` [.item-kind]#internal#
  2622. Returns true if the queue is empty.
  2623. [.contract-item]
  2624. [[DoubleEndedQueue-QueueEmpty--]]
  2625. ==== `[.contract-item-name]#++QueueEmpty++#++()++` [.item-kind]#error#
  2626. An operation (e.g. {front}) couldn't be completed due to the queue being empty.
  2627. [.contract-item]
  2628. [[DoubleEndedQueue-QueueFull--]]
  2629. ==== `[.contract-item-name]#++QueueFull++#++()++` [.item-kind]#error#
  2630. A push operation couldn't be completed due to the queue being full.
  2631. [.contract-item]
  2632. [[DoubleEndedQueue-QueueOutOfBounds--]]
  2633. ==== `[.contract-item-name]#++QueueOutOfBounds++#++()++` [.item-kind]#error#
  2634. An operation (e.g. {at}) couldn't be completed due to an index being out of bounds.
  2635. :CheckpointUnorderedInsertion: pass:normal[xref:#Checkpoints-CheckpointUnorderedInsertion--[`++CheckpointUnorderedInsertion++`]]
  2636. :Trace224: pass:normal[xref:#Checkpoints-Trace224[`++Trace224++`]]
  2637. :Checkpoint224: pass:normal[xref:#Checkpoints-Checkpoint224[`++Checkpoint224++`]]
  2638. :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-[`++push++`]]
  2639. :lowerLookup: pass:normal[xref:#Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-[`++lowerLookup++`]]
  2640. :upperLookup: pass:normal[xref:#Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-[`++upperLookup++`]]
  2641. :upperLookupRecent: pass:normal[xref:#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-[`++upperLookupRecent++`]]
  2642. :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-Trace224-[`++latest++`]]
  2643. :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-[`++latestCheckpoint++`]]
  2644. :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-Trace224-[`++length++`]]
  2645. :at: pass:normal[xref:#Checkpoints-at-struct-Checkpoints-Trace224-uint32-[`++at++`]]
  2646. :Trace208: pass:normal[xref:#Checkpoints-Trace208[`++Trace208++`]]
  2647. :Checkpoint208: pass:normal[xref:#Checkpoints-Checkpoint208[`++Checkpoint208++`]]
  2648. :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-[`++push++`]]
  2649. :lowerLookup: pass:normal[xref:#Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-[`++lowerLookup++`]]
  2650. :upperLookup: pass:normal[xref:#Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-[`++upperLookup++`]]
  2651. :upperLookupRecent: pass:normal[xref:#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-[`++upperLookupRecent++`]]
  2652. :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-Trace208-[`++latest++`]]
  2653. :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-[`++latestCheckpoint++`]]
  2654. :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-Trace208-[`++length++`]]
  2655. :at: pass:normal[xref:#Checkpoints-at-struct-Checkpoints-Trace208-uint32-[`++at++`]]
  2656. :Trace160: pass:normal[xref:#Checkpoints-Trace160[`++Trace160++`]]
  2657. :Checkpoint160: pass:normal[xref:#Checkpoints-Checkpoint160[`++Checkpoint160++`]]
  2658. :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-[`++push++`]]
  2659. :lowerLookup: pass:normal[xref:#Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-[`++lowerLookup++`]]
  2660. :upperLookup: pass:normal[xref:#Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-[`++upperLookup++`]]
  2661. :upperLookupRecent: pass:normal[xref:#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-[`++upperLookupRecent++`]]
  2662. :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-Trace160-[`++latest++`]]
  2663. :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-[`++latestCheckpoint++`]]
  2664. :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-Trace160-[`++length++`]]
  2665. :at: pass:normal[xref:#Checkpoints-at-struct-Checkpoints-Trace160-uint32-[`++at++`]]
  2666. [.contract]
  2667. [[Checkpoints]]
  2668. === `++Checkpoints++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/structs/Checkpoints.sol[{github-icon},role=heading-link]
  2669. [.hljs-theme-light.nopadding]
  2670. ```solidity
  2671. import "@openzeppelin/contracts/utils/structs/Checkpoints.sol";
  2672. ```
  2673. This library defines the `Trace*` struct, for checkpointing values as they change at different points in
  2674. time, and later looking up past values by block number. See {Votes} as an example.
  2675. To create a history of checkpoints define a variable type `Checkpoints.Trace*` in your contract, and store a new
  2676. checkpoint for the current transaction block using the {push} function.
  2677. [.contract-index]
  2678. .Functions
  2679. --
  2680. * {xref-Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-}[`++push(self, key, value)++`]
  2681. * {xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-}[`++lowerLookup(self, key)++`]
  2682. * {xref-Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-}[`++upperLookup(self, key)++`]
  2683. * {xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-}[`++upperLookupRecent(self, key)++`]
  2684. * {xref-Checkpoints-latest-struct-Checkpoints-Trace224-}[`++latest(self)++`]
  2685. * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-}[`++latestCheckpoint(self)++`]
  2686. * {xref-Checkpoints-length-struct-Checkpoints-Trace224-}[`++length(self)++`]
  2687. * {xref-Checkpoints-at-struct-Checkpoints-Trace224-uint32-}[`++at(self, pos)++`]
  2688. * {xref-Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-}[`++push(self, key, value)++`]
  2689. * {xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-}[`++lowerLookup(self, key)++`]
  2690. * {xref-Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-}[`++upperLookup(self, key)++`]
  2691. * {xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-}[`++upperLookupRecent(self, key)++`]
  2692. * {xref-Checkpoints-latest-struct-Checkpoints-Trace208-}[`++latest(self)++`]
  2693. * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-}[`++latestCheckpoint(self)++`]
  2694. * {xref-Checkpoints-length-struct-Checkpoints-Trace208-}[`++length(self)++`]
  2695. * {xref-Checkpoints-at-struct-Checkpoints-Trace208-uint32-}[`++at(self, pos)++`]
  2696. * {xref-Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-}[`++push(self, key, value)++`]
  2697. * {xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-}[`++lowerLookup(self, key)++`]
  2698. * {xref-Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-}[`++upperLookup(self, key)++`]
  2699. * {xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-}[`++upperLookupRecent(self, key)++`]
  2700. * {xref-Checkpoints-latest-struct-Checkpoints-Trace160-}[`++latest(self)++`]
  2701. * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-}[`++latestCheckpoint(self)++`]
  2702. * {xref-Checkpoints-length-struct-Checkpoints-Trace160-}[`++length(self)++`]
  2703. * {xref-Checkpoints-at-struct-Checkpoints-Trace160-uint32-}[`++at(self, pos)++`]
  2704. --
  2705. [.contract-index]
  2706. .Errors
  2707. --
  2708. * {xref-Checkpoints-CheckpointUnorderedInsertion--}[`++CheckpointUnorderedInsertion()++`]
  2709. --
  2710. [.contract-item]
  2711. [[Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-]]
  2712. ==== `[.contract-item-name]#++push++#++(struct Checkpoints.Trace224 self, uint32 key, uint224 value) → uint224, uint224++` [.item-kind]#internal#
  2713. Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.
  2714. Returns previous value and new value.
  2715. IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint32).max` key set will disable the
  2716. library.
  2717. [.contract-item]
  2718. [[Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-]]
  2719. ==== `[.contract-item-name]#++lowerLookup++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
  2720. Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
  2721. there is none.
  2722. [.contract-item]
  2723. [[Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-]]
  2724. ==== `[.contract-item-name]#++upperLookup++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
  2725. Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
  2726. if there is none.
  2727. [.contract-item]
  2728. [[Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-]]
  2729. ==== `[.contract-item-name]#++upperLookupRecent++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
  2730. Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
  2731. if there is none.
  2732. NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high
  2733. keys).
  2734. [.contract-item]
  2735. [[Checkpoints-latest-struct-Checkpoints-Trace224-]]
  2736. ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.Trace224 self) → uint224++` [.item-kind]#internal#
  2737. Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
  2738. [.contract-item]
  2739. [[Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-]]
  2740. ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.Trace224 self) → bool exists, uint32 _key, uint224 _value++` [.item-kind]#internal#
  2741. Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
  2742. in the most recent checkpoint.
  2743. [.contract-item]
  2744. [[Checkpoints-length-struct-Checkpoints-Trace224-]]
  2745. ==== `[.contract-item-name]#++length++#++(struct Checkpoints.Trace224 self) → uint256++` [.item-kind]#internal#
  2746. Returns the number of checkpoint.
  2747. [.contract-item]
  2748. [[Checkpoints-at-struct-Checkpoints-Trace224-uint32-]]
  2749. ==== `[.contract-item-name]#++at++#++(struct Checkpoints.Trace224 self, uint32 pos) → struct Checkpoints.Checkpoint224++` [.item-kind]#internal#
  2750. Returns checkpoint at given position.
  2751. [.contract-item]
  2752. [[Checkpoints-push-struct-Checkpoints-Trace208-uint48-uint208-]]
  2753. ==== `[.contract-item-name]#++push++#++(struct Checkpoints.Trace208 self, uint48 key, uint208 value) → uint208, uint208++` [.item-kind]#internal#
  2754. Pushes a (`key`, `value`) pair into a Trace208 so that it is stored as the checkpoint.
  2755. Returns previous value and new value.
  2756. IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint48).max` key set will disable the
  2757. library.
  2758. [.contract-item]
  2759. [[Checkpoints-lowerLookup-struct-Checkpoints-Trace208-uint48-]]
  2760. ==== `[.contract-item-name]#++lowerLookup++#++(struct Checkpoints.Trace208 self, uint48 key) → uint208++` [.item-kind]#internal#
  2761. Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
  2762. there is none.
  2763. [.contract-item]
  2764. [[Checkpoints-upperLookup-struct-Checkpoints-Trace208-uint48-]]
  2765. ==== `[.contract-item-name]#++upperLookup++#++(struct Checkpoints.Trace208 self, uint48 key) → uint208++` [.item-kind]#internal#
  2766. Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
  2767. if there is none.
  2768. [.contract-item]
  2769. [[Checkpoints-upperLookupRecent-struct-Checkpoints-Trace208-uint48-]]
  2770. ==== `[.contract-item-name]#++upperLookupRecent++#++(struct Checkpoints.Trace208 self, uint48 key) → uint208++` [.item-kind]#internal#
  2771. Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
  2772. if there is none.
  2773. NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high
  2774. keys).
  2775. [.contract-item]
  2776. [[Checkpoints-latest-struct-Checkpoints-Trace208-]]
  2777. ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.Trace208 self) → uint208++` [.item-kind]#internal#
  2778. Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
  2779. [.contract-item]
  2780. [[Checkpoints-latestCheckpoint-struct-Checkpoints-Trace208-]]
  2781. ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.Trace208 self) → bool exists, uint48 _key, uint208 _value++` [.item-kind]#internal#
  2782. Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
  2783. in the most recent checkpoint.
  2784. [.contract-item]
  2785. [[Checkpoints-length-struct-Checkpoints-Trace208-]]
  2786. ==== `[.contract-item-name]#++length++#++(struct Checkpoints.Trace208 self) → uint256++` [.item-kind]#internal#
  2787. Returns the number of checkpoint.
  2788. [.contract-item]
  2789. [[Checkpoints-at-struct-Checkpoints-Trace208-uint32-]]
  2790. ==== `[.contract-item-name]#++at++#++(struct Checkpoints.Trace208 self, uint32 pos) → struct Checkpoints.Checkpoint208++` [.item-kind]#internal#
  2791. Returns checkpoint at given position.
  2792. [.contract-item]
  2793. [[Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-]]
  2794. ==== `[.contract-item-name]#++push++#++(struct Checkpoints.Trace160 self, uint96 key, uint160 value) → uint160, uint160++` [.item-kind]#internal#
  2795. Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.
  2796. Returns previous value and new value.
  2797. IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint96).max` key set will disable the
  2798. library.
  2799. [.contract-item]
  2800. [[Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-]]
  2801. ==== `[.contract-item-name]#++lowerLookup++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
  2802. Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
  2803. there is none.
  2804. [.contract-item]
  2805. [[Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-]]
  2806. ==== `[.contract-item-name]#++upperLookup++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
  2807. Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
  2808. if there is none.
  2809. [.contract-item]
  2810. [[Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-]]
  2811. ==== `[.contract-item-name]#++upperLookupRecent++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
  2812. Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
  2813. if there is none.
  2814. NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high
  2815. keys).
  2816. [.contract-item]
  2817. [[Checkpoints-latest-struct-Checkpoints-Trace160-]]
  2818. ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.Trace160 self) → uint160++` [.item-kind]#internal#
  2819. Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
  2820. [.contract-item]
  2821. [[Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-]]
  2822. ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.Trace160 self) → bool exists, uint96 _key, uint160 _value++` [.item-kind]#internal#
  2823. Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
  2824. in the most recent checkpoint.
  2825. [.contract-item]
  2826. [[Checkpoints-length-struct-Checkpoints-Trace160-]]
  2827. ==== `[.contract-item-name]#++length++#++(struct Checkpoints.Trace160 self) → uint256++` [.item-kind]#internal#
  2828. Returns the number of checkpoint.
  2829. [.contract-item]
  2830. [[Checkpoints-at-struct-Checkpoints-Trace160-uint32-]]
  2831. ==== `[.contract-item-name]#++at++#++(struct Checkpoints.Trace160 self, uint32 pos) → struct Checkpoints.Checkpoint160++` [.item-kind]#internal#
  2832. Returns checkpoint at given position.
  2833. [.contract-item]
  2834. [[Checkpoints-CheckpointUnorderedInsertion--]]
  2835. ==== `[.contract-item-name]#++CheckpointUnorderedInsertion++#++()++` [.item-kind]#error#
  2836. A value was attempted to be inserted on a past checkpoint.
  2837. == Libraries
  2838. :Create2InsufficientBalance: pass:normal[xref:#Create2-Create2InsufficientBalance-uint256-uint256-[`++Create2InsufficientBalance++`]]
  2839. :Create2EmptyBytecode: pass:normal[xref:#Create2-Create2EmptyBytecode--[`++Create2EmptyBytecode++`]]
  2840. :Create2FailedDeployment: pass:normal[xref:#Create2-Create2FailedDeployment--[`++Create2FailedDeployment++`]]
  2841. :deploy: pass:normal[xref:#Create2-deploy-uint256-bytes32-bytes-[`++deploy++`]]
  2842. :computeAddress: pass:normal[xref:#Create2-computeAddress-bytes32-bytes32-[`++computeAddress++`]]
  2843. :computeAddress: pass:normal[xref:#Create2-computeAddress-bytes32-bytes32-address-[`++computeAddress++`]]
  2844. [.contract]
  2845. [[Create2]]
  2846. === `++Create2++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/Create2.sol[{github-icon},role=heading-link]
  2847. [.hljs-theme-light.nopadding]
  2848. ```solidity
  2849. import "@openzeppelin/contracts/utils/Create2.sol";
  2850. ```
  2851. Helper to make usage of the `CREATE2` EVM opcode easier and safer.
  2852. `CREATE2` can be used to compute in advance the address where a smart
  2853. contract will be deployed, which allows for interesting new mechanisms known
  2854. as 'counterfactual interactions'.
  2855. See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
  2856. information.
  2857. [.contract-index]
  2858. .Functions
  2859. --
  2860. * {xref-Create2-deploy-uint256-bytes32-bytes-}[`++deploy(amount, salt, bytecode)++`]
  2861. * {xref-Create2-computeAddress-bytes32-bytes32-}[`++computeAddress(salt, bytecodeHash)++`]
  2862. * {xref-Create2-computeAddress-bytes32-bytes32-address-}[`++computeAddress(salt, bytecodeHash, deployer)++`]
  2863. --
  2864. [.contract-index]
  2865. .Errors
  2866. --
  2867. * {xref-Create2-Create2InsufficientBalance-uint256-uint256-}[`++Create2InsufficientBalance(balance, needed)++`]
  2868. * {xref-Create2-Create2EmptyBytecode--}[`++Create2EmptyBytecode()++`]
  2869. * {xref-Create2-Create2FailedDeployment--}[`++Create2FailedDeployment()++`]
  2870. --
  2871. [.contract-item]
  2872. [[Create2-deploy-uint256-bytes32-bytes-]]
  2873. ==== `[.contract-item-name]#++deploy++#++(uint256 amount, bytes32 salt, bytes bytecode) → address addr++` [.item-kind]#internal#
  2874. Deploys a contract using `CREATE2`. The address where the contract
  2875. will be deployed can be known in advance via {computeAddress}.
  2876. The bytecode for a contract can be obtained from Solidity with
  2877. `type(contractName).creationCode`.
  2878. Requirements:
  2879. - `bytecode` must not be empty.
  2880. - `salt` must have not been used for `bytecode` already.
  2881. - the factory must have a balance of at least `amount`.
  2882. - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
  2883. [.contract-item]
  2884. [[Create2-computeAddress-bytes32-bytes32-]]
  2885. ==== `[.contract-item-name]#++computeAddress++#++(bytes32 salt, bytes32 bytecodeHash) → address++` [.item-kind]#internal#
  2886. Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
  2887. `bytecodeHash` or `salt` will result in a new destination address.
  2888. [.contract-item]
  2889. [[Create2-computeAddress-bytes32-bytes32-address-]]
  2890. ==== `[.contract-item-name]#++computeAddress++#++(bytes32 salt, bytes32 bytecodeHash, address deployer) → address addr++` [.item-kind]#internal#
  2891. Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
  2892. `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
  2893. [.contract-item]
  2894. [[Create2-Create2InsufficientBalance-uint256-uint256-]]
  2895. ==== `[.contract-item-name]#++Create2InsufficientBalance++#++(uint256 balance, uint256 needed)++` [.item-kind]#error#
  2896. Not enough balance for performing a CREATE2 deploy.
  2897. [.contract-item]
  2898. [[Create2-Create2EmptyBytecode--]]
  2899. ==== `[.contract-item-name]#++Create2EmptyBytecode++#++()++` [.item-kind]#error#
  2900. There's no code to deploy.
  2901. [.contract-item]
  2902. [[Create2-Create2FailedDeployment--]]
  2903. ==== `[.contract-item-name]#++Create2FailedDeployment++#++()++` [.item-kind]#error#
  2904. The deployment failed.
  2905. :AddressInsufficientBalance: pass:normal[xref:#Address-AddressInsufficientBalance-address-[`++AddressInsufficientBalance++`]]
  2906. :AddressEmptyCode: pass:normal[xref:#Address-AddressEmptyCode-address-[`++AddressEmptyCode++`]]
  2907. :FailedInnerCall: pass:normal[xref:#Address-FailedInnerCall--[`++FailedInnerCall++`]]
  2908. :sendValue: pass:normal[xref:#Address-sendValue-address-payable-uint256-[`++sendValue++`]]
  2909. :functionCall: pass:normal[xref:#Address-functionCall-address-bytes-[`++functionCall++`]]
  2910. :functionCallWithValue: pass:normal[xref:#Address-functionCallWithValue-address-bytes-uint256-[`++functionCallWithValue++`]]
  2911. :functionStaticCall: pass:normal[xref:#Address-functionStaticCall-address-bytes-[`++functionStaticCall++`]]
  2912. :functionDelegateCall: pass:normal[xref:#Address-functionDelegateCall-address-bytes-[`++functionDelegateCall++`]]
  2913. :verifyCallResultFromTarget: pass:normal[xref:#Address-verifyCallResultFromTarget-address-bool-bytes-[`++verifyCallResultFromTarget++`]]
  2914. :verifyCallResult: pass:normal[xref:#Address-verifyCallResult-bool-bytes-[`++verifyCallResult++`]]
  2915. [.contract]
  2916. [[Address]]
  2917. === `++Address++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/Address.sol[{github-icon},role=heading-link]
  2918. [.hljs-theme-light.nopadding]
  2919. ```solidity
  2920. import "@openzeppelin/contracts/utils/Address.sol";
  2921. ```
  2922. Collection of functions related to the address type
  2923. [.contract-index]
  2924. .Functions
  2925. --
  2926. * {xref-Address-sendValue-address-payable-uint256-}[`++sendValue(recipient, amount)++`]
  2927. * {xref-Address-functionCall-address-bytes-}[`++functionCall(target, data)++`]
  2928. * {xref-Address-functionCallWithValue-address-bytes-uint256-}[`++functionCallWithValue(target, data, value)++`]
  2929. * {xref-Address-functionStaticCall-address-bytes-}[`++functionStaticCall(target, data)++`]
  2930. * {xref-Address-functionDelegateCall-address-bytes-}[`++functionDelegateCall(target, data)++`]
  2931. * {xref-Address-verifyCallResultFromTarget-address-bool-bytes-}[`++verifyCallResultFromTarget(target, success, returndata)++`]
  2932. * {xref-Address-verifyCallResult-bool-bytes-}[`++verifyCallResult(success, returndata)++`]
  2933. --
  2934. [.contract-index]
  2935. .Errors
  2936. --
  2937. * {xref-Address-AddressInsufficientBalance-address-}[`++AddressInsufficientBalance(account)++`]
  2938. * {xref-Address-AddressEmptyCode-address-}[`++AddressEmptyCode(target)++`]
  2939. * {xref-Address-FailedInnerCall--}[`++FailedInnerCall()++`]
  2940. --
  2941. [.contract-item]
  2942. [[Address-sendValue-address-payable-uint256-]]
  2943. ==== `[.contract-item-name]#++sendValue++#++(address payable recipient, uint256 amount)++` [.item-kind]#internal#
  2944. Replacement for Solidity's `transfer`: sends `amount` wei to
  2945. `recipient`, forwarding all available gas and reverting on errors.
  2946. https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
  2947. of certain opcodes, possibly making contracts go over the 2300 gas limit
  2948. imposed by `transfer`, making them unable to receive funds via
  2949. `transfer`. {sendValue} removes this limitation.
  2950. https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
  2951. IMPORTANT: because control is transferred to `recipient`, care must be
  2952. taken to not create reentrancy vulnerabilities. Consider using
  2953. {ReentrancyGuard} or the
  2954. https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
  2955. [.contract-item]
  2956. [[Address-functionCall-address-bytes-]]
  2957. ==== `[.contract-item-name]#++functionCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
  2958. Performs a Solidity function call using a low level `call`. A
  2959. plain `call` is an unsafe replacement for a function call: use this
  2960. function instead.
  2961. If `target` reverts with a revert reason or custom error, it is bubbled
  2962. up by this function (like regular Solidity function calls). However, if
  2963. the call reverted with no returned reason, this function reverts with a
  2964. {FailedInnerCall} error.
  2965. Returns the raw returned data. To convert to the expected return value,
  2966. use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
  2967. Requirements:
  2968. - `target` must be a contract.
  2969. - calling `target` with `data` must not revert.
  2970. [.contract-item]
  2971. [[Address-functionCallWithValue-address-bytes-uint256-]]
  2972. ==== `[.contract-item-name]#++functionCallWithValue++#++(address target, bytes data, uint256 value) → bytes++` [.item-kind]#internal#
  2973. Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
  2974. but also transferring `value` wei to `target`.
  2975. Requirements:
  2976. - the calling contract must have an ETH balance of at least `value`.
  2977. - the called Solidity function must be `payable`.
  2978. [.contract-item]
  2979. [[Address-functionStaticCall-address-bytes-]]
  2980. ==== `[.contract-item-name]#++functionStaticCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
  2981. Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
  2982. but performing a static call.
  2983. [.contract-item]
  2984. [[Address-functionDelegateCall-address-bytes-]]
  2985. ==== `[.contract-item-name]#++functionDelegateCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
  2986. Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
  2987. but performing a delegate call.
  2988. [.contract-item]
  2989. [[Address-verifyCallResultFromTarget-address-bool-bytes-]]
  2990. ==== `[.contract-item-name]#++verifyCallResultFromTarget++#++(address target, bool success, bytes returndata) → bytes++` [.item-kind]#internal#
  2991. Tool to verify that a low level call to smart-contract was successful, and reverts if the target
  2992. was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
  2993. unsuccessful call.
  2994. [.contract-item]
  2995. [[Address-verifyCallResult-bool-bytes-]]
  2996. ==== `[.contract-item-name]#++verifyCallResult++#++(bool success, bytes returndata) → bytes++` [.item-kind]#internal#
  2997. Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
  2998. revert reason or with a default {FailedInnerCall} error.
  2999. [.contract-item]
  3000. [[Address-AddressInsufficientBalance-address-]]
  3001. ==== `[.contract-item-name]#++AddressInsufficientBalance++#++(address account)++` [.item-kind]#error#
  3002. The ETH balance of the account is not enough to perform the operation.
  3003. [.contract-item]
  3004. [[Address-AddressEmptyCode-address-]]
  3005. ==== `[.contract-item-name]#++AddressEmptyCode++#++(address target)++` [.item-kind]#error#
  3006. There's no code at `target` (it is not a contract).
  3007. [.contract-item]
  3008. [[Address-FailedInnerCall--]]
  3009. ==== `[.contract-item-name]#++FailedInnerCall++#++()++` [.item-kind]#error#
  3010. A call to an address target failed. The target may have reverted.
  3011. :findUpperBound: pass:normal[xref:#Arrays-findUpperBound-uint256---uint256-[`++findUpperBound++`]]
  3012. :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-address---uint256-[`++unsafeAccess++`]]
  3013. :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-bytes32---uint256-[`++unsafeAccess++`]]
  3014. :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-uint256---uint256-[`++unsafeAccess++`]]
  3015. :unsafeMemoryAccess: pass:normal[xref:#Arrays-unsafeMemoryAccess-uint256---uint256-[`++unsafeMemoryAccess++`]]
  3016. :unsafeMemoryAccess: pass:normal[xref:#Arrays-unsafeMemoryAccess-address---uint256-[`++unsafeMemoryAccess++`]]
  3017. [.contract]
  3018. [[Arrays]]
  3019. === `++Arrays++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/Arrays.sol[{github-icon},role=heading-link]
  3020. [.hljs-theme-light.nopadding]
  3021. ```solidity
  3022. import "@openzeppelin/contracts/utils/Arrays.sol";
  3023. ```
  3024. Collection of functions related to array types.
  3025. [.contract-index]
  3026. .Functions
  3027. --
  3028. * {xref-Arrays-findUpperBound-uint256---uint256-}[`++findUpperBound(array, element)++`]
  3029. * {xref-Arrays-unsafeAccess-address---uint256-}[`++unsafeAccess(arr, pos)++`]
  3030. * {xref-Arrays-unsafeAccess-bytes32---uint256-}[`++unsafeAccess(arr, pos)++`]
  3031. * {xref-Arrays-unsafeAccess-uint256---uint256-}[`++unsafeAccess(arr, pos)++`]
  3032. * {xref-Arrays-unsafeMemoryAccess-uint256---uint256-}[`++unsafeMemoryAccess(arr, pos)++`]
  3033. * {xref-Arrays-unsafeMemoryAccess-address---uint256-}[`++unsafeMemoryAccess(arr, pos)++`]
  3034. --
  3035. [.contract-item]
  3036. [[Arrays-findUpperBound-uint256---uint256-]]
  3037. ==== `[.contract-item-name]#++findUpperBound++#++(uint256[] array, uint256 element) → uint256++` [.item-kind]#internal#
  3038. Searches a sorted `array` and returns the first index that contains
  3039. a value greater or equal to `element`. If no such index exists (i.e. all
  3040. values in the array are strictly less than `element`), the array length is
  3041. returned. Time complexity O(log n).
  3042. `array` is expected to be sorted in ascending order, and to contain no
  3043. repeated elements.
  3044. [.contract-item]
  3045. [[Arrays-unsafeAccess-address---uint256-]]
  3046. ==== `[.contract-item-name]#++unsafeAccess++#++(address[] arr, uint256 pos) → struct StorageSlot.AddressSlot++` [.item-kind]#internal#
  3047. Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
  3048. WARNING: Only use if you are certain `pos` is lower than the array length.
  3049. [.contract-item]
  3050. [[Arrays-unsafeAccess-bytes32---uint256-]]
  3051. ==== `[.contract-item-name]#++unsafeAccess++#++(bytes32[] arr, uint256 pos) → struct StorageSlot.Bytes32Slot++` [.item-kind]#internal#
  3052. Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
  3053. WARNING: Only use if you are certain `pos` is lower than the array length.
  3054. [.contract-item]
  3055. [[Arrays-unsafeAccess-uint256---uint256-]]
  3056. ==== `[.contract-item-name]#++unsafeAccess++#++(uint256[] arr, uint256 pos) → struct StorageSlot.Uint256Slot++` [.item-kind]#internal#
  3057. Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
  3058. WARNING: Only use if you are certain `pos` is lower than the array length.
  3059. [.contract-item]
  3060. [[Arrays-unsafeMemoryAccess-uint256---uint256-]]
  3061. ==== `[.contract-item-name]#++unsafeMemoryAccess++#++(uint256[] arr, uint256 pos) → uint256 res++` [.item-kind]#internal#
  3062. Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
  3063. WARNING: Only use if you are certain `pos` is lower than the array length.
  3064. [.contract-item]
  3065. [[Arrays-unsafeMemoryAccess-address---uint256-]]
  3066. ==== `[.contract-item-name]#++unsafeMemoryAccess++#++(address[] arr, uint256 pos) → address res++` [.item-kind]#internal#
  3067. Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
  3068. WARNING: Only use if you are certain `pos` is lower than the array length.
  3069. :_TABLE: pass:normal[xref:#Base64-_TABLE-string[`++_TABLE++`]]
  3070. :encode: pass:normal[xref:#Base64-encode-bytes-[`++encode++`]]
  3071. [.contract]
  3072. [[Base64]]
  3073. === `++Base64++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/Base64.sol[{github-icon},role=heading-link]
  3074. [.hljs-theme-light.nopadding]
  3075. ```solidity
  3076. import "@openzeppelin/contracts/utils/Base64.sol";
  3077. ```
  3078. Provides a set of functions to operate with Base64 strings.
  3079. [.contract-index]
  3080. .Functions
  3081. --
  3082. * {xref-Base64-encode-bytes-}[`++encode(data)++`]
  3083. --
  3084. [.contract-item]
  3085. [[Base64-encode-bytes-]]
  3086. ==== `[.contract-item-name]#++encode++#++(bytes data) → string++` [.item-kind]#internal#
  3087. Converts a `bytes` to its Bytes64 `string` representation.
  3088. :StringsInsufficientHexLength: pass:normal[xref:#Strings-StringsInsufficientHexLength-uint256-uint256-[`++StringsInsufficientHexLength++`]]
  3089. :toString: pass:normal[xref:#Strings-toString-uint256-[`++toString++`]]
  3090. :toStringSigned: pass:normal[xref:#Strings-toStringSigned-int256-[`++toStringSigned++`]]
  3091. :toHexString: pass:normal[xref:#Strings-toHexString-uint256-[`++toHexString++`]]
  3092. :toHexString: pass:normal[xref:#Strings-toHexString-uint256-uint256-[`++toHexString++`]]
  3093. :toHexString: pass:normal[xref:#Strings-toHexString-address-[`++toHexString++`]]
  3094. :equal: pass:normal[xref:#Strings-equal-string-string-[`++equal++`]]
  3095. [.contract]
  3096. [[Strings]]
  3097. === `++Strings++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/Strings.sol[{github-icon},role=heading-link]
  3098. [.hljs-theme-light.nopadding]
  3099. ```solidity
  3100. import "@openzeppelin/contracts/utils/Strings.sol";
  3101. ```
  3102. String operations.
  3103. [.contract-index]
  3104. .Functions
  3105. --
  3106. * {xref-Strings-toString-uint256-}[`++toString(value)++`]
  3107. * {xref-Strings-toStringSigned-int256-}[`++toStringSigned(value)++`]
  3108. * {xref-Strings-toHexString-uint256-}[`++toHexString(value)++`]
  3109. * {xref-Strings-toHexString-uint256-uint256-}[`++toHexString(value, length)++`]
  3110. * {xref-Strings-toHexString-address-}[`++toHexString(addr)++`]
  3111. * {xref-Strings-equal-string-string-}[`++equal(a, b)++`]
  3112. --
  3113. [.contract-index]
  3114. .Errors
  3115. --
  3116. * {xref-Strings-StringsInsufficientHexLength-uint256-uint256-}[`++StringsInsufficientHexLength(value, length)++`]
  3117. --
  3118. [.contract-item]
  3119. [[Strings-toString-uint256-]]
  3120. ==== `[.contract-item-name]#++toString++#++(uint256 value) → string++` [.item-kind]#internal#
  3121. Converts a `uint256` to its ASCII `string` decimal representation.
  3122. [.contract-item]
  3123. [[Strings-toStringSigned-int256-]]
  3124. ==== `[.contract-item-name]#++toStringSigned++#++(int256 value) → string++` [.item-kind]#internal#
  3125. Converts a `int256` to its ASCII `string` decimal representation.
  3126. [.contract-item]
  3127. [[Strings-toHexString-uint256-]]
  3128. ==== `[.contract-item-name]#++toHexString++#++(uint256 value) → string++` [.item-kind]#internal#
  3129. Converts a `uint256` to its ASCII `string` hexadecimal representation.
  3130. [.contract-item]
  3131. [[Strings-toHexString-uint256-uint256-]]
  3132. ==== `[.contract-item-name]#++toHexString++#++(uint256 value, uint256 length) → string++` [.item-kind]#internal#
  3133. Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
  3134. [.contract-item]
  3135. [[Strings-toHexString-address-]]
  3136. ==== `[.contract-item-name]#++toHexString++#++(address addr) → string++` [.item-kind]#internal#
  3137. Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
  3138. representation.
  3139. [.contract-item]
  3140. [[Strings-equal-string-string-]]
  3141. ==== `[.contract-item-name]#++equal++#++(string a, string b) → bool++` [.item-kind]#internal#
  3142. Returns true if the two strings are equal.
  3143. [.contract-item]
  3144. [[Strings-StringsInsufficientHexLength-uint256-uint256-]]
  3145. ==== `[.contract-item-name]#++StringsInsufficientHexLength++#++(uint256 value, uint256 length)++` [.item-kind]#error#
  3146. The `value` string doesn't fit in the specified `length`.
  3147. :StringTooLong: pass:normal[xref:#ShortStrings-StringTooLong-string-[`++StringTooLong++`]]
  3148. :InvalidShortString: pass:normal[xref:#ShortStrings-InvalidShortString--[`++InvalidShortString++`]]
  3149. :toShortString: pass:normal[xref:#ShortStrings-toShortString-string-[`++toShortString++`]]
  3150. :toString: pass:normal[xref:#ShortStrings-toString-ShortString-[`++toString++`]]
  3151. :byteLength: pass:normal[xref:#ShortStrings-byteLength-ShortString-[`++byteLength++`]]
  3152. :toShortStringWithFallback: pass:normal[xref:#ShortStrings-toShortStringWithFallback-string-string-[`++toShortStringWithFallback++`]]
  3153. :toStringWithFallback: pass:normal[xref:#ShortStrings-toStringWithFallback-ShortString-string-[`++toStringWithFallback++`]]
  3154. :byteLengthWithFallback: pass:normal[xref:#ShortStrings-byteLengthWithFallback-ShortString-string-[`++byteLengthWithFallback++`]]
  3155. [.contract]
  3156. [[ShortStrings]]
  3157. === `++ShortStrings++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/ShortStrings.sol[{github-icon},role=heading-link]
  3158. [.hljs-theme-light.nopadding]
  3159. ```solidity
  3160. import "@openzeppelin/contracts/utils/ShortStrings.sol";
  3161. ```
  3162. This library provides functions to convert short memory strings
  3163. into a `ShortString` type that can be used as an immutable variable.
  3164. Strings of arbitrary length can be optimized using this library if
  3165. they are short enough (up to 31 bytes) by packing them with their
  3166. length (1 byte) in a single EVM word (32 bytes). Additionally, a
  3167. fallback mechanism can be used for every other case.
  3168. Usage example:
  3169. ```solidity
  3170. contract Named {
  3171. using ShortStrings for *;
  3172. ShortString private immutable _name;
  3173. string private _nameFallback;
  3174. constructor(string memory contractName) {
  3175. _name = contractName.toShortStringWithFallback(_nameFallback);
  3176. }
  3177. function name() external view returns (string memory) {
  3178. return _name.toStringWithFallback(_nameFallback);
  3179. }
  3180. }
  3181. ```
  3182. [.contract-index]
  3183. .Functions
  3184. --
  3185. * {xref-ShortStrings-toShortString-string-}[`++toShortString(str)++`]
  3186. * {xref-ShortStrings-toString-ShortString-}[`++toString(sstr)++`]
  3187. * {xref-ShortStrings-byteLength-ShortString-}[`++byteLength(sstr)++`]
  3188. * {xref-ShortStrings-toShortStringWithFallback-string-string-}[`++toShortStringWithFallback(value, store)++`]
  3189. * {xref-ShortStrings-toStringWithFallback-ShortString-string-}[`++toStringWithFallback(value, store)++`]
  3190. * {xref-ShortStrings-byteLengthWithFallback-ShortString-string-}[`++byteLengthWithFallback(value, store)++`]
  3191. --
  3192. [.contract-index]
  3193. .Errors
  3194. --
  3195. * {xref-ShortStrings-StringTooLong-string-}[`++StringTooLong(str)++`]
  3196. * {xref-ShortStrings-InvalidShortString--}[`++InvalidShortString()++`]
  3197. --
  3198. [.contract-item]
  3199. [[ShortStrings-toShortString-string-]]
  3200. ==== `[.contract-item-name]#++toShortString++#++(string str) → ShortString++` [.item-kind]#internal#
  3201. Encode a string of at most 31 chars into a `ShortString`.
  3202. This will trigger a `StringTooLong` error is the input string is too long.
  3203. [.contract-item]
  3204. [[ShortStrings-toString-ShortString-]]
  3205. ==== `[.contract-item-name]#++toString++#++(ShortString sstr) → string++` [.item-kind]#internal#
  3206. Decode a `ShortString` back to a "normal" string.
  3207. [.contract-item]
  3208. [[ShortStrings-byteLength-ShortString-]]
  3209. ==== `[.contract-item-name]#++byteLength++#++(ShortString sstr) → uint256++` [.item-kind]#internal#
  3210. Return the length of a `ShortString`.
  3211. [.contract-item]
  3212. [[ShortStrings-toShortStringWithFallback-string-string-]]
  3213. ==== `[.contract-item-name]#++toShortStringWithFallback++#++(string value, string store) → ShortString++` [.item-kind]#internal#
  3214. Encode a string into a `ShortString`, or write it to storage if it is too long.
  3215. [.contract-item]
  3216. [[ShortStrings-toStringWithFallback-ShortString-string-]]
  3217. ==== `[.contract-item-name]#++toStringWithFallback++#++(ShortString value, string store) → string++` [.item-kind]#internal#
  3218. Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
  3219. [.contract-item]
  3220. [[ShortStrings-byteLengthWithFallback-ShortString-string-]]
  3221. ==== `[.contract-item-name]#++byteLengthWithFallback++#++(ShortString value, string store) → uint256++` [.item-kind]#internal#
  3222. Return the length of a string that was encoded to `ShortString` or written to storage using
  3223. {setWithFallback}.
  3224. WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
  3225. actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
  3226. [.contract-item]
  3227. [[ShortStrings-StringTooLong-string-]]
  3228. ==== `[.contract-item-name]#++StringTooLong++#++(string str)++` [.item-kind]#error#
  3229. [.contract-item]
  3230. [[ShortStrings-InvalidShortString--]]
  3231. ==== `[.contract-item-name]#++InvalidShortString++#++()++` [.item-kind]#error#
  3232. :AddressSlot: pass:normal[xref:#StorageSlot-AddressSlot[`++AddressSlot++`]]
  3233. :BooleanSlot: pass:normal[xref:#StorageSlot-BooleanSlot[`++BooleanSlot++`]]
  3234. :Bytes32Slot: pass:normal[xref:#StorageSlot-Bytes32Slot[`++Bytes32Slot++`]]
  3235. :Uint256Slot: pass:normal[xref:#StorageSlot-Uint256Slot[`++Uint256Slot++`]]
  3236. :StringSlot: pass:normal[xref:#StorageSlot-StringSlot[`++StringSlot++`]]
  3237. :BytesSlot: pass:normal[xref:#StorageSlot-BytesSlot[`++BytesSlot++`]]
  3238. :getAddressSlot: pass:normal[xref:#StorageSlot-getAddressSlot-bytes32-[`++getAddressSlot++`]]
  3239. :getBooleanSlot: pass:normal[xref:#StorageSlot-getBooleanSlot-bytes32-[`++getBooleanSlot++`]]
  3240. :getBytes32Slot: pass:normal[xref:#StorageSlot-getBytes32Slot-bytes32-[`++getBytes32Slot++`]]
  3241. :getUint256Slot: pass:normal[xref:#StorageSlot-getUint256Slot-bytes32-[`++getUint256Slot++`]]
  3242. :getStringSlot: pass:normal[xref:#StorageSlot-getStringSlot-bytes32-[`++getStringSlot++`]]
  3243. :getStringSlot: pass:normal[xref:#StorageSlot-getStringSlot-string-[`++getStringSlot++`]]
  3244. :getBytesSlot: pass:normal[xref:#StorageSlot-getBytesSlot-bytes32-[`++getBytesSlot++`]]
  3245. :getBytesSlot: pass:normal[xref:#StorageSlot-getBytesSlot-bytes-[`++getBytesSlot++`]]
  3246. [.contract]
  3247. [[StorageSlot]]
  3248. === `++StorageSlot++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/StorageSlot.sol[{github-icon},role=heading-link]
  3249. [.hljs-theme-light.nopadding]
  3250. ```solidity
  3251. import "@openzeppelin/contracts/utils/StorageSlot.sol";
  3252. ```
  3253. Library for reading and writing primitive types to specific storage slots.
  3254. Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
  3255. This library helps with reading and writing to such slots without the need for inline assembly.
  3256. The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
  3257. Example usage to set ERC1967 implementation slot:
  3258. ```solidity
  3259. contract ERC1967 {
  3260. bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
  3261. function _getImplementation() internal view returns (address) {
  3262. return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
  3263. }
  3264. function _setImplementation(address newImplementation) internal {
  3265. require(newImplementation.code.length > 0);
  3266. StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
  3267. }
  3268. }
  3269. ```
  3270. [.contract-index]
  3271. .Functions
  3272. --
  3273. * {xref-StorageSlot-getAddressSlot-bytes32-}[`++getAddressSlot(slot)++`]
  3274. * {xref-StorageSlot-getBooleanSlot-bytes32-}[`++getBooleanSlot(slot)++`]
  3275. * {xref-StorageSlot-getBytes32Slot-bytes32-}[`++getBytes32Slot(slot)++`]
  3276. * {xref-StorageSlot-getUint256Slot-bytes32-}[`++getUint256Slot(slot)++`]
  3277. * {xref-StorageSlot-getStringSlot-bytes32-}[`++getStringSlot(slot)++`]
  3278. * {xref-StorageSlot-getStringSlot-string-}[`++getStringSlot(store)++`]
  3279. * {xref-StorageSlot-getBytesSlot-bytes32-}[`++getBytesSlot(slot)++`]
  3280. * {xref-StorageSlot-getBytesSlot-bytes-}[`++getBytesSlot(store)++`]
  3281. --
  3282. [.contract-item]
  3283. [[StorageSlot-getAddressSlot-bytes32-]]
  3284. ==== `[.contract-item-name]#++getAddressSlot++#++(bytes32 slot) → struct StorageSlot.AddressSlot r++` [.item-kind]#internal#
  3285. Returns an `AddressSlot` with member `value` located at `slot`.
  3286. [.contract-item]
  3287. [[StorageSlot-getBooleanSlot-bytes32-]]
  3288. ==== `[.contract-item-name]#++getBooleanSlot++#++(bytes32 slot) → struct StorageSlot.BooleanSlot r++` [.item-kind]#internal#
  3289. Returns an `BooleanSlot` with member `value` located at `slot`.
  3290. [.contract-item]
  3291. [[StorageSlot-getBytes32Slot-bytes32-]]
  3292. ==== `[.contract-item-name]#++getBytes32Slot++#++(bytes32 slot) → struct StorageSlot.Bytes32Slot r++` [.item-kind]#internal#
  3293. Returns an `Bytes32Slot` with member `value` located at `slot`.
  3294. [.contract-item]
  3295. [[StorageSlot-getUint256Slot-bytes32-]]
  3296. ==== `[.contract-item-name]#++getUint256Slot++#++(bytes32 slot) → struct StorageSlot.Uint256Slot r++` [.item-kind]#internal#
  3297. Returns an `Uint256Slot` with member `value` located at `slot`.
  3298. [.contract-item]
  3299. [[StorageSlot-getStringSlot-bytes32-]]
  3300. ==== `[.contract-item-name]#++getStringSlot++#++(bytes32 slot) → struct StorageSlot.StringSlot r++` [.item-kind]#internal#
  3301. Returns an `StringSlot` with member `value` located at `slot`.
  3302. [.contract-item]
  3303. [[StorageSlot-getStringSlot-string-]]
  3304. ==== `[.contract-item-name]#++getStringSlot++#++(string store) → struct StorageSlot.StringSlot r++` [.item-kind]#internal#
  3305. Returns an `StringSlot` representation of the string storage pointer `store`.
  3306. [.contract-item]
  3307. [[StorageSlot-getBytesSlot-bytes32-]]
  3308. ==== `[.contract-item-name]#++getBytesSlot++#++(bytes32 slot) → struct StorageSlot.BytesSlot r++` [.item-kind]#internal#
  3309. Returns an `BytesSlot` with member `value` located at `slot`.
  3310. [.contract-item]
  3311. [[StorageSlot-getBytesSlot-bytes-]]
  3312. ==== `[.contract-item-name]#++getBytesSlot++#++(bytes store) → struct StorageSlot.BytesSlot r++` [.item-kind]#internal#
  3313. Returns an `BytesSlot` representation of the bytes storage pointer `store`.
  3314. :multicall: pass:normal[xref:#Multicall-multicall-bytes---[`++multicall++`]]
  3315. [.contract]
  3316. [[Multicall]]
  3317. === `++Multicall++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/utils/Multicall.sol[{github-icon},role=heading-link]
  3318. [.hljs-theme-light.nopadding]
  3319. ```solidity
  3320. import "@openzeppelin/contracts/utils/Multicall.sol";
  3321. ```
  3322. Provides a function to batch together multiple calls in a single external call.
  3323. Consider any assumption about calldata validation performed by the sender may be violated if it's not especially
  3324. careful about sending transactions invoking {multicall}. For example, a relay address that filters function
  3325. selectors won't filter calls nested within a {multicall} operation.
  3326. NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}).
  3327. If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data`
  3328. to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of
  3329. {_msgSender} are not propagated to subcalls.
  3330. [.contract-index]
  3331. .Functions
  3332. --
  3333. * {xref-Multicall-multicall-bytes---}[`++multicall(data)++`]
  3334. --
  3335. [.contract-item]
  3336. [[Multicall-multicall-bytes---]]
  3337. ==== `[.contract-item-name]#++multicall++#++(bytes[] data) → bytes[] results++` [.item-kind]#external#
  3338. Receives and executes a batch of function calls on this contract.