Skip to main content

NaivePaymaster

NaivePaymaster​

This paymaster will approve transactions sent through a relay provider by the target contracts that are updated in the 'targets' mapping. This mapping maps an address to a boolean to indicate whether or not the address can be approved or not for gasless transactions https://docs.opengsn.org/tutorials/integration.html#creating_a_paymaster

targets​

mapping(address => bool) targets

TargetSet​

event TargetSet(address target)

constructor​

constructor() public

initialize​

function initialize(address _admin, address _target, address _forwarder) external

initializes a paymaster contract

NameTypeDescription
_adminaddressadmin of the paymaster
_targetaddressthe target address that should be approved for gasless transactions
_forwarderaddressaddress for the trusted forwarder for open GSN

proxyinitialize​

function proxyinitialize(address _admin, address _target, address _forwarder) external

__NaivePaymaster_init​

function __NaivePaymaster_init(address _admin, address _target, address _forwarder) internal

__NaivePaymaster_init_unchained​

function __NaivePaymaster_init_unchained(address _target) internal

setTarget​

function setTarget(address target) external

updates the mapping of target addresses to approve the passed in address

removeTarget​

function removeTarget(address target) external

updates the mapping of target addresses to disapprove the passed in address

PreRelayed​

event PreRelayed(uint256)

PostRelayed​

event PostRelayed(uint256)

preRelayedCall​

function preRelayedCall(struct GsnTypes.RelayRequest relayRequest, bytes signature, bytes approvalData, uint256 maxPossibleGas) external virtual returns (bytes context, bool)

function that performs all access control. It verifies that the relay request passes in an address that has been set as a target address and is approved for a gasless transaction

postRelayedCall​

function postRelayedCall(bytes context, bool success, uint256 gasUseWithoutPost, struct GsnTypes.RelayData relayData) external virtual

function that performs all bookkeeping after a function call has been made.

versionPaymaster​

function versionPaymaster() external view virtual returns (string)

function that is required for open GSN paymasters