proxy.adoc 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499
  1. :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
  2. :Proxy: pass:normal[xref:proxy.adoc#Proxy[`Proxy`]]
  3. :ERC1967Utils: pass:normal[xref:proxy.adoc#ERC1967Utils[`ERC1967Utils`]]
  4. :ERC1967Proxy: pass:normal[xref:proxy.adoc#ERC1967Proxy[`ERC1967Proxy`]]
  5. :TransparentUpgradeableProxy: pass:normal[xref:proxy.adoc#TransparentUpgradeableProxy[`TransparentUpgradeableProxy`]]
  6. :UUPSUpgradeable: pass:normal[xref:proxy.adoc#UUPSUpgradeable[`UUPSUpgradeable`]]
  7. :BeaconProxy: pass:normal[xref:proxy.adoc#BeaconProxy[`BeaconProxy`]]
  8. :UpgradeableBeacon: pass:normal[xref:proxy.adoc#UpgradeableBeacon[`UpgradeableBeacon`]]
  9. :BeaconProxy: pass:normal[xref:proxy.adoc#BeaconProxy[`BeaconProxy`]]
  10. :Clones: pass:normal[xref:proxy.adoc#Clones[`Clones`]]
  11. :TransparentUpgradeableProxy: pass:normal[xref:proxy.adoc#TransparentUpgradeableProxy[`TransparentUpgradeableProxy`]]
  12. :ERC1967Proxy: pass:normal[xref:proxy.adoc#ERC1967Proxy[`ERC1967Proxy`]]
  13. :UUPSUpgradeable: pass:normal[xref:proxy.adoc#UUPSUpgradeable[`UUPSUpgradeable`]]
  14. :xref-UUPSUpgradeable-_authorizeUpgrade-address-: xref:proxy.adoc#UUPSUpgradeable-_authorizeUpgrade-address-
  15. :TransparentUpgradeableProxy: pass:normal[xref:proxy.adoc#TransparentUpgradeableProxy[`TransparentUpgradeableProxy`]]
  16. :UUPSUpgradeable: pass:normal[xref:proxy.adoc#UUPSUpgradeable[`UUPSUpgradeable`]]
  17. :xref-Proxy-_delegate-address-: xref:proxy.adoc#Proxy-_delegate-address-
  18. :xref-Proxy-_implementation--: xref:proxy.adoc#Proxy-_implementation--
  19. :xref-Proxy-_fallback--: xref:proxy.adoc#Proxy-_fallback--
  20. :xref-Proxy-fallback--: xref:proxy.adoc#Proxy-fallback--
  21. :xref-ERC1967Proxy-constructor-address-bytes-: xref:proxy.adoc#ERC1967Proxy-constructor-address-bytes-
  22. :xref-ERC1967Proxy-_implementation--: xref:proxy.adoc#ERC1967Proxy-_implementation--
  23. :xref-Proxy-_delegate-address-: xref:proxy.adoc#Proxy-_delegate-address-
  24. :xref-Proxy-_fallback--: xref:proxy.adoc#Proxy-_fallback--
  25. :xref-Proxy-fallback--: xref:proxy.adoc#Proxy-fallback--
  26. :xref-ERC1967Utils-getImplementation--: xref:proxy.adoc#ERC1967Utils-getImplementation--
  27. :xref-ERC1967Utils-upgradeToAndCall-address-bytes-: xref:proxy.adoc#ERC1967Utils-upgradeToAndCall-address-bytes-
  28. :xref-ERC1967Utils-getAdmin--: xref:proxy.adoc#ERC1967Utils-getAdmin--
  29. :xref-ERC1967Utils-changeAdmin-address-: xref:proxy.adoc#ERC1967Utils-changeAdmin-address-
  30. :xref-ERC1967Utils-getBeacon--: xref:proxy.adoc#ERC1967Utils-getBeacon--
  31. :xref-ERC1967Utils-upgradeBeaconToAndCall-address-bytes-: xref:proxy.adoc#ERC1967Utils-upgradeBeaconToAndCall-address-bytes-
  32. :xref-ERC1967Utils-ERC1967InvalidImplementation-address-: xref:proxy.adoc#ERC1967Utils-ERC1967InvalidImplementation-address-
  33. :xref-ERC1967Utils-ERC1967InvalidAdmin-address-: xref:proxy.adoc#ERC1967Utils-ERC1967InvalidAdmin-address-
  34. :xref-ERC1967Utils-ERC1967InvalidBeacon-address-: xref:proxy.adoc#ERC1967Utils-ERC1967InvalidBeacon-address-
  35. :xref-ERC1967Utils-ERC1967NonPayable--: xref:proxy.adoc#ERC1967Utils-ERC1967NonPayable--
  36. :xref-ERC1967Utils-IMPLEMENTATION_SLOT-bytes32: xref:proxy.adoc#ERC1967Utils-IMPLEMENTATION_SLOT-bytes32
  37. :xref-ERC1967Utils-ADMIN_SLOT-bytes32: xref:proxy.adoc#ERC1967Utils-ADMIN_SLOT-bytes32
  38. :xref-ERC1967Utils-BEACON_SLOT-bytes32: xref:proxy.adoc#ERC1967Utils-BEACON_SLOT-bytes32
  39. :IERC1967-Upgraded: pass:normal[xref:interfaces.adoc#IERC1967-Upgraded-address-[`IERC1967.Upgraded`]]
  40. :IERC1967-AdminChanged: pass:normal[xref:interfaces.adoc#IERC1967-AdminChanged-address-address-[`IERC1967.AdminChanged`]]
  41. :IERC1967-BeaconUpgraded: pass:normal[xref:interfaces.adoc#IERC1967-BeaconUpgraded-address-[`IERC1967.BeaconUpgraded`]]
  42. :BeaconProxy: pass:normal[xref:proxy.adoc#BeaconProxy[`BeaconProxy`]]
  43. :ProxyAdmin: pass:normal[xref:proxy.adoc#ProxyAdmin[`ProxyAdmin`]]
  44. :ITransparentUpgradeableProxy-upgradeToAndCall: pass:normal[xref:proxy.adoc#ITransparentUpgradeableProxy-upgradeToAndCall-address-bytes-[`ITransparentUpgradeableProxy.upgradeToAndCall`]]
  45. :ProxyAdmin: pass:normal[xref:proxy.adoc#ProxyAdmin[`ProxyAdmin`]]
  46. :Context: pass:normal[xref:utils.adoc#Context[`Context`]]
  47. :ProxyAdmin: pass:normal[xref:proxy.adoc#ProxyAdmin[`ProxyAdmin`]]
  48. :ITransparentUpgradeableProxy: pass:normal[xref:proxy.adoc#ITransparentUpgradeableProxy[`ITransparentUpgradeableProxy`]]
  49. :xref-TransparentUpgradeableProxy-constructor-address-address-bytes-: xref:proxy.adoc#TransparentUpgradeableProxy-constructor-address-address-bytes-
  50. :xref-TransparentUpgradeableProxy-_proxyAdmin--: xref:proxy.adoc#TransparentUpgradeableProxy-_proxyAdmin--
  51. :xref-TransparentUpgradeableProxy-_fallback--: xref:proxy.adoc#TransparentUpgradeableProxy-_fallback--
  52. :xref-ERC1967Proxy-_implementation--: xref:proxy.adoc#ERC1967Proxy-_implementation--
  53. :xref-Proxy-_delegate-address-: xref:proxy.adoc#Proxy-_delegate-address-
  54. :xref-Proxy-fallback--: xref:proxy.adoc#Proxy-fallback--
  55. :xref-TransparentUpgradeableProxy-ProxyDeniedAdminAccess--: xref:proxy.adoc#TransparentUpgradeableProxy-ProxyDeniedAdminAccess--
  56. :ProxyAdmin: pass:normal[xref:proxy.adoc#ProxyAdmin[`ProxyAdmin`]]
  57. :ERC1967Proxy-constructor: pass:normal[xref:proxy.adoc#ERC1967Proxy-constructor-address-bytes-[`ERC1967Proxy.constructor`]]
  58. :TransparentUpgradeableProxy: pass:normal[xref:proxy.adoc#TransparentUpgradeableProxy[`TransparentUpgradeableProxy`]]
  59. :TransparentUpgradeableProxy: pass:normal[xref:proxy.adoc#TransparentUpgradeableProxy[`TransparentUpgradeableProxy`]]
  60. :xref-ProxyAdmin-constructor-address-: xref:proxy.adoc#ProxyAdmin-constructor-address-
  61. :xref-ProxyAdmin-upgradeAndCall-contract-ITransparentUpgradeableProxy-address-bytes-: xref:proxy.adoc#ProxyAdmin-upgradeAndCall-contract-ITransparentUpgradeableProxy-address-bytes-
  62. :xref-ProxyAdmin-UPGRADE_INTERFACE_VERSION-string: xref:proxy.adoc#ProxyAdmin-UPGRADE_INTERFACE_VERSION-string
  63. :xref-Ownable-owner--: xref:access.adoc#Ownable-owner--
  64. :xref-Ownable-_checkOwner--: xref:access.adoc#Ownable-_checkOwner--
  65. :xref-Ownable-renounceOwnership--: xref:access.adoc#Ownable-renounceOwnership--
  66. :xref-Ownable-transferOwnership-address-: xref:access.adoc#Ownable-transferOwnership-address-
  67. :xref-Ownable-_transferOwnership-address-: xref:access.adoc#Ownable-_transferOwnership-address-
  68. :xref-Ownable-OwnershipTransferred-address-address-: xref:access.adoc#Ownable-OwnershipTransferred-address-address-
  69. :xref-Ownable-OwnableUnauthorizedAccount-address-: xref:access.adoc#Ownable-OwnableUnauthorizedAccount-address-
  70. :xref-Ownable-OwnableInvalidOwner-address-: xref:access.adoc#Ownable-OwnableInvalidOwner-address-
  71. :TransparentUpgradeableProxy-_dispatchUpgradeToAndCall: pass:normal[xref:proxy.adoc#TransparentUpgradeableProxy-_dispatchUpgradeToAndCall--[`TransparentUpgradeableProxy._dispatchUpgradeToAndCall`]]
  72. :UpgradeableBeacon: pass:normal[xref:proxy.adoc#UpgradeableBeacon[`UpgradeableBeacon`]]
  73. :xref-BeaconProxy-constructor-address-bytes-: xref:proxy.adoc#BeaconProxy-constructor-address-bytes-
  74. :xref-BeaconProxy-_implementation--: xref:proxy.adoc#BeaconProxy-_implementation--
  75. :xref-BeaconProxy-_getBeacon--: xref:proxy.adoc#BeaconProxy-_getBeacon--
  76. :xref-Proxy-_delegate-address-: xref:proxy.adoc#Proxy-_delegate-address-
  77. :xref-Proxy-_fallback--: xref:proxy.adoc#Proxy-_fallback--
  78. :xref-Proxy-fallback--: xref:proxy.adoc#Proxy-fallback--
  79. :IBeacon: pass:normal[xref:proxy.adoc#IBeacon[`IBeacon`]]
  80. :BeaconProxy: pass:normal[xref:proxy.adoc#BeaconProxy[`BeaconProxy`]]
  81. :xref-IBeacon-implementation--: xref:proxy.adoc#IBeacon-implementation--
  82. :UpgradeableBeacon: pass:normal[xref:proxy.adoc#UpgradeableBeacon[`UpgradeableBeacon`]]
  83. :BeaconProxy: pass:normal[xref:proxy.adoc#BeaconProxy[`BeaconProxy`]]
  84. :xref-UpgradeableBeacon-constructor-address-address-: xref:proxy.adoc#UpgradeableBeacon-constructor-address-address-
  85. :xref-UpgradeableBeacon-implementation--: xref:proxy.adoc#UpgradeableBeacon-implementation--
  86. :xref-UpgradeableBeacon-upgradeTo-address-: xref:proxy.adoc#UpgradeableBeacon-upgradeTo-address-
  87. :xref-Ownable-owner--: xref:access.adoc#Ownable-owner--
  88. :xref-Ownable-_checkOwner--: xref:access.adoc#Ownable-_checkOwner--
  89. :xref-Ownable-renounceOwnership--: xref:access.adoc#Ownable-renounceOwnership--
  90. :xref-Ownable-transferOwnership-address-: xref:access.adoc#Ownable-transferOwnership-address-
  91. :xref-Ownable-_transferOwnership-address-: xref:access.adoc#Ownable-_transferOwnership-address-
  92. :xref-UpgradeableBeacon-Upgraded-address-: xref:proxy.adoc#UpgradeableBeacon-Upgraded-address-
  93. :xref-Ownable-OwnershipTransferred-address-address-: xref:access.adoc#Ownable-OwnershipTransferred-address-address-
  94. :xref-UpgradeableBeacon-BeaconInvalidImplementation-address-: xref:proxy.adoc#UpgradeableBeacon-BeaconInvalidImplementation-address-
  95. :xref-Ownable-OwnableUnauthorizedAccount-address-: xref:access.adoc#Ownable-OwnableUnauthorizedAccount-address-
  96. :xref-Ownable-OwnableInvalidOwner-address-: xref:access.adoc#Ownable-OwnableInvalidOwner-address-
  97. :xref-Clones-clone-address-: xref:proxy.adoc#Clones-clone-address-
  98. :xref-Clones-clone-address-uint256-: xref:proxy.adoc#Clones-clone-address-uint256-
  99. :xref-Clones-cloneDeterministic-address-bytes32-: xref:proxy.adoc#Clones-cloneDeterministic-address-bytes32-
  100. :xref-Clones-cloneDeterministic-address-bytes32-uint256-: xref:proxy.adoc#Clones-cloneDeterministic-address-bytes32-uint256-
  101. :xref-Clones-predictDeterministicAddress-address-bytes32-address-: xref:proxy.adoc#Clones-predictDeterministicAddress-address-bytes32-address-
  102. :xref-Clones-predictDeterministicAddress-address-bytes32-: xref:proxy.adoc#Clones-predictDeterministicAddress-address-bytes32-
  103. :xref-Clones-cloneWithImmutableArgs-address-bytes-: xref:proxy.adoc#Clones-cloneWithImmutableArgs-address-bytes-
  104. :xref-Clones-cloneWithImmutableArgs-address-bytes-uint256-: xref:proxy.adoc#Clones-cloneWithImmutableArgs-address-bytes-uint256-
  105. :xref-Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-: xref:proxy.adoc#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-
  106. :xref-Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256-: xref:proxy.adoc#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256-
  107. :xref-Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-address-: xref:proxy.adoc#Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-address-
  108. :xref-Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-: xref:proxy.adoc#Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-
  109. :xref-Clones-fetchCloneArgs-address-: xref:proxy.adoc#Clones-fetchCloneArgs-address-
  110. :xref-Clones-CloneArgumentsTooLong--: xref:proxy.adoc#Clones-CloneArgumentsTooLong--
  111. :xref-Clones-clone-address-: xref:proxy.adoc#Clones-clone-address-
  112. :xref-Clones-cloneDeterministic-address-bytes32-: xref:proxy.adoc#Clones-cloneDeterministic-address-bytes32-
  113. :Clones-cloneDeterministic: pass:normal[xref:proxy.adoc#Clones-cloneDeterministic-address-bytes32-uint256-[`Clones.cloneDeterministic`]]
  114. :Clones-cloneDeterministic: pass:normal[xref:proxy.adoc#Clones-cloneDeterministic-address-bytes32-uint256-[`Clones.cloneDeterministic`]]
  115. :xref-Clones-cloneWithImmutableArgs-address-bytes-: xref:proxy.adoc#Clones-cloneWithImmutableArgs-address-bytes-
  116. :xref-Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-: xref:proxy.adoc#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-
  117. :Clones-cloneDeterministicWithImmutableArgs: pass:normal[xref:proxy.adoc#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256-[`Clones.cloneDeterministicWithImmutableArgs`]]
  118. :Clones-cloneDeterministicWithImmutableArgs: pass:normal[xref:proxy.adoc#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256-[`Clones.cloneDeterministicWithImmutableArgs`]]
  119. :ERC1967Proxy-constructor: pass:normal[xref:proxy.adoc#ERC1967Proxy-constructor-address-bytes-[`ERC1967Proxy.constructor`]]
  120. :xref-Initializable-initializer--: xref:proxy.adoc#Initializable-initializer--
  121. :xref-Initializable-reinitializer-uint64-: xref:proxy.adoc#Initializable-reinitializer-uint64-
  122. :xref-Initializable-onlyInitializing--: xref:proxy.adoc#Initializable-onlyInitializing--
  123. :xref-Initializable-_checkInitializing--: xref:proxy.adoc#Initializable-_checkInitializing--
  124. :xref-Initializable-_disableInitializers--: xref:proxy.adoc#Initializable-_disableInitializers--
  125. :xref-Initializable-_getInitializedVersion--: xref:proxy.adoc#Initializable-_getInitializedVersion--
  126. :xref-Initializable-_isInitializing--: xref:proxy.adoc#Initializable-_isInitializing--
  127. :xref-Initializable-_initializableStorageSlot--: xref:proxy.adoc#Initializable-_initializableStorageSlot--
  128. :xref-Initializable-Initialized-uint64-: xref:proxy.adoc#Initializable-Initialized-uint64-
  129. :xref-Initializable-InvalidInitialization--: xref:proxy.adoc#Initializable-InvalidInitialization--
  130. :xref-Initializable-NotInitializing--: xref:proxy.adoc#Initializable-NotInitializing--
  131. :ERC1967Proxy: pass:normal[xref:proxy.adoc#ERC1967Proxy[`ERC1967Proxy`]]
  132. :xref-UUPSUpgradeable-onlyProxy--: xref:proxy.adoc#UUPSUpgradeable-onlyProxy--
  133. :xref-UUPSUpgradeable-notDelegated--: xref:proxy.adoc#UUPSUpgradeable-notDelegated--
  134. :xref-UUPSUpgradeable-proxiableUUID--: xref:proxy.adoc#UUPSUpgradeable-proxiableUUID--
  135. :xref-UUPSUpgradeable-upgradeToAndCall-address-bytes-: xref:proxy.adoc#UUPSUpgradeable-upgradeToAndCall-address-bytes-
  136. :xref-UUPSUpgradeable-_checkProxy--: xref:proxy.adoc#UUPSUpgradeable-_checkProxy--
  137. :xref-UUPSUpgradeable-_checkNotDelegated--: xref:proxy.adoc#UUPSUpgradeable-_checkNotDelegated--
  138. :xref-UUPSUpgradeable-_authorizeUpgrade-address-: xref:proxy.adoc#UUPSUpgradeable-_authorizeUpgrade-address-
  139. :xref-UUPSUpgradeable-UPGRADE_INTERFACE_VERSION-string: xref:proxy.adoc#UUPSUpgradeable-UPGRADE_INTERFACE_VERSION-string
  140. :xref-UUPSUpgradeable-UUPSUnauthorizedCallContext--: xref:proxy.adoc#UUPSUpgradeable-UUPSUnauthorizedCallContext--
  141. :xref-UUPSUpgradeable-UUPSUnsupportedProxiableUUID-bytes32-: xref:proxy.adoc#UUPSUpgradeable-UUPSUnsupportedProxiableUUID-bytes32-
  142. :Ownable-onlyOwner: pass:normal[xref:access.adoc#Ownable-onlyOwner--[`Ownable.onlyOwner`]]
  143. = Proxies
  144. [.readme-notice]
  145. NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/proxy
  146. This is a low-level set of contracts implementing different proxy patterns with and without upgradeability. For an in-depth overview of this pattern check out the xref:upgrades-plugins::proxies.adoc[Proxy Upgrade Pattern] page.
  147. Most of the proxies below are built on an abstract base contract.
  148. - {Proxy}: Abstract contract implementing the core delegation functionality.
  149. In order to avoid clashes with the storage variables of the implementation contract behind a proxy, we use https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] storage slots.
  150. - {ERC1967Utils}: Internal functions to get and set the storage slots defined in ERC-1967.
  151. - {ERC1967Proxy}: A proxy using ERC-1967 storage slots. Not upgradeable by default.
  152. There are two alternative ways to add upgradeability to an ERC-1967 proxy. Their differences are explained below in <<transparent-vs-uups>>.
  153. - {TransparentUpgradeableProxy}: A proxy with a built-in immutable admin and upgrade interface.
  154. - {UUPSUpgradeable}: An upgradeability mechanism to be included in the implementation contract.
  155. CAUTION: Using upgradeable proxies correctly and securely is a difficult task that requires deep knowledge of the proxy pattern, Solidity, and the EVM. Unless you want a lot of low level control, we recommend using the xref:upgrades-plugins::index.adoc[OpenZeppelin Upgrades Plugins] for Hardhat and Foundry.
  156. A different family of proxies are beacon proxies. This pattern, popularized by Dharma, allows multiple proxies to be upgraded to a different implementation in a single transaction.
  157. - {BeaconProxy}: A proxy that retrieves its implementation from a beacon contract.
  158. - {UpgradeableBeacon}: A beacon contract with a built in admin that can upgrade the {BeaconProxy} pointing to it.
  159. In this pattern, the proxy contract doesn't hold the implementation address in storage like an ERC-1967 proxy. Instead, the address is stored in a separate beacon contract. The `upgrade` operations are sent to the beacon instead of to the proxy contract, and all proxies that follow that beacon are automatically upgraded.
  160. Outside the realm of upgradeability, proxies can also be useful to make cheap contract clones, such as those created by an on-chain factory contract that creates many instances of the same contract. These instances are designed to be both cheap to deploy, and cheap to call.
  161. - {Clones}: A library that can deploy cheap minimal non-upgradeable proxies.
  162. [[transparent-vs-uups]]
  163. == Transparent vs UUPS Proxies
  164. The original proxies included in OpenZeppelin followed the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[Transparent Proxy Pattern]. While this pattern is still provided, our recommendation is now shifting towards UUPS proxies, which are both lightweight and versatile. The name UUPS comes from https://eips.ethereum.org/EIPS/eip-1822[ERC-1822], which first documented the pattern.
  165. While both of these share the same interface for upgrades, in UUPS proxies the upgrade is handled by the implementation, and can eventually be removed. Transparent proxies, on the other hand, include the upgrade and admin logic in the proxy itself. This means {TransparentUpgradeableProxy} is more expensive to deploy than what is possible with UUPS proxies.
  166. UUPS proxies are implemented using an {ERC1967Proxy}. Note that this proxy is not by itself upgradeable. It is the role of the implementation to include, alongside the contract's logic, all the code necessary to update the implementation's address that is stored at a specific slot in the proxy's storage space. This is where the {UUPSUpgradeable} contract comes in. Inheriting from it (and overriding the {xref-UUPSUpgradeable-_authorizeUpgrade-address-}[`_authorizeUpgrade`] function with the relevant access control mechanism) will turn your contract into a UUPS compliant implementation.
  167. Note that since both proxies use the same storage slot for the implementation address, using a UUPS compliant implementation with a {TransparentUpgradeableProxy} might allow non-admins to perform upgrade operations.
  168. By default, the upgrade functionality included in {UUPSUpgradeable} contains a security mechanism that will prevent any upgrades to a non UUPS compliant implementation. This prevents upgrades to an implementation contract that wouldn't contain the necessary upgrade mechanism, as it would lock the upgradeability of the proxy forever. This security mechanism can be bypassed by either of:
  169. - Adding a flag mechanism in the implementation that will disable the upgrade function when triggered.
  170. - Upgrading to an implementation that features an upgrade mechanism without the additional security check, and then upgrading again to another implementation without the upgrade mechanism.
  171. The current implementation of this security mechanism uses https://eips.ethereum.org/EIPS/eip-1822[ERC-1822] to detect the storage slot used by the implementation. A previous implementation, now deprecated, relied on a rollback check. It is possible to upgrade from a contract using the old mechanism to a new one. The inverse is however not possible, as old implementations (before version 4.5) did not include the ERC-1822 interface.
  172. == Core
  173. :_delegate: pass:normal[xref:#Proxy-_delegate-address-[`++_delegate++`]]
  174. :_implementation: pass:normal[xref:#Proxy-_implementation--[`++_implementation++`]]
  175. :_fallback: pass:normal[xref:#Proxy-_fallback--[`++_fallback++`]]
  176. :fallback: pass:normal[xref:#Proxy-fallback--[`++fallback++`]]
  177. :_delegate-address: pass:normal[xref:#Proxy-_delegate-address-[`++_delegate++`]]
  178. :_implementation-: pass:normal[xref:#Proxy-_implementation--[`++_implementation++`]]
  179. :_fallback-: pass:normal[xref:#Proxy-_fallback--[`++_fallback++`]]
  180. :fallback-: pass:normal[xref:#Proxy-fallback--[`++fallback++`]]
  181. [.contract]
  182. [[Proxy]]
  183. === `++Proxy++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/Proxy.sol[{github-icon},role=heading-link]
  184. [.hljs-theme-light.nopadding]
  185. ```solidity
  186. import "@openzeppelin/contracts/proxy/Proxy.sol";
  187. ```
  188. This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
  189. instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
  190. be specified by overriding the virtual {_implementation} function.
  191. Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
  192. different contract through the {_delegate} function.
  193. The success and return data of the delegated call will be returned back to the caller of the proxy.
  194. [.contract-index]
  195. .Functions
  196. --
  197. * {xref-Proxy-_delegate-address-}[`++_delegate(implementation)++`]
  198. * {xref-Proxy-_implementation--}[`++_implementation()++`]
  199. * {xref-Proxy-_fallback--}[`++_fallback()++`]
  200. * {xref-Proxy-fallback--}[`++fallback()++`]
  201. --
  202. [.contract-item]
  203. [[Proxy-_delegate-address-]]
  204. ==== `[.contract-item-name]#++_delegate++#++(address implementation)++` [.item-kind]#internal#
  205. Delegates the current call to `implementation`.
  206. This function does not return to its internal call site, it will return directly to the external caller.
  207. [.contract-item]
  208. [[Proxy-_implementation--]]
  209. ==== `[.contract-item-name]#++_implementation++#++() → address++` [.item-kind]#internal#
  210. This is a virtual function that should be overridden so it returns the address to which the fallback
  211. function and {_fallback} should delegate.
  212. [.contract-item]
  213. [[Proxy-_fallback--]]
  214. ==== `[.contract-item-name]#++_fallback++#++()++` [.item-kind]#internal#
  215. Delegates the current call to the address returned by `_implementation()`.
  216. This function does not return to its internal call site, it will return directly to the external caller.
  217. [.contract-item]
  218. [[Proxy-fallback--]]
  219. ==== `[.contract-item-name]#++fallback++#++()++` [.item-kind]#external#
  220. Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
  221. function in the contract matches the call data.
  222. == ERC-1967
  223. :constructor: pass:normal[xref:#ERC1967Proxy-constructor-address-bytes-[`++constructor++`]]
  224. :_implementation: pass:normal[xref:#ERC1967Proxy-_implementation--[`++_implementation++`]]
  225. :constructor-address-bytes: pass:normal[xref:#ERC1967Proxy-constructor-address-bytes-[`++constructor++`]]
  226. :_implementation-: pass:normal[xref:#ERC1967Proxy-_implementation--[`++_implementation++`]]
  227. [.contract]
  228. [[ERC1967Proxy]]
  229. === `++ERC1967Proxy++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/ERC1967/ERC1967Proxy.sol[{github-icon},role=heading-link]
  230. [.hljs-theme-light.nopadding]
  231. ```solidity
  232. import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
  233. ```
  234. This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
  235. implementation address that can be changed. This address is stored in storage in the location specified by
  236. https://eips.ethereum.org/EIPS/eip-1967[ERC-1967], so that it doesn't conflict with the storage layout of the
  237. implementation behind the proxy.
  238. [.contract-index]
  239. .Functions
  240. --
  241. * {xref-ERC1967Proxy-constructor-address-bytes-}[`++constructor(implementation, _data)++`]
  242. * {xref-ERC1967Proxy-_implementation--}[`++_implementation()++`]
  243. [.contract-subindex-inherited]
  244. .Proxy
  245. * {xref-Proxy-_delegate-address-}[`++_delegate(implementation)++`]
  246. * {xref-Proxy-_fallback--}[`++_fallback()++`]
  247. * {xref-Proxy-fallback--}[`++fallback()++`]
  248. --
  249. [.contract-item]
  250. [[ERC1967Proxy-constructor-address-bytes-]]
  251. ==== `[.contract-item-name]#++constructor++#++(address implementation, bytes _data)++` [.item-kind]#public#
  252. Initializes the upgradeable proxy with an initial implementation specified by `implementation`.
  253. If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
  254. encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
  255. Requirements:
  256. - If `data` is empty, `msg.value` must be zero.
  257. [.contract-item]
  258. [[ERC1967Proxy-_implementation--]]
  259. ==== `[.contract-item-name]#++_implementation++#++() → address++` [.item-kind]#internal#
  260. Returns the current implementation address.
  261. TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
  262. the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
  263. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
  264. :IMPLEMENTATION_SLOT: pass:normal[xref:#ERC1967Utils-IMPLEMENTATION_SLOT-bytes32[`++IMPLEMENTATION_SLOT++`]]
  265. :ERC1967InvalidImplementation: pass:normal[xref:#ERC1967Utils-ERC1967InvalidImplementation-address-[`++ERC1967InvalidImplementation++`]]
  266. :ERC1967InvalidAdmin: pass:normal[xref:#ERC1967Utils-ERC1967InvalidAdmin-address-[`++ERC1967InvalidAdmin++`]]
  267. :ERC1967InvalidBeacon: pass:normal[xref:#ERC1967Utils-ERC1967InvalidBeacon-address-[`++ERC1967InvalidBeacon++`]]
  268. :ERC1967NonPayable: pass:normal[xref:#ERC1967Utils-ERC1967NonPayable--[`++ERC1967NonPayable++`]]
  269. :getImplementation: pass:normal[xref:#ERC1967Utils-getImplementation--[`++getImplementation++`]]
  270. :upgradeToAndCall: pass:normal[xref:#ERC1967Utils-upgradeToAndCall-address-bytes-[`++upgradeToAndCall++`]]
  271. :ADMIN_SLOT: pass:normal[xref:#ERC1967Utils-ADMIN_SLOT-bytes32[`++ADMIN_SLOT++`]]
  272. :getAdmin: pass:normal[xref:#ERC1967Utils-getAdmin--[`++getAdmin++`]]
  273. :changeAdmin: pass:normal[xref:#ERC1967Utils-changeAdmin-address-[`++changeAdmin++`]]
  274. :BEACON_SLOT: pass:normal[xref:#ERC1967Utils-BEACON_SLOT-bytes32[`++BEACON_SLOT++`]]
  275. :getBeacon: pass:normal[xref:#ERC1967Utils-getBeacon--[`++getBeacon++`]]
  276. :upgradeBeaconToAndCall: pass:normal[xref:#ERC1967Utils-upgradeBeaconToAndCall-address-bytes-[`++upgradeBeaconToAndCall++`]]
  277. :getImplementation-: pass:normal[xref:#ERC1967Utils-getImplementation--[`++getImplementation++`]]
  278. :upgradeToAndCall-address-bytes: pass:normal[xref:#ERC1967Utils-upgradeToAndCall-address-bytes-[`++upgradeToAndCall++`]]
  279. :getAdmin-: pass:normal[xref:#ERC1967Utils-getAdmin--[`++getAdmin++`]]
  280. :changeAdmin-address: pass:normal[xref:#ERC1967Utils-changeAdmin-address-[`++changeAdmin++`]]
  281. :getBeacon-: pass:normal[xref:#ERC1967Utils-getBeacon--[`++getBeacon++`]]
  282. :upgradeBeaconToAndCall-address-bytes: pass:normal[xref:#ERC1967Utils-upgradeBeaconToAndCall-address-bytes-[`++upgradeBeaconToAndCall++`]]
  283. [.contract]
  284. [[ERC1967Utils]]
  285. === `++ERC1967Utils++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/ERC1967/ERC1967Utils.sol[{github-icon},role=heading-link]
  286. [.hljs-theme-light.nopadding]
  287. ```solidity
  288. import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
  289. ```
  290. This library provides getters and event emitting update functions for
  291. https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
  292. [.contract-index]
  293. .Functions
  294. --
  295. * {xref-ERC1967Utils-getImplementation--}[`++getImplementation()++`]
  296. * {xref-ERC1967Utils-upgradeToAndCall-address-bytes-}[`++upgradeToAndCall(newImplementation, data)++`]
  297. * {xref-ERC1967Utils-getAdmin--}[`++getAdmin()++`]
  298. * {xref-ERC1967Utils-changeAdmin-address-}[`++changeAdmin(newAdmin)++`]
  299. * {xref-ERC1967Utils-getBeacon--}[`++getBeacon()++`]
  300. * {xref-ERC1967Utils-upgradeBeaconToAndCall-address-bytes-}[`++upgradeBeaconToAndCall(newBeacon, data)++`]
  301. --
  302. [.contract-index]
  303. .Errors
  304. --
  305. * {xref-ERC1967Utils-ERC1967InvalidImplementation-address-}[`++ERC1967InvalidImplementation(implementation)++`]
  306. * {xref-ERC1967Utils-ERC1967InvalidAdmin-address-}[`++ERC1967InvalidAdmin(admin)++`]
  307. * {xref-ERC1967Utils-ERC1967InvalidBeacon-address-}[`++ERC1967InvalidBeacon(beacon)++`]
  308. * {xref-ERC1967Utils-ERC1967NonPayable--}[`++ERC1967NonPayable()++`]
  309. --
  310. [.contract-index]
  311. .Internal Variables
  312. --
  313. * {xref-ERC1967Utils-IMPLEMENTATION_SLOT-bytes32}[`++bytes32 constant IMPLEMENTATION_SLOT++`]
  314. * {xref-ERC1967Utils-ADMIN_SLOT-bytes32}[`++bytes32 constant ADMIN_SLOT++`]
  315. * {xref-ERC1967Utils-BEACON_SLOT-bytes32}[`++bytes32 constant BEACON_SLOT++`]
  316. --
  317. [.contract-item]
  318. [[ERC1967Utils-getImplementation--]]
  319. ==== `[.contract-item-name]#++getImplementation++#++() → address++` [.item-kind]#internal#
  320. Returns the current implementation address.
  321. [.contract-item]
  322. [[ERC1967Utils-upgradeToAndCall-address-bytes-]]
  323. ==== `[.contract-item-name]#++upgradeToAndCall++#++(address newImplementation, bytes data)++` [.item-kind]#internal#
  324. Performs implementation upgrade with additional setup call if data is nonempty.
  325. This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
  326. to avoid stuck value in the contract.
  327. Emits an {IERC1967-Upgraded} event.
  328. [.contract-item]
  329. [[ERC1967Utils-getAdmin--]]
  330. ==== `[.contract-item-name]#++getAdmin++#++() → address++` [.item-kind]#internal#
  331. Returns the current admin.
  332. TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
  333. the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
  334. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
  335. [.contract-item]
  336. [[ERC1967Utils-changeAdmin-address-]]
  337. ==== `[.contract-item-name]#++changeAdmin++#++(address newAdmin)++` [.item-kind]#internal#
  338. Changes the admin of the proxy.
  339. Emits an {IERC1967-AdminChanged} event.
  340. [.contract-item]
  341. [[ERC1967Utils-getBeacon--]]
  342. ==== `[.contract-item-name]#++getBeacon++#++() → address++` [.item-kind]#internal#
  343. Returns the current beacon.
  344. [.contract-item]
  345. [[ERC1967Utils-upgradeBeaconToAndCall-address-bytes-]]
  346. ==== `[.contract-item-name]#++upgradeBeaconToAndCall++#++(address newBeacon, bytes data)++` [.item-kind]#internal#
  347. Change the beacon and trigger a setup call if data is nonempty.
  348. This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
  349. to avoid stuck value in the contract.
  350. Emits an {IERC1967-BeaconUpgraded} event.
  351. CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
  352. it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
  353. efficiency.
  354. [.contract-item]
  355. [[ERC1967Utils-ERC1967InvalidImplementation-address-]]
  356. ==== `[.contract-item-name]#++ERC1967InvalidImplementation++#++(address implementation)++` [.item-kind]#error#
  357. The `implementation` of the proxy is invalid.
  358. [.contract-item]
  359. [[ERC1967Utils-ERC1967InvalidAdmin-address-]]
  360. ==== `[.contract-item-name]#++ERC1967InvalidAdmin++#++(address admin)++` [.item-kind]#error#
  361. The `admin` of the proxy is invalid.
  362. [.contract-item]
  363. [[ERC1967Utils-ERC1967InvalidBeacon-address-]]
  364. ==== `[.contract-item-name]#++ERC1967InvalidBeacon++#++(address beacon)++` [.item-kind]#error#
  365. The `beacon` of the proxy is invalid.
  366. [.contract-item]
  367. [[ERC1967Utils-ERC1967NonPayable--]]
  368. ==== `[.contract-item-name]#++ERC1967NonPayable++#++()++` [.item-kind]#error#
  369. An upgrade function sees `msg.value > 0` that may be lost.
  370. [.contract-item]
  371. [[ERC1967Utils-IMPLEMENTATION_SLOT-bytes32]]
  372. ==== `bytes32 [.contract-item-name]#++IMPLEMENTATION_SLOT++#` [.item-kind]#internal constant#
  373. Storage slot with the address of the current implementation.
  374. This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
  375. [.contract-item]
  376. [[ERC1967Utils-ADMIN_SLOT-bytes32]]
  377. ==== `bytes32 [.contract-item-name]#++ADMIN_SLOT++#` [.item-kind]#internal constant#
  378. Storage slot with the admin of the contract.
  379. This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
  380. [.contract-item]
  381. [[ERC1967Utils-BEACON_SLOT-bytes32]]
  382. ==== `bytes32 [.contract-item-name]#++BEACON_SLOT++#` [.item-kind]#internal constant#
  383. The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
  384. This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
  385. == Transparent Proxy
  386. :ProxyDeniedAdminAccess: pass:normal[xref:#TransparentUpgradeableProxy-ProxyDeniedAdminAccess--[`++ProxyDeniedAdminAccess++`]]
  387. :constructor: pass:normal[xref:#TransparentUpgradeableProxy-constructor-address-address-bytes-[`++constructor++`]]
  388. :_proxyAdmin: pass:normal[xref:#TransparentUpgradeableProxy-_proxyAdmin--[`++_proxyAdmin++`]]
  389. :_fallback: pass:normal[xref:#TransparentUpgradeableProxy-_fallback--[`++_fallback++`]]
  390. :constructor-address-address-bytes: pass:normal[xref:#TransparentUpgradeableProxy-constructor-address-address-bytes-[`++constructor++`]]
  391. :_proxyAdmin-: pass:normal[xref:#TransparentUpgradeableProxy-_proxyAdmin--[`++_proxyAdmin++`]]
  392. :_fallback-: pass:normal[xref:#TransparentUpgradeableProxy-_fallback--[`++_fallback++`]]
  393. [.contract]
  394. [[TransparentUpgradeableProxy]]
  395. === `++TransparentUpgradeableProxy++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/transparent/TransparentUpgradeableProxy.sol[{github-icon},role=heading-link]
  396. [.hljs-theme-light.nopadding]
  397. ```solidity
  398. import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
  399. ```
  400. This contract implements a proxy that is upgradeable through an associated {ProxyAdmin} instance.
  401. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
  402. clashing], which can potentially be used in an attack, this contract uses the
  403. https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
  404. things that go hand in hand:
  405. 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
  406. that call matches the {ITransparentUpgradeableProxy-upgradeToAndCall} function exposed by the proxy itself.
  407. 2. If the admin calls the proxy, it can call the `upgradeToAndCall` function but any other call won't be forwarded to
  408. the implementation. If the admin tries to call a function on the implementation it will fail with an error indicating
  409. the proxy admin cannot fallback to the target implementation.
  410. These properties mean that the admin account can only be used for upgrading the proxy, so it's best if it's a
  411. dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to
  412. call a function from the proxy implementation. For this reason, the proxy deploys an instance of {ProxyAdmin} and
  413. allows upgrades only if they come through it. You should think of the `ProxyAdmin` instance as the administrative
  414. interface of the proxy, including the ability to change who can trigger upgrades by transferring ownership.
  415. NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not
  416. inherit from that interface, and instead `upgradeToAndCall` is implicitly implemented using a custom dispatch
  417. mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to
  418. fully implement transparency without decoding reverts caused by selector clashes between the proxy and the
  419. implementation.
  420. NOTE: This proxy does not inherit from {Context} deliberately. The {ProxyAdmin} of this contract won't send a
  421. meta-transaction in any way, and any other meta-transaction setup should be made in the implementation contract.
  422. IMPORTANT: This contract avoids unnecessary storage reads by setting the admin only during construction as an
  423. immutable variable, preventing any changes thereafter. However, the admin slot defined in ERC-1967 can still be
  424. overwritten by the implementation logic pointed to by this proxy. In such cases, the contract may end up in an
  425. undesirable state where the admin slot is different from the actual admin. Relying on the value of the admin slot
  426. is generally fine if the implementation is trusted.
  427. WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the
  428. compiler will not check that there are no selector conflicts, due to the note above. A selector clash between any new
  429. function and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This
  430. could render the `upgradeToAndCall` function inaccessible, preventing upgradeability and compromising transparency.
  431. [.contract-index]
  432. .Functions
  433. --
  434. * {xref-TransparentUpgradeableProxy-constructor-address-address-bytes-}[`++constructor(_logic, initialOwner, _data)++`]
  435. * {xref-TransparentUpgradeableProxy-_proxyAdmin--}[`++_proxyAdmin()++`]
  436. * {xref-TransparentUpgradeableProxy-_fallback--}[`++_fallback()++`]
  437. [.contract-subindex-inherited]
  438. .ERC1967Proxy
  439. * {xref-ERC1967Proxy-_implementation--}[`++_implementation()++`]
  440. [.contract-subindex-inherited]
  441. .Proxy
  442. * {xref-Proxy-_delegate-address-}[`++_delegate(implementation)++`]
  443. * {xref-Proxy-fallback--}[`++fallback()++`]
  444. --
  445. [.contract-index]
  446. .Errors
  447. --
  448. * {xref-TransparentUpgradeableProxy-ProxyDeniedAdminAccess--}[`++ProxyDeniedAdminAccess()++`]
  449. [.contract-subindex-inherited]
  450. .ERC1967Proxy
  451. [.contract-subindex-inherited]
  452. .Proxy
  453. --
  454. [.contract-item]
  455. [[TransparentUpgradeableProxy-constructor-address-address-bytes-]]
  456. ==== `[.contract-item-name]#++constructor++#++(address _logic, address initialOwner, bytes _data)++` [.item-kind]#public#
  457. Initializes an upgradeable proxy managed by an instance of a {ProxyAdmin} with an `initialOwner`,
  458. backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in
  459. {ERC1967Proxy-constructor}.
  460. [.contract-item]
  461. [[TransparentUpgradeableProxy-_proxyAdmin--]]
  462. ==== `[.contract-item-name]#++_proxyAdmin++#++() → address++` [.item-kind]#internal#
  463. Returns the admin of this proxy.
  464. [.contract-item]
  465. [[TransparentUpgradeableProxy-_fallback--]]
  466. ==== `[.contract-item-name]#++_fallback++#++()++` [.item-kind]#internal#
  467. If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.
  468. [.contract-item]
  469. [[TransparentUpgradeableProxy-ProxyDeniedAdminAccess--]]
  470. ==== `[.contract-item-name]#++ProxyDeniedAdminAccess++#++()++` [.item-kind]#error#
  471. The proxy caller is the current admin, and can't fallback to the proxy target.
  472. :UPGRADE_INTERFACE_VERSION: pass:normal[xref:#ProxyAdmin-UPGRADE_INTERFACE_VERSION-string[`++UPGRADE_INTERFACE_VERSION++`]]
  473. :constructor: pass:normal[xref:#ProxyAdmin-constructor-address-[`++constructor++`]]
  474. :upgradeAndCall: pass:normal[xref:#ProxyAdmin-upgradeAndCall-contract-ITransparentUpgradeableProxy-address-bytes-[`++upgradeAndCall++`]]
  475. :constructor-address: pass:normal[xref:#ProxyAdmin-constructor-address-[`++constructor++`]]
  476. :upgradeAndCall-contract-ITransparentUpgradeableProxy-address-bytes: pass:normal[xref:#ProxyAdmin-upgradeAndCall-contract-ITransparentUpgradeableProxy-address-bytes-[`++upgradeAndCall++`]]
  477. :UPGRADE_INTERFACE_VERSION-string: pass:normal[xref:#ProxyAdmin-UPGRADE_INTERFACE_VERSION-string[`++UPGRADE_INTERFACE_VERSION++`]]
  478. [.contract]
  479. [[ProxyAdmin]]
  480. === `++ProxyAdmin++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/transparent/ProxyAdmin.sol[{github-icon},role=heading-link]
  481. [.hljs-theme-light.nopadding]
  482. ```solidity
  483. import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
  484. ```
  485. This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an
  486. explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.
  487. [.contract-index]
  488. .Functions
  489. --
  490. * {xref-ProxyAdmin-constructor-address-}[`++constructor(initialOwner)++`]
  491. * {xref-ProxyAdmin-upgradeAndCall-contract-ITransparentUpgradeableProxy-address-bytes-}[`++upgradeAndCall(proxy, implementation, data)++`]
  492. * {xref-ProxyAdmin-UPGRADE_INTERFACE_VERSION-string}[`++UPGRADE_INTERFACE_VERSION()++`]
  493. [.contract-subindex-inherited]
  494. .Ownable
  495. * {xref-Ownable-owner--}[`++owner()++`]
  496. * {xref-Ownable-_checkOwner--}[`++_checkOwner()++`]
  497. * {xref-Ownable-renounceOwnership--}[`++renounceOwnership()++`]
  498. * {xref-Ownable-transferOwnership-address-}[`++transferOwnership(newOwner)++`]
  499. * {xref-Ownable-_transferOwnership-address-}[`++_transferOwnership(newOwner)++`]
  500. --
  501. [.contract-index]
  502. .Events
  503. --
  504. [.contract-subindex-inherited]
  505. .Ownable
  506. * {xref-Ownable-OwnershipTransferred-address-address-}[`++OwnershipTransferred(previousOwner, newOwner)++`]
  507. --
  508. [.contract-index]
  509. .Errors
  510. --
  511. [.contract-subindex-inherited]
  512. .Ownable
  513. * {xref-Ownable-OwnableUnauthorizedAccount-address-}[`++OwnableUnauthorizedAccount(account)++`]
  514. * {xref-Ownable-OwnableInvalidOwner-address-}[`++OwnableInvalidOwner(owner)++`]
  515. --
  516. [.contract-item]
  517. [[ProxyAdmin-constructor-address-]]
  518. ==== `[.contract-item-name]#++constructor++#++(address initialOwner)++` [.item-kind]#public#
  519. Sets the initial owner who can perform upgrades.
  520. [.contract-item]
  521. [[ProxyAdmin-upgradeAndCall-contract-ITransparentUpgradeableProxy-address-bytes-]]
  522. ==== `[.contract-item-name]#++upgradeAndCall++#++(contract ITransparentUpgradeableProxy proxy, address implementation, bytes data)++` [.item-kind]#public#
  523. Upgrades `proxy` to `implementation` and calls a function on the new implementation.
  524. See {TransparentUpgradeableProxy-_dispatchUpgradeToAndCall}.
  525. Requirements:
  526. - This contract must be the admin of `proxy`.
  527. - If `data` is empty, `msg.value` must be zero.
  528. [.contract-item]
  529. [[ProxyAdmin-UPGRADE_INTERFACE_VERSION-string]]
  530. ==== `[.contract-item-name]#++UPGRADE_INTERFACE_VERSION++#++() → string++` [.item-kind]#public#
  531. The version of the upgrade interface of the contract. If this getter is missing, both `upgrade(address,address)`
  532. and `upgradeAndCall(address,address,bytes)` are present, and `upgrade` must be used if no function should be called,
  533. while `upgradeAndCall` will invoke the `receive` function if the third argument is the empty byte string.
  534. If the getter returns `"5.0.0"`, only `upgradeAndCall(address,address,bytes)` is present, and the third argument must
  535. be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
  536. during an upgrade.
  537. == Beacon
  538. :constructor: pass:normal[xref:#BeaconProxy-constructor-address-bytes-[`++constructor++`]]
  539. :_implementation: pass:normal[xref:#BeaconProxy-_implementation--[`++_implementation++`]]
  540. :_getBeacon: pass:normal[xref:#BeaconProxy-_getBeacon--[`++_getBeacon++`]]
  541. :constructor-address-bytes: pass:normal[xref:#BeaconProxy-constructor-address-bytes-[`++constructor++`]]
  542. :_implementation-: pass:normal[xref:#BeaconProxy-_implementation--[`++_implementation++`]]
  543. :_getBeacon-: pass:normal[xref:#BeaconProxy-_getBeacon--[`++_getBeacon++`]]
  544. [.contract]
  545. [[BeaconProxy]]
  546. === `++BeaconProxy++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/beacon/BeaconProxy.sol[{github-icon},role=heading-link]
  547. [.hljs-theme-light.nopadding]
  548. ```solidity
  549. import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
  550. ```
  551. This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.
  552. The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an
  553. immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by
  554. https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] so that it can be accessed externally.
  555. CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust
  556. the beacon to not upgrade the implementation maliciously.
  557. IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in
  558. an inconsistent state where the beacon storage slot does not match the beacon address.
  559. [.contract-index]
  560. .Functions
  561. --
  562. * {xref-BeaconProxy-constructor-address-bytes-}[`++constructor(beacon, data)++`]
  563. * {xref-BeaconProxy-_implementation--}[`++_implementation()++`]
  564. * {xref-BeaconProxy-_getBeacon--}[`++_getBeacon()++`]
  565. [.contract-subindex-inherited]
  566. .Proxy
  567. * {xref-Proxy-_delegate-address-}[`++_delegate(implementation)++`]
  568. * {xref-Proxy-_fallback--}[`++_fallback()++`]
  569. * {xref-Proxy-fallback--}[`++fallback()++`]
  570. --
  571. [.contract-item]
  572. [[BeaconProxy-constructor-address-bytes-]]
  573. ==== `[.contract-item-name]#++constructor++#++(address beacon, bytes data)++` [.item-kind]#public#
  574. Initializes the proxy with `beacon`.
  575. If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
  576. will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity
  577. constructor.
  578. Requirements:
  579. - `beacon` must be a contract with the interface {IBeacon}.
  580. - If `data` is empty, `msg.value` must be zero.
  581. [.contract-item]
  582. [[BeaconProxy-_implementation--]]
  583. ==== `[.contract-item-name]#++_implementation++#++() → address++` [.item-kind]#internal#
  584. Returns the current implementation address of the associated beacon.
  585. [.contract-item]
  586. [[BeaconProxy-_getBeacon--]]
  587. ==== `[.contract-item-name]#++_getBeacon++#++() → address++` [.item-kind]#internal#
  588. Returns the beacon.
  589. :implementation: pass:normal[xref:#IBeacon-implementation--[`++implementation++`]]
  590. :implementation-: pass:normal[xref:#IBeacon-implementation--[`++implementation++`]]
  591. [.contract]
  592. [[IBeacon]]
  593. === `++IBeacon++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/beacon/IBeacon.sol[{github-icon},role=heading-link]
  594. [.hljs-theme-light.nopadding]
  595. ```solidity
  596. import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";
  597. ```
  598. This is the interface that {BeaconProxy} expects of its beacon.
  599. [.contract-index]
  600. .Functions
  601. --
  602. * {xref-IBeacon-implementation--}[`++implementation()++`]
  603. --
  604. [.contract-item]
  605. [[IBeacon-implementation--]]
  606. ==== `[.contract-item-name]#++implementation++#++() → address++` [.item-kind]#external#
  607. Must return an address that can be used as a delegate call target.
  608. {UpgradeableBeacon} will check that this address is a contract.
  609. :BeaconInvalidImplementation: pass:normal[xref:#UpgradeableBeacon-BeaconInvalidImplementation-address-[`++BeaconInvalidImplementation++`]]
  610. :Upgraded: pass:normal[xref:#UpgradeableBeacon-Upgraded-address-[`++Upgraded++`]]
  611. :constructor: pass:normal[xref:#UpgradeableBeacon-constructor-address-address-[`++constructor++`]]
  612. :implementation: pass:normal[xref:#UpgradeableBeacon-implementation--[`++implementation++`]]
  613. :upgradeTo: pass:normal[xref:#UpgradeableBeacon-upgradeTo-address-[`++upgradeTo++`]]
  614. :constructor-address-address: pass:normal[xref:#UpgradeableBeacon-constructor-address-address-[`++constructor++`]]
  615. :implementation-: pass:normal[xref:#UpgradeableBeacon-implementation--[`++implementation++`]]
  616. :upgradeTo-address: pass:normal[xref:#UpgradeableBeacon-upgradeTo-address-[`++upgradeTo++`]]
  617. [.contract]
  618. [[UpgradeableBeacon]]
  619. === `++UpgradeableBeacon++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/beacon/UpgradeableBeacon.sol[{github-icon},role=heading-link]
  620. [.hljs-theme-light.nopadding]
  621. ```solidity
  622. import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
  623. ```
  624. This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their
  625. implementation contract, which is where they will delegate all function calls.
  626. An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.
  627. [.contract-index]
  628. .Functions
  629. --
  630. * {xref-UpgradeableBeacon-constructor-address-address-}[`++constructor(implementation_, initialOwner)++`]
  631. * {xref-UpgradeableBeacon-implementation--}[`++implementation()++`]
  632. * {xref-UpgradeableBeacon-upgradeTo-address-}[`++upgradeTo(newImplementation)++`]
  633. [.contract-subindex-inherited]
  634. .Ownable
  635. * {xref-Ownable-owner--}[`++owner()++`]
  636. * {xref-Ownable-_checkOwner--}[`++_checkOwner()++`]
  637. * {xref-Ownable-renounceOwnership--}[`++renounceOwnership()++`]
  638. * {xref-Ownable-transferOwnership-address-}[`++transferOwnership(newOwner)++`]
  639. * {xref-Ownable-_transferOwnership-address-}[`++_transferOwnership(newOwner)++`]
  640. [.contract-subindex-inherited]
  641. .IBeacon
  642. --
  643. [.contract-index]
  644. .Events
  645. --
  646. * {xref-UpgradeableBeacon-Upgraded-address-}[`++Upgraded(implementation)++`]
  647. [.contract-subindex-inherited]
  648. .Ownable
  649. * {xref-Ownable-OwnershipTransferred-address-address-}[`++OwnershipTransferred(previousOwner, newOwner)++`]
  650. [.contract-subindex-inherited]
  651. .IBeacon
  652. --
  653. [.contract-index]
  654. .Errors
  655. --
  656. * {xref-UpgradeableBeacon-BeaconInvalidImplementation-address-}[`++BeaconInvalidImplementation(implementation)++`]
  657. [.contract-subindex-inherited]
  658. .Ownable
  659. * {xref-Ownable-OwnableUnauthorizedAccount-address-}[`++OwnableUnauthorizedAccount(account)++`]
  660. * {xref-Ownable-OwnableInvalidOwner-address-}[`++OwnableInvalidOwner(owner)++`]
  661. [.contract-subindex-inherited]
  662. .IBeacon
  663. --
  664. [.contract-item]
  665. [[UpgradeableBeacon-constructor-address-address-]]
  666. ==== `[.contract-item-name]#++constructor++#++(address implementation_, address initialOwner)++` [.item-kind]#public#
  667. Sets the address of the initial implementation, and the initial owner who can upgrade the beacon.
  668. [.contract-item]
  669. [[UpgradeableBeacon-implementation--]]
  670. ==== `[.contract-item-name]#++implementation++#++() → address++` [.item-kind]#public#
  671. Returns the current implementation address.
  672. [.contract-item]
  673. [[UpgradeableBeacon-upgradeTo-address-]]
  674. ==== `[.contract-item-name]#++upgradeTo++#++(address newImplementation)++` [.item-kind]#public#
  675. Upgrades the beacon to a new implementation.
  676. Emits an {Upgraded} event.
  677. Requirements:
  678. - msg.sender must be the owner of the contract.
  679. - `newImplementation` must be a contract.
  680. [.contract-item]
  681. [[UpgradeableBeacon-Upgraded-address-]]
  682. ==== `[.contract-item-name]#++Upgraded++#++(address indexed implementation)++` [.item-kind]#event#
  683. Emitted when the implementation returned by the beacon is changed.
  684. [.contract-item]
  685. [[UpgradeableBeacon-BeaconInvalidImplementation-address-]]
  686. ==== `[.contract-item-name]#++BeaconInvalidImplementation++#++(address implementation)++` [.item-kind]#error#
  687. The `implementation` of the beacon is invalid.
  688. == Minimal Clones
  689. :CloneArgumentsTooLong: pass:normal[xref:#Clones-CloneArgumentsTooLong--[`++CloneArgumentsTooLong++`]]
  690. :clone: pass:normal[xref:#Clones-clone-address-[`++clone++`]]
  691. :clone: pass:normal[xref:#Clones-clone-address-uint256-[`++clone++`]]
  692. :cloneDeterministic: pass:normal[xref:#Clones-cloneDeterministic-address-bytes32-[`++cloneDeterministic++`]]
  693. :cloneDeterministic: pass:normal[xref:#Clones-cloneDeterministic-address-bytes32-uint256-[`++cloneDeterministic++`]]
  694. :predictDeterministicAddress: pass:normal[xref:#Clones-predictDeterministicAddress-address-bytes32-address-[`++predictDeterministicAddress++`]]
  695. :predictDeterministicAddress: pass:normal[xref:#Clones-predictDeterministicAddress-address-bytes32-[`++predictDeterministicAddress++`]]
  696. :cloneWithImmutableArgs: pass:normal[xref:#Clones-cloneWithImmutableArgs-address-bytes-[`++cloneWithImmutableArgs++`]]
  697. :cloneWithImmutableArgs: pass:normal[xref:#Clones-cloneWithImmutableArgs-address-bytes-uint256-[`++cloneWithImmutableArgs++`]]
  698. :cloneDeterministicWithImmutableArgs: pass:normal[xref:#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-[`++cloneDeterministicWithImmutableArgs++`]]
  699. :cloneDeterministicWithImmutableArgs: pass:normal[xref:#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256-[`++cloneDeterministicWithImmutableArgs++`]]
  700. :predictDeterministicAddressWithImmutableArgs: pass:normal[xref:#Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-address-[`++predictDeterministicAddressWithImmutableArgs++`]]
  701. :predictDeterministicAddressWithImmutableArgs: pass:normal[xref:#Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-[`++predictDeterministicAddressWithImmutableArgs++`]]
  702. :fetchCloneArgs: pass:normal[xref:#Clones-fetchCloneArgs-address-[`++fetchCloneArgs++`]]
  703. :clone-address: pass:normal[xref:#Clones-clone-address-[`++clone++`]]
  704. :clone-address-uint256: pass:normal[xref:#Clones-clone-address-uint256-[`++clone++`]]
  705. :cloneDeterministic-address-bytes32: pass:normal[xref:#Clones-cloneDeterministic-address-bytes32-[`++cloneDeterministic++`]]
  706. :cloneDeterministic-address-bytes32-uint256: pass:normal[xref:#Clones-cloneDeterministic-address-bytes32-uint256-[`++cloneDeterministic++`]]
  707. :predictDeterministicAddress-address-bytes32-address: pass:normal[xref:#Clones-predictDeterministicAddress-address-bytes32-address-[`++predictDeterministicAddress++`]]
  708. :predictDeterministicAddress-address-bytes32: pass:normal[xref:#Clones-predictDeterministicAddress-address-bytes32-[`++predictDeterministicAddress++`]]
  709. :cloneWithImmutableArgs-address-bytes: pass:normal[xref:#Clones-cloneWithImmutableArgs-address-bytes-[`++cloneWithImmutableArgs++`]]
  710. :cloneWithImmutableArgs-address-bytes-uint256: pass:normal[xref:#Clones-cloneWithImmutableArgs-address-bytes-uint256-[`++cloneWithImmutableArgs++`]]
  711. :cloneDeterministicWithImmutableArgs-address-bytes-bytes32: pass:normal[xref:#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-[`++cloneDeterministicWithImmutableArgs++`]]
  712. :cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256: pass:normal[xref:#Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256-[`++cloneDeterministicWithImmutableArgs++`]]
  713. :predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-address: pass:normal[xref:#Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-address-[`++predictDeterministicAddressWithImmutableArgs++`]]
  714. :predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32: pass:normal[xref:#Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-[`++predictDeterministicAddressWithImmutableArgs++`]]
  715. :fetchCloneArgs-address: pass:normal[xref:#Clones-fetchCloneArgs-address-[`++fetchCloneArgs++`]]
  716. [.contract]
  717. [[Clones]]
  718. === `++Clones++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/Clones.sol[{github-icon},role=heading-link]
  719. [.hljs-theme-light.nopadding]
  720. ```solidity
  721. import "@openzeppelin/contracts/proxy/Clones.sol";
  722. ```
  723. https://eips.ethereum.org/EIPS/eip-1167[ERC-1167] is a standard for
  724. deploying minimal proxy contracts, also known as "clones".
  725. > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
  726. > a minimal bytecode implementation that delegates all calls to a known, fixed address.
  727. The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
  728. (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
  729. deterministic method.
  730. [.contract-index]
  731. .Functions
  732. --
  733. * {xref-Clones-clone-address-}[`++clone(implementation)++`]
  734. * {xref-Clones-clone-address-uint256-}[`++clone(implementation, value)++`]
  735. * {xref-Clones-cloneDeterministic-address-bytes32-}[`++cloneDeterministic(implementation, salt)++`]
  736. * {xref-Clones-cloneDeterministic-address-bytes32-uint256-}[`++cloneDeterministic(implementation, salt, value)++`]
  737. * {xref-Clones-predictDeterministicAddress-address-bytes32-address-}[`++predictDeterministicAddress(implementation, salt, deployer)++`]
  738. * {xref-Clones-predictDeterministicAddress-address-bytes32-}[`++predictDeterministicAddress(implementation, salt)++`]
  739. * {xref-Clones-cloneWithImmutableArgs-address-bytes-}[`++cloneWithImmutableArgs(implementation, args)++`]
  740. * {xref-Clones-cloneWithImmutableArgs-address-bytes-uint256-}[`++cloneWithImmutableArgs(implementation, args, value)++`]
  741. * {xref-Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-}[`++cloneDeterministicWithImmutableArgs(implementation, args, salt)++`]
  742. * {xref-Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256-}[`++cloneDeterministicWithImmutableArgs(implementation, args, salt, value)++`]
  743. * {xref-Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-address-}[`++predictDeterministicAddressWithImmutableArgs(implementation, args, salt, deployer)++`]
  744. * {xref-Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-}[`++predictDeterministicAddressWithImmutableArgs(implementation, args, salt)++`]
  745. * {xref-Clones-fetchCloneArgs-address-}[`++fetchCloneArgs(instance)++`]
  746. --
  747. [.contract-index]
  748. .Errors
  749. --
  750. * {xref-Clones-CloneArgumentsTooLong--}[`++CloneArgumentsTooLong()++`]
  751. --
  752. [.contract-item]
  753. [[Clones-clone-address-]]
  754. ==== `[.contract-item-name]#++clone++#++(address implementation) → address instance++` [.item-kind]#internal#
  755. Deploys and returns the address of a clone that mimics the behavior of `implementation`.
  756. This function uses the create opcode, which should never revert.
  757. WARNING: This function does not check if `implementation` has code. A clone that points to an address
  758. without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
  759. have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
  760. [.contract-item]
  761. [[Clones-clone-address-uint256-]]
  762. ==== `[.contract-item-name]#++clone++#++(address implementation, uint256 value) → address instance++` [.item-kind]#internal#
  763. Same as {xref-Clones-clone-address-}[clone], but with a `value` parameter to send native currency
  764. to the new contract.
  765. WARNING: This function does not check if `implementation` has code. A clone that points to an address
  766. without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
  767. have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
  768. NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
  769. to always have enough balance for new deployments. Consider exposing this function under a payable method.
  770. [.contract-item]
  771. [[Clones-cloneDeterministic-address-bytes32-]]
  772. ==== `[.contract-item-name]#++cloneDeterministic++#++(address implementation, bytes32 salt) → address instance++` [.item-kind]#internal#
  773. Deploys and returns the address of a clone that mimics the behavior of `implementation`.
  774. This function uses the create2 opcode and a `salt` to deterministically deploy
  775. the clone. Using the same `implementation` and `salt` multiple times will revert, since
  776. the clones cannot be deployed twice at the same address.
  777. WARNING: This function does not check if `implementation` has code. A clone that points to an address
  778. without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
  779. have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
  780. [.contract-item]
  781. [[Clones-cloneDeterministic-address-bytes32-uint256-]]
  782. ==== `[.contract-item-name]#++cloneDeterministic++#++(address implementation, bytes32 salt, uint256 value) → address instance++` [.item-kind]#internal#
  783. Same as {xref-Clones-cloneDeterministic-address-bytes32-}[cloneDeterministic], but with
  784. a `value` parameter to send native currency to the new contract.
  785. WARNING: This function does not check if `implementation` has code. A clone that points to an address
  786. without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
  787. have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
  788. NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
  789. to always have enough balance for new deployments. Consider exposing this function under a payable method.
  790. [.contract-item]
  791. [[Clones-predictDeterministicAddress-address-bytes32-address-]]
  792. ==== `[.contract-item-name]#++predictDeterministicAddress++#++(address implementation, bytes32 salt, address deployer) → address predicted++` [.item-kind]#internal#
  793. Computes the address of a clone deployed using {Clones-cloneDeterministic}.
  794. [.contract-item]
  795. [[Clones-predictDeterministicAddress-address-bytes32-]]
  796. ==== `[.contract-item-name]#++predictDeterministicAddress++#++(address implementation, bytes32 salt) → address predicted++` [.item-kind]#internal#
  797. Computes the address of a clone deployed using {Clones-cloneDeterministic}.
  798. [.contract-item]
  799. [[Clones-cloneWithImmutableArgs-address-bytes-]]
  800. ==== `[.contract-item-name]#++cloneWithImmutableArgs++#++(address implementation, bytes args) → address instance++` [.item-kind]#internal#
  801. Deploys and returns the address of a clone that mimics the behavior of `implementation` with custom
  802. immutable arguments. These are provided through `args` and cannot be changed after deployment. To
  803. access the arguments within the implementation, use {fetchCloneArgs}.
  804. This function uses the create opcode, which should never revert.
  805. WARNING: This function does not check if `implementation` has code. A clone that points to an address
  806. without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
  807. have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
  808. [.contract-item]
  809. [[Clones-cloneWithImmutableArgs-address-bytes-uint256-]]
  810. ==== `[.contract-item-name]#++cloneWithImmutableArgs++#++(address implementation, bytes args, uint256 value) → address instance++` [.item-kind]#internal#
  811. Same as {xref-Clones-cloneWithImmutableArgs-address-bytes-}[cloneWithImmutableArgs], but with a `value`
  812. parameter to send native currency to the new contract.
  813. WARNING: This function does not check if `implementation` has code. A clone that points to an address
  814. without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
  815. have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
  816. NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
  817. to always have enough balance for new deployments. Consider exposing this function under a payable method.
  818. [.contract-item]
  819. [[Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-]]
  820. ==== `[.contract-item-name]#++cloneDeterministicWithImmutableArgs++#++(address implementation, bytes args, bytes32 salt) → address instance++` [.item-kind]#internal#
  821. Deploys and returns the address of a clone that mimics the behavior of `implementation` with custom
  822. immutable arguments. These are provided through `args` and cannot be changed after deployment. To
  823. access the arguments within the implementation, use {fetchCloneArgs}.
  824. This function uses the create2 opcode and a `salt` to deterministically deploy the clone. Using the same
  825. `implementation`, `args` and `salt` multiple times will revert, since the clones cannot be deployed twice
  826. at the same address.
  827. WARNING: This function does not check if `implementation` has code. A clone that points to an address
  828. without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
  829. have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
  830. [.contract-item]
  831. [[Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-uint256-]]
  832. ==== `[.contract-item-name]#++cloneDeterministicWithImmutableArgs++#++(address implementation, bytes args, bytes32 salt, uint256 value) → address instance++` [.item-kind]#internal#
  833. Same as {xref-Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-}[cloneDeterministicWithImmutableArgs],
  834. but with a `value` parameter to send native currency to the new contract.
  835. WARNING: This function does not check if `implementation` has code. A clone that points to an address
  836. without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
  837. have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
  838. NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
  839. to always have enough balance for new deployments. Consider exposing this function under a payable method.
  840. [.contract-item]
  841. [[Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-address-]]
  842. ==== `[.contract-item-name]#++predictDeterministicAddressWithImmutableArgs++#++(address implementation, bytes args, bytes32 salt, address deployer) → address predicted++` [.item-kind]#internal#
  843. Computes the address of a clone deployed using {Clones-cloneDeterministicWithImmutableArgs}.
  844. [.contract-item]
  845. [[Clones-predictDeterministicAddressWithImmutableArgs-address-bytes-bytes32-]]
  846. ==== `[.contract-item-name]#++predictDeterministicAddressWithImmutableArgs++#++(address implementation, bytes args, bytes32 salt) → address predicted++` [.item-kind]#internal#
  847. Computes the address of a clone deployed using {Clones-cloneDeterministicWithImmutableArgs}.
  848. [.contract-item]
  849. [[Clones-fetchCloneArgs-address-]]
  850. ==== `[.contract-item-name]#++fetchCloneArgs++#++(address instance) → bytes++` [.item-kind]#internal#
  851. Get the immutable args attached to a clone.
  852. - If `instance` is a clone that was deployed using `clone` or `cloneDeterministic`, this
  853. function will return an empty array.
  854. - If `instance` is a clone that was deployed using `cloneWithImmutableArgs` or
  855. `cloneDeterministicWithImmutableArgs`, this function will return the args array used at
  856. creation.
  857. - If `instance` is NOT a clone deployed using this library, the behavior is undefined. This
  858. function should only be used to check addresses that are known to be clones.
  859. [.contract-item]
  860. [[Clones-CloneArgumentsTooLong--]]
  861. ==== `[.contract-item-name]#++CloneArgumentsTooLong++#++()++` [.item-kind]#error#
  862. == Utils
  863. :InitializableStorage: pass:normal[xref:#Initializable-InitializableStorage[`++InitializableStorage++`]]
  864. :InvalidInitialization: pass:normal[xref:#Initializable-InvalidInitialization--[`++InvalidInitialization++`]]
  865. :NotInitializing: pass:normal[xref:#Initializable-NotInitializing--[`++NotInitializing++`]]
  866. :Initialized: pass:normal[xref:#Initializable-Initialized-uint64-[`++Initialized++`]]
  867. :initializer: pass:normal[xref:#Initializable-initializer--[`++initializer++`]]
  868. :reinitializer: pass:normal[xref:#Initializable-reinitializer-uint64-[`++reinitializer++`]]
  869. :onlyInitializing: pass:normal[xref:#Initializable-onlyInitializing--[`++onlyInitializing++`]]
  870. :_checkInitializing: pass:normal[xref:#Initializable-_checkInitializing--[`++_checkInitializing++`]]
  871. :_disableInitializers: pass:normal[xref:#Initializable-_disableInitializers--[`++_disableInitializers++`]]
  872. :_getInitializedVersion: pass:normal[xref:#Initializable-_getInitializedVersion--[`++_getInitializedVersion++`]]
  873. :_isInitializing: pass:normal[xref:#Initializable-_isInitializing--[`++_isInitializing++`]]
  874. :_initializableStorageSlot: pass:normal[xref:#Initializable-_initializableStorageSlot--[`++_initializableStorageSlot++`]]
  875. :_checkInitializing-: pass:normal[xref:#Initializable-_checkInitializing--[`++_checkInitializing++`]]
  876. :_disableInitializers-: pass:normal[xref:#Initializable-_disableInitializers--[`++_disableInitializers++`]]
  877. :_getInitializedVersion-: pass:normal[xref:#Initializable-_getInitializedVersion--[`++_getInitializedVersion++`]]
  878. :_isInitializing-: pass:normal[xref:#Initializable-_isInitializing--[`++_isInitializing++`]]
  879. :_initializableStorageSlot-: pass:normal[xref:#Initializable-_initializableStorageSlot--[`++_initializableStorageSlot++`]]
  880. [.contract]
  881. [[Initializable]]
  882. === `++Initializable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/utils/Initializable.sol[{github-icon},role=heading-link]
  883. [.hljs-theme-light.nopadding]
  884. ```solidity
  885. import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
  886. ```
  887. This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
  888. behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
  889. external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
  890. function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
  891. The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
  892. reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
  893. case an upgrade adds a module that needs to be initialized.
  894. For example:
  895. [.hljs-theme-light.nopadding]
  896. ```solidity
  897. contract MyToken is ERC20Upgradeable {
  898. function initialize() initializer public {
  899. __ERC20_init("MyToken", "MTK");
  900. }
  901. }
  902. contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
  903. function initializeV2() reinitializer(2) public {
  904. __ERC20Permit_init("MyToken");
  905. }
  906. }
  907. ```
  908. TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
  909. possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
  910. CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
  911. that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
  912. [CAUTION]
  913. ====
  914. Avoid leaving a contract uninitialized.
  915. An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
  916. contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
  917. the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
  918. [.hljs-theme-light.nopadding]
  919. ```
  920. /// @custom:oz-upgrades-unsafe-allow constructor
  921. constructor() {
  922. _disableInitializers();
  923. }
  924. ```
  925. ====
  926. [.contract-index]
  927. .Modifiers
  928. --
  929. * {xref-Initializable-initializer--}[`++initializer()++`]
  930. * {xref-Initializable-reinitializer-uint64-}[`++reinitializer(version)++`]
  931. * {xref-Initializable-onlyInitializing--}[`++onlyInitializing()++`]
  932. --
  933. [.contract-index]
  934. .Functions
  935. --
  936. * {xref-Initializable-_checkInitializing--}[`++_checkInitializing()++`]
  937. * {xref-Initializable-_disableInitializers--}[`++_disableInitializers()++`]
  938. * {xref-Initializable-_getInitializedVersion--}[`++_getInitializedVersion()++`]
  939. * {xref-Initializable-_isInitializing--}[`++_isInitializing()++`]
  940. * {xref-Initializable-_initializableStorageSlot--}[`++_initializableStorageSlot()++`]
  941. --
  942. [.contract-index]
  943. .Events
  944. --
  945. * {xref-Initializable-Initialized-uint64-}[`++Initialized(version)++`]
  946. --
  947. [.contract-index]
  948. .Errors
  949. --
  950. * {xref-Initializable-InvalidInitialization--}[`++InvalidInitialization()++`]
  951. * {xref-Initializable-NotInitializing--}[`++NotInitializing()++`]
  952. --
  953. [.contract-item]
  954. [[Initializable-initializer--]]
  955. ==== `[.contract-item-name]#++initializer++#++()++` [.item-kind]#modifier#
  956. A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
  957. `onlyInitializing` functions can be used to initialize parent contracts.
  958. Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
  959. number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
  960. production.
  961. Emits an {Initialized} event.
  962. [.contract-item]
  963. [[Initializable-reinitializer-uint64-]]
  964. ==== `[.contract-item-name]#++reinitializer++#++(uint64 version)++` [.item-kind]#modifier#
  965. A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
  966. contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
  967. used to initialize parent contracts.
  968. A reinitializer may be used after the original initialization step. This is essential to configure modules that
  969. are added through upgrades and that require initialization.
  970. When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
  971. cannot be nested. If one is invoked in the context of another, execution will revert.
  972. Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
  973. a contract, executing them in the right order is up to the developer or operator.
  974. WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
  975. Emits an {Initialized} event.
  976. [.contract-item]
  977. [[Initializable-onlyInitializing--]]
  978. ==== `[.contract-item-name]#++onlyInitializing++#++()++` [.item-kind]#modifier#
  979. Modifier to protect an initialization function so that it can only be invoked by functions with the
  980. {initializer} and {reinitializer} modifiers, directly or indirectly.
  981. [.contract-item]
  982. [[Initializable-_checkInitializing--]]
  983. ==== `[.contract-item-name]#++_checkInitializing++#++()++` [.item-kind]#internal#
  984. Reverts if the contract is not in an initializing state. See {onlyInitializing}.
  985. [.contract-item]
  986. [[Initializable-_disableInitializers--]]
  987. ==== `[.contract-item-name]#++_disableInitializers++#++()++` [.item-kind]#internal#
  988. Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
  989. Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
  990. to any version. It is recommended to use this to lock implementation contracts that are designed to be called
  991. through proxies.
  992. Emits an {Initialized} event the first time it is successfully executed.
  993. [.contract-item]
  994. [[Initializable-_getInitializedVersion--]]
  995. ==== `[.contract-item-name]#++_getInitializedVersion++#++() → uint64++` [.item-kind]#internal#
  996. Returns the highest version that has been initialized. See {reinitializer}.
  997. [.contract-item]
  998. [[Initializable-_isInitializing--]]
  999. ==== `[.contract-item-name]#++_isInitializing++#++() → bool++` [.item-kind]#internal#
  1000. Returns `true` if the contract is currently initializing. See {onlyInitializing}.
  1001. [.contract-item]
  1002. [[Initializable-_initializableStorageSlot--]]
  1003. ==== `[.contract-item-name]#++_initializableStorageSlot++#++() → bytes32++` [.item-kind]#internal#
  1004. Pointer to storage slot. Allows integrators to override it with a custom storage location.
  1005. NOTE: Consider following the ERC-7201 formula to derive storage locations.
  1006. [.contract-item]
  1007. [[Initializable-Initialized-uint64-]]
  1008. ==== `[.contract-item-name]#++Initialized++#++(uint64 version)++` [.item-kind]#event#
  1009. Triggered when the contract has been initialized or reinitialized.
  1010. [.contract-item]
  1011. [[Initializable-InvalidInitialization--]]
  1012. ==== `[.contract-item-name]#++InvalidInitialization++#++()++` [.item-kind]#error#
  1013. The contract is already initialized.
  1014. [.contract-item]
  1015. [[Initializable-NotInitializing--]]
  1016. ==== `[.contract-item-name]#++NotInitializing++#++()++` [.item-kind]#error#
  1017. The contract is not initializing.
  1018. :UPGRADE_INTERFACE_VERSION: pass:normal[xref:#UUPSUpgradeable-UPGRADE_INTERFACE_VERSION-string[`++UPGRADE_INTERFACE_VERSION++`]]
  1019. :UUPSUnauthorizedCallContext: pass:normal[xref:#UUPSUpgradeable-UUPSUnauthorizedCallContext--[`++UUPSUnauthorizedCallContext++`]]
  1020. :UUPSUnsupportedProxiableUUID: pass:normal[xref:#UUPSUpgradeable-UUPSUnsupportedProxiableUUID-bytes32-[`++UUPSUnsupportedProxiableUUID++`]]
  1021. :onlyProxy: pass:normal[xref:#UUPSUpgradeable-onlyProxy--[`++onlyProxy++`]]
  1022. :notDelegated: pass:normal[xref:#UUPSUpgradeable-notDelegated--[`++notDelegated++`]]
  1023. :proxiableUUID: pass:normal[xref:#UUPSUpgradeable-proxiableUUID--[`++proxiableUUID++`]]
  1024. :upgradeToAndCall: pass:normal[xref:#UUPSUpgradeable-upgradeToAndCall-address-bytes-[`++upgradeToAndCall++`]]
  1025. :_checkProxy: pass:normal[xref:#UUPSUpgradeable-_checkProxy--[`++_checkProxy++`]]
  1026. :_checkNotDelegated: pass:normal[xref:#UUPSUpgradeable-_checkNotDelegated--[`++_checkNotDelegated++`]]
  1027. :_authorizeUpgrade: pass:normal[xref:#UUPSUpgradeable-_authorizeUpgrade-address-[`++_authorizeUpgrade++`]]
  1028. :proxiableUUID-: pass:normal[xref:#UUPSUpgradeable-proxiableUUID--[`++proxiableUUID++`]]
  1029. :upgradeToAndCall-address-bytes: pass:normal[xref:#UUPSUpgradeable-upgradeToAndCall-address-bytes-[`++upgradeToAndCall++`]]
  1030. :_checkProxy-: pass:normal[xref:#UUPSUpgradeable-_checkProxy--[`++_checkProxy++`]]
  1031. :_checkNotDelegated-: pass:normal[xref:#UUPSUpgradeable-_checkNotDelegated--[`++_checkNotDelegated++`]]
  1032. :_authorizeUpgrade-address: pass:normal[xref:#UUPSUpgradeable-_authorizeUpgrade-address-[`++_authorizeUpgrade++`]]
  1033. :UPGRADE_INTERFACE_VERSION-string: pass:normal[xref:#UUPSUpgradeable-UPGRADE_INTERFACE_VERSION-string[`++UPGRADE_INTERFACE_VERSION++`]]
  1034. [.contract]
  1035. [[UUPSUpgradeable]]
  1036. === `++UUPSUpgradeable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.4.0/contracts/proxy/utils/UUPSUpgradeable.sol[{github-icon},role=heading-link]
  1037. [.hljs-theme-light.nopadding]
  1038. ```solidity
  1039. import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
  1040. ```
  1041. An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
  1042. {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
  1043. A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
  1044. reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
  1045. `UUPSUpgradeable` with a custom implementation of upgrades.
  1046. The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
  1047. [.contract-index]
  1048. .Modifiers
  1049. --
  1050. * {xref-UUPSUpgradeable-onlyProxy--}[`++onlyProxy()++`]
  1051. * {xref-UUPSUpgradeable-notDelegated--}[`++notDelegated()++`]
  1052. --
  1053. [.contract-index]
  1054. .Functions
  1055. --
  1056. * {xref-UUPSUpgradeable-proxiableUUID--}[`++proxiableUUID()++`]
  1057. * {xref-UUPSUpgradeable-upgradeToAndCall-address-bytes-}[`++upgradeToAndCall(newImplementation, data)++`]
  1058. * {xref-UUPSUpgradeable-_checkProxy--}[`++_checkProxy()++`]
  1059. * {xref-UUPSUpgradeable-_checkNotDelegated--}[`++_checkNotDelegated()++`]
  1060. * {xref-UUPSUpgradeable-_authorizeUpgrade-address-}[`++_authorizeUpgrade(newImplementation)++`]
  1061. * {xref-UUPSUpgradeable-UPGRADE_INTERFACE_VERSION-string}[`++UPGRADE_INTERFACE_VERSION()++`]
  1062. [.contract-subindex-inherited]
  1063. .IERC1822Proxiable
  1064. --
  1065. [.contract-index]
  1066. .Errors
  1067. --
  1068. * {xref-UUPSUpgradeable-UUPSUnauthorizedCallContext--}[`++UUPSUnauthorizedCallContext()++`]
  1069. * {xref-UUPSUpgradeable-UUPSUnsupportedProxiableUUID-bytes32-}[`++UUPSUnsupportedProxiableUUID(slot)++`]
  1070. [.contract-subindex-inherited]
  1071. .IERC1822Proxiable
  1072. --
  1073. [.contract-item]
  1074. [[UUPSUpgradeable-onlyProxy--]]
  1075. ==== `[.contract-item-name]#++onlyProxy++#++()++` [.item-kind]#modifier#
  1076. Check that the execution is being performed through a delegatecall call and that the execution context is
  1077. a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case
  1078. for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
  1079. function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
  1080. fail.
  1081. [.contract-item]
  1082. [[UUPSUpgradeable-notDelegated--]]
  1083. ==== `[.contract-item-name]#++notDelegated++#++()++` [.item-kind]#modifier#
  1084. Check that the execution is not being performed through a delegate call. This allows a function to be
  1085. callable on the implementing contract but not through proxies.
  1086. [.contract-item]
  1087. [[UUPSUpgradeable-proxiableUUID--]]
  1088. ==== `[.contract-item-name]#++proxiableUUID++#++() → bytes32++` [.item-kind]#external#
  1089. Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the
  1090. implementation. It is used to validate the implementation's compatibility when performing an upgrade.
  1091. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
  1092. bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
  1093. function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
  1094. [.contract-item]
  1095. [[UUPSUpgradeable-upgradeToAndCall-address-bytes-]]
  1096. ==== `[.contract-item-name]#++upgradeToAndCall++#++(address newImplementation, bytes data)++` [.item-kind]#public#
  1097. Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
  1098. encoded in `data`.
  1099. Calls {_authorizeUpgrade}.
  1100. Emits an {Upgraded} event.
  1101. [.contract-item]
  1102. [[UUPSUpgradeable-_checkProxy--]]
  1103. ==== `[.contract-item-name]#++_checkProxy++#++()++` [.item-kind]#internal#
  1104. Reverts if the execution is not performed via delegatecall or the execution
  1105. context is not of a proxy with an ERC-1967 compliant implementation pointing to self.
  1106. [.contract-item]
  1107. [[UUPSUpgradeable-_checkNotDelegated--]]
  1108. ==== `[.contract-item-name]#++_checkNotDelegated++#++()++` [.item-kind]#internal#
  1109. Reverts if the execution is performed via delegatecall.
  1110. See {notDelegated}.
  1111. [.contract-item]
  1112. [[UUPSUpgradeable-_authorizeUpgrade-address-]]
  1113. ==== `[.contract-item-name]#++_authorizeUpgrade++#++(address newImplementation)++` [.item-kind]#internal#
  1114. Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
  1115. {upgradeToAndCall}.
  1116. Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
  1117. ```solidity
  1118. function _authorizeUpgrade(address) internal onlyOwner {}
  1119. ```
  1120. [.contract-item]
  1121. [[UUPSUpgradeable-UPGRADE_INTERFACE_VERSION-string]]
  1122. ==== `[.contract-item-name]#++UPGRADE_INTERFACE_VERSION++#++() → string++` [.item-kind]#public#
  1123. The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
  1124. and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
  1125. while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
  1126. If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
  1127. be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
  1128. during an upgrade.
  1129. [.contract-item]
  1130. [[UUPSUpgradeable-UUPSUnauthorizedCallContext--]]
  1131. ==== `[.contract-item-name]#++UUPSUnauthorizedCallContext++#++()++` [.item-kind]#error#
  1132. The call is from an unauthorized context.
  1133. [.contract-item]
  1134. [[UUPSUpgradeable-UUPSUnsupportedProxiableUUID-bytes32-]]
  1135. ==== `[.contract-item-name]#++UUPSUnsupportedProxiableUUID++#++(bytes32 slot)++` [.item-kind]#error#
  1136. The storage `slot` is unsupported as a UUID.