Request form
ERC4337
  • ERC4337
  • Audited
Docs
Source
ChefGPT

ERC4337

This smart contract is an implementation of the ERC4337 standard. It allows users to execute calls and delegate calls, validate signatures and nonces, and perform direct storage operations. It also includes an initializer function and an entry point function.

ERC4337 :
addDeposit() :
Deposit more funds for this account in the EntryPoint.
cancelOwnershipHandover() :
Cancels the two-step ownership handover to the caller, if any.
completeOwnershipHandover(address) :
Allows the owner to complete the two-step ownership handover to `pendingOwner`. Reverts if there is no existing ownership handover requested by `pendingOwner`.
delegateExecute(address,bytes) :
Execute a delegatecall with `delegate` on this account.
eip712Domain() :
See: https://eips.ethereum.org/EIPS/eip-5267
entryPoint() :
Returns the canonical ERC4337 EntryPoint contract. Override this function to return a different EntryPoint.
execute(address,uint256,bytes) :
Execute a call from this account.
executeBatch((address,uint256,bytes)[]) :
Execute a sequence of calls from this account.
getDeposit() :
Returns the account's balance on the EntryPoint.
initialize(address) :
Initializes the account with the owner. Can only be called once.
isValidSignature(bytes32,bytes) :
Validates the signature with ERC1271 return, so that this account can also be used as a signer.
owner() :
Returns the owner of the contract.
ownershipHandoverExpiresAt(address) :
Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
proxiableUUID() :
Returns the storage slot used by the implementation, as specified in [ERC1822](https://eips.ethereum.org/EIPS/eip-1822). Note: The `notDelegated` modifier prevents accidental upgrades to an implementation that is a proxy contract.
renounceOwnership() :
Allows the owner to renounce their ownership.
requestOwnershipHandover() :
Request a two-step ownership handover to the caller. The request will automatically expire in 48 hours (172800 seconds) by default.
storageLoad(bytes32) :
Returns the raw storage value at `storageSlot`.
storageStore(bytes32,bytes32) :
Writes the raw storage value at `storageSlot`.
transferOwnership(address) :
Allows the owner to transfer the ownership to `newOwner`.
upgradeTo(address) :
Upgrades the proxy's implementation to `newImplementation`. Emits a {Upgraded} event. Note: The `onlyProxy` modifier prevents accidental calling on the implementation.
upgradeToAndCall(address,bytes) :
Upgrades the proxy's implementation to `newImplementation`. Emits a {Upgraded} event. Note: This function calls `upgradeTo` internally, followed by a delegatecall to `newImplementation`.
validateUserOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes32,uint256) :
Validates the signature and nonce. The EntryPoint will make the call to the recipient only if this validation call returns successfully. Signature failure should be reported by returning 1 (see: `_validateSignature`). This allows making a "simulation call" without a valid signature. Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.
withdrawDepositTo(address,uint256) :
Withdraw ETH from the account's deposit on the EntryPoint.
Receiver :
Note: - Handles all ERC721 and ERC1155 token safety callbacks. - Collapses function table gas overhead and code size. - Utilizes fallback so unknown calldata will pass on.
EIP712 :
Note, this implementation: - Uses `address(this)` for the `verifyingContract` field. - Does NOT use the optional EIP-712 salt. - Does NOT use any EIP-712 extensions. This is for simplicity and to save gas. If you need to customize, please fork / modify accordingly.
constructor :
Cache the hashes for cheaper runtime gas costs. In the case of upgradeable contracts (i.e. proxies), or if the chain id changes due to a hard fork, the domain separator will be seamlessly calculated on-the-fly.
eip712Domain() :
See: https://eips.ethereum.org/EIPS/eip-5267
LibZip :
Note: The accompanying solady.js library includes implementations of FastLZ and calldata operations for convenience.
Ownable :
Note: This implementation does NOT auto-initialize the owner to `msg.sender`. You MUST call the `_initializeOwner` in the constructor / initializer. While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, the nomenclature for the 2-step ownership handover may be unique to this codebase.
OwnershipHandoverCanceled(address) :
The ownership handover to `pendingOwner` has been canceled.
OwnershipHandoverRequested(address) :
An ownership handover to `pendingOwner` has been requested.
OwnershipTransferred(address,address) :
The ownership is transferred from `oldOwner` to `newOwner`. This event is intentionally kept the same as OpenZeppelin's Ownable to be compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), despite it not being as lightweight as a single argument event.
cancelOwnershipHandover() :
Cancels the two-step ownership handover to the caller, if any.
completeOwnershipHandover(address) :
Allows the owner to complete the two-step ownership handover to `pendingOwner`. Reverts if there is no existing ownership handover requested by `pendingOwner`.
owner() :
Returns the owner of the contract.
ownershipHandoverExpiresAt(address) :
Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
renounceOwnership() :
Allows the owner to renounce their ownership.
requestOwnershipHandover() :
Request a two-step ownership handover to the caller. The request will automatically expire in 48 hours (172800 seconds) by default.
transferOwnership(address) :
Allows the owner to transfer the ownership to `newOwner`.
UUPSUpgradeable :
Upgraded(address) :
Emitted when the proxy's implementation is upgraded.
proxiableUUID() :
Returns the storage slot used by the implementation, as specified in [ERC1822](https://eips.ethereum.org/EIPS/eip-1822). Note: The `notDelegated` modifier prevents accidental upgrades to an implementation that is a proxy contract.
upgradeTo(address) :
Upgrades the proxy's implementation to `newImplementation`. Emits a {Upgraded} event. Note: The `onlyProxy` modifier prevents accidental calling on the implementation.
upgradeToAndCall(address,bytes) :
Upgrades the proxy's implementation to `newImplementation`. Emits a {Upgraded} event. Note: This function calls `upgradeTo` internally, followed by a delegatecall to `newImplementation`.
SignatureCheckerLib :
Note: - The signature checking functions use the ecrecover precompile (0x1). - The `bytes memory signature` variants use the identity precompile (0x4) to copy memory internally. - Unlike ECDSA signatures, contract signatures are revocable. WARNING! Do NOT use signatures as unique identifiers. Please use EIP712 with a nonce included in the digest to prevent replay attacks. This implementation does NOT check if a signature is non-malleable.
ERC4337.sol
Receiver.sol
EIP712.sol
LibZip.sol
Ownable.sol
UUPSUpgradeable.sol
SignatureCheckerLib.sol

2 downloads

Solidity Version

0.8.15

Creator

Solady
Solady / ERC4337
  • ERC4337
  • Audited
Docs
Source
ChefGPT
Expand
Share

Get Cookin'
star icon2

2 downloads

Solidity Version

0.8.15

Creator

Solady

ERC4337

This smart contract is an implementation of the ERC4337 standard. It allows users to execute calls and delegate calls, validate signatures and nonces, and perform direct storage operations. It also includes an initializer function and an entry point function.

ERC4337 :
addDeposit() :
Deposit more funds for this account in the EntryPoint.
cancelOwnershipHandover() :
Cancels the two-step ownership handover to the caller, if any.
completeOwnershipHandover(address) :
Allows the owner to complete the two-step ownership handover to `pendingOwner`. Reverts if there is no existing ownership handover requested by `pendingOwner`.
delegateExecute(address,bytes) :
Execute a delegatecall with `delegate` on this account.
eip712Domain() :
See: https://eips.ethereum.org/EIPS/eip-5267
entryPoint() :
Returns the canonical ERC4337 EntryPoint contract. Override this function to return a different EntryPoint.
execute(address,uint256,bytes) :
Execute a call from this account.
executeBatch((address,uint256,bytes)[]) :
Execute a sequence of calls from this account.
getDeposit() :
Returns the account's balance on the EntryPoint.
initialize(address) :
Initializes the account with the owner. Can only be called once.
isValidSignature(bytes32,bytes) :
Validates the signature with ERC1271 return, so that this account can also be used as a signer.
owner() :
Returns the owner of the contract.
ownershipHandoverExpiresAt(address) :
Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
proxiableUUID() :
Returns the storage slot used by the implementation, as specified in [ERC1822](https://eips.ethereum.org/EIPS/eip-1822). Note: The `notDelegated` modifier prevents accidental upgrades to an implementation that is a proxy contract.
renounceOwnership() :
Allows the owner to renounce their ownership.
requestOwnershipHandover() :
Request a two-step ownership handover to the caller. The request will automatically expire in 48 hours (172800 seconds) by default.
storageLoad(bytes32) :
Returns the raw storage value at `storageSlot`.
storageStore(bytes32,bytes32) :
Writes the raw storage value at `storageSlot`.
transferOwnership(address) :
Allows the owner to transfer the ownership to `newOwner`.
upgradeTo(address) :
Upgrades the proxy's implementation to `newImplementation`. Emits a {Upgraded} event. Note: The `onlyProxy` modifier prevents accidental calling on the implementation.
upgradeToAndCall(address,bytes) :
Upgrades the proxy's implementation to `newImplementation`. Emits a {Upgraded} event. Note: This function calls `upgradeTo` internally, followed by a delegatecall to `newImplementation`.
validateUserOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes32,uint256) :
Validates the signature and nonce. The EntryPoint will make the call to the recipient only if this validation call returns successfully. Signature failure should be reported by returning 1 (see: `_validateSignature`). This allows making a "simulation call" without a valid signature. Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.
withdrawDepositTo(address,uint256) :
Withdraw ETH from the account's deposit on the EntryPoint.
Receiver :
Note: - Handles all ERC721 and ERC1155 token safety callbacks. - Collapses function table gas overhead and code size. - Utilizes fallback so unknown calldata will pass on.
EIP712 :
Note, this implementation: - Uses `address(this)` for the `verifyingContract` field. - Does NOT use the optional EIP-712 salt. - Does NOT use any EIP-712 extensions. This is for simplicity and to save gas. If you need to customize, please fork / modify accordingly.
constructor :
Cache the hashes for cheaper runtime gas costs. In the case of upgradeable contracts (i.e. proxies), or if the chain id changes due to a hard fork, the domain separator will be seamlessly calculated on-the-fly.
eip712Domain() :
See: https://eips.ethereum.org/EIPS/eip-5267
LibZip :
Note: The accompanying solady.js library includes implementations of FastLZ and calldata operations for convenience.
Ownable :
Note: This implementation does NOT auto-initialize the owner to `msg.sender`. You MUST call the `_initializeOwner` in the constructor / initializer. While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, the nomenclature for the 2-step ownership handover may be unique to this codebase.
OwnershipHandoverCanceled(address) :
The ownership handover to `pendingOwner` has been canceled.
OwnershipHandoverRequested(address) :
An ownership handover to `pendingOwner` has been requested.
OwnershipTransferred(address,address) :
The ownership is transferred from `oldOwner` to `newOwner`. This event is intentionally kept the same as OpenZeppelin's Ownable to be compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), despite it not being as lightweight as a single argument event.
cancelOwnershipHandover() :
Cancels the two-step ownership handover to the caller, if any.
completeOwnershipHandover(address) :
Allows the owner to complete the two-step ownership handover to `pendingOwner`. Reverts if there is no existing ownership handover requested by `pendingOwner`.
owner() :
Returns the owner of the contract.
ownershipHandoverExpiresAt(address) :
Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
renounceOwnership() :
Allows the owner to renounce their ownership.
requestOwnershipHandover() :
Request a two-step ownership handover to the caller. The request will automatically expire in 48 hours (172800 seconds) by default.
transferOwnership(address) :
Allows the owner to transfer the ownership to `newOwner`.
UUPSUpgradeable :
Upgraded(address) :
Emitted when the proxy's implementation is upgraded.
proxiableUUID() :
Returns the storage slot used by the implementation, as specified in [ERC1822](https://eips.ethereum.org/EIPS/eip-1822). Note: The `notDelegated` modifier prevents accidental upgrades to an implementation that is a proxy contract.
upgradeTo(address) :
Upgrades the proxy's implementation to `newImplementation`. Emits a {Upgraded} event. Note: The `onlyProxy` modifier prevents accidental calling on the implementation.
upgradeToAndCall(address,bytes) :
Upgrades the proxy's implementation to `newImplementation`. Emits a {Upgraded} event. Note: This function calls `upgradeTo` internally, followed by a delegatecall to `newImplementation`.
SignatureCheckerLib :
Note: - The signature checking functions use the ecrecover precompile (0x1). - The `bytes memory signature` variants use the identity precompile (0x4) to copy memory internally. - Unlike ECDSA signatures, contract signatures are revocable. WARNING! Do NOT use signatures as unique identifiers. Please use EIP712 with a nonce included in the digest to prevent replay attacks. This implementation does NOT check if a signature is non-malleable.
ERC4337.sol
Receiver.sol
EIP712.sol
LibZip.sol
Ownable.sol
UUPSUpgradeable.sol
SignatureCheckerLib.sol