utils.adoc 221 KB

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