@@ -461,3 +458,4 @@ Internal version of [`AccessManagerLight._setRequirements`](#AccessManagerLight-
+
diff --git a/content/community-contracts/api/account.mdx b/content/community-contracts/api/account.mdx
index 6fe89546..bc1f6c66 100644
--- a/content/community-contracts/api/account.mdx
+++ b/content/community-contracts/api/account.mdx
@@ -60,22 +60,22 @@ This directory includes contracts to build accounts for ERC-4337. These include:
```solidity
-import "@openzeppelin/community-contracts/account/modules/ERC7579DelayedExecutor.sol";
+import "@openzeppelin/community-contracts/contracts/account/modules/ERC7579DelayedExecutor.sol";
```
Extension of [`ERC7579Executor`](#ERC7579Executor) that allows scheduling and executing delayed operations
with expiration. This module enables time-delayed execution patterns for smart accounts.
-==== Operation Lifecycle
+#### Operation Lifecycle
1. Scheduling: Operations are scheduled via [`ERC7579DelayedExecutor.schedule`](#ERC7579DelayedExecutor-schedule-address-bytes32-bytes32-bytes-) with a specified delay period.
The delay period is set during [`ERC7579DelayedExecutor.onInstall`](#ERC7579DelayedExecutor-onInstall-bytes-) and can be customized via [`ERC7579DelayedExecutor.setDelay`](#ERC7579DelayedExecutor-setDelay-uint32-). Each
@@ -90,7 +90,7 @@ Operations can be executed via [`ERC7579Executor.execute`](#ERC7579Executor-exec
executable. If an operation is not executed within the expiration period, it becomes `Expired`
and can't be executed. Expired operations must be rescheduled with a different salt.
-==== Delay Management
+#### Delay Management
Accounts can set their own delay periods during installation or via [`ERC7579DelayedExecutor.setDelay`](#ERC7579DelayedExecutor-setDelay-uint32-).
The delay period is enforced even between installas and uninstalls to prevent
@@ -98,7 +98,7 @@ immediate downgrades. When setting a new delay period, the new delay takes effec
after a transition period defined by the current delay or [`ERC7579DelayedExecutor.minSetback`](#ERC7579DelayedExecutor-minSetback--), whichever
is longer.
-==== Authorization
+#### Authorization
Authorization for scheduling and canceling operations is controlled through the [`ERC7579DelayedExecutor._validateSchedule`](#ERC7579DelayedExecutor-_validateSchedule-address-bytes32-bytes32-bytes-)
and [`ERC7579DelayedExecutor._validateCancel`](#ERC7579DelayedExecutor-_validateCancel-address-bytes32-bytes32-bytes-) functions. These functions can be overridden to implement custom
@@ -137,10 +137,13 @@ useful to pre-schedule operations for non-deployed accounts (e.g. subscriptions)
- [_cancel(account, mode, executionCalldata, salt)](#ERC7579DelayedExecutor-_cancel-address-bytes32-bytes-bytes32-)
- [_validateStateBitmap(operationId, allowedStates)](#ERC7579DelayedExecutor-_validateStateBitmap-bytes32-bytes32-)
- [_encodeStateBitmap(operationState)](#ERC7579DelayedExecutor-_encodeStateBitmap-enum-ERC7579DelayedExecutor-OperationState-)
-#### ERC7579Executor [!toc]
+
+ERC7579Executor
+
- [isModuleType(moduleTypeId)](#ERC7579Executor-isModuleType-uint256-)
- [execute(account, salt, mode, data)](#ERC7579Executor-execute-address-bytes32-bytes32-bytes-)
-#### IERC7579Module [!toc]
+
+
@@ -151,9 +154,12 @@ useful to pre-schedule operations for non-deployed accounts (e.g. subscriptions)
- [ERC7579ExecutorOperationCanceled(account, operationId)](#ERC7579DelayedExecutor-ERC7579ExecutorOperationCanceled-address-bytes32-)
- [ERC7579ExecutorDelayUpdated(account, newDelay, effectTime)](#ERC7579DelayedExecutor-ERC7579ExecutorDelayUpdated-address-uint32-uint48-)
- [ERC7579ExecutorExpirationUpdated(account, newExpiration)](#ERC7579DelayedExecutor-ERC7579ExecutorExpirationUpdated-address-uint32-)
-#### ERC7579Executor [!toc]
+
+ERC7579Executor
+
- [ERC7579ExecutorOperationExecuted(account, salt, mode, executionCalldata)](#ERC7579Executor-ERC7579ExecutorOperationExecuted-address-bytes32-bytes32-bytes-)
-#### IERC7579Module [!toc]
+
+
@@ -162,8 +168,6 @@ useful to pre-schedule operations for non-deployed accounts (e.g. subscriptions)
-Validates the current threshold is reachable with the number of [`ERC7579Multisig._signersSetByAccount`](#ERC7579Multisig-_signersSetByAccount-mapping-address----struct-EnumerableSet-BytesSet-).
+Validates the current threshold is reachable with the number of `signers`.
Requirements:
@@ -1532,16 +1535,16 @@ The `threshold` is unreachable given the number of `signers`.
@@ -1851,7 +1874,7 @@ invalid signers won't be executable. See [`ERC7579Multisig._validateSignatures`]
See [`ERC7579Multisig._validateSignatures`](#ERC7579Multisig-_validateSignatures-address-bytes32-bytes---bytes---).
If a signature is empty, it indicates a presignature and the validation will check the storage mapping
-instead of cryptographic verification. See [`ERC7579Multisig._signersSetByAccount`](#ERC7579Multisig-_signersSetByAccount-mapping-address----struct-EnumerableSet-BytesSet-) for more details.
+instead of cryptographic verification. See `sign` for more details.
@@ -1878,16 +1901,16 @@ Emitted when a signer signs a hash
```solidity
-import "@openzeppelin/community-contracts/account/modules/ERC7579MultisigWeighted.sol";
+import "@openzeppelin/community-contracts/contracts/account/modules/ERC7579MultisigWeighted.sol";
```
Extension of [`ERC7579Multisig`](#ERC7579Multisig) that supports weighted signatures.
@@ -1922,7 +1945,9 @@ signatures with a total weight of at least 4 (e.g., one with weight 1 and one wi
- [_removeSigners(account, oldSigners)](#ERC7579MultisigWeighted-_removeSigners-address-bytes---)
- [_validateReachableThreshold(account)](#ERC7579MultisigWeighted-_validateReachableThreshold-address-)
- [_validateThreshold(account, validatingSigners)](#ERC7579MultisigWeighted-_validateThreshold-address-bytes---)
-#### ERC7579Multisig [!toc]
+
+ERC7579Multisig
+
- [getSigners(account, start, end)](#ERC7579Multisig-getSigners-address-uint64-uint64-)
- [getSignerCount(account)](#ERC7579Multisig-getSignerCount-address-)
- [isSigner(account, signer)](#ERC7579Multisig-isSigner-address-bytes-)
@@ -1933,12 +1958,16 @@ signatures with a total weight of at least 4 (e.g., one with weight 1 and one wi
- [_rawERC7579Validation(account, hash, signature)](#ERC7579Multisig-_rawERC7579Validation-address-bytes32-bytes-)
- [_setThreshold(account, newThreshold)](#ERC7579Multisig-_setThreshold-address-uint64-)
- [_validateSignatures(account, hash, signingSigners, signatures)](#ERC7579Multisig-_validateSignatures-address-bytes32-bytes---bytes---)
-#### ERC7579Validator [!toc]
+
+
+
+ERC7579Validator
+
- [isModuleType(moduleTypeId)](#ERC7579Validator-isModuleType-uint256-)
- [validateUserOp(userOp, userOpHash)](#ERC7579Validator-validateUserOp-struct-PackedUserOperation-bytes32-)
- [isValidSignatureWithSender(, hash, signature)](#ERC7579Validator-isValidSignatureWithSender-address-bytes32-bytes-)
-#### IERC7579Validator [!toc]
-#### IERC7579Module [!toc]
+
+
@@ -1946,13 +1975,14 @@ signatures with a total weight of at least 4 (e.g., one with weight 1 and one wi
```solidity
-import "@openzeppelin/community-contracts/account/modules/ERC7579SelectorExecutor.sol";
+import "@openzeppelin/community-contracts/contracts/account/modules/ERC7579SelectorExecutor.sol";
```
Implementation of an [`ERC7579Executor`](#ERC7579Executor) that allows authorizing specific function selectors
@@ -2281,11 +2312,14 @@ in the set will be allowed to execute.
- [_addSelectors(account, newSelectors)](#ERC7579SelectorExecutor-_addSelectors-address-bytes4---)
- [_removeSelectors(account, oldSelectors)](#ERC7579SelectorExecutor-_removeSelectors-address-bytes4---)
- [_validateExecution(account, , , data)](#ERC7579SelectorExecutor-_validateExecution-address-bytes32-bytes32-bytes-)
-#### ERC7579Executor [!toc]
+
+ERC7579Executor
+
- [isModuleType(moduleTypeId)](#ERC7579Executor-isModuleType-uint256-)
- [execute(account, salt, mode, data)](#ERC7579Executor-execute-address-bytes32-bytes32-bytes-)
- [_execute(account, mode, salt, executionCalldata)](#ERC7579Executor-_execute-address-bytes32-bytes32-bytes-)
-#### IERC7579Module [!toc]
+
+
@@ -2294,9 +2328,12 @@ in the set will be allowed to execute.
@@ -2381,7 +2416,7 @@ Clears all selectors.
This function has unbounded gas costs and may become uncallable if the set grows too large.
-See [`EnumerableSetExtended.clear`](./utils#EnumerableSetExtended-clear-struct-EnumerableSetExtended-Bytes32x2Set-).
+See [`EnumerableSetExtended.clear`](/community-contracts/api/utils#EnumerableSetExtended-clear-struct-EnumerableSetExtended-Bytes32x2Set-).
@@ -2529,16 +2564,16 @@ Error thrown when attempting to execute a non-authorized selector
@@ -3438,7 +3474,7 @@ The values returned by this internal function are:
* `token`: Address of the ERC-20 token used for payment to the paymaster.
* `tokenPrice`: Price of the token in native currency, scaled by `_tokenPriceDenominator()`.
-==== Calculating the token price
+#### Calculating the token price
Given gas fees are paid in native currency, developers can use the `ERC20 price unit / native price unit` ratio to
calculate the price of an ERC20 token price in native currency. However, the token may have a different number of decimals
@@ -3563,16 +3599,16 @@ and the `actualAmount` of `token`.
```solidity
-import "@openzeppelin/community-contracts/account/paymaster/PaymasterERC20Guarantor.sol";
+import "@openzeppelin/community-contracts/contracts/account/paymaster/PaymasterERC20Guarantor.sol";
```
Extension of [`PaymasterERC20`](#PaymasterERC20) that enables third parties to guarantee user operations.
@@ -3600,7 +3636,9 @@ logic based on the specific requirements of the application.
- [_refund(token, tokenPrice, actualGasCost, actualUserOpFeePerGas, prefunder, prefundAmount, prefundContext)](#PaymasterERC20Guarantor-_refund-contract-IERC20-uint256-uint256-uint256-address-uint256-bytes-)
- [_fetchGuarantor(userOp)](#PaymasterERC20Guarantor-_fetchGuarantor-struct-PackedUserOperation-)
- [_guaranteedPostOpCost()](#PaymasterERC20Guarantor-_guaranteedPostOpCost--)
-#### PaymasterERC20 [!toc]
+
+PaymasterERC20
+
- [_validatePaymasterUserOp(userOp, userOpHash, maxCost)](#PaymasterERC20-_validatePaymasterUserOp-struct-PackedUserOperation-bytes32-uint256-)
- [_postOp(, context, actualGasCost, actualUserOpFeePerGas)](#PaymasterERC20-_postOp-enum-IPaymaster-PostOpMode-bytes-uint256-uint256-)
- [_fetchDetails(userOp, userOpHash)](#PaymasterERC20-_fetchDetails-struct-PackedUserOperation-bytes32-)
@@ -3608,7 +3646,11 @@ logic based on the specific requirements of the application.
- [_tokenPriceDenominator()](#PaymasterERC20-_tokenPriceDenominator--)
- [_erc20Cost(cost, feePerGas, tokenPrice)](#PaymasterERC20-_erc20Cost-uint256-uint256-uint256-)
- [withdrawTokens(token, recipient, amount)](#PaymasterERC20-withdrawTokens-contract-IERC20-address-uint256-)
-#### PaymasterCore [!toc]
+
+
+
+PaymasterCore
+
- [entryPoint()](#PaymasterCore-entryPoint--)
- [validatePaymasterUserOp(userOp, userOpHash, maxCost)](#PaymasterCore-validatePaymasterUserOp-struct-PackedUserOperation-bytes32-uint256-)
- [postOp(mode, context, actualGasCost, actualUserOpFeePerGas)](#PaymasterCore-postOp-enum-IPaymaster-PostOpMode-bytes-uint256-uint256-)
@@ -3619,7 +3661,8 @@ logic based on the specific requirements of the application.
- [withdrawStake(to)](#PaymasterCore-withdrawStake-address-payable-)
- [_checkEntryPoint()](#PaymasterCore-_checkEntryPoint--)
- [_authorizeWithdraw()](#PaymasterCore-_authorizeWithdraw--)
-#### IPaymaster [!toc]
+
+
@@ -3627,21 +3670,30 @@ logic based on the specific requirements of the application.
@@ -4039,3 +4105,4 @@ Decodes the user operation's data from `paymasterAndData`.
+
diff --git a/content/community-contracts/api/crosschain.mdx b/content/community-contracts/api/crosschain.mdx
index 2ecb1370..fe69d513 100644
--- a/content/community-contracts/api/crosschain.mdx
+++ b/content/community-contracts/api/crosschain.mdx
@@ -5,7 +5,6 @@ description: "Smart contract crosschain utilities and implementations"
Gateways are contracts that enable cross-chain communication. These can either be a message source or a destination according to ERC-7786.
-* [`ERC7786Receiver`](#ERC7786Receiver): ERC-7786 cross-chain message receiver.
* [`ERC7786OpenBridge`](#ERC7786OpenBridge): ERC-7786 "N out of M" gateway. Sends a message through M gateways and executes on the destination if N received it.
Developers can access interoperability protocols through gateway adapters. The library includes the following gateway adapters:
@@ -16,10 +15,6 @@ Developers can access interoperability protocols through gateway adapters. The l
[`ERC7786OpenBridge`](#ERC7786OpenBridge)
-## Clients
-
-[`ERC7786Receiver`](#ERC7786Receiver)
-
## Adapters
### Axelar
@@ -30,19 +25,19 @@ Developers can access interoperability protocols through gateway adapters. The l
```solidity
-import "@openzeppelin/community-contracts/crosschain/ERC7786OpenBridge.sol";
+import "@openzeppelin/community-contracts/contracts/crosschain/ERC7786OpenBridge.sol";
```
-N of M gateway: Sends your message through M independent gateways. It will be delivered to the receiver by an
+N of M gateway: Sends your message through M independent gateways. It will be delivered to the recipient by an
equivalent bridge on the destination chain if N of the M gateways agree.
@@ -67,20 +62,26 @@ equivalent bridge on the destination chain if N of the M gateways agree.
- [_removeGateway(gateway)](#ERC7786OpenBridge-_removeGateway-address-)
- [_setThreshold(newThreshold)](#ERC7786OpenBridge-_setThreshold-uint8-)
- [_registerRemoteBridge(bridge)](#ERC7786OpenBridge-_registerRemoteBridge-bytes-)
-#### Pausable [!toc]
+
+Pausable
+
- [paused()](#Pausable-paused--)
- [_requireNotPaused()](#Pausable-_requireNotPaused--)
- [_requirePaused()](#Pausable-_requirePaused--)
- [_pause()](#Pausable-_pause--)
- [_unpause()](#Pausable-_unpause--)
-#### Ownable [!toc]
+
+
+
+Ownable
+
- [owner()](#Ownable-owner--)
- [_checkOwner()](#Ownable-_checkOwner--)
- [renounceOwnership()](#Ownable-renounceOwnership--)
- [transferOwnership(newOwner)](#Ownable-transferOwnership-address-)
- [_transferOwnership(newOwner)](#Ownable-_transferOwnership-address-)
-#### IERC7786Receiver [!toc]
-#### IERC7786GatewaySource [!toc]
+
+
@@ -95,14 +96,25 @@ equivalent bridge on the destination chain if N of the M gateways agree.
- [GatewayRemoved(gateway)](#ERC7786OpenBridge-GatewayRemoved-address-)
- [ThresholdUpdated(threshold)](#ERC7786OpenBridge-ThresholdUpdated-uint8-)
- [RemoteRegistered(remote)](#ERC7786OpenBridge-RemoteRegistered-bytes-)
-#### Pausable [!toc]
+
+Pausable
+
- [Paused(account)](#Pausable-Paused-address-)
- [Unpaused(account)](#Pausable-Unpaused-address-)
-#### Ownable [!toc]
+
+
+
+Ownable
+
- [OwnershipTransferred(previousOwner, newOwner)](#Ownable-OwnershipTransferred-address-address-)
-#### IERC7786Receiver [!toc]
-#### IERC7786GatewaySource [!toc]
-- [MessageSent(sendId, sender, receiver, payload, value, attributes)](#IERC7786GatewaySource-MessageSent-bytes32-bytes-bytes-bytes-uint256-bytes---)
+
+
+
+IERC7786GatewaySource
+
+- [MessageSent(sendId, sender, recipient, payload, value, attributes)](#IERC7786GatewaySource-MessageSent-bytes32-bytes-bytes-bytes-uint256-bytes---)
+
+
@@ -118,15 +130,26 @@ equivalent bridge on the destination chain if N of the M gateways agree.
- [ERC7786OpenBridgeThresholdViolation()](#ERC7786OpenBridge-ERC7786OpenBridgeThresholdViolation--)
- [ERC7786OpenBridgeInvalidExecutionReturnValue()](#ERC7786OpenBridge-ERC7786OpenBridgeInvalidExecutionReturnValue--)
- [RemoteAlreadyRegistered(remote)](#ERC7786OpenBridge-RemoteAlreadyRegistered-bytes-)
-#### Pausable [!toc]
+
+Pausable
+
- [EnforcedPause()](#Pausable-EnforcedPause--)
- [ExpectedPause()](#Pausable-ExpectedPause--)
-#### Ownable [!toc]
+
+
+
+Ownable
+
- [OwnableUnauthorizedAccount(account)](#Ownable-OwnableUnauthorizedAccount-address-)
- [OwnableInvalidOwner(owner)](#Ownable-OwnableInvalidOwner-address-)
-#### IERC7786Receiver [!toc]
-#### IERC7786GatewaySource [!toc]
+
+
+
+IERC7786GatewaySource
+
- [UnsupportedAttribute(selector)](#IERC7786GatewaySource-UnsupportedAttribute-bytes4-)
+
+
@@ -210,21 +233,21 @@ This function revert if:
chain.
* someone tries re-execute a message that was already successfully delivered. This includes gateways that call
this function a second time with a message that was already executed.
-* the execution of the message (on the [`IERC7786Receiver`](./interfaces#IERC7786Receiver) receiver) is successful but fails to return the
+* the execution of the message (on the `IERC7786Recipient` recipient) is successful but fails to return the
executed value.
This function does not revert if:
* A known gateway delivers a message for the first time, and that message was already executed. In that case
the message is NOT re-executed, and the correct "magic value" is returned.
-* The execution of the message (on the [`IERC7786Receiver`](./interfaces#IERC7786Receiver) receiver) reverts. In that case a [`ERC7786OpenBridge.ExecutionFailed`](#ERC7786OpenBridge-ExecutionFailed-bytes32-)
+* The execution of the message (on the `IERC7786Recipient` recipient) reverts. In that case a [`ERC7786OpenBridge.ExecutionFailed`](#ERC7786OpenBridge-ExecutionFailed-bytes32-)
event is emitted.
This function emits:
* [`ERC7786OpenBridge.Received`](#ERC7786OpenBridge-Received-bytes32-address-) when a known ERC-7786 gateway delivers a message for the first time.
-* [`ERC7786OpenBridge.ExecutionSuccess`](#ERC7786OpenBridge-ExecutionSuccess-bytes32-) when a message is successfully delivered to the receiver.
-* [`ERC7786OpenBridge.ExecutionFailed`](#ERC7786OpenBridge-ExecutionFailed-bytes32-) when a message delivery to the receiver reverted (for example because of OOG error).
+* [`ERC7786OpenBridge.ExecutionSuccess`](#ERC7786OpenBridge-ExecutionSuccess-bytes32-) when a message is successfully delivered to the recipient.
+* [`ERC7786OpenBridge.ExecutionFailed`](#ERC7786OpenBridge-ExecutionFailed-bytes32-) when a message delivery to the recipient reverted (for example because of OOG error).
interface requires this function to be payable. Even if we don't expect any value, a gateway may pass
@@ -722,21 +745,21 @@ Recovery method in case value is ever received through [`ERC7786OpenBridge.recei
@@ -962,12 +1008,12 @@ Getter to check whether an attribute is supported or not.
Endpoint for creating a new message. If the message requires further (gateway specific) processing before
-it can be sent to the destination chain, then a non-zero `outboxId` must be returned. Otherwise, the
+it can be sent to the destination chain, then a non-zero `sendId` must be returned. Otherwise, the
message MUST be sent and this function must return 0.
-* MUST emit a [`IERC7786GatewaySource.MessageSent`](./interfaces#IERC7786GatewaySource-MessageSent-bytes32-bytes-bytes-bytes-uint256-bytes---) event.
+* MUST emit a `MessageSent` event.
-If any of the `attributes` is not supported, this function SHOULD revert with an [`IERC7786GatewaySource.UnsupportedAttribute`](./interfaces#IERC7786GatewaySource-UnsupportedAttribute-bytes4-) error.
+If any of the `attributes` is not supported, this function SHOULD revert with an `UnsupportedAttribute` error.
Other errors SHOULD revert with errors not specified in ERC-7786.
@@ -1080,14 +1126,14 @@ A chain equivalence has been registered.
-
+
```solidity
-import "@openzeppelin/community-contracts/crosschain/utils/ERC7786Attributes.sol";
+import "@openzeppelin/community-contracts/contracts/crosschain/utils/ERC7786Attributes.sol";
```
Library of helper to parse/process ERC-7786 attributes
@@ -1227,149 +1273,20 @@ Parse the `requestRelay(uint256,uint256,address)` (0x4cbb573a) attribute into it
-
-```solidity
-import "@openzeppelin/community-contracts/crosschain/utils/ERC7786Receiver.sol";
-```
-
-Base implementation of an ERC-7786 compliant cross-chain message receiver.
-
-This abstract contract exposes the `receiveMessage` function that is used for communication with (one or multiple)
-destination gateways. This contract leaves two functions unimplemented:
-
-[`ERC7786Receiver._isKnownGateway`](#ERC7786Receiver-_isKnownGateway-address-), an internal getter used to verify whether an address is recognised by the contract as a valid
-ERC-7786 destination gateway. One or multiple gateway can be supported. Note that any malicious address for which
-this function returns true would be able to impersonate any account on any other chain sending any message.
-
-[`ERC7786Receiver._processMessage`](#ERC7786Receiver-_processMessage-address-bytes32-bytes-bytes-), the internal function that will be called with any message that has been validated.
-
-
Endpoint for creating a new message. If the message requires further (gateway specific) processing before
-it can be sent to the destination chain, then a non-zero `outboxId` must be returned. Otherwise, the
+it can be sent to the destination chain, then a non-zero `sendId` must be returned. Otherwise, the
message MUST be sent and this function must return 0.
-* MUST emit a [`IERC7786GatewaySource.MessageSent`](./interfaces#IERC7786GatewaySource-MessageSent-bytes32-bytes-bytes-bytes-uint256-bytes---) event.
+* MUST emit a `MessageSent` event.
-If any of the `attributes` is not supported, this function SHOULD revert with an [`IERC7786GatewaySource.UnsupportedAttribute`](./interfaces#IERC7786GatewaySource-UnsupportedAttribute-bytes4-) error.
+If any of the `attributes` is not supported, this function SHOULD revert with an `UnsupportedAttribute` error.
Other errors SHOULD revert with errors not specified in ERC-7786.
@@ -1892,14 +1825,14 @@ A chain equivalence has been registered.
-
+
+
+Schedule an operation containing a single transaction.
+
+Emits `CallSalt` if salt is nonzero, and `CallScheduled`.
+
+Requirements:
+
+- the caller must have the 'proposer' role.
+
+
+
+Schedule an operation containing a batch of transactions.
+
+Emits `CallSalt` if salt is nonzero, and one `CallScheduled` event per transaction in the batch.
+
+Requirements:
+
+- the caller must have the 'proposer' role.
+
+
+
+Return all scheduled operations
+
+This is designed for view accessors queried without gas fees. Using it in state-changing
+functions may become uncallable if the list grows too large.
+
+
+
+
+Return all scheduled operation batches
+
+This is designed for view accessors queried without gas fees. Using it in state-changing
+functions may become uncallable if the list grows too large.
+
+
+
+
+```solidity
+import "@openzeppelin/community-contracts/contracts/interfaces/IERC7786Attributes.sol";
+```
+
+Standard attributes for ERC-7786. These attributes may be standardized in different ERCs.
+
+
-Endpoint for creating a new message. If the message requires further (gateway specific) processing before
-it can be sent to the destination chain, then a non-zero `outboxId` must be returned. Otherwise, the
-message MUST be sent and this function must return 0.
-
-* MUST emit a [`IERC7786GatewaySource.MessageSent`](#IERC7786GatewaySource-MessageSent-bytes32-bytes-bytes-bytes-uint256-bytes---) event.
-
-If any of the `attributes` is not supported, this function SHOULD revert with an [`IERC7786GatewaySource.UnsupportedAttribute`](#IERC7786GatewaySource-UnsupportedAttribute-bytes4-) error.
-Other errors SHOULD revert with errors not specified in ERC-7786.
+Requires specific authorization. Frozen tokens cannot be transferred by the account.
-Event emitted when a message is created. If `outboxId` is zero, no further processing is necessary. If
-`outboxId` is not zero, then further (gateway specific, and non-standardized) action is required.
+This is often used for allowlist/KYC/KYB/AML checks.
-This error is thrown when a message creation fails because of an unsupported attribute being specified.
+It could return an amount higher than the account's balance.
-```solidity
-import "@openzeppelin/community-contracts/interfaces/IERC7786.sol";
-```
-
-Interface for the ERC-7786 client contract (receiver).
-
-See ERC-7786 for more details
+This can involve checks like allowlists, blocklists, transfer limits and other policy-defined restrictions.
-
-```solidity
-import "@openzeppelin/community-contracts/interfaces/IERC7786Attributes.sol";
-```
+
-Standard attributes for ERC-7786. These attributes may be standardized in different ERCs.
+
+
+
ERC7943CannotTransfer(address from, address to, uint256 amount)
-```solidity
-import "@openzeppelin/community-contracts/interfaces/IERC7821.sol";
-```
-
-Interface for minimal batch executor.
+This can involve checks like allowlists, blocklists, transfer limits and other policy-defined restrictions.
-
-
-Executes the calls in `executionData`.
-Reverts and bubbles up error if any call fails.
-`executionData` encoding:
+
-* If `opData` is empty, `executionData` is simply `abi.encode(calls)`.
-* Else, `executionData` is `abi.encode(calls, opData)`.
- See: https://eips.ethereum.org/EIPS/eip-7579
+
-* `bytes32(0x01000000000000000000...)`: does not support optional `opData`.
-* `bytes32(0x01000000000078210001...)`: supports optional `opData`.
+
-Authorization checks:
+
+
-* If `opData` is empty, the implementation SHOULD require that
- `msg.sender == address(this)`.
-* If `opData` is not empty, the implementation SHOULD use the signature
- encoded in `opData` to determine if the caller can perform the execution.
+
-`opData` may be used to store additional data for authentication,
-paymaster data, gas limits, etc.
+
-This function is provided for frontends to detect support.
-Only returns true for:
+
+
+
+
-* `bytes32(0x01000000000000000000...)`: does not support optional `opData`.
-* `bytes32(0x01000000000078210001...)`: supports optional `opData`.
+
-Requires specific authorization. Frozen tokens cannot be transferred by the user.
+Requires specific authorization. Frozen tokens cannot be transferred by the account.
-This may involve checks like allowlists, blocklists, transfer limits and other policy-defined restrictions.
+It could return an amount higher than the account's balance.
-This is often used for allowlist/KYC/KYB/AML checks.
+This can involve checks like allowlists, blocklists, transfer limits and other policy-defined restrictions.
-
+
-
ForcedTransfer(address indexed from, address indexed to, uint256 tokenId, uint256 amount)
```solidity
-import "@openzeppelin/community-contracts/interfaces/IERC7969.sol";
+import "@openzeppelin/community-contracts/contracts/interfaces/IERC7969.sol";
```
This interface provides a standard way to register and validate DKIM public key hashes onchain
@@ -711,3 +779,4 @@ Emitted when a DKIM public key hash is revoked for a domain
+
diff --git a/content/community-contracts/api/proxy.mdx b/content/community-contracts/api/proxy.mdx
index 3109f979..1cb68017 100644
--- a/content/community-contracts/api/proxy.mdx
+++ b/content/community-contracts/api/proxy.mdx
@@ -15,16 +15,16 @@ Variants of proxy patterns, which are contracts that allow to forward a call to
```solidity
-import "@openzeppelin/community-contracts/proxy/HybridProxy.sol";
+import "@openzeppelin/community-contracts/contracts/proxy/HybridProxy.sol";
```
A version of an ERC-1967 proxy that uses the address stored in the implementation slot as a beacon.
@@ -45,10 +45,14 @@ the returned address will be used as this proxy's implementation.
@@ -92,3 +96,4 @@ define this function, mistakenly identifying it as a beacon.
+
diff --git a/content/community-contracts/api/token.mdx b/content/community-contracts/api/token.mdx
index 7ef43718..bb76aa70 100644
--- a/content/community-contracts/api/token.mdx
+++ b/content/community-contracts/api/token.mdx
@@ -32,19 +32,19 @@ Set of extensions and utilities for tokens (e.g ERC-20, ERC-721, ERC-1155) and d
```solidity
-import "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Allowlist.sol";
+import "@openzeppelin/community-contracts/contracts/token/ERC20/extensions/ERC20Allowlist.sol";
```
-Extension of [`PaymasterERC20`](./account#PaymasterERC20) that allows to implement an allowlist
+Extension of `ERC20` that allows to implement an allowlist
mechanism that can be managed by an authorized account with the
[`ERC20Allowlist._disallowUser`](#ERC20Allowlist-_disallowUser-address-) and [`ERC20Allowlist._allowUser`](#ERC20Allowlist-_allowUser-address-) functions.
@@ -62,29 +62,30 @@ Deprecated. Use [`ERC20Restricted`](#ERC20Restricted) instead.
```solidity
-import "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Blocklist.sol";
+import "@openzeppelin/community-contracts/contracts/token/ERC20/extensions/ERC20Blocklist.sol";
```
-Extension of [`PaymasterERC20`](./account#PaymasterERC20) that allows to implement a blocklist
+Extension of `ERC20` that allows to implement a blocklist
mechanism that can be managed by an authorized account with the
[`ERC20Blocklist._blockUser`](#ERC20Blocklist-_blockUser-address-) and [`ERC20Blocklist._unblockUser`](#ERC20Blocklist-_unblockUser-address-) functions.
@@ -290,29 +293,30 @@ Deprecated. Use [`ERC20Restricted`](#ERC20Restricted) instead.
```solidity
-import "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Collateral.sol";
+import "@openzeppelin/community-contracts/contracts/token/ERC20/extensions/ERC20Collateral.sol";
```
-Extension of [`PaymasterERC20`](./account#PaymasterERC20) that limits the supply of tokens based
+Extension of `ERC20` that limits the supply of tokens based
on a collateral amount and time-based expiration.
The [`ERC20Collateral.collateral`](#ERC20Collateral-collateral--) function must be implemented to return the collateral
@@ -515,39 +521,39 @@ data. This function can call external oracles or use any local storage.
- [CLOCK_MODE()](#ERC20Collateral-CLOCK_MODE--)
- [collateral()](#ERC20Collateral-collateral--)
- [_update(from, to, value)](#ERC20Collateral-_update-address-address-uint256-)
-#### IERC6372 [!toc]
-#### ERC20 [!toc]
+
+ERC20
+
- [name()](#ERC20-name--)
- [symbol()](#ERC20-symbol--)
- [decimals()](#ERC20-decimals--)
- [totalSupply()](#ERC20-totalSupply--)
-- [balanceOf(./account)](#ERC20-balanceOf-address-)
+- [balanceOf(account)](#ERC20-balanceOf-address-)
- [transfer(to, value)](#ERC20-transfer-address-uint256-)
- [allowance(owner, spender)](#ERC20-allowance-address-address-)
- [approve(spender, value)](#ERC20-approve-address-uint256-)
- [transferFrom(from, to, value)](#ERC20-transferFrom-address-address-uint256-)
- [_transfer(from, to, value)](#ERC20-_transfer-address-address-uint256-)
-- [_mint(./account, value)](#ERC20-_mint-address-uint256-)
-- [_burn(./account, value)](#ERC20-_burn-address-uint256-)
+- [_mint(account, value)](#ERC20-_mint-address-uint256-)
+- [_burn(account, value)](#ERC20-_burn-address-uint256-)
- [_approve(owner, spender, value)](#ERC20-_approve-address-address-uint256-)
- [_approve(owner, spender, value, emitEvent)](#ERC20-_approve-address-address-uint256-bool-)
- [_spendAllowance(owner, spender, value)](#ERC20-_spendAllowance-address-address-uint256-)
-#### IERC20Errors [!toc]
-#### IERC20Metadata [!toc]
-#### IERC20 [!toc]
+
+
```solidity
-import "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Custodian.sol";
+import "@openzeppelin/community-contracts/contracts/token/ERC20/extensions/ERC20Custodian.sol";
```
-Extension of [`PaymasterERC20`](./account#PaymasterERC20) that allows to implement a custodian
+Extension of `ERC20` that allows to implement a custodian
mechanism that can be managed by an authorized account with the
[`ERC20Custodian.freeze`](#ERC20Custodian-freeze-address-uint256-) function.
@@ -751,28 +757,29 @@ Deprecated. Use [`ERC20Freezable`](#ERC20Freezable) instead.
@@ -796,16 +804,17 @@ Deprecated. Use [`ERC20Freezable`](#ERC20Freezable) instead.
- [ERC20InsufficientUnfrozenBalance(user)](#ERC20Custodian-ERC20InsufficientUnfrozenBalance-address-)
- [ERC20InsufficientFrozenBalance(user)](#ERC20Custodian-ERC20InsufficientFrozenBalance-address-)
- [ERC20NotCustodian()](#ERC20Custodian-ERC20NotCustodian--)
-#### ERC20 [!toc]
-#### IERC20Errors [!toc]
+
+IERC20Errors
+
- [ERC20InsufficientBalance(sender, balance, needed)](#IERC20Errors-ERC20InsufficientBalance-address-uint256-uint256-)
- [ERC20InvalidSender(sender)](#IERC20Errors-ERC20InvalidSender-address-)
- [ERC20InvalidReceiver(receiver)](#IERC20Errors-ERC20InvalidReceiver-address-)
- [ERC20InsufficientAllowance(spender, allowance, needed)](#IERC20Errors-ERC20InsufficientAllowance-address-uint256-uint256-)
- [ERC20InvalidApprover(approver)](#IERC20Errors-ERC20InvalidApprover-address-)
- [ERC20InvalidSpender(spender)](#IERC20Errors-ERC20InvalidSpender-address-)
-#### IERC20Metadata [!toc]
-#### IERC20 [!toc]
+
+
@@ -911,7 +920,7 @@ Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints
(or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
this function.
-Emits a [`ERC7786OpenBridge.UnsupportedNativeTransfer`](./crosschain#ERC7786OpenBridge-UnsupportedNativeTransfer--) event.
+Emits a `Transfer` event.
@@ -1006,82 +1015,85 @@ Error thrown when a non-custodian account attempts to perform a custodian-only o
```solidity
-import "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Freezable.sol";
+import "@openzeppelin/community-contracts/contracts/token/ERC20/extensions/ERC20Freezable.sol";
```
-Extension of [`PaymasterERC20`](./account#PaymasterERC20) that allows to implement a freezing
+Extension of `ERC20` that allows to implement a freezing
mechanism that can be managed by an authorized account with the
-`_freezeTokens` and `_unfreezeTokens` functions.
+[`ERC20Freezable._setFrozen`](#ERC20Freezable-_setFrozen-address-uint256-) function.
The freezing mechanism provides the guarantee to the contract owner
(e.g. a DAO or a well-configured multisig) that a specific amount
-of tokens held by an account won't be transferable until those
-tokens are unfrozen using `_unfreezeTokens`.
+of tokens held by an account won't be transferable until the frozen amount
+is reduced using [`ERC20Freezable._setFrozen`](#ERC20Freezable-_setFrozen-address-uint256-).
```solidity
-import "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Restricted.sol";
+import "@openzeppelin/community-contracts/contracts/token/ERC20/extensions/ERC20Restricted.sol";
```
-Extension of [`PaymasterERC20`](./account#PaymasterERC20) that allows to implement user account transfer restrictions
-through the [`IERC7943.isUserAllowed`](./interfaces#IERC7943-isUserAllowed-address-) function. Inspired by [EIP-7943](https://eips.ethereum.org/EIPS/eip-7943).
+Extension of `ERC20` that allows to implement user account transfer restrictions
+through the [`ERC20Restricted.canTransact`](#ERC20Restricted-canTransact-address-) function. Inspired by [EIP-7943](https://eips.ethereum.org/EIPS/eip-7943).
-By default, each account has no explicit restriction. The [`IERC7943.isUserAllowed`](./interfaces#IERC7943-isUserAllowed-address-) function acts as
-a blocklist. Developers can override [`IERC7943.isUserAllowed`](./interfaces#IERC7943-isUserAllowed-address-) to check that `restriction == ALLOWED`
+By default, each account has no explicit restriction. The [`ERC20Restricted.canTransact`](#ERC20Restricted-canTransact-address-) function acts as
+a blocklist. Developers can override [`ERC20Restricted.canTransact`](#ERC20Restricted-canTransact-address-) to check that `restriction == ALLOWED`
to implement an allowlist.
@@ -1296,8 +1311,8 @@ Default implementation only disallows explicitly BLOCKED accounts (i.e. a blockl
To convert into an allowlist, override as:
```solidity
-function isUserAllowed(address account) public view virtual override returns (bool) {
- return getRestriction(./account) == Restriction.ALLOWED;
+function canTransact(address account) public view virtual override returns (bool) {
+ return getRestriction(account) == Restriction.ALLOWED;
}
```
@@ -1320,8 +1335,8 @@ See `ERC20-_update`. Enforces restriction transfers (excluding minting and burni
Requirements:
-* `from` must be allowed to transfer tokens (see [`IERC7943.isUserAllowed`](./interfaces#IERC7943-isUserAllowed-address-)).
-* `to` must be allowed to receive tokens (see [`IERC7943.isUserAllowed`](./interfaces#IERC7943-isUserAllowed-address-)).
+* `from` must be allowed to transfer tokens (see [`ERC20Restricted.canTransact`](#ERC20Restricted-canTransact-address-)).
+* `to` must be allowed to receive tokens (see [`ERC20Restricted.canTransact`](#ERC20Restricted-canTransact-address-)).
@@ -1450,125 +1465,150 @@ The operation failed because the user account is restricted.
```solidity
-import "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20uRWA.sol";
+import "@openzeppelin/community-contracts/contracts/token/ERC20/extensions/ERC20uRWA.sol";
```
-Extension of [`PaymasterERC20`](./account#PaymasterERC20) according to [EIP-7943](https://eips.ethereum.org/EIPS/eip-7943).
+Extension of `ERC20` according to [EIP-7943](https://eips.ethereum.org/EIPS/eip-7943).
-Combines standard ERC-20 functionality with RWA-specific features like user restrictions,
-asset freezing, and forced asset transfers.
+Combines standard ERC-20 functionality with RWA-specific features like account restrictions,
+asset freezing, and forced asset transfers. This contract doesn't expose minting or burning
+capabilities; if implemented in derived contracts as needed, they must include 7943-specific
+logic.
-See [`IERC7943.isTransferAllowed`](./interfaces#IERC7943-isTransferAllowed-address-address-uint256-uint256-).
+See [`IERC7943Fungible.canTransfer`](/community-contracts/api/interfaces#IERC7943Fungible-canTransfer-address-address-uint256-).
-CAUTION: This function is only meant for external use. Overriding it will not apply the new checks to
+
+This function is only meant for external use. Overriding it will not apply the new checks to
the internal [`ERC20Allowlist._update`](#ERC20Allowlist-_update-address-address-uint256-) function. Consider overriding [`ERC20Allowlist._update`](#ERC20Allowlist-_update-address-address-uint256-) accordingly to keep both functions in sync.
+
-See [`IERC7943.setFrozen`](./interfaces#IERC7943-setFrozen-address-uint256-uint256-).
+See [`IERC7943Fungible.setFrozenTokens`](/community-contracts/api/interfaces#IERC7943Fungible-setFrozenTokens-address-uint256-). Always returns true if successful. Reverts otherwise.
-The `amount` is capped to the balance of the `user` to ensure the [`IERC7943.Frozen`](./interfaces#IERC7943-Frozen-address-uint256-uint256-) event
+The `amount` is capped to the balance of the `account` to ensure the [`IERC7943Fungible.Frozen`](/community-contracts/api/interfaces#IERC7943Fungible-Frozen-address-uint256-) event
emits values that consistently reflect the actual amount of tokens that are frozen.
-
+
-
forceTransfer(address from, address to, uint256, uint256 amount)
+
forcedTransfer(address from, address to, uint256 amount) โ bool result
-See [`IERC7943.forceTransfer`](./interfaces#IERC7943-forceTransfer-address-address-uint256-uint256-).
+See [`IERC7943Fungible.forcedTransfer`](/community-contracts/api/interfaces#IERC7943Fungible-forcedTransfer-address-address-uint256-). Always returns true if successful. Reverts otherwise.
Bypasses the [`ERC20Restricted`](#ERC20Restricted) restrictions for the `from` address and adjusts the frozen balance
to the new balance after the transfer.
@@ -1710,7 +1754,7 @@ Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints
(or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
this function.
-Emits a [`ERC7786OpenBridge.UnsupportedNativeTransfer`](./crosschain#ERC7786OpenBridge-UnsupportedNativeTransfer--) event.
+Emits a `Transfer` event.
@@ -1742,7 +1786,7 @@ function _checkEnforcer(address from, address to, uint256 amount) internal view
-
_checkFreezer(address user, uint256 amount)
+
_checkFreezer(address account, uint256 amount)
internal
#
@@ -1755,7 +1799,7 @@ Internal function to check if the `freezer` is allowed to freeze the `amount` of
Example usage with `AccessControl-onlyRole`:
```solidity
-function _checkFreezer(address user, uint256 amount) internal view override onlyRole(FREEZER_ROLE) {}
+function _checkFreezer(address account, uint256 amount) internal view override onlyRole(FREEZER_ROLE) {}
```
@@ -1765,16 +1809,16 @@ function _checkFreezer(address user, uint256 amount) internal view override only
```solidity
-import "@openzeppelin/community-contracts/token/OnTokenTransferAdapter.sol";
+import "@openzeppelin/community-contracts/contracts/token/OnTokenTransferAdapter.sol";
```
This contract exposes the 667 `onTokenTransfer` hook on top of `IERC1363Receiver-onTransferReceived`.
@@ -2057,8 +2115,12 @@ Chainlink's Link, that implement the 667 interface for transferAndCall.
@@ -2076,3 +2138,4 @@ Chainlink's Link, that implement the 667 interface for transferAndCall.
+
diff --git a/content/community-contracts/api/utils.mdx b/content/community-contracts/api/utils.mdx
index 0047856d..4897ad49 100644
--- a/content/community-contracts/api/utils.mdx
+++ b/content/community-contracts/api/utils.mdx
@@ -22,16 +22,16 @@ Miscellaneous contracts and libraries containing utility functions you can use t
```solidity
-import "@openzeppelin/community-contracts/utils/Masks.sol";
+import "@openzeppelin/community-contracts/contracts/utils/Masks.sol";
```
Library for handling bit masks
@@ -208,16 +208,16 @@ Returns the symmetric difference (โ) of two masks, also known as disjunctive u
```solidity
-import "@openzeppelin/community-contracts/utils/structs/EnumerableMapExtended.sol";
+import "@openzeppelin/community-contracts/contracts/utils/structs/EnumerableMapExtended.sol";
```
Library for managing an enumerable variant of Solidity's
@@ -246,17 +246,14 @@ The following map types are supported:
- `bytes -> uint256` (`BytesToUintMap`)
- `string -> string` (`StringToStringMap`)
-
-Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
+[WARNING]
+#### Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
unusable.
See [ethereum/solidity#11843](https://github.com/ethereum/solidity/pull/11843) for more info.
In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
array of EnumerableMap.
-
-
-Extensions of openzeppelin/contracts/utils/struct/EnumerableMap.sol.
-
+#### NOTE: Extensions of openzeppelin/contracts/utils/struct/EnumerableMap.sol.
Functions
@@ -744,16 +741,16 @@ Query for a nonexistent map key.
```solidity
-import "@openzeppelin/community-contracts/utils/structs/EnumerableSetExtended.sol";
+import "@openzeppelin/community-contracts/contracts/utils/structs/EnumerableSetExtended.sol";
```
Library for managing
@@ -780,17 +777,14 @@ contract Example {
Sets of type `string` (`StringSet`), `bytes` (`BytesSet`) and
`bytes32[2]` (`Bytes32x2Set`) are supported.
-
-Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
+[WARNING]
+#### Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
unusable.
See [ethereum/solidity#11843](https://github.com/ethereum/solidity/pull/11843) for more info.
In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
array of EnumerableSet.
-
-
-This is an extension of openzeppelin/contracts/utils/struct/EnumerableSet.sol.
-
+#### NOTE: This is an extension of openzeppelin/contracts/utils/struct/EnumerableSet.sol.
Functions
@@ -973,3 +967,4 @@ uncallable if the set grows to a point where copying to memory consumes too much
+
diff --git a/content/community-contracts/api/utils/cryptography.mdx b/content/community-contracts/api/utils/cryptography.mdx
index 1e46a40f..5847fc69 100644
--- a/content/community-contracts/api/utils/cryptography.mdx
+++ b/content/community-contracts/api/utils/cryptography.mdx
@@ -6,46 +6,38 @@ description: "Smart contract cryptography utilities and implementations"
A collection of contracts and libraries that implement various signature validation schemes and cryptographic primitives. These utilities enable secure authentication, multisignature operations, and advanced cryptographic operations in smart contracts.
* [`ZKEmailUtils`](#ZKEmailUtils): Library for ZKEmail signature validation utilities, enabling email-based authentication through zero-knowledge proofs.
-* [`WebAuthn`](#WebAuthn): Library for verifying WebAuthn Authentication Assertions.
* [`DKIMRegistry`](#DKIMRegistry): Implementation of [ERC-7969](https://eips.ethereum.org/EIPS/eip-7969) to enable onchain verification of DomainKeys Identified Mail (DKIM) signatures.
* [`SignerZKEmail`](#SignerZKEmail): Implementation of an [AbstractSigner](https://docs.openzeppelin.com/contracts/5.x/api/utils/cryptography#AbstractSigner) that enables email-based authentication through zero-knowledge proofs.
-* [`SignerWebAuthn`](#SignerWebAuthn): Implementation of [SignerP256](https://docs.openzeppelin.com/contracts/5.x/api/utils/cryptography#SignerP256) that supports WebAuthn authentication assertions.
-* [`ERC7913ZKEmailVerifier`](#ERC7913ZKEmailVerifier), [`ERC7913WebAuthnVerifier`](#ERC7913WebAuthnVerifier): Ready to use ERC-7913 signature verifiers for ZKEmail and WebAuthn.
+* [`ERC7913ZKEmailVerifier`](#ERC7913ZKEmailVerifier): Ready to use ERC-7913 signature verifiers for ZKEmail.
## Utils
[`ZKEmailUtils`](#ZKEmailUtils)
-[`WebAuthn`](#WebAuthn)
-
[`DKIMRegistry`](#DKIMRegistry)
## Abstract Signers
[`SignerZKEmail`](#SignerZKEmail)
-[`SignerWebAuthn`](#SignerWebAuthn)
-
## Verifiers
[`ERC7913ZKEmailVerifier`](#ERC7913ZKEmailVerifier)
-[`ERC7913WebAuthnVerifier`](#ERC7913WebAuthnVerifier)
-
@@ -129,7 +124,7 @@ Returns whether a DKIM key hash is valid for a given domain.
Sets a DKIM key hash as valid for a domain. Internal version without access control.
-Emits a [`IDKIMRegistry.KeyHashRegistered`](../interfaces#IDKIMRegistry-KeyHashRegistered-bytes32-bytes32-) event.
+Emits a [`IDKIMRegistry.KeyHashRegistered`](/community-contracts/api/interfaces#IDKIMRegistry-KeyHashRegistered-bytes32-bytes32-) event.
This function does not validate that keyHash is non-zero. Consider adding
@@ -154,7 +149,7 @@ validation in derived contracts if needed.
Sets multiple DKIM key hashes as valid for a domain in a single transaction.
Internal version without access control.
-Emits a [`IDKIMRegistry.KeyHashRegistered`](../interfaces#IDKIMRegistry-KeyHashRegistered-bytes32-bytes32-) event for each key hash.
+Emits a [`IDKIMRegistry.KeyHashRegistered`](/community-contracts/api/interfaces#IDKIMRegistry-KeyHashRegistered-bytes32-bytes32-) event for each key hash.
This function does not validate that the keyHashes array is non-empty.
@@ -179,128 +174,7 @@ Consider adding validation in derived contracts if needed.
Revokes a DKIM key hash for a domain, making it invalid.
Internal version without access control.
-Emits a [`IDKIMRegistry.KeyHashRevoked`](../interfaces#IDKIMRegistry-KeyHashRevoked-bytes32-) event.
-
-
-
-
-
-
-
-
-```solidity
-import "@openzeppelin/community-contracts/utils/cryptography/WebAuthn.sol";
-```
-
-Library for verifying WebAuthn Authentication Assertions.
-
-WebAuthn enables strong authentication for smart contracts using
-[P256](https://docs.openzeppelin.com/contracts/5.x/api/utils#P256)
-as an alternative to traditional secp256k1 ECDSA signatures. This library verifies
-signatures generated during WebAuthn authentication ceremonies as specified in the
-[WebAuthn Level 2 standard](https://www.w3.org/TR/webauthn-2/).
-
-For blockchain use cases, the following WebAuthn validations are intentionally omitted:
-
-* Origin validation: Origin verification in `clientDataJSON` is omitted as blockchain
- contexts rely on authenticator and dapp frontend enforcement. Standard authenticators
- implement proper origin validation.
-* RP ID hash validation: Verification of `rpIdHash` in authenticatorData against expected
- RP ID hash is omitted. This is typically handled by platform-level security measures.
- Including an expiry timestamp in signed data is recommended for enhanced security.
-* Signature counter: Verification of signature counter increments is omitted. While
- useful for detecting credential cloning, on-chain operations typically include nonce
- protection, making this check redundant.
-* Extension outputs: Extension output value verification is omitted as these are not
- essential for core authentication security in blockchain applications.
-* Attestation: Attestation object verification is omitted as this implementation
- focuses on authentication (`webauthn.get`) rather than registration ceremonies.
-
-Inspired by:
-
-* [daimo-eth implementation](https://github.com/daimo-eth/p256-verifier/blob/master/src/WebAuthn.sol)
-* [base implementation](https://github.com/base/webauthn-sol/blob/main/src/WebAuthn.sol)
-
-
-
-Performs verification of a WebAuthn Authentication Assertion. This variants allow the caller to select
-whether of not to require the UV flag (step 17).
-
-Verifies:
-
-1. Type is "webauthn.get" (see [`WebAuthn._validateExpectedTypeHash`](#WebAuthn-_validateExpectedTypeHash-string-uint256-))
-2. Challenge matches the expected value (see [`WebAuthn._validateChallenge`](#WebAuthn-_validateChallenge-string-uint256-bytes-))
-3. Cryptographic signature is valid for the given public key
-4. confirming physical user presence during authentication
-5. (if `requireUV` is true) confirming stronger user authentication (biometrics/PIN)
-6. Backup Eligibility (`BE`) and Backup State (BS) bits relationship is valid
-
-
-
-Verifies that calldata bytes (`input`) represents a valid `WebAuthnAuth` object. If encoding is valid,
-returns true and the calldata view at the object. Otherwise, returns false and an invalid calldata object.
-
-
-The returned `auth` object should not be accessed if `success` is false. Trying to access the data may
-cause revert/panic.
-
+Emits a [`IDKIMRegistry.KeyHashRevoked`](/community-contracts/api/interfaces#IDKIMRegistry-KeyHashRevoked-bytes32-) event.
```solidity
-import "@openzeppelin/community-contracts/utils/cryptography/ZKEmailUtils.sol";
+import "@openzeppelin/community-contracts/contracts/utils/cryptography/ZKEmailUtils.sol";
```
Library for [ZKEmail](https://docs.zk.email) Groth16 proof validation utilities.
@@ -359,7 +233,7 @@ mechanism to ensure the email was actually sent and received without revealing i
-Variant of [`ZKEmailUtils.isValidZKEmail`](#ZKEmailUtils-isValidZKEmail-struct-EmailProof-contract-IDKIMRegistry-contract-IGroth16Verifier-string---bytes---enum-ZKEmailUtils-Case-) that validates the `["signHash", "../access#AccessManagerLight-ADMIN_ROLE-uint8"]` command template.
+Variant of [`ZKEmailUtils.isValidZKEmail`](#ZKEmailUtils-isValidZKEmail-struct-EmailProof-contract-IDKIMRegistry-contract-IGroth16Verifier-string---bytes---enum-ZKEmailUtils-Case-) that validates the `["signHash", "`uint`"]` command template.
@@ -404,7 +278,7 @@ Attempts to validate the command for all possible string [`ZKEmailUtils.Case`](#
Variant of [`ZKEmailUtils.isValidZKEmail`](#ZKEmailUtils-isValidZKEmail-struct-EmailProof-contract-IDKIMRegistry-contract-IGroth16Verifier-string---bytes---enum-ZKEmailUtils-Case-) that validates a template with a specific string [`ZKEmailUtils.Case`](#ZKEmailUtils-Case).
-Useful for templates with Ethereum address matchers (i.e. ``ethAddr``), which are case-sensitive (e.g., `["someCommand", "../access#AccessManagerLight-_groups-mapping-address----Masks-Mask-"]`).
+Useful for templates with Ethereum address matchers (i.e. ``ethAddr``), which are case-sensitive (e.g., `["someCommand", "`address`"]`).
@@ -452,100 +326,20 @@ into a uint256 array in the order expected by the verifier circuit.
-
-
-
-
-```solidity
-import "@openzeppelin/community-contracts/utils/cryptography/signers/SignerWebAuthn.sol";
-```
-
-Implementation of `SignerP256` that supports WebAuthn authentication assertions.
-
-This contract enables signature validation using WebAuthn authentication assertions,
-leveraging the P256 public key stored in the contract. It allows for both WebAuthn
-and raw P256 signature validation, providing compatibility with both signature types.
-
-The signature is expected to be an abi-encoded [`WebAuthn.WebAuthnAuth`](#WebAuthn-WebAuthnAuth) struct.
-
-Example usage:
-
-```solidity
-contract MyAccountWebAuthn is Account, SignerWebAuthn, Initializable {
- function initialize(bytes32 qx, bytes32 qy) public initializer {
- _setSigner(qx, qy);
- }
-}
-```
-
-
-Failing to call [`ERC7579Signature._setSigner`](../account#ERC7579Signature-_setSigner-address-bytes-) either during construction (if used standalone)
-or during initialization (if used as a clone) may leave the signer either front-runnable or unusable.
-
-
-
-
-Validates a raw signature using the WebAuthn authentication assertion.
-
-In case the signature can't be validated, it falls back to the
-`SignerP256-_rawSignatureValidation` method for raw P256 signature validation by passing
-the raw `r` and `s` values from the signature.
-
-
-
-```solidity
-import "@openzeppelin/community-contracts/utils/cryptography/verifiers/ERC7913WebAuthnVerifier.sol";
-```
-
-ERC-7913 signature verifier that supports WebAuthn authentication assertions.
-
-This verifier enables the validation of WebAuthn signatures using P256 public keys.
-The key is expected to be a 64-byte concatenation of the P256 public key coordinates (qx || qy).
-The signature is expected to be an abi-encoded [`WebAuthn.WebAuthnAuth`](#WebAuthn-WebAuthnAuth) struct.
-
-Uses `WebAuthn-verifyMinimal` for signature verification, which performs the essential
-WebAuthn checks: type validation, challenge matching, and cryptographic signature verification.
-
-
-Wallets that may require default P256 validation may install a P256 verifier separately.
-
-
-
-
-Verifies `signature` as a valid signature of `hash` by `key`.
-
-MUST return the bytes4 magic value IERC7913SignatureVerifier.verify.selector if the signature is valid.
-SHOULD return 0xffffffff or revert if the signature is not valid.
-SHOULD return 0xffffffff or revert if the key is empty
-
-
```solidity
-import "@openzeppelin/community-contracts/utils/cryptography/verifiers/ERC7913ZKEmailVerifier.sol";
+import "@openzeppelin/community-contracts/contracts/utils/cryptography/verifiers/ERC7913ZKEmailVerifier.sol";
```
ERC-7913 signature verifier that supports ZKEmail accounts.
@@ -867,7 +601,6 @@ Example of overriding _decodeKey to enforce a specific verifier, registry:
@@ -893,7 +626,7 @@ The key format is ABI-encoded (IDKIMRegistry, bytes32, IGroth16Verifier) where:
See [`ERC7913ZKEmailVerifier._decodeKey`](#ERC7913ZKEmailVerifier-_decodeKey-bytes-) for the key encoding format.
-The signature is an ABI-encoded [`ZKEmailUtils.EmailProofError`](#ZKEmailUtils-EmailProofError) struct containing
+The signature is an ABI-encoded `EmailProof` struct containing
the proof details.
Signature encoding:
@@ -934,3 +667,4 @@ bytes memory key = abi.encode(registry, accountSalt, verifier);
+
diff --git a/content/confidential-contracts/api/finance.mdx b/content/confidential-contracts/api/finance.mdx
index 8d0ec00b..8653cfa3 100644
--- a/content/confidential-contracts/api/finance.mdx
+++ b/content/confidential-contracts/api/finance.mdx
@@ -7,6 +7,7 @@ This directory includes primitives for on-chain confidential financial systems:
* [`VestingWalletConfidential`](#VestingWalletConfidential): Handles the vesting of confidential tokens for a given beneficiary. Custody of multiple tokens can be given to this contract, which will release the token to the beneficiary following a given, customizable, vesting schedule.
* [`VestingWalletCliffConfidential`](#VestingWalletCliffConfidential): Variant of [`VestingWalletConfidential`](#VestingWalletConfidential) which adds a cliff period to the vesting schedule.
+* [`BatcherConfidential`](#BatcherConfidential): A batching primitive that enables routing between two [`ERC7984ERC20Wrapper`](/confidential-contracts/api/token#ERC7984ERC20Wrapper) contracts via a non-confidential route.
For convenience, this directory also includes:
@@ -16,21 +17,773 @@ For convenience, this directory also includes:
[`VestingWalletConfidential`](#VestingWalletConfidential)
[`VestingWalletCliffConfidential`](#VestingWalletCliffConfidential)
[`VestingWalletConfidentialFactory`](#VestingWalletConfidentialFactory)
+[`BatcherConfidential`](#BatcherConfidential)
+
+
+
+
+
+```solidity
+import "@openzeppelin/confidential-contracts/contracts/finance/BatcherConfidential.sol";
+```
+
+`BatcherConfidential` is a batching primitive that enables routing between two [`ERC7984ERC20Wrapper`](/confidential-contracts/api/token#ERC7984ERC20Wrapper) contracts
+via a non-confidential route. Users deposit [`BatcherConfidential.fromToken`](#BatcherConfidential-fromToken--) into the batcher and receive [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) in exchange. Deposits are
+made by using `ERC7984` transfer and call functions such as [`ERC7984.confidentialTransferAndCall`](/confidential-contracts/api/token#ERC7984-confidentialTransferAndCall-address-euint64-bytes-).
+
+Developers must implement the virtual function [`BatcherConfidential._executeRoute`](#BatcherConfidential-_executeRoute-uint256-uint256-) to perform the batch's route. This function is called
+once the batch deposits are unwrapped into the underlying tokens. The function should swap the underlying [`BatcherConfidential.fromToken`](#BatcherConfidential-fromToken--) for
+underlying [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--). If an issue is encountered, the function should return `ExecuteOutcome.Cancel` to cancel the batch.
+
+Developers must also implement the virtual function [`BatcherConfidential.routeDescription`](#BatcherConfidential-routeDescription--) to provide a human readable description of the batch's route.
+
+Claim outputs are rounded down. This may result in small deposits being rounded down to 0 if the exchange rate is less than 1:1.
+[`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) dust from rounding down will accumulate in the batcher over time.
+
+
+The batcher does not support [`ERC7984ERC20Wrapper`](/confidential-contracts/api/token#ERC7984ERC20Wrapper) contracts prior to v0.4.0.
+
+
+
+The batcher could be used to maintain confidentiality of deposits--by default there are no confidentiality guarantees.
+If desired, developers should consider restricting certain functions to increase confidentiality.
+
+
+
+The [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) and [`BatcherConfidential.fromToken`](#BatcherConfidential-fromToken--) must be carefully inspected to ensure proper capacity is maintained. If [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) or
+[`BatcherConfidential.fromToken`](#BatcherConfidential-fromToken--) are filled--resulting in denial of service--batches could get bricked. The batcher would be unable to wrap
+underlying tokens into [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--). Further, if [`BatcherConfidential.fromToken`](#BatcherConfidential-fromToken--) is also filled, cancellation would also fail on rewrap.
+
+
+
+
+Claim the `toToken` corresponding to `account`'s deposit in batch with id `batchId`.
+
+
+This function is not gated and can be called by anyone. Claims could be frontrun.
+
+
+
+
+Quit the batch with id `batchId`. Entire deposit is returned to the user.
+This can only be called if the batch has not yet been dispatched or if the batch was canceled.
+
+
+Developers should consider adding additional restrictions to this function
+if maintaining confidentiality of deposits is critical to the application.
+
+
+
+[`BatcherConfidential.dispatchBatch`](#BatcherConfidential-dispatchBatch--) may fail if an incompatible version of [`ERC7984ERC20Wrapper`](/confidential-contracts/api/token#ERC7984ERC20Wrapper) is used.
+This function must be unrestricted in cases where batch dispatching fails.
+
+
+
+
+Permissionless function to dispatch the current batch. Increments the [`BatcherConfidential.currentBatchId`](#BatcherConfidential-currentBatchId--).
+
+
+Developers should consider adding additional restrictions to this function
+if maintaining confidentiality of deposits is critical to the application.
+
+
+
+
+Dispatch batch callback callable by anyone. This function finalizes the unwrap of [`BatcherConfidential.fromToken`](#BatcherConfidential-fromToken--)
+and calls [`BatcherConfidential._executeRoute`](#BatcherConfidential-_executeRoute-uint256-uint256-) to perform the batch's route. If `_executeRoute` returns `ExecuteOutcome.Partial`,
+this function should be called again with the same `batchId`, `unwrapAmountCleartext`, and `decryptionProof`.
+
+
+
+See [`IERC7984Receiver.onConfidentialTransferReceived`](/confidential-contracts/api/interfaces#IERC7984Receiver-onConfidentialTransferReceived-address-address-euint64-bytes-).
+
+Deposit [`BatcherConfidential.fromToken`](#BatcherConfidential-fromToken--) into the current batch.
+
+
+See [`BatcherConfidential._claim`](#BatcherConfidential-_claim-uint256-address-) to understand how the [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) amount is calculated. Claim amounts are rounded down. Small
+deposits may be rounded down to 0 if the exchange rate is less than 1:1.
+
+
+
+
+Claims `toToken` for `account`'s deposit in batch with id `batchId`. Tokens are always
+sent to `account`, enabling third-party relayers to claim on behalf of depositors.
+
+
+
+Function which is executed by [`BatcherConfidential.dispatchBatchCallback`](#BatcherConfidential-dispatchBatchCallback-uint256-uint64-bytes-) after validation and unwrap finalization. The parameter
+`amount` is the plaintext amount of the `fromToken` which were unwrapped--to attain the underlying tokens received,
+evaluate `amount * fromToken().rate()`. This function should swap the underlying [`BatcherConfidential.fromToken`](#BatcherConfidential-fromToken--) for underlying [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--).
+
+This function returns an [`BatcherConfidential.ExecuteOutcome`](#BatcherConfidential-ExecuteOutcome) enum indicating the new state of the batch. If the route execution is complete,
+the balance of the underlying [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) is wrapped and the exchange rate is set.
+
+
+[`BatcherConfidential.dispatchBatchCallback`](#BatcherConfidential-dispatchBatchCallback-uint256-uint64-bytes-) (and in turn [`BatcherConfidential._executeRoute`](#BatcherConfidential-_executeRoute-uint256-uint256-)) can be repeatedly called until the route execution is complete.
+If a multi-step route is necessary, intermediate steps should return `ExecuteOutcome.Partial`. Intermediate steps *must* not
+result in underlying [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) being transferred into the batcher.
+
+
+[WARNING]
+#### This function must eventually return `ExecuteOutcome.Complete` or `ExecuteOutcome.Cancel`. Failure to do so results
+in user deposits being locked indefinitely.
+
+Additionally, the following must hold:
+
+- `swappedAmount >= ceil(unwrapAmountCleartext / 10 ** exchangeRateDecimals()) * toToken().rate()` (the exchange rate must not be 0)
+- `swappedAmount \<= type(uint64).max * toToken().rate()` (the wrapped amount of [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) must fit in `uint64`)
+
+
+
+Check that the current state of a batch matches the requirements described by the `allowedStates` bitmap.
+This bitmap should be built using `_encodeStateBitmap`.
+
+If requirements are not met, reverts with a [`BatcherConfidential.BatchUnexpectedState`](#BatcherConfidential-BatchUnexpectedState-uint256-enum-BatcherConfidential-BatchState-bytes32-) error.
+
+
+
+Encodes a `BatchState` into a `bytes32` representation where each bit enabled corresponds to
+the underlying position in the `BatchState` enum. For example:
+
+0x000...1000
+ ^--- Canceled
+ ^-- Finalized
+ ^- Dispatched
+ ^ Pending
+
+
+
+The `batchId` does not exist. Batch IDs start at 1 and must be less than or equal to [`BatcherConfidential.currentBatchId`](#BatcherConfidential-currentBatchId--).
+
+
+
+The batch `batchId` is in the state `current`, which is invalid for the operation.
+The `expectedStates` is a bitmap encoding the expected/allowed states for the operation.
+
+See [`BatcherConfidential._encodeStateBitmap`](#BatcherConfidential-_encodeStateBitmap-enum-BatcherConfidential-BatchState-).
+
+
+
+Thrown when the given exchange rate is invalid. The exchange rate must be non-zero and the wrapped
+amount of [`BatcherConfidential.toToken`](#BatcherConfidential-toToken--) must be less than or equal to `type(uint64).max`.
+
+
```solidity
-import "@openzeppelin/confidential-contracts/finance/VestingWalletConfidential.sol";
+import "@openzeppelin/confidential-contracts/contracts/finance/VestingWalletConfidential.sol";
```
A vesting wallet is an ownable contract that can receive ERC7984 tokens, and release these
@@ -354,7 +1164,7 @@ Since the wallet is `Ownable`, and ownership can be transferred, it is possible
When using this contract with any token whose balance is adjusted automatically (i.e. a rebase token), make
-sure to account the supply/balance adjustment in the vesting schedule to ensure the vested amount is as intended.
+sure to account for the supply/balance adjustment in the vesting schedule to ensure the vested amount is as intended.
Confidential vesting wallet contracts can be deployed (as clones) using the [`VestingWalletConfidentialFactory`](#VestingWalletConfidentialFactory).
@@ -372,9 +1182,16 @@ Confidential vesting wallet contracts can be deployed (as clones) using the [`Ve
- [__VestingWalletConfidential_init(beneficiary, startTimestamp, durationSeconds)](#VestingWalletConfidential-__VestingWalletConfidential_init-address-uint48-uint48-)
- [__VestingWalletConfidential_init_unchained(startTimestamp, durationSeconds)](#VestingWalletConfidential-__VestingWalletConfidential_init_unchained-uint48-uint48-)
- [_vestingSchedule(totalAllocation, timestamp)](#VestingWalletConfidential-_vestingSchedule-euint128-uint48-)
-#### ReentrancyGuardTransient [!toc]
+
+ReentrancyGuardTransient
+
- [_reentrancyGuardEntered()](#ReentrancyGuardTransient-_reentrancyGuardEntered--)
-#### OwnableUpgradeable [!toc]
+- [_reentrancyGuardStorageSlot()](#ReentrancyGuardTransient-_reentrancyGuardStorageSlot--)
+
+
+
+OwnableUpgradeable
+
- [__Ownable_init(initialOwner)](#OwnableUpgradeable-__Ownable_init-address-)
- [__Ownable_init_unchained(initialOwner)](#OwnableUpgradeable-__Ownable_init_unchained-address-)
- [owner()](#OwnableUpgradeable-owner--)
@@ -382,18 +1199,28 @@ Confidential vesting wallet contracts can be deployed (as clones) using the [`Ve
- [renounceOwnership()](#OwnableUpgradeable-renounceOwnership--)
- [transferOwnership(newOwner)](#OwnableUpgradeable-transferOwnership-address-)
- [_transferOwnership(newOwner)](#OwnableUpgradeable-_transferOwnership-address-)
-#### ContextUpgradeable [!toc]
+
+
+
+ContextUpgradeable
+
- [__Context_init()](#ContextUpgradeable-__Context_init--)
- [__Context_init_unchained()](#ContextUpgradeable-__Context_init_unchained--)
- [_msgSender()](#ContextUpgradeable-_msgSender--)
- [_msgData()](#ContextUpgradeable-_msgData--)
- [_contextSuffixLength()](#ContextUpgradeable-_contextSuffixLength--)
-#### Initializable [!toc]
+
+
+
+Initializable
+
- [_checkInitializing()](#Initializable-_checkInitializing--)
- [_disableInitializers()](#Initializable-_disableInitializers--)
- [_getInitializedVersion()](#Initializable-_getInitializedVersion--)
- [_isInitializing()](#Initializable-_isInitializing--)
- [_initializableStorageSlot()](#Initializable-_initializableStorageSlot--)
+
+
@@ -401,27 +1228,44 @@ Confidential vesting wallet contracts can be deployed (as clones) using the [`Ve
```solidity
-import "@openzeppelin/confidential-contracts/finance/VestingWalletConfidentialFactory.sol";
+import "@openzeppelin/confidential-contracts/contracts/finance/VestingWalletConfidentialFactory.sol";
```
A factory which enables batch funding of vesting wallets.
@@ -836,3 +1680,4 @@ Emitted when a vesting wallet is deployed.
+
diff --git a/content/confidential-contracts/api/governance.mdx b/content/confidential-contracts/api/governance.mdx
index 4089b3d4..1eec5652 100644
--- a/content/confidential-contracts/api/governance.mdx
+++ b/content/confidential-contracts/api/governance.mdx
@@ -14,20 +14,20 @@ This directory includes primitives for on-chain confidential governance.
```solidity
-import "@openzeppelin/confidential-contracts/governance/utils/VotesConfidential.sol";
+import "@openzeppelin/confidential-contracts/contracts/governance/utils/VotesConfidential.sol";
```
A confidential votes contract tracking confidential voting power of accounts over time.
-It features vote delegation to delegators.
+It features vote delegation to delegatees.
This contract keeps a history (checkpoints) of each account's confidential vote power. Confidential
voting power can be delegated either by calling the [`VotesConfidential.delegate`](#VotesConfidential-delegate-address-) function directly, or by providing
@@ -36,7 +36,7 @@ through the public accessors [`VotesConfidential.getVotes`](#VotesConfidential-g
allowed to access them. Ensure that [`HandleAccessManager._validateHandleAllowance`](/confidential-contracts/api/utils#HandleAccessManager-_validateHandleAllowance-bytes32-) is implemented properly, allowing all
necessary addresses to access voting power handles.
-By default, voting units does not account for voting power. This makes transfers of underlying
+By default, transfer of voting units does not account for voting power. This makes transfers of
voting units cheaper. The downside is that it requires users to delegate to themselves in order
to activate checkpoints and have their voting power tracked.
@@ -57,21 +57,31 @@ to activate checkpoints and have their voting power tracked.
- [_moveDelegateVotes(from, to, amount)](#VotesConfidential-_moveDelegateVotes-address-address-euint64-)
- [_validateTimepoint(timepoint)](#VotesConfidential-_validateTimepoint-uint256-)
- [_getVotingUnits()](#VotesConfidential-_getVotingUnits-address-)
-#### HandleAccessManager [!toc]
+
+HandleAccessManager
+
- [getHandleAllowance(handle, account, persistent)](#HandleAccessManager-getHandleAllowance-bytes32-address-bool-)
-- [_validateHandleAllowance(handle)](#HandleAccessManager-_validateHandleAllowance-bytes32-)
-#### IERC6372 [!toc]
-#### EIP712 [!toc]
+- [_validateHandleAllowance()](#HandleAccessManager-_validateHandleAllowance-bytes32-)
+
+
+
+EIP712
+
- [_domainSeparatorV4()](#EIP712-_domainSeparatorV4--)
- [_hashTypedDataV4(structHash)](#EIP712-_hashTypedDataV4-bytes32-)
- [eip712Domain()](#EIP712-eip712Domain--)
- [_EIP712Name()](#EIP712-_EIP712Name--)
- [_EIP712Version()](#EIP712-_EIP712Version--)
-#### IERC5267 [!toc]
-#### Nonces [!toc]
+
+
+
+Nonces
+
- [nonces(owner)](#Nonces-nonces-address-)
- [_useNonce(owner)](#Nonces-_useNonce-address-)
- [_useCheckedNonce(owner, nonce)](#Nonces-_useCheckedNonce-address-uint256-)
+
+
@@ -80,12 +90,12 @@ to activate checkpoints and have their voting power tracked.
```solidity
-import "@openzeppelin/confidential-contracts/interfaces/IERC7984.sol";
+import "@openzeppelin/confidential-contracts/contracts/interfaces/IERC7984.sol";
```
Draft interface for a confidential fungible token standard utilizing the Zama FHE library.
@@ -49,8 +54,12 @@ Draft interface for a confidential fungible token standard utilizing the Zama FH
- [confidentialTransferAndCall(to, amount, data)](#IERC7984-confidentialTransferAndCall-address-euint64-bytes-)
- [confidentialTransferFromAndCall(from, to, encryptedAmount, inputProof, data)](#IERC7984-confidentialTransferFromAndCall-address-address-externalEuint64-bytes-bytes-)
- [confidentialTransferFromAndCall(from, to, amount, data)](#IERC7984-confidentialTransferFromAndCall-address-address-euint64-bytes-)
-#### IERC165 [!toc]
+
+IERC165
+
- [supportsInterface(interfaceId)](#IERC165-supportsInterface-bytes4-)
+
+
@@ -60,7 +69,6 @@ Draft interface for a confidential fungible token standard utilizing the Zama FH
- [OperatorSet(holder, operator, until)](#IERC7984-OperatorSet-address-address-uint48-)
- [ConfidentialTransfer(from, to, amount)](#IERC7984-ConfidentialTransfer-address-address-euint64-)
- [AmountDisclosed(encryptedAmount, amount)](#IERC7984-AmountDisclosed-euint64-uint64-)
-#### IERC165 [!toc]
@@ -235,7 +243,7 @@ Returns the encrypted amount that was actually transferred.
-Similar to #IERC7984-confidentialTransfer-address-externalEuint64-bytes- but without an input proof. The caller
+Similar to `confidentialTransfer-address-externalEuint64-bytes` but without an input proof. The caller
*must* already be allowed by ACL for the given `amount`.
@@ -273,7 +281,7 @@ Returns the encrypted amount that was actually transferred.
-Similar to #IERC7984-confidentialTransferFrom-address-address-externalEuint64-bytes- but without an input proof.
+Similar to `confidentialTransferFrom-address-address-externalEuint64-bytes` but without an input proof.
The caller *must* be already allowed by ACL for the given `amount`.
@@ -291,7 +299,7 @@ The caller *must* be already allowed by ACL for the given `amount`.
-Similar to #IERC7984-confidentialTransfer-address-externalEuint64-bytes- but with a callback to `to` after
+Similar to `confidentialTransfer-address-externalEuint64-bytes` but with a callback to `to` after
the transfer.
The callback is made to the [`IERC7984Receiver.onConfidentialTransferReceived`](#IERC7984Receiver-onConfidentialTransferReceived-address-address-euint64-bytes-) function on the
@@ -313,7 +321,7 @@ data `data`.
-Similar to #IERC7984-confidentialTransfer-address-euint64- but with a callback to `to` after the transfer.
+Similar to `confidentialTransfer-address-euint64` but with a callback to `to` after the transfer.
@@ -330,7 +338,7 @@ Similar to #IERC7984-confidentialTransfer-address-euint64- but with a callback t
-Similar to #IERC7984-confidentialTransferFrom-address-address-externalEuint64-bytes- but with a callback to `to`
+Similar to `confidentialTransferFrom-address-address-externalEuint64-bytes` but with a callback to `to`
after the transfer.
@@ -348,7 +356,7 @@ after the transfer.
-Similar to #IERC7984-confidentialTransferFrom-address-address-euint64- but with a callback to `to`
+Similar to `confidentialTransferFrom-address-address-euint64` but with a callback to `to`
after the transfer.
@@ -410,20 +418,240 @@ should be able to disclose the amount. This functionality is implementation spec
+
+
+
+
+Unwraps tokens from `from` and sends the underlying tokens to `to`. The caller must be `from`
+or be an approved operator for `from`.
+
+Returns the unwrap request id.
+
+
+The returned unwrap request id must never be zero.
+
+
+
+
+Returns the rate at which the underlying token is converted to the wrapped token.
+For example, if the `rate` is 1000, then 1000 units of the underlying token equal 1 unit of the wrapped token.
+
+
```solidity
-import "@openzeppelin/confidential-contracts/interfaces/IERC7984Receiver.sol";
+import "@openzeppelin/confidential-contracts/contracts/interfaces/IERC7984Receiver.sol";
```
Interface for contracts that can receive ERC7984 transfers with a callback.
@@ -448,7 +676,15 @@ Interface for contracts that can receive ERC7984 transfers with a callback.
Called upon receiving a confidential token transfer. Returns an encrypted boolean indicating success
-of the callback. If false is returned, the transfer must be reversed.
+of the callback. If false is returned, the token contract will attempt to refund the transfer.
+
+
+The calling contract (token) must be granted ACL allowance to read the confidential return value.
+
+
+
+Do not manually refund the transfer AND return false, as this can lead to double refunds.
+
@@ -457,16 +693,16 @@ of the callback. If false is returned, the transfer must be reversed.
diff --git a/content/confidential-contracts/api/token.mdx b/content/confidential-contracts/api/token.mdx
index c1cb0ba9..e5215b12 100644
--- a/content/confidential-contracts/api/token.mdx
+++ b/content/confidential-contracts/api/token.mdx
@@ -12,6 +12,7 @@ This set of interfaces, contracts, and utilities are all related to `ERC7984`, a
* [`ERC7984Restricted`](#ERC7984Restricted): An extension of [`ERC7984`](#ERC7984) that implements user account transfer restrictions.
* [`ERC7984Omnibus`](#ERC7984Omnibus): An extension of [`ERC7984`](#ERC7984) that emits additional events for omnibus transfers, which contain encrypted addresses for the sub-account sender and recipient.
* [`ERC7984Rwa`](#ERC7984Rwa): Extension of [`ERC7984`](#ERC7984) that supports confidential Real World Assets (RWAs) by providing compliance checks, transfer controls and enforcement actions.
+* [`ERC7984Votes`](#ERC7984Votes): An extension of [`ERC7984`](#ERC7984) that supports confidential vote tracking and delegation via [`VotesConfidential`](/confidential-contracts/api/governance#VotesConfidential).
* [`ERC7984Utils`](#ERC7984Utils): A library that provides the on-transfer callback check used by [`ERC7984`](#ERC7984).
## Core
@@ -24,6 +25,7 @@ This set of interfaces, contracts, and utilities are all related to `ERC7984`, a
[`ERC7984Restricted`](#ERC7984Restricted)
[`ERC7984Omnibus`](#ERC7984Omnibus)
[`ERC7984Rwa`](#ERC7984Rwa)
+[`ERC7984Votes`](#ERC7984Votes)
## Utilities
[`ERC7984Utils`](#ERC7984Utils)
@@ -32,16 +34,16 @@ This set of interfaces, contracts, and utilities are all related to `ERC7984`, a
-Similar to interfaces#IERC7984-confidentialTransfer-address-externalEuint64-bytes- but without an input proof. The caller
+Similar to `confidentialTransfer-address-externalEuint64-bytes` but without an input proof. The caller
*must* already be allowed by ACL for the given `amount`.
@@ -368,7 +365,7 @@ Returns the encrypted amount that was actually transferred.
-Similar to interfaces#IERC7984-confidentialTransferFrom-address-address-externalEuint64-bytes- but without an input proof.
+Similar to `confidentialTransferFrom-address-address-externalEuint64-bytes` but without an input proof.
The caller *must* be already allowed by ACL for the given `amount`.
@@ -386,7 +383,7 @@ The caller *must* be already allowed by ACL for the given `amount`.
-Similar to interfaces#IERC7984-confidentialTransfer-address-externalEuint64-bytes- but with a callback to `to` after
+Similar to `confidentialTransfer-address-externalEuint64-bytes` but with a callback to `to` after
the transfer.
The callback is made to the [`IERC7984Receiver.onConfidentialTransferReceived`](/confidential-contracts/api/interfaces#IERC7984Receiver-onConfidentialTransferReceived-address-address-euint64-bytes-) function on the
@@ -408,7 +405,7 @@ data `data`.
-Similar to interfaces#IERC7984-confidentialTransfer-address-euint64- but with a callback to `to` after the transfer.
+Similar to `confidentialTransfer-address-euint64` but with a callback to `to` after the transfer.
@@ -425,7 +422,7 @@ Similar to interfaces#IERC7984-confidentialTransfer-address-euint64- but with a
-Similar to interfaces#IERC7984-confidentialTransferFrom-address-address-externalEuint64-bytes- but with a callback to `to`
+Similar to `confidentialTransferFrom-address-address-externalEuint64-bytes` but with a callback to `to`
after the transfer.
@@ -443,7 +440,7 @@ after the transfer.
-Similar to interfaces#IERC7984-confidentialTransferFrom-address-address-euint64- but with a callback to `to`
+Similar to `confidentialTransferFrom-address-address-euint64` but with a callback to `to`
after the transfer.
@@ -707,37 +704,20 @@ The given caller `caller` is not authorized for the current operation.
-
-
-
```solidity
-import "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol";
+import "@openzeppelin/confidential-contracts/contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol";
```
A wrapper contract built on top of [`ERC7984`](#ERC7984) that allows wrapping an `ERC20` token
@@ -753,20 +733,27 @@ tokens such as fee-on-transfer or other deflationary-type tokens are not support
Functions
- [constructor(underlying_)](#ERC7984ERC20Wrapper-constructor-contract-IERC20-)
-- [decimals()](#ERC7984ERC20Wrapper-decimals--)
-- [rate()](#ERC7984ERC20Wrapper-rate--)
-- [underlying()](#ERC7984ERC20Wrapper-underlying--)
- [onTransferReceived(, from, amount, data)](#ERC7984ERC20Wrapper-onTransferReceived-address-address-uint256-bytes-)
- [wrap(to, amount)](#ERC7984ERC20Wrapper-wrap-address-uint256-)
- [unwrap(from, to, amount)](#ERC7984ERC20Wrapper-unwrap-address-address-euint64-)
- [unwrap(from, to, encryptedAmount, inputProof)](#ERC7984ERC20Wrapper-unwrap-address-address-externalEuint64-bytes-)
-- [finalizeUnwrap(burntAmount, burntAmountCleartext, decryptionProof)](#ERC7984ERC20Wrapper-finalizeUnwrap-euint64-uint64-bytes-)
+- [finalizeUnwrap(unwrapRequestId, unwrapAmountCleartext, decryptionProof)](#ERC7984ERC20Wrapper-finalizeUnwrap-bytes32-uint64-bytes-)
+- [decimals()](#ERC7984ERC20Wrapper-decimals--)
+- [rate()](#ERC7984ERC20Wrapper-rate--)
+- [underlying()](#ERC7984ERC20Wrapper-underlying--)
+- [unwrapAmount(unwrapRequestId)](#ERC7984ERC20Wrapper-unwrapAmount-bytes32-)
+- [supportsInterface(interfaceId)](#ERC7984ERC20Wrapper-supportsInterface-bytes4-)
+- [inferredTotalSupply()](#ERC7984ERC20Wrapper-inferredTotalSupply--)
+- [maxTotalSupply()](#ERC7984ERC20Wrapper-maxTotalSupply--)
+- [unwrapRequester(unwrapRequestId)](#ERC7984ERC20Wrapper-unwrapRequester-bytes32-)
+- [_checkConfidentialTotalSupply()](#ERC7984ERC20Wrapper-_checkConfidentialTotalSupply--)
+- [_update(from, to, amount)](#ERC7984ERC20Wrapper-_update-address-address-euint64-)
- [_unwrap(from, to, amount)](#ERC7984ERC20Wrapper-_unwrap-address-address-euint64-)
- [_fallbackUnderlyingDecimals()](#ERC7984ERC20Wrapper-_fallbackUnderlyingDecimals--)
- [_maxDecimals()](#ERC7984ERC20Wrapper-_maxDecimals--)
-#### IERC1363Receiver [!toc]
-#### ERC7984 [!toc]
-- [supportsInterface(interfaceId)](#ERC7984-supportsInterface-bytes4-)
+
+ERC7984
+
- [name()](#ERC7984-name--)
- [symbol()](#ERC7984-symbol--)
- [contractURI()](#ERC7984-contractURI--)
@@ -789,46 +776,54 @@ tokens such as fee-on-transfer or other deflationary-type tokens are not support
- [_burn(from, amount)](#ERC7984-_burn-address-euint64-)
- [_transfer(from, to, amount)](#ERC7984-_transfer-address-address-euint64-)
- [_transferAndCall(from, to, amount, data)](#ERC7984-_transferAndCall-address-address-euint64-bytes-)
-- [_update(from, to, amount)](#ERC7984-_update-address-address-euint64-)
-#### ERC165 [!toc]
-#### IERC7984 [!toc]
-#### IERC165 [!toc]
+
+
+
+`ERC1363` callback function which wraps tokens to the address specified in `data` or
+the address `from` (if no address is specified in `data`). This function refunds any excess tokens
+sent beyond the nearest multiple of [`ERC7984ERC20Wrapper.rate`](#ERC7984ERC20Wrapper-rate--) to `from`. See [`ERC7984ERC20Wrapper.wrap`](#ERC7984ERC20Wrapper-wrap-address-uint256-) for more details on wrapping tokens.
+
+
+
+See [`IERC7984ERC20Wrapper.wrap`](/confidential-contracts/api/interfaces#IERC7984ERC20Wrapper-wrap-address-uint256-). Tokens are exchanged at a fixed rate specified by [`ERC7984ERC20Wrapper.rate`](#ERC7984ERC20Wrapper-rate--) such that
+`amount / rate()` confidential tokens are sent. The amount transferred in is rounded down to the nearest
+multiple of [`ERC7984ERC20Wrapper.rate`](#ERC7984ERC20Wrapper-rate--).
+
+Returns the amount of wrapped token sent.
+
+
+
+
+
+
+
+
+
unwrap(address from, address to, euint64 amount) โ bytes32
+
+See [`IERC7984ERC20Wrapper.unwrap`](/confidential-contracts/api/interfaces#IERC7984ERC20Wrapper-unwrap-address-address-externalEuint64-bytes-). `amount * rate()` underlying tokens are sent to `to`.
+
+
+The unwrap request created by this function must be finalized by calling [`ERC7984ERC20Wrapper.finalizeUnwrap`](#ERC7984ERC20Wrapper-finalizeUnwrap-bytes32-uint64-bytes-).
+
+
+
-`ERC1363` callback function which wraps tokens to the address specified in `data` or
-the address `from` (if no address is specified in `data`). This function refunds any excess tokens
-sent beyond the nearest multiple of [`ERC7984ERC20Wrapper.rate`](#ERC7984ERC20Wrapper-rate--). See [`ERC7984ERC20Wrapper.wrap`](#ERC7984ERC20Wrapper-wrap-address-uint256-) from more details on wrapping tokens.
+Returns the amount of wrapper tokens that were unwrapped for a given `unwrapRequestId`.
-Wraps amount `amount` of the underlying token into a confidential token and sends it to
-`to`. Tokens are exchanged at a fixed rate specified by [`ERC7984ERC20Wrapper.rate`](#ERC7984ERC20Wrapper-rate--) such that `amount / rate()` confidential
-tokens are sent. Amount transferred in is rounded down to the nearest multiple of [`ERC7984ERC20Wrapper.rate`](#ERC7984ERC20Wrapper-rate--).
+Returns true if this contract implements the interface defined by
+`interfaceId`. See the corresponding
+[ERC section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
+to learn more about how these ids are created.
+
+This function call must use less than 30 000 gas.
-Unwraps tokens from `from` and sends the underlying tokens to `to`. The caller must be `from`
-or be an approved operator for `from`. `amount * rate()` underlying tokens are sent to `to`.
+Returns the underlying balance divided by the [`ERC7984ERC20Wrapper.rate`](#ERC7984ERC20Wrapper-rate--), a value greater or equal to the actual
+[`ERC7984.confidentialTotalSupply`](#ERC7984-confidentialTotalSupply--).
-The unwrap request created by this function must be finalized by calling [`ERC7984ERC20Wrapper.finalizeUnwrap`](#ERC7984ERC20Wrapper-finalizeUnwrap-euint64-uint64-bytes-).
-
-
-The caller *must* already be approved by ACL for the given `amount`.
+The return value of this function can be inflated by directly sending underlying tokens to the wrapper contract.
+Reductions will lag compared to [`ERC7984.confidentialTotalSupply`](#ERC7984-confidentialTotalSupply--) since it is updated on [`ERC7984ERC20Wrapper.unwrap`](#ERC7984ERC20Wrapper-unwrap-address-address-externalEuint64-bytes-) while this function updates
+on [`ERC7984ERC20Wrapper.finalizeUnwrap`](#ERC7984ERC20Wrapper-finalizeUnwrap-bytes32-uint64-bytes-).
-
+
-
unwrap(address from, address to, externalEuint64 encryptedAmount, bytes inputProof)
-Variant of [`ERC7984ERC20Wrapper.unwrap`](#ERC7984ERC20Wrapper-unwrap-address-address-externalEuint64-bytes-) that passes an `inputProof` which approves the caller for the `encryptedAmount`
-in the ACL.
+Returns the maximum total supply of wrapped tokens supported by the encrypted datatype.
+
+Gets the address that will receive the ERC-20 tokens associated with a pending unwrap request identified by
+`unwrapRequestId`. Returns `address(0)` if there is no pending unwrap request with id `unwrapRequestId`.
+
+
-Fills an unwrap request for a given cipher-text `burntAmount` with the `cleartextAmount` and `decryptionProof`.
+This function must revert if the new [`ERC7984.confidentialTotalSupply`](#ERC7984-confidentialTotalSupply--) is invalid (overflow occurred).
+
+
+Overflow can be detected here since the wrapper holdings are non-confidential. In other cases, it may be impossible
+to infer total supply overflow synchronously. This function may revert even if the [`ERC7984.confidentialTotalSupply`](#ERC7984-confidentialTotalSupply--) did
+not overflow.
+
+
+
+
+
+
+
+
+
+
_update(address from, address to, euint64 amount) โ euint64
@@ -1001,7 +1129,7 @@ Fills an unwrap request for a given cipher-text `burntAmount` with the `cleartex
-
_unwrap(address from, address to, euint64 amount)
+
_unwrap(address from, address to, euint64 amount) โ bytes32
internal
#
@@ -1009,6 +1137,8 @@ Fills an unwrap request for a given cipher-text `burntAmount` with the `cleartex
+Internal logic for handling the creation of unwrap requests. Returns the unwrap request id.
+
@@ -1043,50 +1173,34 @@ ERC-20 token.
-Returns the maximum number that will be used for [`IERC7984.decimals`](/confidential-contracts/api/interfaces#IERC7984-decimals--) by the wrapper.
+Returns the maximum number that will be used for [`ERC7984.decimals`](#ERC7984-decimals--) by the wrapper.
```solidity
-import "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984Freezable.sol";
+import "@openzeppelin/confidential-contracts/contracts/token/ERC7984/extensions/ERC7984Freezable.sol";
```
Extension of [`ERC7984`](#ERC7984) that implements a confidential
-freezing mechanism that can be managed by an authorized account with
-[`IERC7984Rwa.setConfidentialFrozen`](/confidential-contracts/api/interfaces#IERC7984Rwa-setConfidentialFrozen-address-euint64-) functions.
+freezing mechanism that can be managed by calling the internal function
+[`ERC7984Freezable._setConfidentialFrozen`](#ERC7984Freezable-_setConfidentialFrozen-address-euint64-) by an inheriting contract.
-The freezing mechanism provides the guarantee to the contract owner
-(e.g. a DAO or a well-configured multisig) that a specific confidential
+The freezing mechanism provides the guarantee that a specific confidential
amount of tokens held by an account won't be transferable until those
tokens are unfrozen.
@@ -1129,7 +1242,9 @@ Inspired by https://github.com/OpenZeppelin/openzeppelin-community-contracts/blo
- [_confidentialAvailable(account)](#ERC7984Freezable-_confidentialAvailable-address-)
- [_setConfidentialFrozen(account, encryptedAmount)](#ERC7984Freezable-_setConfidentialFrozen-address-euint64-)
- [_update(from, to, encryptedAmount)](#ERC7984Freezable-_update-address-address-euint64-)
-#### ERC7984 [!toc]
+
+ERC7984
+
- [supportsInterface(interfaceId)](#ERC7984-supportsInterface-bytes4-)
- [name()](#ERC7984-name--)
- [symbol()](#ERC7984-symbol--)
@@ -1154,9 +1269,8 @@ Inspired by https://github.com/OpenZeppelin/openzeppelin-community-contracts/blo
- [_burn(from, amount)](#ERC7984-_burn-address-euint64-)
- [_transfer(from, to, amount)](#ERC7984-_transfer-address-address-euint64-)
- [_transferAndCall(from, to, amount, data)](#ERC7984-_transferAndCall-address-address-euint64-bytes-)
-#### ERC165 [!toc]
-#### IERC7984 [!toc]
-#### IERC165 [!toc]
+
+
@@ -1164,31 +1278,37 @@ Inspired by https://github.com/OpenZeppelin/openzeppelin-community-contracts/blo
```solidity
-import "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984ObserverAccess.sol";
+import "@openzeppelin/confidential-contracts/contracts/token/ERC7984/extensions/ERC7984ObserverAccess.sol";
```
-Extension of [`ERC7984`](#ERC7984) that allows each account to add a observer who is given
-permanent ACL access to its transfer and balance amounts. A observer can be added or removed at any point in time.
+Extension of [`ERC7984`](#ERC7984) that allows each account to add an observer who is given
+permanent ACL access to its transfer and balance amounts. An observer can be added or removed at any point in time.
Functions
@@ -1326,7 +1446,9 @@ permanent ACL access to its transfer and balance amounts. A observer can be adde
- [setObserver(account, newObserver)](#ERC7984ObserverAccess-setObserver-address-address-)
- [observer(account)](#ERC7984ObserverAccess-observer-address-)
- [_update(from, to, amount)](#ERC7984ObserverAccess-_update-address-address-euint64-)
-#### ERC7984 [!toc]
+
+ERC7984
+
- [supportsInterface(interfaceId)](#ERC7984-supportsInterface-bytes4-)
- [name()](#ERC7984-name--)
- [symbol()](#ERC7984-symbol--)
@@ -1351,9 +1473,8 @@ permanent ACL access to its transfer and balance amounts. A observer can be adde
- [_burn(from, amount)](#ERC7984-_burn-address-euint64-)
- [_transfer(from, to, amount)](#ERC7984-_transfer-address-address-euint64-)
- [_transferAndCall(from, to, amount, data)](#ERC7984-_transferAndCall-address-address-euint64-bytes-)
-#### ERC165 [!toc]
-#### IERC7984 [!toc]
-#### IERC165 [!toc]
+
+
@@ -1361,14 +1482,20 @@ permanent ACL access to its transfer and balance amounts. A observer can be adde
-Wraps the interfaces#IERC7984-confidentialTransfer-address-externalEuint64-bytes- function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
+Wraps the `confidentialTransfer-address-externalEuint64-bytes` function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
@@ -1606,7 +1740,7 @@ Wraps the interfaces#IERC7984-confidentialTransfer-address-externalEuint64-bytes
-Wraps the interfaces#IERC7984-confidentialTransfer-address-euint64- function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
+Wraps the `confidentialTransfer-address-euint64` function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
@@ -1623,7 +1757,7 @@ Wraps the interfaces#IERC7984-confidentialTransfer-address-euint64- function and
-Wraps the interfaces#IERC7984-confidentialTransferFrom-address-address-externalEuint64-bytes- function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
+Wraps the `confidentialTransferFrom-address-address-externalEuint64-bytes` function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
@@ -1640,7 +1774,7 @@ Wraps the interfaces#IERC7984-confidentialTransferFrom-address-address-externalE
-Wraps the interfaces#IERC7984-confidentialTransferFrom-address-address-euint64- function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
+Wraps the `confidentialTransferFrom-address-address-euint64` function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
@@ -1657,7 +1791,7 @@ Wraps the interfaces#IERC7984-confidentialTransferFrom-address-address-euint64-
-Wraps the interfaces#IERC7984-confidentialTransferAndCall-address-externalEuint64-bytes-bytes- function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
+Wraps the `confidentialTransferAndCall-address-externalEuint64-bytes-bytes` function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
@@ -1674,7 +1808,7 @@ Wraps the interfaces#IERC7984-confidentialTransferAndCall-address-externalEuint6
-Wraps the interfaces#IERC7984-confidentialTransferAndCall-address-euint64-bytes- function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
+Wraps the `confidentialTransferAndCall-address-euint64-bytes` function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
@@ -1691,7 +1825,7 @@ Wraps the interfaces#IERC7984-confidentialTransferAndCall-address-euint64-bytes-
-Wraps the interfaces#IERC7984-confidentialTransferFromAndCall-address-address-externalEuint64-bytes-bytes- function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
+Wraps the `confidentialTransferFromAndCall-address-address-externalEuint64-bytes-bytes` function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
@@ -1708,7 +1842,7 @@ Wraps the interfaces#IERC7984-confidentialTransferFromAndCall-address-address-ex
-Wraps the interfaces#IERC7984-confidentialTransferFromAndCall-address-address-euint64-bytes- function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
+Wraps the `confidentialTransferFromAndCall-address-address-euint64-bytes` function and emits the [`ERC7984Omnibus.OmnibusConfidentialTransfer`](#ERC7984Omnibus-OmnibusConfidentialTransfer-address-address-eaddress-eaddress-euint64-) event.
@@ -1796,31 +1930,31 @@ Try using the equivalent transfer function with an input proof.
```solidity
-import "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984Restricted.sol";
+import "@openzeppelin/confidential-contracts/contracts/token/ERC7984/extensions/ERC7984Restricted.sol";
```
Extension of [`ERC7984`](#ERC7984) that implements user account transfer restrictions through the
-[`IERC7984Rwa.isUserAllowed`](/confidential-contracts/api/interfaces#IERC7984Rwa-isUserAllowed-address-) function. Inspired by
+[`ERC7984Restricted.canTransact`](#ERC7984Restricted-canTransact-address-) function. Inspired by
https://github.com/OpenZeppelin/openzeppelin-community-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Restricted.sol.
-By default, each account has no explicit restriction. The [`IERC7984Rwa.isUserAllowed`](/confidential-contracts/api/interfaces#IERC7984Rwa-isUserAllowed-address-) function acts as
-a blocklist. Developers can override [`IERC7984Rwa.isUserAllowed`](/confidential-contracts/api/interfaces#IERC7984Rwa-isUserAllowed-address-) to check that `restriction == ALLOWED`
+By default, each account has no explicit restriction. The [`ERC7984Restricted.canTransact`](#ERC7984Restricted-canTransact-address-) function acts as
+a blocklist. Developers can override [`ERC7984Restricted.canTransact`](#ERC7984Restricted-canTransact-address-) to check that `restriction == ALLOWED`
to implement an allowlist.
@@ -1945,8 +2086,8 @@ See [`ERC7984._update`](#ERC7984-_update-address-address-euint64-). Enforces tra
Requirements:
-* `from` must be allowed to transfer tokens (see [`IERC7984Rwa.isUserAllowed`](/confidential-contracts/api/interfaces#IERC7984Rwa-isUserAllowed-address-)).
-* `to` must be allowed to receive tokens (see [`IERC7984Rwa.isUserAllowed`](/confidential-contracts/api/interfaces#IERC7984Rwa-isUserAllowed-address-)).
+* `from` must be allowed to transfer tokens (see [`ERC7984Restricted.canTransact`](#ERC7984Restricted-canTransact-address-)).
+* `to` must be allowed to receive tokens (see [`ERC7984Restricted.canTransact`](#ERC7984Restricted-canTransact-address-)).
The default restriction behavior can be changed (for a pass-through for instance) by overriding
[`ERC7984Restricted._checkSenderRestriction`](#ERC7984Restricted-_checkSenderRestriction-address-) and/or [`ERC7984Restricted._checkRecipientRestriction`](#ERC7984Restricted-_checkRecipientRestriction-address-).
@@ -2114,16 +2255,16 @@ The operation failed because the user account is restricted.
@@ -2601,7 +2788,7 @@ Burns confidential amount of tokens from account.
-Variant of interfaces#IERC7984Rwa-forceConfidentialTransferFrom-address-address-euint64- with an input proof.
+Variant of `forceConfidentialTransferFrom-address-address-euint64` with an input proof.
@@ -2676,14 +2863,14 @@ Returns true if the contract is paused, and false otherwise.
-
+
@@ -2741,7 +2928,7 @@ Internal function which forces transfer of confidential amount of tokens from ac
-Bypasses the `from` restriction check when performing a [`IERC7984Rwa.forceConfidentialTransferFrom`](/confidential-contracts/api/interfaces#IERC7984Rwa-forceConfidentialTransferFrom-address-address-euint64-).
+Bypasses the `from` restriction check when performing a [`ERC7984Rwa.forceConfidentialTransferFrom`](#ERC7984Rwa-forceConfidentialTransferFrom-address-address-euint64-).
@@ -2760,12 +2947,12 @@ Bypasses the `from` restriction check when performing a [`IERC7984Rwa.forceConfi
Accounts granted the agent role have the following permissioned abilities:
-- Mint/Burn to/from a given address (does not require permission)
-- Force transfer from a given address (does not require permission)
- - Bypasses pause and restriction checks (not frozen)
-- Pause/Unpause the contract
-- Block/Unblock a given account
-- Set frozen amount of tokens for a given account.
+* Mint/Burn to/from a given address (does not require permission)
+* Force transfer from a given address (does not require permission)
+** Bypasses pause and restriction checks (not frozen)
+* Pause/Unpause the contract
+* Block/Unblock a given account
+* Set frozen amount of tokens for a given account.
@@ -2774,22 +2961,22 @@ Accounts granted the agent role have the following permissioned abilities:
```solidity
-import "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984Votes.sol";
+import "@openzeppelin/confidential-contracts/contracts/token/ERC7984/extensions/ERC7984Votes.sol";
```
Extension of [`ERC7984`](#ERC7984) supporting confidential votes tracking and delegation.
The amount of confidential voting units an account has is equal to the balance of
-that account. Voing power is taken into account when an account delegates votes to itself or to another
+that account. Voting power is taken into account when an account delegates votes to itself or to another
account.
```solidity
-import "@openzeppelin/confidential-contracts/token/ERC7984/utils/ERC7984Utils.sol";
+import "@openzeppelin/confidential-contracts/contracts/token/ERC7984/utils/ERC7984Utils.sol";
```
Library that provides common [`ERC7984`](#ERC7984) utility functions.
@@ -3001,3 +3223,4 @@ should try to refund the `from` address.
+
diff --git a/content/confidential-contracts/api/utils.mdx b/content/confidential-contracts/api/utils.mdx
index 2a378b76..0e491fcc 100644
--- a/content/confidential-contracts/api/utils.mdx
+++ b/content/confidential-contracts/api/utils.mdx
@@ -24,16 +24,16 @@ Miscellaneous contracts and libraries containing utility functions you can use t
```solidity
-import "@openzeppelin/confidential-contracts/utils/FHESafeMath.sol";
+import "@openzeppelin/confidential-contracts/contracts/utils/FHESafeMath.sol";
```
Library providing safe arithmetic operations for encrypted values
@@ -41,7 +41,7 @@ to handle potential overflows in FHE operations.
An uninitialized `euint64` value (equivalent to euint64.wrap(bytes32(0))) is evaluated as 0.
-This library will may return an uninitialized value if all inputs are uninitialized.
+This library may return an uninitialized value if all inputs are uninitialized.
@@ -132,23 +132,30 @@ will be `a - b`. Otherwise, `success` will be false, and `res` will be 0.
@@ -168,8 +175,7 @@ Get handle access for the given handle `handle`. Access will be given to the
account `account` with the given persistence flag.
-This function call is gated by `msg.sender` and validated by the
-[`HandleAccessManager._validateHandleAllowance`](#HandleAccessManager-_validateHandleAllowance-bytes32-) function.
+This function call is validated by [`HandleAccessManager._validateHandleAllowance`](#HandleAccessManager-_validateHandleAllowance-bytes32-).
@@ -179,7 +185,7 @@ This function call is gated by `msg.sender` and validated by the
-
_validateHandleAllowance(bytes32 handle)
+
_validateHandleAllowance(bytes32) โ bool
internal
#
@@ -187,26 +193,41 @@ This function call is gated by `msg.sender` and validated by the
-Unimplemented function that must revert if the message sender is not allowed to call
+Validation function that must return true if the message sender is allowed to call
[`HandleAccessManager.getHandleAllowance`](#HandleAccessManager-getHandleAllowance-bytes32-address-bool-) for the given handle.
```solidity
-import "@openzeppelin/confidential-contracts/utils/structs/CheckpointsConfidential.sol";
+import "@openzeppelin/confidential-contracts/contracts/utils/structs/CheckpointsConfidential.sol";
```
This library defines the `Trace*` struct, for checkpointing values as they change at different points in
@@ -541,694 +562,3 @@ Returns checkpoint at given position.
-
-```solidity
-import "@openzeppelin/confidential-contracts/utils/structs/temporary-Checkpoints.sol";
-```
-
-This library defines the `Trace*` struct, for checkpointing values as they change at different points in
-time, and later looking up past values by block number. See [`VotesConfidential`](/confidential-contracts/api/governance#VotesConfidential) as an example.
-
-To create a history of checkpoints define a variable type `Checkpoints.Trace*` in your contract, and store a new
-checkpoint for the current transaction block using the [`CheckpointsConfidential.push`](#CheckpointsConfidential-push-struct-CheckpointsConfidential-TraceEuint64-uint256-euint64-) function.
-
-
-
-Pushes a (`key`, `value`) pair into a Trace256 so that it is stored as the checkpoint.
-
-Returns previous value and new value.
-
-
-Never accept `key` as a user input, since an arbitrary `type(uint256).max` key set will disable the
-library.
-
-
-
-
-Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
-if there is none.
-
-
-This is a variant of [`CheckpointsConfidential.upperLookup`](#CheckpointsConfidential-upperLookup-struct-CheckpointsConfidential-TraceEuint64-uint256-) that is optimized to find "recent" checkpoint (checkpoints with high
-keys).
-
-
-
-
-Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.
-
-Returns previous value and new value.
-
-
-Never accept `key` as a user input, since an arbitrary `type(uint32).max` key set will disable the
-library.
-
-
-
-
-Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
-if there is none.
-
-
-This is a variant of [`CheckpointsConfidential.upperLookup`](#CheckpointsConfidential-upperLookup-struct-CheckpointsConfidential-TraceEuint64-uint256-) that is optimized to find "recent" checkpoint (checkpoints with high
-keys).
-
-
-
-
-Pushes a (`key`, `value`) pair into a Trace208 so that it is stored as the checkpoint.
-
-Returns previous value and new value.
-
-
-Never accept `key` as a user input, since an arbitrary `type(uint48).max` key set will disable the
-library.
-
-
-
-
-Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
-if there is none.
-
-
-This is a variant of [`CheckpointsConfidential.upperLookup`](#CheckpointsConfidential-upperLookup-struct-CheckpointsConfidential-TraceEuint64-uint256-) that is optimized to find "recent" checkpoint (checkpoints with high
-keys).
-
-
-
-
-Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.
-
-Returns previous value and new value.
-
-
-Never accept `key` as a user input, since an arbitrary `type(uint96).max` key set will disable the
-library.
-
-
-
-
-Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
-if there is none.
-
-
-This is a variant of [`CheckpointsConfidential.upperLookup`](#CheckpointsConfidential-upperLookup-struct-CheckpointsConfidential-TraceEuint64-uint256-) that is optimized to find "recent" checkpoint (checkpoints with high
-keys).
-
-
-
@@ -182,6 +183,13 @@ with an [`IAccessControl.AccessControlUnauthorizedAccount`](#IAccessControl-Acce
+Returns true if this contract implements the interface defined by
+`interfaceId`. See the corresponding
+[ERC section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
+to learn more about how these ids are created.
+
+This function call must use less than 30 000 gas.
+
@@ -421,7 +429,7 @@ May emit a [`IAccessControl.RoleRevoked`](#IAccessControl-RoleRevoked-bytes32-ad
## `IAccessControl`
-
+
@@ -679,7 +687,7 @@ Don't confuse with [`IAccessControl.AccessControlUnauthorizedAccount`](#IAccessC
## `Ownable`
-
+
@@ -918,7 +926,7 @@ The owner is not a valid owner account. (eg. `address(0)`)
## `Ownable2Step`
-
+
@@ -951,10 +959,14 @@ from parent (Ownable).
- [transferOwnership(newOwner)](#Ownable2Step-transferOwnership-address-)
- [_transferOwnership(newOwner)](#Ownable2Step-_transferOwnership-address-)
- [acceptOwnership()](#Ownable2Step-acceptOwnership--)
-#### Ownable [!toc]
+
+Ownable
+
- [owner()](#Ownable-owner--)
- [_checkOwner()](#Ownable-_checkOwner--)
- [renounceOwnership()](#Ownable-renounceOwnership--)
+
+
@@ -962,17 +974,25 @@ from parent (Ownable).
@@ -1503,7 +1530,7 @@ Requirements:
- Only can be called by the current [`AccessControlDefaultAdminRules.defaultAdmin`](#AccessControlDefaultAdminRules-defaultAdmin--).
-Emits a DefaultAdminRoleChangeStarted event.
+Emits a [`IAccessControlDefaultAdminRules.DefaultAdminTransferScheduled`](#IAccessControlDefaultAdminRules-DefaultAdminTransferScheduled-address-uint48-) event.
@@ -1547,7 +1574,7 @@ Requirements:
- Only can be called by the current [`AccessControlDefaultAdminRules.defaultAdmin`](#AccessControlDefaultAdminRules-defaultAdmin--).
-May emit a DefaultAdminTransferCanceled event.
+May emit a [`IAccessControlDefaultAdminRules.DefaultAdminTransferCanceled`](#IAccessControlDefaultAdminRules-DefaultAdminTransferCanceled--) event.
@@ -1653,7 +1680,7 @@ Requirements:
- Only can be called by the current [`AccessControlDefaultAdminRules.defaultAdmin`](#AccessControlDefaultAdminRules-defaultAdmin--).
-Emits a DefaultAdminDelayChangeScheduled event and may emit a DefaultAdminDelayChangeCanceled event.
+Emits a [`IAccessControlDefaultAdminRules.DefaultAdminDelayChangeScheduled`](#IAccessControlDefaultAdminRules-DefaultAdminDelayChangeScheduled-uint48-uint48-) event and may emit a [`IAccessControlDefaultAdminRules.DefaultAdminDelayChangeCanceled`](#IAccessControlDefaultAdminRules-DefaultAdminDelayChangeCanceled--) event.
@@ -1695,7 +1722,7 @@ Requirements:
- Only can be called by the current [`AccessControlDefaultAdminRules.defaultAdmin`](#AccessControlDefaultAdminRules-defaultAdmin--).
-May emit a DefaultAdminDelayChangeCanceled event.
+May emit a [`IAccessControlDefaultAdminRules.DefaultAdminDelayChangeCanceled`](#IAccessControlDefaultAdminRules-DefaultAdminDelayChangeCanceled--) event.
@@ -1748,7 +1775,7 @@ See [`AccessControlDefaultAdminRules.defaultAdminDelayIncreaseWait`](#AccessCont
## `AccessControlEnumerable`
-
+
@@ -1769,7 +1796,9 @@ Extension of [`AccessControl`](#AccessControl) that allows enumerating the membe
- [getRoleMembers(role)](#AccessControlEnumerable-getRoleMembers-bytes32-)
- [_grantRole(role, account)](#AccessControlEnumerable-_grantRole-bytes32-address-)
- [_revokeRole(role, account)](#AccessControlEnumerable-_revokeRole-bytes32-address-)
-#### AccessControl [!toc]
+
+AccessControl
+
- [hasRole(role, account)](#AccessControl-hasRole-bytes32-address-)
- [_checkRole(role)](#AccessControl-_checkRole-bytes32-)
- [_checkRole(role, account)](#AccessControl-_checkRole-bytes32-address-)
@@ -1779,37 +1808,35 @@ Extension of [`AccessControl`](#AccessControl) that allows enumerating the membe
- [renounceRole(role, callerConfirmation)](#AccessControl-renounceRole-bytes32-address-)
- [_setRoleAdmin(role, adminRole)](#AccessControl-_setRoleAdmin-bytes32-bytes32-)
- [DEFAULT_ADMIN_ROLE()](#AccessControl-DEFAULT_ADMIN_ROLE-bytes32)
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-#### IAccessControlEnumerable [!toc]
-#### IAccessControl [!toc]
+
+
@@ -1938,7 +1965,7 @@ Overload [`AccessControl._revokeRole`](#AccessControl-_revokeRole-bytes32-addres
## `IAccessControlDefaultAdminRules`
-
+
@@ -1963,12 +1990,16 @@ External interface of AccessControlDefaultAdminRules declared to support ERC-165
- [changeDefaultAdminDelay(newDelay)](#IAccessControlDefaultAdminRules-changeDefaultAdminDelay-uint48-)
- [rollbackDefaultAdminDelay()](#IAccessControlDefaultAdminRules-rollbackDefaultAdminDelay--)
- [defaultAdminDelayIncreaseWait()](#IAccessControlDefaultAdminRules-defaultAdminDelayIncreaseWait--)
-#### IAccessControl [!toc]
+
+IAccessControl
+
- [hasRole(role, account)](#IAccessControl-hasRole-bytes32-address-)
- [getRoleAdmin(role)](#IAccessControl-getRoleAdmin-bytes32-)
- [grantRole(role, account)](#IAccessControl-grantRole-bytes32-address-)
- [revokeRole(role, account)](#IAccessControl-revokeRole-bytes32-address-)
- [renounceRole(role, callerConfirmation)](#IAccessControl-renounceRole-bytes32-address-)
+
+
@@ -1979,10 +2010,14 @@ External interface of AccessControlDefaultAdminRules declared to support ERC-165
- [DefaultAdminTransferCanceled()](#IAccessControlDefaultAdminRules-DefaultAdminTransferCanceled--)
- [DefaultAdminDelayChangeScheduled(newDelay, effectSchedule)](#IAccessControlDefaultAdminRules-DefaultAdminDelayChangeScheduled-uint48-uint48-)
- [DefaultAdminDelayChangeCanceled()](#IAccessControlDefaultAdminRules-DefaultAdminDelayChangeCanceled--)
-#### IAccessControl [!toc]
+
+IAccessControl
+
- [RoleAdminChanged(role, previousAdminRole, newAdminRole)](#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-)
- [RoleGranted(role, account, sender)](#IAccessControl-RoleGranted-bytes32-address-address-)
- [RoleRevoked(role, account, sender)](#IAccessControl-RoleRevoked-bytes32-address-address-)
+
+
@@ -1992,9 +2027,13 @@ External interface of AccessControlDefaultAdminRules declared to support ERC-165
- [AccessControlInvalidDefaultAdmin(defaultAdmin)](#IAccessControlDefaultAdminRules-AccessControlInvalidDefaultAdmin-address-)
- [AccessControlEnforcedDefaultAdminRules()](#IAccessControlDefaultAdminRules-AccessControlEnforcedDefaultAdminRules--)
- [AccessControlEnforcedDefaultAdminDelay(schedule)](#IAccessControlDefaultAdminRules-AccessControlEnforcedDefaultAdminDelay-uint48-)
-#### IAccessControl [!toc]
+
+IAccessControl
+
- [AccessControlUnauthorizedAccount(account, neededRole)](#IAccessControl-AccessControlUnauthorizedAccount-address-bytes32-)
- [AccessControlBadConfirmation()](#IAccessControl-AccessControlBadConfirmation--)
+
+
@@ -2112,7 +2151,7 @@ Requirements:
- Only can be called by the current [`AccessControlDefaultAdminRules.defaultAdmin`](#AccessControlDefaultAdminRules-defaultAdmin--).
-Emits a DefaultAdminRoleChangeStarted event.
+Emits a [`IAccessControlDefaultAdminRules.DefaultAdminTransferScheduled`](#IAccessControlDefaultAdminRules-DefaultAdminTransferScheduled-address-uint48-) event.
@@ -2137,7 +2176,7 @@ Requirements:
- Only can be called by the current [`AccessControlDefaultAdminRules.defaultAdmin`](#AccessControlDefaultAdminRules-defaultAdmin--).
-May emit a DefaultAdminTransferCanceled event.
+May emit a [`IAccessControlDefaultAdminRules.DefaultAdminTransferCanceled`](#IAccessControlDefaultAdminRules-DefaultAdminTransferCanceled--) event.
@@ -2205,7 +2244,7 @@ Requirements:
- Only can be called by the current [`AccessControlDefaultAdminRules.defaultAdmin`](#AccessControlDefaultAdminRules-defaultAdmin--).
-Emits a DefaultAdminDelayChangeScheduled event and may emit a DefaultAdminDelayChangeCanceled event.
+Emits a [`IAccessControlDefaultAdminRules.DefaultAdminDelayChangeScheduled`](#IAccessControlDefaultAdminRules-DefaultAdminDelayChangeScheduled-uint48-uint48-) event and may emit a [`IAccessControlDefaultAdminRules.DefaultAdminDelayChangeCanceled`](#IAccessControlDefaultAdminRules-DefaultAdminDelayChangeCanceled--) event.
@@ -2228,7 +2267,7 @@ Requirements:
- Only can be called by the current [`AccessControlDefaultAdminRules.defaultAdmin`](#AccessControlDefaultAdminRules-defaultAdmin--).
-May emit a DefaultAdminDelayChangeCanceled event.
+May emit a [`IAccessControlDefaultAdminRules.DefaultAdminDelayChangeCanceled`](#IAccessControlDefaultAdminRules-DefaultAdminDelayChangeCanceled--) event.
@@ -2400,7 +2439,7 @@ the operation must wait until `schedule`.
## `IAccessControlEnumerable`
-
+
@@ -2417,31 +2456,43 @@ External interface of AccessControlEnumerable declared to support ERC-165 detect
@@ -2497,7 +2548,7 @@ together with [`AccessControlEnumerable.getRoleMember`](#AccessControlEnumerable
## `AccessManaged`
-
+
@@ -2532,25 +2583,32 @@ functions, and ideally only used in `external` functions. See [`AccessManaged.re
- [isConsumingScheduledOp()](#AccessManaged-isConsumingScheduledOp--)
- [_setAuthority(newAuthority)](#AccessManaged-_setAuthority-address-)
- [_checkCanCall(caller, data)](#AccessManaged-_checkCanCall-address-bytes-)
-#### IAccessManaged [!toc]
@@ -2570,22 +2628,20 @@ functions, and ideally only used in `external` functions. See [`AccessManaged.re
Restricts access to a function as defined by the connected Authority for this contract and the
caller and selector of the function that entered the contract.
-
-In general, this modifier should only be used on `external` functions. It is okay to use it on `public`
+[IMPORTANT]
+#### In general, this modifier should only be used on `external` functions. It is okay to use it on `public`
functions that are used as external entry points and are not called internally. Unless you know what you're
doing, it should never be used on `internal` functions. Failure to follow these rules can have critical security
implications! This is because the permissions are determined by the function that entered the contract, i.e. the
function at the bottom of the call stack, and not the function where the modifier is visible in the source code.
-
-
-Avoid adding this modifier to the [`receive()`](https://docs.soliditylang.org/en/v0.8.20/contracts.html#receive-ether-function)
+#### [WARNING]
+#### Avoid adding this modifier to the [`receive()`](https://docs.soliditylang.org/en/v0.8.20/contracts.html#receive-ether-function)
function or the [`fallback()`](https://docs.soliditylang.org/en/v0.8.20/contracts.html#fallback-function). These
functions are the only execution paths where a function selector cannot be unambiguously determined from the calldata
since the selector defaults to `0x00000000` in the `receive()` function and similarly in the `fallback()` function
if no calldata is provided. (See [`AccessManaged._checkCanCall`](#AccessManaged-_checkCanCall-address-bytes-)).
The `receive()` function will always panic whereas the `fallback()` may panic depending on the calldata length.
-
@@ -2702,7 +2758,7 @@ is less than 4 bytes long.
## `AccessManager`
-
+
@@ -2815,16 +2871,21 @@ mindful of the danger associated with functions such as [`Ownable.renounceOwners
- [updateAuthority(target, newAuthority)](#AccessManager-updateAuthority-address-address-)
- [ADMIN_ROLE()](#AccessManager-ADMIN_ROLE-uint64)
- [PUBLIC_ROLE()](#AccessManager-PUBLIC_ROLE-uint64)
-#### IAccessManager [!toc]
-#### Multicall [!toc]
+
+Multicall
+
- [multicall(data)](#Multicall-multicall-bytes---)
+
+
Events
-#### IAccessManager [!toc]
+
+IAccessManager
+
- [OperationScheduled(operationId, nonce, schedule, caller, target, data)](#IAccessManager-OperationScheduled-bytes32-uint32-uint48-address-address-bytes-)
- [OperationExecuted(operationId, nonce)](#IAccessManager-OperationExecuted-bytes32-uint32-)
- [OperationCanceled(operationId, nonce)](#IAccessManager-OperationCanceled-bytes32-uint32-)
@@ -2837,26 +2898,31 @@ mindful of the danger associated with functions such as [`Ownable.renounceOwners
- [TargetClosed(target, closed)](#IAccessManager-TargetClosed-address-bool-)
- [TargetFunctionRoleUpdated(target, selector, roleId)](#IAccessManager-TargetFunctionRoleUpdated-address-bytes4-uint64-)
- [TargetAdminDelayUpdated(target, delay, since)](#IAccessManager-TargetAdminDelayUpdated-address-uint32-uint48-)
-#### Multicall [!toc]
+
+
@@ -3147,6 +3213,7 @@ Give a label to a role, for improved role discoverability by UIs.
Requirements:
- the caller must be a global admin
+- `roleId` must not be the `ADMIN_ROLE` or `PUBLIC_ROLE`
Emits a [`IAccessManager.RoleLabel`](#IAccessManager-RoleLabel-uint64-string-) event.
@@ -3253,6 +3320,7 @@ Change admin role for a given role.
Requirements:
- the caller must be a global admin
+- `roleId` must not be the `ADMIN_ROLE` or `PUBLIC_ROLE`
Emits a [`IAccessControl.RoleAdminChanged`](#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-) event
@@ -3276,6 +3344,7 @@ Change guardian role for a given role.
Requirements:
- the caller must be a global admin
+- `roleId` must not be the `ADMIN_ROLE` or `PUBLIC_ROLE`
Emits a [`IAccessManager.RoleGuardianChanged`](#IAccessManager-RoleGuardianChanged-uint64-uint64-) event
@@ -3299,6 +3368,7 @@ Update the delay for granting a `roleId`.
Requirements:
- the caller must be a global admin
+- `roleId` must not be the `PUBLIC_ROLE`
Emits a [`IAccessManager.RoleGrantDelayChanged`](#IAccessManager-RoleGrantDelayChanged-uint64-uint32-uint48-) event.
@@ -3774,7 +3844,7 @@ The identifier of the public role. Automatically granted to all addresses with n
## `AuthorityUtils`
-
+
@@ -3816,7 +3886,7 @@ This helper function takes care of invoking `canCall` in a backwards compatible
## `IAccessManaged`
-
+
@@ -3973,7 +4043,7 @@ Authority that manages this contract was updated.
## `IAccessManager`
-
+
@@ -4044,6 +4114,7 @@ import "@openzeppelin/contracts/access/manager/IAccessManager.sol";
- [AccessManagerNotReady(operationId)](#IAccessManager-AccessManagerNotReady-bytes32-)
- [AccessManagerExpired(operationId)](#IAccessManager-AccessManagerExpired-bytes32-)
- [AccessManagerLockedRole(roleId)](#IAccessManager-AccessManagerLockedRole-uint64-)
+- [AccessManagerLockedFunction(selector)](#IAccessManager-AccessManagerLockedFunction-bytes4-)
- [AccessManagerBadConfirmation()](#IAccessManager-AccessManagerBadConfirmation--)
- [AccessManagerUnauthorizedAccount(msgsender, roleId)](#IAccessManager-AccessManagerUnauthorizedAccount-address-uint64-)
- [AccessManagerUnauthorizedCall(caller, target, selector)](#IAccessManager-AccessManagerUnauthorizedCall-address-address-bytes4-)
@@ -4306,6 +4377,7 @@ Give a label to a role, for improved role discoverability by UIs.
Requirements:
- the caller must be a global admin
+- `roleId` must not be the `ADMIN_ROLE` or `PUBLIC_ROLE`
Emits a [`IAccessManager.RoleLabel`](#IAccessManager-RoleLabel-uint64-string-) event.
@@ -4412,6 +4484,7 @@ Change admin role for a given role.
Requirements:
- the caller must be a global admin
+- `roleId` must not be the `ADMIN_ROLE` or `PUBLIC_ROLE`
Emits a [`IAccessControl.RoleAdminChanged`](#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-) event
@@ -4435,6 +4508,7 @@ Change guardian role for a given role.
Requirements:
- the caller must be a global admin
+- `roleId` must not be the `ADMIN_ROLE` or `PUBLIC_ROLE`
Emits a [`IAccessManager.RoleGuardianChanged`](#IAccessManager-RoleGuardianChanged-uint64-uint64-) event
@@ -4458,6 +4532,7 @@ Update the delay for granting a `roleId`.
Requirements:
- the caller must be a global admin
+- `roleId` must not be the `PUBLIC_ROLE`
Emits a [`IAccessManager.RoleGrantDelayChanged`](#IAccessManager-RoleGrantDelayChanged-uint64-uint32-uint48-) event.
@@ -4796,7 +4871,7 @@ Emitted when `account` is granted `roleId`.
The meaning of the `since` argument depends on the `newMember` argument.
If the role is granted to a new member, the `since` argument indicates when the account becomes a member of the role,
-otherwise it indicates the execution delay for this account and roleId is updated.
+otherwise it indicates the timestamp when the execution delay update takes effect for this account and roleId.
@@ -4996,6 +5071,21 @@ Admin delay for a given `target` will be updated to `delay` when `since` is reac
+
+
+
@@ -5092,7 +5182,7 @@ Admin delay for a given `target` will be updated to `delay` when `since` is reac
## `IAuthority`
-
+
diff --git a/content/contracts/5.x/api/account.mdx b/content/contracts/5.x/api/account.mdx
index 8d16aab0..8b021760 100644
--- a/content/contracts/5.x/api/account.mdx
+++ b/content/contracts/5.x/api/account.mdx
@@ -34,9 +34,9 @@ This directory includes contracts to build accounts for ERC-4337. These include:
@@ -353,9 +354,9 @@ Unauthorized call to the account.
-## `AccountERC7579`
+## `AccountERC7579`
-
+
@@ -382,8 +383,8 @@ contract MyAccountERC7579 is AccountERC7579, Initializable {
}
```
-
-* Hook support is not included. See [`AccountERC7579Hooked`](#AccountERC7579Hooked) for a version that hooks to execution.
+[NOTE]
+#### * Hook support is not included. See [`AccountERC7579Hooked`](#AccountERC7579Hooked) for a version that hooks to execution.
* Validator selection, when verifying either ERC-1271 signature or ERC-4337 UserOperation is implemented in
internal virtual functions [`AccountERC7579._extractUserOpValidator`](#AccountERC7579-_extractUserOpValidator-struct-PackedUserOperation-) and [`AccountERC7579._extractSignatureValidator`](#AccountERC7579-_extractSignatureValidator-bytes-). Both are implemented
following common practices. However, this part is not standardized in ERC-7579 (or in any follow-up ERC). Some
@@ -391,10 +392,7 @@ contract MyAccountERC7579 is AccountERC7579, Initializable {
* When combined with [`ERC7739`](/contracts/5.x/api/utils/cryptography#ERC7739), resolution ordering of [`AccountERC7579.isValidSignature`](#AccountERC7579-isValidSignature-bytes32-bytes-) may have an impact ([`ERC7739`](/contracts/5.x/api/utils/cryptography#ERC7739) does not
call super). Manual resolution might be necessary.
* Static calls (using callType `0xfe`) are currently NOT supported.
-
-
-Removing all validator modules will render the account inoperable, as no user operations can be validated thereafter.
-
+#### WARNING: Removing all validator modules will render the account inoperable, as no user operations can be validated thereafter.
Modifiers
@@ -427,11 +425,9 @@ Removing all validator modules will render the account inoperable, as no user op
- [_extractSignatureValidator(signature)](#AccountERC7579-_extractSignatureValidator-bytes-)
- [_decodeFallbackData(data)](#AccountERC7579-_decodeFallbackData-bytes-)
- [_rawSignatureValidation(, )](#AccountERC7579-_rawSignatureValidation-bytes32-bytes-)
-#### IERC7579ModuleConfig [!toc]
-#### IERC7579AccountConfig [!toc]
-#### IERC7579Execution [!toc]
-#### IERC1271 [!toc]
-#### Account [!toc]
+
+Account
+
- [entryPoint()](#Account-entryPoint--)
- [getNonce()](#Account-getNonce--)
- [getNonce(key)](#Account-getNonce-uint192-)
@@ -441,23 +437,21 @@ Removing all validator modules will render the account inoperable, as no user op
- [_checkEntryPoint()](#Account-_checkEntryPoint--)
- [_checkEntryPointOrSelf()](#Account-_checkEntryPointOrSelf--)
- [receive()](#Account-receive--)
-#### IAccount [!toc]
-#### AbstractSigner [!toc]
+
+
@@ -923,7 +915,7 @@ If we had calldata here, we could use calldata slice which are cheaper to manipu
actual copy. However, this would require `_installModule` to get a calldata bytes object instead of a memory
bytes object. This would prevent calling `_installModule` from a contract constructor and would force the use
of external initializers. That may change in the future, as most accounts will probably be deployed as
-clones/proxy/ERC-7702 delegates and therefore rely on initializers anyway.
+clones/proxy/EIP-7702 delegates and therefore rely on initializers anyway.
@@ -984,9 +976,9 @@ The provided initData/deInitData for a fallback module is too short to extract a
-## `AccountERC7579Hooked`
+## `AccountERC7579Hooked`
-
+
@@ -999,7 +991,7 @@ import "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.so
Extension of [`AccountERC7579`](#AccountERC7579) with support for a single hook module (type 4).
If installed, this extension will call the hook module's [`IERC7579Hook.preCheck`](/contracts/5.x/api/interfaces#IERC7579Hook-preCheck-address-uint256-bytes-) before executing any operation
-with [`AccountERC7579._execute`](#AccountERC7579-_execute-Mode-bytes-) (including [`AccessManager.execute`](/contracts/5.x/api/access#AccessManager-execute-address-bytes-) and [`AccountERC7579.executeFromExecutor`](#AccountERC7579-executeFromExecutor-bytes32-bytes-) by default) and [`IERC7579Hook.postCheck`](/contracts/5.x/api/interfaces#IERC7579Hook-postCheck-bytes-) thereafter.
+with [`AccountERC7579._execute`](#AccountERC7579-_execute-Mode-bytes-) (including [`AccountERC7579.execute`](#AccountERC7579-execute-bytes32-bytes-) and [`AccountERC7579.executeFromExecutor`](#AccountERC7579-executeFromExecutor-bytes32-bytes-) by default) and [`IERC7579Hook.postCheck`](/contracts/5.x/api/interfaces#IERC7579Hook-postCheck-bytes-) thereafter.
Hook modules break the check-effect-interaction pattern. In particular, the [`IERC7579Hook.preCheck`](/contracts/5.x/api/interfaces#IERC7579Hook-preCheck-address-uint256-bytes-) hook can
@@ -1027,7 +1019,9 @@ modules or further overriding functions that involve hooks.
- [_uninstallModule(moduleTypeId, module, deInitData)](#AccountERC7579Hooked-_uninstallModule-uint256-address-bytes-)
- [_execute(mode, executionCalldata)](#AccountERC7579Hooked-_execute-Mode-bytes-)
- [_fallback()](#AccountERC7579Hooked-_fallback--)
-#### AccountERC7579 [!toc]
+
+AccountERC7579
+
- [fallback()](#AccountERC7579-fallback-bytes-)
- [supportsExecutionMode(encodedMode)](#AccountERC7579-supportsExecutionMode-bytes32-)
- [installModule(moduleTypeId, module, initData)](#AccountERC7579-installModule-uint256-address-bytes-)
@@ -1042,11 +1036,11 @@ modules or further overriding functions that involve hooks.
- [_extractSignatureValidator(signature)](#AccountERC7579-_extractSignatureValidator-bytes-)
- [_decodeFallbackData(data)](#AccountERC7579-_decodeFallbackData-bytes-)
- [_rawSignatureValidation(, )](#AccountERC7579-_rawSignatureValidation-bytes32-bytes-)
-#### IERC7579ModuleConfig [!toc]
-#### IERC7579AccountConfig [!toc]
-#### IERC7579Execution [!toc]
-#### IERC1271 [!toc]
-#### Account [!toc]
+
+
+
+Account
+
- [entryPoint()](#Account-entryPoint--)
- [getNonce()](#Account-getNonce--)
- [getNonce(key)](#Account-getNonce-uint192-)
@@ -1056,24 +1050,21 @@ modules or further overriding functions that involve hooks.
- [_checkEntryPoint()](#Account-_checkEntryPoint--)
- [_checkEntryPointOrSelf()](#Account-_checkEntryPointOrSelf--)
- [receive()](#Account-receive--)
-#### IAccount [!toc]
-#### AbstractSigner [!toc]
+
+
-Access control mechanism for the [`AccessManager.execute`](/contracts/5.x/api/access#AccessManager-execute-address-bytes-) function.
+Access control mechanism for the [`AccountERC7579.execute`](#AccountERC7579-execute-bytes32-bytes-) function.
By default, only the contract itself is allowed to execute.
Override this function to implement custom access control, for example to allow the
@@ -1401,9 +1392,9 @@ function _erc7821AuthorizedExecutor(
@@ -1445,9 +1436,9 @@ Returns the address of the delegate if `account` has an EIP-7702 delegation setu
-## `IEntryPointExtra`
+## `IEntryPointExtra`
-
+
@@ -1485,9 +1476,9 @@ This is available on all entrypoint since v0.4.0, but is not formally part of th
#
@@ -1536,7 +1530,8 @@ See [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337).
-Parses the validation data into its components. See [`ERC4337Utils.packValidationData`](#ERC4337Utils-packValidationData-bool-uint48-uint48-).
+Parses the validation data into its components and the validity range. See [`ERC4337Utils.packValidationData`](#ERC4337Utils-packValidationData-bool-uint48-uint48-enum-ERC4337Utils-ValidationRange-).
+Strips away the highest bit flag from the `validAfter` and `validUntil` fields.
@@ -1558,6 +1553,24 @@ Packs the validation data into a single uint256. See [`ERC4337Utils.parseValidat
+
+Variant of [`ERC4337Utils.packValidationData`](#ERC4337Utils-packValidationData-bool-uint48-uint48-enum-ERC4337Utils-ValidationRange-) that forces which validity range to use. This overwrites the presence of
+flags in `validAfter` and `validUntil`).
+
+
+
+
@@ -1570,7 +1583,25 @@ Packs the validation data into a single uint256. See [`ERC4337Utils.parseValidat
-Same as [`ERC4337Utils.packValidationData`](#ERC4337Utils-packValidationData-bool-uint48-uint48-), but with a boolean signature success flag.
+Variant of [`ERC4337Utils.packValidationData`](#ERC4337Utils-packValidationData-bool-uint48-uint48-enum-ERC4337Utils-ValidationRange-) that uses a boolean success flag instead of an aggregator address.
+
+
+
+Variant of [`ERC4337Utils.packValidationData`](#ERC4337Utils-packValidationData-bool-uint48-uint48-enum-ERC4337Utils-ValidationRange-) that uses a boolean success flag instead of an aggregator address and that
+forces which validity range to use. This overwrites the presence of flags in `validAfter` and `validUntil`).
@@ -1592,6 +1623,10 @@ Combines two validation data into a single one.
The `aggregator` is set to [`ERC4337Utils.SIG_VALIDATION_SUCCESS`](#ERC4337Utils-SIG_VALIDATION_SUCCESS-uint256) if both are successful, while
the `validAfter` is the maximum and the `validUntil` is the minimum of both.
+
+Returns `SIG_VALIDATION_FAILED` if the validation ranges differ.
+
+
@@ -1812,6 +1847,25 @@ Returns the third section of `paymasterAndData` from the [`PackedUserOperation`]
Returns the fourth section of `paymasterAndData` from the [`PackedUserOperation`](/contracts/5.x/api/interfaces#PackedUserOperation).
+If a paymaster signature is present, it is excluded from the returned data.
+
+
-## `ERC7579Utils`
+## `ERC7579Utils`
-
+
@@ -2285,9 +2339,9 @@ Input calldata not properly formatted and possibly malicious.
-## `eqCallType`
+## `eqCallType`
-
+
@@ -2320,9 +2374,9 @@ Compares two `CallType` values for equality.
-## `eqExecType`
+## `eqExecType`
-
+
@@ -2355,9 +2409,9 @@ Compares two `ExecType` values for equality.
-## `eqModeSelector`
+## `eqModeSelector`
-
+
@@ -2390,9 +2444,9 @@ Compares two `ModeSelector` values for equality.
-## `eqModePayload`
+## `eqModePayload`
-
+
@@ -2420,3 +2474,4 @@ Compares two `ModePayload` values for equality.
+
diff --git a/content/contracts/5.x/api/crosschain.mdx b/content/contracts/5.x/api/crosschain.mdx
index 864666f4..0e1d7b30 100644
--- a/content/contracts/5.x/api/crosschain.mdx
+++ b/content/contracts/5.x/api/crosschain.mdx
@@ -5,88 +5,395 @@ description: "Smart contract crosschain utilities and implementations"
This directory contains contracts for sending and receiving cross chain messages that follows the ERC-7786 standard.
-* [`ERC7786Recipient`](#ERC7786Recipient): generic ERC-7786 crosschain contract that receives messages from a trusted gateway
+* [`CrosschainLinked`](#CrosschainLinked): helper to facilitate communication between a contract on one chain and counterparts on remote chains through ERC-7786 gateways.
+* [`CrosschainRemoteExecutor`](#CrosschainRemoteExecutor): executor contract that relays transaction from a controller on a remote chain.
+* [`ERC7786Recipient`](#ERC7786Recipient): generic ERC-7786 crosschain contract that receives messages from a trusted gateway.
+
+Additionally there are multiple bridge constructions:
+
+* [`BridgeFungible`](#BridgeFungible): Core bridging logic for crosschain ERC-20 transfer. Used by [`BridgeERC20`](#BridgeERC20), [`BridgeERC7802`](#BridgeERC7802) and [`ERC20Crosschain`](/contracts/5.x/api/token/ERC20#ERC20Crosschain),
+* [`BridgeNonFungible`](#BridgeNonFungible): Core bridging logic for crosschain ERC-721 transfer. Used by [`BridgeERC721`](#BridgeERC721) and [`ERC721Crosschain`](/contracts/5.x/api/token/ERC721#ERC721Crosschain),
+* [`BridgeMultiToken`](#BridgeMultiToken): Core bridging logic for crosschain ERC-1155 transfer. Used by [`BridgeERC1155`](#BridgeERC1155) and [`ERC1155Crosschain`](/contracts/5.x/api/token/ERC1155#ERC1155Crosschain),
+* [`BridgeERC20`](#BridgeERC20): Standalone bridge contract to connect an ERC-20 token contract with counterparts on remote chains,
+* [`BridgeERC721`](#BridgeERC721): Standalone bridge contract to connect an ERC-721 token contract with counterparts on remote chains,
+* [`BridgeERC1155`](#BridgeERC1155): Standalone bridge contract to connect an ERC-1155 token contract with counterparts on remote chains,
+* [`BridgeERC7802`](#BridgeERC7802): Standalone bridge contract to connect an ERC-7802 token contract with counterparts on remote chains.
## Helpers
+[`CrosschainLinked`](#CrosschainLinked)
+
+[`CrosschainRemoteExecutor`](#CrosschainRemoteExecutor)
+
[`ERC7786Recipient`](#ERC7786Recipient)
-
+## Bridges
+
+[`BridgeFungible`](#BridgeFungible)
+
+[`BridgeNonFungible`](#BridgeNonFungible)
+
+[`BridgeMultiToken`](#BridgeMultiToken)
+
+[`BridgeERC20`](#BridgeERC20)
+
+[`BridgeERC721`](#BridgeERC721)
+
+[`BridgeERC1155`](#BridgeERC1155)
+
+[`BridgeERC7802`](#BridgeERC7802)
+
+
```solidity
-import "@openzeppelin/contracts/crosschain/ERC7786Recipient.sol";
+import "@openzeppelin/contracts/crosschain/CrosschainLinked.sol";
```
-Base implementation of an ERC-7786 compliant cross-chain message receiver.
+Core bridging mechanism.
-This abstract contract exposes the `receiveMessage` function that is used for communication with (one or multiple)
-destination gateways. This contract leaves two functions unimplemented:
+This contract contains the logic to register and send messages to counterparts on remote chains using ERC-7786
+gateways. It ensure received messages originate from a counterpart. This is the base of token bridges such as
+[`BridgeFungible`](#BridgeFungible).
-* [`ERC7786Recipient._isAuthorizedGateway`](#ERC7786Recipient-_isAuthorizedGateway-address-bytes-), an internal getter used to verify whether an address is recognised by the contract as a
-valid ERC-7786 destination gateway. One or multiple gateway can be supported. Note that any malicious address for
-which this function returns true would be able to impersonate any account on any other chain sending any message.
+Contracts that inherit from this contract can use the internal [`CrosschainLinked._sendMessageToCounterpart`](#CrosschainLinked-_sendMessageToCounterpart-bytes-bytes-bytes---) to send messages to their
+counterpart on a foreign chain. They must override the [`CrosschainRemoteExecutor._processMessage`](#CrosschainRemoteExecutor-_processMessage-address-bytes32-bytes-bytes-) function to handle messages that have
+been verified.
+
+
+
+Returns the ERC-7786 gateway used for sending and receiving cross-chain messages to a given chain.
+
+Note: The `chain` parameter is a "chain-only" InteroperableAddress (empty address) and the `counterpart` returns
+the full InteroperableAddress (chain ref + address) that is on `chain`.
+
+
+
+Internal setter to change the ERC-7786 gateway and counterpart for a given chain. Called at construction.
+
+Note: The `counterpart` parameter is the full InteroperableAddress (chain ref + address).
+
+
+
+Virtual getter that returns whether an address is a valid ERC-7786 gateway for a given sender.
+
+The `sender` parameter is an interoperable address that include the source chain. The chain part can be
+extracted using the [`InteroperableAddress`](/contracts/5.x/api/utils#InteroperableAddress) library to selectively authorize gateways based on the origin chain
+of a message.
+
+
+
+Emitted when a new link is registered.
+
+Note: the `counterpart` argument is a full InteroperableAddress (chain ref + address).
+
+
+
-* [`ERC7786Recipient._processMessage`](#ERC7786Recipient-_processMessage-address-bytes32-bytes-bytes-), the internal function that will be called with any message that has been validated.
+
-This contract implements replay protection, meaning that if two messages are received from the same gateway with the
-same `receiveId`, then the second one will NOT be executed, regardless of the result of [`ERC7786Recipient._isAuthorizedGateway`](#ERC7786Recipient-_isAuthorizedGateway-address-bytes-).
+
+
+Reverted when trying to register a link for a chain that is already registered.
+
+Note: the `chain` argument is a "chain-only" InteroperableAddress (empty address).
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/CrosschainRemoteExecutor.sol";
+```
+
+Helper contract used to relay transactions received from a controller through an ERC-7786 gateway. This is
+used by the [`GovernorCrosschain`](/contracts/5.x/api/governance#GovernorCrosschain) governance module for the execution of cross-chain actions.
+
+A [`CrosschainRemoteExecutor`](#CrosschainRemoteExecutor) address can be seen as the local identity of a remote executor on another chain. It
+holds assets and permissions for the sake of its controller.
+
+Endpoint allowing the controller to reconfigure the executor. This must be called by the executor itself
+following an instruction from the controller.
+
+
Virtual function that should contain the logic to execute when a cross-chain message is received.
+
+This function should revert on failure. Any silent failure from this function will result in the message
+being marked as received and not being retryable.
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/ERC7786Recipient.sol";
+```
+
+Base implementation of an ERC-7786 compliant cross-chain message receiver.
+
+This abstract contract exposes the `receiveMessage` function that is used for communication with (one or multiple)
+destination gateways. This contract leaves two functions unimplemented:
+
+* [`CrosschainLinked._isAuthorizedGateway`](#CrosschainLinked-_isAuthorizedGateway-address-bytes-), an internal getter used to verify whether an address is recognised by the contract as a
+valid ERC-7786 destination gateway. One or multiple gateway can be supported. Note that any malicious address for
+which this function returns true would be able to impersonate any account on any other chain sending any message.
+
+* [`CrosschainRemoteExecutor._processMessage`](#CrosschainRemoteExecutor-_processMessage-address-bytes32-bytes-bytes-), the internal function that will be called with any message that has been validated.
+
+ERC-7786 requires the gateway to ensure messages are not delivered more than once. Therefore, we don't need to keep
+track of the processed receiveId.
+
+@custom:stateless
+
+
+
+Virtual getter that returns whether an address is a valid ERC-7786 gateway for a given sender.
+
+The `sender` parameter is an interoperable address that include the source chain. The chain part can be
+extracted using the [`InteroperableAddress`](/contracts/5.x/api/utils#InteroperableAddress) library to selectively authorize gateways based on the origin chain
+of a message.
+
+
+
+Virtual function that should contain the logic to execute when a cross-chain message is received.
+
+
+This function should revert on failure. Any silent failure from this function will result in the message
+being marked as received and not being retryable.
+
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/bridges/BridgeERC1155.sol";
+```
+
+This is a variant of [`BridgeMultiToken`](#BridgeMultiToken) that implements the bridge logic for ERC-1155 tokens that do not expose
+a crosschain mint and burn mechanism. Instead, it takes custody of bridged assets.
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/bridges/BridgeERC20.sol";
+```
+
+This is a variant of [`BridgeFungible`](#BridgeFungible) that implements the bridge logic for ERC-20 tokens that do not expose a
+crosschain mint and burn mechanism. Instead, it takes custody of bridged assets.
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/bridges/BridgeERC721.sol";
+```
+
+This is a variant of [`BridgeNonFungible`](#BridgeNonFungible) that implements the bridge logic for ERC-721 tokens that do not expose
+a crosschain mint and burn mechanism. Instead, it takes custody of bridged assets.
+
+
+
+Transfer `tokenId` from `from` (on this chain) to `to` (on a different chain).
+
+The `to` parameter is the full InteroperableAddress that references both the destination chain and the account
+on that chain. Similarly to the underlying token's [`ERC721.transferFrom`](/contracts/5.x/api/token/ERC721#ERC721-transferFrom-address-address-uint256-) function, this function can be called
+either by the token holder or by anyone that is approved by the token holder. It reuses the token's allowance
+system, meaning that an account that is "approved for all" or "approved for tokenId" can perform the crosschain
+transfer directly without having to take temporary custody of the token.
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/bridges/BridgeERC7802.sol";
+```
+
+This is a variant of [`BridgeFungible`](#BridgeFungible) that implements the bridge logic for ERC-7802 compliant tokens.
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/bridges/abstract/BridgeFungible.sol";
+```
+
+Base contract for bridging ERC-20 between chains using an ERC-7786 gateway.
+
+In order to use this contract, two functions must be implemented to link it to the token:
+* [`BridgeERC1155._onSend`](#BridgeERC1155-_onSend-address-uint256---uint256---): called when a crosschain transfer is going out. Must take the sender tokens or revert.
+* [`BridgeERC1155._onReceive`](#BridgeERC1155-_onReceive-address-uint256---uint256---): called when a crosschain transfer is coming in. Must give tokens to the receiver.
+
+This base contract is used by the [`BridgeERC20`](#BridgeERC20), which interfaces with legacy ERC-20 tokens, and [`BridgeERC7802`](#BridgeERC7802),
+which interface with ERC-7802 to provide an approve-free user experience. It is also used by the [`ERC20Crosschain`](/contracts/5.x/api/token/ERC20#ERC20Crosschain)
+extension, which embeds the bridge logic directly in the token contract.
+
+
+
+Virtual function that should contain the logic to execute when a cross-chain message is received.
+
+
+This function should revert on failure. Any silent failure from this function will result in the message
+being marked as received and not being retryable.
+
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/bridges/abstract/BridgeMultiToken.sol";
+```
+
+Base contract for bridging ERC-1155 between chains using an ERC-7786 gateway.
+
+In order to use this contract, two functions must be implemented to link it to the token:
+* [`BridgeERC1155._onSend`](#BridgeERC1155-_onSend-address-uint256---uint256---): called when a crosschain transfer is going out. Must take the sender tokens or revert.
+* [`BridgeERC1155._onReceive`](#BridgeERC1155-_onReceive-address-uint256---uint256---): called when a crosschain transfer is coming in. Must give tokens to the receiver.
+
+This base contract is used by the [`BridgeERC1155`](#BridgeERC1155), which interfaces with legacy ERC-1155 tokens. It is also used by
+the [`ERC1155Crosschain`](/contracts/5.x/api/token/ERC1155#ERC1155Crosschain) extension, which embeds the bridge logic directly in the token contract.
+
+This base contract implements the crosschain transfer operation though internal functions. It is for the the "child
+contracts" that inherit from this to implement the external interfaces and make this functions accessible.
+
+
+
+Virtual function that should contain the logic to execute when a cross-chain message is received.
+
+
+This function should revert on failure. Any silent failure from this function will result in the message
+being marked as received and not being retryable.
+
+
+
+
+```solidity
+import "@openzeppelin/contracts/crosschain/bridges/abstract/BridgeNonFungible.sol";
+```
+
+Base contract for bridging ERC-721 between chains using an ERC-7786 gateway.
+
+In order to use this contract, two functions must be implemented to link it to the token:
+* [`BridgeERC1155._onSend`](#BridgeERC1155-_onSend-address-uint256---uint256---): called when a crosschain transfer is going out. Must take the sender tokens or revert.
+* [`BridgeERC1155._onReceive`](#BridgeERC1155-_onReceive-address-uint256---uint256---): called when a crosschain transfer is coming in. Must give tokens to the receiver.
+
+This base contract is used by the [`BridgeERC721`](#BridgeERC721), which interfaces with legacy ERC-721 tokens. It is also used by
+the [`ERC721Crosschain`](/contracts/5.x/api/token/ERC721#ERC721Crosschain) extension, which embeds the bridge logic directly in the token contract.
+
+
+
+Virtual function that should contain the logic to execute when a cross-chain message is received.
+
+
+This function should revert on failure. Any silent failure from this function will result in the message
+being marked as received and not being retryable.
+
+
+
@@ -524,3 +555,4 @@ The specified cliff duration is larger than the vesting duration.
+
diff --git a/content/contracts/5.x/api/governance.mdx b/content/contracts/5.x/api/governance.mdx
index d177b40a..8941a9ea 100644
--- a/content/contracts/5.x/api/governance.mdx
+++ b/content/contracts/5.x/api/governance.mdx
@@ -37,12 +37,13 @@ Timelock extensions add a delay for governance decisions to be executed. The wor
Other extensions can customize the behavior or interface in multiple ways.
-* [`GovernorStorage`](#GovernorStorage): Stores the proposal details onchain and provides enumerability of the proposals. This can be useful for some L2 chains where storage is cheap compared to calldata.
-* [`GovernorSettings`](#GovernorSettings): Manages some of the settings (voting delay, voting period duration, and proposal threshold) in a way that can be updated through a governance proposal, without requiring an upgrade.
+* [`GovernorCrosschain`](#GovernorCrosschain): Helps with the execution of crosschain operation using `CrosschainRemoteExector` and ERC-7786 gateways.
+* [`GovernorNoncesKeyed`](#GovernorNoncesKeyed): An extension of [`Governor`](#Governor) with support for keyed nonces in addition to traditional nonces when voting by signature.
* [`GovernorPreventLateQuorum`](#GovernorPreventLateQuorum): Ensures there is a minimum voting period after quorum is reached as a security protection against large voters.
* [`GovernorProposalGuardian`](#GovernorProposalGuardian): Adds a proposal guardian that can cancel proposals at any stage in their lifecycle--this permission is passed on to the proposers if the guardian is not set.
+* [`GovernorSettings`](#GovernorSettings): Manages some of the settings (voting delay, voting period duration, and proposal threshold) in a way that can be updated through a governance proposal, without requiring an upgrade.
+* [`GovernorStorage`](#GovernorStorage): Stores the proposal details onchain and provides enumerability of the proposals. This can be useful for some L2 chains where storage is cheap compared to calldata.
* [`GovernorSuperQuorum`](#GovernorSuperQuorum): Extension of [`Governor`](#Governor) with a super quorum. Proposals that meet the super quorum (and have a majority of for votes) advance to the `Succeeded` state before the proposal deadline.
-* [`GovernorNoncesKeyed`](#GovernorNoncesKeyed): An extension of [`Governor`](#Governor) with support for keyed nonces in addition to traditional nonces when voting by signature.
In addition to modules and extensions, the core contract requires a few virtual functions to be implemented to your particular specifications:
@@ -82,17 +83,19 @@ Functions of the `Governor` contract do not include access control. If you want
[`GovernorTimelockCompound`](#GovernorTimelockCompound)
-[`GovernorSettings`](#GovernorSettings)
+[`GovernorCrosschain`](#GovernorCrosschain)
-[`GovernorPreventLateQuorum`](#GovernorPreventLateQuorum)
+[`GovernorNoncesKeyed`](#GovernorNoncesKeyed)
-[`GovernorStorage`](#GovernorStorage)
+[`GovernorPreventLateQuorum`](#GovernorPreventLateQuorum)
[`GovernorProposalGuardian`](#GovernorProposalGuardian)
-[`GovernorSuperQuorum`](#GovernorSuperQuorum)
+[`GovernorSettings`](#GovernorSettings)
-[`GovernorNoncesKeyed`](#GovernorNoncesKeyed)
+[`GovernorStorage`](#GovernorStorage)
+
+[`GovernorSuperQuorum`](#GovernorSuperQuorum)
## Utils
@@ -123,7 +126,7 @@ In a governance system, the [`TimelockController`](#TimelockController) contract
#### Operation structure
-Operation executed by the [`TimelockController`](contracts/5.x/api/governance#TimelockController) can contain one or multiple subsequent calls. Depending on whether you need to multiple calls to be executed atomically, you can either use simple or batched operations.
+Operation executed by the [`TimelockController`](/contracts/5.x/api/governance#TimelockController) can contain one or multiple subsequent calls. Depending on whether you need multiple calls to be executed atomically, you can either use simple or batched operations.
Both operations contain:
@@ -146,16 +149,16 @@ Timelocked operations are identified by a unique id (their hash) and follow a sp
`Unset` -> `Pending` -> `Pending` + `Ready` -> `Done`
-* By calling [`schedule`](contracts/5.x/api/governance#TimelockController-schedule-address-uint256-bytes-bytes32-bytes32-uint256-) (or [`scheduleBatch`](contracts/5.x/api/governance#TimelockController-scheduleBatch-address---uint256---bytes---bytes32-bytes32-uint256-)), a proposer moves the operation from the `Unset` to the `Pending` state. This starts a timer that must be longer than the minimum delay. The timer expires at a timestamp accessible through the [`getTimestamp`](contracts/5.x/api/governance#TimelockController-getTimestamp-bytes32-) method.
+* By calling [`schedule`](/contracts/5.x/api/governance#TimelockController-schedule-address-uint256-bytes-bytes32-bytes32-uint256-) (or [`scheduleBatch`](/contracts/5.x/api/governance#TimelockController-scheduleBatch-address---uint256---bytes---bytes32-bytes32-uint256-)), a proposer moves the operation from the `Unset` to the `Pending` state. This starts a timer that must be longer than the minimum delay. The timer expires at a timestamp accessible through the [`getTimestamp`](/contracts/5.x/api/governance#TimelockController-getTimestamp-bytes32-) method.
* Once the timer expires, the operation automatically gets the `Ready` state. At this point, it can be executed.
-* By calling [`execute`](contracts/5.x/api/governance#TimelockController-TimelockController-execute-address-uint256-bytes-bytes32-bytes32-) (or [`executeBatch`](contracts/5.x/api/governance#TimelockController-executeBatch-address---uint256---bytes---bytes32-bytes32-)), an executor triggers the operationโs underlying transactions and moves it to the `Done` state. If the operation has a predecessor, it has to be in the `Done` state for this transition to succeed.
-* [`cancel`](contracts/5.x/api/governance#TimelockController-TimelockController-cancel-bytes32-) allows proposers to cancel any `Pending` operation. This resets the operation to the `Unset` state. It is thus possible for a proposer to re-schedule an operation that has been cancelled. In this case, the timer restarts when the operation is rescheduled.
+* By calling [`execute`](/contracts/5.x/api/governance#TimelockController-TimelockController-execute-address-uint256-bytes-bytes32-bytes32-) (or [`executeBatch`](/contracts/5.x/api/governance#TimelockController-executeBatch-address---uint256---bytes---bytes32-bytes32-)), an executor triggers the operationโs underlying transactions and moves it to the `Done` state. If the operation has a predecessor, it has to be in the `Done` state for this transition to succeed.
+* [`cancel`](/contracts/5.x/api/governance#TimelockController-TimelockController-cancel-bytes32-) allows proposers to cancel any `Pending` operation. This resets the operation to the `Unset` state. It is thus possible for a proposer to re-schedule an operation that has been cancelled. In this case, the timer restarts when the operation is rescheduled.
Operations status can be queried using the functions:
-* [`isOperationPending(bytes32)`](contracts/5.x/api/governance#TimelockController-isOperationPending-bytes32-)
-* [`isOperationReady(bytes32)`](contracts/5.x/api/governance#TimelockController-isOperationReady-bytes32-)
-* [`isOperationDone(bytes32)`](contracts/5.x/api/governance#TimelockController-isOperationDone-bytes32-)
+* [`isOperationPending(bytes32)`](/contracts/5.x/api/governance#TimelockController-isOperationPending-bytes32-)
+* [`isOperationReady(bytes32)`](/contracts/5.x/api/governance#TimelockController-isOperationReady-bytes32-)
+* [`isOperationDone(bytes32)`](/contracts/5.x/api/governance#TimelockController-isOperationDone-bytes32-)
#### Roles
@@ -168,7 +171,7 @@ The admins are in charge of managing proposers and executors. For the timelock t
The proposers are in charge of scheduling (and cancelling) operations. This is a critical role, that should be given to governing entities. This could be an EOA, a multisig, or a DAO.
-**Proposer fight:** Having multiple proposers, while providing redundancy in case one becomes unavailable, can be dangerous. As proposer have their say on all operations, they could cancel operations they disagree with, including operations to remove them for the proposers.
+**Proposer fight:** Having multiple proposers, while providing redundancy in case one becomes unavailable, can be dangerous. Proposers have a say on all operations--they could cancel operations they disagree with, including operations to remove them from the list of proposers.
This role is identified by the **PROPOSER_ROLE** value: `0xb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1`
@@ -187,9 +190,9 @@ A live contract without at least one proposer and one executor is locked. Make s
-#### IERC1155Receiver [!toc]
-#### IERC721Receiver [!toc]
-#### IGovernor [!toc]
+
+IGovernor
+
- [GovernorInvalidProposalLength(targets, calldatas, values)](#IGovernor-GovernorInvalidProposalLength-uint256-uint256-uint256-)
- [GovernorAlreadyCastVote(voter)](#IGovernor-GovernorAlreadyCastVote-address-)
- [GovernorDisabledDeposit()](#IGovernor-GovernorDisabledDeposit--)
@@ -335,17 +345,17 @@ This contract is abstract and requires several functions to be implemented in va
- [GovernorInvalidVoteType()](#IGovernor-GovernorInvalidVoteType--)
- [GovernorInvalidVoteParams()](#IGovernor-GovernorInvalidVoteParams--)
- [GovernorQueueNotImplemented()](#IGovernor-GovernorQueueNotImplemented--)
-- [GovernorNotQueuedProposal(proposalId)](#IGovernor-GovernorNotQueuedProposal-uint256-)
- [GovernorAlreadyQueuedProposal(proposalId)](#IGovernor-GovernorAlreadyQueuedProposal-uint256-)
- [GovernorInvalidSignature(voter)](#IGovernor-GovernorInvalidSignature-address-)
- [GovernorUnableToCancel(proposalId, account)](#IGovernor-GovernorUnableToCancel-uint256-address-)
-#### IERC6372 [!toc]
-#### Nonces [!toc]
+
+
+
+Nonces
+
- [InvalidAccountNonce(account, currentNonce)](#Nonces-InvalidAccountNonce-address-uint256-)
-#### EIP712 [!toc]
-#### IERC5267 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -367,7 +377,7 @@ parameter setters in [`GovernorSettings`](#GovernorSettings) are protected using
The governance executing address may be different from the Governor's own address, for example it could be a
timelock. This can be customized by modules by overriding [`Governor._executor`](#Governor-_executor--). The executor is only able to invoke these
-functions during the execution of the governor's [`AccessManager.execute`](/contracts/5.x/api/access#AccessManager-execute-address-bytes-) function, and not under any other circumstances. Thus,
+functions during the execution of the governor's [`Governor.execute`](#Governor-execute-address---uint256---bytes---bytes32-) function, and not under any other circumstances. Thus,
for example, additional timelock proposers are not able to change governance parameters without going through the
governance protocol (since v4.6).
@@ -645,7 +655,7 @@ Whether a proposal needs to be queued before execution.
Reverts if the `msg.sender` is not the executor. In case the executor is not this contract
-itself, the function reverts if `msg.data` is not whitelisted as a result of an [`AccessManager.execute`](/contracts/5.x/api/access#AccessManager-execute-address-bytes-)
+itself, the function reverts if `msg.data` is not whitelisted as a result of an [`Governor.execute`](#Governor-execute-address---uint256---bytes---bytes32-)
operation. See [`Governor.onlyGovernance`](#Governor-onlyGovernance--).
@@ -888,7 +898,7 @@ performed (for example adding a vault/timelock).
Calling this function directly will NOT check the current state of the proposal, set the executed flag to
-true or emit the `ProposalExecuted` event. Executing a proposal should be done using [`AccessManager.execute`](/contracts/5.x/api/access#AccessManager-execute-address-bytes-).
+true or emit the `ProposalExecuted` event. Executing a proposal should be done using [`Governor.execute`](#Governor-execute-address---uint256---bytes---bytes32-).
@@ -1291,6 +1301,23 @@ If requirements are not met, reverts with a [`IGovernor.GovernorUnexpectedPropos
+Check if the proposer is authorized to submit a proposal with the given description.
+
+If the proposal description ends with `#proposer=0x???`, where `0x???` is an address written as a hex string
+(case insensitive), then the submission of this proposal will only be authorized to said address.
+
+This is used for frontrunning protection. By adding this pattern at the end of their proposal, one can ensure
+that no other address can submit the same proposal. An attacker would have to either remove or change that part,
+which would result in a different proposal id.
+
+If the description does not match this pattern, it is unrestricted and anyone can submit it. This includes:
+
+- If the `0x???` part is not a valid hex string.
+- If the `0x???` part is a valid hex string, but does not contain exactly 40 hex digits.
+- If it ends with the expected suffix followed by newlines or other whitespace.
+- If it ends with some other similar suffix, e.g. `#other=abc`.
+- If it does not end with any such suffix.
+
@@ -1458,9 +1485,9 @@ quorum depending on values such as the totalSupply of a token at this timepoint
@@ -2501,9 +2514,9 @@ The given `account` is unable to cancel the proposal with given `proposalId`.
-## `TimelockController`
+## `TimelockController`
-
+
@@ -2558,14 +2571,22 @@ a multisig or a DAO as the sole proposer.
- [PROPOSER_ROLE()](#TimelockController-PROPOSER_ROLE-bytes32)
- [EXECUTOR_ROLE()](#TimelockController-EXECUTOR_ROLE-bytes32)
- [CANCELLER_ROLE()](#TimelockController-CANCELLER_ROLE-bytes32)
-#### ERC1155Holder [!toc]
+
+ERC1155Holder
+
- [onERC1155Received(, , , , )](#ERC1155Holder-onERC1155Received-address-address-uint256-uint256-bytes-)
- [onERC1155BatchReceived(, , , , )](#ERC1155Holder-onERC1155BatchReceived-address-address-uint256---uint256---bytes-)
-#### IERC1155Receiver [!toc]
-#### ERC721Holder [!toc]
+
+
+
+ERC721Holder
+
- [onERC721Received(, , , )](#ERC721Holder-onERC721Received-address-address-uint256-bytes-)
-#### IERC721Receiver [!toc]
-#### AccessControl [!toc]
+
+
+
+AccessControl
+
- [hasRole(role, account)](#AccessControl-hasRole-bytes32-address-)
- [_checkRole(role)](#AccessControl-_checkRole-bytes32-)
- [_checkRole(role, account)](#AccessControl-_checkRole-bytes32-address-)
@@ -2577,9 +2598,8 @@ a multisig or a DAO as the sole proposer.
- [_grantRole(role, account)](#AccessControl-_grantRole-bytes32-address-)
- [_revokeRole(role, account)](#AccessControl-_revokeRole-bytes32-address-)
- [DEFAULT_ADMIN_ROLE()](#AccessControl-DEFAULT_ADMIN_ROLE-bytes32)
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-#### IAccessControl [!toc]
+
+
@@ -2591,17 +2611,14 @@ a multisig or a DAO as the sole proposer.
- [CallSalt(id, salt)](#TimelockController-CallSalt-bytes32-bytes32-)
- [Cancelled(id)](#TimelockController-Cancelled-bytes32-)
- [MinDelayChange(oldDuration, newDuration)](#TimelockController-MinDelayChange-uint256-uint256-)
-#### ERC1155Holder [!toc]
-#### IERC1155Receiver [!toc]
-#### ERC721Holder [!toc]
-#### IERC721Receiver [!toc]
-#### AccessControl [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-#### IAccessControl [!toc]
+
+IAccessControl
+
- [RoleAdminChanged(role, previousAdminRole, newAdminRole)](#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-)
- [RoleGranted(role, account, sender)](#IAccessControl-RoleGranted-bytes32-address-address-)
- [RoleRevoked(role, account, sender)](#IAccessControl-RoleRevoked-bytes32-address-address-)
+
+
@@ -2613,16 +2630,13 @@ a multisig or a DAO as the sole proposer.
- [TimelockUnexpectedOperationState(operationId, expectedStates)](#TimelockController-TimelockUnexpectedOperationState-bytes32-bytes32-)
- [TimelockUnexecutedPredecessor(predecessorId)](#TimelockController-TimelockUnexecutedPredecessor-bytes32-)
- [TimelockUnauthorizedCaller(caller)](#TimelockController-TimelockUnauthorizedCaller-address-)
-#### ERC1155Holder [!toc]
-#### IERC1155Receiver [!toc]
-#### ERC721Holder [!toc]
-#### IERC721Receiver [!toc]
-#### AccessControl [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-#### IAccessControl [!toc]
+
+IAccessControl
+
- [AccessControlUnauthorizedAccount(account, neededRole)](#IAccessControl-AccessControlUnauthorizedAccount-address-bytes32-)
- [AccessControlBadConfirmation()](#IAccessControl-AccessControlBadConfirmation--)
+
+
@@ -2705,6 +2719,13 @@ Contract might receive/hold ETH as part of the maintenance process.
+Returns true if this contract implements the interface defined by
+`interfaceId`. See the corresponding
+[ERC section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
+to learn more about how these ids are created.
+
+This function call must use less than 30 000 gas.
+
@@ -3270,9 +3291,9 @@ The caller account is not authorized.
@@ -4361,7 +4396,207 @@ See [`Governor._voteSucceeded`](#Governor-_voteSucceeded-uint256-). In this modu
-See [`Governor._countVote`](#Governor-_countVote-uint256-address-uint8-uint256-bytes-). In this module, the support follows the `VoteType` enum (from Governor Bravo).
+See [`Governor._countVote`](#Governor-_countVote-uint256-address-uint8-uint256-bytes-). In this module, the support follows the `VoteType` enum (from Governor Bravo).
+
+
+
+```solidity
+import "@openzeppelin/contracts/governance/extensions/GovernorCrosschain.sol";
+```
+
+Extension of [`Governor`](#Governor) for cross-chain governance through ERC-7786 gateways and [`CrosschainRemoteExecutor`](/contracts/5.x/api/crosschain#CrosschainRemoteExecutor).
+
+
-## `GovernorTimelockAccess`
+## `GovernorTimelockAccess`
-
+
@@ -6343,7 +6643,7 @@ and [`GovernorTimelockCompound`](#GovernorTimelockCompound), where the timelock
permissions. Operations that are delay-restricted by the manager, however, will be executed through the
[`AccessManager.execute`](/contracts/5.x/api/access#AccessManager-execute-address-bytes-) function.
-==== Security Considerations
+#### Security Considerations
Some operations may be cancelable in the `AccessManager` by the admin or a set of guardians, depending on the
restricted function being invoked. Since proposals are atomic, the cancellation by a guardian of a single operation
@@ -6379,7 +6679,9 @@ the same time. See [`AccessManager.schedule`](/contracts/5.x/api/access#AccessMa
- [_queueOperations(proposalId, targets, , calldatas, )](#GovernorTimelockAccess-_queueOperations-uint256-address---uint256---bytes---bytes32-)
- [_executeOperations(proposalId, targets, values, calldatas, )](#GovernorTimelockAccess-_executeOperations-uint256-address---uint256---bytes---bytes32-)
- [_cancel(targets, values, calldatas, descriptionHash)](#GovernorTimelockAccess-_cancel-address---uint256---bytes---bytes32-)
-#### Governor [!toc]
+
+Governor
+
- [receive()](#Governor-receive--)
- [supportsInterface(interfaceId)](#Governor-supportsInterface-bytes4-)
- [name()](#Governor-name--)
@@ -6430,25 +6732,33 @@ the same time. See [`AccessManager.schedule`](/contracts/5.x/api/access#AccessMa
- [quorum(timepoint)](#Governor-quorum-uint256-)
- [BALLOT_TYPEHASH()](#Governor-BALLOT_TYPEHASH-bytes32)
- [EXTENDED_BALLOT_TYPEHASH()](#Governor-EXTENDED_BALLOT_TYPEHASH-bytes32)
-#### IERC1155Receiver [!toc]
-#### IERC721Receiver [!toc]
-#### IGovernor [!toc]
+
+
+
+IGovernor
+
- [COUNTING_MODE()](#IGovernor-COUNTING_MODE--)
- [hasVoted(proposalId, account)](#IGovernor-hasVoted-uint256-address-)
-#### IERC6372 [!toc]
-#### Nonces [!toc]
+
+
+
+Nonces
+
- [nonces(owner)](#Nonces-nonces-address-)
- [_useNonce(owner)](#Nonces-_useNonce-address-)
- [_useCheckedNonce(owner, nonce)](#Nonces-_useCheckedNonce-address-uint256-)
-#### EIP712 [!toc]
+
+
+
+EIP712
+
- [_domainSeparatorV4()](#EIP712-_domainSeparatorV4--)
- [_hashTypedDataV4(structHash)](#EIP712-_hashTypedDataV4-bytes32-)
- [eip712Domain()](#EIP712-eip712Domain--)
- [_EIP712Name()](#EIP712-_EIP712Name--)
- [_EIP712Version()](#EIP712-_EIP712Version--)
-#### IERC5267 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -6457,23 +6767,23 @@ the same time. See [`AccessManager.schedule`](/contracts/5.x/api/access#AccessMa
@@ -7186,7 +7504,9 @@ Note that if the timelock admin has been handed over in a previous operation, we
timelock if admin of the timelock has already been accepted and the operation is executed outside the scope of
governance.
-CAUTION: It is not recommended to change the timelock while there are other queued governance proposals.
+
+It is not recommended to change the timelock while there are other queued governance proposals.
+
@@ -7213,9 +7533,9 @@ Emitted when the timelock controller used for proposal execution is modified.
@@ -7532,7 +7861,9 @@ Address through which the governor executes action. In this case, the timelock.
Public endpoint to update the underlying timelock instance. Restricted to the timelock itself, so updates
must be proposed, scheduled, and executed through governance proposals.
-CAUTION: It is not recommended to change the timelock while there are other queued governance proposals.
+
+It is not recommended to change the timelock while there are other queued governance proposals.
+
@@ -7559,9 +7890,9 @@ Emitted when the timelock controller used for proposal execution is modified.
@@ -9396,3 +9803,4 @@ should be zero. Total supply of voting units will be adjusted with mints and bur
+
diff --git a/content/contracts/5.x/api/interfaces.mdx b/content/contracts/5.x/api/interfaces.mdx
index 92d69448..6fde47a5 100644
--- a/content/contracts/5.x/api/interfaces.mdx
+++ b/content/contracts/5.x/api/interfaces.mdx
@@ -30,6 +30,8 @@ are useful to interact with third party contracts that implement them.
* [`IERC1820Implementer`](#IERC1820Implementer)
* [`IERC1820Registry`](#IERC1820Registry)
* [`IERC1822Proxiable`](#IERC1822Proxiable)
+* [`IERC1967`](#IERC1967)
+* [`IERC2309`](#IERC2309)
* [`IERC2612`](#IERC2612)
* [`IERC2981`](#IERC2981)
* [`IERC3156FlashLender`](#IERC3156FlashLender)
@@ -44,11 +46,18 @@ are useful to interact with third party contracts that implement them.
* [`IERC6909ContentURI`](#IERC6909ContentURI)
* [`IERC6909Metadata`](#IERC6909Metadata)
* [`IERC6909TokenSupply`](#IERC6909TokenSupply)
+* [`IERC7579Module`](#IERC7579Module)
+* [`IERC7579Validator`](#IERC7579Validator)
+* [`IERC7579Hook`](#IERC7579Hook)
+* [`IERC7579Execution`](#IERC7579Execution)
+* [`IERC7579AccountConfig`](#IERC7579AccountConfig)
+* [`IERC7579ModuleConfig`](#IERC7579ModuleConfig)
* [`IERC7674`](#IERC7674)
-ย [`IERC7751`](#IERC7751)
* [`IERC7786GatewaySource`](#IERC7786GatewaySource)
* [`IERC7786Recipient`](#IERC7786Recipient)
* [`IERC7802`](#IERC7802)
+* [`IERC7913SignatureVerifier`](#IERC7913SignatureVerifier)
## Detailed ABI
@@ -72,6 +81,10 @@ are useful to interact with third party contracts that implement them.
[`IERC1822Proxiable`](#IERC1822Proxiable)
+[`IERC1967`](#IERC1967)
+
+[`IERC2309`](#IERC2309)
+
[`IERC2612`](#IERC2612)
[`IERC2981`](#IERC2981)
@@ -100,6 +113,18 @@ are useful to interact with third party contracts that implement them.
[`IERC6909TokenSupply`](#IERC6909TokenSupply)
+[`IERC7579Module`](#IERC7579Module)
+
+[`IERC7579Validator`](#IERC7579Validator)
+
+[`IERC7579Hook`](#IERC7579Hook)
+
+[`IERC7579Execution`](#IERC7579Execution)
+
+[`IERC7579AccountConfig`](#IERC7579AccountConfig)
+
+[`IERC7579ModuleConfig`](#IERC7579ModuleConfig)
+
[`IERC7674`](#IERC7674)
[`IERC7751`](#IERC7751)
@@ -110,13 +135,15 @@ are useful to interact with third party contracts that implement them.
[`IERC7802`](#IERC7802)
+[`IERC7913SignatureVerifier`](#IERC7913SignatureVerifier)
+
-## `IERC1271`
+## `IERC1271`
-
+
@@ -157,9 +184,9 @@ Should return whether the signature provided is valid for the provided data
-## `IERC1363`
+## `IERC1363`
-
+
@@ -183,25 +210,36 @@ after `transfer` or `transferFrom`, or code on a spender contract after `approve
- [transferFromAndCall(from, to, value, data)](#IERC1363-transferFromAndCall-address-address-uint256-bytes-)
- [approveAndCall(spender, value)](#IERC1363-approveAndCall-address-uint256-)
- [approveAndCall(spender, value, data)](#IERC1363-approveAndCall-address-uint256-bytes-)
-#### IERC165 [!toc]
+
+IERC165
+
- [supportsInterface(interfaceId)](#IERC165-supportsInterface-bytes4-)
-#### IERC20 [!toc]
+
+
+
+IERC20
+
- [totalSupply()](#IERC20-totalSupply--)
- [balanceOf(account)](#IERC20-balanceOf-address-)
- [transfer(to, value)](#IERC20-transfer-address-uint256-)
- [allowance(owner, spender)](#IERC20-allowance-address-address-)
- [approve(spender, value)](#IERC20-approve-address-uint256-)
- [transferFrom(from, to, value)](#IERC20-transferFrom-address-address-uint256-)
+
+
-## `IERC7786GatewaySource`
+## `IERC7786GatewaySource`
-
+
@@ -4838,9 +4980,9 @@ This error is thrown when a message creation fails because of an unsupported att
-## `IERC7786Recipient`
+## `IERC7786Recipient`
-
+
@@ -4884,9 +5026,9 @@ This function may be called directly by the gateway.
+
diff --git a/content/contracts/5.x/api/metatx.mdx b/content/contracts/5.x/api/metatx.mdx
index 4fcbd986..72afa69a 100644
--- a/content/contracts/5.x/api/metatx.mdx
+++ b/content/contracts/5.x/api/metatx.mdx
@@ -20,9 +20,9 @@ This directory includes contracts for adding meta-transaction capabilities (i.e.
-## `ERC2771Context`
+## `ERC2771Context`
-
+
@@ -32,7 +32,7 @@ This directory includes contracts for adding meta-transaction capabilities (i.e.
import "@openzeppelin/contracts/metatx/ERC2771Context.sol";
```
-Context variant with ERC-2771 support.
+Context variant with ERC-2771 support. See [`ERC2771Context._msgSender`](#ERC2771Context-_msgSender--) for the calldata format.
Avoid using this pattern in contracts that rely on a specific calldata length as they'll
@@ -168,9 +168,9 @@ ERC-2771 specifies the context as being a single address (20 bytes).
-## `ERC2771Forwarder`
+## `ERC2771Forwarder`
-
+
@@ -188,7 +188,7 @@ This forwarder operates on forward requests that include:
* `to`: The address that should be called.
* `value`: The amount of native token to attach with the requested call.
* `gas`: The amount of gas limit that will be forwarded with the requested call.
-* `nonce`: A unique transaction ordering identifier to avoid replayability and request invalidation.
+* `nonce` (implicit): Taken from [`Nonces`](/contracts/5.x/api/utils#Nonces) for `from` and included in the signed typed data.
* `deadline`: A timestamp after which the request is not executable anymore.
* `data`: Encoded `msg.data` to send with the requested call.
@@ -205,7 +205,7 @@ handle `msg.data.length == 0`. `ERC2771Context` in OpenZeppelin Contracts versio
do not handle this properly.
-==== Security Considerations
+#### Security Considerations
If a relayer submits a forward request, it should be willing to pay up to 100% of the gas amount
specified in the request. This contract does not implement any kind of retribution for this gas,
@@ -230,17 +230,24 @@ used to execute arbitrary code.
- [_recoverForwardRequestSigner(request)](#ERC2771Forwarder-_recoverForwardRequestSigner-struct-ERC2771Forwarder-ForwardRequestData-)
- [_execute(request, requireValidRequest)](#ERC2771Forwarder-_execute-struct-ERC2771Forwarder-ForwardRequestData-bool-)
- [_isTrustedByTarget(target)](#ERC2771Forwarder-_isTrustedByTarget-address-)
-#### Nonces [!toc]
+
+Nonces
+
- [nonces(owner)](#Nonces-nonces-address-)
- [_useNonce(owner)](#Nonces-_useNonce-address-)
- [_useCheckedNonce(owner, nonce)](#Nonces-_useCheckedNonce-address-uint256-)
-#### EIP712 [!toc]
+
+
+
+EIP712
+
- [_domainSeparatorV4()](#EIP712-_domainSeparatorV4--)
- [_hashTypedDataV4(structHash)](#EIP712-_hashTypedDataV4-bytes32-)
- [eip712Domain()](#EIP712-eip712Domain--)
- [_EIP712Name()](#EIP712-_EIP712Name--)
- [_EIP712Version()](#EIP712-_EIP712Version--)
-#### IERC5267 [!toc]
+
+
@@ -248,24 +255,29 @@ used to execute arbitrary code.
@@ -304,7 +316,7 @@ A transaction is considered valid when the target trusts this forwarder, the req
(deadline is not met), and the signer matches the `from` parameter of the signed request.
-A request may return false here but it won't cause [`TimelockController.executeBatch`](/contracts/5.x/api/governance#TimelockController-executeBatch-address---uint256---bytes---bytes32-bytes32-) to revert if a refund
+A request may return false here but it won't cause [`ERC2771Forwarder.executeBatch`](#ERC2771Forwarder-executeBatch-struct-ERC2771Forwarder-ForwardRequestData---address-payable-) to revert if a refund
receiver is provided.
@@ -330,7 +342,7 @@ out of gas. Will revert if the request is invalid or the call reverts, in this c
Requirements:
- The request value should be equal to the provided `msg.value`.
-- The request should be valid according to [`IERC7913SignatureVerifier.verify`](/contracts/5.x/api/interfaces#IERC7913SignatureVerifier-verify-bytes-bytes32-bytes-).
+- The request should be valid according to [`ERC2771Forwarder.verify`](#ERC2771Forwarder-verify-struct-ERC2771Forwarder-ForwardRequestData-).
@@ -347,9 +359,9 @@ Requirements:
-Batch version of [`AccessManager.execute`](/contracts/5.x/api/access#AccessManager-execute-address-bytes-) with optional refunding and atomic execution.
+Batch version of [`ERC2771Forwarder.execute`](#ERC2771Forwarder-execute-struct-ERC2771Forwarder-ForwardRequestData-) with optional refunding and atomic execution.
-In case a batch contains at least one invalid request (see [`IERC7913SignatureVerifier.verify`](/contracts/5.x/api/interfaces#IERC7913SignatureVerifier-verify-bytes-bytes32-bytes-)), the
+In case a batch contains at least one invalid request (see [`ERC2771Forwarder.verify`](#ERC2771Forwarder-verify-struct-ERC2771Forwarder-ForwardRequestData-)), the
request will be skipped and the `refundReceiver` parameter will receive back the
unused requested value at the end of the execution. This is done to prevent reverting
the entire batch when a request is invalid or has already been submitted.
@@ -363,7 +375,7 @@ including reverted transactions.
Requirements:
- The sum of the requests' values should be equal to the provided `msg.value`.
-- All of the requests should be valid (see [`IERC7913SignatureVerifier.verify`](/contracts/5.x/api/interfaces#IERC7913SignatureVerifier-verify-bytes-bytes32-bytes-)) when `refundReceiver` is the zero address.
+- All of the requests should be valid (see [`ERC2771Forwarder.verify`](#ERC2771Forwarder-verify-struct-ERC2771Forwarder-ForwardRequestData-)) when `refundReceiver` is the zero address.
Setting a zero `refundReceiver` guarantees an all-or-nothing requests execution only for
@@ -387,7 +399,7 @@ subcall, the second-level call may revert without the top-level call reverting.
Validates if the provided request can be executed at current block timestamp with
-the given `request.signature` on behalf of `request.signer`.
+the given `request.signature` on behalf of `request.from`.
@@ -408,7 +420,7 @@ Returns a tuple with the recovered the signer of an EIP712 forward request messa
and a boolean indicating if the signature is valid.
-The signature is considered valid if [`ECDSA.tryRecover`](/contracts/5.x/api/utils/cryptography#ECDSA-tryRecover-bytes32-uint8-bytes32-bytes32-) indicates no recover error for it.
+The signature is considered valid if [`ECDSA.tryRecoverCalldata`](/contracts/5.x/api/utils/cryptography#ECDSA-tryRecoverCalldata-bytes32-bytes-) indicates no recover error for it.
@@ -433,7 +445,7 @@ Internal function without msg.value validation.
Requirements:
- The caller must have provided enough gas to forward with the call.
-- The request must be valid (see [`IERC7913SignatureVerifier.verify`](/contracts/5.x/api/interfaces#IERC7913SignatureVerifier-verify-bytes-bytes32-bytes-)) if the `requireValidRequest` is true.
+- The request must be valid (see [`ERC2771Forwarder.verify`](#ERC2771Forwarder-verify-struct-ERC2771Forwarder-ForwardRequestData-)) if the `requireValidRequest` is true.
Emits an [`ERC2771Forwarder.ExecutedForwardRequest`](#ERC2771Forwarder-ExecutedForwardRequest-address-uint256-bool-) event.
@@ -494,6 +506,23 @@ the requested call to run out of gas.
+
+One of the calls in an atomic batch failed.
+
+
+
+
@@ -561,3 +590,4 @@ The request target doesn't trust the `forwarder`.
+
diff --git a/content/contracts/5.x/api/proxy.mdx b/content/contracts/5.x/api/proxy.mdx
index 0b1cd166..8f7d0d77 100644
--- a/content/contracts/5.x/api/proxy.mdx
+++ b/content/contracts/5.x/api/proxy.mdx
@@ -22,10 +22,10 @@ There are two alternative ways to add upgradeability to an ERC-1967 proxy. Their
**๐ฅ 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 [OpenZeppelin Upgrades Plugins](/upgrades-plugins) for Hardhat and Foundry.
-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.
+A different family of proxies is beacon proxies. This pattern, popularized by Dharma, allows multiple proxies to be upgraded to a different implementation in a single transaction.
* [`BeaconProxy`](#BeaconProxy): A proxy that retrieves its implementation from a beacon contract.
-* [`UpgradeableBeacon`](#UpgradeableBeacon): A beacon contract with a built in admin that can upgrade the [`BeaconProxy`](#BeaconProxy) pointing to it.
+* [`UpgradeableBeacon`](#UpgradeableBeacon): A beacon contract with a built-in admin that can upgrade the [`BeaconProxy`](#BeaconProxy) pointing to it.
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.
@@ -90,9 +90,9 @@ The current implementation of this security mechanism uses [ERC-1822](https://ei
-## `Clones`
+## `Clones`
-
+
@@ -474,9 +474,9 @@ Get the immutable args attached to a clone.
@@ -517,8 +529,11 @@ implementation behind the proxy.
Initializes the upgradeable proxy with an initial implementation specified by `implementation`.
-If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
-encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
+Provided `_data` is passed in a delegate call to `implementation`. This will typically be an encoded function
+call, and allows initializing the storage of the proxy like a Solidity constructor. By default construction
+will fail if `_data` is empty. This behavior can be overridden using a custom [`ERC1967Proxy._unsafeAllowUninitialized`](#ERC1967Proxy-_unsafeAllowUninitialized--) that
+returns true. In that case, empty `_data` is ignored and no delegate call to the implementation is performed
+during construction.
Requirements:
@@ -550,13 +565,53 @@ the [`eth_getStorageAt`](https://eth.wiki/json-rpc/API#eth_getstorageat) RPC cal
+
+Returns whether the proxy can be left uninitialized.
+
+
+Override this function to allow the proxy to be left uninitialized.
+Consider uninitialized proxies might be susceptible to man-in-the-middle threats
+where the proxy is replaced with a malicious one.
+
+
+
-## `ERC1967Utils`
+## `ERC1967Utils`
-
+
@@ -645,7 +700,7 @@ Returns the current admin.
To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
-the [`eth_getStorageAt`](https://eth.wiki/json-rpc/API#eth_getstorageat) RPC call.
+the [`eth_getStorageAt`](https://ethereum.org/developers/docs/apis/json-rpc/#eth_getstorageat) RPC call.
`0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
@@ -706,9 +761,11 @@ to avoid stuck value in the contract.
Emits an [`IERC1967.BeaconUpgraded`](/contracts/5.x/api/interfaces#IERC1967-BeaconUpgraded-address-) event.
-CAUTION: Invoking this function has no effect on an instance of [`BeaconProxy`](#BeaconProxy) since v5, since
+
+Invoking this function has no effect on an instance of [`BeaconProxy`](#BeaconProxy) since v5, since
it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
efficiency.
+
@@ -785,9 +842,9 @@ An upgrade function sees `msg.value > 0` that may be lost.
-## `Proxy`
+## `Proxy`
-
+
@@ -801,8 +858,8 @@ This abstract contract provides a fallback function that delegates all calls to
instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
be specified by overriding the virtual [`ERC1967Proxy._implementation`](#ERC1967Proxy-_implementation--) function.
-Additionally, delegation to the implementation can be triggered manually through the [`AccountERC7579._fallback`](/contracts/5.x/api/account#AccountERC7579-_fallback--) function, or to a
-different contract through the [`Votes._delegate`](/contracts/5.x/api/governance#Votes-_delegate-address-address-) function.
+Additionally, delegation to the implementation can be triggered manually through the [`Proxy._fallback`](#Proxy-_fallback--) function, or to a
+different contract through the [`Proxy._delegate`](#Proxy-_delegate-address-) function.
The success and return data of the delegated call will be returned back to the caller of the proxy.
@@ -848,7 +905,7 @@ This function does not return to its internal call site, it will return directly
This is a virtual function that should be overridden so it returns the address to which the fallback
-function and [`AccountERC7579._fallback`](/contracts/5.x/api/account#AccountERC7579-_fallback--) should delegate.
+function and [`Proxy._fallback`](#Proxy-_fallback--) should delegate.
@@ -894,9 +951,9 @@ function in the contract matches the call data.
-## `BeaconProxy`
+## `BeaconProxy`
-
+
@@ -912,8 +969,10 @@ The beacon address can only be set once during construction, and cannot be chang
immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by
[ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) so that it can be accessed externally.
-CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust
+
+Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust
the beacon to not upgrade the implementation maliciously.
+
Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in
@@ -926,10 +985,14 @@ an inconsistent state where the beacon storage slot does not match the beacon ad
- [constructor(beacon, data)](#BeaconProxy-constructor-address-bytes-)
- [_implementation()](#BeaconProxy-_implementation--)
- [_getBeacon()](#BeaconProxy-_getBeacon--)
-#### Proxy [!toc]
+
+Proxy
+
- [_delegate(implementation)](#Proxy-_delegate-address-)
- [_fallback()](#Proxy-_fallback--)
- [fallback()](#Proxy-fallback--)
+
+
@@ -997,9 +1060,9 @@ Returns the beacon.
-## `IBeacon`
+## `IBeacon`
-
+
@@ -1041,9 +1104,9 @@ Must return an address that can be used as a delegate call target.
-## `UpgradeableBeacon`
+## `UpgradeableBeacon`
-
+
@@ -1064,13 +1127,16 @@ An owner is able to change the implementation the beacon points to, thus upgradi
- [constructor(implementation_, initialOwner)](#UpgradeableBeacon-constructor-address-address-)
- [implementation()](#UpgradeableBeacon-implementation--)
- [upgradeTo(newImplementation)](#UpgradeableBeacon-upgradeTo-address-)
-#### Ownable [!toc]
+
+Ownable
+
- [owner()](#Ownable-owner--)
- [_checkOwner()](#Ownable-_checkOwner--)
- [renounceOwnership()](#Ownable-renounceOwnership--)
- [transferOwnership(newOwner)](#Ownable-transferOwnership-address-)
- [_transferOwnership(newOwner)](#Ownable-_transferOwnership-address-)
-#### IBeacon [!toc]
+
+
@@ -1078,9 +1144,12 @@ An owner is able to change the implementation the beacon points to, thus upgradi
@@ -1143,7 +1215,7 @@ Returns the current implementation address.
Upgrades the beacon to a new implementation.
-Emits an [`IERC1967.Upgraded`](/contracts/5.x/api/interfaces#IERC1967-Upgraded-address-) event.
+Emits an [`UpgradeableBeacon.Upgraded`](#UpgradeableBeacon-Upgraded-address-) event.
Requirements:
@@ -1192,9 +1264,9 @@ The `implementation` of the beacon is invalid.
-## `ProxyAdmin`
+## `ProxyAdmin`
-
+
@@ -1213,29 +1285,41 @@ explanation of why you would want to use this see the documentation for [`Transp
- [constructor(initialOwner)](#ProxyAdmin-constructor-address-)
- [upgradeAndCall(proxy, implementation, data)](#ProxyAdmin-upgradeAndCall-contract-ITransparentUpgradeableProxy-address-bytes-)
- [UPGRADE_INTERFACE_VERSION()](#ProxyAdmin-UPGRADE_INTERFACE_VERSION-string)
-#### Ownable [!toc]
+
+Ownable
+
- [owner()](#Ownable-owner--)
- [_checkOwner()](#Ownable-_checkOwner--)
- [renounceOwnership()](#Ownable-renounceOwnership--)
- [transferOwnership(newOwner)](#Ownable-transferOwnership-address-)
- [_transferOwnership(newOwner)](#Ownable-_transferOwnership-address-)
+
+
-## `ITransparentUpgradeableProxy`
+## `ITransparentUpgradeableProxy`
-
+
@@ -1326,17 +1410,20 @@ include them in the ABI so this interface must be used to interact with it.
@@ -1517,9 +1617,9 @@ The proxy caller is the current admin, and can't fallback to the proxy target.
-## `Initializable`
+## `Initializable`
-
+
@@ -1560,11 +1660,13 @@ To avoid leaving the proxy in an uninitialized state, the initializer function s
possible by providing the encoded function call as the `_data` argument to [`ERC1967Proxy.constructor`](#ERC1967Proxy-constructor-address-bytes-).
-CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
+
+When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
+
-
-Avoid leaving a contract uninitialized.
+[CAUTION]
+#### Avoid leaving a contract uninitialized.
An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
@@ -1577,7 +1679,6 @@ constructor() {
_disableInitializers();
}
```
-
Modifiers
@@ -1843,9 +1944,9 @@ The contract is not initializing.
@@ -1949,7 +2048,7 @@ callable on the implementing contract but not through proxies.
-Implementation of the ERC-1822 [`IERC1822Proxiable.proxiableUUID`](/contracts/5.x/api/interfaces#IERC1822Proxiable-proxiableUUID--) function. This returns the storage slot used by the
+Implementation of the ERC-1822 [`UUPSUpgradeable.proxiableUUID`](#UUPSUpgradeable-proxiableUUID--) function. This returns the storage slot used by the
implementation. It is used to validate the implementation's compatibility when performing an upgrade.
@@ -1978,7 +2077,7 @@ encoded in `data`.
Calls [`UUPSUpgradeable._authorizeUpgrade`](#UUPSUpgradeable-_authorizeUpgrade-address-).
-Emits an [`IERC1967.Upgraded`](/contracts/5.x/api/interfaces#IERC1967-Upgraded-address-) event.
+Emits an [`UpgradeableBeacon.Upgraded`](#UpgradeableBeacon-Upgraded-address-) event.
@@ -2098,3 +2197,4 @@ The storage `slot` is unsupported as a UUID.
+
diff --git a/content/contracts/5.x/api/token/ERC1155.mdx b/content/contracts/5.x/api/token/ERC1155.mdx
index 69846298..d9dfdbbe 100644
--- a/content/contracts/5.x/api/token/ERC1155.mdx
+++ b/content/contracts/5.x/api/token/ERC1155.mdx
@@ -13,6 +13,7 @@ Additionally there are multiple custom extensions, including:
* designation of addresses that can pause token transfers for all users ([`ERC1155Pausable`](#ERC1155Pausable)).
* destruction of own tokens ([`ERC1155Burnable`](#ERC1155Burnable)).
+* crosschain bridging of tokens through ERC-7786 gateways ([`ERC1155Crosschain`](#ERC1155Crosschain)).
This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC-1155 (such as [`_mint`](#ERC1155-_mint-address-uint256-uint256-bytes-)) and expose them as external functions in the way they prefer.
@@ -30,10 +31,12 @@ This core set of contracts is designed to be unopinionated, allowing developers
## Extensions
-[`ERC1155Pausable`](#ERC1155Pausable)
-
[`ERC1155Burnable`](#ERC1155Burnable)
+[`ERC1155Crosschain`](#ERC1155Crosschain)
+
+[`ERC1155Pausable`](#ERC1155Pausable)
+
[`ERC1155Supply`](#ERC1155Supply)
[`ERC1155URIStorage`](#ERC1155URIStorage)
@@ -48,9 +51,9 @@ This core set of contracts is designed to be unopinionated, allowing developers
-## `ERC1155`
+## `ERC1155`
-
+
@@ -76,8 +79,10 @@ Originally based on code by Enjin: https://github.com/enjin/erc-1155
- [isApprovedForAll(account, operator)](#ERC1155-isApprovedForAll-address-address-)
- [safeTransferFrom(from, to, id, value, data)](#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-)
- [safeBatchTransferFrom(from, to, ids, values, data)](#ERC1155-safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
+- [_checkAuthorized(operator, owner)](#ERC1155-_checkAuthorized-address-address-)
- [_update(from, to, ids, values)](#ERC1155-_update-address-address-uint256---uint256---)
- [_updateWithAcceptanceCheck(from, to, ids, values, data)](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-)
+- [_updateWithAcceptanceCheck(from, to, ids, values, data, batch)](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-bool-)
- [_safeTransferFrom(from, to, id, value, data)](#ERC1155-_safeTransferFrom-address-address-uint256-uint256-bytes-)
- [_safeBatchTransferFrom(from, to, ids, values, data)](#ERC1155-_safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
- [_setURI(newuri)](#ERC1155-_setURI-string-)
@@ -86,33 +91,30 @@ Originally based on code by Enjin: https://github.com/enjin/erc-1155
- [_burn(from, id, value)](#ERC1155-_burn-address-uint256-uint256-)
- [_burnBatch(from, ids, values)](#ERC1155-_burnBatch-address-uint256---uint256---)
- [_setApprovalForAll(owner, operator, approved)](#ERC1155-_setApprovalForAll-address-address-bool-)
-#### IERC1155Errors [!toc]
-#### IERC1155MetadataURI [!toc]
-#### IERC1155 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-[Batched](/contracts/5.x/erc1155) version of [`ERC1155.safeTransferFrom`](#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-).
+[Batched](/contracts/5.x/erc1155#batch-operations) version of [`ERC1155.safeTransferFrom`](#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-).
This function can potentially allow a reentrancy attack when transferring tokens
@@ -336,6 +336,23 @@ acceptance magic value.
+
+Checks if `operator` is authorized to transfer tokens owned by `owner`. Reverts with [`IERC1155Errors.ERC1155MissingApprovalForAll`](/contracts/5.x/api/interfaces#IERC1155Errors-ERC1155MissingApprovalForAll-address-address-) if not.
+
+
+
+
@@ -360,7 +377,7 @@ Requirements:
- `ids` and `values` must have the same length.
-The ERC-1155 acceptance check is not performed in this function. See [`ERC1155._updateWithAcceptanceCheck`](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-) instead.
+The ERC-1155 acceptance check is not performed in this function. See [`ERC1155._updateWithAcceptanceCheck`](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-bool-) instead.
@@ -388,6 +405,36 @@ update to the contract state after this function would break the check-effect-in
overriding [`ERC1155._update`](#ERC1155-_update-address-address-uint256---uint256---) instead.
+
+This version is kept for backward compatibility. We recommend calling the alternative version with a boolean
+flag in order to achieve better control over which hook to call.
+
+
+
+
+Version of [`ERC1155._update`](#ERC1155-_update-address-address-uint256---uint256---) that performs the token acceptance check by calling
+[`IERC1155Receiver.onERC1155Received`](#IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes-) or [`IERC1155Receiver.onERC1155BatchReceived`](#IERC1155Receiver-onERC1155BatchReceived-address-address-uint256---uint256---bytes-) on the receiver address if it
+contains code (eg. is a smart contract at the moment of execution).
+
+
+Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
+update to the contract state after this function would break the check-effect-interaction pattern. Consider
+overriding [`ERC1155._update`](#ERC1155-_update-address-address-uint256---uint256---) instead.
+
+
@@ -429,7 +476,7 @@ acceptance magic value.
-[Batched](/contracts/5.x/erc1155) version of [`ERC1155._safeTransferFrom`](#ERC1155-_safeTransferFrom-address-address-uint256-uint256-bytes-).
+[Batched](/contracts/5.x/erc1155#batch-operations) version of [`ERC1155._safeTransferFrom`](#ERC1155-_safeTransferFrom-address-address-uint256-uint256-bytes-).
Emits a [`IERC1155.TransferBatch`](#IERC1155-TransferBatch-address-address-address-uint256---uint256---) event.
@@ -512,7 +559,7 @@ acceptance magic value.
-[Batched](/contracts/5.x/erc1155) version of [`ERC1155._mint`](#ERC1155-_mint-address-uint256-uint256-bytes-).
+[Batched](/contracts/5.x/erc1155#batch-operations) version of [`ERC1155._mint`](#ERC1155-_mint-address-uint256-uint256-bytes-).
Emits a [`IERC1155.TransferBatch`](#IERC1155-TransferBatch-address-address-address-uint256---uint256---) event.
@@ -562,7 +609,7 @@ Requirements:
-[Batched](/contracts/5.x/erc1155) version of [`ERC1155._burn`](#ERC1155-_burn-address-uint256-uint256-).
+[Batched](/contracts/5.x/erc1155#batch-operations) version of [`ERC1155._burn`](#ERC1155-_burn-address-uint256-uint256-).
Emits a [`IERC1155.TransferBatch`](#IERC1155-TransferBatch-address-address-address-uint256---uint256---) event.
@@ -593,6 +640,7 @@ Emits an [`IERC1155.ApprovalForAll`](#IERC1155-ApprovalForAll-address-address-bo
Requirements:
+- `owner` cannot be the zero address.
- `operator` cannot be the zero address.
@@ -602,9 +650,9 @@ Requirements:
-## `IERC1155`
+## `IERC1155`
-
+
@@ -626,8 +674,12 @@ Required interface of an ERC-1155 compliant contract, as defined in the
- [isApprovedForAll(account, operator)](#IERC1155-isApprovedForAll-address-address-)
- [safeTransferFrom(from, to, id, value, data)](#IERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-)
- [safeBatchTransferFrom(from, to, ids, values, data)](#IERC1155-safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
-#### IERC165 [!toc]
+
+IERC165
+
- [supportsInterface(interfaceId)](#IERC165-supportsInterface-bytes4-)
+
+
@@ -638,7 +690,6 @@ Required interface of an ERC-1155 compliant contract, as defined in the
- [TransferBatch(operator, from, to, ids, values)](#IERC1155-TransferBatch-address-address-address-uint256---uint256---)
- [ApprovalForAll(account, operator, approved)](#IERC1155-ApprovalForAll-address-address-bool-)
- [URI(value, id)](#IERC1155-URI-string-uint256-)
-#### IERC165 [!toc]
@@ -671,7 +722,7 @@ Returns the value of tokens of token type `id` owned by `account`.
-[Batched](/contracts/5.x/erc1155) version of [`IERC6909.balanceOf`](../interfaces#IERC6909-balanceOf-address-uint256-).
+[Batched](/contracts/5.x/erc1155#batch-operations) version of [`ERC1155.balanceOf`](#ERC1155-balanceOf-address-uint256-).
Requirements:
@@ -768,7 +819,7 @@ acceptance magic value.
-[Batched](/contracts/5.x/erc1155) version of [`ERC1155.safeTransferFrom`](#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-).
+[Batched](/contracts/5.x/erc1155#batch-operations) version of [`ERC1155.safeTransferFrom`](#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-).
This function can potentially allow a reentrancy attack when transferring tokens
@@ -867,9 +918,9 @@ returned by [`IERC1155MetadataURI.uri`](#IERC1155MetadataURI-uri-uint256-).
+
+```solidity
+import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Crosschain.sol";
+```
+
+Extension of [`ERC1155`](#ERC1155) that makes it natively cross-chain using the ERC-7786 based [`BridgeMultiToken`](/contracts/5.x/api/crosschain#BridgeMultiToken).
+
+This extension makes the token compatible with:
+* [`ERC1155Crosschain`](#ERC1155Crosschain) instances on other chains,
+* [`ERC1155`](#ERC1155) instances on other chains that are bridged using [`BridgeERC1155`](/contracts/5.x/api/crosschain#BridgeERC1155),
+
+
+
+TransferFrom variant of [`ERC1155Crosschain.crosschainTransferFrom`](#ERC1155Crosschain-crosschainTransferFrom-address-bytes-uint256---uint256---), using ERC1155 allowance from the sender to the caller.
+
+
+
+
+
+
+
+
+
crosschainTransferFrom(address from, bytes to, uint256[] ids, uint256[] values) โ bytes32
+
+TransferFrom variant of [`ERC1155Crosschain.crosschainTransferFrom`](#ERC1155Crosschain-crosschainTransferFrom-address-bytes-uint256---uint256---), using ERC1155 allowance from the sender to the caller.
+
+
+
+"Unlocking" tokens is achieved through minting
+
+
+
+
-## `ERC1155Pausable`
+## `ERC1155Pausable`
-
+
@@ -1082,8 +1341,8 @@ event of a large bug.
This contract does not include public pause and unpause functions. In
addition to inheriting this contract, you must define both functions, invoking the
-[`Pausable._pause`](../utils#Pausable-_pause--) and [`Pausable._unpause`](../utils#Pausable-_unpause--) internal functions, with appropriate
-access control, e.g. using [`AccessControl`](../access#AccessControl) or [`Ownable`](../access#Ownable). Not doing so will
+[`Pausable._pause`](/contracts/5.x/api/utils#Pausable-_pause--) and [`Pausable._unpause`](/contracts/5.x/api/utils#Pausable-_unpause--) internal functions, with appropriate
+access control, e.g. using [`AccessControl`](/contracts/5.x/api/access#AccessControl) or [`Ownable`](/contracts/5.x/api/access#Ownable). Not doing so will
make the contract pause mechanism of the contract unreachable, and thus unusable.
@@ -1091,13 +1350,19 @@ make the contract pause mechanism of the contract unreachable, and thus unusable
Functions
- [_update(from, to, ids, values)](#ERC1155Pausable-_update-address-address-uint256---uint256---)
-#### Pausable [!toc]
+
+Pausable
+
- [paused()](#Pausable-paused--)
- [_requireNotPaused()](#Pausable-_requireNotPaused--)
- [_requirePaused()](#Pausable-_requirePaused--)
- [_pause()](#Pausable-_pause--)
- [_unpause()](#Pausable-_unpause--)
-#### ERC1155 [!toc]
+
+
+
+ERC1155
+
- [supportsInterface(interfaceId)](#ERC1155-supportsInterface-bytes4-)
- [uri()](#ERC1155-uri-uint256-)
- [balanceOf(account, id)](#ERC1155-balanceOf-address-uint256-)
@@ -1106,7 +1371,9 @@ make the contract pause mechanism of the contract unreachable, and thus unusable
- [isApprovedForAll(account, operator)](#ERC1155-isApprovedForAll-address-address-)
- [safeTransferFrom(from, to, id, value, data)](#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-)
- [safeBatchTransferFrom(from, to, ids, values, data)](#ERC1155-safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
+- [_checkAuthorized(operator, owner)](#ERC1155-_checkAuthorized-address-address-)
- [_updateWithAcceptanceCheck(from, to, ids, values, data)](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-)
+- [_updateWithAcceptanceCheck(from, to, ids, values, data, batch)](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-bool-)
- [_safeTransferFrom(from, to, id, value, data)](#ERC1155-_safeTransferFrom-address-address-uint256-uint256-bytes-)
- [_safeBatchTransferFrom(from, to, ids, values, data)](#ERC1155-_safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
- [_setURI(newuri)](#ERC1155-_setURI-string-)
@@ -1115,41 +1382,46 @@ make the contract pause mechanism of the contract unreachable, and thus unusable
- [_burn(from, id, value)](#ERC1155-_burn-address-uint256-uint256-)
- [_burnBatch(from, ids, values)](#ERC1155-_burnBatch-address-uint256---uint256---)
- [_setApprovalForAll(owner, operator, approved)](#ERC1155-_setApprovalForAll-address-address-bool-)
-#### IERC1155Errors [!toc]
-#### IERC1155MetadataURI [!toc]
-#### IERC1155 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
-## `ERC1155Supply`
+## `ERC1155Supply`
-
+
@@ -1204,16 +1474,18 @@ import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
Extension of ERC-1155 that adds tracking of total supply per id.
Useful for scenarios where Fungible and Non-fungible tokens have to be
-clearly identified. Note: While a totalSupply of 1 might mean the
-corresponding is an NFT, there is no guarantees that no other token with the
-same id are not going to be minted.
+clearly identified. Note: While a `totalSupply` of 1 may mean the
+corresponding token is an NFT, there are no inherent guarantees that
+no more tokens with the same id will be minted in future.
This contract implies a global limit of 2**256 - 1 to the number of tokens
that can be minted.
-CAUTION: This extension should not be added in an upgrade to an already deployed contract.
+
+This extension should not be added in an upgrade to an already deployed contract.
+
Functions
@@ -1222,7 +1494,9 @@ CAUTION: This extension should not be added in an upgrade to an already deployed
- [totalSupply()](#ERC1155Supply-totalSupply--)
- [exists(id)](#ERC1155Supply-exists-uint256-)
- [_update(from, to, ids, values)](#ERC1155Supply-_update-address-address-uint256---uint256---)
-#### ERC1155 [!toc]
+
+ERC1155
+
- [supportsInterface(interfaceId)](#ERC1155-supportsInterface-bytes4-)
- [uri()](#ERC1155-uri-uint256-)
- [balanceOf(account, id)](#ERC1155-balanceOf-address-uint256-)
@@ -1231,7 +1505,9 @@ CAUTION: This extension should not be added in an upgrade to an already deployed
- [isApprovedForAll(account, operator)](#ERC1155-isApprovedForAll-address-address-)
- [safeTransferFrom(from, to, id, value, data)](#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-)
- [safeBatchTransferFrom(from, to, ids, values, data)](#ERC1155-safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
+- [_checkAuthorized(operator, owner)](#ERC1155-_checkAuthorized-address-address-)
- [_updateWithAcceptanceCheck(from, to, ids, values, data)](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-)
+- [_updateWithAcceptanceCheck(from, to, ids, values, data, batch)](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-bool-)
- [_safeTransferFrom(from, to, id, value, data)](#ERC1155-_safeTransferFrom-address-address-uint256-uint256-bytes-)
- [_safeBatchTransferFrom(from, to, ids, values, data)](#ERC1155-_safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
- [_setURI(newuri)](#ERC1155-_setURI-string-)
@@ -1240,35 +1516,32 @@ CAUTION: This extension should not be added in an upgrade to an already deployed
- [_burn(from, id, value)](#ERC1155-_burn-address-uint256-uint256-)
- [_burnBatch(from, ids, values)](#ERC1155-_burnBatch-address-uint256---uint256---)
- [_setApprovalForAll(owner, operator, approved)](#ERC1155-_setApprovalForAll-address-address-bool-)
-#### IERC1155Errors [!toc]
-#### IERC1155MetadataURI [!toc]
-#### IERC1155 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
-#### ERC1155 [!toc]
-#### IERC1155Errors [!toc]
+
+IERC1155Errors
+
- [ERC1155InsufficientBalance(sender, balance, needed, tokenId)](#IERC1155Errors-ERC1155InsufficientBalance-address-uint256-uint256-uint256-)
- [ERC1155InvalidSender(sender)](#IERC1155Errors-ERC1155InvalidSender-address-)
- [ERC1155InvalidReceiver(receiver)](#IERC1155Errors-ERC1155InvalidReceiver-address-)
@@ -1276,10 +1549,8 @@ CAUTION: This extension should not be added in an upgrade to an already deployed
- [ERC1155InvalidApprover(approver)](#IERC1155Errors-ERC1155InvalidApprover-address-)
- [ERC1155InvalidOperator(operator)](#IERC1155Errors-ERC1155InvalidOperator-address-)
- [ERC1155InvalidArrayLength(idsLength, valuesLength)](#IERC1155Errors-ERC1155InvalidArrayLength-uint256-uint256-)
-#### IERC1155MetadataURI [!toc]
-#### IERC1155 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -1295,7 +1566,7 @@ CAUTION: This extension should not be added in an upgrade to an already deployed
-Total value of tokens in with a given id.
+Total value of tokens with a given id.
@@ -1329,7 +1600,7 @@ Total value of tokens.
-Indicates whether any token exist with a given id, or not.
+Indicates whether any tokens exist with a given id, or not.
@@ -1358,7 +1629,7 @@ Requirements:
- `ids` and `values` must have the same length.
-The ERC-1155 acceptance check is not performed in this function. See [`ERC1155._updateWithAcceptanceCheck`](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-) instead.
+The ERC-1155 acceptance check is not performed in this function. See [`ERC1155._updateWithAcceptanceCheck`](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-bool-) instead.
@@ -1368,9 +1639,9 @@ The ERC-1155 acceptance check is not performed in this function. See [`ERC1155._
-## `ERC1155URIStorage`
+## `ERC1155URIStorage`
-
+
@@ -1389,7 +1660,9 @@ Inspired by the [`ERC721URIStorage`](/contracts/5.x/api/token/ERC721#ERC721URISt
- [uri(tokenId)](#ERC1155URIStorage-uri-uint256-)
- [_setURI(tokenId, tokenURI)](#ERC1155URIStorage-_setURI-uint256-string-)
- [_setBaseURI(baseURI)](#ERC1155URIStorage-_setBaseURI-string-)
-#### ERC1155 [!toc]
+
+ERC1155
+
- [supportsInterface(interfaceId)](#ERC1155-supportsInterface-bytes4-)
- [balanceOf(account, id)](#ERC1155-balanceOf-address-uint256-)
- [balanceOfBatch(accounts, ids)](#ERC1155-balanceOfBatch-address---uint256---)
@@ -1397,8 +1670,10 @@ Inspired by the [`ERC721URIStorage`](/contracts/5.x/api/token/ERC721#ERC721URISt
- [isApprovedForAll(account, operator)](#ERC1155-isApprovedForAll-address-address-)
- [safeTransferFrom(from, to, id, value, data)](#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-)
- [safeBatchTransferFrom(from, to, ids, values, data)](#ERC1155-safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
+- [_checkAuthorized(operator, owner)](#ERC1155-_checkAuthorized-address-address-)
- [_update(from, to, ids, values)](#ERC1155-_update-address-address-uint256---uint256---)
- [_updateWithAcceptanceCheck(from, to, ids, values, data)](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-)
+- [_updateWithAcceptanceCheck(from, to, ids, values, data, batch)](#ERC1155-_updateWithAcceptanceCheck-address-address-uint256---uint256---bytes-bool-)
- [_safeTransferFrom(from, to, id, value, data)](#ERC1155-_safeTransferFrom-address-address-uint256-uint256-bytes-)
- [_safeBatchTransferFrom(from, to, ids, values, data)](#ERC1155-_safeBatchTransferFrom-address-address-uint256---uint256---bytes-)
- [_setURI(newuri)](#ERC1155-_setURI-string-)
@@ -1407,35 +1682,32 @@ Inspired by the [`ERC721URIStorage`](/contracts/5.x/api/token/ERC721#ERC721URISt
- [_burn(from, id, value)](#ERC1155-_burn-address-uint256-uint256-)
- [_burnBatch(from, ids, values)](#ERC1155-_burnBatch-address-uint256---uint256---)
- [_setApprovalForAll(owner, operator, approved)](#ERC1155-_setApprovalForAll-address-address-bool-)
-#### IERC1155Errors [!toc]
-#### IERC1155MetadataURI [!toc]
-#### IERC1155 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
+
diff --git a/content/contracts/5.x/api/token/ERC20.mdx b/content/contracts/5.x/api/token/ERC20.mdx
index f0473dda..4c9d8b45 100644
--- a/content/contracts/5.x/api/token/ERC20.mdx
+++ b/content/contracts/5.x/api/token/ERC20.mdx
@@ -21,6 +21,7 @@ Additionally there are multiple custom extensions, including:
* [`ERC20Bridgeable`](#ERC20Bridgeable): compatibility with crosschain bridges through ERC-7802.
* [`ERC20Burnable`](#ERC20Burnable): destruction of own tokens.
* [`ERC20Capped`](#ERC20Capped): enforcement of a cap to the total supply when minting tokens.
+* [`ERC20Crosschain`](#ERC20Crosschain): embedded [`BridgeFungible`](/contracts/5.x/api/crosschain#BridgeFungible) bridge, making the token crosschain through the use of ERC-7786 gateways.
* [`ERC20Pausable`](#ERC20Pausable): ability to pause token transfers.
* [`ERC20FlashMint`](#ERC20FlashMint): token level support for flash loans through the minting and burning of ephemeral tokens (standardized as ERC-3156).
* [`ERC20Votes`](#ERC20Votes): support for voting and vote delegation. [See the governance guide for a minimal example (with the required overrides when combining ERC20 + ERC20Permit + ERC20Votes)](/contracts/5.x/api/governance#token).
@@ -35,7 +36,7 @@ Finally, there are some utilities to interact with ERC-20 contracts in various w
Other utilities that support ERC-20 assets can be found in the codebase:
-* ERC-20 tokens can be timelocked (held for a beneficiary until a specified time) or vested (released following a given schedule) using a [`VestingWallet`](../finance#VestingWallet).
+* ERC-20 tokens can be timelocked (held for a beneficiary until a specified time) or vested (released following a given schedule) using a [`VestingWallet`](/contracts/5.x/api/finance#VestingWallet).
This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC-20 (such as [`_mint`](#ERC20-_mint-address-uint256-)) and expose them as external functions in the way they prefer.
@@ -61,6 +62,8 @@ This core set of contracts is designed to be unopinionated, allowing developers
[`ERC20Capped`](#ERC20Capped)
+[`ERC20Crosschain`](#ERC20Crosschain)
+
[`ERC20Pausable`](#ERC20Pausable)
[`ERC20Votes`](#ERC20Votes)
@@ -85,9 +88,9 @@ This core set of contracts is designed to be unopinionated, allowing developers
-## `ERC20`
+## `ERC20`
-
+
@@ -100,7 +103,7 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
Implementation of the [`IERC20`](#IERC20) interface.
This implementation is agnostic to the way tokens are created. This means
-that a supply mechanism has to be added in a derived contract using [`ERC1155._mint`](/contracts/5.x/api/token/ERC1155#ERC1155-_mint-address-uint256-uint256-bytes-).
+that a supply mechanism has to be added in a derived contract using [`ERC20._mint`](#ERC20-_mint-address-uint256-).
For a detailed writeup see our guide
@@ -108,7 +111,7 @@ For a detailed writeup see our guide
to implement supply mechanisms](https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226).
-The default value of [`IERC6909Metadata.decimals`](../interfaces#IERC6909Metadata-decimals-uint256-) is 18. To change this, you should override
+The default value of [`ERC20.decimals`](#ERC20-decimals--) is 18. To change this, you should override
this function so it returns a different value.
We have followed general OpenZeppelin Contracts guidelines: functions revert
@@ -136,35 +139,36 @@ applications.
- [_approve(owner, spender, value)](#ERC20-_approve-address-address-uint256-)
- [_approve(owner, spender, value, emitEvent)](#ERC20-_approve-address-address-uint256-bool-)
- [_spendAllowance(owner, spender, value)](#ERC20-_spendAllowance-address-address-uint256-)
-#### IERC20Errors [!toc]
-#### IERC20Metadata [!toc]
-#### IERC20 [!toc]
-Sets the values for [`Governor.name`](../governance#Governor-name--) and [`IERC6909Metadata.symbol`](../interfaces#IERC6909Metadata-symbol-uint256-).
+Sets the values for [`ERC20.name`](#ERC20-name--) and [`ERC20.symbol`](#ERC20-symbol--).
Both values are immutable: they can only be set once during construction.
@@ -320,10 +324,10 @@ Requirements:
Returns the remaining number of tokens that `spender` will be
-allowed to spend on behalf of `owner` through [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-). This is
+allowed to spend on behalf of `owner` through [`ERC20.transferFrom`](#ERC20-transferFrom-address-address-uint256-). This is
zero by default.
-This value changes when [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) or [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-) are called.
+This value changes when [`ERC20.approve`](#ERC20-approve-address-uint256-) or [`ERC20.transferFrom`](#ERC20-transferFrom-address-address-uint256-) are called.
@@ -368,7 +372,7 @@ Requirements:
See [`IERC20.transferFrom`](#IERC20-transferFrom-address-address-uint256-).
-Skips emitting an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event indicating an allowance update. This is not
+Skips emitting an [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event indicating an allowance update. This is not
required by the ERC. See [_approve](#ERC20-_approve-address-address-uint256-bool-).
@@ -400,13 +404,13 @@ Requirements:
Moves a `value` amount of tokens from `from` to `to`.
-This internal function is equivalent to [`IERC6909.transfer`](../interfaces#IERC6909-transfer-address-uint256-uint256-), and can be used to
+This internal function is equivalent to [`ERC20.transfer`](#ERC20-transfer-address-uint256-), and can be used to
e.g. implement automatic token fees, slashing mechanisms, etc.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC20.Transfer`](#IERC20-Transfer-address-address-uint256-) event.
-This function is not virtual, [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) should be overridden instead.
+This function is not virtual, [`ERC20._update`](#ERC20-_update-address-address-uint256-) should be overridden instead.
@@ -428,7 +432,7 @@ Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints
(or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
this function.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC20.Transfer`](#IERC20-Transfer-address-address-uint256-) event.
@@ -448,10 +452,10 @@ Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-ad
Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
Relies on the `_update` mechanism
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event with `from` set to the zero address.
+Emits a [`IERC20.Transfer`](#IERC20-Transfer-address-address-uint256-) event with `from` set to the zero address.
-This function is not virtual, [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) should be overridden instead.
+This function is not virtual, [`ERC20._update`](#ERC20-_update-address-address-uint256-) should be overridden instead.
@@ -472,10 +476,10 @@ This function is not virtual, [`ERC1155._update`](/contracts/5.x/api/token/ERC11
Destroys a `value` amount of tokens from `account`, lowering the total supply.
Relies on the `_update` mechanism.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event with `to` set to the zero address.
+Emits a [`IERC20.Transfer`](#IERC20-Transfer-address-address-uint256-) event with `to` set to the zero address.
-This function is not virtual, [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) should be overridden instead
+This function is not virtual, [`ERC20._update`](#ERC20-_update-address-address-uint256-) should be overridden instead
@@ -498,7 +502,7 @@ Sets `value` as the allowance of `spender` over the `owner`'s tokens.
This internal function is equivalent to `approve`, and can be used to
e.g. set automatic allowances for certain subsystems, etc.
-Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Emits an [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event.
Requirements:
@@ -522,7 +526,7 @@ Overrides to this logic should be done to the variant with an additional `bool e
-Variant of [`ERC20._approve`](#ERC20-_approve-address-address-uint256-bool-) with an optional flag to enable or disable the [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Variant of [`ERC20._approve`](#ERC20-_approve-address-address-uint256-bool-) with an optional flag to enable or disable the [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event.
By default (when calling [`ERC20._approve`](#ERC20-_approve-address-address-uint256-bool-)) the flag is set to true. On the other hand, approval changes made by
`_spendAllowance` during the `transferFrom` operation sets the flag to false. This saves gas by not emitting any
@@ -559,7 +563,7 @@ Updates `owner`'s allowance for `spender` based on spent `value`.
Does not update the allowance value in case of infinite allowance.
Revert if not enough allowance is available.
-Does not emit an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Does not emit an [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event.
@@ -568,9 +572,9 @@ Does not emit an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-a
-## `IERC20`
+## `IERC20`
-
+
@@ -652,7 +656,7 @@ Moves a `value` amount of tokens from the caller's account to `to`.
Returns a boolean value indicating whether the operation succeeded.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC20.Transfer`](#IERC20-Transfer-address-address-uint256-) event.
@@ -670,10 +674,10 @@ Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-ad
Returns the remaining number of tokens that `spender` will be
-allowed to spend on behalf of `owner` through [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-). This is
+allowed to spend on behalf of `owner` through [`ERC20.transferFrom`](#ERC20-transferFrom-address-address-uint256-). This is
zero by default.
-This value changes when [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) or [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-) are called.
+This value changes when [`ERC20.approve`](#ERC20-approve-address-uint256-) or [`ERC20.transferFrom`](#ERC20-transferFrom-address-address-uint256-) are called.
@@ -704,7 +708,7 @@ desired value afterwards:
https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
-Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Emits an [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event.
@@ -727,7 +731,7 @@ allowance.
Returns a boolean value indicating whether the operation succeeded.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC20.Transfer`](#IERC20-Transfer-address-address-uint256-) event.
@@ -766,7 +770,7 @@ Note that `value` may be zero.
Emitted when the allowance of a `spender` for an `owner` is set by
-a call to [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-). `value` is the new allowance.
+a call to [`ERC20.approve`](#ERC20-approve-address-uint256-). `value` is the new allowance.
@@ -775,9 +779,9 @@ a call to [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-ui
Moves a `value` amount of tokens from the caller's account to `to`
-and then calls [`IERC1363Receiver.onTransferReceived`](../interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) on `to`. Returns a flag that indicates
+and then calls [`IERC1363Receiver.onTransferReceived`](/contracts/5.x/api/interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) on `to`. Returns a flag that indicates
if the call succeeded.
Requirements:
- The target has code (i.e. is a contract).
-- The target `to` must implement the [`IERC1363Receiver`](../interfaces#IERC1363Receiver) interface.
-- The target must return the [`IERC1363Receiver.onTransferReceived`](../interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) selector to accept the transfer.
-- The internal [`IERC6909.transfer`](../interfaces#IERC6909-transfer-address-uint256-uint256-) must succeed (returned `true`).
+- The target `to` must implement the [`IERC1363Receiver`](/contracts/5.x/api/interfaces#IERC1363Receiver) interface.
+- The target must return the [`IERC1363Receiver.onTransferReceived`](/contracts/5.x/api/interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) selector to accept the transfer.
+- The internal [`ERC20.transfer`](#ERC20-transfer-address-uint256-) must succeed (returned `true`).
@@ -926,7 +924,7 @@ Requirements:
-Variant of [`IERC1363.transferAndCall`](../interfaces#IERC1363-transferAndCall-address-uint256-bytes-) that accepts an additional `data` parameter with
+Variant of [`ERC1363.transferAndCall`](#ERC1363-transferAndCall-address-uint256-bytes-) that accepts an additional `data` parameter with
no specified format.
@@ -945,15 +943,15 @@ no specified format.
Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
-and then calls [`IERC1363Receiver.onTransferReceived`](../interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) on `to`. Returns a flag that indicates
+and then calls [`IERC1363Receiver.onTransferReceived`](/contracts/5.x/api/interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) on `to`. Returns a flag that indicates
if the call succeeded.
Requirements:
- The target has code (i.e. is a contract).
-- The target `to` must implement the [`IERC1363Receiver`](../interfaces#IERC1363Receiver) interface.
-- The target must return the [`IERC1363Receiver.onTransferReceived`](../interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) selector to accept the transfer.
-- The internal [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-) must succeed (returned `true`).
+- The target `to` must implement the [`IERC1363Receiver`](/contracts/5.x/api/interfaces#IERC1363Receiver) interface.
+- The target must return the [`IERC1363Receiver.onTransferReceived`](/contracts/5.x/api/interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) selector to accept the transfer.
+- The internal [`ERC20.transferFrom`](#ERC20-transferFrom-address-address-uint256-) must succeed (returned `true`).
@@ -970,7 +968,7 @@ Requirements:
-Variant of [`IERC1363.transferFromAndCall`](../interfaces#IERC1363-transferFromAndCall-address-address-uint256-bytes-) that accepts an additional `data` parameter with
+Variant of [`ERC1363.transferFromAndCall`](#ERC1363-transferFromAndCall-address-address-uint256-bytes-) that accepts an additional `data` parameter with
no specified format.
@@ -989,15 +987,15 @@ no specified format.
Sets a `value` amount of tokens as the allowance of `spender` over the
-caller's tokens and then calls [`IERC1363Spender.onApprovalReceived`](../interfaces#IERC1363Spender-onApprovalReceived-address-uint256-bytes-) on `spender`.
+caller's tokens and then calls [`IERC1363Spender.onApprovalReceived`](/contracts/5.x/api/interfaces#IERC1363Spender-onApprovalReceived-address-uint256-bytes-) on `spender`.
Returns a flag that indicates if the call succeeded.
Requirements:
- The target has code (i.e. is a contract).
-- The target `spender` must implement the [`IERC1363Spender`](../interfaces#IERC1363Spender) interface.
-- The target must return the [`IERC1363Spender.onApprovalReceived`](../interfaces#IERC1363Spender-onApprovalReceived-address-uint256-bytes-) selector to accept the approval.
-- The internal [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) must succeed (returned `true`).
+- The target `spender` must implement the [`IERC1363Spender`](/contracts/5.x/api/interfaces#IERC1363Spender) interface.
+- The target must return the [`IERC1363Spender.onApprovalReceived`](/contracts/5.x/api/interfaces#IERC1363Spender-onApprovalReceived-address-uint256-bytes-) selector to accept the approval.
+- The internal [`ERC20.approve`](#ERC20-approve-address-uint256-) must succeed (returned `true`).
@@ -1014,7 +1012,7 @@ Requirements:
-Variant of [`IERC1363.approveAndCall`](../interfaces#IERC1363-approveAndCall-address-uint256-bytes-) that accepts an additional `data` parameter with
+Variant of [`ERC1363.approveAndCall`](#ERC1363-approveAndCall-address-uint256-bytes-) that accepts an additional `data` parameter with
no specified format.
@@ -1032,7 +1030,7 @@ no specified format.
-Indicates a failure within the [`IERC6909.transfer`](../interfaces#IERC6909-transfer-address-uint256-uint256-) part of a transferAndCall operation.
+Indicates a failure within the [`ERC20.transfer`](#ERC20-transfer-address-uint256-) part of a transferAndCall operation.
@@ -1049,7 +1047,7 @@ Indicates a failure within the [`IERC6909.transfer`](../interfaces#IERC6909-tran
-Indicates a failure within the [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-) part of a transferFromAndCall operation.
+Indicates a failure within the [`ERC20.transferFrom`](#ERC20-transferFrom-address-address-uint256-) part of a transferFromAndCall operation.
@@ -1066,7 +1064,7 @@ Indicates a failure within the [`IERC6909.transferFrom`](../interfaces#IERC6909-
-Indicates a failure within the [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) part of a approveAndCall operation.
+Indicates a failure within the [`ERC20.approve`](#ERC20-approve-address-uint256-) part of a approveAndCall operation.
@@ -1075,9 +1073,9 @@ Indicates a failure within the [`IERC6909.approve`](../interfaces#IERC6909-appro
@@ -1318,7 +1322,7 @@ Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints
(or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
this function.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC20.Transfer`](#IERC20-Transfer-address-address-uint256-) event.
@@ -1357,13 +1361,200 @@ The supplied cap is not a valid cap.
+
+
+
+
+```solidity
+import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Crosschain.sol";
+```
+
+Extension of [`ERC20`](#ERC20) that makes it natively cross-chain using the ERC-7786 based [`BridgeFungible`](/contracts/5.x/api/crosschain#BridgeFungible).
+
+This extension makes the token compatible with counterparts on other chains, which can be:
+* [`ERC20Crosschain`](#ERC20Crosschain) instances,
+* [`ERC20`](#ERC20) instances that are bridged using [`BridgeERC20`](/contracts/5.x/api/crosschain#BridgeERC20),
+* [`ERC20Bridgeable`](#ERC20Bridgeable) instances that are bridged using [`BridgeERC7802`](/contracts/5.x/api/crosschain#BridgeERC7802).
+
+It is mostly equivalent to inheriting from both [`ERC20Bridgeable`](#ERC20Bridgeable) and [`BridgeERC7802`](/contracts/5.x/api/crosschain#BridgeERC7802), and configuring them such
+that:
+* `token` (on the [`BridgeERC7802`](/contracts/5.x/api/crosschain#BridgeERC7802) side) is `address(this)`,
+* `_checkTokenBridge` (on the [`ERC20Bridgeable`](#ERC20Bridgeable) side) is implemented such that it only accepts self-calls.
+
+
+
+Variant of [`BridgeFungible.crosschainTransfer`](/contracts/5.x/api/crosschain#BridgeFungible-crosschainTransfer-bytes-uint256-) that allows an authorized account (using ERC20 allowance) to operate on `from`'s assets.
+
+
+
+"Unlocking" tokens is achieved through minting
+
+
+
+
-## `ERC20FlashMint`
+## `ERC20FlashMint`
-
+
@@ -1376,13 +1567,13 @@ import "@openzeppelin/contracts/token/ERC20/extensions/ERC20FlashMint.sol";
Implementation of the ERC-3156 Flash loans extension, as defined in
[ERC-3156](https://eips.ethereum.org/EIPS/eip-3156).
-Adds the [`IERC3156FlashLender.flashLoan`](../interfaces#IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-) method, which provides flash loan support at the token
-level. By default there is no fee, but this can be changed by overriding [`IERC3156FlashLender.flashFee`](../interfaces#IERC3156FlashLender-flashFee-address-uint256-).
+Adds the [`ERC20FlashMint.flashLoan`](#ERC20FlashMint-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-) method, which provides flash loan support at the token
+level. By default there is no fee, but this can be changed by overriding [`ERC20FlashMint.flashFee`](#ERC20FlashMint-flashFee-address-uint256-).
When this extension is used along with the [`ERC20Capped`](#ERC20Capped) or [`ERC20Votes`](#ERC20Votes) extensions,
-[`IERC3156FlashLender.maxFlashLoan`](../interfaces#IERC3156FlashLender-maxFlashLoan-address-) will not correctly reflect the maximum that can be flash minted. We recommend
-overriding [`IERC3156FlashLender.maxFlashLoan`](../interfaces#IERC3156FlashLender-maxFlashLoan-address-) so that it correctly reflects the supply cap.
+[`ERC20FlashMint.maxFlashLoan`](#ERC20FlashMint-maxFlashLoan-address-) will not correctly reflect the maximum that can be flash minted. We recommend
+overriding [`ERC20FlashMint.maxFlashLoan`](#ERC20FlashMint-maxFlashLoan-address-) so that it correctly reflects the supply cap.
@@ -1464,6 +1655,12 @@ overriding [`IERC3156FlashLender.maxFlashLoan`](../interfaces#IERC3156FlashLende
Returns the maximum amount of tokens available for loan.
+
+This function will not automatically detect any supply cap
+added by other extensions, such as [`ERC20Capped`](#ERC20Capped). If necessary,
+override this function to take a supply cap into account.
+
+
@@ -1490,7 +1687,7 @@ loans.
#
@@ -1537,7 +1734,7 @@ This function can be overloaded to change the fee receiver.
Performs a flash loan. New tokens are minted and sent to the
-`receiver`, who is required to implement the [`IERC3156FlashBorrower`](../interfaces#IERC3156FlashBorrower)
+`receiver`, who is required to implement the [`IERC3156FlashBorrower`](/contracts/5.x/api/interfaces#IERC3156FlashBorrower)
interface. By the end of the flash loan, the receiver is expected to own
value + fee tokens and have them approved back to the token contract itself so
they can be burned.
@@ -1591,7 +1788,7 @@ The requested loan exceeds the max loan value for `token`.
-The receiver of a flashloan is not a valid [`IERC3156FlashBorrower.onFlashLoan`](../interfaces#IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-) implementer.
+The receiver of a flashloan is not a valid [`IERC3156FlashBorrower.onFlashLoan`](/contracts/5.x/api/interfaces#IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-) implementer.
@@ -1600,9 +1797,9 @@ The receiver of a flashloan is not a valid [`IERC3156FlashBorrower.onFlashLoan`]
-## `ERC20Pausable`
+## `ERC20Pausable`
-
+
@@ -1621,8 +1818,8 @@ event of a large bug.
This contract does not include public pause and unpause functions. In
addition to inheriting this contract, you must define both functions, invoking the
-[`Pausable._pause`](../utils#Pausable-_pause--) and [`Pausable._unpause`](../utils#Pausable-_unpause--) internal functions, with appropriate
-access control, e.g. using [`AccessControl`](../access#AccessControl) or [`Ownable`](../access#Ownable). Not doing so will
+[`Pausable._pause`](/contracts/5.x/api/utils#Pausable-_pause--) and [`Pausable._unpause`](/contracts/5.x/api/utils#Pausable-_unpause--) internal functions, with appropriate
+access control, e.g. using [`AccessControl`](/contracts/5.x/api/access#AccessControl) or [`Ownable`](/contracts/5.x/api/access#Ownable). Not doing so will
make the contract pause mechanism of the contract unreachable, and thus unusable.
@@ -1630,13 +1827,19 @@ make the contract pause mechanism of the contract unreachable, and thus unusable
@@ -1829,7 +2052,7 @@ need to send a transaction, and thus is not required to hold Ether at all.
-Initializes the [`EIP712`](../utils/cryptography#EIP712) domain separator using the `name` parameter, and setting `version` to `"1"`.
+Initializes the [`EIP712`](/contracts/5.x/api/utils/cryptography#EIP712) domain separator using the `name` parameter, and setting `version` to `"1"`.
It's a good idea to use the same `name` that is defined as the ERC-20 token name.
@@ -1856,7 +2079,7 @@ The same issues [`IERC20.approve`](#IERC20-approve-address-uint256-) has related
ordering also applies here.
-Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Emits an [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event.
Requirements:
@@ -1870,7 +2093,9 @@ For more information on the signature format, see the
[relevant EIP
section](https://eips.ethereum.org/EIPS/eip-2612#specification).
-CAUTION: See Security Considerations above.
+
+See Security Considerations above.
+
@@ -1908,7 +2133,7 @@ prevents a signature from being used multiple times.
-Returns the domain separator used in the encoding of the signature for [`ERC20Permit.permit`](#ERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-), as defined by [`EIP712`](../utils/cryptography#EIP712).
+Returns the domain separator used in the encoding of the signature for [`ERC20Permit.permit`](#ERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-), as defined by [`EIP712`](/contracts/5.x/api/utils/cryptography#EIP712).
@@ -1951,9 +2176,9 @@ Mismatched signature.
-## `ERC20Votes`
+## `ERC20Votes`
-
+
@@ -1971,8 +2196,8 @@ This contract does not provide interface compatibility with Compound's COMP toke
This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
-by calling the [`Votes.delegate`](../governance#Votes-delegate-address-) function directly, or by providing a signature to be used with [`Votes.delegateBySig`](../governance#Votes-delegateBySig-address-uint256-uint256-uint8-bytes32-bytes32-). Voting
-power can be queried through the public accessors [`Votes.getVotes`](../governance#Votes-getVotes-address-) and [`Votes.getPastVotes`](../governance#Votes-getPastVotes-address-uint256-).
+by calling the [`Votes.delegate`](/contracts/5.x/api/governance#Votes-delegate-address-) function directly, or by providing a signature to be used with [`Votes.delegateBySig`](/contracts/5.x/api/governance#Votes-delegateBySig-address-uint256-uint256-uint8-bytes32-bytes32-). Voting
+power can be queried through the public accessors [`Votes.getVotes`](/contracts/5.x/api/governance#Votes-getVotes-address-) and [`Votes.getPastVotes`](/contracts/5.x/api/governance#Votes-getPastVotes-address-uint256-).
By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
@@ -1985,7 +2210,9 @@ requires users to delegate to themselves in order to activate checkpoints and ha
- [_getVotingUnits(account)](#ERC20Votes-_getVotingUnits-address-)
- [numCheckpoints(account)](#ERC20Votes-numCheckpoints-address-)
- [checkpoints(account, pos)](#ERC20Votes-checkpoints-address-uint32-)
-#### Votes [!toc]
+
+Votes
+
- [clock()](#Votes-clock--)
- [CLOCK_MODE()](#Votes-CLOCK_MODE--)
- [_validateTimepoint(timepoint)](#Votes-_validateTimepoint-uint256-)
@@ -2001,21 +2228,29 @@ requires users to delegate to themselves in order to activate checkpoints and ha
- [_moveDelegateVotes(from, to, amount)](#Votes-_moveDelegateVotes-address-address-uint256-)
- [_numCheckpoints(account)](#Votes-_numCheckpoints-address-)
- [_checkpoints(account, pos)](#Votes-_checkpoints-address-uint32-)
-#### IERC5805 [!toc]
-#### IVotes [!toc]
-#### IERC6372 [!toc]
-#### Nonces [!toc]
+
+
+
+Nonces
+
- [nonces(owner)](#Nonces-nonces-address-)
- [_useNonce(owner)](#Nonces-_useNonce-address-)
- [_useCheckedNonce(owner, nonce)](#Nonces-_useCheckedNonce-address-uint256-)
-#### EIP712 [!toc]
+
+
+
+EIP712
+
- [_domainSeparatorV4()](#EIP712-_domainSeparatorV4--)
- [_hashTypedDataV4(structHash)](#EIP712-_hashTypedDataV4-bytes32-)
- [eip712Domain()](#EIP712-eip712Domain--)
- [_EIP712Name()](#EIP712-_EIP712Name--)
- [_EIP712Version()](#EIP712-_EIP712Version--)
-#### IERC5267 [!toc]
-#### ERC20 [!toc]
+
+
+
+ERC20
+
- [name()](#ERC20-name--)
- [symbol()](#ERC20-symbol--)
- [decimals()](#ERC20-decimals--)
@@ -2031,31 +2266,34 @@ requires users to delegate to themselves in order to activate checkpoints and ha
- [_approve(owner, spender, value)](#ERC20-_approve-address-address-uint256-)
- [_approve(owner, spender, value, emitEvent)](#ERC20-_approve-address-address-uint256-bool-)
- [_spendAllowance(owner, spender, value)](#ERC20-_spendAllowance-address-address-uint256-)
-#### IERC20Errors [!toc]
-#### IERC20Metadata [!toc]
-#### IERC20 [!toc]
+
+
@@ -2101,10 +2348,10 @@ requires users to delegate to themselves in order to activate checkpoints and ha
Maximum token supply. Defaults to `type(uint208).max` (2^208^ - 1).
-This maximum is enforced in [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---). It limits the total supply of the token, which is otherwise a uint256,
-so that checkpoints can be stored in the Trace208 structure used by [`Votes`](../governance#Votes). Increasing this value will not
-remove the underlying limitation, and will cause [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) to fail because of a math overflow in
-[`Votes._transferVotingUnits`](../governance#Votes-_transferVotingUnits-address-address-uint256-). An override could be used to further restrict the total supply (to a lower value) if
+This maximum is enforced in [`ERC20._update`](#ERC20-_update-address-address-uint256-). It limits the total supply of the token, which is otherwise a uint256,
+so that checkpoints can be stored in the Trace208 structure used by [`Votes`](/contracts/5.x/api/governance#Votes). Increasing this value will not
+remove the underlying limitation, and will cause [`ERC20._update`](#ERC20-_update-address-address-uint256-) to fail because of a math overflow in
+[`Votes._transferVotingUnits`](/contracts/5.x/api/governance#Votes-_transferVotingUnits-address-address-uint256-). An override could be used to further restrict the total supply (to a lower value) if
additional logic requires it. When resolving override conflicts on this function, the minimum should be
returned.
@@ -2125,7 +2372,7 @@ returned.
Move voting power when tokens are transferred.
-Emits a [`IVotes.DelegateVotesChanged`](../governance#IVotes-DelegateVotesChanged-address-uint256-uint256-) event.
+Emits a [`IVotes.DelegateVotesChanged`](/contracts/5.x/api/governance#IVotes-DelegateVotesChanged-address-uint256-uint256-) event.
@@ -2207,9 +2454,9 @@ Total supply cap has been exceeded, introducing a risk of votes overflowing.
-## `ERC20Wrapper`
+## `ERC20Wrapper`
-
+
@@ -2226,7 +2473,7 @@ in conjunction with other modules. For example, combining this wrapping mechanis
wrapping of an existing "basic" ERC-20 into a governance token.
-Any mechanism in which the underlying token changes the [`IERC6909.balanceOf`](../interfaces#IERC6909-balanceOf-address-uint256-) of an account without an explicit transfer
+Any mechanism in which the underlying token changes the [`ERC20.balanceOf`](#ERC20-balanceOf-address-) of an account without an explicit transfer
may desynchronize this contract's supply and its underlying balance. Please exercise caution when wrapping tokens that
may undercollateralize the wrapper (i.e. wrapper's total supply is higher than its underlying balance). See [`ERC20Wrapper._recover`](#ERC20Wrapper-_recover-address-)
for recovering value accrued to the wrapper.
@@ -2241,7 +2488,9 @@ for recovering value accrued to the wrapper.
- [depositFor(account, value)](#ERC20Wrapper-depositFor-address-uint256-)
- [withdrawTo(account, value)](#ERC20Wrapper-withdrawTo-address-uint256-)
- [_recover(account)](#ERC20Wrapper-_recover-address-)
-#### ERC20 [!toc]
+
+ERC20
+
- [name()](#ERC20-name--)
- [symbol()](#ERC20-symbol--)
- [totalSupply()](#ERC20-totalSupply--)
@@ -2257,21 +2506,21 @@ for recovering value accrued to the wrapper.
- [_approve(owner, spender, value)](#ERC20-_approve-address-address-uint256-)
- [_approve(owner, spender, value, emitEvent)](#ERC20-_approve-address-address-uint256-bool-)
- [_spendAllowance(owner, spender, value)](#ERC20-_spendAllowance-address-address-uint256-)
-#### IERC20Errors [!toc]
-#### IERC20Metadata [!toc]
-#### IERC20 [!toc]
+
+
@@ -2412,9 +2662,9 @@ The underlying token couldn't be wrapped.
-## `ERC4626`
+## `ERC4626`
-
+
@@ -2428,12 +2678,12 @@ Implementation of the ERC-4626 "Tokenized Vault Standard" as defined in
[ERC-4626](https://eips.ethereum.org/EIPS/eip-4626).
This extension allows the minting and burning of "shares" (represented using the ERC-20 inheritance) in exchange for
-underlying "assets" through standardized [`IERC4626.deposit`](../interfaces#IERC4626-deposit-uint256-address-), [`IERC4626.mint`](../interfaces#IERC4626-mint-uint256-address-), [`IERC4626.redeem`](../interfaces#IERC4626-redeem-uint256-address-address-) and [`IERC777.burn`](../interfaces#IERC777-burn-uint256-bytes-) workflows. This contract extends
+underlying "assets" through standardized [`ERC4626.deposit`](#ERC4626-deposit-uint256-address-), [`ERC4626.mint`](#ERC4626-mint-uint256-address-), [`ERC4626.redeem`](#ERC4626-redeem-uint256-address-address-) and [`ERC20Burnable.burn`](#ERC20Burnable-burn-uint256-) workflows. This contract extends
the ERC-20 standard. Any additional extensions included along it would affect the "shares" token represented by this
contract and not the "assets" token which is an independent contract.
-
-In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning
+[CAUTION]
+#### In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning
with a "donation" to the vault that inflates the price of a share. This is variously known as a donation or inflation
attack and is essentially a problem of slippage. Vault deployers can protect against this attack by making an initial
deposit of a non-trivial amount of the asset, such that price manipulation becomes infeasible. Withdrawals may
@@ -2457,25 +2707,23 @@ bigger losses. Developers willing to revert back to the pre-v4.9 behavior just n
`_convertToShares` and `_convertToAssets` functions.
To learn more, check out our [ERC-4626 guide](/contracts/5.x/erc4626).
-
-
-When overriding this contract, some elements must be considered:
+#### [NOTE]
+#### When overriding this contract, some elements must be considered:
* When overriding the behavior of the deposit or withdraw mechanisms, it is recommended to override the internal
-functions. Overriding [`ERC4626._deposit`](#ERC4626-_deposit-address-address-uint256-uint256-) automatically affects both [`IERC4626.deposit`](../interfaces#IERC4626-deposit-uint256-address-) and [`IERC4626.mint`](../interfaces#IERC4626-mint-uint256-address-). Similarly, overriding [`ERC4626._withdraw`](#ERC4626-_withdraw-address-address-address-uint256-uint256-)
-automatically affects both [`IERC4626.withdraw`](../interfaces#IERC4626-withdraw-uint256-address-address-) and [`IERC4626.redeem`](../interfaces#IERC4626-redeem-uint256-address-address-). Overall it is not recommended to override the public facing
-functions since that could lead to inconsistent behaviors between the [`IERC4626.deposit`](../interfaces#IERC4626-deposit-uint256-address-) and [`IERC4626.mint`](../interfaces#IERC4626-mint-uint256-address-) or between [`IERC4626.withdraw`](../interfaces#IERC4626-withdraw-uint256-address-address-) and
-[`IERC4626.redeem`](../interfaces#IERC4626-redeem-uint256-address-address-), which is documented to have lead to loss of funds.
+functions. Overriding [`ERC4626._deposit`](#ERC4626-_deposit-address-address-uint256-uint256-) automatically affects both [`ERC4626.deposit`](#ERC4626-deposit-uint256-address-) and [`ERC4626.mint`](#ERC4626-mint-uint256-address-). Similarly, overriding [`ERC4626._withdraw`](#ERC4626-_withdraw-address-address-address-uint256-uint256-)
+automatically affects both [`ERC4626.withdraw`](#ERC4626-withdraw-uint256-address-address-) and [`ERC4626.redeem`](#ERC4626-redeem-uint256-address-address-). Overall it is not recommended to override the public facing
+functions since that could lead to inconsistent behaviors between the [`ERC4626.deposit`](#ERC4626-deposit-uint256-address-) and [`ERC4626.mint`](#ERC4626-mint-uint256-address-) or between [`ERC4626.withdraw`](#ERC4626-withdraw-uint256-address-address-) and
+[`ERC4626.redeem`](#ERC4626-redeem-uint256-address-address-), which is documented to have led to loss of funds.
* Overrides to the deposit or withdraw mechanism must be reflected in the preview functions as well.
-* [`IERC4626.maxWithdraw`](../interfaces#IERC4626-maxWithdraw-address-) depends on [`IERC4626.maxRedeem`](../interfaces#IERC4626-maxRedeem-address-). Therefore, overriding [`IERC4626.maxRedeem`](../interfaces#IERC4626-maxRedeem-address-) only is enough. On the other hand,
-overriding [`IERC4626.maxWithdraw`](../interfaces#IERC4626-maxWithdraw-address-) only would have no effect on [`IERC4626.maxRedeem`](../interfaces#IERC4626-maxRedeem-address-), and could create an inconsistency between the two
+* [`ERC4626.maxWithdraw`](#ERC4626-maxWithdraw-address-) depends on [`ERC4626.maxRedeem`](#ERC4626-maxRedeem-address-). Therefore, overriding [`ERC4626.maxRedeem`](#ERC4626-maxRedeem-address-) only is enough. On the other hand,
+overriding [`ERC4626.maxWithdraw`](#ERC4626-maxWithdraw-address-) only would have no effect on [`ERC4626.maxRedeem`](#ERC4626-maxRedeem-address-), and could create an inconsistency between the two
functions.
-* If [`IERC4626.previewRedeem`](../interfaces#IERC4626-previewRedeem-uint256-) is overridden to revert, [`IERC4626.maxWithdraw`](../interfaces#IERC4626-maxWithdraw-address-) must be overridden as necessary to ensure it
+* If [`ERC4626.previewRedeem`](#ERC4626-previewRedeem-uint256-) is overridden to revert, [`ERC4626.maxWithdraw`](#ERC4626-maxWithdraw-address-) must be overridden as necessary to ensure it
always return successfully.
-
+
+Performs a transfer in of underlying assets. The default implementation uses `SafeERC20`. Used by [`ERC4626._deposit`](#ERC4626-_deposit-address-address-uint256-uint256-).
+
+
+
+Performs a transfer out of underlying assets. The default implementation uses `SafeERC20`. Used by [`ERC4626._withdraw`](#ERC4626-_withdraw-address-address-address-uint256-uint256-).
+
+
+
+
@@ -3146,7 +3435,7 @@ Attempted to mint more shares than the max amount for `receiver`.
-Attempted to withdraw more assets than the max amount for `receiver`.
+Attempted to withdraw more assets than the max amount for `owner`.
@@ -3163,7 +3452,7 @@ Attempted to withdraw more assets than the max amount for `receiver`.
-Attempted to redeem more shares than the max amount for `receiver`.
+Attempted to redeem more shares than the max amount for `owner`.
@@ -3172,9 +3461,9 @@ Attempted to redeem more shares than the max amount for `receiver`.
@@ -3266,9 +3563,9 @@ Returns the decimals places of the token.
-## `IERC20Permit`
+## `IERC20Permit`
-
+
@@ -3285,7 +3582,7 @@ Adds the [`ERC20Permit.permit`](#ERC20Permit-permit-address-address-uint256-uint
presenting a message signed by the account. By not relying on [`IERC20.approve`](#IERC20-approve-address-uint256-), the token holder account doesn't
need to send a transaction, and thus is not required to hold Ether at all.
-==== Security Considerations
+#### Security Considerations
There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
@@ -3342,7 +3639,7 @@ The same issues [`IERC20.approve`](#IERC20-approve-address-uint256-) has related
ordering also applies here.
-Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Emits an [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event.
Requirements:
@@ -3356,7 +3653,9 @@ For more information on the signature format, see the
[relevant EIP
section](https://eips.ethereum.org/EIPS/eip-2612#specification).
-CAUTION: See Security Considerations above.
+
+See Security Considerations above.
+
@@ -3394,7 +3693,7 @@ prevents a signature from being used multiple times.
-Returns the domain separator used in the encoding of the signature for [`ERC20Permit.permit`](#ERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-), as defined by [`EIP712`](../utils/cryptography#EIP712).
+Returns the domain separator used in the encoding of the signature for [`ERC20Permit.permit`](#ERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-), as defined by [`EIP712`](/contracts/5.x/api/utils/cryptography#EIP712).
@@ -3403,9 +3702,9 @@ Returns the domain separator used in the encoding of the signature for [`ERC20Pe
-## `ERC20Bridgeable`
+## `ERC20Bridgeable`
-
+
@@ -3432,10 +3731,9 @@ ERC20 extension that implements the standard token interface according to
- [crosschainMint(to, value)](#ERC20Bridgeable-crosschainMint-address-uint256-)
- [crosschainBurn(from, value)](#ERC20Bridgeable-crosschainBurn-address-uint256-)
- [_checkTokenBridge(caller)](#ERC20Bridgeable-_checkTokenBridge-address-)
-#### IERC7802 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-#### ERC20 [!toc]
+
+ERC20
+
- [name()](#ERC20-name--)
- [symbol()](#ERC20-symbol--)
- [decimals()](#ERC20-decimals--)
@@ -3452,45 +3750,45 @@ ERC20 extension that implements the standard token interface according to
- [_approve(owner, spender, value)](#ERC20-_approve-address-address-uint256-)
- [_approve(owner, spender, value, emitEvent)](#ERC20-_approve-address-address-uint256-bool-)
- [_spendAllowance(owner, spender, value)](#ERC20-_spendAllowance-address-address-uint256-)
-#### IERC20Errors [!toc]
-#### IERC20Metadata [!toc]
-#### IERC20 [!toc]
+
+
@@ -3546,7 +3844,7 @@ This function call must use less than 30 000 gas.
-See [`IERC7802.crosschainMint`](../interfaces#IERC7802-crosschainMint-address-uint256-). Emits a [`IERC7802.CrosschainMint`](../interfaces#IERC7802-CrosschainMint-address-uint256-address-) event.
+See [`IERC7802.crosschainMint`](/contracts/5.x/api/interfaces#IERC7802-crosschainMint-address-uint256-). Emits a [`IERC7802.CrosschainMint`](/contracts/5.x/api/interfaces#IERC7802-CrosschainMint-address-uint256-address-) event.
@@ -3563,7 +3861,7 @@ See [`IERC7802.crosschainMint`](../interfaces#IERC7802-crosschainMint-address-ui
-See [`IERC7802.crosschainBurn`](../interfaces#IERC7802-crosschainBurn-address-uint256-). Emits a [`IERC7802.CrosschainBurn`](../interfaces#IERC7802-CrosschainBurn-address-uint256-address-) event.
+See [`IERC7802.crosschainBurn`](/contracts/5.x/api/interfaces#IERC7802-crosschainBurn-address-uint256-). Emits a [`IERC7802.CrosschainBurn`](/contracts/5.x/api/interfaces#IERC7802-CrosschainBurn-address-uint256-address-) event.
@@ -3583,7 +3881,7 @@ See [`IERC7802.crosschainBurn`](../interfaces#IERC7802-crosschainBurn-address-ui
Checks if the caller is a trusted token bridge. MUST revert otherwise.
Developers should implement this function using an access control mechanism that allows
-customizing the list of allowed senders. Consider using [`AccessControl`](../access#AccessControl) or [`AccessManaged`](../access#AccessManaged).
+customizing the list of allowed senders. Consider using [`AccessControl`](/contracts/5.x/api/access#AccessControl) or [`AccessManaged`](/contracts/5.x/api/access#AccessManaged).
@@ -3592,9 +3890,9 @@ customizing the list of allowed senders. Consider using [`AccessControl`](../acc
-[`IERC6909.allowance`](../interfaces#IERC6909-allowance-address-address-uint256-) override that includes the temporary allowance when looking up the current allowance. If
+[`ERC20.allowance`](#ERC20-allowance-address-address-) override that includes the temporary allowance when looking up the current allowance. If
adding up the persistent and the temporary allowances result in an overflow, type(uint256).max is returned.
@@ -3719,7 +4017,7 @@ Internal getter for the current temporary allowance that `spender` has over `own
-Alternative to [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) that sets a `value` amount of tokens as the temporary allowance of `spender` over
+Alternative to [`ERC20.approve`](#ERC20-approve-address-uint256-) that sets a `value` amount of tokens as the temporary allowance of `spender` over
the caller's tokens.
Returns a boolean value indicating whether the operation succeeded.
@@ -3727,7 +4025,7 @@ Returns a boolean value indicating whether the operation succeeded.
Requirements:
- `spender` cannot be the zero address.
-Does NOT emit an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Does NOT emit an [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event.
@@ -3753,7 +4051,7 @@ Requirements:
- `owner` cannot be the zero address.
- `spender` cannot be the zero address.
-Does NOT emit an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Does NOT emit an [`IERC20.Approval`](#IERC20-Approval-address-address-uint256-) event.
@@ -3784,9 +4082,9 @@ is enough to cover the spending.
-Performs a call to [`IERC1363Receiver.onTransferReceived`](../interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) on a target address.
+Performs a call to [`IERC1363Receiver.onTransferReceived`](/contracts/5.x/api/interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) on a target address.
Requirements:
- The target has code (i.e. is a contract).
-- The target `to` must implement the [`IERC1363Receiver`](../interfaces#IERC1363Receiver) interface.
-- The target must return the [`IERC1363Receiver.onTransferReceived`](../interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) selector to accept the transfer.
+- The target `to` must implement the [`IERC1363Receiver`](/contracts/5.x/api/interfaces#IERC1363Receiver) interface.
+- The target must return the [`IERC1363Receiver.onTransferReceived`](/contracts/5.x/api/interfaces#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-) selector to accept the transfer.
@@ -3851,13 +4149,13 @@ Requirements:
-Performs a call to [`IERC1363Spender.onApprovalReceived`](../interfaces#IERC1363Spender-onApprovalReceived-address-uint256-bytes-) on a target address.
+Performs a call to [`IERC1363Spender.onApprovalReceived`](/contracts/5.x/api/interfaces#IERC1363Spender-onApprovalReceived-address-uint256-bytes-) on a target address.
Requirements:
- The target has code (i.e. is a contract).
-- The target `spender` must implement the [`IERC1363Spender`](../interfaces#IERC1363Spender) interface.
-- The target must return the [`IERC1363Spender.onApprovalReceived`](../interfaces#IERC1363Spender-onApprovalReceived-address-uint256-bytes-) selector to accept the approval.
+- The target `spender` must implement the [`IERC1363Spender`](/contracts/5.x/api/interfaces#IERC1363Spender) interface.
+- The target must return the [`IERC1363Spender.onApprovalReceived`](/contracts/5.x/api/interfaces#IERC1363Spender-onApprovalReceived-address-uint256-bytes-) selector to accept the approval.
@@ -3900,9 +4198,9 @@ Indicates a failure with the token `spender`. Used in approvals.
-Variant of [`ERC1155.safeTransferFrom`](/contracts/5.x/api/token/ERC1155#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-) that returns a bool instead of reverting if the operation is not successful.
+Variant of [`SafeERC20.safeTransferFrom`](#SafeERC20-safeTransferFrom-contract-IERC20-address-address-uint256-) that returns a bool instead of reverting if the operation is not successful.
@@ -4190,3 +4488,4 @@ Indicates a failed `decreaseAllowance` request.
+
diff --git a/content/contracts/5.x/api/token/ERC6909.mdx b/content/contracts/5.x/api/token/ERC6909.mdx
index 5430787f..cb2ebfa5 100644
--- a/content/contracts/5.x/api/token/ERC6909.mdx
+++ b/content/contracts/5.x/api/token/ERC6909.mdx
@@ -7,10 +7,10 @@ This set of interfaces and contracts are all related to the [ERC-6909 Minimal Mu
The ERC consists of four interfaces which fulfill different roles--the interfaces are as follows:
-1. [`IERC6909`](../interfaces#IERC6909): Base interface for a vanilla ERC6909 token.
-2. [`IERC6909ContentURI`](../interfaces#IERC6909ContentURI): Extends the base interface and adds content URI (contract and token level) functionality.
-3. [`IERC6909Metadata`](../interfaces#IERC6909Metadata): Extends the base interface and adds metadata functionality, which exposes a name, symbol, and decimals for each token id.
-4. [`IERC6909TokenSupply`](../interfaces#IERC6909TokenSupply): Extends the base interface and adds total supply functionality for each token id.
+1. [`IERC6909`](/contracts/5.x/api/interfaces#IERC6909): Base interface for a vanilla ERC6909 token.
+2. [`IERC6909ContentURI`](/contracts/5.x/api/interfaces#IERC6909ContentURI): Extends the base interface and adds content URI (contract and token level) functionality.
+3. [`IERC6909Metadata`](/contracts/5.x/api/interfaces#IERC6909Metadata): Extends the base interface and adds metadata functionality, which exposes a name, symbol, and decimals for each token id.
+4. [`IERC6909TokenSupply`](/contracts/5.x/api/interfaces#IERC6909TokenSupply): Extends the base interface and adds total supply functionality for each token id.
Implementations are provided for each of the 4 interfaces defined in the ERC.
@@ -30,9 +30,9 @@ Implementations are provided for each of the 4 interfaces defined in the ERC.
@@ -90,9 +89,6 @@ See https://eips.ethereum.org/EIPS/eip-6909
- [ERC6909InvalidReceiver(receiver)](#ERC6909-ERC6909InvalidReceiver-address-)
- [ERC6909InvalidSender(sender)](#ERC6909-ERC6909InvalidSender-address-)
- [ERC6909InvalidSpender(spender)](#ERC6909-ERC6909InvalidSpender-address-)
-#### IERC6909 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
@@ -265,10 +261,10 @@ Must return true.
Creates `amount` of token `id` and assigns them to `account`, by transferring it from address(0).
Relies on the `_update` mechanism.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event with `from` set to the zero address.
+Emits a [`IERC6909.Transfer`](/contracts/5.x/api/interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event with `from` set to the zero address.
-This function is not virtual, [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) should be overridden instead.
+This function is not virtual, [`ERC6909._update`](#ERC6909-_update-address-address-uint256-uint256-) should be overridden instead.
@@ -290,10 +286,10 @@ Moves `amount` of token `id` from `from` to `to` without checking for approvals.
that neither the sender nor the receiver are address(0), which means it cannot mint or burn tokens.
Relies on the `_update` mechanism.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC6909.Transfer`](/contracts/5.x/api/interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
-This function is not virtual, [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) should be overridden instead.
+This function is not virtual, [`ERC6909._update`](#ERC6909-_update-address-address-uint256-uint256-) should be overridden instead.
@@ -314,10 +310,10 @@ This function is not virtual, [`ERC1155._update`](/contracts/5.x/api/token/ERC11
Destroys a `amount` of token `id` from `account`.
Relies on the `_update` mechanism.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event with `to` set to the zero address.
+Emits a [`IERC6909.Transfer`](/contracts/5.x/api/interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event with `to` set to the zero address.
-This function is not virtual, [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) should be overridden instead
+This function is not virtual, [`ERC6909._update`](#ERC6909-_update-address-address-uint256-uint256-) should be overridden instead
@@ -339,7 +335,7 @@ Transfers `amount` of token `id` from `from` to `to`, or alternatively mints (or
(or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
this function.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC6909.Transfer`](/contracts/5.x/api/interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
@@ -361,7 +357,7 @@ Sets `amount` as the allowance of `spender` over the `owner`'s `id` tokens.
This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain
subsystems, etc.
-Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Emits an [`IERC6909.Approval`](/contracts/5.x/api/interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
Requirements:
@@ -388,7 +384,7 @@ Approve `spender` to operate on all of `owner`'s tokens
This internal function is equivalent to `setOperator`, and can be used to e.g. set automatic allowances for
certain subsystems, etc.
-Emits an [`IERC6909.OperatorSet`](../interfaces#IERC6909-OperatorSet-address-address-bool-) event.
+Emits an [`IERC6909.OperatorSet`](/contracts/5.x/api/interfaces#IERC6909-OperatorSet-address-address-bool-) event.
Requirements:
@@ -415,7 +411,7 @@ Updates `owner`'s allowance for `spender` based on spent `amount`.
Does not update the allowance value in case of infinite allowance.
Revert if not enough allowance is available.
-Does not emit an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Does not emit an [`IERC6909.Approval`](/contracts/5.x/api/interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
@@ -514,9 +510,9 @@ Does not emit an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-a
-## `ERC6909ContentURI`
+## `ERC6909ContentURI`
-
+
@@ -531,13 +527,14 @@ Implementation of the Content URI extension defined in ERC6909.
+
+Returns true if this contract implements the interface defined by
+`interfaceId`. See the corresponding
+[ERC section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
+to learn more about how these ids are created.
+
+This function call must use less than 30 000 gas.
+
@@ -637,7 +655,7 @@ Returns the URI for the token of type `id`.
-Sets the [`IERC6909ContentURI.contractURI`](../interfaces#IERC6909ContentURI-contractURI--) for the contract.
+Sets the [`ERC6909ContentURI.contractURI`](#ERC6909ContentURI-contractURI--) for the contract.
Emits a [`ERC6909ContentURI.ContractURIUpdated`](#ERC6909ContentURI-ContractURIUpdated--) event.
@@ -656,9 +674,9 @@ Emits a [`ERC6909ContentURI.ContractURIUpdated`](#ERC6909ContentURI-ContractURIU
-Sets the [`IERC6909ContentURI.tokenURI`](../interfaces#IERC6909ContentURI-tokenURI-uint256-) for a given token of type `id`.
+Sets the [`ERC6909ContentURI.tokenURI`](#ERC6909ContentURI-tokenURI-uint256-) for a given token of type `id`.
-Emits a [`IERC1155.URI`](/contracts/5.x/api/token/ERC1155#IERC1155-URI-string-uint256-) event.
+Emits a [`ERC6909ContentURI.URI`](#ERC6909ContentURI-URI-string-uint256-) event.
@@ -702,9 +720,9 @@ See [`IERC1155.URI`](/contracts/5.x/api/token/ERC1155#IERC1155-URI-string-uint25
-## `ERC6909Metadata`
+## `ERC6909Metadata`
-
+
@@ -722,12 +740,13 @@ Implementation of the Metadata extension defined in ERC6909. Exposes the name, s
- [name(id)](#ERC6909Metadata-name-uint256-)
- [symbol(id)](#ERC6909Metadata-symbol-uint256-)
- [decimals(id)](#ERC6909Metadata-decimals-uint256-)
+- [supportsInterface(interfaceId)](#ERC6909Metadata-supportsInterface-bytes4-)
- [_setName(id, newName)](#ERC6909Metadata-_setName-uint256-string-)
- [_setSymbol(id, newSymbol)](#ERC6909Metadata-_setSymbol-uint256-string-)
- [_setDecimals(id, newDecimals)](#ERC6909Metadata-_setDecimals-uint256-uint8-)
-#### IERC6909Metadata [!toc]
-#### ERC6909 [!toc]
-- [supportsInterface(interfaceId)](#ERC6909-supportsInterface-bytes4-)
+
+ERC6909
+
- [balanceOf(owner, id)](#ERC6909-balanceOf-address-uint256-)
- [allowance(owner, spender, id)](#ERC6909-allowance-address-address-uint256-)
- [isOperator(owner, spender)](#ERC6909-isOperator-address-address-)
@@ -742,9 +761,8 @@ Implementation of the Metadata extension defined in ERC6909. Exposes the name, s
- [_approve(owner, spender, id, amount)](#ERC6909-_approve-address-address-uint256-uint256-)
- [_setOperator(owner, spender, approved)](#ERC6909-_setOperator-address-address-bool-)
- [_spendAllowance(owner, spender, id, amount)](#ERC6909-_spendAllowance-address-address-uint256-uint256-)
-#### IERC6909 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -754,31 +772,31 @@ Implementation of the Metadata extension defined in ERC6909. Exposes the name, s
- [ERC6909NameUpdated(id, newName)](#ERC6909Metadata-ERC6909NameUpdated-uint256-string-)
- [ERC6909SymbolUpdated(id, newSymbol)](#ERC6909Metadata-ERC6909SymbolUpdated-uint256-string-)
- [ERC6909DecimalsUpdated(id, newDecimals)](#ERC6909Metadata-ERC6909DecimalsUpdated-uint256-uint8-)
-#### IERC6909Metadata [!toc]
-#### ERC6909 [!toc]
-#### IERC6909 [!toc]
+
+IERC6909
+
- [Approval(owner, spender, id, amount)](#IERC6909-Approval-address-address-uint256-uint256-)
- [OperatorSet(owner, spender, approved)](#IERC6909-OperatorSet-address-address-bool-)
- [Transfer(caller, sender, receiver, id, amount)](#IERC6909-Transfer-address-address-address-uint256-uint256-)
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
+
+Returns true if this contract implements the interface defined by
+`interfaceId`. See the corresponding
+[ERC section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
+to learn more about how these ids are created.
+
+This function call must use less than 30 000 gas.
+
+
+
+
@@ -946,9 +986,9 @@ The decimals value for token of type `id` was updated to `newDecimals`.
-## `ERC6909TokenSupply`
+## `ERC6909TokenSupply`
-
+
@@ -965,10 +1005,11 @@ Tracks the total supply of each token id individually.
+
+Returns true if this contract implements the interface defined by
+`interfaceId`. See the corresponding
+[ERC section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
+to learn more about how these ids are created.
+
+This function call must use less than 30 000 gas.
+
+
+
+
@@ -1052,3 +1114,4 @@ Override the `_update` function to update the total supply of each token id as n
+
diff --git a/content/contracts/5.x/api/token/ERC721.mdx b/content/contracts/5.x/api/token/ERC721.mdx
index 72f8829e..9d62fa92 100644
--- a/content/contracts/5.x/api/token/ERC721.mdx
+++ b/content/contracts/5.x/api/token/ERC721.mdx
@@ -24,12 +24,13 @@ OpenZeppelin Contracts provides implementations of all four interfaces:
Additionally there are a few of other extensions:
+* [`ERC721Burnable`](#ERC721Burnable): A way for token holders to burn their own tokens.
* [`ERC721Consecutive`](#ERC721Consecutive): An implementation of [ERC-2309](https://eips.ethereum.org/EIPS/eip-2309) for minting batches of tokens during construction, in accordance with ERC-721.
+* [`ERC721Crosschain`](#ERC721Crosschain): Embedded [`BridgeNonFungible`](/contracts/5.x/api/crosschain#BridgeNonFungible) bridge, making the token crosschain through the use of ERC-7786 gateways.
+* [`ERC721Pausable`](#ERC721Pausable): A primitive to pause contract operation.
+* [`ERC721Royalty`](#ERC721Royalty): A way to signal royalty information following ERC-2981.
* [`ERC721URIStorage`](#ERC721URIStorage): A more flexible but more expensive way of storing metadata.
* [`ERC721Votes`](#ERC721Votes): Support for voting and vote delegation.
-* [`ERC721Royalty`](#ERC721Royalty): A way to signal royalty information following ERC-2981.
-* [`ERC721Pausable`](#ERC721Pausable): A primitive to pause contract operation.
-* [`ERC721Burnable`](#ERC721Burnable): A way for token holders to burn their own tokens.
* [`ERC721Wrapper`](#ERC721Wrapper): Wrapper to create an ERC-721 backed by another ERC-721, with deposit and withdraw methods. Useful in conjunction with [`ERC721Votes`](#ERC721Votes).
@@ -52,18 +53,20 @@ This core set of contracts is designed to be unopinionated, allowing developers
## Extensions
-[`ERC721Pausable`](#ERC721Pausable)
-
[`ERC721Burnable`](#ERC721Burnable)
[`ERC721Consecutive`](#ERC721Consecutive)
-[`ERC721URIStorage`](#ERC721URIStorage)
+[`ERC721Crosschain`](#ERC721Crosschain)
-[`ERC721Votes`](#ERC721Votes)
+[`ERC721Pausable`](#ERC721Pausable)
[`ERC721Royalty`](#ERC721Royalty)
+[`ERC721URIStorage`](#ERC721URIStorage)
+
+[`ERC721Votes`](#ERC721Votes)
+
[`ERC721Wrapper`](#ERC721Wrapper)
## Utilities
@@ -76,9 +79,9 @@ This core set of contracts is designed to be unopinionated, allowing developers
-## `ERC721`
+## `ERC721`
-
+
@@ -127,32 +130,29 @@ the Metadata extension, but not including the Enumerable extension, which is ava
- [_approve(to, tokenId, auth, emitEvent)](#ERC721-_approve-address-uint256-address-bool-)
- [_setApprovalForAll(owner, operator, approved)](#ERC721-_setApprovalForAll-address-address-bool-)
- [_requireOwned(tokenId)](#ERC721-_requireOwned-uint256-)
-#### IERC721Errors [!toc]
-#### IERC721Metadata [!toc]
-#### IERC721 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-#### IERC721Errors [!toc]
+
+IERC721Errors
+
- [ERC721InvalidOwner(owner)](#IERC721Errors-ERC721InvalidOwner-address-)
- [ERC721NonexistentToken(tokenId)](#IERC721Errors-ERC721NonexistentToken-uint256-)
- [ERC721IncorrectOwner(sender, tokenId, owner)](#IERC721Errors-ERC721IncorrectOwner-address-uint256-address-)
@@ -161,10 +161,8 @@ the Metadata extension, but not including the Enumerable extension, which is ava
- [ERC721InsufficientApproval(operator, tokenId)](#IERC721Errors-ERC721InsufficientApproval-address-uint256-)
- [ERC721InvalidApprover(approver)](#IERC721Errors-ERC721InvalidApprover-address-)
- [ERC721InvalidOperator(operator)](#IERC721Errors-ERC721InvalidOperator-address-)
-#### IERC721Metadata [!toc]
-#### IERC721 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -308,7 +306,7 @@ Returns the Uniform Resource Identifier (URI) for `tokenId` token.
-Base URI for computing [`IERC6909ContentURI.tokenURI`](../interfaces#IERC6909ContentURI-tokenURI-uint256-). If set, the resulting URI for each
+Base URI for computing [`ERC721.tokenURI`](#ERC721-tokenURI-uint256-). If set, the resulting URI for each
token will be the concatenation of the `baseURI` and the `tokenId`. Empty
by default, can be overridden in child contracts.
@@ -337,7 +335,7 @@ Requirements:
- The caller must own the token or be an approved operator.
- `tokenId` must exist.
-Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Emits an [`IERC721.Approval`](#IERC721-Approval-address-address-uint256-) event.
@@ -376,13 +374,13 @@ Requirements:
Approve or remove `operator` as an operator for the caller.
-Operators can call [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-) or [`ERC1155.safeTransferFrom`](/contracts/5.x/api/token/ERC1155#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-) for any token owned by the caller.
+Operators can call [`ERC721.transferFrom`](#ERC721-transferFrom-address-address-uint256-) or [`ERC721.safeTransferFrom`](#ERC721-safeTransferFrom-address-address-uint256-bytes-) for any token owned by the caller.
Requirements:
- The `operator` cannot be the address zero.
-Emits an [`IERC1155.ApprovalForAll`](/contracts/5.x/api/token/ERC1155#IERC1155-ApprovalForAll-address-address-bool-) event.
+Emits an [`IERC721.ApprovalForAll`](#IERC721-ApprovalForAll-address-address-bool-) event.
@@ -401,7 +399,7 @@ Emits an [`IERC1155.ApprovalForAll`](/contracts/5.x/api/token/ERC1155#IERC1155-A
Returns if the `operator` is allowed to manage all of the assets of `owner`.
-See [`ERC1155.setApprovalForAll`](/contracts/5.x/api/token/ERC1155#ERC1155-setApprovalForAll-address-bool-)
+See [`ERC721.setApprovalForAll`](#ERC721-setApprovalForAll-address-bool-)
@@ -422,7 +420,7 @@ Transfers `tokenId` token from `from` to `to`.
Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
-or else they may be permanently lost. Usage of [`ERC1155.safeTransferFrom`](/contracts/5.x/api/token/ERC1155#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-) prevents loss, though the caller must
+or else they may be permanently lost. Usage of [`ERC721.safeTransferFrom`](#ERC721-safeTransferFrom-address-address-uint256-bytes-) prevents loss, though the caller must
understand this adds an external call which potentially creates a reentrancy vulnerability.
@@ -431,9 +429,9 @@ Requirements:
- `from` cannot be the zero address.
- `to` cannot be the zero address.
- `tokenId` token must be owned by `from`.
-- If the caller is not `from`, it must be approved to move this token by either [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) or [`ERC1155.setApprovalForAll`](/contracts/5.x/api/token/ERC1155#ERC1155-setApprovalForAll-address-bool-).
+- If the caller is not `from`, it must be approved to move this token by either [`ERC721.approve`](#ERC721-approve-address-uint256-) or [`ERC721.setApprovalForAll`](#ERC721-setApprovalForAll-address-bool-).
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -458,12 +456,12 @@ Requirements:
- `from` cannot be the zero address.
- `to` cannot be the zero address.
- `tokenId` token must exist and be owned by `from`.
-- If the caller is not `from`, it must have been allowed to move this token by either [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) or
- [`ERC1155.setApprovalForAll`](/contracts/5.x/api/token/ERC1155#ERC1155-setApprovalForAll-address-bool-).
+- If the caller is not `from`, it must have been allowed to move this token by either [`ERC721.approve`](#ERC721-approve-address-uint256-) or
+ [`ERC721.setApprovalForAll`](#ERC721-setApprovalForAll-address-bool-).
- If `to` refers to a smart contract, it must implement [`IERC721Receiver.onERC721Received`](#IERC721Receiver-onERC721Received-address-address-uint256-bytes-), which is called upon
a safe transfer.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -487,11 +485,11 @@ Requirements:
- `from` cannot be the zero address.
- `to` cannot be the zero address.
- `tokenId` token must exist and be owned by `from`.
-- If the caller is not `from`, it must be approved to move this token by either [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) or [`ERC1155.setApprovalForAll`](/contracts/5.x/api/token/ERC1155#ERC1155-setApprovalForAll-address-bool-).
+- If the caller is not `from`, it must be approved to move this token by either [`ERC721.approve`](#ERC721-approve-address-uint256-) or [`ERC721.setApprovalForAll`](#ERC721-setApprovalForAll-address-bool-).
- If `to` refers to a smart contract, it must implement [`IERC721Receiver.onERC721Received`](#IERC721Receiver-onERC721Received-address-address-uint256-bytes-), which is called upon
a safe transfer.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -631,7 +629,7 @@ Transfers `tokenId` from its current owner to `to`, or alternatively mints (or b
The `auth` argument is optional. If the value passed is non 0, then this function will check that
`auth` is either the owner of the token, or approved to operate on the token (by the owner).
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
If overriding this function in a way that tracks balances, see also [`ERC721._increaseBalance`](#ERC721-_increaseBalance-address-uint128-).
@@ -663,7 +661,7 @@ Requirements:
- `tokenId` must not exist.
- `to` cannot be the zero address.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -687,7 +685,7 @@ Requirements:
- `tokenId` must not exist.
- If `to` refers to a smart contract, it must implement [`IERC721Receiver.onERC721Received`](#IERC721Receiver-onERC721Received-address-address-uint256-bytes-), which is called upon a safe transfer.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -730,7 +728,7 @@ Requirements:
- `tokenId` must exist.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -748,14 +746,14 @@ Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-ad
Transfers `tokenId` from `from` to `to`.
- As opposed to [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-), this imposes no restrictions on msg.sender.
+ As opposed to [`ERC721.transferFrom`](#ERC721-transferFrom-address-address-uint256-), this imposes no restrictions on msg.sender.
Requirements:
- `to` cannot be the zero address.
- `tokenId` token must be owned by `from`.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -777,7 +775,7 @@ are aware of the ERC-721 standard to prevent tokens from being forever locked.
`data` is additional data, it has no specified format and it is sent in call to `to`.
-This internal function is like [`ERC1155.safeTransferFrom`](/contracts/5.x/api/token/ERC1155#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-) in the sense that it invokes
+This internal function is like [`ERC721.safeTransferFrom`](#ERC721-safeTransferFrom-address-address-uint256-bytes-) in the sense that it invokes
[`IERC721Receiver.onERC721Received`](#IERC721Receiver-onERC721Received-address-address-uint256-bytes-) on the receiver, and can be used to e.g.
implement alternative mechanisms to perform token transfer, such as signature-based.
@@ -788,7 +786,7 @@ Requirements:
- `from` cannot be the zero address.
- If `to` refers to a smart contract, it must implement [`IERC721Receiver.onERC721Received`](#IERC721Receiver-onERC721Received-address-address-uint256-bytes-), which is called upon a safe transfer.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -828,7 +826,7 @@ Approve `to` to operate on `tokenId`
The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
either the owner of the token, or approved to operate on all tokens held by this owner.
-Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Emits an [`IERC721.Approval`](#IERC721-Approval-address-address-uint256-) event.
Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
@@ -847,7 +845,7 @@ Overrides to this logic should be done to the variant with an additional `bool e
-Variant of `_approve` with an optional flag to enable or disable the [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event. The event is not
+Variant of `_approve` with an optional flag to enable or disable the [`IERC721.Approval`](#IERC721-Approval-address-address-uint256-) event. The event is not
emitted in the context of transfers.
@@ -870,7 +868,7 @@ Approve `operator` to operate on all of `owner` tokens
Requirements:
- operator can't be the address zero.
-Emits an [`IERC1155.ApprovalForAll`](/contracts/5.x/api/token/ERC1155#IERC1155-ApprovalForAll-address-address-bool-) event.
+Emits an [`IERC721.ApprovalForAll`](#IERC721-ApprovalForAll-address-address-bool-) event.
@@ -899,9 +897,9 @@ Overrides to ownership logic should be done to [`ERC721._ownerOf`](#ERC721-_owne
@@ -936,7 +938,6 @@ Required interface of an ERC-721 compliant contract.
- [Transfer(from, to, tokenId)](#IERC721-Transfer-address-address-uint256-)
- [Approval(owner, approved, tokenId)](#IERC721-Approval-address-address-uint256-)
- [ApprovalForAll(owner, operator, approved)](#IERC721-ApprovalForAll-address-address-bool-)
-#### IERC165 [!toc]
@@ -997,11 +998,11 @@ Requirements:
- `from` cannot be the zero address.
- `to` cannot be the zero address.
- `tokenId` token must exist and be owned by `from`.
-- If the caller is not `from`, it must be approved to move this token by either [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) or [`ERC1155.setApprovalForAll`](/contracts/5.x/api/token/ERC1155#ERC1155-setApprovalForAll-address-bool-).
+- If the caller is not `from`, it must be approved to move this token by either [`ERC721.approve`](#ERC721-approve-address-uint256-) or [`ERC721.setApprovalForAll`](#ERC721-setApprovalForAll-address-bool-).
- If `to` refers to a smart contract, it must implement [`IERC721Receiver.onERC721Received`](#IERC721Receiver-onERC721Received-address-address-uint256-bytes-), which is called upon
a safe transfer.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -1026,12 +1027,12 @@ Requirements:
- `from` cannot be the zero address.
- `to` cannot be the zero address.
- `tokenId` token must exist and be owned by `from`.
-- If the caller is not `from`, it must have been allowed to move this token by either [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) or
- [`ERC1155.setApprovalForAll`](/contracts/5.x/api/token/ERC1155#ERC1155-setApprovalForAll-address-bool-).
+- If the caller is not `from`, it must have been allowed to move this token by either [`ERC721.approve`](#ERC721-approve-address-uint256-) or
+ [`ERC721.setApprovalForAll`](#ERC721-setApprovalForAll-address-bool-).
- If `to` refers to a smart contract, it must implement [`IERC721Receiver.onERC721Received`](#IERC721Receiver-onERC721Received-address-address-uint256-bytes-), which is called upon
a safe transfer.
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -1052,7 +1053,7 @@ Transfers `tokenId` token from `from` to `to`.
Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
-or else they may be permanently lost. Usage of [`ERC1155.safeTransferFrom`](/contracts/5.x/api/token/ERC1155#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-) prevents loss, though the caller must
+or else they may be permanently lost. Usage of [`ERC721.safeTransferFrom`](#ERC721-safeTransferFrom-address-address-uint256-bytes-) prevents loss, though the caller must
understand this adds an external call which potentially creates a reentrancy vulnerability.
@@ -1061,9 +1062,9 @@ Requirements:
- `from` cannot be the zero address.
- `to` cannot be the zero address.
- `tokenId` token must be owned by `from`.
-- If the caller is not `from`, it must be approved to move this token by either [`IERC6909.approve`](../interfaces#IERC6909-approve-address-uint256-uint256-) or [`ERC1155.setApprovalForAll`](/contracts/5.x/api/token/ERC1155#ERC1155-setApprovalForAll-address-bool-).
+- If the caller is not `from`, it must be approved to move this token by either [`ERC721.approve`](#ERC721-approve-address-uint256-) or [`ERC721.setApprovalForAll`](#ERC721-setApprovalForAll-address-bool-).
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
@@ -1090,7 +1091,7 @@ Requirements:
- The caller must own the token or be an approved operator.
- `tokenId` must exist.
-Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-uint256-uint256-) event.
+Emits an [`IERC721.Approval`](#IERC721-Approval-address-address-uint256-) event.
@@ -1108,13 +1109,13 @@ Emits an [`IERC6909.Approval`](../interfaces#IERC6909-Approval-address-address-u
Approve or remove `operator` as an operator for the caller.
-Operators can call [`IERC6909.transferFrom`](../interfaces#IERC6909-transferFrom-address-address-uint256-uint256-) or [`ERC1155.safeTransferFrom`](/contracts/5.x/api/token/ERC1155#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-) for any token owned by the caller.
+Operators can call [`ERC721.transferFrom`](#ERC721-transferFrom-address-address-uint256-) or [`ERC721.safeTransferFrom`](#ERC721-safeTransferFrom-address-address-uint256-bytes-) for any token owned by the caller.
Requirements:
- The `operator` cannot be the address zero.
-Emits an [`IERC1155.ApprovalForAll`](/contracts/5.x/api/token/ERC1155#IERC1155-ApprovalForAll-address-address-bool-) event.
+Emits an [`IERC721.ApprovalForAll`](#IERC721-ApprovalForAll-address-address-bool-) event.
@@ -1154,7 +1155,7 @@ Requirements:
Returns if the `operator` is allowed to manage all of the assets of `owner`.
-See [`ERC1155.setApprovalForAll`](/contracts/5.x/api/token/ERC1155#ERC1155-setApprovalForAll-address-bool-)
+See [`ERC721.setApprovalForAll`](#ERC721-setApprovalForAll-address-bool-)
@@ -1215,9 +1216,9 @@ Emitted when `owner` enables or disables (`approved`) `operator` to manage all o
-## `IERC721Receiver`
+## `IERC721Receiver`
-
+
@@ -1265,9 +1266,9 @@ The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.
-## `ERC721Burnable`
+## `ERC721Burnable`
-
+
@@ -1283,7 +1284,9 @@ ERC-721 Token that can be burned (destroyed).
-## `ERC721Consecutive`
+## `ERC721Consecutive`
-
+
@@ -1406,7 +1404,7 @@ Using this extension removes the ability to mint single tokens during contract c
regained after construction. During construction, only batch minting is allowed.
-This extension does not call the [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) function for tokens minted in batch. Any logic added to this
+This extension does not call the [`ERC721._update`](#ERC721-_update-address-uint256-address-) function for tokens minted in batch. Any logic added to this
function through overrides will not be triggered when tokens are minted in batch. You may want to also override
[`ERC721._increaseBalance`](#ERC721-_increaseBalance-address-uint128-) or [`ERC721Consecutive._mintConsecutive`](#ERC721Consecutive-_mintConsecutive-address-uint96-) to account for these mints.
@@ -1425,7 +1423,9 @@ super call before your custom logic.
- [_mintConsecutive(to, batchSize)](#ERC721Consecutive-_mintConsecutive-address-uint96-)
- [_update(to, tokenId, auth)](#ERC721Consecutive-_update-address-uint256-address-)
- [_firstConsecutiveId()](#ERC721Consecutive-_firstConsecutiveId--)
-#### ERC721 [!toc]
+
+ERC721
+
- [supportsInterface(interfaceId)](#ERC721-supportsInterface-bytes4-)
- [balanceOf(owner)](#ERC721-balanceOf-address-)
- [ownerOf(tokenId)](#ERC721-ownerOf-uint256-)
@@ -1455,29 +1455,28 @@ super call before your custom logic.
- [_approve(to, tokenId, auth, emitEvent)](#ERC721-_approve-address-uint256-address-bool-)
- [_setApprovalForAll(owner, operator, approved)](#ERC721-_setApprovalForAll-address-address-bool-)
- [_requireOwned(tokenId)](#ERC721-_requireOwned-uint256-)
-#### IERC721Errors [!toc]
-#### IERC721Metadata [!toc]
-#### IERC721 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-#### IERC2309 [!toc]
+
+
@@ -1488,8 +1487,9 @@ super call before your custom logic.
- [ERC721ExceededMaxBatchMint(batchSize, maxBatch)](#ERC721Consecutive-ERC721ExceededMaxBatchMint-uint256-uint256-)
- [ERC721ForbiddenMint()](#ERC721Consecutive-ERC721ForbiddenMint--)
- [ERC721ForbiddenBatchBurn()](#ERC721Consecutive-ERC721ForbiddenBatchBurn--)
-#### ERC721 [!toc]
-#### IERC721Errors [!toc]
+
+IERC721Errors
+
- [ERC721InvalidOwner(owner)](#IERC721Errors-ERC721InvalidOwner-address-)
- [ERC721NonexistentToken(tokenId)](#IERC721Errors-ERC721NonexistentToken-uint256-)
- [ERC721IncorrectOwner(sender, tokenId, owner)](#IERC721Errors-ERC721IncorrectOwner-address-uint256-address-)
@@ -1498,11 +1498,8 @@ super call before your custom logic.
- [ERC721InsufficientApproval(operator, tokenId)](#IERC721Errors-ERC721InsufficientApproval-address-uint256-)
- [ERC721InvalidApprover(approver)](#IERC721Errors-ERC721InvalidApprover-address-)
- [ERC721InvalidOperator(operator)](#IERC721Errors-ERC721InvalidOperator-address-)
-#### IERC721Metadata [!toc]
-#### IERC721 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
-#### IERC2309 [!toc]
+
+
@@ -1568,12 +1565,16 @@ Requirements:
- `batchSize` must not be greater than [`ERC721Consecutive._maxBatchSize`](#ERC721Consecutive-_maxBatchSize--).
- The function is called in the constructor of the contract (directly or indirectly).
-CAUTION: Does not emit a `Transfer` event. This is ERC-721 compliant as long as it is done inside of the
+
+Does not emit a `Transfer` event. This is ERC-721 compliant as long as it is done inside of the
constructor, which is enforced by this function.
+
-CAUTION: Does not invoke `onERC721Received` on the receiver.
+
+Does not invoke `onERC721Received` on the receiver.
+
-Emits a [`IERC2309.ConsecutiveTransfer`](../interfaces#IERC2309-ConsecutiveTransfer-uint256-uint256-address-address-) event.
+Emits a [`IERC2309.ConsecutiveTransfer`](/contracts/5.x/api/interfaces#IERC2309-ConsecutiveTransfer-uint256-uint256-address-address-) event.
@@ -1594,7 +1595,7 @@ See [`ERC721._update`](#ERC721-_update-address-uint256-address-). Override versi
Using [`ERC721Consecutive`](#ERC721Consecutive) prevents minting during construction in favor of [`ERC721Consecutive._mintConsecutive`](#ERC721Consecutive-_mintConsecutive-address-uint96-).
-After construction, [`ERC721Consecutive._mintConsecutive`](#ERC721Consecutive-_mintConsecutive-address-uint96-) is no longer available and minting through [`ERC1155._update`](/contracts/5.x/api/token/ERC1155#ERC1155-_update-address-address-uint256---uint256---) becomes available.
+After construction, [`ERC721Consecutive._mintConsecutive`](#ERC721Consecutive-_mintConsecutive-address-uint96-) is no longer available and minting through [`ERC721._update`](#ERC721-_update-address-uint256-address-) becomes available.
@@ -1687,13 +1688,211 @@ Batch burn is not supported.
+
+
+
+
+```solidity
+import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Crosschain.sol";
+```
+
+Extension of [`ERC721`](#ERC721) that makes it natively cross-chain using the ERC-7786 based [`BridgeNonFungible`](/contracts/5.x/api/crosschain#BridgeNonFungible).
+
+This extension makes the token compatible with:
+* [`ERC721Crosschain`](#ERC721Crosschain) instances on other chains,
+* [`ERC721`](#ERC721) instances on other chains that are bridged using [`BridgeERC721`](/contracts/5.x/api/crosschain#BridgeERC721),
+
+
+
+Crosschain variant of [`ERC721.transferFrom`](#ERC721-transferFrom-address-address-uint256-), using the allowance system from the underlying ERC-721 token.
+
+
+
+"Unlocking" tokens is achieved through minting
+
+
+
+
-## `ERC721Enumerable`
+## `ERC721Enumerable`
-
+
@@ -1706,8 +1905,10 @@ import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
This implements an optional extension of [`ERC721`](#ERC721) defined in the ERC that adds enumerability
of all the token ids in the contract as well as all token ids owned by each account.
-CAUTION: [`ERC721`](#ERC721) extensions that implement custom `balanceOf` logic, such as [`ERC721Consecutive`](#ERC721Consecutive),
+
+[`ERC721`](#ERC721) extensions that implement custom `balanceOf` logic, such as [`ERC721Consecutive`](#ERC721Consecutive),
interfere with enumerability and should not be used together with [`ERC721Enumerable`](#ERC721Enumerable).
+
Functions
@@ -1718,8 +1919,9 @@ interfere with enumerability and should not be used together with [`ERC721Enumer
- [tokenByIndex(index)](#ERC721Enumerable-tokenByIndex-uint256-)
- [_update(to, tokenId, auth)](#ERC721Enumerable-_update-address-uint256-address-)
- [_increaseBalance(account, amount)](#ERC721Enumerable-_increaseBalance-address-uint128-)
-#### IERC721Enumerable [!toc]
-#### ERC721 [!toc]
+
+ERC721
+
- [balanceOf(owner)](#ERC721-balanceOf-address-)
- [ownerOf(tokenId)](#ERC721-ownerOf-uint256-)
- [name()](#ERC721-name--)
@@ -1748,27 +1950,22 @@ interfere with enumerability and should not be used together with [`ERC721Enumer
- [_approve(to, tokenId, auth, emitEvent)](#ERC721-_approve-address-uint256-address-bool-)
- [_setApprovalForAll(owner, operator, approved)](#ERC721-_setApprovalForAll-address-address-bool-)
- [_requireOwned(tokenId)](#ERC721-_requireOwned-uint256-)
-#### IERC721Errors [!toc]
-#### IERC721Metadata [!toc]
-#### IERC721 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -1777,9 +1974,9 @@ interfere with enumerability and should not be used together with [`ERC721Enumer
- [ERC721OutOfBoundsIndex(owner, index)](#ERC721Enumerable-ERC721OutOfBoundsIndex-address-uint256-)
- [ERC721EnumerableForbiddenBatchMint()](#ERC721Enumerable-ERC721EnumerableForbiddenBatchMint--)
-#### IERC721Enumerable [!toc]
-#### ERC721 [!toc]
-#### IERC721Errors [!toc]
+
+IERC721Errors
+
- [ERC721InvalidOwner(owner)](#IERC721Errors-ERC721InvalidOwner-address-)
- [ERC721NonexistentToken(tokenId)](#IERC721Errors-ERC721NonexistentToken-uint256-)
- [ERC721IncorrectOwner(sender, tokenId, owner)](#IERC721Errors-ERC721IncorrectOwner-address-uint256-address-)
@@ -1788,10 +1985,8 @@ interfere with enumerability and should not be used together with [`ERC721Enumer
- [ERC721InsufficientApproval(operator, tokenId)](#IERC721Errors-ERC721InsufficientApproval-address-uint256-)
- [ERC721InvalidApprover(approver)](#IERC721Errors-ERC721InvalidApprover-address-)
- [ERC721InvalidOperator(operator)](#IERC721Errors-ERC721InvalidOperator-address-)
-#### IERC721Metadata [!toc]
-#### IERC721 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -1830,7 +2025,7 @@ This function call must use less than 30 000 gas.
Returns a token ID owned by `owner` at a given `index` of its token list.
-Use along with [`IERC6909.balanceOf`](../interfaces#IERC6909-balanceOf-address-uint256-) to enumerate all of ``owner``'s tokens.
+Use along with [`ERC721.balanceOf`](#ERC721-balanceOf-address-) to enumerate all of ``owner``'s tokens.
@@ -1865,7 +2060,7 @@ Returns the total amount of tokens stored by the contract.
Returns a token ID at a given `index` of all the tokens stored by the contract.
-Use along with [`IERC6909TokenSupply.totalSupply`](../interfaces#IERC6909TokenSupply-totalSupply-uint256-) to enumerate all tokens.
+Use along with [`ERC721Enumerable.totalSupply`](#ERC721Enumerable-totalSupply--) to enumerate all tokens.
@@ -1888,7 +2083,7 @@ Transfers `tokenId` from its current owner to `to`, or alternatively mints (or b
The `auth` argument is optional. If the value passed is non 0, then this function will check that
`auth` is either the owner of the token, or approved to operate on the token (by the owner).
-Emits a [`IERC6909.Transfer`](../interfaces#IERC6909-Transfer-address-address-address-uint256-uint256-) event.
+Emits a [`IERC721.Transfer`](#IERC721-Transfer-address-address-uint256-) event.
If overriding this function in a way that tracks balances, see also [`ERC721._increaseBalance`](#ERC721-_increaseBalance-address-uint128-).
@@ -1954,9 +2149,9 @@ Batch mint is not allowed.
-## `ERC721Pausable`
+## `ERC721Pausable`
-
+
@@ -1975,8 +2170,8 @@ event of a large bug.
This contract does not include public pause and unpause functions. In
addition to inheriting this contract, you must define both functions, invoking the
-[`Pausable._pause`](../utils#Pausable-_pause--) and [`Pausable._unpause`](../utils#Pausable-_unpause--) internal functions, with appropriate
-access control, e.g. using [`AccessControl`](../access#AccessControl) or [`Ownable`](../access#Ownable). Not doing so will
+[`Pausable._pause`](/contracts/5.x/api/utils#Pausable-_pause--) and [`Pausable._unpause`](/contracts/5.x/api/utils#Pausable-_unpause--) internal functions, with appropriate
+access control, e.g. using [`AccessControl`](/contracts/5.x/api/access#AccessControl) or [`Ownable`](/contracts/5.x/api/access#Ownable). Not doing so will
make the contract pause mechanism of the contract unreachable, and thus unusable.
@@ -1984,13 +2179,19 @@ make the contract pause mechanism of the contract unreachable, and thus unusable
@@ -2381,7 +2586,24 @@ This function call must use less than 30 000 gas.
Sets `_tokenURI` as the tokenURI of `tokenId`.
-Emits [`IERC4906.MetadataUpdate`](../interfaces#IERC4906-MetadataUpdate-uint256-).
+Emits [`IERC4906.MetadataUpdate`](/contracts/5.x/api/interfaces#IERC4906-MetadataUpdate-uint256-).
+
+
+
+
+
+
+
-## `ERC721Votes`
+## `ERC721Votes`
-
+
@@ -2402,7 +2624,7 @@ Emits [`IERC4906.MetadataUpdate`](../interfaces#IERC4906-MetadataUpdate-uint256-
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Votes.sol";
```
-Extension of ERC-721 to support voting and delegation as implemented by [`Votes`](../governance#Votes), where each individual NFT counts
+Extension of ERC-721 to support voting and delegation as implemented by [`Votes`](/contracts/5.x/api/governance#Votes), where each individual NFT counts
as 1 vote unit.
Tokens do not count as votes until they are delegated, because votes must be tracked which incurs an additional cost
@@ -2415,7 +2637,9 @@ the votes in governance decisions, or they can delegate to themselves to be thei
- [_update(to, tokenId, auth)](#ERC721Votes-_update-address-uint256-address-)
- [_getVotingUnits(account)](#ERC721Votes-_getVotingUnits-address-)
- [_increaseBalance(account, amount)](#ERC721Votes-_increaseBalance-address-uint128-)
-#### Votes [!toc]
+
+Votes
+
- [clock()](#Votes-clock--)
- [CLOCK_MODE()](#Votes-CLOCK_MODE--)
- [_validateTimepoint(timepoint)](#Votes-_validateTimepoint-uint256-)
@@ -2431,21 +2655,29 @@ the votes in governance decisions, or they can delegate to themselves to be thei
- [_moveDelegateVotes(from, to, amount)](#Votes-_moveDelegateVotes-address-address-uint256-)
- [_numCheckpoints(account)](#Votes-_numCheckpoints-address-)
- [_checkpoints(account, pos)](#Votes-_checkpoints-address-uint32-)
-#### IERC5805 [!toc]
-#### IVotes [!toc]
-#### IERC6372 [!toc]
-#### Nonces [!toc]
+
+
+
+Nonces
+
- [nonces(owner)](#Nonces-nonces-address-)
- [_useNonce(owner)](#Nonces-_useNonce-address-)
- [_useCheckedNonce(owner, nonce)](#Nonces-_useCheckedNonce-address-uint256-)
-#### EIP712 [!toc]
+
+
+
+EIP712
+
- [_domainSeparatorV4()](#EIP712-_domainSeparatorV4--)
- [_hashTypedDataV4(structHash)](#EIP712-_hashTypedDataV4-bytes32-)
- [eip712Domain()](#EIP712-eip712Domain--)
- [_EIP712Name()](#EIP712-_EIP712Name--)
- [_EIP712Version()](#EIP712-_EIP712Version--)
-#### IERC5267 [!toc]
-#### ERC721 [!toc]
+
+
+
+ERC721
+
- [supportsInterface(interfaceId)](#ERC721-supportsInterface-bytes4-)
- [balanceOf(owner)](#ERC721-balanceOf-address-)
- [ownerOf(tokenId)](#ERC721-ownerOf-uint256-)
@@ -2475,55 +2707,63 @@ the votes in governance decisions, or they can delegate to themselves to be thei
- [_approve(to, tokenId, auth, emitEvent)](#ERC721-_approve-address-uint256-address-bool-)
- [_setApprovalForAll(owner, operator, approved)](#ERC721-_setApprovalForAll-address-address-bool-)
- [_requireOwned(tokenId)](#ERC721-_requireOwned-uint256-)
-#### IERC721Errors [!toc]
-#### IERC721Metadata [!toc]
-#### IERC721 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -2553,7 +2791,7 @@ the votes in governance decisions, or they can delegate to themselves to be thei
See [`ERC721._update`](#ERC721-_update-address-uint256-address-). Adjusts votes when tokens are transferred.
-Emits a [`IVotes.DelegateVotesChanged`](../governance#IVotes-DelegateVotesChanged-address-uint256-uint256-) event.
+Emits a [`IVotes.DelegateVotesChanged`](/contracts/5.x/api/governance#IVotes-DelegateVotesChanged-address-uint256-uint256-) event.
@@ -2600,9 +2838,9 @@ See [`ERC721._increaseBalance`](#ERC721-_increaseBalance-address-uint128-). We n
-## `ERC721Wrapper`
+## `ERC721Wrapper`
-
+
@@ -2627,8 +2865,9 @@ the wrapping of an existing "basic" ERC-721 into a governance token.
- [onERC721Received(, from, tokenId, )](#ERC721Wrapper-onERC721Received-address-address-uint256-bytes-)
- [_recover(account, tokenId)](#ERC721Wrapper-_recover-address-uint256-)
- [underlying()](#ERC721Wrapper-underlying--)
-#### IERC721Receiver [!toc]
-#### ERC721 [!toc]
+
+ERC721
+
- [supportsInterface(interfaceId)](#ERC721-supportsInterface-bytes4-)
- [balanceOf(owner)](#ERC721-balanceOf-address-)
- [ownerOf(tokenId)](#ERC721-ownerOf-uint256-)
@@ -2660,27 +2899,22 @@ the wrapping of an existing "basic" ERC-721 into a governance token.
- [_approve(to, tokenId, auth, emitEvent)](#ERC721-_approve-address-uint256-address-bool-)
- [_setApprovalForAll(owner, operator, approved)](#ERC721-_setApprovalForAll-address-address-bool-)
- [_requireOwned(tokenId)](#ERC721-_requireOwned-uint256-)
-#### IERC721Errors [!toc]
-#### IERC721Metadata [!toc]
-#### IERC721 [!toc]
-#### ERC165 [!toc]
-#### IERC165 [!toc]
+
+
@@ -2771,7 +3003,7 @@ Overrides [`IERC721Receiver.onERC721Received`](#IERC721Receiver-onERC721Received
this contract.
In case there's data attached, it validates that the operator is this contract, so only trusted data
-is accepted from [`ERC20Wrapper.depositFor`](/contracts/5.x/api/token/ERC20#ERC20Wrapper-depositFor-address-uint256-).
+is accepted from [`ERC721Wrapper.depositFor`](#ERC721Wrapper-depositFor-address-uint256---).
Doesn't work with unsafe transfers (eg. [`IERC721.transferFrom`](#IERC721-transferFrom-address-address-uint256-)). Use [`ERC721Wrapper._recover`](#ERC721Wrapper-_recover-address-uint256-)
@@ -2837,9 +3069,9 @@ The received ERC-721 token couldn't be wrapped.
@@ -2913,7 +3156,7 @@ Returns the total amount of tokens stored by the contract.
Returns a token ID owned by `owner` at a given `index` of its token list.
-Use along with [`IERC6909.balanceOf`](../interfaces#IERC6909-balanceOf-address-uint256-) to enumerate all of ``owner``'s tokens.
+Use along with [`ERC721.balanceOf`](#ERC721-balanceOf-address-) to enumerate all of ``owner``'s tokens.
@@ -2931,7 +3174,7 @@ Use along with [`IERC6909.balanceOf`](../interfaces#IERC6909-balanceOf-address-u
Returns a token ID at a given `index` of all the tokens stored by the contract.
-Use along with [`IERC6909TokenSupply.totalSupply`](../interfaces#IERC6909TokenSupply-totalSupply-uint256-) to enumerate all tokens.
+Use along with [`ERC721Enumerable.totalSupply`](#ERC721Enumerable-totalSupply--) to enumerate all tokens.
@@ -2940,9 +3183,9 @@ Use along with [`IERC6909TokenSupply.totalSupply`](../interfaces#IERC6909TokenSu
+
diff --git a/content/contracts/5.x/api/token/common.mdx b/content/contracts/5.x/api/token/common.mdx
index a1f70f22..1f1b5644 100644
--- a/content/contracts/5.x/api/token/common.mdx
+++ b/content/contracts/5.x/api/token/common.mdx
@@ -16,9 +16,9 @@ Functionality that is common to multiple token standards.
-## `ERC2981`
+## `ERC2981`
-
+
@@ -52,9 +52,6 @@ voluntarily pay royalties together with sales, but note that this standard is no
- [_deleteDefaultRoyalty()](#ERC2981-_deleteDefaultRoyalty--)
- [_setTokenRoyalty(tokenId, receiver, feeNumerator)](#ERC2981-_setTokenRoyalty-uint256-address-uint96-)
- [_resetTokenRoyalty(tokenId)](#ERC2981-_resetTokenRoyalty-uint256-)
-#### ERC165 [!toc]
-#### IERC2981 [!toc]
-#### IERC165 [!toc]
@@ -65,9 +62,6 @@ voluntarily pay royalties together with sales, but note that this standard is no
- [ERC2981InvalidDefaultRoyaltyReceiver(receiver)](#ERC2981-ERC2981InvalidDefaultRoyaltyReceiver-address-)
- [ERC2981InvalidTokenRoyalty(tokenId, numerator, denominator)](#ERC2981-ERC2981InvalidTokenRoyalty-uint256-uint256-uint256-)
- [ERC2981InvalidTokenRoyaltyReceiver(tokenId, receiver)](#ERC2981-ERC2981InvalidTokenRoyaltyReceiver-uint256-address-)
-#### ERC165 [!toc]
-#### IERC2981 [!toc]
-#### IERC165 [!toc]
@@ -280,3 +274,4 @@ The royalty receiver for `tokenId` is invalid.
+
diff --git a/content/contracts/5.x/api/utils.mdx b/content/contracts/5.x/api/utils.mdx
index 38b05b49..de595447 100644
--- a/content/contracts/5.x/api/utils.mdx
+++ b/content/contracts/5.x/api/utils.mdx
@@ -42,6 +42,7 @@ Miscellaneous contracts and libraries containing utility functions you can use t
* [`RelayedCall`](#RelayedCall): A library for performing calls that use minimal and predictable relayers to hide the sender.
* [`RLP`](#RLP): Library for encoding and decoding data in Ethereumโs Recursive Length Prefix format.
* [`ShortStrings`](#ShortStrings): Library to encode (and decode) short strings into (or from) a single bytes32 slot for optimizing costs. Short strings are limited to 31 characters.
+* [`SimulateCall`](#SimulateCall): Library for simulating contract calls, enabling safe inspection of call results without affecting on-chain state.
* [`SlotDerivation`](#SlotDerivation): Methods for deriving storage slot from ERC-7201 namespaces as well as from constructions such as mapping and arrays.
* [`StorageSlot`](#StorageSlot): Methods for accessing specific storage slots formatted as common primitive types.
* [`Strings`](#Strings): Common operations for strings formatting.
@@ -76,7 +77,7 @@ Because Solidity does not support generic types, [`EnumerableMap`](#EnumerableMa
This set of interfaces and contracts deal with [type introspection](https://en.wikipedia.org/wiki/Type_introspection) of contracts, that is, examining which functions can be called on them. This is usually referred to as a contractโs _interface_.
-Ethereum contracts have no native concept of an interface, so applications must usually simply trust they are not making an incorrect call. For trusted setups this is a non-issue, but often unknown and untrusted third-party addresses need to be interacted with. There may even not be any direct calls to them! (e.g. ERC-20 tokens may be sent to a contract that lacks a way to transfer them out of it, locking them forever). In these cases, a contract _declaring_ its interface can be very helpful in preventing errors.
+Ethereum contracts have no native concept of an interface, so applications must usually simply trust that they are not making an incorrect call. For trusted setups this is a non-issue, but often unknown and untrusted third-party addresses need to be interacted with. There may not even be any direct calls to them! (e.g. ERC-20 tokens may be sent to a contract that lacks a way to transfer them out of it, locking them forever). In these cases, a contract _declaring_ its interface can be very helpful in preventing errors.
[`IERC165`](#IERC165)
@@ -148,6 +149,8 @@ Ethereum contracts have no native concept of an interface, so applications must
[`ShortStrings`](#ShortStrings)
+[`SimulateCall`](#SimulateCall)
+
[`SlotDerivation`](#SlotDerivation)
[`StorageSlot`](#StorageSlot)
@@ -162,9 +165,9 @@ Ethereum contracts have no native concept of an interface, so applications must
-## `Address`
+## `Address`
-
+
@@ -247,7 +250,7 @@ function instead.
If `target` reverts with a revert reason or custom error, it is bubbled
up by this function (like regular Solidity function calls). However, if
the call reverted with no returned reason, this function reverts with a
-[`Errors.FailedCall`](#Errors-FailedCall--) error.
+`Errors.FailedCall` error.
Returns the raw returned data. To convert to the expected return value,
use [`abi.decode`](https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions).
@@ -332,7 +335,7 @@ but performing a delegate call.
Tool to verify that a low level call to smart-contract was successful, and reverts if the target
-was not a contract or bubbling up the revert reason (falling back to [`Errors.FailedCall`](#Errors-FailedCall--)) in case
+was not a contract or bubbling up the revert reason (falling back to `Errors.FailedCall`) in case
of an unsuccessful call.
@@ -355,7 +358,7 @@ This function is DEPRECATED and may be removed in the next major release.
Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
-revert reason or with a default [`Errors.FailedCall`](#Errors-FailedCall--) error.
+revert reason or with a default `Errors.FailedCall` error.
@@ -381,9 +384,9 @@ There's no code at `target` (it is not a contract).
-Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array.
+Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array,
+and shrinks the array length accordingly, effectively overwriting the array with array[start:].
This function modifies the provided array in place. If you need to preserve the original array, use [`Arrays.slice`](#Arrays-slice-uint256---uint256-uint256-) instead.
-
-replicates the behavior of [Javascript's `Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
-
@@ -860,14 +867,63 @@ replicates the behavior of [Javascript's `Array.splice`](https://developer.mozil
-Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array. The
+Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array,
+and shrinks the array length accordingly, effectively overwriting the array with array[start:end]. The
`end` argument is truncated to the length of the `array`.
This function modifies the provided array in place. If you need to preserve the original array, use [`Arrays.slice`](#Arrays-slice-uint256---uint256-uint256-) instead.
+
+
+
+Replaces elements in `array` starting at `pos` with all elements from `replacement`.
+
+Parameters are clamped to valid ranges (e.g. `pos` is clamped to `[0, array.length]`).
+If `pos >= array.length`, no replacement occurs and the array is returned unchanged.
+
+
+This function modifies the provided array in place.
+
+
+
+
+Replaces elements in `array` starting at `pos` with elements from `replacement` starting at `offset`.
+Copies at most `length` elements from `replacement` to `array`.
+
+Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, array.length]`, `offset` is
+clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,
+array.length - pos)`). If `pos >= array.length` or `offset >= replacement.length`, no replacement occurs
+and the array is returned unchanged.
+
-replicates the behavior of [Javascript's `Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
+This function modifies the provided array in place.
@@ -885,14 +941,12 @@ replicates the behavior of [Javascript's `Array.splice`](https://developer.mozil
-Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array.
+Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array,
+and shrinks the array length accordingly, effectively overwriting the array with array[start:].
This function modifies the provided array in place. If you need to preserve the original array, use [`Arrays.slice`](#Arrays-slice-uint256---uint256-uint256-) instead.
-
-replicates the behavior of [Javascript's `Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
-
@@ -909,14 +963,63 @@ replicates the behavior of [Javascript's `Array.splice`](https://developer.mozil
-Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array. The
+Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array,
+and shrinks the array length accordingly, effectively overwriting the array with array[start:end]. The
`end` argument is truncated to the length of the `array`.
This function modifies the provided array in place. If you need to preserve the original array, use [`Arrays.slice`](#Arrays-slice-uint256---uint256-uint256-) instead.
+
+
+
+Replaces elements in `array` starting at `pos` with all elements from `replacement`.
+
+Parameters are clamped to valid ranges (e.g. `pos` is clamped to `[0, array.length]`).
+If `pos >= array.length`, no replacement occurs and the array is returned unchanged.
+
+
+This function modifies the provided array in place.
+
+
+
+
+Replaces elements in `array` starting at `pos` with elements from `replacement` starting at `offset`.
+Copies at most `length` elements from `replacement` to `array`.
+
+Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, array.length]`, `offset` is
+clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,
+array.length - pos)`). If `pos >= array.length` or `offset >= replacement.length`, no replacement occurs
+and the array is returned unchanged.
+
-replicates the behavior of [Javascript's `Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
+This function modifies the provided array in place.
@@ -934,14 +1037,12 @@ replicates the behavior of [Javascript's `Array.splice`](https://developer.mozil
-Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array.
+Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array,
+and shrinks the array length accordingly, effectively overwriting the array with array[start:].
This function modifies the provided array in place. If you need to preserve the original array, use [`Arrays.slice`](#Arrays-slice-uint256---uint256-uint256-) instead.
-
-replicates the behavior of [Javascript's `Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
-
@@ -958,14 +1059,63 @@ replicates the behavior of [Javascript's `Array.splice`](https://developer.mozil
-Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array. The
+Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array,
+and shrinks the array length accordingly, effectively overwriting the array with array[start:end]. The
`end` argument is truncated to the length of the `array`.
This function modifies the provided array in place. If you need to preserve the original array, use [`Arrays.slice`](#Arrays-slice-uint256---uint256-uint256-) instead.
+
+
+
+Replaces elements in `array` starting at `pos` with all elements from `replacement`.
+
+Parameters are clamped to valid ranges (e.g. `pos` is clamped to `[0, array.length]`).
+If `pos >= array.length`, no replacement occurs and the array is returned unchanged.
+
+
+This function modifies the provided array in place.
+
+
+
+
+Replaces elements in `array` starting at `pos` with elements from `replacement` starting at `offset`.
+Copies at most `length` elements from `replacement` to `array`.
+
+Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, array.length]`, `offset` is
+clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,
+array.length - pos)`). If `pos >= array.length` or `offset >= replacement.length`, no replacement occurs
+and the array is returned unchanged.
+
-replicates the behavior of [Javascript's `Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
+This function modifies the provided array in place.
@@ -1196,7 +1346,7 @@ Only use if you are certain `pos` is lower than the array length.
Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
-this does not clear elements if length is reduced, of initialize elements if length is increased.
+this does not clear elements if length is reduced, or initialize elements if length is increased.
@@ -1217,7 +1367,7 @@ this does not clear elements if length is reduced, of initialize elements if len
Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
-this does not clear elements if length is reduced, of initialize elements if length is increased.
+this does not clear elements if length is reduced, or initialize elements if length is increased.
@@ -1238,7 +1388,7 @@ this does not clear elements if length is reduced, of initialize elements if len
Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
-this does not clear elements if length is reduced, of initialize elements if length is increased.
+this does not clear elements if length is reduced, or initialize elements if length is increased.
@@ -1259,7 +1409,7 @@ this does not clear elements if length is reduced, of initialize elements if len
Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
-this does not clear elements if length is reduced, of initialize elements if length is increased.
+this does not clear elements if length is reduced, or initialize elements if length is increased.
@@ -1280,7 +1430,7 @@ this does not clear elements if length is reduced, of initialize elements if len
Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
-this does not clear elements if length is reduced, of initialize elements if length is increased.
+this does not clear elements if length is reduced, or initialize elements if length is increased.
@@ -1290,9 +1440,9 @@ this does not clear elements if length is reduced, of initialize elements if len
-## `Base58`
+## `Base58`
-
+
@@ -1386,9 +1536,9 @@ Unrecognized Base58 character on decoding.
-## `Base64`
+## `Base64`
-
+
@@ -1467,7 +1617,7 @@ Converts a Base64 `string` to the `bytes` it represents.
* Supports padded and unpadded inputs.
* Supports both encoding ([`Base58.encode`](#Base58-encode-bytes-) and [`Base64.encodeURL`](#Base64-encodeURL-bytes-)) seamlessly.
-* Does NOT revert if the input is not a valid Base64 string.
+* Reverts with [`Base64.InvalidBase64Char`](#Base64-InvalidBase64Char-bytes1-) if the input contains an invalid character.
@@ -1491,9 +1641,9 @@ Converts a Base64 `string` to the `bytes` it represents.
-## `Blockhash`
+## `Blockhash`
-
+
@@ -1549,9 +1699,9 @@ by returning zero, consistent with the EVM's native `BLOCKHASH` behavior.
-Moves the content of `buffer`, from `start` (included) to the end of `buffer` to the start of that buffer.
+Moves the content of `buffer`, from `start` (included) to the end of `buffer` to the start of that buffer,
+and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:].
This function modifies the provided buffer in place. If you need to preserve the original buffer, use [`Arrays.slice`](#Arrays-slice-uint256---uint256-uint256-) instead
-
-replicates the behavior of [Javascript's `Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
-
@@ -1757,14 +1908,63 @@ replicates the behavior of [Javascript's `Array.splice`](https://developer.mozil
-Moves the content of `buffer`, from `start` (included) to end (excluded) to the start of that buffer. The
-`end` argument is truncated to the length of the `buffer`.
+Moves the content of `buffer`, from `start` (included) to `end` (excluded) to the start of that buffer,
+and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:end].
+The `end` argument is truncated to the length of the `buffer`.
This function modifies the provided buffer in place. If you need to preserve the original buffer, use [`Arrays.slice`](#Arrays-slice-uint256---uint256-uint256-) instead
+
+
+
+Replaces bytes in `buffer` starting at `pos` with all bytes from `replacement`.
+
+Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`).
+If `pos >= buffer.length`, no replacement occurs and the buffer is returned unchanged.
+
+
+This function modifies the provided buffer in place.
+
+
+
+
+Replaces bytes in `buffer` starting at `pos` with bytes from `replacement` starting at `offset`.
+Copies at most `length` bytes from `replacement` to `buffer`.
+
+Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`, `offset` is
+clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,
+buffer.length - pos))`. If `pos >= buffer.length` or `offset >= replacement.length`, no replacement occurs
+and the buffer is returned unchanged.
+
-replicates the behavior of [Javascript's `Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
+This function modifies the provided buffer in place.
@@ -1795,6 +1995,25 @@ significantly less readable. It might be worth benchmarking the savings of the f
-## `Context`
+## `Context`
-
+
@@ -2311,9 +2530,9 @@ This contract is only required for intermediate, library-like contracts.
-## `Create2`
+## `Create2`
-
+
@@ -2432,9 +2651,9 @@ There's no code to deploy.
-## `Errors`
+## `Errors`
-
+
@@ -2535,9 +2754,9 @@ A necessary precompile is missing.
-## `LowLevelCall`
+## `LowLevelCall`
-
+
@@ -2601,7 +2820,7 @@ Performs a Solidity function call using a low level `call` and ignoring the retu
-Same as [`LowLevelCall.callNoReturn`](#LowLevelCall-callNoReturn-address-uint256-bytes-), but allows to specify the value to be sent in the call.
+Same as `callNoReturn-address-bytes`, but allows specifying the value to be sent in the call.
@@ -2619,7 +2838,7 @@ Same as [`LowLevelCall.callNoReturn`](#LowLevelCall-callNoReturn-address-uint256
Performs a Solidity function call using a low level `call` and returns the first 64 bytes of the result
-in the scratch space of memory. Useful for functions that return a tuple of single-word values.
+in the scratch space of memory. Useful for functions that return a tuple with two single-word values.
Do not assume that the results are zero if `success` is false. Memory can be already allocated
@@ -2641,7 +2860,7 @@ and this function doesn't zero it out.
-Same as `callReturnBytes32Pair`, but allows to specify the value to be sent in the call.
+Same as `callReturn64Bytes-address-bytes`, but allows specifying the value to be sent in the call.
@@ -2676,7 +2895,7 @@ Performs a Solidity function call using a low level `staticcall` and ignoring th
Performs a Solidity function call using a low level `staticcall` and returns the first 64 bytes of the result
-in the scratch space of memory. Useful for functions that return a tuple of single-word values.
+in the scratch space of memory. Useful for functions that return a tuple with two single-word values.
Do not assume that the results are zero if `success` is false. Memory can be already allocated
@@ -2716,7 +2935,7 @@ Performs a Solidity function call using a low level `delegatecall` and ignoring
Performs a Solidity function call using a low level `delegatecall` and returns the first 64 bytes of the result
-in the scratch space of memory. Useful for functions that return a tuple of single-word values.
+in the scratch space of memory. Useful for functions that return a tuple with two single-word values.
Do not assume that the results are zero if `success` is false. Memory can be already allocated
@@ -2796,9 +3015,9 @@ Revert with the return data from the last call.
Sets the free `Pointer` to a specific value.
+The solidity memory layout requires that the FMP is never set to a value lower than 0x80. Setting the
+FMP to a value lower than 0x80 may cause unexpected behavior. Deallocating all memory can be achieved by
+setting the FMP to 0x80.
+
Everything after the pointer may be overwritten.
@@ -2876,40 +3099,6 @@ Everything after the pointer may be overwritten.
-
-`bytes32` to `Pointer`. Expects a pointer to a properly ABI-encoded `bytes` object.
-
-
-
-
@@ -2990,7 +3179,7 @@ Returns the length of a given slice (equiv to self.length for calldata slices)
-Offset a memory slice (equivalent to self[start:] for calldata slices)
+Offset a memory slice (equivalent to self[offset:] for calldata slices)
@@ -3007,7 +3196,7 @@ Offset a memory slice (equivalent to self[start:] for calldata slices)
-Offset and cut a Slice (equivalent to self[start:start+length] for calldata slices)
+Offset and cut a Slice (equivalent to self[offset:offset+len] for calldata slices)
@@ -3050,13 +3239,47 @@ Extract the data corresponding to a Slice (allocate new memory)
+
+
+
+
+
equal(Memory.Slice a, Memory.Slice b) โ bool result
-## `Panic`
+## `Panic`
-
+
@@ -6857,9 +7088,9 @@ the internal constants with predefined codes.
-## `Pausable`
+## `Pausable`
-
+
@@ -7122,9 +7353,9 @@ The operation failed because the contract is not paused.
-## `RLP`
+## `RLP`
-
+
@@ -7143,6 +7374,33 @@ Inspired by
* https://github.com/succinctlabs/optimism-bedrock-contracts/blob/main/rlp/RLPWriter.sol
* https://github.com/succinctlabs/optimism-bedrock-contracts/blob/main/rlp/RLPReader.sol
+## Canonical vs Non-Canonical Encodings
+
+According to the Ethereum Yellow Paper, a "canonical" RLP encoding is the unique, minimal
+representation of a value. For scalar values (integers), this means:
+
+* No leading zero bytes (e.g., `0x0123` should be encoded as 2 bytes, not `0x000123` as 3 bytes)
+* Single bytes less than 0x80 must be encoded directly without a prefix wrapper
+* Zero is represented as an empty byte array (prefix `0x80`)
+
+A "non-canonical" encoding represents the same value but doesn't follow these minimality rules.
+For example, encoding the integer 1234 (0x04d2) with a leading zero as `0x830004d2` instead
+of the canonical `0x8204d2`.
+
+[IMPORTANT]
+#### This implementation takes a permissive approach to decoding, accepting some non-canonical
+encodings (e.g., scalar values with leading zero bytes) that would be rejected by
+strict implementations like go-ethereum. This design choice prioritizes compatibility
+with diverse RLP encoders in the ecosystem over strict adherence to the Yellow Paper
+specification's canonicalization requirements.
+
+Users should be aware that:
+
+* Multiple different RLP encodings may decode to the same value (non-injective)
+* Encoding followed by decoding is guaranteed to work correctly
+* External RLP data from untrusted sources may have non-canonical encodings
+* Improperly wrapped single bytes (< 0x80) are still rejected as invalid
+
Functions
@@ -7372,7 +7630,10 @@ This follows the de facto ecosystem standard where booleans are treated as 0/1 i
-Encode an address as RLP.
+Encode an address as an RLP item of fixed size (20 bytes).
+
+The address is encoded with its leading zeros (if it has any). If someone wants to encode the address as a scalar,
+they can cast it to an uint256 and then call the corresponding [`Base58.encode`](#Base58-encode-bytes-) function.
@@ -7389,7 +7650,9 @@ Encode an address as RLP.
-Encode a uint256 as RLP.
+Encode an uint256 as an RLP scalar.
+
+Unlike `encode-bytes32-`, this function uses scalar encoding that removes the prefix zeros.
-Encode a bytes32 as RLP. Type alias for #RLP-encode-uint256-.
+Encode a bytes32 as an RLP item of fixed size (32 bytes).
+
+Unlike `encode-uint256-`, this function uses array encoding that preserves the prefix zeros.
@@ -7440,7 +7705,7 @@ Encode a bytes buffer as RLP.
-Encode a string as RLP. Type alias for #Base58-encode-bytes-.
+Encode a string as RLP. Type alias for `encode-bytes-`.
@@ -7458,6 +7723,8 @@ Encode a string as RLP. Type alias for #Base58-encode-bytes-.
Encode an array of bytes as RLP.
+This function expects an array of already encoded bytes, not raw bytes.
+Users should call [`Base58.encode`](#Base58-encode-bytes-) on each element of the array before calling it.
@@ -7466,7 +7733,7 @@ Encode an array of bytes as RLP.
-
encode(struct RLP.Encoder self) โ bytes result
+
encode(struct RLP.Encoder self) โ bytes
internal
#
@@ -7491,7 +7758,13 @@ Encode an encoder (list of bytes) as RLP
-Decode an RLP encoded bool. See #RLP-encode-bool-
+Decode an RLP encoded bool. See `encode-bool`
+
+
+This function treats any non-zero value as `true`, which is more permissive
+than some implementations (e.g., go-ethereum only accepts `0x00` for false and `0x01`
+for true). For example, `0x02`, `0x03`, etc. will all decode as `true`.
+
@@ -7508,7 +7781,16 @@ Decode an RLP encoded bool. See #RLP-encode-bool-
-Decode an RLP encoded address. See #RLP-encode-address-
+Decode an RLP encoded address. See `encode-address`
+
+[NOTE]
+#### This function accepts both single-byte encodings (for values 0-127, including
+precompile addresses like 0x01) and the standard 21-byte encoding with the `0x94` prefix.
+For example, `0x01` decodes to `0x0000000000000000000000000000000000000001`.
+
+Additionally, like [`RLP.readUint256`](#RLP-readUint256-Memory-Slice-), this function accepts non-canonical encodings with
+leading zeros. For instance, both `0x01` and `0x940000000000000000000000000000000000000001`
+decode to the same address.
@@ -7525,7 +7807,20 @@ Decode an RLP encoded address. See #RLP-encode-address-
-Decode an RLP encoded uint256. See #RLP-encode-uint256-
+Decode an RLP encoded uint256. See `encode-uint256`
+
+[NOTE]
+#### This function accepts non-canonical encodings with leading zero bytes for multi-byte values,
+which differs from the Ethereum Yellow Paper specification and some reference
+implementations like go-ethereum. For example, both `0x88ab54a98ceb1f0ad2` and
+`0x8900ab54a98ceb1f0ad2` will decode to the same uint256 value (12345678901234567890).
+
+However, single bytes less than 0x80 must NOT be wrapped with a prefix. For example,
+`0x8100` is invalid (should be `0x00`), but `0x820000` is valid (two zero bytes).
+
+This permissive behavior is intentional for compatibility with various RLP encoders
+in the ecosystem, but users should be aware that multiple RLP encodings may map
+to the same decoded value (non-injective decoding).
@@ -7542,7 +7837,14 @@ Decode an RLP encoded uint256. See #RLP-encode-uint256-
-Decode an RLP encoded bytes32. See #RLP-encode-bytes32-
+Decode an RLP encoded bytes32. See `encode-bytes32`
+
+
+Since this function delegates to [`RLP.readUint256`](#RLP-readUint256-Memory-Slice-), it inherits the non-canonical
+encoding acceptance behavior for multi-byte values. Multiple RLP encodings with different
+leading zero bytes may decode to the same bytes32 value, but single bytes < 0x80 must
+not be wrapped with a prefix (e.g., `0x820000` is valid, but `0x8100` is not).
+
@@ -7559,7 +7861,7 @@ Decode an RLP encoded bytes32. See #RLP-encode-bytes32-
-Decodes an RLP encoded bytes. See #Base58-encode-bytes-
+Decodes an RLP encoded bytes. See `encode-bytes`
@@ -7576,7 +7878,7 @@ Decodes an RLP encoded bytes. See #Base58-encode-bytes-
-Decodes an RLP encoded string. See #RLP-encode-string-
+Decodes an RLP encoded string. See `encode-string`
@@ -7593,7 +7895,12 @@ Decodes an RLP encoded string. See #RLP-encode-string-
-Decodes an RLP encoded list into an array of RLP Items.
+Decodes an RLP encoded list in a memory slice into an array of RLP Items.
+
+
+The returned array contains slice references into the original payload, not copied bytes. Any further
+modification of the input buffer may cause the output result to become invalid.
+
@@ -7714,6 +8021,11 @@ Decode an RLP encoded string from bytes. See [`RLP.readString`](#RLP-readString-
Decode an RLP encoded list from bytes. See [`RLP.readList`](#RLP-readList-Memory-Slice-)
+
+The returned array contains slice references into the original payload, not copied bytes. Any further
+modification of the input buffer may cause the output result to become invalid.
+
+
@@ -7729,7 +8041,7 @@ Decode an RLP encoded list from bytes. See [`RLP.readList`](#RLP-readList-Memory
-The item is not properly formatted and cannot de decoded.
+The item is not properly formatted and cannot be decoded.
@@ -7738,9 +8050,9 @@ The item is not properly formatted and cannot de decoded.
-## `ReentrancyGuard`
+## `ReentrancyGuard`
-
+
@@ -7841,9 +8153,11 @@ by making the `nonReentrant` function external, and making it call a
A `view` only version of [`ReentrancyGuard.nonReentrant`](#ReentrancyGuard-nonReentrant--). Use to block view functions
from being called, preventing reading from inconsistent contract state.
-CAUTION: This is a "view" modifier and does not change the reentrancy
+
+This is a "view" modifier and does not change the reentrancy
status. Use it only on view functions. For payable or non-payable functions,
use the standard [`ReentrancyGuard.nonReentrant`](#ReentrancyGuard-nonReentrant--) modifier instead.
+
-## `ReentrancyGuardTransient`
+## `ReentrancyGuardTransient`
-
+
@@ -8000,9 +8314,11 @@ by making the `nonReentrant` function external, and making it call a
A `view` only version of [`ReentrancyGuard.nonReentrant`](#ReentrancyGuard-nonReentrant--). Use to block view functions
from being called, preventing reading from inconsistent contract state.
-CAUTION: This is a "view" modifier and does not change the reentrancy
+
+This is a "view" modifier and does not change the reentrancy
status. Use it only on view functions. For payable or non-payable functions,
use the standard [`ReentrancyGuard.nonReentrant`](#ReentrancyGuard-nonReentrant--) modifier instead.
+
-## `RelayedCall`
+## `RelayedCall`
-
+
@@ -8085,6 +8401,12 @@ the target only sees the unprivileged relay address as `msg.sender`.
For example, instead of `target.call(data)` where the target sees this contract as `msg.sender`, use
[`RelayedCall.relayCall`](#RelayedCall-relayCall-address-uint256-bytes-bytes32-) where the target sees a relay address as `msg.sender`.
+
+This library uses the PUSH0 opcode that was introduced in the Shanghai hardfork. While this instruction is
+now widely supported, developers using the library on exotic chains should verify that their target chain has
+supports for EIP-3855.
+
+
Functions
@@ -8101,7 +8423,7 @@ For example, instead of `target.call(data)` where the target sees this contract
#
@@ -8126,7 +8448,7 @@ Relays a call to the target contract through a dynamically deployed relay contra
-Same as [`RelayedCall.relayCall`](#RelayedCall-relayCall-address-uint256-bytes-bytes32-) but with a value.
+Same as `relayCall-address-bytes` but with a value.
@@ -8135,7 +8457,7 @@ Same as [`RelayedCall.relayCall`](#RelayedCall-relayCall-address-uint256-bytes-b
#
@@ -8143,7 +8465,7 @@ Same as [`RelayedCall.relayCall`](#RelayedCall-relayCall-address-uint256-bytes-b
-Same as [`RelayedCall.relayCall`](#RelayedCall-relayCall-address-uint256-bytes-bytes32-) but with a salt.
+Same as `relayCall-address-bytes` but with a salt.
@@ -8152,7 +8474,7 @@ Same as [`RelayedCall.relayCall`](#RelayedCall-relayCall-address-uint256-bytes-b
#
@@ -8160,7 +8482,7 @@ Same as [`RelayedCall.relayCall`](#RelayedCall-relayCall-address-uint256-bytes-b
-Same as [`RelayedCall.relayCall`](#RelayedCall-relayCall-address-uint256-bytes-bytes32-) but with a salt and a value.
+Same as `relayCall-address-bytes` but with a salt and a value.
@@ -8203,9 +8525,9 @@ Returns the relayer address for a given salt.
```solidity
-import "@openzeppelin/contracts/utils/SlotDerivation.sol";
+import "@openzeppelin/contracts/utils/SimulateCall.sol";
```
-Library for computing storage (and transient storage) locations from namespaces and deriving slots
-corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by
-the solidity language / compiler.
-
-See [Solidity docs for mappings and dynamic arrays.](https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays).
+Library for simulating external calls and inspecting the result of the call while reverting any state changes
+of events the call may have produced.
-Example usage:
-```solidity
-contract Example {
- // Add the library methods
- using StorageSlot for bytes32;
- using SlotDerivation for *;
+This pattern is useful when you need to simulate the result of a call without actually executing it on-chain. Since
+the address of the sender is preserved, this supports simulating calls that perform token swap that use the caller's
+balance, or any operation that is restricted to the caller.
- // Declare a namespace
+
+
+Returns the simulator address.
+
+The simulator REVERTs on success and RETURNs on failure, preserving the return data in both cases.
+
+* A failed target call returns the return data and succeeds in our context (no state changes).
+* A successful target call causes a revert in our context (undoing all state changes) while still
+capturing the return data.
+
+
+
+```solidity
+import "@openzeppelin/contracts/utils/SlotDerivation.sol";
+```
+
+Library for computing storage (and transient storage) locations from namespaces and deriving slots
+corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by
+the solidity language / compiler.
+
+See [Solidity docs for mappings and dynamic arrays.](https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays).
+
+Example usage:
+```solidity
+contract Example {
+ // Add the library methods
+ using StorageSlot for bytes32;
+ using SlotDerivation for *;
+
+ // Declare a namespace
string private constant _NAMESPACE = ""; // eg. OpenZeppelin.Slot
function setValueInNamespace(uint256 key, address newValue) internal {
@@ -8661,9 +9072,9 @@ Derive the location of a mapping element from the key.
-## `StorageSlot`
+## `StorageSlot`
-
+
@@ -8873,9 +9284,9 @@ Returns an `BytesSlot` representation of the bytes storage pointer `store`.
-Variant of #Strings-parseUint-string- that parses a substring of `input` located between position `begin` (included) and
+Variant of `parseUint-string` that parses a substring of `input` located between position `begin` (included) and
`end` (excluded).
Requirements:
@@ -9120,7 +9531,7 @@ Requirements:
-Variant of #Strings-parseUint-string- that returns false if the parsing fails because of an invalid character.
+Variant of `parseUint-string` that returns false if the parsing fails because of an invalid character.
This function will revert if the result does not fit in a `uint256`.
@@ -9141,7 +9552,7 @@ This function will revert if the result does not fit in a `uint256`.
-Variant of #Strings-parseUint-string-uint256-uint256- that returns false if the parsing fails because of an invalid
+Variant of `parseUint-string-uint256-uint256` that returns false if the parsing fails because of an invalid
character.
@@ -9184,7 +9595,7 @@ Requirements:
-Variant of #Strings-parseInt-string- that parses a substring of `input` located between position `begin` (included) and
+Variant of `parseInt-string` that parses a substring of `input` located between position `begin` (included) and
`end` (excluded).
Requirements:
@@ -9206,7 +9617,7 @@ Requirements:
-Variant of #Strings-parseInt-string- that returns false if the parsing fails because of an invalid character or if
+Variant of `parseInt-string` that returns false if the parsing fails because of an invalid character or if
the result does not fit in a `int256`.
@@ -9228,7 +9639,7 @@ This function will revert if the absolute value of the result does not fit in a
-Variant of #Strings-parseInt-string-uint256-uint256- that returns false if the parsing fails because of an invalid
+Variant of `parseInt-string-uint256-uint256` that returns false if the parsing fails because of an invalid
character or if the result does not fit in a `int256`.
@@ -9271,7 +9682,7 @@ Requirements:
-Variant of #Strings-parseHexUint-string- that parses a substring of `input` located between position `begin` (included) and
+Variant of `parseHexUint-string` that parses a substring of `input` located between position `begin` (included) and
`end` (excluded).
Requirements:
@@ -9293,7 +9704,7 @@ Requirements:
-Variant of #Strings-parseHexUint-string- that returns false if the parsing fails because of an invalid character.
+Variant of `parseHexUint-string` that returns false if the parsing fails because of an invalid character.
This function will revert if the result does not fit in a `uint256`.
@@ -9314,7 +9725,7 @@ This function will revert if the result does not fit in a `uint256`.
-Variant of #Strings-parseHexUint-string-uint256-uint256- that returns false if the parsing fails because of an
+Variant of `parseHexUint-string-uint256-uint256` that returns false if the parsing fails because of an
invalid character.
@@ -9339,7 +9750,7 @@ This function will revert if the result does not fit in a `uint256`.
Parse a hexadecimal string (with or without "0x" prefix), and returns the value as an `address`.
Requirements:
-- The string must be formatted as `(0x)?[0-9a-fA-F][`SafeCast.toUint240`](#SafeCast-toUint240-uint256-)`
+- The string must be formatted as `(0x)?[0-9a-fA-F]`40``
@@ -9356,11 +9767,11 @@ Requirements:
-Variant of #Strings-parseAddress-string- that parses a substring of `input` located between position `begin` (included) and
+Variant of `parseAddress-string` that parses a substring of `input` located between position `begin` (included) and
`end` (excluded).
Requirements:
-- The substring must be formatted as `(0x)?[0-9a-fA-F][`SafeCast.toUint240`](#SafeCast-toUint240-uint256-)`
+- The substring must be formatted as `(0x)?[0-9a-fA-F]`40``
@@ -9377,8 +9788,8 @@ Requirements:
-Variant of #Strings-parseAddress-string- that returns false if the parsing fails because the input is not a properly
-formatted address. See #Strings-parseAddress-string- requirements.
+Variant of `parseAddress-string` that returns false if the parsing fails because the input is not a properly
+formatted address. See `parseAddress-string` requirements.
@@ -9395,8 +9806,8 @@ formatted address. See #Strings-parseAddress-string- requirements.
-Variant of #Strings-parseAddress-string-uint256-uint256- that returns false if the parsing fails because input is not a properly
-formatted address. See #Strings-parseAddress-string-uint256-uint256- requirements.
+Variant of `parseAddress-string-uint256-uint256` that returns false if the parsing fails because input is not a properly
+formatted address. See `parseAddress-string-uint256-uint256` requirements.
@@ -9420,9 +9831,10 @@ This function should only be used in double quoted JSON strings. Single quotes a
-This function escapes all unicode characters, and not just the ones in ranges defined in section 2.5 of
-RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). ECMAScript's `JSON.parse` does recover escaped unicode
-characters that are not in this range, but other tooling may provide different results.
+This function escapes backslashes (including those in \uXXXX sequences) and the characters in ranges
+defined in section 2.5 of RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). All control characters in U+0000
+to U+001F are escaped (\b, \t, \n, \f, \r use short form; others use \u00XX). ECMAScript's `JSON.parse` does
+recover escaped unicode characters that are not in this range, but other tooling may provide different results.
@@ -9483,9 +9895,9 @@ The string being parsed is not a properly formatted address.
-## `TransientSlot`
+## `TransientSlot`
-
+
@@ -9802,9 +10214,9 @@ Store `value` at location `slot` in transient storage.
-## `InteroperableAddress`
+## `InteroperableAddress`
-
+
@@ -9874,7 +10286,7 @@ ERC-7930, including interoperable addresses with empty chain reference or empty
-Variant of #InteroperableAddress-formatV1-bytes2-bytes-bytes- specific to EVM chains. Returns the ERC-7930 interoperable
+Variant of `formatV1-bytes2-bytes-bytes-` specific to EVM chains. Returns the ERC-7930 interoperable
address (version 1) for a given chainid and ethereum address.
@@ -9892,7 +10304,7 @@ address (version 1) for a given chainid and ethereum address.
-Variant of #InteroperableAddress-formatV1-bytes2-bytes-bytes- that specifies an EVM chain without an address.
+Variant of `formatV1-bytes2-bytes-bytes-` that specifies an EVM chain without an address.
@@ -9909,7 +10321,7 @@ Variant of #InteroperableAddress-formatV1-bytes2-bytes-bytes- that specifies an
-Variant of #InteroperableAddress-formatV1-bytes2-bytes-bytes- that specifies an EVM address without a chain reference.
+Variant of `formatV1-bytes2-bytes-bytes-` that specifies an EVM address without a chain reference.
@@ -9927,7 +10339,12 @@ Variant of #InteroperableAddress-formatV1-bytes2-bytes-bytes- that specifies an
Parse a ERC-7930 interoperable address (version 1) into its different components. Reverts if the input is
-not following a version 1 of ERC-7930
+not following a version 1 of ERC-7930.
+
+
+Trailing bytes after a valid v1 encoding are ignored. The same decoded address may therefore correspond
+to multiple distinct input byte strings.
+
@@ -9999,6 +10416,11 @@ Variant of [`InteroperableAddress.tryParseV1`](#InteroperableAddress-tryParseV1-
Parse a ERC-7930 interoperable address (version 1) corresponding to an EIP-155 chain. The `chainId` and
`addr` return values will be zero if the input doesn't include a chainReference or an address, respectively.
+
+Trailing bytes after a valid v1 encoding are ignored. The same decoded (chainId, addr) may therefore
+correspond to multiple distinct input byte strings.
+
+
Requirements:
* The input must be a valid ERC-7930 interoperable address (version 1)
@@ -10093,9 +10515,9 @@ Variant of [`InteroperableAddress.tryParseEvmV1`](#InteroperableAddress-tryParse
-## `ERC165`
+## `ERC165`
-
+
@@ -10107,7 +10529,7 @@ import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
Implementation of the [`IERC165`](#IERC165) interface.
-Contracts that want to implement ERC-165 should inherit from this contract and override [`AccessControl.supportsInterface`](/contracts/5.x/api/access#AccessControl-supportsInterface-bytes4-) to check
+Contracts that want to implement ERC-165 should inherit from this contract and override [`ERC165.supportsInterface`](#ERC165-supportsInterface-bytes4-) to check
for the additional interface id that will be supported. For example:
```solidity
@@ -10120,7 +10542,6 @@ function supportsInterface(bytes4 interfaceId) public view virtual override retu
@@ -10150,9 +10571,9 @@ This function call must use less than 30 000 gas.
-## `ERC165Checker`
+## `ERC165Checker`
-
+
@@ -10289,9 +10710,9 @@ Interface identification is specified in ERC-165.
-## `IERC165`
+## `IERC165`
-
+
@@ -10342,9 +10763,9 @@ This function call must use less than 30 000 gas.
-## `Math`
+## `Math`
-
+
@@ -11065,9 +11486,9 @@ Counts the number of leading zero bits in a uint256.
-## `SafeCast`
+## `SafeCast`
-
+
@@ -12759,7 +13180,7 @@ Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
-Value doesn't fit in an uint of `bits` size.
+Value doesn't fit in a uint of `bits` size.
@@ -12776,7 +13197,7 @@ Value doesn't fit in an uint of `bits` size.
-An int value doesn't fit in an uint of `bits` size.
+An int value doesn't fit in a uint of `bits` size.
@@ -12810,7 +13231,7 @@ Value doesn't fit in an int of `bits` size.
-An uint value doesn't fit in an int of `bits` size.
+A uint value doesn't fit in an int of `bits` size.
@@ -12819,9 +13240,9 @@ An uint value doesn't fit in an int of `bits` size.
-## `SignedMath`
+## `SignedMath`
-
+
@@ -12940,9 +13361,9 @@ Returns the absolute unsigned value of a signed value.
-## `Accumulators`
+## `Accumulators`
-
+
@@ -12960,14 +13381,14 @@ to existing data and performs a single memory allocation during flattening (O(n)
Uses 0x00 as sentinel value for empty state (i.e. null pointers)
-==== How it works
+#### How it works
1. Create an empty accumulator with null head/tail pointers
2. Add data using [`RLP.push`](#RLP-push-struct-RLP-Encoder-struct-RLP-Encoder-) (append) or [`Accumulators.shift`](#Accumulators-shift-struct-Accumulators-Accumulator-Memory-Slice-) (prepend). It creates linked list nodes
3. Each node stores a reference to existing data (no copying)
4. Call [`Accumulators.flatten`](#Accumulators-flatten-struct-Accumulators-Accumulator-) to materialize the final concatenated result in a single operation
-==== Performance
+#### Performance
* Addition: O(1) per operation (just pointer manipulation)
* Flattening: O(n) single pass with one memory allocation
@@ -13091,9 +13512,9 @@ Flatten all the bytes entries in an Accumulator into a single buffer
-## `BitMaps`
+## `BitMaps`
-
+
@@ -13197,9 +13618,9 @@ Unsets the bit at `index`.
-## `Checkpoints`
+## `Checkpoints`
-
+
@@ -13889,9 +14310,9 @@ A value was attempted to be inserted on a past checkpoint.
-## `CircularBuffer`
+## `CircularBuffer`
-
+
@@ -13910,6 +14331,7 @@ structure.
Elements can't be removed but the data structure can be cleared. See [`CircularBuffer.clear`](#CircularBuffer-clear-struct-CircularBuffer-Bytes32CircularBuffer-).
Complexity:
+
- insertion ([`RLP.push`](#RLP-push-struct-RLP-Encoder-struct-RLP-Encoder-)): O(1)
- lookup ([`CircularBuffer.last`](#CircularBuffer-last-struct-CircularBuffer-Bytes32CircularBuffer-uint256-)): O(1)
- inclusion ([`CircularBuffer.includes`](#CircularBuffer-includes-struct-CircularBuffer-Bytes32CircularBuffer-bytes32-)): O(N) (worst case)
@@ -13927,9 +14349,21 @@ contract Example {
// Declare a buffer storage variable
CircularBuffer.Bytes32CircularBuffer private myBuffer;
+
+ constructor() {
+ myBuffer.setup(16); // Initialize the buffer with a non-zero fixed size (e.g., 16)
+ }
+
+ function pushValue(bytes32 value) external {
+ myBuffer.push(value); // Safe to push because the buffer was initialized in the constructor
+ }
}
```
+
+Make sure to call [`CircularBuffer.setup`](#CircularBuffer-setup-struct-CircularBuffer-Bytes32CircularBuffer-uint256-) on your buffer during construction/initialization
+
+
_Available since v5.1._
@@ -14104,9 +14538,9 @@ Error emitted when trying to setup a buffer with a size of 0.
+
+Attempts to return the item at a position in the queue given by `index`, with the first item at
+0 and the last item at `length(deque) - 1`.
+
+Returns `(false, 0x00)` if the index is out of bounds. Never reverts.
+
+
+
+
@@ -14337,9 +14913,9 @@ Returns true if the queue is empty.
-## `EnumerableMap`
+## `EnumerableMap`
-
+
@@ -14382,15 +14958,15 @@ The following map types are supported:
- `address -> bytes32` (`AddressToBytes32Map`) since v5.1.0
- `bytes32 -> address` (`Bytes32ToAddressMap`) since v5.1.0
- `bytes -> bytes` (`BytesToBytesMap`) since v5.4.0
+- `bytes4 -> address` (`Bytes4ToAddressMap`) since v5.6.0
-
-Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
+[WARNING]
+#### Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
unusable.
See [ethereum/solidity#11843](https://github.com/ethereum/solidity/pull/11843) for more info.
In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
array of EnumerableMap.
-
Functions
@@ -14485,6 +15061,16 @@ array of EnumerableMap.
- [get(map, key)](#EnumerableMap-get-struct-EnumerableMap-Bytes32ToAddressMap-bytes32-)
- [keys(map)](#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToAddressMap-)
- [keys(map, start, end)](#EnumerableMap-keys-struct-EnumerableMap-Bytes32ToAddressMap-uint256-uint256-)
+- [set(map, key, value)](#EnumerableMap-set-struct-EnumerableMap-Bytes4ToAddressMap-bytes4-address-)
+- [remove(map, key)](#EnumerableMap-remove-struct-EnumerableMap-Bytes4ToAddressMap-bytes4-)
+- [clear(map)](#EnumerableMap-clear-struct-EnumerableMap-Bytes4ToAddressMap-)
+- [contains(map, key)](#EnumerableMap-contains-struct-EnumerableMap-Bytes4ToAddressMap-bytes4-)
+- [length(map)](#EnumerableMap-length-struct-EnumerableMap-Bytes4ToAddressMap-)
+- [at(map, index)](#EnumerableMap-at-struct-EnumerableMap-Bytes4ToAddressMap-uint256-)
+- [tryGet(map, key)](#EnumerableMap-tryGet-struct-EnumerableMap-Bytes4ToAddressMap-bytes4-)
+- [get(map, key)](#EnumerableMap-get-struct-EnumerableMap-Bytes4ToAddressMap-bytes4-)
+- [keys(map)](#EnumerableMap-keys-struct-EnumerableMap-Bytes4ToAddressMap-)
+- [keys(map, start, end)](#EnumerableMap-keys-struct-EnumerableMap-Bytes4ToAddressMap-uint256-uint256-)
- [set(map, key, value)](#EnumerableMap-set-struct-EnumerableMap-BytesToBytesMap-bytes-bytes-)
- [remove(map, key)](#EnumerableMap-remove-struct-EnumerableMap-BytesToBytesMap-bytes-)
- [clear(map)](#EnumerableMap-clear-struct-EnumerableMap-BytesToBytesMap-)
@@ -16369,14 +16955,14 @@ uncallable if the map grows to a point where copying to memory consumes too much
-Removes a key-value pair from a map. O(1).
+Removes a value from a map. O(1).
Returns true if the key was removed from the map, that is if it was present.
@@ -16424,21 +17010,22 @@ Returns true if the key was removed from the map, that is if it was present.
Removes all the entries from a map. O(n).
-Developers should keep in mind that this function has an unbounded cost and using it may render the
-function uncallable if the map grows to the point where clearing it consumes too much gas to fit in a block.
+This function has an unbounded cost that scales with map size. Developers should keep in mind that
+using it may render the function uncallable if the map grows to the point where clearing it consumes too much
+gas to fit in a block.
-Returns the key-value pair stored at position `index` in the map. O(1).
-
-Note that there are no guarantees on the ordering of entries inside the
-array, and it may change when more entries are added or removed.
+Returns the element stored at position `index` in the map. O(1).
+Note that there are no guarantees on the ordering of values inside the
+array, and it may change when more values are added or removed.
Requirements:
@@ -16489,14 +17075,14 @@ Requirements:
-
+
-
tryGet(struct EnumerableMap.BytesToBytesMap map, bytes key) โ bool exists, bytes value
+
tryGet(struct EnumerableMap.Bytes4ToAddressMap map, bytes4 key) โ bool exists, address value
-Query for a nonexistent map key.
+Adds a key-value pair to a map, or updates the value for an existing
+key. O(1).
+
+Returns true if the key was added to the map, that is if it was not
+already present.
+
+Removes all the entries from a map. O(n).
+
+
+Developers should keep in mind that this function has an unbounded cost and using it may render the
+function uncallable if the map grows to the point where clearing it consumes too much gas to fit in a block.
+
+
+
+
+Returns the key-value pair stored at position `index` in the map. O(1).
+
+Note that there are no guarantees on the ordering of entries inside the
+array, and it may change when more entries are added or removed.
+
+Requirements:
+
+- `index` must be strictly less than [`Memory.length`](#Memory-length-Memory-Slice-).
+
+
+
+
+
+
+
+
+
tryGet(struct EnumerableMap.BytesToBytesMap map, bytes key) โ bool exists, bytes value
+
+Returns an array containing all the keys
+
+
+This operation will copy the entire storage to memory, which can be quite expensive. This is designed
+to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
+this function has an unbounded cost, and using it as part of a state-changing function may render the function
+uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
+
+
+
+
+Returns an array containing a slice of the keys
+
+
+This operation will copy the entire storage to memory, which can be quite expensive. This is designed
+to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
+this function has an unbounded cost, and using it as part of a state-changing function may render the function
+uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
+
+
+
@@ -16614,9 +17407,9 @@ Query for a nonexistent map key.
-## `EnumerableSet`
+## `EnumerableSet`
-
+
@@ -16654,15 +17447,15 @@ The following types are supported:
- `uint256` (`UintSet`) since v3.3.0
- `string` (`StringSet`) since v5.4.0
- `bytes` (`BytesSet`) since v5.4.0
+- `bytes4` (`Bytes4Set`) since v5.6.0
-
-Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
+[WARNING]
+#### Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
unusable.
See [ethereum/solidity#11843](https://github.com/ethereum/solidity/pull/11843) for more info.
In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
array of EnumerableSet.
-
Functions
@@ -16675,6 +17468,14 @@ array of EnumerableSet.
- [at(set, index)](#EnumerableSet-at-struct-EnumerableSet-Bytes32Set-uint256-)
- [values(set)](#EnumerableSet-values-struct-EnumerableSet-Bytes32Set-)
- [values(set, start, end)](#EnumerableSet-values-struct-EnumerableSet-Bytes32Set-uint256-uint256-)
+- [add(set, value)](#EnumerableSet-add-struct-EnumerableSet-Bytes4Set-bytes4-)
+- [remove(set, value)](#EnumerableSet-remove-struct-EnumerableSet-Bytes4Set-bytes4-)
+- [clear(set)](#EnumerableSet-clear-struct-EnumerableSet-Bytes4Set-)
+- [contains(set, value)](#EnumerableSet-contains-struct-EnumerableSet-Bytes4Set-bytes4-)
+- [length(set)](#EnumerableSet-length-struct-EnumerableSet-Bytes4Set-)
+- [at(set, index)](#EnumerableSet-at-struct-EnumerableSet-Bytes4Set-uint256-)
+- [values(set)](#EnumerableSet-values-struct-EnumerableSet-Bytes4Set-)
+- [values(set, start, end)](#EnumerableSet-values-struct-EnumerableSet-Bytes4Set-uint256-uint256-)
- [add(set, value)](#EnumerableSet-add-struct-EnumerableSet-AddressSet-address-)
- [remove(set, value)](#EnumerableSet-remove-struct-EnumerableSet-AddressSet-address-)
- [clear(set)](#EnumerableSet-clear-struct-EnumerableSet-AddressSet-)
@@ -16878,6 +17679,174 @@ uncallable if the set grows to a point where copying to memory consumes too much
+
+Removes all the values from a set. O(n).
+
+
+Developers should keep in mind that this function has an unbounded cost and using it may render the
+function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
+
+
+
+
+Returns the value stored at position `index` in the set. O(1).
+
+Note that there are no guarantees on the ordering of values inside the
+array, and it may change when more values are added or removed.
+
+Requirements:
+
+- `index` must be strictly less than [`Memory.length`](#Memory-length-Memory-Slice-).
+
+
+
+Return the entire set in an array
+
+
+This operation will copy the entire storage to memory, which can be quite expensive. This is designed
+to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
+this function has an unbounded cost, and using it as part of a state-changing function may render the function
+uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
+
+
+
+
+Return a slice of the set in an array
+
+
+This operation will copy the entire storage to memory, which can be quite expensive. This is designed
+to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
+this function has an unbounded cost, and using it as part of a state-changing function may render the function
+uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
+
+
+
+
+
@@ -17554,9 +18523,9 @@ uncallable if the set grows to a point where copying to memory consumes too much
-## `Heap`
+## `Heap`
-
+
@@ -17573,9 +18542,10 @@ Heaps are represented as a tree of values where the first element (index 0) is t
index i is the child of the node at index (i-1)/2 and the parent of nodes at index 2*i+1 and 2*i+2. Each node
stores an element of the heap.
-The structure is ordered so that each node is bigger than its parent. An immediate consequence is that the
-highest priority value is the one at the root. This value can be looked up in constant time (O(1)) at
-`heap.tree[0]`
+The structure is ordered so that, per the comparator, each node has lower priority than its parent; as a
+consequence, the highest-priority value is at the root. This value can be looked up in constant time (O(1)) at
+`heap.tree[0]`. By default, the comparator is `Comparators.lt`, which treats smaller values as higher priority
+(min-heap). Using `Comparators.gt` yields a max-heap.
The structure is designed to perform the following operations with the corresponding complexities:
@@ -17798,9 +18768,9 @@ Removes all elements in the heap.
-## `MerkleTree`
+## `MerkleTree`
-
+
@@ -18066,9 +19036,9 @@ Error emitted when the proof used during an update is invalid (could not reprodu
-## `Time`
+## `Time`
-
+
@@ -18240,3 +19210,4 @@ pack the components into a Delay object.
+
diff --git a/content/contracts/5.x/api/utils/cryptography.mdx b/content/contracts/5.x/api/utils/cryptography.mdx
index 13e43174..0f496a59 100644
--- a/content/contracts/5.x/api/utils/cryptography.mdx
+++ b/content/contracts/5.x/api/utils/cryptography.mdx
@@ -11,6 +11,7 @@ A collection of contracts and libraries that implement various signature validat
* [`SignatureChecker`](#SignatureChecker): A library helper to support regular ECDSA from EOAs as well as ERC-1271 signatures for smart contracts.
* [`Hashes`](#Hashes): Commonly used hash functions.
* [`MerkleProof`](#MerkleProof): Functions for verifying [Merkle Tree](https://en.wikipedia.org/wiki/Merkle_tree) proofs.
+* [`TrieProof`](#TrieProof): Library for verifying Ethereum Merkle-Patricia trie inclusion proofs.
* [`EIP712`](#EIP712): Contract with functions to allow processing signed typed structure data according to [EIP-712](https://eips.ethereum.org/EIPS/eip-712).
* [`ERC7739Utils`](#ERC7739Utils): Utilities library that implements a defensive rehashing mechanism to prevent replayability of smart contract signatures based on ERC-7739.
* [`WebAuthn`](#WebAuthn): Library for verifying WebAuthn Authentication Assertions.
@@ -38,6 +39,8 @@ A collection of contracts and libraries that implement various signature validat
[`MerkleProof`](#MerkleProof)
+[`TrieProof`](#TrieProof)
+
[`EIP712`](#EIP712)
[`ERC7739Utils`](#ERC7739Utils)
@@ -76,9 +79,9 @@ A collection of contracts and libraries that implement various signature validat
-## `ECDSA`
+## `ECDSA`
-
+
@@ -263,7 +266,7 @@ See [ERC-2098 short signatures](https://eips.ethereum.org/EIPS/eip-2098)
-Overload of [`ECDSA.recover`](#ECDSA-recover-bytes32-uint8-bytes32-bytes32-) that receives the `r and `vs` short-signature fields separately.
+Overload of [`ECDSA.recover`](#ECDSA-recover-bytes32-uint8-bytes32-bytes32-) that receives the `r` and `vs` short-signature fields separately.
@@ -339,7 +342,7 @@ Consider validating the result before use, or use [`ECDSA.tryRecover`](#ECDSA-tr
-Variant of [`CAIP10.parse`](#CAIP10-parse-string-) that takes a signature in calldata
+Variant of [`ECDSA.parse`](#ECDSA-parse-bytes-) that takes a signature in calldata
@@ -356,7 +359,7 @@ Variant of [`CAIP10.parse`](#CAIP10-parse-string-) that takes a signature in cal
-The signature derives the `address(0)`.
+The signature is invalid.
@@ -399,9 +402,9 @@ The signature has an S value that is in the upper half order.
-## `EIP712`
+## `EIP712`
-
+
@@ -445,15 +448,18 @@ separator from the immutable values, which is cheaper than accessing a cached ve
- [eip712Domain()](#EIP712-eip712Domain--)
- [_EIP712Name()](#EIP712-_EIP712Name--)
- [_EIP712Version()](#EIP712-_EIP712Version--)
-#### IERC5267 [!toc]
@@ -478,7 +484,8 @@ The meaning of `name` and `version` is specified in
- `version`: the current major version of the signing domain.
-These parameters cannot be changed except through a [smart contract upgrade](/contracts/5.x/learn/upgrading-smart-contracts).
+These parameters cannot be changed except through a [smart
+contract upgrade](/contracts/5.x/learn/upgrading-smart-contracts).
@@ -596,9 +603,9 @@ It only reads from storage if necessary (in case the value is too large to fit i
-## `Hashes`
+## `Hashes`
-
+
@@ -662,9 +669,9 @@ Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand me
-## `MerkleProof`
+## `MerkleProof`
-
+
@@ -923,7 +930,9 @@ Returns true if the `leaves` can be simultaneously proven to be a part of a Merk
This version handles multiproofs in memory with the default hashing function.
-CAUTION: Not all Merkle trees admit multiproofs. See [`MerkleProof.processMultiProof`](#MerkleProof-processMultiProof-bytes32---bool---bytes32---function--bytes32-bytes32--view-returns--bytes32--) for details.
+
+Not all Merkle trees admit multiproofs. See [`MerkleProof.processMultiProof`](#MerkleProof-processMultiProof-bytes32---bool---bytes32---function--bytes32-bytes32--view-returns--bytes32--) for details.
+
Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
@@ -952,9 +961,11 @@ respectively.
This version handles multiproofs in memory with the default hashing function.
-CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
+
+Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
+
The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
@@ -982,7 +993,9 @@ Returns true if the `leaves` can be simultaneously proven to be a part of a Merk
This version handles multiproofs in memory with a custom hashing function.
-CAUTION: Not all Merkle trees admit multiproofs. See [`MerkleProof.processMultiProof`](#MerkleProof-processMultiProof-bytes32---bool---bytes32---function--bytes32-bytes32--view-returns--bytes32--) for details.
+
+Not all Merkle trees admit multiproofs. See [`MerkleProof.processMultiProof`](#MerkleProof-processMultiProof-bytes32---bool---bytes32---function--bytes32-bytes32--view-returns--bytes32--) for details.
+
Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
@@ -1011,9 +1024,11 @@ respectively.
This version handles multiproofs in memory with a custom hashing function.
-CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
+
+Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
+
The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
@@ -1041,7 +1056,9 @@ Returns true if the `leaves` can be simultaneously proven to be a part of a Merk
This version handles multiproofs in calldata with the default hashing function.
-CAUTION: Not all Merkle trees admit multiproofs. See [`MerkleProof.processMultiProof`](#MerkleProof-processMultiProof-bytes32---bool---bytes32---function--bytes32-bytes32--view-returns--bytes32--) for details.
+
+Not all Merkle trees admit multiproofs. See [`MerkleProof.processMultiProof`](#MerkleProof-processMultiProof-bytes32---bool---bytes32---function--bytes32-bytes32--view-returns--bytes32--) for details.
+
Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
@@ -1070,9 +1087,11 @@ respectively.
This version handles multiproofs in calldata with the default hashing function.
-CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
+
+Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
+
The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
@@ -1100,7 +1119,9 @@ Returns true if the `leaves` can be simultaneously proven to be a part of a Merk
This version handles multiproofs in calldata with a custom hashing function.
-CAUTION: Not all Merkle trees admit multiproofs. See [`MerkleProof.processMultiProof`](#MerkleProof-processMultiProof-bytes32---bool---bytes32---function--bytes32-bytes32--view-returns--bytes32--) for details.
+
+Not all Merkle trees admit multiproofs. See [`MerkleProof.processMultiProof`](#MerkleProof-processMultiProof-bytes32---bool---bytes32---function--bytes32-bytes32--view-returns--bytes32--) for details.
+
Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
@@ -1129,9 +1150,11 @@ respectively.
This version handles multiproofs in calldata with a custom hashing function.
-CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
+
+Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
+
The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
@@ -1163,9 +1186,9 @@ The multiproof provided is not valid.
@@ -1281,7 +1314,7 @@ See [`ECDSA.recover`](#ECDSA-recover-bytes32-uint8-bytes32-bytes32-).
-Variant of #MessageHashUtils-toDataWithIntendedValidatorHash-address-bytes- optimized for cases where `data` is a bytes32.
+Variant of `toDataWithIntendedValidatorHash-address-bytes` optimized for cases where `data` is a bytes32.
@@ -1309,13 +1342,91 @@ See [`ECDSA.recover`](#ECDSA-recover-bytes32-uint8-bytes32-bytes32-).
+
+Returns the EIP-712 domain separator constructed from an `eip712Domain`. See [`IERC5267.eip712Domain`](/contracts/5.x/api/interfaces#IERC5267-eip712Domain--)
+
+This function dynamically constructs the domain separator based on which fields are present in the
+`fields` parameter. It contains flags that indicate which domain fields are present:
+
+* Bit 0 (0x01): name
+* Bit 1 (0x02): version
+* Bit 2 (0x04): chainId
+* Bit 3 (0x08): verifyingContract
+* Bit 4 (0x10): salt
+
+Arguments that correspond to fields which are not present in `fields` are ignored. For example, if `fields` is
+`0x0f` (`0b01111`), then the `salt` parameter is ignored.
+
+
-Same as [`IERC7913SignatureVerifier.verify`](../interfaces#IERC7913SignatureVerifier-verify-bytes-bytes32-bytes-), but it will revert if the required precompile is not available.
+Same as [`MerkleProof.verify`](#MerkleProof-verify-bytes32---bytes32-bytes32-function--bytes32-bytes32--view-returns--bytes32--), but it will revert if the required precompile is not available.
Make sure any logic (code or precompile) deployed at that address is the expected one,
otherwise the returned value may be misinterpreted as a positive boolean.
@@ -1399,7 +1510,7 @@ otherwise the returned value may be misinterpreted as a positive boolean.
-Same as [`IERC7913SignatureVerifier.verify`](../interfaces#IERC7913SignatureVerifier-verify-bytes-bytes32-bytes-), but only the Solidity implementation is used.
+Same as [`MerkleProof.verify`](#MerkleProof-verify-bytes32---bytes32-bytes32-function--bytes32-bytes32--view-returns--bytes32--), but only the Solidity implementation is used.
@@ -1434,7 +1545,7 @@ Public key recovery
Checks if (x, y) are valid coordinates of a point on the curve.
-In particular this function checks that x < P and y < P.
+In particular this function checks that x < P and y < P.
@@ -1443,9 +1554,9 @@ In particular this function checks that x < P and y < P.
-## `RSA`
+## `RSA`
-
+
@@ -1530,9 +1641,9 @@ using a low exponent out of security concerns.
@@ -1582,7 +1694,7 @@ change through time. It could return true at block N and false at block N+1 (or
-For an extended version of this function that supports ERC-7913 signatures, see #SignatureChecker-isValidSignatureNow-bytes-bytes32-bytes-.
+For an extended version of this function that supports ERC-7913 signatures, see `isValidSignatureNow-bytes-bytes32-bytes-`.
@@ -1628,6 +1740,21 @@ change through time. It could return true at block N and false at block N+1 (or
+
+
+
+
+
isValidERC1271SignatureNowCalldata(address signer, bytes32 hash, bytes signature) โ bool result
@@ -1647,9 +1774,9 @@ The signer is a `bytes` object that is the concatenation of an address and optio
Verification is done as follows:
-* If `signer.length < 20`: verification fails
+* If `signer.length < 20`: verification fails
* If `signer.length == 20`: verification is done using [`SignatureChecker.isValidSignatureNow`](#SignatureChecker-isValidSignatureNow-bytes-bytes32-bytes-)
-* Otherwise: verification is done using [`IERC7913SignatureVerifier`](../interfaces#IERC7913SignatureVerifier)
+* Otherwise: verification is done using [`IERC7913SignatureVerifier`](/contracts/5.x/api/interfaces#IERC7913SignatureVerifier)
Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
@@ -1685,13 +1812,134 @@ change through time. It could return true at block N and false at block N+1 (or
+
+```solidity
+import "@openzeppelin/contracts/utils/cryptography/TrieProof.sol";
+```
+
+Library for verifying Ethereum Merkle-Patricia trie inclusion proofs.
+
+The [`TrieProof.traverse`](#TrieProof-traverse-bytes32-bytes-bytes---) and [`MerkleProof.verify`](#MerkleProof-verify-bytes32---bytes32-bytes32-function--bytes32-bytes32--view-returns--bytes32--) functions can be used to prove the following value:
+
+* Transaction against the transactionsRoot of a block.
+* Event against receiptsRoot of a block.
+* Account details (RLP encoding of [nonce, balance, storageRoot, codeHash]) against the stateRoot of a block.
+* Storage slot (RLP encoding of the value) against the storageRoot of a account.
+
+Proving a storage slot is usually done in 3 steps:
+
+* From the stateRoot of a block, process the account proof (see `eth_getProof`) to get the account details.
+* RLP decode the account details to extract the storageRoot.
+* Use storageRoot of that account to process the storageProof (again, see `eth_getProof`).
+
+See [Merkle-Patricia trie](https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie)
+
+Based on [this implementation from optimism](https://github.com/ethereum-optimism/optimism/blob/ef970556e668b271a152124023a8d6bb5159bacf/packages/contracts-bedrock/src/libraries/trie/MerkleTrie.sol).
+
+
+
+Traverses a proof with a given key and returns the value.
+
+Reverts with [`TrieProof.TrieProofTraversalError`](#TrieProof-TrieProofTraversalError-enum-TrieProof-ProofError-) if proof is invalid.
+
+
+
+Traverses a proof with a given key and returns the value and an error flag
+instead of reverting if the proof is invalid. This function may still revert if
+malformed input leads to RLP decoding errors.
+
+
-## `WebAuthn`
+## `WebAuthn`
-
+
@@ -1711,15 +1959,18 @@ signatures generated during WebAuthn authentication ceremonies as specified in t
For blockchain use cases, the following WebAuthn validations are intentionally omitted:
-* Origin validation: Origin verification in `clientDataJSON` is omitted as blockchain
- contexts rely on authenticator and dapp frontend enforcement. Standard authenticators
- implement proper origin validation.
+* Origin validation: Origin verification in `clientDataJSON` is omitted. This check is the
+ responsibility of the authenticator and does not have a meaningful on-chain use case; standard
+ authenticators implement proper origin validation before signing.
* RP ID hash validation: Verification of `rpIdHash` in authenticatorData against expected
- RP ID hash is omitted. This is typically handled by platform-level security measures.
- Including an expiry timestamp in signed data is recommended for enhanced security.
-* Signature counter: Verification of signature counter increments is omitted. While
- useful for detecting credential cloning, on-chain operations typically include nonce
- protection, making this check redundant.
+ RP ID hash is omitted. This check is the responsibility of the authenticator and does not have
+ a meaningful on-chain use case; it is typically enforced at the platform level.
+* Signature counter: Verification of signature counter increments is omitted. The
+ signature counter is maintained by authenticators per the WebAuthn spec to detect
+ credential cloning, but validating it requires storing per-credential mutable state
+ (the last seen counter value) which is impractical for most smart contract applications.
+ Additionally, counter enforcement is primarily an authenticator responsibility, not a
+ contract-level concern.
* Extension outputs: Extension output value verification is omitted as these are not
essential for core authentication security in blockchain applications.
* Attestation: Attestation object verification is omitted as this implementation
@@ -1810,9 +2061,9 @@ cause revert/panic.
-## `ERC7739Utils`
+## `ERC7739Utils`
-
+
@@ -1825,7 +2076,8 @@ import "@openzeppelin/contracts/utils/cryptography/draft-ERC7739Utils.sol";
Utilities to process [ERC-7739](https://ercs.ethereum.org/ERCS/erc-7739) typed data signatures
that are specific to an EIP-712 domain.
-This library provides methods to wrap, unwrap and operate over typed data signatures with a defensive rehashing mechanism that includes the app's [EIP-712](/contracts/5.x/api/utils/cryptography#EIP712-_domainSeparatorV4)
+This library provides methods to wrap, unwrap and operate over typed data signatures with a defensive
+rehashing mechanism that includes the app's xref:api:utils/cryptography#EIP712-_domainSeparatorV4[EIP-712]
and preserves readability of the signed content using an EIP-712 nested approach.
A smart contract domain can validate a signature for a typed data structure in two ways:
@@ -1837,7 +2089,8 @@ A smart contract domain can validate a signature for a typed data structure in t
A provider for a smart contract wallet would need to return this signature as the
result of a call to `personal_sign` or `eth_signTypedData`, and this may be unsupported by
API clients that expect a return value of 129 bytes, or specifically the `r,s,v` parameters
-of an [ECDSA](/contracts/5.x/api/utils/cryptography#ECDSA) signature, as is for example specified for [EIP-712](/contracts/5.x/api/utils/cryptography#EIP712).
+of an xref:api:utils/cryptography#ECDSA[ECDSA] signature, as is for example specified for
+xref:api:utils/cryptography#EIP712[EIP-712].
@@ -1899,7 +2152,6 @@ Constructed as follows:
This function returns empty if the input format is invalid instead of reverting.
-data instead.
@@ -1921,7 +2173,7 @@ Nests an `ERC-191` digest into a `PersonalSign` EIP-712 struct, and returns the
This struct hash must be combined with a domain separator, using [`MessageHashUtils.toTypedDataHash`](#MessageHashUtils-toTypedDataHash-bytes32-bytes32-) before
being verified/recovered.
-This is used to simulates the `personal_sign` RPC method in the context of smart contracts.
+This is used to simulate the `personal_sign` RPC method in the context of smart contracts.
@@ -1957,7 +2209,7 @@ before being verified/recovered.
-Variant of #ERC7739Utils-typedDataSignStructHash-string-string-bytes32-bytes- that takes a content descriptor
+Variant of `typedDataSignStructHash-string-string-bytes32-bytes` that takes a content descriptor
and decodes the `contentsName` and `contentsType` out of it.
@@ -2008,9 +2260,9 @@ length.
-## `AbstractSigner`
+## `AbstractSigner`
-
+
@@ -2022,7 +2274,7 @@ import "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";
Abstract contract for signature validation.
-Developers must implement [`AccountERC7579._rawSignatureValidation`](../account#AccountERC7579-_rawSignatureValidation-bytes32-bytes-) and use it as the lowest-level signature validation mechanism.
+Developers must implement [`AbstractSigner._rawSignatureValidation`](#AbstractSigner-_rawSignatureValidation-bytes32-bytes-) and use it as the lowest-level signature validation mechanism.
@custom:stateless
@@ -2049,8 +2301,9 @@ Signature validation algorithm.
Implementing a signature validation algorithm is a security-sensitive operation as it involves
-cryptographic verification. It is important to review and test thoroughly before deployment. Consider using one of the signature verification libraries ([ECDSA](/contracts/5.x/api/utils/cryptography#ECDSA),
-[P256](/contracts/5.x/api/utils/cryptography#P256) or [RSA](/contracts/5.x/api/utils/cryptography#RSA)).
+cryptographic verification. It is important to review and test thoroughly before deployment. Consider
+using one of the signature verification libraries (xref:api:utils/cryptography#ECDSA[ECDSA],
+xref:api:utils/cryptography#P256[P256] or xref:api:utils/cryptography#RSA[RSA]).
@@ -2060,9 +2313,9 @@ cryptographic verification. It is important to review and test thoroughly before
@@ -2133,7 +2385,6 @@ either front-runnable or unusable.
- [ERC7913SignerAdded(signers)](#MultiSignerERC7913-ERC7913SignerAdded-bytes-)
- [ERC7913SignerRemoved(signers)](#MultiSignerERC7913-ERC7913SignerRemoved-bytes-)
- [ERC7913ThresholdSet(threshold)](#MultiSignerERC7913-ERC7913ThresholdSet-uint64-)
-#### AbstractSigner [!toc]
@@ -2145,7 +2396,6 @@ either front-runnable or unusable.
- [MultiSignerERC7913InvalidSigner(signer)](#MultiSignerERC7913-MultiSignerERC7913InvalidSigner-bytes-)
- [MultiSignerERC7913ZeroThreshold()](#MultiSignerERC7913-MultiSignerERC7913ZeroThreshold--)
- [MultiSignerERC7913UnreachableThreshold(signers, threshold)](#MultiSignerERC7913-MultiSignerERC7913UnreachableThreshold-uint64-uint64-)
-#### AbstractSigner [!toc]
@@ -2260,6 +2510,15 @@ Requirements:
* Each of `newSigners` must be at least 20 bytes long. Reverts with [`MultiSignerERC7913.MultiSignerERC7913InvalidSigner`](#MultiSignerERC7913-MultiSignerERC7913InvalidSigner-bytes-) if not.
* Each of `newSigners` must not be authorized. See [`MultiSignerERC7913.isSigner`](#MultiSignerERC7913-isSigner-bytes-). Reverts with [`MultiSignerERC7913.MultiSignerERC7913AlreadyExists`](#MultiSignerERC7913-MultiSignerERC7913AlreadyExists-bytes-) if so.
+
+This function does not validate that signers are controlled or represent appropriate entities. Integrators
+must ensure signers are properly validated before adding them. Problematic signers can compromise
+the multisig's security or functionality. Examples include uncontrolled addresses (e.g., `address(0)`),
+the account's own address (which may cause recursive validation loops), or contracts that may unintentionally
+allow arbitrary validation (e.g. using the identity precompile at `address(0x04)`, which would return the
+ERC-1271 magic value for any `isValidSignature` call).
+
+
@@ -2562,9 +2821,9 @@ The `threshold` is unreachable given the number of `signers`.
-## `MultiSignerERC7913Weighted`
+## `MultiSignerERC7913Weighted`
-
+
@@ -2625,7 +2884,9 @@ least two signers (e.g., one with weight 1 and one with weight 3). See [`MultiSi
- [_removeSigners(signers)](#MultiSignerERC7913Weighted-_removeSigners-bytes---)
- [_validateReachableThreshold()](#MultiSignerERC7913Weighted-_validateReachableThreshold--)
- [_validateThreshold(signers)](#MultiSignerERC7913Weighted-_validateThreshold-bytes---)
-#### MultiSignerERC7913 [!toc]
+
+MultiSignerERC7913
+
- [getSigners(start, end)](#MultiSignerERC7913-getSigners-uint64-uint64-)
- [getSignerCount()](#MultiSignerERC7913-getSignerCount--)
- [isSigner(signer)](#MultiSignerERC7913-isSigner-bytes-)
@@ -2633,7 +2894,8 @@ least two signers (e.g., one with weight 1 and one with weight 3). See [`MultiSi
- [_setThreshold(newThreshold)](#MultiSignerERC7913-_setThreshold-uint64-)
- [_rawSignatureValidation(hash, signature)](#MultiSignerERC7913-_rawSignatureValidation-bytes32-bytes-)
- [_validateSignatures(hash, signers, signatures)](#MultiSignerERC7913-_validateSignatures-bytes32-bytes---bytes---)
-#### AbstractSigner [!toc]
+
+
@@ -2641,11 +2903,14 @@ least two signers (e.g., one with weight 1 and one with weight 3). See [`MultiSi
@@ -2893,9 +3161,9 @@ Thrown when the arrays lengths don't match. See [`MultiSignerERC7913Weighted._se
-## `SignerECDSA`
+## `SignerECDSA`
-
+
@@ -2905,9 +3173,9 @@ Thrown when the arrays lengths don't match. See [`MultiSignerERC7913Weighted._se
import "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";
```
-Implementation of [`AbstractSigner`](#AbstractSigner) using [ECDSA](/contracts/5.x/api/utils/cryptography#ECDSA) signatures.
+Implementation of [`AbstractSigner`](#AbstractSigner) using xref:api:utils/cryptography#ECDSA[ECDSA] signatures.
-For [`Account`](../account#Account) usage, a [`SignerECDSA._setSigner`](#SignerECDSA-_setSigner-address-) function is provided to set the [`SignerECDSA.signer`](#SignerECDSA-signer--) address.
+For [`Account`](/contracts/5.x/api/account#Account) usage, a [`SignerECDSA._setSigner`](#SignerECDSA-_setSigner-address-) function is provided to set the [`SignerECDSA.signer`](#SignerECDSA-signer--) address.
Doing so is easier for a factory, who is likely to use initializable clones of this contract.
Example of usage:
@@ -2932,7 +3200,6 @@ or during initialization (if used as a clone) may leave the signer either front-
- [_setSigner(signerAddr)](#SignerECDSA-_setSigner-address-)
- [signer()](#SignerECDSA-signer--)
- [_rawSignatureValidation(hash, signature)](#SignerECDSA-_rawSignatureValidation-bytes32-bytes-)
-#### AbstractSigner [!toc]
@@ -3002,7 +3269,9 @@ Signature validation algorithm.
Implementing a signature validation algorithm is a security-sensitive operation as it involves
-cryptographic verification. It is important to review and test thoroughly before deployment. Consider using one of the signature verification libraries ([ECDSA](/contracts/5.x/api/utils/cryptography#ECDSA), [P256](/contracts/5.x/api/utils/cryptography#P256) or [RSA](/contracts/5.x/api/utils/cryptography#RSA)).
+cryptographic verification. It is important to review and test thoroughly before deployment. Consider
+using one of the signature verification libraries (xref:api:utils/cryptography#ECDSA[ECDSA],
+xref:api:utils/cryptography#P256[P256] or xref:api:utils/cryptography#RSA[RSA]).
@@ -3012,9 +3281,9 @@ cryptographic verification. It is important to review and test thoroughly before
-## `SignerEIP7702`
+## `SignerEIP7702`
-
+
@@ -3024,7 +3293,7 @@ cryptographic verification. It is important to review and test thoroughly before
import "@openzeppelin/contracts/utils/cryptography/signers/SignerEIP7702.sol";
```
-Implementation of [`AbstractSigner`](#AbstractSigner) for implementation for an EOA. Useful for ERC-7702 accounts.
+Implementation of [`AbstractSigner`](#AbstractSigner) for implementation for an EOA. Useful for EIP-7702 accounts.
@custom:stateless
@@ -3032,7 +3301,6 @@ Implementation of [`AbstractSigner`](#AbstractSigner) for implementation for an
@@ -3057,9 +3325,9 @@ Validates the signature using the EOA's address (i.e. `address(this)`).
-## `SignerERC7913`
+## `SignerERC7913`
-
+
@@ -3072,7 +3340,7 @@ import "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7913.sol";
Implementation of [`AbstractSigner`](#AbstractSigner) using
[ERC-7913](https://eips.ethereum.org/EIPS/eip-7913) signature verification.
-For [`Account`](../account#Account) usage, a [`SignerECDSA._setSigner`](#SignerECDSA-_setSigner-address-) function is provided to set the ERC-7913 formatted [`SignerECDSA.signer`](#SignerECDSA-signer--).
+For [`Account`](/contracts/5.x/api/account#Account) usage, a [`SignerECDSA._setSigner`](#SignerECDSA-_setSigner-address-) function is provided to set the ERC-7913 formatted [`SignerECDSA.signer`](#SignerECDSA-signer--).
Doing so is easier for a factory, who is likely to use initializable clones of this contract.
The signer is a `bytes` object that concatenates a verifier address and a key: `verifier || key`.
@@ -3103,7 +3371,6 @@ or during initialization (if used as a clone) may leave the signer either front-
- [signer()](#SignerERC7913-signer--)
- [_setSigner(signer_)](#SignerERC7913-_setSigner-bytes-)
- [_rawSignatureValidation(hash, signature)](#SignerERC7913-_rawSignatureValidation-bytes32-bytes-)
-#### AbstractSigner [!toc]
@@ -3168,7 +3435,7 @@ Sets the signer (i.e. `verifier || key`) with an ERC-7913 formatted signer.
-Verifies a signature using #SignatureChecker-isValidSignatureNow-bytes-bytes32-bytes-
+Verifies a signature using `SignatureChecker-isValidSignatureNow-bytes-bytes32-bytes-`
with [`SignerECDSA.signer`](#SignerECDSA-signer--), `hash` and `signature`.
@@ -3178,9 +3445,9 @@ with [`SignerECDSA.signer`](#SignerECDSA-signer--), `hash` and `signature`.
-## `SignerP256`
+## `SignerP256`
-
+
@@ -3190,9 +3457,9 @@ with [`SignerECDSA.signer`](#SignerECDSA-signer--), `hash` and `signature`.
import "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";
```
-Implementation of [`AbstractSigner`](#AbstractSigner) using [P256](/contracts/5.x/api/utils/cryptography#P256) signatures.
+Implementation of [`AbstractSigner`](#AbstractSigner) using xref:api:utils/cryptography#P256[P256] signatures.
-For [`Account`](../account#Account) usage, a [`SignerECDSA._setSigner`](#SignerECDSA-_setSigner-address-) function is provided to set the [`SignerECDSA.signer`](#SignerECDSA-signer--) public key.
+For [`Account`](/contracts/5.x/api/account#Account) usage, a [`SignerECDSA._setSigner`](#SignerECDSA-_setSigner-address-) function is provided to set the [`SignerECDSA.signer`](#SignerECDSA-signer--) public key.
Doing so is easier for a factory, who is likely to use initializable clones of this contract.
Example of usage:
@@ -3217,7 +3484,6 @@ or during initialization (if used as a clone) may leave the signer either front-
- [_setSigner(qx, qy)](#SignerP256-_setSigner-bytes32-bytes32-)
- [signer()](#SignerP256-signer--)
- [_rawSignatureValidation(hash, signature)](#SignerP256-_rawSignatureValidation-bytes32-bytes-)
-#### AbstractSigner [!toc]
@@ -3225,7 +3491,6 @@ or during initialization (if used as a clone) may leave the signer either front-
@@ -3295,7 +3560,9 @@ Signature validation algorithm.
Implementing a signature validation algorithm is a security-sensitive operation as it involves
-cryptographic verification. It is important to review and test thoroughly before deployment. Consider using one of the signature verification libraries ([ECDSA](/contracts/5.x/api/utils/cryptography#ECDSA), [P256](/contracts/5.x/api/utils/cryptography#P256) or [RSA](/contracts/5.x/api/utils/cryptography#RSA)).
+cryptographic verification. It is important to review and test thoroughly before deployment. Consider
+using one of the signature verification libraries (xref:api:utils/cryptography#ECDSA[ECDSA],
+xref:api:utils/cryptography#P256[P256] or xref:api:utils/cryptography#RSA[RSA]).
@@ -3320,9 +3587,9 @@ cryptographic verification. It is important to review and test thoroughly before
-## `SignerRSA`
+## `SignerRSA`
-
+
@@ -3332,9 +3599,9 @@ cryptographic verification. It is important to review and test thoroughly before
import "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";
```
-Implementation of [`AbstractSigner`](#AbstractSigner) using [RSA](/contracts/5.x/api/utils/cryptography#RSA) signatures.
+Implementation of [`AbstractSigner`](#AbstractSigner) using xref:api:utils/cryptography#RSA[RSA] signatures.
-For [`Account`](../account#Account) usage, a [`SignerECDSA._setSigner`](#SignerECDSA-_setSigner-address-) function is provided to set the [`SignerECDSA.signer`](#SignerECDSA-signer--) public key.
+For [`Account`](/contracts/5.x/api/account#Account) usage, a [`SignerECDSA._setSigner`](#SignerECDSA-_setSigner-address-) function is provided to set the [`SignerECDSA.signer`](#SignerECDSA-signer--) public key.
Doing so is easier for a factory, who is likely to use initializable clones of this contract.
Example of usage:
@@ -3359,7 +3626,6 @@ or during initialization (if used as a clone) may leave the signer either front-
- [_setSigner(e, n)](#SignerRSA-_setSigner-bytes-bytes-)
- [signer()](#SignerRSA-signer--)
- [_rawSignatureValidation(hash, signature)](#SignerRSA-_rawSignatureValidation-bytes32-bytes-)
-#### AbstractSigner [!toc]
@@ -3441,9 +3707,9 @@ encoding as per section 9.2 (step 1) of the RFC.
-## `SignerWebAuthn`
+## `SignerWebAuthn`
-
+
@@ -3480,19 +3746,25 @@ or during initialization (if used as a clone) may leave the signer either front-
@@ -3510,9 +3782,7 @@ or during initialization (if used as a clone) may leave the signer either front-
Validates a raw signature using the WebAuthn authentication assertion.
-In case the signature can't be validated, it falls back to the
-[`SignerP256._rawSignatureValidation`](#SignerP256-_rawSignatureValidation-bytes32-bytes-) method for raw P256 signature validation by passing
-the raw `r` and `s` values from the signature.
+Returns `false` if the signature is not a valid WebAuthn authentication assertion.
@@ -3521,9 +3791,9 @@ the raw `r` and `s` values from the signature.
-## `ERC7739`
+## `ERC7739`
-
+
@@ -3538,11 +3808,13 @@ Validates signatures wrapping the message hash in a nested EIP712 type. See [`ER
Linking the signature to the EIP-712 domain separator is a security measure to prevent signature replay across different
EIP-712 domains (e.g. a single offchain owner of multiple contracts).
-This contract requires implementing the [`AccountERC7579._rawSignatureValidation`](../account#AccountERC7579-_rawSignatureValidation-bytes32-bytes-) function, which passes the wrapped message hash,
+This contract requires implementing the [`AbstractSigner._rawSignatureValidation`](#AbstractSigner-_rawSignatureValidation-bytes32-bytes-) function, which passes the wrapped message hash,
which may be either an typed data or a personal sign nested type.
-[EIP-712](/contracts/5.x/api/utils/cryptography#EIP712) uses [ShortStrings](/contracts/5.x/api/utils/cryptography#ShortStrings) to optimize gas costs for short strings (up to 31 characters). Consider that strings longer than that will use storage, which may limit the ability of the signer to be used within the ERC-4337 validation phase (due to
+xref:api:utils/cryptography#EIP712[EIP-712] uses xref:api:utils/cryptography#ShortStrings[ShortStrings] to
+optimize gas costs for short strings (up to 31 characters). Consider that strings longer than that will use storage,
+which may limit the ability of the signer to be used within the ERC-4337 validation phase (due to
[ERC-7562 storage access rules](https://eips.ethereum.org/EIPS/eip-7562#storage-rules)).
@@ -3550,27 +3822,34 @@ which may be either an typed data or a personal sign nested type.
@@ -3698,9 +3975,9 @@ SHOULD return 0xffffffff or revert if the key is empty
-## `ERC7913WebAuthnVerifier`
+## `ERC7913WebAuthnVerifier`
-
+
@@ -3716,7 +3993,7 @@ This verifier enables the validation of WebAuthn signatures using P256 public ke
The key is expected to be a 64-byte concatenation of the P256 public key coordinates (qx || qy).
The signature is expected to be an abi-encoded [`WebAuthn.WebAuthnAuth`](#WebAuthn-WebAuthnAuth) struct.
-Uses `WebAuthn-verifyMinimal` for signature verification, which performs the essential
+Uses [`WebAuthn.verify`](#WebAuthn-verify-bytes-struct-WebAuthn-WebAuthnAuth-bytes32-bytes32-bool-) for signature verification, which performs the essential
WebAuthn checks: type validation, challenge matching, and cryptographic signature verification.
@@ -3729,7 +4006,6 @@ Wallets that may require default P256 validation may install a P256 verifier sep