IPaymaster

Interface for a Paymaster contract.

IPaymaster Contract

The `IPaymaster` interface defines the functions required for a contract to act as a paymaster in the context of a Gas Station Network (GSN). A paymaster is responsible for covering the gas costs of transactions submitted through GSN, enabling users to perform transactions without having to pay gas upfront.

Functions

The `IPaymaster` interface includes the following functions:

  • post: This function is called by the GSN Relay to verify and pay for a transaction on behalf of a user. If the paymaster approves the transaction, it should return true, otherwise false.
  • postTransaction: This function is called by the GSN Relay after a successful transaction to allow the paymaster to perform any post-transaction actions, such as updating its internal state.
  • preRelayedCall: This function is called by the GSN Relay before the transaction is relayed to the destination contract. The paymaster can use this function to perform checks and modify the transaction parameters.
  • version: This function allows clients to retrieve the current version of the paymaster implementation.

Usage

To use a paymaster contract with a GSN Relay, the user needs to specify the address of the paymaster contract in the transaction request. The GSN Relay will then interact with the paymaster contract to verify and pay for the transaction.

Security Considerations

Paymaster contracts should be carefully audited to ensure they are secure and do not introduce vulnerabilities that could be exploited by malicious actors.