12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129 |
- :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
- :Address: pass:normal[xref:utils.adoc#Address[`Address`]]
- :Arrays: pass:normal[xref:utils.adoc#Arrays[`Arrays`]]
- :Base64: pass:normal[xref:utils.adoc#Base64[`Base64`]]
- :Strings: pass:normal[xref:utils.adoc#Strings[`Strings`]]
- :SafeCast: pass:normal[xref:utils.adoc#SafeCast[`SafeCast`]]
- :Multicall: pass:normal[xref:utils.adoc#Multicall[`Multicall`]]
- :Counters: pass:normal[xref:utils.adoc#Counters[`Counters`]]
- :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
- :EnumerableSet: pass:normal[xref:utils.adoc#EnumerableSet[`EnumerableSet`]]
- :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
- :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
- :EnumerableSet: pass:normal[xref:utils.adoc#EnumerableSet[`EnumerableSet`]]
- :EnumerableMap: pass:normal[xref:utils.adoc#EnumerableMap[`EnumerableMap`]]
- :EnumerableSet: pass:normal[xref:utils.adoc#EnumerableSet[`EnumerableSet`]]
- :Create2: pass:normal[xref:utils.adoc#Create2[`Create2`]]
- :xref-Math-max-uint256-uint256-: xref:utils.adoc#Math-max-uint256-uint256-
- :xref-Math-min-uint256-uint256-: xref:utils.adoc#Math-min-uint256-uint256-
- :xref-Math-average-uint256-uint256-: xref:utils.adoc#Math-average-uint256-uint256-
- :xref-Math-ceilDiv-uint256-uint256-: xref:utils.adoc#Math-ceilDiv-uint256-uint256-
- :xref-Math-mulDiv-uint256-uint256-uint256-: xref:utils.adoc#Math-mulDiv-uint256-uint256-uint256-
- :xref-Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-
- :xref-Math-sqrt-uint256-: xref:utils.adoc#Math-sqrt-uint256-
- :xref-Math-sqrt-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-sqrt-uint256-enum-Math-Rounding-
- :xref-Math-log2-uint256-: xref:utils.adoc#Math-log2-uint256-
- :xref-Math-log2-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log2-uint256-enum-Math-Rounding-
- :xref-Math-log10-uint256-: xref:utils.adoc#Math-log10-uint256-
- :xref-Math-log10-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log10-uint256-enum-Math-Rounding-
- :xref-Math-log256-uint256-: xref:utils.adoc#Math-log256-uint256-
- :xref-Math-log256-uint256-enum-Math-Rounding-: xref:utils.adoc#Math-log256-uint256-enum-Math-Rounding-
- :xref-SignedMath-max-int256-int256-: xref:utils.adoc#SignedMath-max-int256-int256-
- :xref-SignedMath-min-int256-int256-: xref:utils.adoc#SignedMath-min-int256-int256-
- :xref-SignedMath-average-int256-int256-: xref:utils.adoc#SignedMath-average-int256-int256-
- :xref-SignedMath-abs-int256-: xref:utils.adoc#SignedMath-abs-int256-
- :SafeMath: pass:normal[xref:utils.adoc#SafeMath[`SafeMath`]]
- :SignedSafeMath: pass:normal[xref:utils.adoc#SignedSafeMath[`SignedSafeMath`]]
- :xref-SafeCast-toUint248-uint256-: xref:utils.adoc#SafeCast-toUint248-uint256-
- :xref-SafeCast-toUint240-uint256-: xref:utils.adoc#SafeCast-toUint240-uint256-
- :xref-SafeCast-toUint232-uint256-: xref:utils.adoc#SafeCast-toUint232-uint256-
- :xref-SafeCast-toUint224-uint256-: xref:utils.adoc#SafeCast-toUint224-uint256-
- :xref-SafeCast-toUint216-uint256-: xref:utils.adoc#SafeCast-toUint216-uint256-
- :xref-SafeCast-toUint208-uint256-: xref:utils.adoc#SafeCast-toUint208-uint256-
- :xref-SafeCast-toUint200-uint256-: xref:utils.adoc#SafeCast-toUint200-uint256-
- :xref-SafeCast-toUint192-uint256-: xref:utils.adoc#SafeCast-toUint192-uint256-
- :xref-SafeCast-toUint184-uint256-: xref:utils.adoc#SafeCast-toUint184-uint256-
- :xref-SafeCast-toUint176-uint256-: xref:utils.adoc#SafeCast-toUint176-uint256-
- :xref-SafeCast-toUint168-uint256-: xref:utils.adoc#SafeCast-toUint168-uint256-
- :xref-SafeCast-toUint160-uint256-: xref:utils.adoc#SafeCast-toUint160-uint256-
- :xref-SafeCast-toUint152-uint256-: xref:utils.adoc#SafeCast-toUint152-uint256-
- :xref-SafeCast-toUint144-uint256-: xref:utils.adoc#SafeCast-toUint144-uint256-
- :xref-SafeCast-toUint136-uint256-: xref:utils.adoc#SafeCast-toUint136-uint256-
- :xref-SafeCast-toUint128-uint256-: xref:utils.adoc#SafeCast-toUint128-uint256-
- :xref-SafeCast-toUint120-uint256-: xref:utils.adoc#SafeCast-toUint120-uint256-
- :xref-SafeCast-toUint112-uint256-: xref:utils.adoc#SafeCast-toUint112-uint256-
- :xref-SafeCast-toUint104-uint256-: xref:utils.adoc#SafeCast-toUint104-uint256-
- :xref-SafeCast-toUint96-uint256-: xref:utils.adoc#SafeCast-toUint96-uint256-
- :xref-SafeCast-toUint88-uint256-: xref:utils.adoc#SafeCast-toUint88-uint256-
- :xref-SafeCast-toUint80-uint256-: xref:utils.adoc#SafeCast-toUint80-uint256-
- :xref-SafeCast-toUint72-uint256-: xref:utils.adoc#SafeCast-toUint72-uint256-
- :xref-SafeCast-toUint64-uint256-: xref:utils.adoc#SafeCast-toUint64-uint256-
- :xref-SafeCast-toUint56-uint256-: xref:utils.adoc#SafeCast-toUint56-uint256-
- :xref-SafeCast-toUint48-uint256-: xref:utils.adoc#SafeCast-toUint48-uint256-
- :xref-SafeCast-toUint40-uint256-: xref:utils.adoc#SafeCast-toUint40-uint256-
- :xref-SafeCast-toUint32-uint256-: xref:utils.adoc#SafeCast-toUint32-uint256-
- :xref-SafeCast-toUint24-uint256-: xref:utils.adoc#SafeCast-toUint24-uint256-
- :xref-SafeCast-toUint16-uint256-: xref:utils.adoc#SafeCast-toUint16-uint256-
- :xref-SafeCast-toUint8-uint256-: xref:utils.adoc#SafeCast-toUint8-uint256-
- :xref-SafeCast-toUint256-int256-: xref:utils.adoc#SafeCast-toUint256-int256-
- :xref-SafeCast-toInt248-int256-: xref:utils.adoc#SafeCast-toInt248-int256-
- :xref-SafeCast-toInt240-int256-: xref:utils.adoc#SafeCast-toInt240-int256-
- :xref-SafeCast-toInt232-int256-: xref:utils.adoc#SafeCast-toInt232-int256-
- :xref-SafeCast-toInt224-int256-: xref:utils.adoc#SafeCast-toInt224-int256-
- :xref-SafeCast-toInt216-int256-: xref:utils.adoc#SafeCast-toInt216-int256-
- :xref-SafeCast-toInt208-int256-: xref:utils.adoc#SafeCast-toInt208-int256-
- :xref-SafeCast-toInt200-int256-: xref:utils.adoc#SafeCast-toInt200-int256-
- :xref-SafeCast-toInt192-int256-: xref:utils.adoc#SafeCast-toInt192-int256-
- :xref-SafeCast-toInt184-int256-: xref:utils.adoc#SafeCast-toInt184-int256-
- :xref-SafeCast-toInt176-int256-: xref:utils.adoc#SafeCast-toInt176-int256-
- :xref-SafeCast-toInt168-int256-: xref:utils.adoc#SafeCast-toInt168-int256-
- :xref-SafeCast-toInt160-int256-: xref:utils.adoc#SafeCast-toInt160-int256-
- :xref-SafeCast-toInt152-int256-: xref:utils.adoc#SafeCast-toInt152-int256-
- :xref-SafeCast-toInt144-int256-: xref:utils.adoc#SafeCast-toInt144-int256-
- :xref-SafeCast-toInt136-int256-: xref:utils.adoc#SafeCast-toInt136-int256-
- :xref-SafeCast-toInt128-int256-: xref:utils.adoc#SafeCast-toInt128-int256-
- :xref-SafeCast-toInt120-int256-: xref:utils.adoc#SafeCast-toInt120-int256-
- :xref-SafeCast-toInt112-int256-: xref:utils.adoc#SafeCast-toInt112-int256-
- :xref-SafeCast-toInt104-int256-: xref:utils.adoc#SafeCast-toInt104-int256-
- :xref-SafeCast-toInt96-int256-: xref:utils.adoc#SafeCast-toInt96-int256-
- :xref-SafeCast-toInt88-int256-: xref:utils.adoc#SafeCast-toInt88-int256-
- :xref-SafeCast-toInt80-int256-: xref:utils.adoc#SafeCast-toInt80-int256-
- :xref-SafeCast-toInt72-int256-: xref:utils.adoc#SafeCast-toInt72-int256-
- :xref-SafeCast-toInt64-int256-: xref:utils.adoc#SafeCast-toInt64-int256-
- :xref-SafeCast-toInt56-int256-: xref:utils.adoc#SafeCast-toInt56-int256-
- :xref-SafeCast-toInt48-int256-: xref:utils.adoc#SafeCast-toInt48-int256-
- :xref-SafeCast-toInt40-int256-: xref:utils.adoc#SafeCast-toInt40-int256-
- :xref-SafeCast-toInt32-int256-: xref:utils.adoc#SafeCast-toInt32-int256-
- :xref-SafeCast-toInt24-int256-: xref:utils.adoc#SafeCast-toInt24-int256-
- :xref-SafeCast-toInt16-int256-: xref:utils.adoc#SafeCast-toInt16-int256-
- :xref-SafeCast-toInt8-int256-: xref:utils.adoc#SafeCast-toInt8-int256-
- :xref-SafeCast-toInt256-uint256-: xref:utils.adoc#SafeCast-toInt256-uint256-
- :xref-SafeMath-tryAdd-uint256-uint256-: xref:utils.adoc#SafeMath-tryAdd-uint256-uint256-
- :xref-SafeMath-trySub-uint256-uint256-: xref:utils.adoc#SafeMath-trySub-uint256-uint256-
- :xref-SafeMath-tryMul-uint256-uint256-: xref:utils.adoc#SafeMath-tryMul-uint256-uint256-
- :xref-SafeMath-tryDiv-uint256-uint256-: xref:utils.adoc#SafeMath-tryDiv-uint256-uint256-
- :xref-SafeMath-tryMod-uint256-uint256-: xref:utils.adoc#SafeMath-tryMod-uint256-uint256-
- :xref-SafeMath-add-uint256-uint256-: xref:utils.adoc#SafeMath-add-uint256-uint256-
- :xref-SafeMath-sub-uint256-uint256-: xref:utils.adoc#SafeMath-sub-uint256-uint256-
- :xref-SafeMath-mul-uint256-uint256-: xref:utils.adoc#SafeMath-mul-uint256-uint256-
- :xref-SafeMath-div-uint256-uint256-: xref:utils.adoc#SafeMath-div-uint256-uint256-
- :xref-SafeMath-mod-uint256-uint256-: xref:utils.adoc#SafeMath-mod-uint256-uint256-
- :xref-SafeMath-sub-uint256-uint256-string-: xref:utils.adoc#SafeMath-sub-uint256-uint256-string-
- :xref-SafeMath-div-uint256-uint256-string-: xref:utils.adoc#SafeMath-div-uint256-uint256-string-
- :xref-SafeMath-mod-uint256-uint256-string-: xref:utils.adoc#SafeMath-mod-uint256-uint256-string-
- :xref-SignedSafeMath-mul-int256-int256-: xref:utils.adoc#SignedSafeMath-mul-int256-int256-
- :xref-SignedSafeMath-div-int256-int256-: xref:utils.adoc#SignedSafeMath-div-int256-int256-
- :xref-SignedSafeMath-sub-int256-int256-: xref:utils.adoc#SignedSafeMath-sub-int256-int256-
- :xref-SignedSafeMath-add-int256-int256-: xref:utils.adoc#SignedSafeMath-add-int256-int256-
- :xref-ECDSA-tryRecover-bytes32-bytes-: xref:utils.adoc#ECDSA-tryRecover-bytes32-bytes-
- :xref-ECDSA-recover-bytes32-bytes-: xref:utils.adoc#ECDSA-recover-bytes32-bytes-
- :xref-ECDSA-tryRecover-bytes32-bytes32-bytes32-: xref:utils.adoc#ECDSA-tryRecover-bytes32-bytes32-bytes32-
- :xref-ECDSA-recover-bytes32-bytes32-bytes32-: xref:utils.adoc#ECDSA-recover-bytes32-bytes32-bytes32-
- :xref-ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-: xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-
- :xref-ECDSA-recover-bytes32-uint8-bytes32-bytes32-: xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-
- :xref-ECDSA-toEthSignedMessageHash-bytes32-: xref:utils.adoc#ECDSA-toEthSignedMessageHash-bytes32-
- :xref-ECDSA-toEthSignedMessageHash-bytes-: xref:utils.adoc#ECDSA-toEthSignedMessageHash-bytes-
- :xref-ECDSA-toTypedDataHash-bytes32-bytes32-: xref:utils.adoc#ECDSA-toTypedDataHash-bytes32-bytes32-
- :xref-ECDSA-toDataWithIntendedValidatorHash-address-bytes-: xref:utils.adoc#ECDSA-toDataWithIntendedValidatorHash-address-bytes-
- :ECDSA-tryRecover: pass:normal[xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`ECDSA.tryRecover`]]
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :ECDSA-tryRecover: pass:normal[xref:utils.adoc#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`ECDSA.tryRecover`]]
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :xref-SignatureChecker-isValidSignatureNow-address-bytes32-bytes-: xref:utils.adoc#SignatureChecker-isValidSignatureNow-address-bytes32-bytes-
- :xref-SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-: xref:utils.adoc#SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-
- :xref-MerkleProof-verify-bytes32---bytes32-bytes32-: xref:utils.adoc#MerkleProof-verify-bytes32---bytes32-bytes32-
- :xref-MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-: xref:utils.adoc#MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-
- :xref-MerkleProof-processProof-bytes32---bytes32-: xref:utils.adoc#MerkleProof-processProof-bytes32---bytes32-
- :xref-MerkleProof-processProofCalldata-bytes32---bytes32-: xref:utils.adoc#MerkleProof-processProofCalldata-bytes32---bytes32-
- :xref-MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---: xref:utils.adoc#MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---
- :xref-MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---: xref:utils.adoc#MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---
- :xref-MerkleProof-processMultiProof-bytes32---bool---bytes32---: xref:utils.adoc#MerkleProof-processMultiProof-bytes32---bool---bytes32---
- :xref-MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---: xref:utils.adoc#MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---
- :xref-EIP712-constructor-string-string-: xref:utils.adoc#EIP712-constructor-string-string-
- :xref-EIP712-_domainSeparatorV4--: xref:utils.adoc#EIP712-_domainSeparatorV4--
- :xref-EIP712-_hashTypedDataV4-bytes32-: xref:utils.adoc#EIP712-_hashTypedDataV4-bytes32-
- :xref-EIP712-eip712Domain--: xref:utils.adoc#EIP712-eip712Domain--
- :xref-IERC5267-EIP712DomainChanged--: xref:interfaces.adoc#IERC5267-EIP712DomainChanged--
- :ECDSA-recover: pass:normal[xref:utils.adoc#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`ECDSA.recover`]]
- :Escrow: pass:normal[xref:utils.adoc#Escrow[`Escrow`]]
- :xref-ConditionalEscrow-withdrawalAllowed-address-: xref:utils.adoc#ConditionalEscrow-withdrawalAllowed-address-
- :xref-ConditionalEscrow-withdraw-address-payable-: xref:utils.adoc#ConditionalEscrow-withdraw-address-payable-
- :xref-Escrow-depositsOf-address-: xref:utils.adoc#Escrow-depositsOf-address-
- :xref-Escrow-deposit-address-: xref:utils.adoc#Escrow-deposit-address-
- :xref-Ownable-owner--: xref:access.adoc#Ownable-owner--
- :xref-Ownable-_checkOwner--: xref:access.adoc#Ownable-_checkOwner--
- :xref-Ownable-renounceOwnership--: xref:access.adoc#Ownable-renounceOwnership--
- :xref-Ownable-transferOwnership-address-: xref:access.adoc#Ownable-transferOwnership-address-
- :xref-Ownable-_transferOwnership-address-: xref:access.adoc#Ownable-_transferOwnership-address-
- :xref-Escrow-Deposited-address-uint256-: xref:utils.adoc#Escrow-Deposited-address-uint256-
- :xref-Escrow-Withdrawn-address-uint256-: xref:utils.adoc#Escrow-Withdrawn-address-uint256-
- :xref-Ownable-OwnershipTransferred-address-address-: xref:access.adoc#Ownable-OwnershipTransferred-address-address-
- :ReentrancyGuard: pass:normal[xref:security.adoc#ReentrancyGuard[`ReentrancyGuard`]]
- :xref-Escrow-depositsOf-address-: xref:utils.adoc#Escrow-depositsOf-address-
- :xref-Escrow-deposit-address-: xref:utils.adoc#Escrow-deposit-address-
- :xref-Escrow-withdraw-address-payable-: xref:utils.adoc#Escrow-withdraw-address-payable-
- :xref-Ownable-owner--: xref:access.adoc#Ownable-owner--
- :xref-Ownable-_checkOwner--: xref:access.adoc#Ownable-_checkOwner--
- :xref-Ownable-renounceOwnership--: xref:access.adoc#Ownable-renounceOwnership--
- :xref-Ownable-transferOwnership-address-: xref:access.adoc#Ownable-transferOwnership-address-
- :xref-Ownable-_transferOwnership-address-: xref:access.adoc#Ownable-_transferOwnership-address-
- :xref-Escrow-Deposited-address-uint256-: xref:utils.adoc#Escrow-Deposited-address-uint256-
- :xref-Escrow-Withdrawn-address-uint256-: xref:utils.adoc#Escrow-Withdrawn-address-uint256-
- :xref-Ownable-OwnershipTransferred-address-address-: xref:access.adoc#Ownable-OwnershipTransferred-address-address-
- :ReentrancyGuard: pass:normal[xref:security.adoc#ReentrancyGuard[`ReentrancyGuard`]]
- :Escrow: pass:normal[xref:utils.adoc#Escrow[`Escrow`]]
- :xref-RefundEscrow-constructor-address-payable-: xref:utils.adoc#RefundEscrow-constructor-address-payable-
- :xref-RefundEscrow-state--: xref:utils.adoc#RefundEscrow-state--
- :xref-RefundEscrow-beneficiary--: xref:utils.adoc#RefundEscrow-beneficiary--
- :xref-RefundEscrow-deposit-address-: xref:utils.adoc#RefundEscrow-deposit-address-
- :xref-RefundEscrow-close--: xref:utils.adoc#RefundEscrow-close--
- :xref-RefundEscrow-enableRefunds--: xref:utils.adoc#RefundEscrow-enableRefunds--
- :xref-RefundEscrow-beneficiaryWithdraw--: xref:utils.adoc#RefundEscrow-beneficiaryWithdraw--
- :xref-RefundEscrow-withdrawalAllowed-address-: xref:utils.adoc#RefundEscrow-withdrawalAllowed-address-
- :xref-ConditionalEscrow-withdraw-address-payable-: xref:utils.adoc#ConditionalEscrow-withdraw-address-payable-
- :xref-Escrow-depositsOf-address-: xref:utils.adoc#Escrow-depositsOf-address-
- :xref-Ownable-owner--: xref:access.adoc#Ownable-owner--
- :xref-Ownable-_checkOwner--: xref:access.adoc#Ownable-_checkOwner--
- :xref-Ownable-renounceOwnership--: xref:access.adoc#Ownable-renounceOwnership--
- :xref-Ownable-transferOwnership-address-: xref:access.adoc#Ownable-transferOwnership-address-
- :xref-Ownable-_transferOwnership-address-: xref:access.adoc#Ownable-_transferOwnership-address-
- :xref-RefundEscrow-RefundsClosed--: xref:utils.adoc#RefundEscrow-RefundsClosed--
- :xref-RefundEscrow-RefundsEnabled--: xref:utils.adoc#RefundEscrow-RefundsEnabled--
- :xref-Escrow-Deposited-address-uint256-: xref:utils.adoc#Escrow-Deposited-address-uint256-
- :xref-Escrow-Withdrawn-address-uint256-: xref:utils.adoc#Escrow-Withdrawn-address-uint256-
- :xref-Ownable-OwnershipTransferred-address-address-: xref:access.adoc#Ownable-OwnershipTransferred-address-address-
- :ERC165Checker: pass:normal[xref:utils.adoc#ERC165Checker[`ERC165Checker`]]
- :ERC165: pass:normal[xref:utils.adoc#ERC165[`ERC165`]]
- :xref-IERC165-supportsInterface-bytes4-: xref:utils.adoc#IERC165-supportsInterface-bytes4-
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :ERC165Storage: pass:normal[xref:utils.adoc#ERC165Storage[`ERC165Storage`]]
- :xref-ERC165-supportsInterface-bytes4-: xref:utils.adoc#ERC165-supportsInterface-bytes4-
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :xref-ERC165Storage-supportsInterface-bytes4-: xref:utils.adoc#ERC165Storage-supportsInterface-bytes4-
- :xref-ERC165Storage-_registerInterface-bytes4-: xref:utils.adoc#ERC165Storage-_registerInterface-bytes4-
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :xref-ERC165Checker-supportsERC165-address-: xref:utils.adoc#ERC165Checker-supportsERC165-address-
- :xref-ERC165Checker-supportsInterface-address-bytes4-: xref:utils.adoc#ERC165Checker-supportsInterface-address-bytes4-
- :xref-ERC165Checker-getSupportedInterfaces-address-bytes4---: xref:utils.adoc#ERC165Checker-getSupportedInterfaces-address-bytes4---
- :xref-ERC165Checker-supportsAllInterfaces-address-bytes4---: xref:utils.adoc#ERC165Checker-supportsAllInterfaces-address-bytes4---
- :xref-ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-: xref:utils.adoc#ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :xref-IERC1820Registry-setManager-address-address-: xref:utils.adoc#IERC1820Registry-setManager-address-address-
- :xref-IERC1820Registry-getManager-address-: xref:utils.adoc#IERC1820Registry-getManager-address-
- :xref-IERC1820Registry-setInterfaceImplementer-address-bytes32-address-: xref:utils.adoc#IERC1820Registry-setInterfaceImplementer-address-bytes32-address-
- :xref-IERC1820Registry-getInterfaceImplementer-address-bytes32-: xref:utils.adoc#IERC1820Registry-getInterfaceImplementer-address-bytes32-
- :xref-IERC1820Registry-interfaceHash-string-: xref:utils.adoc#IERC1820Registry-interfaceHash-string-
- :xref-IERC1820Registry-updateERC165Cache-address-bytes4-: xref:utils.adoc#IERC1820Registry-updateERC165Cache-address-bytes4-
- :xref-IERC1820Registry-implementsERC165Interface-address-bytes4-: xref:utils.adoc#IERC1820Registry-implementsERC165Interface-address-bytes4-
- :xref-IERC1820Registry-implementsERC165InterfaceNoCache-address-bytes4-: xref:utils.adoc#IERC1820Registry-implementsERC165InterfaceNoCache-address-bytes4-
- :xref-IERC1820Registry-InterfaceImplementerSet-address-bytes32-address-: xref:utils.adoc#IERC1820Registry-InterfaceImplementerSet-address-bytes32-address-
- :xref-IERC1820Registry-ManagerChanged-address-address-: xref:utils.adoc#IERC1820Registry-ManagerChanged-address-address-
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC1820Implementer: pass:normal[xref:utils.adoc#IERC1820Implementer[`IERC1820Implementer`]]
- :IERC1820Implementer-canImplementInterfaceForAddress: pass:normal[xref:utils.adoc#IERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-[`IERC1820Implementer.canImplementInterfaceForAddress`]]
- :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
- :IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]]
- :xref-IERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-: xref:utils.adoc#IERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-
- :IERC1820Registry-setInterfaceImplementer: pass:normal[xref:utils.adoc#IERC1820Registry-setInterfaceImplementer-address-bytes32-address-[`IERC1820Registry.setInterfaceImplementer`]]
- :IERC1820Implementer: pass:normal[xref:utils.adoc#IERC1820Implementer[`IERC1820Implementer`]]
- :IERC1820Registry-setInterfaceImplementer: pass:normal[xref:utils.adoc#IERC1820Registry-setInterfaceImplementer-address-bytes32-address-[`IERC1820Registry.setInterfaceImplementer`]]
- :xref-ERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-: xref:utils.adoc#ERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-
- :xref-ERC1820Implementer-_registerInterfaceForAddress-bytes32-address-: xref:utils.adoc#ERC1820Implementer-_registerInterfaceForAddress-bytes32-address-
- :IERC1820Implementer-canImplementInterfaceForAddress: pass:normal[xref:utils.adoc#IERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-[`IERC1820Implementer.canImplementInterfaceForAddress`]]
- :IERC1820Registry-setInterfaceImplementer: pass:normal[xref:utils.adoc#IERC1820Registry-setInterfaceImplementer-address-bytes32-address-[`IERC1820Registry.setInterfaceImplementer`]]
- :IERC1820Registry-interfaceHash: pass:normal[xref:utils.adoc#IERC1820Registry-interfaceHash-string-[`IERC1820Registry.interfaceHash`]]
- :xref-BitMaps-get-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-get-struct-BitMaps-BitMap-uint256-
- :xref-BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-: xref:utils.adoc#BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-
- :xref-BitMaps-set-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-set-struct-BitMaps-BitMap-uint256-
- :xref-BitMaps-unset-struct-BitMaps-BitMap-uint256-: xref:utils.adoc#BitMaps-unset-struct-BitMaps-BitMap-uint256-
- :xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-
- :xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
- :xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
- :xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-
- :xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
- :xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-
- :xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-string-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-string-
- :xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-
- :xref-EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-
- :xref-EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-length-struct-EnumerableMap-UintToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-UintToUintMap-
- :xref-EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-
- :xref-EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-string-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-string-
- :xref-EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-
- :xref-EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-
- :xref-EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-
- :xref-EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-
- :xref-EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-string-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-string-
- :xref-EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-
- :xref-EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-
- :xref-EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-
- :xref-EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-
- :xref-EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-
- :xref-EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-
- :xref-EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-
- :xref-EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-string-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-string-
- :xref-EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-
- :xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-: xref:utils.adoc#EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-
- :xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
- :xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
- :xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-: xref:utils.adoc#EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-
- :xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-: xref:utils.adoc#EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-
- :xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
- :xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-
- :xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-string-: xref:utils.adoc#EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-string-
- :xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-: xref:utils.adoc#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-
- :xref-EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-
- :xref-EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-
- :xref-EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-
- :xref-EnumerableSet-length-struct-EnumerableSet-Bytes32Set-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-Bytes32Set-
- :xref-EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-
- :xref-EnumerableSet-values-struct-EnumerableSet-Bytes32Set-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-Bytes32Set-
- :xref-EnumerableSet-add-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-AddressSet-address-
- :xref-EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-
- :xref-EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-
- :xref-EnumerableSet-length-struct-EnumerableSet-AddressSet-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-AddressSet-
- :xref-EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-
- :xref-EnumerableSet-values-struct-EnumerableSet-AddressSet-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-AddressSet-
- :xref-EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-
- :xref-EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-
- :xref-EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-
- :xref-EnumerableSet-length-struct-EnumerableSet-UintSet-: xref:utils.adoc#EnumerableSet-length-struct-EnumerableSet-UintSet-
- :xref-EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-: xref:utils.adoc#EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-
- :xref-EnumerableSet-values-struct-EnumerableSet-UintSet-: xref:utils.adoc#EnumerableSet-values-struct-EnumerableSet-UintSet-
- :xref-DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-: xref:utils.adoc#DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-
- :xref-DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-: xref:utils.adoc#DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-
- :xref-DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-: xref:utils.adoc#DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-
- :xref-DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-
- :xref-DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-: xref:utils.adoc#DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-
- :Votes: pass:normal[xref:governance.adoc#Votes[`Votes`]]
- :xref-Checkpoints-getAtBlock-struct-Checkpoints-History-uint256-: xref:utils.adoc#Checkpoints-getAtBlock-struct-Checkpoints-History-uint256-
- :xref-Checkpoints-getAtProbablyRecentBlock-struct-Checkpoints-History-uint256-: xref:utils.adoc#Checkpoints-getAtProbablyRecentBlock-struct-Checkpoints-History-uint256-
- :xref-Checkpoints-push-struct-Checkpoints-History-uint256-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-History-uint256-
- :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-
- :xref-Checkpoints-latest-struct-Checkpoints-History-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-History-
- :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-History-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-History-
- :xref-Checkpoints-length-struct-Checkpoints-History-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-History-
- :xref-Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-
- :xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-
- :xref-Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-
- :xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-: xref:utils.adoc#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-
- :xref-Checkpoints-latest-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-Trace224-
- :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-
- :xref-Checkpoints-length-struct-Checkpoints-Trace224-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-Trace224-
- :xref-Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-: xref:utils.adoc#Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-
- :xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-
- :xref-Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-
- :xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-: xref:utils.adoc#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-
- :xref-Checkpoints-latest-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-latest-struct-Checkpoints-Trace160-
- :xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-
- :xref-Checkpoints-length-struct-Checkpoints-Trace160-: xref:utils.adoc#Checkpoints-length-struct-Checkpoints-Trace160-
- :xref-Create2-deploy-uint256-bytes32-bytes-: xref:utils.adoc#Create2-deploy-uint256-bytes32-bytes-
- :xref-Create2-computeAddress-bytes32-bytes32-: xref:utils.adoc#Create2-computeAddress-bytes32-bytes32-
- :xref-Create2-computeAddress-bytes32-bytes32-address-: xref:utils.adoc#Create2-computeAddress-bytes32-bytes32-address-
- :xref-Address-isContract-address-: xref:utils.adoc#Address-isContract-address-
- :xref-Address-sendValue-address-payable-uint256-: xref:utils.adoc#Address-sendValue-address-payable-uint256-
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Address-functionCall-address-bytes-string-: xref:utils.adoc#Address-functionCall-address-bytes-string-
- :xref-Address-functionCallWithValue-address-bytes-uint256-: xref:utils.adoc#Address-functionCallWithValue-address-bytes-uint256-
- :xref-Address-functionCallWithValue-address-bytes-uint256-string-: xref:utils.adoc#Address-functionCallWithValue-address-bytes-uint256-string-
- :xref-Address-functionStaticCall-address-bytes-: xref:utils.adoc#Address-functionStaticCall-address-bytes-
- :xref-Address-functionStaticCall-address-bytes-string-: xref:utils.adoc#Address-functionStaticCall-address-bytes-string-
- :xref-Address-functionDelegateCall-address-bytes-: xref:utils.adoc#Address-functionDelegateCall-address-bytes-
- :xref-Address-functionDelegateCall-address-bytes-string-: xref:utils.adoc#Address-functionDelegateCall-address-bytes-string-
- :xref-Address-verifyCallResultFromTarget-address-bool-bytes-string-: xref:utils.adoc#Address-verifyCallResultFromTarget-address-bool-bytes-string-
- :xref-Address-verifyCallResult-bool-bytes-string-: xref:utils.adoc#Address-verifyCallResult-bool-bytes-string-
- :ReentrancyGuard: pass:normal[xref:security.adoc#ReentrancyGuard[`ReentrancyGuard`]]
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Address-functionCallWithValue-address-bytes-uint256-: xref:utils.adoc#Address-functionCallWithValue-address-bytes-uint256-
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Address-functionCall-address-bytes-string-: xref:utils.adoc#Address-functionCall-address-bytes-string-
- :xref-Address-functionCall-address-bytes-: xref:utils.adoc#Address-functionCall-address-bytes-
- :xref-Address-functionCall-address-bytes-string-: xref:utils.adoc#Address-functionCall-address-bytes-string-
- :xref-Arrays-findUpperBound-uint256---uint256-: xref:utils.adoc#Arrays-findUpperBound-uint256---uint256-
- :xref-Arrays-unsafeAccess-address---uint256-: xref:utils.adoc#Arrays-unsafeAccess-address---uint256-
- :xref-Arrays-unsafeAccess-bytes32---uint256-: xref:utils.adoc#Arrays-unsafeAccess-bytes32---uint256-
- :xref-Arrays-unsafeAccess-uint256---uint256-: xref:utils.adoc#Arrays-unsafeAccess-uint256---uint256-
- :xref-Base64-encode-bytes-: xref:utils.adoc#Base64-encode-bytes-
- :xref-Counters-current-struct-Counters-Counter-: xref:utils.adoc#Counters-current-struct-Counters-Counter-
- :xref-Counters-increment-struct-Counters-Counter-: xref:utils.adoc#Counters-increment-struct-Counters-Counter-
- :xref-Counters-decrement-struct-Counters-Counter-: xref:utils.adoc#Counters-decrement-struct-Counters-Counter-
- :xref-Counters-reset-struct-Counters-Counter-: xref:utils.adoc#Counters-reset-struct-Counters-Counter-
- :xref-Strings-toString-uint256-: xref:utils.adoc#Strings-toString-uint256-
- :xref-Strings-toString-int256-: xref:utils.adoc#Strings-toString-int256-
- :xref-Strings-toHexString-uint256-: xref:utils.adoc#Strings-toHexString-uint256-
- :xref-Strings-toHexString-uint256-uint256-: xref:utils.adoc#Strings-toHexString-uint256-uint256-
- :xref-Strings-toHexString-address-: xref:utils.adoc#Strings-toHexString-address-
- :xref-Strings-equal-string-string-: xref:utils.adoc#Strings-equal-string-string-
- :xref-ShortStrings-toShortString-string-: xref:utils.adoc#ShortStrings-toShortString-string-
- :xref-ShortStrings-toString-ShortString-: xref:utils.adoc#ShortStrings-toString-ShortString-
- :xref-ShortStrings-byteLength-ShortString-: xref:utils.adoc#ShortStrings-byteLength-ShortString-
- :xref-ShortStrings-toShortStringWithFallback-string-string-: xref:utils.adoc#ShortStrings-toShortStringWithFallback-string-string-
- :xref-ShortStrings-toStringWithFallback-ShortString-string-: xref:utils.adoc#ShortStrings-toStringWithFallback-ShortString-string-
- :xref-ShortStrings-byteLengthWithFallback-ShortString-string-: xref:utils.adoc#ShortStrings-byteLengthWithFallback-ShortString-string-
- :xref-StorageSlot-getAddressSlot-bytes32-: xref:utils.adoc#StorageSlot-getAddressSlot-bytes32-
- :xref-StorageSlot-getBooleanSlot-bytes32-: xref:utils.adoc#StorageSlot-getBooleanSlot-bytes32-
- :xref-StorageSlot-getBytes32Slot-bytes32-: xref:utils.adoc#StorageSlot-getBytes32Slot-bytes32-
- :xref-StorageSlot-getUint256Slot-bytes32-: xref:utils.adoc#StorageSlot-getUint256Slot-bytes32-
- :xref-StorageSlot-getStringSlot-bytes32-: xref:utils.adoc#StorageSlot-getStringSlot-bytes32-
- :xref-StorageSlot-getStringSlot-string-: xref:utils.adoc#StorageSlot-getStringSlot-string-
- :xref-StorageSlot-getBytesSlot-bytes32-: xref:utils.adoc#StorageSlot-getBytesSlot-bytes32-
- :xref-StorageSlot-getBytesSlot-bytes-: xref:utils.adoc#StorageSlot-getBytesSlot-bytes-
- :ERC2771Context: pass:normal[xref:metatx.adoc#ERC2771Context[`ERC2771Context`]]
- :xref-Multicall-multicall-bytes---: xref:utils.adoc#Multicall-multicall-bytes---
- = Utilities
- [.readme-notice]
- NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils
- Miscellaneous contracts and libraries containing utility functions you can use to improve security, work with new data types, or safely use low-level primitives.
- 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.
- {Multicall} provides a function to batch together multiple calls in a single external call.
- For new data types:
- * {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.
- * {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`).
- * {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.
- [NOTE]
- ====
- Because Solidity does not support generic types, {EnumerableMap} and {EnumerableSet} are specialized to a limited number of key-value types.
- As of v3.0, {EnumerableMap} supports `uint256 -> address` (`UintToAddressMap`), and {EnumerableSet} supports `address` and `uint256` (`AddressSet` and `UintSet`).
- ====
- 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.
- == Math
- :Rounding: pass:normal[xref:#Math-Rounding[`++Rounding++`]]
- :max: pass:normal[xref:#Math-max-uint256-uint256-[`++max++`]]
- :min: pass:normal[xref:#Math-min-uint256-uint256-[`++min++`]]
- :average: pass:normal[xref:#Math-average-uint256-uint256-[`++average++`]]
- :ceilDiv: pass:normal[xref:#Math-ceilDiv-uint256-uint256-[`++ceilDiv++`]]
- :mulDiv: pass:normal[xref:#Math-mulDiv-uint256-uint256-uint256-[`++mulDiv++`]]
- :mulDiv: pass:normal[xref:#Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-[`++mulDiv++`]]
- :sqrt: pass:normal[xref:#Math-sqrt-uint256-[`++sqrt++`]]
- :sqrt: pass:normal[xref:#Math-sqrt-uint256-enum-Math-Rounding-[`++sqrt++`]]
- :log2: pass:normal[xref:#Math-log2-uint256-[`++log2++`]]
- :log2: pass:normal[xref:#Math-log2-uint256-enum-Math-Rounding-[`++log2++`]]
- :log10: pass:normal[xref:#Math-log10-uint256-[`++log10++`]]
- :log10: pass:normal[xref:#Math-log10-uint256-enum-Math-Rounding-[`++log10++`]]
- :log256: pass:normal[xref:#Math-log256-uint256-[`++log256++`]]
- :log256: pass:normal[xref:#Math-log256-uint256-enum-Math-Rounding-[`++log256++`]]
- [.contract]
- [[Math]]
- === `++Math++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/math/Math.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/math/Math.sol";
- ```
- Standard math utilities missing in the Solidity language.
- [.contract-index]
- .Functions
- --
- * {xref-Math-max-uint256-uint256-}[`++max(a, b)++`]
- * {xref-Math-min-uint256-uint256-}[`++min(a, b)++`]
- * {xref-Math-average-uint256-uint256-}[`++average(a, b)++`]
- * {xref-Math-ceilDiv-uint256-uint256-}[`++ceilDiv(a, b)++`]
- * {xref-Math-mulDiv-uint256-uint256-uint256-}[`++mulDiv(x, y, denominator)++`]
- * {xref-Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-}[`++mulDiv(x, y, denominator, rounding)++`]
- * {xref-Math-sqrt-uint256-}[`++sqrt(a)++`]
- * {xref-Math-sqrt-uint256-enum-Math-Rounding-}[`++sqrt(a, rounding)++`]
- * {xref-Math-log2-uint256-}[`++log2(value)++`]
- * {xref-Math-log2-uint256-enum-Math-Rounding-}[`++log2(value, rounding)++`]
- * {xref-Math-log10-uint256-}[`++log10(value)++`]
- * {xref-Math-log10-uint256-enum-Math-Rounding-}[`++log10(value, rounding)++`]
- * {xref-Math-log256-uint256-}[`++log256(value)++`]
- * {xref-Math-log256-uint256-enum-Math-Rounding-}[`++log256(value, rounding)++`]
- --
- [.contract-item]
- [[Math-max-uint256-uint256-]]
- ==== `[.contract-item-name]#++max++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the largest of two numbers.
- [.contract-item]
- [[Math-min-uint256-uint256-]]
- ==== `[.contract-item-name]#++min++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the smallest of two numbers.
- [.contract-item]
- [[Math-average-uint256-uint256-]]
- ==== `[.contract-item-name]#++average++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the average of two numbers. The result is rounded towards
- zero.
- [.contract-item]
- [[Math-ceilDiv-uint256-uint256-]]
- ==== `[.contract-item-name]#++ceilDiv++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the ceiling of the division of two numbers.
- This differs from standard division with `/` in that it rounds up instead
- of rounding down.
- [.contract-item]
- [[Math-mulDiv-uint256-uint256-uint256-]]
- ==== `[.contract-item-name]#++mulDiv++#++(uint256 x, uint256 y, uint256 denominator) → uint256 result++` [.item-kind]#internal#
- Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
- with further edits by Uniswap Labs also under MIT license.
- [.contract-item]
- [[Math-mulDiv-uint256-uint256-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++mulDiv++#++(uint256 x, uint256 y, uint256 denominator, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- [.contract-item]
- [[Math-sqrt-uint256-]]
- ==== `[.contract-item-name]#++sqrt++#++(uint256 a) → uint256++` [.item-kind]#internal#
- Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
- Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
- [.contract-item]
- [[Math-sqrt-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++sqrt++#++(uint256 a, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- [.contract-item]
- [[Math-log2-uint256-]]
- ==== `[.contract-item-name]#++log2++#++(uint256 value) → uint256++` [.item-kind]#internal#
- Return the log in base 2, rounded down, of a positive value.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-log2-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++log2++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- Return the log in base 2, following the selected rounding direction, of a positive value.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-log10-uint256-]]
- ==== `[.contract-item-name]#++log10++#++(uint256 value) → uint256++` [.item-kind]#internal#
- Return the log in base 10, rounded down, of a positive value.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-log10-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++log10++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- Return the log in base 10, following the selected rounding direction, of a positive value.
- Returns 0 if given 0.
- [.contract-item]
- [[Math-log256-uint256-]]
- ==== `[.contract-item-name]#++log256++#++(uint256 value) → uint256++` [.item-kind]#internal#
- Return the log in base 256, rounded down, of a positive value.
- Returns 0 if given 0.
- Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
- [.contract-item]
- [[Math-log256-uint256-enum-Math-Rounding-]]
- ==== `[.contract-item-name]#++log256++#++(uint256 value, enum Math.Rounding rounding) → uint256++` [.item-kind]#internal#
- Return the log in base 256, following the selected rounding direction, of a positive value.
- Returns 0 if given 0.
- :max: pass:normal[xref:#SignedMath-max-int256-int256-[`++max++`]]
- :min: pass:normal[xref:#SignedMath-min-int256-int256-[`++min++`]]
- :average: pass:normal[xref:#SignedMath-average-int256-int256-[`++average++`]]
- :abs: pass:normal[xref:#SignedMath-abs-int256-[`++abs++`]]
- [.contract]
- [[SignedMath]]
- === `++SignedMath++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/math/SignedMath.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/math/SignedMath.sol";
- ```
- Standard signed math utilities missing in the Solidity language.
- [.contract-index]
- .Functions
- --
- * {xref-SignedMath-max-int256-int256-}[`++max(a, b)++`]
- * {xref-SignedMath-min-int256-int256-}[`++min(a, b)++`]
- * {xref-SignedMath-average-int256-int256-}[`++average(a, b)++`]
- * {xref-SignedMath-abs-int256-}[`++abs(n)++`]
- --
- [.contract-item]
- [[SignedMath-max-int256-int256-]]
- ==== `[.contract-item-name]#++max++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the largest of two signed numbers.
- [.contract-item]
- [[SignedMath-min-int256-int256-]]
- ==== `[.contract-item-name]#++min++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the smallest of two signed numbers.
- [.contract-item]
- [[SignedMath-average-int256-int256-]]
- ==== `[.contract-item-name]#++average++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the average of two signed numbers without overflow.
- The result is rounded towards zero.
- [.contract-item]
- [[SignedMath-abs-int256-]]
- ==== `[.contract-item-name]#++abs++#++(int256 n) → uint256++` [.item-kind]#internal#
- Returns the absolute unsigned value of a signed value.
- :toUint248: pass:normal[xref:#SafeCast-toUint248-uint256-[`++toUint248++`]]
- :toUint240: pass:normal[xref:#SafeCast-toUint240-uint256-[`++toUint240++`]]
- :toUint232: pass:normal[xref:#SafeCast-toUint232-uint256-[`++toUint232++`]]
- :toUint224: pass:normal[xref:#SafeCast-toUint224-uint256-[`++toUint224++`]]
- :toUint216: pass:normal[xref:#SafeCast-toUint216-uint256-[`++toUint216++`]]
- :toUint208: pass:normal[xref:#SafeCast-toUint208-uint256-[`++toUint208++`]]
- :toUint200: pass:normal[xref:#SafeCast-toUint200-uint256-[`++toUint200++`]]
- :toUint192: pass:normal[xref:#SafeCast-toUint192-uint256-[`++toUint192++`]]
- :toUint184: pass:normal[xref:#SafeCast-toUint184-uint256-[`++toUint184++`]]
- :toUint176: pass:normal[xref:#SafeCast-toUint176-uint256-[`++toUint176++`]]
- :toUint168: pass:normal[xref:#SafeCast-toUint168-uint256-[`++toUint168++`]]
- :toUint160: pass:normal[xref:#SafeCast-toUint160-uint256-[`++toUint160++`]]
- :toUint152: pass:normal[xref:#SafeCast-toUint152-uint256-[`++toUint152++`]]
- :toUint144: pass:normal[xref:#SafeCast-toUint144-uint256-[`++toUint144++`]]
- :toUint136: pass:normal[xref:#SafeCast-toUint136-uint256-[`++toUint136++`]]
- :toUint128: pass:normal[xref:#SafeCast-toUint128-uint256-[`++toUint128++`]]
- :toUint120: pass:normal[xref:#SafeCast-toUint120-uint256-[`++toUint120++`]]
- :toUint112: pass:normal[xref:#SafeCast-toUint112-uint256-[`++toUint112++`]]
- :toUint104: pass:normal[xref:#SafeCast-toUint104-uint256-[`++toUint104++`]]
- :toUint96: pass:normal[xref:#SafeCast-toUint96-uint256-[`++toUint96++`]]
- :toUint88: pass:normal[xref:#SafeCast-toUint88-uint256-[`++toUint88++`]]
- :toUint80: pass:normal[xref:#SafeCast-toUint80-uint256-[`++toUint80++`]]
- :toUint72: pass:normal[xref:#SafeCast-toUint72-uint256-[`++toUint72++`]]
- :toUint64: pass:normal[xref:#SafeCast-toUint64-uint256-[`++toUint64++`]]
- :toUint56: pass:normal[xref:#SafeCast-toUint56-uint256-[`++toUint56++`]]
- :toUint48: pass:normal[xref:#SafeCast-toUint48-uint256-[`++toUint48++`]]
- :toUint40: pass:normal[xref:#SafeCast-toUint40-uint256-[`++toUint40++`]]
- :toUint32: pass:normal[xref:#SafeCast-toUint32-uint256-[`++toUint32++`]]
- :toUint24: pass:normal[xref:#SafeCast-toUint24-uint256-[`++toUint24++`]]
- :toUint16: pass:normal[xref:#SafeCast-toUint16-uint256-[`++toUint16++`]]
- :toUint8: pass:normal[xref:#SafeCast-toUint8-uint256-[`++toUint8++`]]
- :toUint256: pass:normal[xref:#SafeCast-toUint256-int256-[`++toUint256++`]]
- :toInt248: pass:normal[xref:#SafeCast-toInt248-int256-[`++toInt248++`]]
- :toInt240: pass:normal[xref:#SafeCast-toInt240-int256-[`++toInt240++`]]
- :toInt232: pass:normal[xref:#SafeCast-toInt232-int256-[`++toInt232++`]]
- :toInt224: pass:normal[xref:#SafeCast-toInt224-int256-[`++toInt224++`]]
- :toInt216: pass:normal[xref:#SafeCast-toInt216-int256-[`++toInt216++`]]
- :toInt208: pass:normal[xref:#SafeCast-toInt208-int256-[`++toInt208++`]]
- :toInt200: pass:normal[xref:#SafeCast-toInt200-int256-[`++toInt200++`]]
- :toInt192: pass:normal[xref:#SafeCast-toInt192-int256-[`++toInt192++`]]
- :toInt184: pass:normal[xref:#SafeCast-toInt184-int256-[`++toInt184++`]]
- :toInt176: pass:normal[xref:#SafeCast-toInt176-int256-[`++toInt176++`]]
- :toInt168: pass:normal[xref:#SafeCast-toInt168-int256-[`++toInt168++`]]
- :toInt160: pass:normal[xref:#SafeCast-toInt160-int256-[`++toInt160++`]]
- :toInt152: pass:normal[xref:#SafeCast-toInt152-int256-[`++toInt152++`]]
- :toInt144: pass:normal[xref:#SafeCast-toInt144-int256-[`++toInt144++`]]
- :toInt136: pass:normal[xref:#SafeCast-toInt136-int256-[`++toInt136++`]]
- :toInt128: pass:normal[xref:#SafeCast-toInt128-int256-[`++toInt128++`]]
- :toInt120: pass:normal[xref:#SafeCast-toInt120-int256-[`++toInt120++`]]
- :toInt112: pass:normal[xref:#SafeCast-toInt112-int256-[`++toInt112++`]]
- :toInt104: pass:normal[xref:#SafeCast-toInt104-int256-[`++toInt104++`]]
- :toInt96: pass:normal[xref:#SafeCast-toInt96-int256-[`++toInt96++`]]
- :toInt88: pass:normal[xref:#SafeCast-toInt88-int256-[`++toInt88++`]]
- :toInt80: pass:normal[xref:#SafeCast-toInt80-int256-[`++toInt80++`]]
- :toInt72: pass:normal[xref:#SafeCast-toInt72-int256-[`++toInt72++`]]
- :toInt64: pass:normal[xref:#SafeCast-toInt64-int256-[`++toInt64++`]]
- :toInt56: pass:normal[xref:#SafeCast-toInt56-int256-[`++toInt56++`]]
- :toInt48: pass:normal[xref:#SafeCast-toInt48-int256-[`++toInt48++`]]
- :toInt40: pass:normal[xref:#SafeCast-toInt40-int256-[`++toInt40++`]]
- :toInt32: pass:normal[xref:#SafeCast-toInt32-int256-[`++toInt32++`]]
- :toInt24: pass:normal[xref:#SafeCast-toInt24-int256-[`++toInt24++`]]
- :toInt16: pass:normal[xref:#SafeCast-toInt16-int256-[`++toInt16++`]]
- :toInt8: pass:normal[xref:#SafeCast-toInt8-int256-[`++toInt8++`]]
- :toInt256: pass:normal[xref:#SafeCast-toInt256-uint256-[`++toInt256++`]]
- [.contract]
- [[SafeCast]]
- === `++SafeCast++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/math/SafeCast.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/math/SafeCast.sol";
- ```
- Wrappers over Solidity's uintXX/intXX casting operators with added overflow
- checks.
- Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
- easily result in undesired exploitation or bugs, since developers usually
- assume that overflows raise errors. `SafeCast` restores this intuition by
- reverting the transaction when such an operation overflows.
- Using this library instead of the unchecked operations eliminates an entire
- class of bugs, so it's recommended to use it always.
- Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
- all math on `uint256` and `int256` and then downcasting.
- [.contract-index]
- .Functions
- --
- * {xref-SafeCast-toUint248-uint256-}[`++toUint248(value)++`]
- * {xref-SafeCast-toUint240-uint256-}[`++toUint240(value)++`]
- * {xref-SafeCast-toUint232-uint256-}[`++toUint232(value)++`]
- * {xref-SafeCast-toUint224-uint256-}[`++toUint224(value)++`]
- * {xref-SafeCast-toUint216-uint256-}[`++toUint216(value)++`]
- * {xref-SafeCast-toUint208-uint256-}[`++toUint208(value)++`]
- * {xref-SafeCast-toUint200-uint256-}[`++toUint200(value)++`]
- * {xref-SafeCast-toUint192-uint256-}[`++toUint192(value)++`]
- * {xref-SafeCast-toUint184-uint256-}[`++toUint184(value)++`]
- * {xref-SafeCast-toUint176-uint256-}[`++toUint176(value)++`]
- * {xref-SafeCast-toUint168-uint256-}[`++toUint168(value)++`]
- * {xref-SafeCast-toUint160-uint256-}[`++toUint160(value)++`]
- * {xref-SafeCast-toUint152-uint256-}[`++toUint152(value)++`]
- * {xref-SafeCast-toUint144-uint256-}[`++toUint144(value)++`]
- * {xref-SafeCast-toUint136-uint256-}[`++toUint136(value)++`]
- * {xref-SafeCast-toUint128-uint256-}[`++toUint128(value)++`]
- * {xref-SafeCast-toUint120-uint256-}[`++toUint120(value)++`]
- * {xref-SafeCast-toUint112-uint256-}[`++toUint112(value)++`]
- * {xref-SafeCast-toUint104-uint256-}[`++toUint104(value)++`]
- * {xref-SafeCast-toUint96-uint256-}[`++toUint96(value)++`]
- * {xref-SafeCast-toUint88-uint256-}[`++toUint88(value)++`]
- * {xref-SafeCast-toUint80-uint256-}[`++toUint80(value)++`]
- * {xref-SafeCast-toUint72-uint256-}[`++toUint72(value)++`]
- * {xref-SafeCast-toUint64-uint256-}[`++toUint64(value)++`]
- * {xref-SafeCast-toUint56-uint256-}[`++toUint56(value)++`]
- * {xref-SafeCast-toUint48-uint256-}[`++toUint48(value)++`]
- * {xref-SafeCast-toUint40-uint256-}[`++toUint40(value)++`]
- * {xref-SafeCast-toUint32-uint256-}[`++toUint32(value)++`]
- * {xref-SafeCast-toUint24-uint256-}[`++toUint24(value)++`]
- * {xref-SafeCast-toUint16-uint256-}[`++toUint16(value)++`]
- * {xref-SafeCast-toUint8-uint256-}[`++toUint8(value)++`]
- * {xref-SafeCast-toUint256-int256-}[`++toUint256(value)++`]
- * {xref-SafeCast-toInt248-int256-}[`++toInt248(value)++`]
- * {xref-SafeCast-toInt240-int256-}[`++toInt240(value)++`]
- * {xref-SafeCast-toInt232-int256-}[`++toInt232(value)++`]
- * {xref-SafeCast-toInt224-int256-}[`++toInt224(value)++`]
- * {xref-SafeCast-toInt216-int256-}[`++toInt216(value)++`]
- * {xref-SafeCast-toInt208-int256-}[`++toInt208(value)++`]
- * {xref-SafeCast-toInt200-int256-}[`++toInt200(value)++`]
- * {xref-SafeCast-toInt192-int256-}[`++toInt192(value)++`]
- * {xref-SafeCast-toInt184-int256-}[`++toInt184(value)++`]
- * {xref-SafeCast-toInt176-int256-}[`++toInt176(value)++`]
- * {xref-SafeCast-toInt168-int256-}[`++toInt168(value)++`]
- * {xref-SafeCast-toInt160-int256-}[`++toInt160(value)++`]
- * {xref-SafeCast-toInt152-int256-}[`++toInt152(value)++`]
- * {xref-SafeCast-toInt144-int256-}[`++toInt144(value)++`]
- * {xref-SafeCast-toInt136-int256-}[`++toInt136(value)++`]
- * {xref-SafeCast-toInt128-int256-}[`++toInt128(value)++`]
- * {xref-SafeCast-toInt120-int256-}[`++toInt120(value)++`]
- * {xref-SafeCast-toInt112-int256-}[`++toInt112(value)++`]
- * {xref-SafeCast-toInt104-int256-}[`++toInt104(value)++`]
- * {xref-SafeCast-toInt96-int256-}[`++toInt96(value)++`]
- * {xref-SafeCast-toInt88-int256-}[`++toInt88(value)++`]
- * {xref-SafeCast-toInt80-int256-}[`++toInt80(value)++`]
- * {xref-SafeCast-toInt72-int256-}[`++toInt72(value)++`]
- * {xref-SafeCast-toInt64-int256-}[`++toInt64(value)++`]
- * {xref-SafeCast-toInt56-int256-}[`++toInt56(value)++`]
- * {xref-SafeCast-toInt48-int256-}[`++toInt48(value)++`]
- * {xref-SafeCast-toInt40-int256-}[`++toInt40(value)++`]
- * {xref-SafeCast-toInt32-int256-}[`++toInt32(value)++`]
- * {xref-SafeCast-toInt24-int256-}[`++toInt24(value)++`]
- * {xref-SafeCast-toInt16-int256-}[`++toInt16(value)++`]
- * {xref-SafeCast-toInt8-int256-}[`++toInt8(value)++`]
- * {xref-SafeCast-toInt256-uint256-}[`++toInt256(value)++`]
- --
- [.contract-item]
- [[SafeCast-toUint248-uint256-]]
- ==== `[.contract-item-name]#++toUint248++#++(uint256 value) → uint248++` [.item-kind]#internal#
- Returns the downcasted uint248 from uint256, reverting on
- overflow (when the input is greater than largest uint248).
- Counterpart to Solidity's `uint248` operator.
- Requirements:
- - input must fit into 248 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint240-uint256-]]
- ==== `[.contract-item-name]#++toUint240++#++(uint256 value) → uint240++` [.item-kind]#internal#
- Returns the downcasted uint240 from uint256, reverting on
- overflow (when the input is greater than largest uint240).
- Counterpart to Solidity's `uint240` operator.
- Requirements:
- - input must fit into 240 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint232-uint256-]]
- ==== `[.contract-item-name]#++toUint232++#++(uint256 value) → uint232++` [.item-kind]#internal#
- Returns the downcasted uint232 from uint256, reverting on
- overflow (when the input is greater than largest uint232).
- Counterpart to Solidity's `uint232` operator.
- Requirements:
- - input must fit into 232 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint224-uint256-]]
- ==== `[.contract-item-name]#++toUint224++#++(uint256 value) → uint224++` [.item-kind]#internal#
- Returns the downcasted uint224 from uint256, reverting on
- overflow (when the input is greater than largest uint224).
- Counterpart to Solidity's `uint224` operator.
- Requirements:
- - input must fit into 224 bits
- _Available since v4.2._
- [.contract-item]
- [[SafeCast-toUint216-uint256-]]
- ==== `[.contract-item-name]#++toUint216++#++(uint256 value) → uint216++` [.item-kind]#internal#
- Returns the downcasted uint216 from uint256, reverting on
- overflow (when the input is greater than largest uint216).
- Counterpart to Solidity's `uint216` operator.
- Requirements:
- - input must fit into 216 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint208-uint256-]]
- ==== `[.contract-item-name]#++toUint208++#++(uint256 value) → uint208++` [.item-kind]#internal#
- Returns the downcasted uint208 from uint256, reverting on
- overflow (when the input is greater than largest uint208).
- Counterpart to Solidity's `uint208` operator.
- Requirements:
- - input must fit into 208 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint200-uint256-]]
- ==== `[.contract-item-name]#++toUint200++#++(uint256 value) → uint200++` [.item-kind]#internal#
- Returns the downcasted uint200 from uint256, reverting on
- overflow (when the input is greater than largest uint200).
- Counterpart to Solidity's `uint200` operator.
- Requirements:
- - input must fit into 200 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint192-uint256-]]
- ==== `[.contract-item-name]#++toUint192++#++(uint256 value) → uint192++` [.item-kind]#internal#
- Returns the downcasted uint192 from uint256, reverting on
- overflow (when the input is greater than largest uint192).
- Counterpart to Solidity's `uint192` operator.
- Requirements:
- - input must fit into 192 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint184-uint256-]]
- ==== `[.contract-item-name]#++toUint184++#++(uint256 value) → uint184++` [.item-kind]#internal#
- Returns the downcasted uint184 from uint256, reverting on
- overflow (when the input is greater than largest uint184).
- Counterpart to Solidity's `uint184` operator.
- Requirements:
- - input must fit into 184 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint176-uint256-]]
- ==== `[.contract-item-name]#++toUint176++#++(uint256 value) → uint176++` [.item-kind]#internal#
- Returns the downcasted uint176 from uint256, reverting on
- overflow (when the input is greater than largest uint176).
- Counterpart to Solidity's `uint176` operator.
- Requirements:
- - input must fit into 176 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint168-uint256-]]
- ==== `[.contract-item-name]#++toUint168++#++(uint256 value) → uint168++` [.item-kind]#internal#
- Returns the downcasted uint168 from uint256, reverting on
- overflow (when the input is greater than largest uint168).
- Counterpart to Solidity's `uint168` operator.
- Requirements:
- - input must fit into 168 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint160-uint256-]]
- ==== `[.contract-item-name]#++toUint160++#++(uint256 value) → uint160++` [.item-kind]#internal#
- Returns the downcasted uint160 from uint256, reverting on
- overflow (when the input is greater than largest uint160).
- Counterpart to Solidity's `uint160` operator.
- Requirements:
- - input must fit into 160 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint152-uint256-]]
- ==== `[.contract-item-name]#++toUint152++#++(uint256 value) → uint152++` [.item-kind]#internal#
- Returns the downcasted uint152 from uint256, reverting on
- overflow (when the input is greater than largest uint152).
- Counterpart to Solidity's `uint152` operator.
- Requirements:
- - input must fit into 152 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint144-uint256-]]
- ==== `[.contract-item-name]#++toUint144++#++(uint256 value) → uint144++` [.item-kind]#internal#
- Returns the downcasted uint144 from uint256, reverting on
- overflow (when the input is greater than largest uint144).
- Counterpart to Solidity's `uint144` operator.
- Requirements:
- - input must fit into 144 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint136-uint256-]]
- ==== `[.contract-item-name]#++toUint136++#++(uint256 value) → uint136++` [.item-kind]#internal#
- Returns the downcasted uint136 from uint256, reverting on
- overflow (when the input is greater than largest uint136).
- Counterpart to Solidity's `uint136` operator.
- Requirements:
- - input must fit into 136 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint128-uint256-]]
- ==== `[.contract-item-name]#++toUint128++#++(uint256 value) → uint128++` [.item-kind]#internal#
- Returns the downcasted uint128 from uint256, reverting on
- overflow (when the input is greater than largest uint128).
- Counterpart to Solidity's `uint128` operator.
- Requirements:
- - input must fit into 128 bits
- _Available since v2.5._
- [.contract-item]
- [[SafeCast-toUint120-uint256-]]
- ==== `[.contract-item-name]#++toUint120++#++(uint256 value) → uint120++` [.item-kind]#internal#
- Returns the downcasted uint120 from uint256, reverting on
- overflow (when the input is greater than largest uint120).
- Counterpart to Solidity's `uint120` operator.
- Requirements:
- - input must fit into 120 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint112-uint256-]]
- ==== `[.contract-item-name]#++toUint112++#++(uint256 value) → uint112++` [.item-kind]#internal#
- Returns the downcasted uint112 from uint256, reverting on
- overflow (when the input is greater than largest uint112).
- Counterpart to Solidity's `uint112` operator.
- Requirements:
- - input must fit into 112 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint104-uint256-]]
- ==== `[.contract-item-name]#++toUint104++#++(uint256 value) → uint104++` [.item-kind]#internal#
- Returns the downcasted uint104 from uint256, reverting on
- overflow (when the input is greater than largest uint104).
- Counterpart to Solidity's `uint104` operator.
- Requirements:
- - input must fit into 104 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint96-uint256-]]
- ==== `[.contract-item-name]#++toUint96++#++(uint256 value) → uint96++` [.item-kind]#internal#
- Returns the downcasted uint96 from uint256, reverting on
- overflow (when the input is greater than largest uint96).
- Counterpart to Solidity's `uint96` operator.
- Requirements:
- - input must fit into 96 bits
- _Available since v4.2._
- [.contract-item]
- [[SafeCast-toUint88-uint256-]]
- ==== `[.contract-item-name]#++toUint88++#++(uint256 value) → uint88++` [.item-kind]#internal#
- Returns the downcasted uint88 from uint256, reverting on
- overflow (when the input is greater than largest uint88).
- Counterpart to Solidity's `uint88` operator.
- Requirements:
- - input must fit into 88 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint80-uint256-]]
- ==== `[.contract-item-name]#++toUint80++#++(uint256 value) → uint80++` [.item-kind]#internal#
- Returns the downcasted uint80 from uint256, reverting on
- overflow (when the input is greater than largest uint80).
- Counterpart to Solidity's `uint80` operator.
- Requirements:
- - input must fit into 80 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint72-uint256-]]
- ==== `[.contract-item-name]#++toUint72++#++(uint256 value) → uint72++` [.item-kind]#internal#
- Returns the downcasted uint72 from uint256, reverting on
- overflow (when the input is greater than largest uint72).
- Counterpart to Solidity's `uint72` operator.
- Requirements:
- - input must fit into 72 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint64-uint256-]]
- ==== `[.contract-item-name]#++toUint64++#++(uint256 value) → uint64++` [.item-kind]#internal#
- Returns the downcasted uint64 from uint256, reverting on
- overflow (when the input is greater than largest uint64).
- Counterpart to Solidity's `uint64` operator.
- Requirements:
- - input must fit into 64 bits
- _Available since v2.5._
- [.contract-item]
- [[SafeCast-toUint56-uint256-]]
- ==== `[.contract-item-name]#++toUint56++#++(uint256 value) → uint56++` [.item-kind]#internal#
- Returns the downcasted uint56 from uint256, reverting on
- overflow (when the input is greater than largest uint56).
- Counterpart to Solidity's `uint56` operator.
- Requirements:
- - input must fit into 56 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint48-uint256-]]
- ==== `[.contract-item-name]#++toUint48++#++(uint256 value) → uint48++` [.item-kind]#internal#
- Returns the downcasted uint48 from uint256, reverting on
- overflow (when the input is greater than largest uint48).
- Counterpart to Solidity's `uint48` operator.
- Requirements:
- - input must fit into 48 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint40-uint256-]]
- ==== `[.contract-item-name]#++toUint40++#++(uint256 value) → uint40++` [.item-kind]#internal#
- Returns the downcasted uint40 from uint256, reverting on
- overflow (when the input is greater than largest uint40).
- Counterpart to Solidity's `uint40` operator.
- Requirements:
- - input must fit into 40 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint32-uint256-]]
- ==== `[.contract-item-name]#++toUint32++#++(uint256 value) → uint32++` [.item-kind]#internal#
- Returns the downcasted uint32 from uint256, reverting on
- overflow (when the input is greater than largest uint32).
- Counterpart to Solidity's `uint32` operator.
- Requirements:
- - input must fit into 32 bits
- _Available since v2.5._
- [.contract-item]
- [[SafeCast-toUint24-uint256-]]
- ==== `[.contract-item-name]#++toUint24++#++(uint256 value) → uint24++` [.item-kind]#internal#
- Returns the downcasted uint24 from uint256, reverting on
- overflow (when the input is greater than largest uint24).
- Counterpart to Solidity's `uint24` operator.
- Requirements:
- - input must fit into 24 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toUint16-uint256-]]
- ==== `[.contract-item-name]#++toUint16++#++(uint256 value) → uint16++` [.item-kind]#internal#
- Returns the downcasted uint16 from uint256, reverting on
- overflow (when the input is greater than largest uint16).
- Counterpart to Solidity's `uint16` operator.
- Requirements:
- - input must fit into 16 bits
- _Available since v2.5._
- [.contract-item]
- [[SafeCast-toUint8-uint256-]]
- ==== `[.contract-item-name]#++toUint8++#++(uint256 value) → uint8++` [.item-kind]#internal#
- Returns the downcasted uint8 from uint256, reverting on
- overflow (when the input is greater than largest uint8).
- Counterpart to Solidity's `uint8` operator.
- Requirements:
- - input must fit into 8 bits
- _Available since v2.5._
- [.contract-item]
- [[SafeCast-toUint256-int256-]]
- ==== `[.contract-item-name]#++toUint256++#++(int256 value) → uint256++` [.item-kind]#internal#
- Converts a signed int256 into an unsigned uint256.
- Requirements:
- - input must be greater than or equal to 0.
- _Available since v3.0._
- [.contract-item]
- [[SafeCast-toInt248-int256-]]
- ==== `[.contract-item-name]#++toInt248++#++(int256 value) → int248 downcasted++` [.item-kind]#internal#
- Returns the downcasted int248 from int256, reverting on
- overflow (when the input is less than smallest int248 or
- greater than largest int248).
- Counterpart to Solidity's `int248` operator.
- Requirements:
- - input must fit into 248 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt240-int256-]]
- ==== `[.contract-item-name]#++toInt240++#++(int256 value) → int240 downcasted++` [.item-kind]#internal#
- Returns the downcasted int240 from int256, reverting on
- overflow (when the input is less than smallest int240 or
- greater than largest int240).
- Counterpart to Solidity's `int240` operator.
- Requirements:
- - input must fit into 240 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt232-int256-]]
- ==== `[.contract-item-name]#++toInt232++#++(int256 value) → int232 downcasted++` [.item-kind]#internal#
- Returns the downcasted int232 from int256, reverting on
- overflow (when the input is less than smallest int232 or
- greater than largest int232).
- Counterpart to Solidity's `int232` operator.
- Requirements:
- - input must fit into 232 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt224-int256-]]
- ==== `[.contract-item-name]#++toInt224++#++(int256 value) → int224 downcasted++` [.item-kind]#internal#
- Returns the downcasted int224 from int256, reverting on
- overflow (when the input is less than smallest int224 or
- greater than largest int224).
- Counterpart to Solidity's `int224` operator.
- Requirements:
- - input must fit into 224 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt216-int256-]]
- ==== `[.contract-item-name]#++toInt216++#++(int256 value) → int216 downcasted++` [.item-kind]#internal#
- Returns the downcasted int216 from int256, reverting on
- overflow (when the input is less than smallest int216 or
- greater than largest int216).
- Counterpart to Solidity's `int216` operator.
- Requirements:
- - input must fit into 216 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt208-int256-]]
- ==== `[.contract-item-name]#++toInt208++#++(int256 value) → int208 downcasted++` [.item-kind]#internal#
- Returns the downcasted int208 from int256, reverting on
- overflow (when the input is less than smallest int208 or
- greater than largest int208).
- Counterpart to Solidity's `int208` operator.
- Requirements:
- - input must fit into 208 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt200-int256-]]
- ==== `[.contract-item-name]#++toInt200++#++(int256 value) → int200 downcasted++` [.item-kind]#internal#
- Returns the downcasted int200 from int256, reverting on
- overflow (when the input is less than smallest int200 or
- greater than largest int200).
- Counterpart to Solidity's `int200` operator.
- Requirements:
- - input must fit into 200 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt192-int256-]]
- ==== `[.contract-item-name]#++toInt192++#++(int256 value) → int192 downcasted++` [.item-kind]#internal#
- Returns the downcasted int192 from int256, reverting on
- overflow (when the input is less than smallest int192 or
- greater than largest int192).
- Counterpart to Solidity's `int192` operator.
- Requirements:
- - input must fit into 192 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt184-int256-]]
- ==== `[.contract-item-name]#++toInt184++#++(int256 value) → int184 downcasted++` [.item-kind]#internal#
- Returns the downcasted int184 from int256, reverting on
- overflow (when the input is less than smallest int184 or
- greater than largest int184).
- Counterpart to Solidity's `int184` operator.
- Requirements:
- - input must fit into 184 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt176-int256-]]
- ==== `[.contract-item-name]#++toInt176++#++(int256 value) → int176 downcasted++` [.item-kind]#internal#
- Returns the downcasted int176 from int256, reverting on
- overflow (when the input is less than smallest int176 or
- greater than largest int176).
- Counterpart to Solidity's `int176` operator.
- Requirements:
- - input must fit into 176 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt168-int256-]]
- ==== `[.contract-item-name]#++toInt168++#++(int256 value) → int168 downcasted++` [.item-kind]#internal#
- Returns the downcasted int168 from int256, reverting on
- overflow (when the input is less than smallest int168 or
- greater than largest int168).
- Counterpart to Solidity's `int168` operator.
- Requirements:
- - input must fit into 168 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt160-int256-]]
- ==== `[.contract-item-name]#++toInt160++#++(int256 value) → int160 downcasted++` [.item-kind]#internal#
- Returns the downcasted int160 from int256, reverting on
- overflow (when the input is less than smallest int160 or
- greater than largest int160).
- Counterpart to Solidity's `int160` operator.
- Requirements:
- - input must fit into 160 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt152-int256-]]
- ==== `[.contract-item-name]#++toInt152++#++(int256 value) → int152 downcasted++` [.item-kind]#internal#
- Returns the downcasted int152 from int256, reverting on
- overflow (when the input is less than smallest int152 or
- greater than largest int152).
- Counterpart to Solidity's `int152` operator.
- Requirements:
- - input must fit into 152 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt144-int256-]]
- ==== `[.contract-item-name]#++toInt144++#++(int256 value) → int144 downcasted++` [.item-kind]#internal#
- Returns the downcasted int144 from int256, reverting on
- overflow (when the input is less than smallest int144 or
- greater than largest int144).
- Counterpart to Solidity's `int144` operator.
- Requirements:
- - input must fit into 144 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt136-int256-]]
- ==== `[.contract-item-name]#++toInt136++#++(int256 value) → int136 downcasted++` [.item-kind]#internal#
- Returns the downcasted int136 from int256, reverting on
- overflow (when the input is less than smallest int136 or
- greater than largest int136).
- Counterpart to Solidity's `int136` operator.
- Requirements:
- - input must fit into 136 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt128-int256-]]
- ==== `[.contract-item-name]#++toInt128++#++(int256 value) → int128 downcasted++` [.item-kind]#internal#
- Returns the downcasted int128 from int256, reverting on
- overflow (when the input is less than smallest int128 or
- greater than largest int128).
- Counterpart to Solidity's `int128` operator.
- Requirements:
- - input must fit into 128 bits
- _Available since v3.1._
- [.contract-item]
- [[SafeCast-toInt120-int256-]]
- ==== `[.contract-item-name]#++toInt120++#++(int256 value) → int120 downcasted++` [.item-kind]#internal#
- Returns the downcasted int120 from int256, reverting on
- overflow (when the input is less than smallest int120 or
- greater than largest int120).
- Counterpart to Solidity's `int120` operator.
- Requirements:
- - input must fit into 120 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt112-int256-]]
- ==== `[.contract-item-name]#++toInt112++#++(int256 value) → int112 downcasted++` [.item-kind]#internal#
- Returns the downcasted int112 from int256, reverting on
- overflow (when the input is less than smallest int112 or
- greater than largest int112).
- Counterpart to Solidity's `int112` operator.
- Requirements:
- - input must fit into 112 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt104-int256-]]
- ==== `[.contract-item-name]#++toInt104++#++(int256 value) → int104 downcasted++` [.item-kind]#internal#
- Returns the downcasted int104 from int256, reverting on
- overflow (when the input is less than smallest int104 or
- greater than largest int104).
- Counterpart to Solidity's `int104` operator.
- Requirements:
- - input must fit into 104 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt96-int256-]]
- ==== `[.contract-item-name]#++toInt96++#++(int256 value) → int96 downcasted++` [.item-kind]#internal#
- Returns the downcasted int96 from int256, reverting on
- overflow (when the input is less than smallest int96 or
- greater than largest int96).
- Counterpart to Solidity's `int96` operator.
- Requirements:
- - input must fit into 96 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt88-int256-]]
- ==== `[.contract-item-name]#++toInt88++#++(int256 value) → int88 downcasted++` [.item-kind]#internal#
- Returns the downcasted int88 from int256, reverting on
- overflow (when the input is less than smallest int88 or
- greater than largest int88).
- Counterpart to Solidity's `int88` operator.
- Requirements:
- - input must fit into 88 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt80-int256-]]
- ==== `[.contract-item-name]#++toInt80++#++(int256 value) → int80 downcasted++` [.item-kind]#internal#
- Returns the downcasted int80 from int256, reverting on
- overflow (when the input is less than smallest int80 or
- greater than largest int80).
- Counterpart to Solidity's `int80` operator.
- Requirements:
- - input must fit into 80 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt72-int256-]]
- ==== `[.contract-item-name]#++toInt72++#++(int256 value) → int72 downcasted++` [.item-kind]#internal#
- Returns the downcasted int72 from int256, reverting on
- overflow (when the input is less than smallest int72 or
- greater than largest int72).
- Counterpart to Solidity's `int72` operator.
- Requirements:
- - input must fit into 72 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt64-int256-]]
- ==== `[.contract-item-name]#++toInt64++#++(int256 value) → int64 downcasted++` [.item-kind]#internal#
- Returns the downcasted int64 from int256, reverting on
- overflow (when the input is less than smallest int64 or
- greater than largest int64).
- Counterpart to Solidity's `int64` operator.
- Requirements:
- - input must fit into 64 bits
- _Available since v3.1._
- [.contract-item]
- [[SafeCast-toInt56-int256-]]
- ==== `[.contract-item-name]#++toInt56++#++(int256 value) → int56 downcasted++` [.item-kind]#internal#
- Returns the downcasted int56 from int256, reverting on
- overflow (when the input is less than smallest int56 or
- greater than largest int56).
- Counterpart to Solidity's `int56` operator.
- Requirements:
- - input must fit into 56 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt48-int256-]]
- ==== `[.contract-item-name]#++toInt48++#++(int256 value) → int48 downcasted++` [.item-kind]#internal#
- Returns the downcasted int48 from int256, reverting on
- overflow (when the input is less than smallest int48 or
- greater than largest int48).
- Counterpart to Solidity's `int48` operator.
- Requirements:
- - input must fit into 48 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt40-int256-]]
- ==== `[.contract-item-name]#++toInt40++#++(int256 value) → int40 downcasted++` [.item-kind]#internal#
- Returns the downcasted int40 from int256, reverting on
- overflow (when the input is less than smallest int40 or
- greater than largest int40).
- Counterpart to Solidity's `int40` operator.
- Requirements:
- - input must fit into 40 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt32-int256-]]
- ==== `[.contract-item-name]#++toInt32++#++(int256 value) → int32 downcasted++` [.item-kind]#internal#
- Returns the downcasted int32 from int256, reverting on
- overflow (when the input is less than smallest int32 or
- greater than largest int32).
- Counterpart to Solidity's `int32` operator.
- Requirements:
- - input must fit into 32 bits
- _Available since v3.1._
- [.contract-item]
- [[SafeCast-toInt24-int256-]]
- ==== `[.contract-item-name]#++toInt24++#++(int256 value) → int24 downcasted++` [.item-kind]#internal#
- Returns the downcasted int24 from int256, reverting on
- overflow (when the input is less than smallest int24 or
- greater than largest int24).
- Counterpart to Solidity's `int24` operator.
- Requirements:
- - input must fit into 24 bits
- _Available since v4.7._
- [.contract-item]
- [[SafeCast-toInt16-int256-]]
- ==== `[.contract-item-name]#++toInt16++#++(int256 value) → int16 downcasted++` [.item-kind]#internal#
- Returns the downcasted int16 from int256, reverting on
- overflow (when the input is less than smallest int16 or
- greater than largest int16).
- Counterpart to Solidity's `int16` operator.
- Requirements:
- - input must fit into 16 bits
- _Available since v3.1._
- [.contract-item]
- [[SafeCast-toInt8-int256-]]
- ==== `[.contract-item-name]#++toInt8++#++(int256 value) → int8 downcasted++` [.item-kind]#internal#
- Returns the downcasted int8 from int256, reverting on
- overflow (when the input is less than smallest int8 or
- greater than largest int8).
- Counterpart to Solidity's `int8` operator.
- Requirements:
- - input must fit into 8 bits
- _Available since v3.1._
- [.contract-item]
- [[SafeCast-toInt256-uint256-]]
- ==== `[.contract-item-name]#++toInt256++#++(uint256 value) → int256++` [.item-kind]#internal#
- Converts an unsigned uint256 into a signed int256.
- Requirements:
- - input must be less than or equal to maxInt256.
- _Available since v3.0._
- :tryAdd: pass:normal[xref:#SafeMath-tryAdd-uint256-uint256-[`++tryAdd++`]]
- :trySub: pass:normal[xref:#SafeMath-trySub-uint256-uint256-[`++trySub++`]]
- :tryMul: pass:normal[xref:#SafeMath-tryMul-uint256-uint256-[`++tryMul++`]]
- :tryDiv: pass:normal[xref:#SafeMath-tryDiv-uint256-uint256-[`++tryDiv++`]]
- :tryMod: pass:normal[xref:#SafeMath-tryMod-uint256-uint256-[`++tryMod++`]]
- :add: pass:normal[xref:#SafeMath-add-uint256-uint256-[`++add++`]]
- :sub: pass:normal[xref:#SafeMath-sub-uint256-uint256-[`++sub++`]]
- :mul: pass:normal[xref:#SafeMath-mul-uint256-uint256-[`++mul++`]]
- :div: pass:normal[xref:#SafeMath-div-uint256-uint256-[`++div++`]]
- :mod: pass:normal[xref:#SafeMath-mod-uint256-uint256-[`++mod++`]]
- :sub: pass:normal[xref:#SafeMath-sub-uint256-uint256-string-[`++sub++`]]
- :div: pass:normal[xref:#SafeMath-div-uint256-uint256-string-[`++div++`]]
- :mod: pass:normal[xref:#SafeMath-mod-uint256-uint256-string-[`++mod++`]]
- [.contract]
- [[SafeMath]]
- === `++SafeMath++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/math/SafeMath.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/math/SafeMath.sol";
- ```
- Wrappers over Solidity's arithmetic operations.
- NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
- now has built in overflow checking.
- [.contract-index]
- .Functions
- --
- * {xref-SafeMath-tryAdd-uint256-uint256-}[`++tryAdd(a, b)++`]
- * {xref-SafeMath-trySub-uint256-uint256-}[`++trySub(a, b)++`]
- * {xref-SafeMath-tryMul-uint256-uint256-}[`++tryMul(a, b)++`]
- * {xref-SafeMath-tryDiv-uint256-uint256-}[`++tryDiv(a, b)++`]
- * {xref-SafeMath-tryMod-uint256-uint256-}[`++tryMod(a, b)++`]
- * {xref-SafeMath-add-uint256-uint256-}[`++add(a, b)++`]
- * {xref-SafeMath-sub-uint256-uint256-}[`++sub(a, b)++`]
- * {xref-SafeMath-mul-uint256-uint256-}[`++mul(a, b)++`]
- * {xref-SafeMath-div-uint256-uint256-}[`++div(a, b)++`]
- * {xref-SafeMath-mod-uint256-uint256-}[`++mod(a, b)++`]
- * {xref-SafeMath-sub-uint256-uint256-string-}[`++sub(a, b, errorMessage)++`]
- * {xref-SafeMath-div-uint256-uint256-string-}[`++div(a, b, errorMessage)++`]
- * {xref-SafeMath-mod-uint256-uint256-string-}[`++mod(a, b, errorMessage)++`]
- --
- [.contract-item]
- [[SafeMath-tryAdd-uint256-uint256-]]
- ==== `[.contract-item-name]#++tryAdd++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the addition of two unsigned integers, with an overflow flag.
- _Available since v3.4._
- [.contract-item]
- [[SafeMath-trySub-uint256-uint256-]]
- ==== `[.contract-item-name]#++trySub++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the subtraction of two unsigned integers, with an overflow flag.
- _Available since v3.4._
- [.contract-item]
- [[SafeMath-tryMul-uint256-uint256-]]
- ==== `[.contract-item-name]#++tryMul++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the multiplication of two unsigned integers, with an overflow flag.
- _Available since v3.4._
- [.contract-item]
- [[SafeMath-tryDiv-uint256-uint256-]]
- ==== `[.contract-item-name]#++tryDiv++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the division of two unsigned integers, with a division by zero flag.
- _Available since v3.4._
- [.contract-item]
- [[SafeMath-tryMod-uint256-uint256-]]
- ==== `[.contract-item-name]#++tryMod++#++(uint256 a, uint256 b) → bool, uint256++` [.item-kind]#internal#
- Returns the remainder of dividing two unsigned integers, with a division by zero flag.
- _Available since v3.4._
- [.contract-item]
- [[SafeMath-add-uint256-uint256-]]
- ==== `[.contract-item-name]#++add++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the addition of two unsigned integers, reverting on
- overflow.
- Counterpart to Solidity's `+` operator.
- Requirements:
- - Addition cannot overflow.
- [.contract-item]
- [[SafeMath-sub-uint256-uint256-]]
- ==== `[.contract-item-name]#++sub++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the subtraction of two unsigned integers, reverting on
- overflow (when the result is negative).
- Counterpart to Solidity's `-` operator.
- Requirements:
- - Subtraction cannot overflow.
- [.contract-item]
- [[SafeMath-mul-uint256-uint256-]]
- ==== `[.contract-item-name]#++mul++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the multiplication of two unsigned integers, reverting on
- overflow.
- Counterpart to Solidity's `*` operator.
- Requirements:
- - Multiplication cannot overflow.
- [.contract-item]
- [[SafeMath-div-uint256-uint256-]]
- ==== `[.contract-item-name]#++div++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the integer division of two unsigned integers, reverting on
- division by zero. The result is rounded towards zero.
- Counterpart to Solidity's `/` operator.
- Requirements:
- - The divisor cannot be zero.
- [.contract-item]
- [[SafeMath-mod-uint256-uint256-]]
- ==== `[.contract-item-name]#++mod++#++(uint256 a, uint256 b) → uint256++` [.item-kind]#internal#
- Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
- reverting when dividing by zero.
- Counterpart to Solidity's `%` operator. This function uses a `revert`
- opcode (which leaves remaining gas untouched) while Solidity uses an
- invalid opcode to revert (consuming all remaining gas).
- Requirements:
- - The divisor cannot be zero.
- [.contract-item]
- [[SafeMath-sub-uint256-uint256-string-]]
- ==== `[.contract-item-name]#++sub++#++(uint256 a, uint256 b, string errorMessage) → uint256++` [.item-kind]#internal#
- Returns the subtraction of two unsigned integers, reverting with custom message on
- overflow (when the result is negative).
- CAUTION: This function is deprecated because it requires allocating memory for the error
- message unnecessarily. For custom revert reasons use {trySub}.
- Counterpart to Solidity's `-` operator.
- Requirements:
- - Subtraction cannot overflow.
- [.contract-item]
- [[SafeMath-div-uint256-uint256-string-]]
- ==== `[.contract-item-name]#++div++#++(uint256 a, uint256 b, string errorMessage) → uint256++` [.item-kind]#internal#
- Returns the integer division of two unsigned integers, reverting with custom message on
- division by zero. The result is rounded towards zero.
- Counterpart to Solidity's `/` operator. Note: this function uses a
- `revert` opcode (which leaves remaining gas untouched) while Solidity
- uses an invalid opcode to revert (consuming all remaining gas).
- Requirements:
- - The divisor cannot be zero.
- [.contract-item]
- [[SafeMath-mod-uint256-uint256-string-]]
- ==== `[.contract-item-name]#++mod++#++(uint256 a, uint256 b, string errorMessage) → uint256++` [.item-kind]#internal#
- Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
- reverting with custom message when dividing by zero.
- CAUTION: This function is deprecated because it requires allocating memory for the error
- message unnecessarily. For custom revert reasons use {tryMod}.
- Counterpart to Solidity's `%` operator. This function uses a `revert`
- opcode (which leaves remaining gas untouched) while Solidity uses an
- invalid opcode to revert (consuming all remaining gas).
- Requirements:
- - The divisor cannot be zero.
- :mul: pass:normal[xref:#SignedSafeMath-mul-int256-int256-[`++mul++`]]
- :div: pass:normal[xref:#SignedSafeMath-div-int256-int256-[`++div++`]]
- :sub: pass:normal[xref:#SignedSafeMath-sub-int256-int256-[`++sub++`]]
- :add: pass:normal[xref:#SignedSafeMath-add-int256-int256-[`++add++`]]
- [.contract]
- [[SignedSafeMath]]
- === `++SignedSafeMath++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/math/SignedSafeMath.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/math/SignedSafeMath.sol";
- ```
- Wrappers over Solidity's arithmetic operations.
- NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler
- now has built in overflow checking.
- [.contract-index]
- .Functions
- --
- * {xref-SignedSafeMath-mul-int256-int256-}[`++mul(a, b)++`]
- * {xref-SignedSafeMath-div-int256-int256-}[`++div(a, b)++`]
- * {xref-SignedSafeMath-sub-int256-int256-}[`++sub(a, b)++`]
- * {xref-SignedSafeMath-add-int256-int256-}[`++add(a, b)++`]
- --
- [.contract-item]
- [[SignedSafeMath-mul-int256-int256-]]
- ==== `[.contract-item-name]#++mul++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the multiplication of two signed integers, reverting on
- overflow.
- Counterpart to Solidity's `*` operator.
- Requirements:
- - Multiplication cannot overflow.
- [.contract-item]
- [[SignedSafeMath-div-int256-int256-]]
- ==== `[.contract-item-name]#++div++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the integer division of two signed integers. Reverts on
- division by zero. The result is rounded towards zero.
- Counterpart to Solidity's `/` operator.
- Requirements:
- - The divisor cannot be zero.
- [.contract-item]
- [[SignedSafeMath-sub-int256-int256-]]
- ==== `[.contract-item-name]#++sub++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the subtraction of two signed integers, reverting on
- overflow.
- Counterpart to Solidity's `-` operator.
- Requirements:
- - Subtraction cannot overflow.
- [.contract-item]
- [[SignedSafeMath-add-int256-int256-]]
- ==== `[.contract-item-name]#++add++#++(int256 a, int256 b) → int256++` [.item-kind]#internal#
- Returns the addition of two signed integers, reverting on
- overflow.
- Counterpart to Solidity's `+` operator.
- Requirements:
- - Addition cannot overflow.
- == Cryptography
- :RecoverError: pass:normal[xref:#ECDSA-RecoverError[`++RecoverError++`]]
- :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-bytes-[`++tryRecover++`]]
- :recover: pass:normal[xref:#ECDSA-recover-bytes32-bytes-[`++recover++`]]
- :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-bytes32-bytes32-[`++tryRecover++`]]
- :recover: pass:normal[xref:#ECDSA-recover-bytes32-bytes32-bytes32-[`++recover++`]]
- :tryRecover: pass:normal[xref:#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-[`++tryRecover++`]]
- :recover: pass:normal[xref:#ECDSA-recover-bytes32-uint8-bytes32-bytes32-[`++recover++`]]
- :toEthSignedMessageHash: pass:normal[xref:#ECDSA-toEthSignedMessageHash-bytes32-[`++toEthSignedMessageHash++`]]
- :toEthSignedMessageHash: pass:normal[xref:#ECDSA-toEthSignedMessageHash-bytes-[`++toEthSignedMessageHash++`]]
- :toTypedDataHash: pass:normal[xref:#ECDSA-toTypedDataHash-bytes32-bytes32-[`++toTypedDataHash++`]]
- :toDataWithIntendedValidatorHash: pass:normal[xref:#ECDSA-toDataWithIntendedValidatorHash-address-bytes-[`++toDataWithIntendedValidatorHash++`]]
- [.contract]
- [[ECDSA]]
- === `++ECDSA++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/cryptography/ECDSA.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
- ```
- Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
- These functions can be used to verify that a message was signed by the holder
- of the private keys of a given address.
- [.contract-index]
- .Functions
- --
- * {xref-ECDSA-tryRecover-bytes32-bytes-}[`++tryRecover(hash, signature)++`]
- * {xref-ECDSA-recover-bytes32-bytes-}[`++recover(hash, signature)++`]
- * {xref-ECDSA-tryRecover-bytes32-bytes32-bytes32-}[`++tryRecover(hash, r, vs)++`]
- * {xref-ECDSA-recover-bytes32-bytes32-bytes32-}[`++recover(hash, r, vs)++`]
- * {xref-ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-}[`++tryRecover(hash, v, r, s)++`]
- * {xref-ECDSA-recover-bytes32-uint8-bytes32-bytes32-}[`++recover(hash, v, r, s)++`]
- * {xref-ECDSA-toEthSignedMessageHash-bytes32-}[`++toEthSignedMessageHash(hash)++`]
- * {xref-ECDSA-toEthSignedMessageHash-bytes-}[`++toEthSignedMessageHash(s)++`]
- * {xref-ECDSA-toTypedDataHash-bytes32-bytes32-}[`++toTypedDataHash(domainSeparator, structHash)++`]
- * {xref-ECDSA-toDataWithIntendedValidatorHash-address-bytes-}[`++toDataWithIntendedValidatorHash(validator, data)++`]
- --
- [.contract-item]
- [[ECDSA-tryRecover-bytes32-bytes-]]
- ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, bytes signature) → address, enum ECDSA.RecoverError++` [.item-kind]#internal#
- Returns the address that signed a hashed message (`hash`) with
- `signature` or error string. This address can then be used for verification purposes.
- The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
- this function rejects them by requiring the `s` value to be in the lower
- half order, and the `v` value to be either 27 or 28.
- IMPORTANT: `hash` _must_ be the result of a hash operation for the
- verification to be secure: it is possible to craft signatures that
- recover to arbitrary addresses for non-hashed data. A safe way to ensure
- this is by receiving a hash of the original message (which may otherwise
- be too long), and then calling {toEthSignedMessageHash} on it.
- Documentation for signature generation:
- - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
- - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
- _Available since v4.3._
- [.contract-item]
- [[ECDSA-recover-bytes32-bytes-]]
- ==== `[.contract-item-name]#++recover++#++(bytes32 hash, bytes signature) → address++` [.item-kind]#internal#
- Returns the address that signed a hashed message (`hash`) with
- `signature`. This address can then be used for verification purposes.
- The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
- this function rejects them by requiring the `s` value to be in the lower
- half order, and the `v` value to be either 27 or 28.
- IMPORTANT: `hash` _must_ be the result of a hash operation for the
- verification to be secure: it is possible to craft signatures that
- recover to arbitrary addresses for non-hashed data. A safe way to ensure
- this is by receiving a hash of the original message (which may otherwise
- be too long), and then calling {toEthSignedMessageHash} on it.
- [.contract-item]
- [[ECDSA-tryRecover-bytes32-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, bytes32 r, bytes32 vs) → address, enum ECDSA.RecoverError++` [.item-kind]#internal#
- Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
- See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
- _Available since v4.3._
- [.contract-item]
- [[ECDSA-recover-bytes32-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++recover++#++(bytes32 hash, bytes32 r, bytes32 vs) → address++` [.item-kind]#internal#
- Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
- _Available since v4.2._
- [.contract-item]
- [[ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++tryRecover++#++(bytes32 hash, uint8 v, bytes32 r, bytes32 s) → address, enum ECDSA.RecoverError++` [.item-kind]#internal#
- Overload of {ECDSA-tryRecover} that receives the `v`,
- `r` and `s` signature fields separately.
- _Available since v4.3._
- [.contract-item]
- [[ECDSA-recover-bytes32-uint8-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++recover++#++(bytes32 hash, uint8 v, bytes32 r, bytes32 s) → address++` [.item-kind]#internal#
- Overload of {ECDSA-recover} that receives the `v`,
- `r` and `s` signature fields separately.
- [.contract-item]
- [[ECDSA-toEthSignedMessageHash-bytes32-]]
- ==== `[.contract-item-name]#++toEthSignedMessageHash++#++(bytes32 hash) → bytes32 message++` [.item-kind]#internal#
- Returns an Ethereum Signed Message, created from a `hash`. This
- produces hash corresponding to the one signed with the
- https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
- JSON-RPC method as part of EIP-191.
- See {recover}.
- [.contract-item]
- [[ECDSA-toEthSignedMessageHash-bytes-]]
- ==== `[.contract-item-name]#++toEthSignedMessageHash++#++(bytes s) → bytes32++` [.item-kind]#internal#
- Returns an Ethereum Signed Message, created from `s`. This
- produces hash corresponding to the one signed with the
- https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
- JSON-RPC method as part of EIP-191.
- See {recover}.
- [.contract-item]
- [[ECDSA-toTypedDataHash-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++toTypedDataHash++#++(bytes32 domainSeparator, bytes32 structHash) → bytes32 data++` [.item-kind]#internal#
- Returns an Ethereum Signed Typed Data, created from a
- `domainSeparator` and a `structHash`. This produces hash corresponding
- to the one signed with the
- https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
- JSON-RPC method as part of EIP-712.
- See {recover}.
- [.contract-item]
- [[ECDSA-toDataWithIntendedValidatorHash-address-bytes-]]
- ==== `[.contract-item-name]#++toDataWithIntendedValidatorHash++#++(address validator, bytes data) → bytes32++` [.item-kind]#internal#
- Returns an Ethereum Signed Data with intended validator, created from a
- `validator` and `data` according to the version 0 of EIP-191.
- See {recover}.
- :isValidSignatureNow: pass:normal[xref:#SignatureChecker-isValidSignatureNow-address-bytes32-bytes-[`++isValidSignatureNow++`]]
- :isValidERC1271SignatureNow: pass:normal[xref:#SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-[`++isValidERC1271SignatureNow++`]]
- [.contract]
- [[SignatureChecker]]
- === `++SignatureChecker++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/cryptography/SignatureChecker.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
- ```
- Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
- signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
- Argent and Gnosis Safe.
- _Available since v4.1._
- [.contract-index]
- .Functions
- --
- * {xref-SignatureChecker-isValidSignatureNow-address-bytes32-bytes-}[`++isValidSignatureNow(signer, hash, signature)++`]
- * {xref-SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-}[`++isValidERC1271SignatureNow(signer, hash, signature)++`]
- --
- [.contract-item]
- [[SignatureChecker-isValidSignatureNow-address-bytes32-bytes-]]
- ==== `[.contract-item-name]#++isValidSignatureNow++#++(address signer, bytes32 hash, bytes signature) → bool++` [.item-kind]#internal#
- Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
- signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
- NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
- change through time. It could return true at block N and false at block N+1 (or the opposite).
- [.contract-item]
- [[SignatureChecker-isValidERC1271SignatureNow-address-bytes32-bytes-]]
- ==== `[.contract-item-name]#++isValidERC1271SignatureNow++#++(address signer, bytes32 hash, bytes signature) → bool++` [.item-kind]#internal#
- Checks if a signature is valid for a given signer and data hash. The signature is validated
- against the signer smart contract using ERC1271.
- NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
- change through time. It could return true at block N and false at block N+1 (or the opposite).
- :verify: pass:normal[xref:#MerkleProof-verify-bytes32---bytes32-bytes32-[`++verify++`]]
- :verifyCalldata: pass:normal[xref:#MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-[`++verifyCalldata++`]]
- :processProof: pass:normal[xref:#MerkleProof-processProof-bytes32---bytes32-[`++processProof++`]]
- :processProofCalldata: pass:normal[xref:#MerkleProof-processProofCalldata-bytes32---bytes32-[`++processProofCalldata++`]]
- :multiProofVerify: pass:normal[xref:#MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---[`++multiProofVerify++`]]
- :multiProofVerifyCalldata: pass:normal[xref:#MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---[`++multiProofVerifyCalldata++`]]
- :processMultiProof: pass:normal[xref:#MerkleProof-processMultiProof-bytes32---bool---bytes32---[`++processMultiProof++`]]
- :processMultiProofCalldata: pass:normal[xref:#MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---[`++processMultiProofCalldata++`]]
- [.contract]
- [[MerkleProof]]
- === `++MerkleProof++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/cryptography/MerkleProof.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
- ```
- These functions deal with verification of Merkle Tree proofs.
- The tree and the proofs can be generated using our
- https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
- You will find a quickstart guide in the readme.
- WARNING: You should avoid using leaf values that are 64 bytes long prior to
- hashing, or use a hash function other than keccak256 for hashing leaves.
- This is because the concatenation of a sorted pair of internal nodes in
- the merkle tree could be reinterpreted as a leaf value.
- OpenZeppelin's JavaScript library generates merkle trees that are safe
- against this attack out of the box.
- [.contract-index]
- .Functions
- --
- * {xref-MerkleProof-verify-bytes32---bytes32-bytes32-}[`++verify(proof, root, leaf)++`]
- * {xref-MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-}[`++verifyCalldata(proof, root, leaf)++`]
- * {xref-MerkleProof-processProof-bytes32---bytes32-}[`++processProof(proof, leaf)++`]
- * {xref-MerkleProof-processProofCalldata-bytes32---bytes32-}[`++processProofCalldata(proof, leaf)++`]
- * {xref-MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---}[`++multiProofVerify(proof, proofFlags, root, leaves)++`]
- * {xref-MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---}[`++multiProofVerifyCalldata(proof, proofFlags, root, leaves)++`]
- * {xref-MerkleProof-processMultiProof-bytes32---bool---bytes32---}[`++processMultiProof(proof, proofFlags, leaves)++`]
- * {xref-MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---}[`++processMultiProofCalldata(proof, proofFlags, leaves)++`]
- --
- [.contract-item]
- [[MerkleProof-verify-bytes32---bytes32-bytes32-]]
- ==== `[.contract-item-name]#++verify++#++(bytes32[] proof, bytes32 root, bytes32 leaf) → bool++` [.item-kind]#internal#
- Returns true if a `leaf` can be proved to be a part of a Merkle tree
- defined by `root`. For this, a `proof` must be provided, containing
- sibling hashes on the branch from the leaf to the root of the tree. Each
- pair of leaves and each pair of pre-images are assumed to be sorted.
- [.contract-item]
- [[MerkleProof-verifyCalldata-bytes32---bytes32-bytes32-]]
- ==== `[.contract-item-name]#++verifyCalldata++#++(bytes32[] proof, bytes32 root, bytes32 leaf) → bool++` [.item-kind]#internal#
- Calldata version of {verify}
- _Available since v4.7._
- [.contract-item]
- [[MerkleProof-processProof-bytes32---bytes32-]]
- ==== `[.contract-item-name]#++processProof++#++(bytes32[] proof, bytes32 leaf) → bytes32++` [.item-kind]#internal#
- Returns the rebuilt hash obtained by traversing a Merkle tree up
- from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
- hash matches the root of the tree. When processing the proof, the pairs
- of leafs & pre-images are assumed to be sorted.
- _Available since v4.4._
- [.contract-item]
- [[MerkleProof-processProofCalldata-bytes32---bytes32-]]
- ==== `[.contract-item-name]#++processProofCalldata++#++(bytes32[] proof, bytes32 leaf) → bytes32++` [.item-kind]#internal#
- Calldata version of {processProof}
- _Available since v4.7._
- [.contract-item]
- [[MerkleProof-multiProofVerify-bytes32---bool---bytes32-bytes32---]]
- ==== `[.contract-item-name]#++multiProofVerify++#++(bytes32[] proof, bool[] proofFlags, bytes32 root, bytes32[] leaves) → bool++` [.item-kind]#internal#
- Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
- `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
- CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
- _Available since v4.7._
- [.contract-item]
- [[MerkleProof-multiProofVerifyCalldata-bytes32---bool---bytes32-bytes32---]]
- ==== `[.contract-item-name]#++multiProofVerifyCalldata++#++(bytes32[] proof, bool[] proofFlags, bytes32 root, bytes32[] leaves) → bool++` [.item-kind]#internal#
- Calldata version of {multiProofVerify}
- CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
- _Available since v4.7._
- [.contract-item]
- [[MerkleProof-processMultiProof-bytes32---bool---bytes32---]]
- ==== `[.contract-item-name]#++processMultiProof++#++(bytes32[] proof, bool[] proofFlags, bytes32[] leaves) → bytes32 merkleRoot++` [.item-kind]#internal#
- Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
- proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
- leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
- respectively.
- CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
- is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
- tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
- _Available since v4.7._
- [.contract-item]
- [[MerkleProof-processMultiProofCalldata-bytes32---bool---bytes32---]]
- ==== `[.contract-item-name]#++processMultiProofCalldata++#++(bytes32[] proof, bool[] proofFlags, bytes32[] leaves) → bytes32 merkleRoot++` [.item-kind]#internal#
- Calldata version of {processMultiProof}.
- CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
- _Available since v4.7._
- :constructor: pass:normal[xref:#EIP712-constructor-string-string-[`++constructor++`]]
- :_domainSeparatorV4: pass:normal[xref:#EIP712-_domainSeparatorV4--[`++_domainSeparatorV4++`]]
- :_hashTypedDataV4: pass:normal[xref:#EIP712-_hashTypedDataV4-bytes32-[`++_hashTypedDataV4++`]]
- :eip712Domain: pass:normal[xref:#EIP712-eip712Domain--[`++eip712Domain++`]]
- [.contract]
- [[EIP712]]
- === `++EIP712++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/cryptography/EIP712.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
- ```
- https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
- The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
- thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
- they need in their contracts using a combination of `abi.encode` and `keccak256`.
- This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
- scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
- ({_hashTypedDataV4}).
- The implementation of the domain separator was designed to be as efficient as possible while still properly updating
- the chain id to protect against replay attacks on an eventual fork of the chain.
- NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
- https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
- NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
- separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
- separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
- _Available since v3.4._
- [.contract-index]
- .Functions
- --
- * {xref-EIP712-constructor-string-string-}[`++constructor(name, version)++`]
- * {xref-EIP712-_domainSeparatorV4--}[`++_domainSeparatorV4()++`]
- * {xref-EIP712-_hashTypedDataV4-bytes32-}[`++_hashTypedDataV4(structHash)++`]
- * {xref-EIP712-eip712Domain--}[`++eip712Domain()++`]
- [.contract-subindex-inherited]
- .IERC5267
- --
- [.contract-index]
- .Events
- --
- [.contract-subindex-inherited]
- .IERC5267
- * {xref-IERC5267-EIP712DomainChanged--}[`++EIP712DomainChanged()++`]
- --
- [.contract-item]
- [[EIP712-constructor-string-string-]]
- ==== `[.contract-item-name]#++constructor++#++(string name, string version)++` [.item-kind]#internal#
- Initializes the domain separator and parameter caches.
- The meaning of `name` and `version` is specified in
- https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
- - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
- - `version`: the current major version of the signing domain.
- NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
- contract upgrade].
- [.contract-item]
- [[EIP712-_domainSeparatorV4--]]
- ==== `[.contract-item-name]#++_domainSeparatorV4++#++() → bytes32++` [.item-kind]#internal#
- Returns the domain separator for the current chain.
- [.contract-item]
- [[EIP712-_hashTypedDataV4-bytes32-]]
- ==== `[.contract-item-name]#++_hashTypedDataV4++#++(bytes32 structHash) → bytes32++` [.item-kind]#internal#
- Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
- function returns the hash of the fully encoded EIP712 message for this domain.
- This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
- ```solidity
- bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
- keccak256("Mail(address to,string contents)"),
- mailTo,
- keccak256(bytes(mailContents))
- )));
- address signer = ECDSA.recover(digest, signature);
- ```
- [.contract-item]
- [[EIP712-eip712Domain--]]
- ==== `[.contract-item-name]#++eip712Domain++#++() → bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions++` [.item-kind]#public#
- See {EIP-5267}.
- _Available since v4.9._
- == Escrow
- :withdrawalAllowed: pass:normal[xref:#ConditionalEscrow-withdrawalAllowed-address-[`++withdrawalAllowed++`]]
- :withdraw: pass:normal[xref:#ConditionalEscrow-withdraw-address-payable-[`++withdraw++`]]
- [.contract]
- [[ConditionalEscrow]]
- === `++ConditionalEscrow++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/escrow/ConditionalEscrow.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/escrow/ConditionalEscrow.sol";
- ```
- Base abstract escrow to only allow withdrawal if a condition is met.
- Intended usage: See {Escrow}. Same usage guidelines apply here.
- [.contract-index]
- .Functions
- --
- * {xref-ConditionalEscrow-withdrawalAllowed-address-}[`++withdrawalAllowed(payee)++`]
- * {xref-ConditionalEscrow-withdraw-address-payable-}[`++withdraw(payee)++`]
- [.contract-subindex-inherited]
- .Escrow
- * {xref-Escrow-depositsOf-address-}[`++depositsOf(payee)++`]
- * {xref-Escrow-deposit-address-}[`++deposit(payee)++`]
- [.contract-subindex-inherited]
- .Ownable
- * {xref-Ownable-owner--}[`++owner()++`]
- * {xref-Ownable-_checkOwner--}[`++_checkOwner()++`]
- * {xref-Ownable-renounceOwnership--}[`++renounceOwnership()++`]
- * {xref-Ownable-transferOwnership-address-}[`++transferOwnership(newOwner)++`]
- * {xref-Ownable-_transferOwnership-address-}[`++_transferOwnership(newOwner)++`]
- --
- [.contract-index]
- .Events
- --
- [.contract-subindex-inherited]
- .Escrow
- * {xref-Escrow-Deposited-address-uint256-}[`++Deposited(payee, weiAmount)++`]
- * {xref-Escrow-Withdrawn-address-uint256-}[`++Withdrawn(payee, weiAmount)++`]
- [.contract-subindex-inherited]
- .Ownable
- * {xref-Ownable-OwnershipTransferred-address-address-}[`++OwnershipTransferred(previousOwner, newOwner)++`]
- --
- [.contract-item]
- [[ConditionalEscrow-withdrawalAllowed-address-]]
- ==== `[.contract-item-name]#++withdrawalAllowed++#++(address payee) → bool++` [.item-kind]#public#
- Returns whether an address is allowed to withdraw their funds. To be
- implemented by derived contracts.
- [.contract-item]
- [[ConditionalEscrow-withdraw-address-payable-]]
- ==== `[.contract-item-name]#++withdraw++#++(address payable payee)++` [.item-kind]#public#
- Withdraw accumulated balance for a payee, forwarding all gas to the
- recipient.
- WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
- Make sure you trust the recipient, or are either following the
- checks-effects-interactions pattern or using {ReentrancyGuard}.
- :Deposited: pass:normal[xref:#Escrow-Deposited-address-uint256-[`++Deposited++`]]
- :Withdrawn: pass:normal[xref:#Escrow-Withdrawn-address-uint256-[`++Withdrawn++`]]
- :depositsOf: pass:normal[xref:#Escrow-depositsOf-address-[`++depositsOf++`]]
- :deposit: pass:normal[xref:#Escrow-deposit-address-[`++deposit++`]]
- :withdraw: pass:normal[xref:#Escrow-withdraw-address-payable-[`++withdraw++`]]
- [.contract]
- [[Escrow]]
- === `++Escrow++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/escrow/Escrow.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/escrow/Escrow.sol";
- ```
- Base escrow contract, holds funds designated for a payee until they
- withdraw them.
- Intended usage: This contract (and derived escrow contracts) should be a
- standalone contract, that only interacts with the contract that instantiated
- it. That way, it is guaranteed that all Ether will be handled according to
- the `Escrow` rules, and there is no need to check for payable functions or
- transfers in the inheritance tree. The contract that uses the escrow as its
- payment method should be its owner, and provide public methods redirecting
- to the escrow's deposit and withdraw.
- [.contract-index]
- .Functions
- --
- * {xref-Escrow-depositsOf-address-}[`++depositsOf(payee)++`]
- * {xref-Escrow-deposit-address-}[`++deposit(payee)++`]
- * {xref-Escrow-withdraw-address-payable-}[`++withdraw(payee)++`]
- [.contract-subindex-inherited]
- .Ownable
- * {xref-Ownable-owner--}[`++owner()++`]
- * {xref-Ownable-_checkOwner--}[`++_checkOwner()++`]
- * {xref-Ownable-renounceOwnership--}[`++renounceOwnership()++`]
- * {xref-Ownable-transferOwnership-address-}[`++transferOwnership(newOwner)++`]
- * {xref-Ownable-_transferOwnership-address-}[`++_transferOwnership(newOwner)++`]
- --
- [.contract-index]
- .Events
- --
- * {xref-Escrow-Deposited-address-uint256-}[`++Deposited(payee, weiAmount)++`]
- * {xref-Escrow-Withdrawn-address-uint256-}[`++Withdrawn(payee, weiAmount)++`]
- [.contract-subindex-inherited]
- .Ownable
- * {xref-Ownable-OwnershipTransferred-address-address-}[`++OwnershipTransferred(previousOwner, newOwner)++`]
- --
- [.contract-item]
- [[Escrow-depositsOf-address-]]
- ==== `[.contract-item-name]#++depositsOf++#++(address payee) → uint256++` [.item-kind]#public#
- [.contract-item]
- [[Escrow-deposit-address-]]
- ==== `[.contract-item-name]#++deposit++#++(address payee)++` [.item-kind]#public#
- Stores the sent amount as credit to be withdrawn.
- [.contract-item]
- [[Escrow-withdraw-address-payable-]]
- ==== `[.contract-item-name]#++withdraw++#++(address payable payee)++` [.item-kind]#public#
- Withdraw accumulated balance for a payee, forwarding all gas to the
- recipient.
- WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
- Make sure you trust the recipient, or are either following the
- checks-effects-interactions pattern or using {ReentrancyGuard}.
- [.contract-item]
- [[Escrow-Deposited-address-uint256-]]
- ==== `[.contract-item-name]#++Deposited++#++(address indexed payee, uint256 weiAmount)++` [.item-kind]#event#
- [.contract-item]
- [[Escrow-Withdrawn-address-uint256-]]
- ==== `[.contract-item-name]#++Withdrawn++#++(address indexed payee, uint256 weiAmount)++` [.item-kind]#event#
- :State: pass:normal[xref:#RefundEscrow-State[`++State++`]]
- :RefundsClosed: pass:normal[xref:#RefundEscrow-RefundsClosed--[`++RefundsClosed++`]]
- :RefundsEnabled: pass:normal[xref:#RefundEscrow-RefundsEnabled--[`++RefundsEnabled++`]]
- :constructor: pass:normal[xref:#RefundEscrow-constructor-address-payable-[`++constructor++`]]
- :state: pass:normal[xref:#RefundEscrow-state--[`++state++`]]
- :beneficiary: pass:normal[xref:#RefundEscrow-beneficiary--[`++beneficiary++`]]
- :deposit: pass:normal[xref:#RefundEscrow-deposit-address-[`++deposit++`]]
- :close: pass:normal[xref:#RefundEscrow-close--[`++close++`]]
- :enableRefunds: pass:normal[xref:#RefundEscrow-enableRefunds--[`++enableRefunds++`]]
- :beneficiaryWithdraw: pass:normal[xref:#RefundEscrow-beneficiaryWithdraw--[`++beneficiaryWithdraw++`]]
- :withdrawalAllowed: pass:normal[xref:#RefundEscrow-withdrawalAllowed-address-[`++withdrawalAllowed++`]]
- [.contract]
- [[RefundEscrow]]
- === `++RefundEscrow++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/escrow/RefundEscrow.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/escrow/RefundEscrow.sol";
- ```
- Escrow that holds funds for a beneficiary, deposited from multiple
- parties.
- Intended usage: See {Escrow}. Same usage guidelines apply here.
- The owner account (that is, the contract that instantiates this
- contract) may deposit, close the deposit period, and allow for either
- withdrawal by the beneficiary, or refunds to the depositors. All interactions
- with `RefundEscrow` will be made through the owner contract.
- [.contract-index]
- .Functions
- --
- * {xref-RefundEscrow-constructor-address-payable-}[`++constructor(beneficiary_)++`]
- * {xref-RefundEscrow-state--}[`++state()++`]
- * {xref-RefundEscrow-beneficiary--}[`++beneficiary()++`]
- * {xref-RefundEscrow-deposit-address-}[`++deposit(refundee)++`]
- * {xref-RefundEscrow-close--}[`++close()++`]
- * {xref-RefundEscrow-enableRefunds--}[`++enableRefunds()++`]
- * {xref-RefundEscrow-beneficiaryWithdraw--}[`++beneficiaryWithdraw()++`]
- * {xref-RefundEscrow-withdrawalAllowed-address-}[`++withdrawalAllowed()++`]
- [.contract-subindex-inherited]
- .ConditionalEscrow
- * {xref-ConditionalEscrow-withdraw-address-payable-}[`++withdraw(payee)++`]
- [.contract-subindex-inherited]
- .Escrow
- * {xref-Escrow-depositsOf-address-}[`++depositsOf(payee)++`]
- [.contract-subindex-inherited]
- .Ownable
- * {xref-Ownable-owner--}[`++owner()++`]
- * {xref-Ownable-_checkOwner--}[`++_checkOwner()++`]
- * {xref-Ownable-renounceOwnership--}[`++renounceOwnership()++`]
- * {xref-Ownable-transferOwnership-address-}[`++transferOwnership(newOwner)++`]
- * {xref-Ownable-_transferOwnership-address-}[`++_transferOwnership(newOwner)++`]
- --
- [.contract-index]
- .Events
- --
- * {xref-RefundEscrow-RefundsClosed--}[`++RefundsClosed()++`]
- * {xref-RefundEscrow-RefundsEnabled--}[`++RefundsEnabled()++`]
- [.contract-subindex-inherited]
- .ConditionalEscrow
- [.contract-subindex-inherited]
- .Escrow
- * {xref-Escrow-Deposited-address-uint256-}[`++Deposited(payee, weiAmount)++`]
- * {xref-Escrow-Withdrawn-address-uint256-}[`++Withdrawn(payee, weiAmount)++`]
- [.contract-subindex-inherited]
- .Ownable
- * {xref-Ownable-OwnershipTransferred-address-address-}[`++OwnershipTransferred(previousOwner, newOwner)++`]
- --
- [.contract-item]
- [[RefundEscrow-constructor-address-payable-]]
- ==== `[.contract-item-name]#++constructor++#++(address payable beneficiary_)++` [.item-kind]#public#
- Constructor.
- [.contract-item]
- [[RefundEscrow-state--]]
- ==== `[.contract-item-name]#++state++#++() → enum RefundEscrow.State++` [.item-kind]#public#
- [.contract-item]
- [[RefundEscrow-beneficiary--]]
- ==== `[.contract-item-name]#++beneficiary++#++() → address payable++` [.item-kind]#public#
- [.contract-item]
- [[RefundEscrow-deposit-address-]]
- ==== `[.contract-item-name]#++deposit++#++(address refundee)++` [.item-kind]#public#
- Stores funds that may later be refunded.
- [.contract-item]
- [[RefundEscrow-close--]]
- ==== `[.contract-item-name]#++close++#++()++` [.item-kind]#public#
- Allows for the beneficiary to withdraw their funds, rejecting
- further deposits.
- [.contract-item]
- [[RefundEscrow-enableRefunds--]]
- ==== `[.contract-item-name]#++enableRefunds++#++()++` [.item-kind]#public#
- Allows for refunds to take place, rejecting further deposits.
- [.contract-item]
- [[RefundEscrow-beneficiaryWithdraw--]]
- ==== `[.contract-item-name]#++beneficiaryWithdraw++#++()++` [.item-kind]#public#
- Withdraws the beneficiary's funds.
- [.contract-item]
- [[RefundEscrow-withdrawalAllowed-address-]]
- ==== `[.contract-item-name]#++withdrawalAllowed++#++(address) → bool++` [.item-kind]#public#
- Returns whether refundees can withdraw their deposits (be refunded). The overridden function receives a
- 'payee' argument, but we ignore it here since the condition is global, not per-payee.
- [.contract-item]
- [[RefundEscrow-RefundsClosed--]]
- ==== `[.contract-item-name]#++RefundsClosed++#++()++` [.item-kind]#event#
- [.contract-item]
- [[RefundEscrow-RefundsEnabled--]]
- ==== `[.contract-item-name]#++RefundsEnabled++#++()++` [.item-kind]#event#
- == Introspection
- This set of interfaces and contracts deal with https://en.wikipedia.org/wiki/Type_introspection[type introspection] of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_.
- Ethereum contracts have no native concept of an interface, so applications must usually simply trust they are not making an incorrect call. For trusted setups this is a non-issue, but often unknown and untrusted third-party addresses need to be interacted with. There may even not be any direct calls to them! (e.g. `ERC20` tokens may be sent to a contract that lacks a way to transfer them out of it, locking them forever). In these cases, a contract _declaring_ its interface can be very helpful in preventing errors.
- There are two main ways to approach this.
- * Locally, where a contract implements `IERC165` and declares an interface, and a second one queries it directly via `ERC165Checker`.
- * 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.
- 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.
- :supportsInterface: pass:normal[xref:#IERC165-supportsInterface-bytes4-[`++supportsInterface++`]]
- [.contract]
- [[IERC165]]
- === `++IERC165++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/introspection/IERC165.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
- ```
- Interface of the ERC165 standard, as defined in the
- https://eips.ethereum.org/EIPS/eip-165[EIP].
- Implementers can declare support of contract interfaces, which can then be
- queried by others ({ERC165Checker}).
- For an implementation, see {ERC165}.
- [.contract-index]
- .Functions
- --
- * {xref-IERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
- --
- [.contract-item]
- [[IERC165-supportsInterface-bytes4-]]
- ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#external#
- Returns true if this contract implements the interface defined by
- `interfaceId`. See the corresponding
- https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
- to learn more about how these ids are created.
- This function call must use less than 30 000 gas.
- :supportsInterface: pass:normal[xref:#ERC165-supportsInterface-bytes4-[`++supportsInterface++`]]
- [.contract]
- [[ERC165]]
- === `++ERC165++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/introspection/ERC165.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
- ```
- Implementation of the {IERC165} interface.
- Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
- for the additional interface id that will be supported. For example:
- ```solidity
- function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
- return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
- }
- ```
- Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
- [.contract-index]
- .Functions
- --
- * {xref-ERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
- [.contract-subindex-inherited]
- .IERC165
- --
- [.contract-item]
- [[ERC165-supportsInterface-bytes4-]]
- ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#public#
- See {IERC165-supportsInterface}.
- :supportsInterface: pass:normal[xref:#ERC165Storage-supportsInterface-bytes4-[`++supportsInterface++`]]
- :_registerInterface: pass:normal[xref:#ERC165Storage-_registerInterface-bytes4-[`++_registerInterface++`]]
- [.contract]
- [[ERC165Storage]]
- === `++ERC165Storage++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/introspection/ERC165Storage.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
- ```
- Storage based implementation of the {IERC165} interface.
- Contracts may inherit from this and call {_registerInterface} to declare
- their support of an interface.
- [.contract-index]
- .Functions
- --
- * {xref-ERC165Storage-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
- * {xref-ERC165Storage-_registerInterface-bytes4-}[`++_registerInterface(interfaceId)++`]
- [.contract-subindex-inherited]
- .ERC165
- [.contract-subindex-inherited]
- .IERC165
- --
- [.contract-item]
- [[ERC165Storage-supportsInterface-bytes4-]]
- ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#public#
- See {IERC165-supportsInterface}.
- [.contract-item]
- [[ERC165Storage-_registerInterface-bytes4-]]
- ==== `[.contract-item-name]#++_registerInterface++#++(bytes4 interfaceId)++` [.item-kind]#internal#
- Registers the contract as an implementer of the interface defined by
- `interfaceId`. Support of the actual ERC165 interface is automatic and
- registering its interface id is not required.
- See {IERC165-supportsInterface}.
- Requirements:
- - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
- :supportsERC165: pass:normal[xref:#ERC165Checker-supportsERC165-address-[`++supportsERC165++`]]
- :supportsInterface: pass:normal[xref:#ERC165Checker-supportsInterface-address-bytes4-[`++supportsInterface++`]]
- :getSupportedInterfaces: pass:normal[xref:#ERC165Checker-getSupportedInterfaces-address-bytes4---[`++getSupportedInterfaces++`]]
- :supportsAllInterfaces: pass:normal[xref:#ERC165Checker-supportsAllInterfaces-address-bytes4---[`++supportsAllInterfaces++`]]
- :supportsERC165InterfaceUnchecked: pass:normal[xref:#ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-[`++supportsERC165InterfaceUnchecked++`]]
- [.contract]
- [[ERC165Checker]]
- === `++ERC165Checker++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/introspection/ERC165Checker.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
- ```
- Library used to query support of an interface declared via {IERC165}.
- Note that these functions return the actual result of the query: they do not
- `revert` if an interface is not supported. It is up to the caller to decide
- what to do in these cases.
- [.contract-index]
- .Functions
- --
- * {xref-ERC165Checker-supportsERC165-address-}[`++supportsERC165(account)++`]
- * {xref-ERC165Checker-supportsInterface-address-bytes4-}[`++supportsInterface(account, interfaceId)++`]
- * {xref-ERC165Checker-getSupportedInterfaces-address-bytes4---}[`++getSupportedInterfaces(account, interfaceIds)++`]
- * {xref-ERC165Checker-supportsAllInterfaces-address-bytes4---}[`++supportsAllInterfaces(account, interfaceIds)++`]
- * {xref-ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-}[`++supportsERC165InterfaceUnchecked(account, interfaceId)++`]
- --
- [.contract-item]
- [[ERC165Checker-supportsERC165-address-]]
- ==== `[.contract-item-name]#++supportsERC165++#++(address account) → bool++` [.item-kind]#internal#
- Returns true if `account` supports the {IERC165} interface.
- [.contract-item]
- [[ERC165Checker-supportsInterface-address-bytes4-]]
- ==== `[.contract-item-name]#++supportsInterface++#++(address account, bytes4 interfaceId) → bool++` [.item-kind]#internal#
- Returns true if `account` supports the interface defined by
- `interfaceId`. Support for {IERC165} itself is queried automatically.
- See {IERC165-supportsInterface}.
- [.contract-item]
- [[ERC165Checker-getSupportedInterfaces-address-bytes4---]]
- ==== `[.contract-item-name]#++getSupportedInterfaces++#++(address account, bytes4[] interfaceIds) → bool[]++` [.item-kind]#internal#
- Returns a boolean array where each value corresponds to the
- interfaces passed in and whether they're supported or not. This allows
- you to batch check interfaces for a contract where your expectation
- is that some interfaces may not be supported.
- See {IERC165-supportsInterface}.
- _Available since v3.4._
- [.contract-item]
- [[ERC165Checker-supportsAllInterfaces-address-bytes4---]]
- ==== `[.contract-item-name]#++supportsAllInterfaces++#++(address account, bytes4[] interfaceIds) → bool++` [.item-kind]#internal#
- Returns true if `account` supports all the interfaces defined in
- `interfaceIds`. Support for {IERC165} itself is queried automatically.
- Batch-querying can lead to gas savings by skipping repeated checks for
- {IERC165} support.
- See {IERC165-supportsInterface}.
- [.contract-item]
- [[ERC165Checker-supportsERC165InterfaceUnchecked-address-bytes4-]]
- ==== `[.contract-item-name]#++supportsERC165InterfaceUnchecked++#++(address account, bytes4 interfaceId) → bool++` [.item-kind]#internal#
- Assumes that account contains a contract that supports ERC165, otherwise
- the behavior of this method is undefined. This precondition can be checked
- with {supportsERC165}.
- Some precompiled contracts will falsely indicate support for a given interface, so caution
- should be exercised when using this function.
- Interface identification is specified in ERC-165.
- :InterfaceImplementerSet: pass:normal[xref:#IERC1820Registry-InterfaceImplementerSet-address-bytes32-address-[`++InterfaceImplementerSet++`]]
- :ManagerChanged: pass:normal[xref:#IERC1820Registry-ManagerChanged-address-address-[`++ManagerChanged++`]]
- :setManager: pass:normal[xref:#IERC1820Registry-setManager-address-address-[`++setManager++`]]
- :getManager: pass:normal[xref:#IERC1820Registry-getManager-address-[`++getManager++`]]
- :setInterfaceImplementer: pass:normal[xref:#IERC1820Registry-setInterfaceImplementer-address-bytes32-address-[`++setInterfaceImplementer++`]]
- :getInterfaceImplementer: pass:normal[xref:#IERC1820Registry-getInterfaceImplementer-address-bytes32-[`++getInterfaceImplementer++`]]
- :interfaceHash: pass:normal[xref:#IERC1820Registry-interfaceHash-string-[`++interfaceHash++`]]
- :updateERC165Cache: pass:normal[xref:#IERC1820Registry-updateERC165Cache-address-bytes4-[`++updateERC165Cache++`]]
- :implementsERC165Interface: pass:normal[xref:#IERC1820Registry-implementsERC165Interface-address-bytes4-[`++implementsERC165Interface++`]]
- :implementsERC165InterfaceNoCache: pass:normal[xref:#IERC1820Registry-implementsERC165InterfaceNoCache-address-bytes4-[`++implementsERC165InterfaceNoCache++`]]
- [.contract]
- [[IERC1820Registry]]
- === `++IERC1820Registry++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/introspection/IERC1820Registry.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/IERC1820Registry.sol";
- ```
- Interface of the global ERC1820 Registry, as defined in the
- https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register
- implementers for interfaces in this registry, as well as query support.
- Implementers may be shared by multiple accounts, and can also implement more
- than a single interface for each account. Contracts can implement interfaces
- for themselves, but externally-owned accounts (EOA) must delegate this to a
- contract.
- {IERC165} interfaces can also be queried via the registry.
- For an in-depth explanation and source code analysis, see the EIP text.
- [.contract-index]
- .Functions
- --
- * {xref-IERC1820Registry-setManager-address-address-}[`++setManager(account, newManager)++`]
- * {xref-IERC1820Registry-getManager-address-}[`++getManager(account)++`]
- * {xref-IERC1820Registry-setInterfaceImplementer-address-bytes32-address-}[`++setInterfaceImplementer(account, _interfaceHash, implementer)++`]
- * {xref-IERC1820Registry-getInterfaceImplementer-address-bytes32-}[`++getInterfaceImplementer(account, _interfaceHash)++`]
- * {xref-IERC1820Registry-interfaceHash-string-}[`++interfaceHash(interfaceName)++`]
- * {xref-IERC1820Registry-updateERC165Cache-address-bytes4-}[`++updateERC165Cache(account, interfaceId)++`]
- * {xref-IERC1820Registry-implementsERC165Interface-address-bytes4-}[`++implementsERC165Interface(account, interfaceId)++`]
- * {xref-IERC1820Registry-implementsERC165InterfaceNoCache-address-bytes4-}[`++implementsERC165InterfaceNoCache(account, interfaceId)++`]
- --
- [.contract-index]
- .Events
- --
- * {xref-IERC1820Registry-InterfaceImplementerSet-address-bytes32-address-}[`++InterfaceImplementerSet(account, interfaceHash, implementer)++`]
- * {xref-IERC1820Registry-ManagerChanged-address-address-}[`++ManagerChanged(account, newManager)++`]
- --
- [.contract-item]
- [[IERC1820Registry-setManager-address-address-]]
- ==== `[.contract-item-name]#++setManager++#++(address account, address newManager)++` [.item-kind]#external#
- Sets `newManager` as the manager for `account`. A manager of an
- account is able to set interface implementers for it.
- By default, each account is its own manager. Passing a value of `0x0` in
- `newManager` will reset the manager to this initial state.
- Emits a {ManagerChanged} event.
- Requirements:
- - the caller must be the current manager for `account`.
- [.contract-item]
- [[IERC1820Registry-getManager-address-]]
- ==== `[.contract-item-name]#++getManager++#++(address account) → address++` [.item-kind]#external#
- Returns the manager for `account`.
- See {setManager}.
- [.contract-item]
- [[IERC1820Registry-setInterfaceImplementer-address-bytes32-address-]]
- ==== `[.contract-item-name]#++setInterfaceImplementer++#++(address account, bytes32 _interfaceHash, address implementer)++` [.item-kind]#external#
- Sets the `implementer` contract as ``account``'s implementer for
- `interfaceHash`.
- `account` being the zero address is an alias for the caller's address.
- The zero address can also be used in `implementer` to remove an old one.
- See {interfaceHash} to learn how these are created.
- Emits an {InterfaceImplementerSet} event.
- Requirements:
- - the caller must be the current manager for `account`.
- - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not
- end in 28 zeroes).
- - `implementer` must implement {IERC1820Implementer} and return true when
- queried for support, unless `implementer` is the caller. See
- {IERC1820Implementer-canImplementInterfaceForAddress}.
- [.contract-item]
- [[IERC1820Registry-getInterfaceImplementer-address-bytes32-]]
- ==== `[.contract-item-name]#++getInterfaceImplementer++#++(address account, bytes32 _interfaceHash) → address++` [.item-kind]#external#
- Returns the implementer of `interfaceHash` for `account`. If no such
- implementer is registered, returns the zero address.
- If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28
- zeroes), `account` will be queried for support of it.
- `account` being the zero address is an alias for the caller's address.
- [.contract-item]
- [[IERC1820Registry-interfaceHash-string-]]
- ==== `[.contract-item-name]#++interfaceHash++#++(string interfaceName) → bytes32++` [.item-kind]#external#
- Returns the interface hash for an `interfaceName`, as defined in the
- corresponding
- https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].
- [.contract-item]
- [[IERC1820Registry-updateERC165Cache-address-bytes4-]]
- ==== `[.contract-item-name]#++updateERC165Cache++#++(address account, bytes4 interfaceId)++` [.item-kind]#external#
- [.contract-item]
- [[IERC1820Registry-implementsERC165Interface-address-bytes4-]]
- ==== `[.contract-item-name]#++implementsERC165Interface++#++(address account, bytes4 interfaceId) → bool++` [.item-kind]#external#
- [.contract-item]
- [[IERC1820Registry-implementsERC165InterfaceNoCache-address-bytes4-]]
- ==== `[.contract-item-name]#++implementsERC165InterfaceNoCache++#++(address account, bytes4 interfaceId) → bool++` [.item-kind]#external#
- [.contract-item]
- [[IERC1820Registry-InterfaceImplementerSet-address-bytes32-address-]]
- ==== `[.contract-item-name]#++InterfaceImplementerSet++#++(address indexed account, bytes32 indexed interfaceHash, address indexed implementer)++` [.item-kind]#event#
- [.contract-item]
- [[IERC1820Registry-ManagerChanged-address-address-]]
- ==== `[.contract-item-name]#++ManagerChanged++#++(address indexed account, address indexed newManager)++` [.item-kind]#event#
- :canImplementInterfaceForAddress: pass:normal[xref:#IERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-[`++canImplementInterfaceForAddress++`]]
- [.contract]
- [[IERC1820Implementer]]
- === `++IERC1820Implementer++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/introspection/IERC1820Implementer.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/IERC1820Implementer.sol";
- ```
- Interface for an ERC1820 implementer, as defined in the
- https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[EIP].
- Used by contracts that will be registered as implementers in the
- {IERC1820Registry}.
- [.contract-index]
- .Functions
- --
- * {xref-IERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-}[`++canImplementInterfaceForAddress(interfaceHash, account)++`]
- --
- [.contract-item]
- [[IERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-]]
- ==== `[.contract-item-name]#++canImplementInterfaceForAddress++#++(bytes32 interfaceHash, address account) → bytes32++` [.item-kind]#external#
- Returns a special value (`ERC1820_ACCEPT_MAGIC`) if this contract
- implements `interfaceHash` for `account`.
- See {IERC1820Registry-setInterfaceImplementer}.
- :canImplementInterfaceForAddress: pass:normal[xref:#ERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-[`++canImplementInterfaceForAddress++`]]
- :_registerInterfaceForAddress: pass:normal[xref:#ERC1820Implementer-_registerInterfaceForAddress-bytes32-address-[`++_registerInterfaceForAddress++`]]
- [.contract]
- [[ERC1820Implementer]]
- === `++ERC1820Implementer++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/introspection/ERC1820Implementer.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/introspection/ERC1820Implementer.sol";
- ```
- Implementation of the {IERC1820Implementer} interface.
- Contracts may inherit from this and call {_registerInterfaceForAddress} to
- declare their willingness to be implementers.
- {IERC1820Registry-setInterfaceImplementer} should then be called for the
- registration to be complete.
- CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.
- [.contract-index]
- .Functions
- --
- * {xref-ERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-}[`++canImplementInterfaceForAddress(interfaceHash, account)++`]
- * {xref-ERC1820Implementer-_registerInterfaceForAddress-bytes32-address-}[`++_registerInterfaceForAddress(interfaceHash, account)++`]
- [.contract-subindex-inherited]
- .IERC1820Implementer
- --
- [.contract-item]
- [[ERC1820Implementer-canImplementInterfaceForAddress-bytes32-address-]]
- ==== `[.contract-item-name]#++canImplementInterfaceForAddress++#++(bytes32 interfaceHash, address account) → bytes32++` [.item-kind]#public#
- See {IERC1820Implementer-canImplementInterfaceForAddress}.
- [.contract-item]
- [[ERC1820Implementer-_registerInterfaceForAddress-bytes32-address-]]
- ==== `[.contract-item-name]#++_registerInterfaceForAddress++#++(bytes32 interfaceHash, address account)++` [.item-kind]#internal#
- Declares the contract as willing to be an implementer of
- `interfaceHash` for `account`.
- See {IERC1820Registry-setInterfaceImplementer} and
- {IERC1820Registry-interfaceHash}.
- == Data Structures
- :BitMap: pass:normal[xref:#BitMaps-BitMap[`++BitMap++`]]
- :get: pass:normal[xref:#BitMaps-get-struct-BitMaps-BitMap-uint256-[`++get++`]]
- :setTo: pass:normal[xref:#BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-[`++setTo++`]]
- :set: pass:normal[xref:#BitMaps-set-struct-BitMaps-BitMap-uint256-[`++set++`]]
- :unset: pass:normal[xref:#BitMaps-unset-struct-BitMaps-BitMap-uint256-[`++unset++`]]
- [.contract]
- [[BitMaps]]
- === `++BitMaps++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/structs/BitMaps.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
- ```
- Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
- Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
- [.contract-index]
- .Functions
- --
- * {xref-BitMaps-get-struct-BitMaps-BitMap-uint256-}[`++get(bitmap, index)++`]
- * {xref-BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-}[`++setTo(bitmap, index, value)++`]
- * {xref-BitMaps-set-struct-BitMaps-BitMap-uint256-}[`++set(bitmap, index)++`]
- * {xref-BitMaps-unset-struct-BitMaps-BitMap-uint256-}[`++unset(bitmap, index)++`]
- --
- [.contract-item]
- [[BitMaps-get-struct-BitMaps-BitMap-uint256-]]
- ==== `[.contract-item-name]#++get++#++(struct BitMaps.BitMap bitmap, uint256 index) → bool++` [.item-kind]#internal#
- Returns whether the bit at `index` is set.
- [.contract-item]
- [[BitMaps-setTo-struct-BitMaps-BitMap-uint256-bool-]]
- ==== `[.contract-item-name]#++setTo++#++(struct BitMaps.BitMap bitmap, uint256 index, bool value)++` [.item-kind]#internal#
- Sets the bit at `index` to the boolean `value`.
- [.contract-item]
- [[BitMaps-set-struct-BitMaps-BitMap-uint256-]]
- ==== `[.contract-item-name]#++set++#++(struct BitMaps.BitMap bitmap, uint256 index)++` [.item-kind]#internal#
- Sets the bit at `index`.
- [.contract-item]
- [[BitMaps-unset-struct-BitMaps-BitMap-uint256-]]
- ==== `[.contract-item-name]#++unset++#++(struct BitMaps.BitMap bitmap, uint256 index)++` [.item-kind]#internal#
- Unsets the bit at `index`.
- :Bytes32ToBytes32Map: pass:normal[xref:#EnumerableMap-Bytes32ToBytes32Map[`++Bytes32ToBytes32Map++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-[`++get++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-string-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-[`++keys++`]]
- :UintToUintMap: pass:normal[xref:#EnumerableMap-UintToUintMap[`++UintToUintMap++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-UintToUintMap-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-[`++get++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-string-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-[`++keys++`]]
- :UintToAddressMap: pass:normal[xref:#EnumerableMap-UintToAddressMap[`++UintToAddressMap++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-[`++get++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-string-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-[`++keys++`]]
- :AddressToUintMap: pass:normal[xref:#EnumerableMap-AddressToUintMap[`++AddressToUintMap++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-[`++get++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-string-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-[`++keys++`]]
- :Bytes32ToUintMap: pass:normal[xref:#EnumerableMap-Bytes32ToUintMap[`++Bytes32ToUintMap++`]]
- :set: pass:normal[xref:#EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-[`++set++`]]
- :remove: pass:normal[xref:#EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-[`++length++`]]
- :at: pass:normal[xref:#EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-[`++at++`]]
- :tryGet: pass:normal[xref:#EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++tryGet++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-[`++get++`]]
- :get: pass:normal[xref:#EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-string-[`++get++`]]
- :keys: pass:normal[xref:#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-[`++keys++`]]
- [.contract]
- [[EnumerableMap]]
- === `++EnumerableMap++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/structs/EnumerableMap.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
- ```
- Library for managing an enumerable variant of Solidity's
- https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
- type.
- Maps have the following properties:
- - Entries are added, removed, and checked for existence in constant time
- (O(1)).
- - Entries are enumerated in O(n). No guarantees are made on the ordering.
- ```solidity
- contract Example {
- // Add the library methods
- using EnumerableMap for EnumerableMap.UintToAddressMap;
- // Declare a set state variable
- EnumerableMap.UintToAddressMap private myMap;
- }
- ```
- The following map types are supported:
- - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
- - `address -> uint256` (`AddressToUintMap`) since v4.6.0
- - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
- - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
- - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
- [WARNING]
- ====
- Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
- unusable.
- See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
- In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
- array of EnumerableMap.
- ====
- [.contract-index]
- .Functions
- --
- * {xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-}[`++get(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-string-}[`++get(map, key, errorMessage)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-}[`++keys(map)++`]
- * {xref-EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-UintToUintMap-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-}[`++get(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-string-}[`++get(map, key, errorMessage)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-}[`++keys(map)++`]
- * {xref-EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-}[`++get(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-string-}[`++get(map, key, errorMessage)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-}[`++keys(map)++`]
- * {xref-EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-}[`++get(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-string-}[`++get(map, key, errorMessage)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-}[`++keys(map)++`]
- * {xref-EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-}[`++set(map, key, value)++`]
- * {xref-EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++remove(map, key)++`]
- * {xref-EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++contains(map, key)++`]
- * {xref-EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-}[`++length(map)++`]
- * {xref-EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-}[`++at(map, index)++`]
- * {xref-EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++tryGet(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-}[`++get(map, key)++`]
- * {xref-EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-string-}[`++get(map, key, errorMessage)++`]
- * {xref-EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-}[`++keys(map)++`]
- --
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key, bytes32 value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool++` [.item-kind]#internal#
- Removes a key-value pair from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-Bytes32ToBytes32Map-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.Bytes32ToBytes32Map map) → uint256++` [.item-kind]#internal#
- Returns the number of key-value pairs in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-Bytes32ToBytes32Map-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.Bytes32ToBytes32Map map, uint256 index) → bytes32, bytes32++` [.item-kind]#internal#
- Returns the key-value pair stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of entries inside the
- array, and it may change when more entries are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bool, bytes32++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key) → bytes32++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-Bytes32ToBytes32Map-bytes32-string-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.Bytes32ToBytes32Map map, bytes32 key, string errorMessage) → bytes32++` [.item-kind]#internal#
- Same as {get}, with a custom error message when `key` is not in the map.
- CAUTION: This function is deprecated because it requires allocating memory for the error
- message unnecessarily. For custom revert reasons use {tryGet}.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-Bytes32ToBytes32Map-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.Bytes32ToBytes32Map map) → bytes32[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-UintToUintMap-uint256-uint256-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.UintToUintMap map, uint256 key, uint256 value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool++` [.item-kind]#internal#
- Removes a value from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-UintToUintMap-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.UintToUintMap map) → uint256++` [.item-kind]#internal#
- Returns the number of elements in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.UintToUintMap map, uint256 index) → uint256, uint256++` [.item-kind]#internal#
- Returns the element stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → bool, uint256++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.UintToUintMap map, uint256 key) → uint256++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-UintToUintMap-uint256-string-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.UintToUintMap map, uint256 key, string errorMessage) → uint256++` [.item-kind]#internal#
- Same as {get}, with a custom error message when `key` is not in the map.
- CAUTION: This function is deprecated because it requires allocating memory for the error
- message unnecessarily. For custom revert reasons use {tryGet}.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-UintToUintMap-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.UintToUintMap map) → uint256[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-UintToAddressMap-uint256-address-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.UintToAddressMap map, uint256 key, address value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool++` [.item-kind]#internal#
- Removes a value from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-UintToAddressMap-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.UintToAddressMap map) → uint256++` [.item-kind]#internal#
- Returns the number of elements in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.UintToAddressMap map, uint256 index) → uint256, address++` [.item-kind]#internal#
- Returns the element stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → bool, address++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.UintToAddressMap map, uint256 key) → address++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-UintToAddressMap-uint256-string-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.UintToAddressMap map, uint256 key, string errorMessage) → address++` [.item-kind]#internal#
- Same as {get}, with a custom error message when `key` is not in the map.
- CAUTION: This function is deprecated because it requires allocating memory for the error
- message unnecessarily. For custom revert reasons use {tryGet}.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-UintToAddressMap-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.UintToAddressMap map) → uint256[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-AddressToUintMap-address-uint256-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.AddressToUintMap map, address key, uint256 value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-AddressToUintMap-address-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool++` [.item-kind]#internal#
- Removes a value from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-AddressToUintMap-address-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-AddressToUintMap-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.AddressToUintMap map) → uint256++` [.item-kind]#internal#
- Returns the number of elements in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-AddressToUintMap-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.AddressToUintMap map, uint256 index) → address, uint256++` [.item-kind]#internal#
- Returns the element stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-AddressToUintMap-address-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.AddressToUintMap map, address key) → bool, uint256++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.AddressToUintMap map, address key) → uint256++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-AddressToUintMap-address-string-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.AddressToUintMap map, address key, string errorMessage) → uint256++` [.item-kind]#internal#
- Same as {get}, with a custom error message when `key` is not in the map.
- CAUTION: This function is deprecated because it requires allocating memory for the error
- message unnecessarily. For custom revert reasons use {tryGet}.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-AddressToUintMap-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.AddressToUintMap map) → address[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableMap-set-struct-EnumerableMap-Bytes32ToUintMap-bytes32-uint256-]]
- ==== `[.contract-item-name]#++set++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key, uint256 value) → bool++` [.item-kind]#internal#
- Adds a key-value pair to a map, or updates the value for an existing
- key. O(1).
- Returns true if the key was added to the map, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableMap-remove-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool++` [.item-kind]#internal#
- Removes a value from a map. O(1).
- Returns true if the key was removed from the map, that is if it was present.
- [.contract-item]
- [[EnumerableMap-contains-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool++` [.item-kind]#internal#
- Returns true if the key is in the map. O(1).
- [.contract-item]
- [[EnumerableMap-length-struct-EnumerableMap-Bytes32ToUintMap-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableMap.Bytes32ToUintMap map) → uint256++` [.item-kind]#internal#
- Returns the number of elements in the map. O(1).
- [.contract-item]
- [[EnumerableMap-at-struct-EnumerableMap-Bytes32ToUintMap-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableMap.Bytes32ToUintMap map, uint256 index) → bytes32, uint256++` [.item-kind]#internal#
- Returns the element stored at position `index` in the map. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableMap-tryGet-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
- ==== `[.contract-item-name]#++tryGet++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → bool, uint256++` [.item-kind]#internal#
- Tries to returns the value associated with `key`. O(1).
- Does not revert if `key` is not in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key) → uint256++` [.item-kind]#internal#
- Returns the value associated with `key`. O(1).
- Requirements:
- - `key` must be in the map.
- [.contract-item]
- [[EnumerableMap-get-struct-EnumerableMap-Bytes32ToUintMap-bytes32-string-]]
- ==== `[.contract-item-name]#++get++#++(struct EnumerableMap.Bytes32ToUintMap map, bytes32 key, string errorMessage) → uint256++` [.item-kind]#internal#
- Same as {get}, with a custom error message when `key` is not in the map.
- CAUTION: This function is deprecated because it requires allocating memory for the error
- message unnecessarily. For custom revert reasons use {tryGet}.
- [.contract-item]
- [[EnumerableMap-keys-struct-EnumerableMap-Bytes32ToUintMap-]]
- ==== `[.contract-item-name]#++keys++#++(struct EnumerableMap.Bytes32ToUintMap map) → bytes32[]++` [.item-kind]#internal#
- Return the an array containing all the keys
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
- :Set: pass:normal[xref:#EnumerableSet-Set[`++Set++`]]
- :Bytes32Set: pass:normal[xref:#EnumerableSet-Bytes32Set[`++Bytes32Set++`]]
- :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-[`++add++`]]
- :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-Bytes32Set-[`++length++`]]
- :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-[`++at++`]]
- :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-Bytes32Set-[`++values++`]]
- :AddressSet: pass:normal[xref:#EnumerableSet-AddressSet[`++AddressSet++`]]
- :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-AddressSet-address-[`++add++`]]
- :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-AddressSet-[`++length++`]]
- :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-[`++at++`]]
- :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-AddressSet-[`++values++`]]
- :UintSet: pass:normal[xref:#EnumerableSet-UintSet[`++UintSet++`]]
- :add: pass:normal[xref:#EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-[`++add++`]]
- :remove: pass:normal[xref:#EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-[`++remove++`]]
- :contains: pass:normal[xref:#EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-[`++contains++`]]
- :length: pass:normal[xref:#EnumerableSet-length-struct-EnumerableSet-UintSet-[`++length++`]]
- :at: pass:normal[xref:#EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-[`++at++`]]
- :values: pass:normal[xref:#EnumerableSet-values-struct-EnumerableSet-UintSet-[`++values++`]]
- [.contract]
- [[EnumerableSet]]
- === `++EnumerableSet++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/structs/EnumerableSet.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
- ```
- Library for managing
- https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
- types.
- Sets have the following properties:
- - Elements are added, removed, and checked for existence in constant time
- (O(1)).
- - Elements are enumerated in O(n). No guarantees are made on the ordering.
- ```solidity
- contract Example {
- // Add the library methods
- using EnumerableSet for EnumerableSet.AddressSet;
- // Declare a set state variable
- EnumerableSet.AddressSet private mySet;
- }
- ```
- As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
- and `uint256` (`UintSet`) are supported.
- [WARNING]
- ====
- Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
- unusable.
- See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
- In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
- array of EnumerableSet.
- ====
- [.contract-index]
- .Functions
- --
- * {xref-EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-}[`++add(set, value)++`]
- * {xref-EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-}[`++remove(set, value)++`]
- * {xref-EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-}[`++contains(set, value)++`]
- * {xref-EnumerableSet-length-struct-EnumerableSet-Bytes32Set-}[`++length(set)++`]
- * {xref-EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-}[`++at(set, index)++`]
- * {xref-EnumerableSet-values-struct-EnumerableSet-Bytes32Set-}[`++values(set)++`]
- * {xref-EnumerableSet-add-struct-EnumerableSet-AddressSet-address-}[`++add(set, value)++`]
- * {xref-EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-}[`++remove(set, value)++`]
- * {xref-EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-}[`++contains(set, value)++`]
- * {xref-EnumerableSet-length-struct-EnumerableSet-AddressSet-}[`++length(set)++`]
- * {xref-EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-}[`++at(set, index)++`]
- * {xref-EnumerableSet-values-struct-EnumerableSet-AddressSet-}[`++values(set)++`]
- * {xref-EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-}[`++add(set, value)++`]
- * {xref-EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-}[`++remove(set, value)++`]
- * {xref-EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-}[`++contains(set, value)++`]
- * {xref-EnumerableSet-length-struct-EnumerableSet-UintSet-}[`++length(set)++`]
- * {xref-EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-}[`++at(set, index)++`]
- * {xref-EnumerableSet-values-struct-EnumerableSet-UintSet-}[`++values(set)++`]
- --
- [.contract-item]
- [[EnumerableSet-add-struct-EnumerableSet-Bytes32Set-bytes32-]]
- ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
- Add a value to a set. O(1).
- Returns true if the value was added to the set, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableSet-remove-struct-EnumerableSet-Bytes32Set-bytes32-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
- Removes a value from a set. O(1).
- Returns true if the value was removed from the set, that is if it was
- present.
- [.contract-item]
- [[EnumerableSet-contains-struct-EnumerableSet-Bytes32Set-bytes32-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.Bytes32Set set, bytes32 value) → bool++` [.item-kind]#internal#
- Returns true if the value is in the set. O(1).
- [.contract-item]
- [[EnumerableSet-length-struct-EnumerableSet-Bytes32Set-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.Bytes32Set set) → uint256++` [.item-kind]#internal#
- Returns the number of values in the set. O(1).
- [.contract-item]
- [[EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.Bytes32Set set, uint256 index) → bytes32++` [.item-kind]#internal#
- Returns the value stored at position `index` in the set. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableSet-values-struct-EnumerableSet-Bytes32Set-]]
- ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.Bytes32Set set) → bytes32[]++` [.item-kind]#internal#
- Return the entire set in an array
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableSet-add-struct-EnumerableSet-AddressSet-address-]]
- ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
- Add a value to a set. O(1).
- Returns true if the value was added to the set, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
- Removes a value from a set. O(1).
- Returns true if the value was removed from the set, that is if it was
- present.
- [.contract-item]
- [[EnumerableSet-contains-struct-EnumerableSet-AddressSet-address-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.AddressSet set, address value) → bool++` [.item-kind]#internal#
- Returns true if the value is in the set. O(1).
- [.contract-item]
- [[EnumerableSet-length-struct-EnumerableSet-AddressSet-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.AddressSet set) → uint256++` [.item-kind]#internal#
- Returns the number of values in the set. O(1).
- [.contract-item]
- [[EnumerableSet-at-struct-EnumerableSet-AddressSet-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.AddressSet set, uint256 index) → address++` [.item-kind]#internal#
- Returns the value stored at position `index` in the set. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableSet-values-struct-EnumerableSet-AddressSet-]]
- ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.AddressSet set) → address[]++` [.item-kind]#internal#
- Return the entire set in an array
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- [.contract-item]
- [[EnumerableSet-add-struct-EnumerableSet-UintSet-uint256-]]
- ==== `[.contract-item-name]#++add++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
- Add a value to a set. O(1).
- Returns true if the value was added to the set, that is if it was not
- already present.
- [.contract-item]
- [[EnumerableSet-remove-struct-EnumerableSet-UintSet-uint256-]]
- ==== `[.contract-item-name]#++remove++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
- Removes a value from a set. O(1).
- Returns true if the value was removed from the set, that is if it was
- present.
- [.contract-item]
- [[EnumerableSet-contains-struct-EnumerableSet-UintSet-uint256-]]
- ==== `[.contract-item-name]#++contains++#++(struct EnumerableSet.UintSet set, uint256 value) → bool++` [.item-kind]#internal#
- Returns true if the value is in the set. O(1).
- [.contract-item]
- [[EnumerableSet-length-struct-EnumerableSet-UintSet-]]
- ==== `[.contract-item-name]#++length++#++(struct EnumerableSet.UintSet set) → uint256++` [.item-kind]#internal#
- Returns the number of values in the set. O(1).
- [.contract-item]
- [[EnumerableSet-at-struct-EnumerableSet-UintSet-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct EnumerableSet.UintSet set, uint256 index) → uint256++` [.item-kind]#internal#
- Returns the value stored at position `index` in the set. O(1).
- Note that there are no guarantees on the ordering of values inside the
- array, and it may change when more values are added or removed.
- Requirements:
- - `index` must be strictly less than {length}.
- [.contract-item]
- [[EnumerableSet-values-struct-EnumerableSet-UintSet-]]
- ==== `[.contract-item-name]#++values++#++(struct EnumerableSet.UintSet set) → uint256[]++` [.item-kind]#internal#
- Return the entire set in an array
- WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- this function has an unbounded cost, and using it as part of a state-changing function may render the function
- uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- :Empty: pass:normal[xref:#DoubleEndedQueue-Empty--[`++Empty++`]]
- :OutOfBounds: pass:normal[xref:#DoubleEndedQueue-OutOfBounds--[`++OutOfBounds++`]]
- :Bytes32Deque: pass:normal[xref:#DoubleEndedQueue-Bytes32Deque[`++Bytes32Deque++`]]
- :pushBack: pass:normal[xref:#DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-[`++pushBack++`]]
- :popBack: pass:normal[xref:#DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-[`++popBack++`]]
- :pushFront: pass:normal[xref:#DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-[`++pushFront++`]]
- :popFront: pass:normal[xref:#DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-[`++popFront++`]]
- :front: pass:normal[xref:#DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-[`++front++`]]
- :back: pass:normal[xref:#DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-[`++back++`]]
- :at: pass:normal[xref:#DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-[`++at++`]]
- :clear: pass:normal[xref:#DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-[`++clear++`]]
- :length: pass:normal[xref:#DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-[`++length++`]]
- :empty: pass:normal[xref:#DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-[`++empty++`]]
- [.contract]
- [[DoubleEndedQueue]]
- === `++DoubleEndedQueue++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/structs/DoubleEndedQueue.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/structs/DoubleEndedQueue.sol";
- ```
- A sequence of items with the ability to efficiently push and pop items (i.e. insert and remove) on both ends of
- the sequence (called front and back). Among other access patterns, it can be used to implement efficient LIFO and
- FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that
- the existing queue contents are left in storage.
- The struct is called `Bytes32Deque`. Other types can be cast to and from `bytes32`. This data structure can only be
- used in storage, and not in memory.
- ```solidity
- DoubleEndedQueue.Bytes32Deque queue;
- ```
- _Available since v4.6._
- [.contract-index]
- .Functions
- --
- * {xref-DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-}[`++pushBack(deque, value)++`]
- * {xref-DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-}[`++popBack(deque)++`]
- * {xref-DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-}[`++pushFront(deque, value)++`]
- * {xref-DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-}[`++popFront(deque)++`]
- * {xref-DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-}[`++front(deque)++`]
- * {xref-DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-}[`++back(deque)++`]
- * {xref-DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-}[`++at(deque, index)++`]
- * {xref-DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-}[`++clear(deque)++`]
- * {xref-DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-}[`++length(deque)++`]
- * {xref-DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-}[`++empty(deque)++`]
- --
- [.contract-item]
- [[DoubleEndedQueue-pushBack-struct-DoubleEndedQueue-Bytes32Deque-bytes32-]]
- ==== `[.contract-item-name]#++pushBack++#++(struct DoubleEndedQueue.Bytes32Deque deque, bytes32 value)++` [.item-kind]#internal#
- Inserts an item at the end of the queue.
- [.contract-item]
- [[DoubleEndedQueue-popBack-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++popBack++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
- Removes the item at the end of the queue and returns it.
- Reverts with `Empty` if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-pushFront-struct-DoubleEndedQueue-Bytes32Deque-bytes32-]]
- ==== `[.contract-item-name]#++pushFront++#++(struct DoubleEndedQueue.Bytes32Deque deque, bytes32 value)++` [.item-kind]#internal#
- Inserts an item at the beginning of the queue.
- [.contract-item]
- [[DoubleEndedQueue-popFront-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++popFront++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
- Removes the item at the beginning of the queue and returns it.
- Reverts with `Empty` if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-front-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++front++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
- Returns the item at the beginning of the queue.
- Reverts with `Empty` if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-back-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++back++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bytes32 value++` [.item-kind]#internal#
- Returns the item at the end of the queue.
- Reverts with `Empty` if the queue is empty.
- [.contract-item]
- [[DoubleEndedQueue-at-struct-DoubleEndedQueue-Bytes32Deque-uint256-]]
- ==== `[.contract-item-name]#++at++#++(struct DoubleEndedQueue.Bytes32Deque deque, uint256 index) → bytes32 value++` [.item-kind]#internal#
- Return the item at a position in the queue given by `index`, with the first item at 0 and last item at
- `length(deque) - 1`.
- Reverts with `OutOfBounds` if the index is out of bounds.
- [.contract-item]
- [[DoubleEndedQueue-clear-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++clear++#++(struct DoubleEndedQueue.Bytes32Deque deque)++` [.item-kind]#internal#
- Resets the queue back to being empty.
- NOTE: The current items are left behind in storage. This does not affect the functioning of the queue, but misses
- out on potential gas refunds.
- [.contract-item]
- [[DoubleEndedQueue-length-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++length++#++(struct DoubleEndedQueue.Bytes32Deque deque) → uint256++` [.item-kind]#internal#
- Returns the number of items in the queue.
- [.contract-item]
- [[DoubleEndedQueue-empty-struct-DoubleEndedQueue-Bytes32Deque-]]
- ==== `[.contract-item-name]#++empty++#++(struct DoubleEndedQueue.Bytes32Deque deque) → bool++` [.item-kind]#internal#
- Returns true if the queue is empty.
- :History: pass:normal[xref:#Checkpoints-History[`++History++`]]
- :Checkpoint: pass:normal[xref:#Checkpoints-Checkpoint[`++Checkpoint++`]]
- :getAtBlock: pass:normal[xref:#Checkpoints-getAtBlock-struct-Checkpoints-History-uint256-[`++getAtBlock++`]]
- :getAtProbablyRecentBlock: pass:normal[xref:#Checkpoints-getAtProbablyRecentBlock-struct-Checkpoints-History-uint256-[`++getAtProbablyRecentBlock++`]]
- :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-History-uint256-[`++push++`]]
- :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-History-function--uint256-uint256--view-returns--uint256--uint256-[`++push++`]]
- :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-History-[`++latest++`]]
- :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-History-[`++latestCheckpoint++`]]
- :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-History-[`++length++`]]
- :Trace224: pass:normal[xref:#Checkpoints-Trace224[`++Trace224++`]]
- :Checkpoint224: pass:normal[xref:#Checkpoints-Checkpoint224[`++Checkpoint224++`]]
- :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-[`++push++`]]
- :lowerLookup: pass:normal[xref:#Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-[`++lowerLookup++`]]
- :upperLookup: pass:normal[xref:#Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-[`++upperLookup++`]]
- :upperLookupRecent: pass:normal[xref:#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-[`++upperLookupRecent++`]]
- :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-Trace224-[`++latest++`]]
- :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-[`++latestCheckpoint++`]]
- :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-Trace224-[`++length++`]]
- :Trace160: pass:normal[xref:#Checkpoints-Trace160[`++Trace160++`]]
- :Checkpoint160: pass:normal[xref:#Checkpoints-Checkpoint160[`++Checkpoint160++`]]
- :push: pass:normal[xref:#Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-[`++push++`]]
- :lowerLookup: pass:normal[xref:#Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-[`++lowerLookup++`]]
- :upperLookup: pass:normal[xref:#Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-[`++upperLookup++`]]
- :upperLookupRecent: pass:normal[xref:#Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-[`++upperLookupRecent++`]]
- :latest: pass:normal[xref:#Checkpoints-latest-struct-Checkpoints-Trace160-[`++latest++`]]
- :latestCheckpoint: pass:normal[xref:#Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-[`++latestCheckpoint++`]]
- :length: pass:normal[xref:#Checkpoints-length-struct-Checkpoints-Trace160-[`++length++`]]
- [.contract]
- [[Checkpoints]]
- === `++Checkpoints++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/Checkpoints.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Checkpoints.sol";
- ```
- This library defines the `History` struct, for checkpointing values as they change at different points in
- time, and later looking up past values by block number. See {Votes} as an example.
- To create a history of checkpoints define a variable type `Checkpoints.History` in your contract, and store a new
- checkpoint for the current transaction block using the {push} function.
- _Available since v4.5._
- [.contract-index]
- .Functions
- --
- * {xref-Checkpoints-getAtBlock-struct-Checkpoints-History-uint256-}[`++getAtBlock(self, blockNumber)++`]
- * {xref-Checkpoints-getAtProbablyRecentBlock-struct-Checkpoints-History-uint256-}[`++getAtProbablyRecentBlock(self, blockNumber)++`]
- * {xref-Checkpoints-push-struct-Checkpoints-History-uint256-}[`++push(self, value)++`]
- * {xref-Checkpoints-push-struct-Checkpoints-History-function--uint256-uint256--view-returns--uint256--uint256-}[`++push(self, op, delta)++`]
- * {xref-Checkpoints-latest-struct-Checkpoints-History-}[`++latest(self)++`]
- * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-History-}[`++latestCheckpoint(self)++`]
- * {xref-Checkpoints-length-struct-Checkpoints-History-}[`++length(self)++`]
- * {xref-Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-}[`++push(self, key, value)++`]
- * {xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-}[`++lowerLookup(self, key)++`]
- * {xref-Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-}[`++upperLookup(self, key)++`]
- * {xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-}[`++upperLookupRecent(self, key)++`]
- * {xref-Checkpoints-latest-struct-Checkpoints-Trace224-}[`++latest(self)++`]
- * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-}[`++latestCheckpoint(self)++`]
- * {xref-Checkpoints-length-struct-Checkpoints-Trace224-}[`++length(self)++`]
- * {xref-Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-}[`++push(self, key, value)++`]
- * {xref-Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-}[`++lowerLookup(self, key)++`]
- * {xref-Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-}[`++upperLookup(self, key)++`]
- * {xref-Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-}[`++upperLookupRecent(self, key)++`]
- * {xref-Checkpoints-latest-struct-Checkpoints-Trace160-}[`++latest(self)++`]
- * {xref-Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-}[`++latestCheckpoint(self)++`]
- * {xref-Checkpoints-length-struct-Checkpoints-Trace160-}[`++length(self)++`]
- --
- [.contract-item]
- [[Checkpoints-getAtBlock-struct-Checkpoints-History-uint256-]]
- ==== `[.contract-item-name]#++getAtBlock++#++(struct Checkpoints.History self, uint256 blockNumber) → uint256++` [.item-kind]#internal#
- Returns the value at a given block number. If a checkpoint is not available at that block, the closest one
- before it is returned, or zero otherwise. Because the number returned corresponds to that at the end of the
- block, the requested block number must be in the past, excluding the current block.
- [.contract-item]
- [[Checkpoints-getAtProbablyRecentBlock-struct-Checkpoints-History-uint256-]]
- ==== `[.contract-item-name]#++getAtProbablyRecentBlock++#++(struct Checkpoints.History self, uint256 blockNumber) → uint256++` [.item-kind]#internal#
- Returns the value at a given block number. If a checkpoint is not available at that block, the closest one
- before it is returned, or zero otherwise. Similar to {upperLookup} but optimized for the case when the searched
- checkpoint is probably "recent", defined as being among the last sqrt(N) checkpoints where N is the number of
- checkpoints.
- [.contract-item]
- [[Checkpoints-push-struct-Checkpoints-History-uint256-]]
- ==== `[.contract-item-name]#++push++#++(struct Checkpoints.History self, uint256 value) → uint256, uint256++` [.item-kind]#internal#
- Pushes a value onto a History so that it is stored as the checkpoint for the current block.
- Returns previous value and new value.
- [.contract-item]
- [[Checkpoints-push-struct-Checkpoints-History-function--uint256-uint256--view-returns--uint256--uint256-]]
- ==== `[.contract-item-name]#++push++#++(struct Checkpoints.History self, function (uint256,uint256) view returns (uint256) op, uint256 delta) → uint256, uint256++` [.item-kind]#internal#
- Pushes a value onto a History, by updating the latest value using binary operation `op`. The new value will
- be set to `op(latest, delta)`.
- Returns previous value and new value.
- [.contract-item]
- [[Checkpoints-latest-struct-Checkpoints-History-]]
- ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.History self) → uint224++` [.item-kind]#internal#
- Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
- [.contract-item]
- [[Checkpoints-latestCheckpoint-struct-Checkpoints-History-]]
- ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.History self) → bool exists, uint32 _blockNumber, uint224 _value++` [.item-kind]#internal#
- Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
- in the most recent checkpoint.
- [.contract-item]
- [[Checkpoints-length-struct-Checkpoints-History-]]
- ==== `[.contract-item-name]#++length++#++(struct Checkpoints.History self) → uint256++` [.item-kind]#internal#
- Returns the number of checkpoint.
- [.contract-item]
- [[Checkpoints-push-struct-Checkpoints-Trace224-uint32-uint224-]]
- ==== `[.contract-item-name]#++push++#++(struct Checkpoints.Trace224 self, uint32 key, uint224 value) → uint224, uint224++` [.item-kind]#internal#
- Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.
- Returns previous value and new value.
- [.contract-item]
- [[Checkpoints-lowerLookup-struct-Checkpoints-Trace224-uint32-]]
- ==== `[.contract-item-name]#++lowerLookup++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
- Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none.
- [.contract-item]
- [[Checkpoints-upperLookup-struct-Checkpoints-Trace224-uint32-]]
- ==== `[.contract-item-name]#++upperLookup++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.
- [.contract-item]
- [[Checkpoints-upperLookupRecent-struct-Checkpoints-Trace224-uint32-]]
- ==== `[.contract-item-name]#++upperLookupRecent++#++(struct Checkpoints.Trace224 self, uint32 key) → uint224++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.
- NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high keys).
- [.contract-item]
- [[Checkpoints-latest-struct-Checkpoints-Trace224-]]
- ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.Trace224 self) → uint224++` [.item-kind]#internal#
- Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
- [.contract-item]
- [[Checkpoints-latestCheckpoint-struct-Checkpoints-Trace224-]]
- ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.Trace224 self) → bool exists, uint32 _key, uint224 _value++` [.item-kind]#internal#
- Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
- in the most recent checkpoint.
- [.contract-item]
- [[Checkpoints-length-struct-Checkpoints-Trace224-]]
- ==== `[.contract-item-name]#++length++#++(struct Checkpoints.Trace224 self) → uint256++` [.item-kind]#internal#
- Returns the number of checkpoint.
- [.contract-item]
- [[Checkpoints-push-struct-Checkpoints-Trace160-uint96-uint160-]]
- ==== `[.contract-item-name]#++push++#++(struct Checkpoints.Trace160 self, uint96 key, uint160 value) → uint160, uint160++` [.item-kind]#internal#
- Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.
- Returns previous value and new value.
- [.contract-item]
- [[Checkpoints-lowerLookup-struct-Checkpoints-Trace160-uint96-]]
- ==== `[.contract-item-name]#++lowerLookup++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
- Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none.
- [.contract-item]
- [[Checkpoints-upperLookup-struct-Checkpoints-Trace160-uint96-]]
- ==== `[.contract-item-name]#++upperLookup++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.
- [.contract-item]
- [[Checkpoints-upperLookupRecent-struct-Checkpoints-Trace160-uint96-]]
- ==== `[.contract-item-name]#++upperLookupRecent++#++(struct Checkpoints.Trace160 self, uint96 key) → uint160++` [.item-kind]#internal#
- Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.
- NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high keys).
- [.contract-item]
- [[Checkpoints-latest-struct-Checkpoints-Trace160-]]
- ==== `[.contract-item-name]#++latest++#++(struct Checkpoints.Trace160 self) → uint160++` [.item-kind]#internal#
- Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
- [.contract-item]
- [[Checkpoints-latestCheckpoint-struct-Checkpoints-Trace160-]]
- ==== `[.contract-item-name]#++latestCheckpoint++#++(struct Checkpoints.Trace160 self) → bool exists, uint96 _key, uint160 _value++` [.item-kind]#internal#
- Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
- in the most recent checkpoint.
- [.contract-item]
- [[Checkpoints-length-struct-Checkpoints-Trace160-]]
- ==== `[.contract-item-name]#++length++#++(struct Checkpoints.Trace160 self) → uint256++` [.item-kind]#internal#
- Returns the number of checkpoint.
- == Libraries
- :deploy: pass:normal[xref:#Create2-deploy-uint256-bytes32-bytes-[`++deploy++`]]
- :computeAddress: pass:normal[xref:#Create2-computeAddress-bytes32-bytes32-[`++computeAddress++`]]
- :computeAddress: pass:normal[xref:#Create2-computeAddress-bytes32-bytes32-address-[`++computeAddress++`]]
- [.contract]
- [[Create2]]
- === `++Create2++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/Create2.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Create2.sol";
- ```
- Helper to make usage of the `CREATE2` EVM opcode easier and safer.
- `CREATE2` can be used to compute in advance the address where a smart
- contract will be deployed, which allows for interesting new mechanisms known
- as 'counterfactual interactions'.
- See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
- information.
- [.contract-index]
- .Functions
- --
- * {xref-Create2-deploy-uint256-bytes32-bytes-}[`++deploy(amount, salt, bytecode)++`]
- * {xref-Create2-computeAddress-bytes32-bytes32-}[`++computeAddress(salt, bytecodeHash)++`]
- * {xref-Create2-computeAddress-bytes32-bytes32-address-}[`++computeAddress(salt, bytecodeHash, deployer)++`]
- --
- [.contract-item]
- [[Create2-deploy-uint256-bytes32-bytes-]]
- ==== `[.contract-item-name]#++deploy++#++(uint256 amount, bytes32 salt, bytes bytecode) → address addr++` [.item-kind]#internal#
- Deploys a contract using `CREATE2`. The address where the contract
- will be deployed can be known in advance via {computeAddress}.
- The bytecode for a contract can be obtained from Solidity with
- `type(contractName).creationCode`.
- Requirements:
- - `bytecode` must not be empty.
- - `salt` must have not been used for `bytecode` already.
- - the factory must have a balance of at least `amount`.
- - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
- [.contract-item]
- [[Create2-computeAddress-bytes32-bytes32-]]
- ==== `[.contract-item-name]#++computeAddress++#++(bytes32 salt, bytes32 bytecodeHash) → address++` [.item-kind]#internal#
- Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
- `bytecodeHash` or `salt` will result in a new destination address.
- [.contract-item]
- [[Create2-computeAddress-bytes32-bytes32-address-]]
- ==== `[.contract-item-name]#++computeAddress++#++(bytes32 salt, bytes32 bytecodeHash, address deployer) → address addr++` [.item-kind]#internal#
- Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
- `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
- :isContract: pass:normal[xref:#Address-isContract-address-[`++isContract++`]]
- :sendValue: pass:normal[xref:#Address-sendValue-address-payable-uint256-[`++sendValue++`]]
- :functionCall: pass:normal[xref:#Address-functionCall-address-bytes-[`++functionCall++`]]
- :functionCall: pass:normal[xref:#Address-functionCall-address-bytes-string-[`++functionCall++`]]
- :functionCallWithValue: pass:normal[xref:#Address-functionCallWithValue-address-bytes-uint256-[`++functionCallWithValue++`]]
- :functionCallWithValue: pass:normal[xref:#Address-functionCallWithValue-address-bytes-uint256-string-[`++functionCallWithValue++`]]
- :functionStaticCall: pass:normal[xref:#Address-functionStaticCall-address-bytes-[`++functionStaticCall++`]]
- :functionStaticCall: pass:normal[xref:#Address-functionStaticCall-address-bytes-string-[`++functionStaticCall++`]]
- :functionDelegateCall: pass:normal[xref:#Address-functionDelegateCall-address-bytes-[`++functionDelegateCall++`]]
- :functionDelegateCall: pass:normal[xref:#Address-functionDelegateCall-address-bytes-string-[`++functionDelegateCall++`]]
- :verifyCallResultFromTarget: pass:normal[xref:#Address-verifyCallResultFromTarget-address-bool-bytes-string-[`++verifyCallResultFromTarget++`]]
- :verifyCallResult: pass:normal[xref:#Address-verifyCallResult-bool-bytes-string-[`++verifyCallResult++`]]
- [.contract]
- [[Address]]
- === `++Address++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/Address.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Address.sol";
- ```
- Collection of functions related to the address type
- [.contract-index]
- .Functions
- --
- * {xref-Address-isContract-address-}[`++isContract(account)++`]
- * {xref-Address-sendValue-address-payable-uint256-}[`++sendValue(recipient, amount)++`]
- * {xref-Address-functionCall-address-bytes-}[`++functionCall(target, data)++`]
- * {xref-Address-functionCall-address-bytes-string-}[`++functionCall(target, data, errorMessage)++`]
- * {xref-Address-functionCallWithValue-address-bytes-uint256-}[`++functionCallWithValue(target, data, value)++`]
- * {xref-Address-functionCallWithValue-address-bytes-uint256-string-}[`++functionCallWithValue(target, data, value, errorMessage)++`]
- * {xref-Address-functionStaticCall-address-bytes-}[`++functionStaticCall(target, data)++`]
- * {xref-Address-functionStaticCall-address-bytes-string-}[`++functionStaticCall(target, data, errorMessage)++`]
- * {xref-Address-functionDelegateCall-address-bytes-}[`++functionDelegateCall(target, data)++`]
- * {xref-Address-functionDelegateCall-address-bytes-string-}[`++functionDelegateCall(target, data, errorMessage)++`]
- * {xref-Address-verifyCallResultFromTarget-address-bool-bytes-string-}[`++verifyCallResultFromTarget(target, success, returndata, errorMessage)++`]
- * {xref-Address-verifyCallResult-bool-bytes-string-}[`++verifyCallResult(success, returndata, errorMessage)++`]
- --
- [.contract-item]
- [[Address-isContract-address-]]
- ==== `[.contract-item-name]#++isContract++#++(address account) → bool++` [.item-kind]#internal#
- Returns true if `account` is a contract.
- [IMPORTANT]
- ====
- It is unsafe to assume that an address for which this function returns
- false is an externally-owned account (EOA) and not a contract.
- Among others, `isContract` will return false for the following
- types of addresses:
- - an externally-owned account
- - a contract in construction
- - an address where a contract will be created
- - an address where a contract lived, but was destroyed
- Furthermore, `isContract` will also return true if the target contract within
- the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
- which only has an effect at the end of a transaction.
- ====
- [IMPORTANT]
- ====
- You shouldn't rely on `isContract` to protect against flash loan attacks!
- Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
- like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
- constructor.
- ====
- [.contract-item]
- [[Address-sendValue-address-payable-uint256-]]
- ==== `[.contract-item-name]#++sendValue++#++(address payable recipient, uint256 amount)++` [.item-kind]#internal#
- Replacement for Solidity's `transfer`: sends `amount` wei to
- `recipient`, forwarding all available gas and reverting on errors.
- https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
- of certain opcodes, possibly making contracts go over the 2300 gas limit
- imposed by `transfer`, making them unable to receive funds via
- `transfer`. {sendValue} removes this limitation.
- https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
- IMPORTANT: because control is transferred to `recipient`, care must be
- taken to not create reentrancy vulnerabilities. Consider using
- {ReentrancyGuard} or the
- https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
- [.contract-item]
- [[Address-functionCall-address-bytes-]]
- ==== `[.contract-item-name]#++functionCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
- Performs a Solidity function call using a low level `call`. A
- plain `call` is an unsafe replacement for a function call: use this
- function instead.
- If `target` reverts with a revert reason, it is bubbled up by this
- function (like regular Solidity function calls).
- Returns the raw returned data. To convert to the expected return value,
- use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
- Requirements:
- - `target` must be a contract.
- - calling `target` with `data` must not revert.
- _Available since v3.1._
- [.contract-item]
- [[Address-functionCall-address-bytes-string-]]
- ==== `[.contract-item-name]#++functionCall++#++(address target, bytes data, string errorMessage) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
- `errorMessage` as a fallback revert reason when `target` reverts.
- _Available since v3.1._
- [.contract-item]
- [[Address-functionCallWithValue-address-bytes-uint256-]]
- ==== `[.contract-item-name]#++functionCallWithValue++#++(address target, bytes data, uint256 value) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
- but also transferring `value` wei to `target`.
- Requirements:
- - the calling contract must have an ETH balance of at least `value`.
- - the called Solidity function must be `payable`.
- _Available since v3.1._
- [.contract-item]
- [[Address-functionCallWithValue-address-bytes-uint256-string-]]
- ==== `[.contract-item-name]#++functionCallWithValue++#++(address target, bytes data, uint256 value, string errorMessage) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
- with `errorMessage` as a fallback revert reason when `target` reverts.
- _Available since v3.1._
- [.contract-item]
- [[Address-functionStaticCall-address-bytes-]]
- ==== `[.contract-item-name]#++functionStaticCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
- but performing a static call.
- _Available since v3.3._
- [.contract-item]
- [[Address-functionStaticCall-address-bytes-string-]]
- ==== `[.contract-item-name]#++functionStaticCall++#++(address target, bytes data, string errorMessage) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
- but performing a static call.
- _Available since v3.3._
- [.contract-item]
- [[Address-functionDelegateCall-address-bytes-]]
- ==== `[.contract-item-name]#++functionDelegateCall++#++(address target, bytes data) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
- but performing a delegate call.
- _Available since v3.4._
- [.contract-item]
- [[Address-functionDelegateCall-address-bytes-string-]]
- ==== `[.contract-item-name]#++functionDelegateCall++#++(address target, bytes data, string errorMessage) → bytes++` [.item-kind]#internal#
- Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
- but performing a delegate call.
- _Available since v3.4._
- [.contract-item]
- [[Address-verifyCallResultFromTarget-address-bool-bytes-string-]]
- ==== `[.contract-item-name]#++verifyCallResultFromTarget++#++(address target, bool success, bytes returndata, string errorMessage) → bytes++` [.item-kind]#internal#
- Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
- the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
- _Available since v4.8._
- [.contract-item]
- [[Address-verifyCallResult-bool-bytes-string-]]
- ==== `[.contract-item-name]#++verifyCallResult++#++(bool success, bytes returndata, string errorMessage) → bytes++` [.item-kind]#internal#
- Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
- revert reason or using the provided one.
- _Available since v4.3._
- :findUpperBound: pass:normal[xref:#Arrays-findUpperBound-uint256---uint256-[`++findUpperBound++`]]
- :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-address---uint256-[`++unsafeAccess++`]]
- :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-bytes32---uint256-[`++unsafeAccess++`]]
- :unsafeAccess: pass:normal[xref:#Arrays-unsafeAccess-uint256---uint256-[`++unsafeAccess++`]]
- [.contract]
- [[Arrays]]
- === `++Arrays++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/Arrays.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Arrays.sol";
- ```
- Collection of functions related to array types.
- [.contract-index]
- .Functions
- --
- * {xref-Arrays-findUpperBound-uint256---uint256-}[`++findUpperBound(array, element)++`]
- * {xref-Arrays-unsafeAccess-address---uint256-}[`++unsafeAccess(arr, pos)++`]
- * {xref-Arrays-unsafeAccess-bytes32---uint256-}[`++unsafeAccess(arr, pos)++`]
- * {xref-Arrays-unsafeAccess-uint256---uint256-}[`++unsafeAccess(arr, pos)++`]
- --
- [.contract-item]
- [[Arrays-findUpperBound-uint256---uint256-]]
- ==== `[.contract-item-name]#++findUpperBound++#++(uint256[] array, uint256 element) → uint256++` [.item-kind]#internal#
- Searches a sorted `array` and returns the first index that contains
- a value greater or equal to `element`. If no such index exists (i.e. all
- values in the array are strictly less than `element`), the array length is
- returned. Time complexity O(log n).
- `array` is expected to be sorted in ascending order, and to contain no
- repeated elements.
- [.contract-item]
- [[Arrays-unsafeAccess-address---uint256-]]
- ==== `[.contract-item-name]#++unsafeAccess++#++(address[] arr, uint256 pos) → struct StorageSlot.AddressSlot++` [.item-kind]#internal#
- Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
- WARNING: Only use if you are certain `pos` is lower than the array length.
- [.contract-item]
- [[Arrays-unsafeAccess-bytes32---uint256-]]
- ==== `[.contract-item-name]#++unsafeAccess++#++(bytes32[] arr, uint256 pos) → struct StorageSlot.Bytes32Slot++` [.item-kind]#internal#
- Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
- WARNING: Only use if you are certain `pos` is lower than the array length.
- [.contract-item]
- [[Arrays-unsafeAccess-uint256---uint256-]]
- ==== `[.contract-item-name]#++unsafeAccess++#++(uint256[] arr, uint256 pos) → struct StorageSlot.Uint256Slot++` [.item-kind]#internal#
- Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
- WARNING: Only use if you are certain `pos` is lower than the array length.
- :_TABLE: pass:normal[xref:#Base64-_TABLE-string[`++_TABLE++`]]
- :encode: pass:normal[xref:#Base64-encode-bytes-[`++encode++`]]
- [.contract]
- [[Base64]]
- === `++Base64++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/Base64.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Base64.sol";
- ```
- Provides a set of functions to operate with Base64 strings.
- _Available since v4.5._
- [.contract-index]
- .Functions
- --
- * {xref-Base64-encode-bytes-}[`++encode(data)++`]
- --
- [.contract-item]
- [[Base64-encode-bytes-]]
- ==== `[.contract-item-name]#++encode++#++(bytes data) → string++` [.item-kind]#internal#
- Converts a `bytes` to its Bytes64 `string` representation.
- :Counter: pass:normal[xref:#Counters-Counter[`++Counter++`]]
- :current: pass:normal[xref:#Counters-current-struct-Counters-Counter-[`++current++`]]
- :increment: pass:normal[xref:#Counters-increment-struct-Counters-Counter-[`++increment++`]]
- :decrement: pass:normal[xref:#Counters-decrement-struct-Counters-Counter-[`++decrement++`]]
- :reset: pass:normal[xref:#Counters-reset-struct-Counters-Counter-[`++reset++`]]
- [.contract]
- [[Counters]]
- === `++Counters++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/Counters.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Counters.sol";
- ```
- Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
- of elements in a mapping, issuing ERC721 ids, or counting request ids.
- Include with `using Counters for Counters.Counter;`
- [.contract-index]
- .Functions
- --
- * {xref-Counters-current-struct-Counters-Counter-}[`++current(counter)++`]
- * {xref-Counters-increment-struct-Counters-Counter-}[`++increment(counter)++`]
- * {xref-Counters-decrement-struct-Counters-Counter-}[`++decrement(counter)++`]
- * {xref-Counters-reset-struct-Counters-Counter-}[`++reset(counter)++`]
- --
- [.contract-item]
- [[Counters-current-struct-Counters-Counter-]]
- ==== `[.contract-item-name]#++current++#++(struct Counters.Counter counter) → uint256++` [.item-kind]#internal#
- [.contract-item]
- [[Counters-increment-struct-Counters-Counter-]]
- ==== `[.contract-item-name]#++increment++#++(struct Counters.Counter counter)++` [.item-kind]#internal#
- [.contract-item]
- [[Counters-decrement-struct-Counters-Counter-]]
- ==== `[.contract-item-name]#++decrement++#++(struct Counters.Counter counter)++` [.item-kind]#internal#
- [.contract-item]
- [[Counters-reset-struct-Counters-Counter-]]
- ==== `[.contract-item-name]#++reset++#++(struct Counters.Counter counter)++` [.item-kind]#internal#
- :toString: pass:normal[xref:#Strings-toString-uint256-[`++toString++`]]
- :toString: pass:normal[xref:#Strings-toString-int256-[`++toString++`]]
- :toHexString: pass:normal[xref:#Strings-toHexString-uint256-[`++toHexString++`]]
- :toHexString: pass:normal[xref:#Strings-toHexString-uint256-uint256-[`++toHexString++`]]
- :toHexString: pass:normal[xref:#Strings-toHexString-address-[`++toHexString++`]]
- :equal: pass:normal[xref:#Strings-equal-string-string-[`++equal++`]]
- [.contract]
- [[Strings]]
- === `++Strings++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/Strings.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Strings.sol";
- ```
- String operations.
- [.contract-index]
- .Functions
- --
- * {xref-Strings-toString-uint256-}[`++toString(value)++`]
- * {xref-Strings-toString-int256-}[`++toString(value)++`]
- * {xref-Strings-toHexString-uint256-}[`++toHexString(value)++`]
- * {xref-Strings-toHexString-uint256-uint256-}[`++toHexString(value, length)++`]
- * {xref-Strings-toHexString-address-}[`++toHexString(addr)++`]
- * {xref-Strings-equal-string-string-}[`++equal(a, b)++`]
- --
- [.contract-item]
- [[Strings-toString-uint256-]]
- ==== `[.contract-item-name]#++toString++#++(uint256 value) → string++` [.item-kind]#internal#
- Converts a `uint256` to its ASCII `string` decimal representation.
- [.contract-item]
- [[Strings-toString-int256-]]
- ==== `[.contract-item-name]#++toString++#++(int256 value) → string++` [.item-kind]#internal#
- Converts a `int256` to its ASCII `string` decimal representation.
- [.contract-item]
- [[Strings-toHexString-uint256-]]
- ==== `[.contract-item-name]#++toHexString++#++(uint256 value) → string++` [.item-kind]#internal#
- Converts a `uint256` to its ASCII `string` hexadecimal representation.
- [.contract-item]
- [[Strings-toHexString-uint256-uint256-]]
- ==== `[.contract-item-name]#++toHexString++#++(uint256 value, uint256 length) → string++` [.item-kind]#internal#
- Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
- [.contract-item]
- [[Strings-toHexString-address-]]
- ==== `[.contract-item-name]#++toHexString++#++(address addr) → string++` [.item-kind]#internal#
- Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
- [.contract-item]
- [[Strings-equal-string-string-]]
- ==== `[.contract-item-name]#++equal++#++(string a, string b) → bool++` [.item-kind]#internal#
- Returns true if the two strings are equal.
- :StringTooLong: pass:normal[xref:#ShortStrings-StringTooLong-string-[`++StringTooLong++`]]
- :InvalidShortString: pass:normal[xref:#ShortStrings-InvalidShortString--[`++InvalidShortString++`]]
- :toShortString: pass:normal[xref:#ShortStrings-toShortString-string-[`++toShortString++`]]
- :toString: pass:normal[xref:#ShortStrings-toString-ShortString-[`++toString++`]]
- :byteLength: pass:normal[xref:#ShortStrings-byteLength-ShortString-[`++byteLength++`]]
- :toShortStringWithFallback: pass:normal[xref:#ShortStrings-toShortStringWithFallback-string-string-[`++toShortStringWithFallback++`]]
- :toStringWithFallback: pass:normal[xref:#ShortStrings-toStringWithFallback-ShortString-string-[`++toStringWithFallback++`]]
- :byteLengthWithFallback: pass:normal[xref:#ShortStrings-byteLengthWithFallback-ShortString-string-[`++byteLengthWithFallback++`]]
- [.contract]
- [[ShortStrings]]
- === `++ShortStrings++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/ShortStrings.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/ShortStrings.sol";
- ```
- This library provides functions to convert short memory strings
- into a `ShortString` type that can be used as an immutable variable.
- Strings of arbitrary length can be optimized using this library if
- they are short enough (up to 31 bytes) by packing them with their
- length (1 byte) in a single EVM word (32 bytes). Additionally, a
- fallback mechanism can be used for every other case.
- Usage example:
- ```solidity
- contract Named {
- using ShortStrings for *;
- ShortString private immutable _name;
- string private _nameFallback;
- constructor(string memory contractName) {
- _name = contractName.toShortStringWithFallback(_nameFallback);
- }
- function name() external view returns (string memory) {
- return _name.toStringWithFallback(_nameFallback);
- }
- }
- ```
- [.contract-index]
- .Functions
- --
- * {xref-ShortStrings-toShortString-string-}[`++toShortString(str)++`]
- * {xref-ShortStrings-toString-ShortString-}[`++toString(sstr)++`]
- * {xref-ShortStrings-byteLength-ShortString-}[`++byteLength(sstr)++`]
- * {xref-ShortStrings-toShortStringWithFallback-string-string-}[`++toShortStringWithFallback(value, store)++`]
- * {xref-ShortStrings-toStringWithFallback-ShortString-string-}[`++toStringWithFallback(value, store)++`]
- * {xref-ShortStrings-byteLengthWithFallback-ShortString-string-}[`++byteLengthWithFallback(value, store)++`]
- --
- [.contract-item]
- [[ShortStrings-toShortString-string-]]
- ==== `[.contract-item-name]#++toShortString++#++(string str) → ShortString++` [.item-kind]#internal#
- Encode a string of at most 31 chars into a `ShortString`.
- This will trigger a `StringTooLong` error is the input string is too long.
- [.contract-item]
- [[ShortStrings-toString-ShortString-]]
- ==== `[.contract-item-name]#++toString++#++(ShortString sstr) → string++` [.item-kind]#internal#
- Decode a `ShortString` back to a "normal" string.
- [.contract-item]
- [[ShortStrings-byteLength-ShortString-]]
- ==== `[.contract-item-name]#++byteLength++#++(ShortString sstr) → uint256++` [.item-kind]#internal#
- Return the length of a `ShortString`.
- [.contract-item]
- [[ShortStrings-toShortStringWithFallback-string-string-]]
- ==== `[.contract-item-name]#++toShortStringWithFallback++#++(string value, string store) → ShortString++` [.item-kind]#internal#
- Encode a string into a `ShortString`, or write it to storage if it is too long.
- [.contract-item]
- [[ShortStrings-toStringWithFallback-ShortString-string-]]
- ==== `[.contract-item-name]#++toStringWithFallback++#++(ShortString value, string store) → string++` [.item-kind]#internal#
- Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
- [.contract-item]
- [[ShortStrings-byteLengthWithFallback-ShortString-string-]]
- ==== `[.contract-item-name]#++byteLengthWithFallback++#++(ShortString value, string store) → uint256++` [.item-kind]#internal#
- Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
- WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
- actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
- :AddressSlot: pass:normal[xref:#StorageSlot-AddressSlot[`++AddressSlot++`]]
- :BooleanSlot: pass:normal[xref:#StorageSlot-BooleanSlot[`++BooleanSlot++`]]
- :Bytes32Slot: pass:normal[xref:#StorageSlot-Bytes32Slot[`++Bytes32Slot++`]]
- :Uint256Slot: pass:normal[xref:#StorageSlot-Uint256Slot[`++Uint256Slot++`]]
- :StringSlot: pass:normal[xref:#StorageSlot-StringSlot[`++StringSlot++`]]
- :BytesSlot: pass:normal[xref:#StorageSlot-BytesSlot[`++BytesSlot++`]]
- :getAddressSlot: pass:normal[xref:#StorageSlot-getAddressSlot-bytes32-[`++getAddressSlot++`]]
- :getBooleanSlot: pass:normal[xref:#StorageSlot-getBooleanSlot-bytes32-[`++getBooleanSlot++`]]
- :getBytes32Slot: pass:normal[xref:#StorageSlot-getBytes32Slot-bytes32-[`++getBytes32Slot++`]]
- :getUint256Slot: pass:normal[xref:#StorageSlot-getUint256Slot-bytes32-[`++getUint256Slot++`]]
- :getStringSlot: pass:normal[xref:#StorageSlot-getStringSlot-bytes32-[`++getStringSlot++`]]
- :getStringSlot: pass:normal[xref:#StorageSlot-getStringSlot-string-[`++getStringSlot++`]]
- :getBytesSlot: pass:normal[xref:#StorageSlot-getBytesSlot-bytes32-[`++getBytesSlot++`]]
- :getBytesSlot: pass:normal[xref:#StorageSlot-getBytesSlot-bytes-[`++getBytesSlot++`]]
- [.contract]
- [[StorageSlot]]
- === `++StorageSlot++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/StorageSlot.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/StorageSlot.sol";
- ```
- Library for reading and writing primitive types to specific storage slots.
- Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
- This library helps with reading and writing to such slots without the need for inline assembly.
- The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
- Example usage to set ERC1967 implementation slot:
- ```solidity
- contract ERC1967 {
- bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
- function _getImplementation() internal view returns (address) {
- return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
- }
- function _setImplementation(address newImplementation) internal {
- require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
- StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
- }
- }
- ```
- _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
- _Available since v4.9 for `string`, `bytes`._
- [.contract-index]
- .Functions
- --
- * {xref-StorageSlot-getAddressSlot-bytes32-}[`++getAddressSlot(slot)++`]
- * {xref-StorageSlot-getBooleanSlot-bytes32-}[`++getBooleanSlot(slot)++`]
- * {xref-StorageSlot-getBytes32Slot-bytes32-}[`++getBytes32Slot(slot)++`]
- * {xref-StorageSlot-getUint256Slot-bytes32-}[`++getUint256Slot(slot)++`]
- * {xref-StorageSlot-getStringSlot-bytes32-}[`++getStringSlot(slot)++`]
- * {xref-StorageSlot-getStringSlot-string-}[`++getStringSlot(store)++`]
- * {xref-StorageSlot-getBytesSlot-bytes32-}[`++getBytesSlot(slot)++`]
- * {xref-StorageSlot-getBytesSlot-bytes-}[`++getBytesSlot(store)++`]
- --
- [.contract-item]
- [[StorageSlot-getAddressSlot-bytes32-]]
- ==== `[.contract-item-name]#++getAddressSlot++#++(bytes32 slot) → struct StorageSlot.AddressSlot r++` [.item-kind]#internal#
- Returns an `AddressSlot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getBooleanSlot-bytes32-]]
- ==== `[.contract-item-name]#++getBooleanSlot++#++(bytes32 slot) → struct StorageSlot.BooleanSlot r++` [.item-kind]#internal#
- Returns an `BooleanSlot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getBytes32Slot-bytes32-]]
- ==== `[.contract-item-name]#++getBytes32Slot++#++(bytes32 slot) → struct StorageSlot.Bytes32Slot r++` [.item-kind]#internal#
- Returns an `Bytes32Slot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getUint256Slot-bytes32-]]
- ==== `[.contract-item-name]#++getUint256Slot++#++(bytes32 slot) → struct StorageSlot.Uint256Slot r++` [.item-kind]#internal#
- Returns an `Uint256Slot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getStringSlot-bytes32-]]
- ==== `[.contract-item-name]#++getStringSlot++#++(bytes32 slot) → struct StorageSlot.StringSlot r++` [.item-kind]#internal#
- Returns an `StringSlot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getStringSlot-string-]]
- ==== `[.contract-item-name]#++getStringSlot++#++(string store) → struct StorageSlot.StringSlot r++` [.item-kind]#internal#
- Returns an `StringSlot` representation of the string storage pointer `store`.
- [.contract-item]
- [[StorageSlot-getBytesSlot-bytes32-]]
- ==== `[.contract-item-name]#++getBytesSlot++#++(bytes32 slot) → struct StorageSlot.BytesSlot r++` [.item-kind]#internal#
- Returns an `BytesSlot` with member `value` located at `slot`.
- [.contract-item]
- [[StorageSlot-getBytesSlot-bytes-]]
- ==== `[.contract-item-name]#++getBytesSlot++#++(bytes store) → struct StorageSlot.BytesSlot r++` [.item-kind]#internal#
- Returns an `BytesSlot` representation of the bytes storage pointer `store`.
- :multicall: pass:normal[xref:#Multicall-multicall-bytes---[`++multicall++`]]
- [.contract]
- [[Multicall]]
- === `++Multicall++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.4/contracts/utils/Multicall.sol[{github-icon},role=heading-link]
- [.hljs-theme-light.nopadding]
- ```solidity
- import "@openzeppelin/contracts/utils/Multicall.sol";
- ```
- Provides a function to batch together multiple calls in a single external call.
- Consider any assumption about calldata validation performed by the sender may be violated if it's not especially
- careful about sending transactions invoking {multicall}. For example, a relay address that filters function
- selectors won't filter calls nested within a {multicall} operation.
- NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}).
- If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data`
- to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of
- {_msgSender} are not propagated to subcalls.
- _Available since v4.1._
- [.contract-index]
- .Functions
- --
- * {xref-Multicall-multicall-bytes---}[`++multicall(data)++`]
- --
- [.contract-item]
- [[Multicall-multicall-bytes---]]
- ==== `[.contract-item-name]#++multicall++#++(bytes[] data) → bytes[] results++` [.item-kind]#external#
- Receives and executes a batch of function calls on this contract.
|