Skip to main content

Extension4337

Standard Specifications
Solidity implementation

Public Methods

Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally.

constructor

References
constructor(address entryPoint_);

Parameters

NameTypeDescription
entryPoint_address-

VERSION

References
function VERSION() external view returns (string);

Contract version.

Returns

NameTypeDescription
0string-

entryPoint

References
function entryPoint() external view returns (address);

Get the address of the Entry Point contract that will execute the user operation.

Returns

NameTypeDescription
0addressThe address of the EntryPoint contract

supportsInterface

References
function supportsInterface(bytes4 interfaceId) external view returns (bool);

See IERC165-supportsInterface.

Parameters

NameTypeDescription
interfaceIdbytes4-

Returns

NameTypeDescription
0bool-

validateUserOp

References
  • Specification details: LSP-17-Extensions
  • Solidity implementation: Extension4337.sol
  • Function signature: validateUserOp(UserOperation,bytes32,uint256)
  • Function selector: 0xe86fc51e
info

In addition to the logic of the IAccount interface from 4337, the permissions of the address that signed the user operation are checked to ensure that it has the permission _4337_PERMISSION.

function validateUserOp(
UserOperation userOp,
bytes32 userOpHash,
uint256
) external nonpayable returns (uint256);

Validate user's 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 SIG_VALIDATION_FAILED (1). 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. The third parameter (not mentioned but missingAccountFunds from the IAccount interface) describes the missing funds on the account's deposit in the entrypoint. This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call. The excess is left as a deposit in the entrypoint, for future calls. Can be withdrawn anytime using "entryPoint.withdrawTo()" In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.

Requirements:

  • caller MUST be the entrypoint contract.
  • the signature and nonce must be valid.

Parameters

NameTypeDescription
userOpUserOperation-
userOpHashbytes32-
_2uint256-

Returns

NameTypeDescription
0uint256validationData packaged ValidationData structure. use _packValidationData and _unpackValidationData to encode and decode - <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure, otherwise, an address of an "authorizer" contract. - <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite" - <6-byte> validAfter - first timestamp this operation is valid If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure. Note that the validation code cannot use block.timestamp (or block.number) directly.

Internal Methods

Any method labeled as internal serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.

Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities.

_extendableMsgData

function _extendableMsgData() internal view returns (bytes);

Returns the original msg.data passed to the extendable contract without the appended msg.sender and msg.value.


_extendableMsgSender

function _extendableMsgSender() internal view returns (address);

Returns the original msg.sender calling the extendable contract.


_extendableMsgValue

function _extendableMsgValue() internal view returns (uint256);

Returns the original msg.value sent to the extendable contract.