Skip to content

#
Contract Functions

##
Paymaster Functions

All valid paymaster signatures, as represented in `paymasterAndData` are expected to be encoded in the following format:

     struct Sponsorship {
        address paymaster;
        address sponsor;
        uint256 amount;
        uint256 chainId;
        address contractAddress;
        uint256 tokenId;
    }

The individual sponsorships are expected to be encoded in the following format:

    bytes memory sponsorships = Sponsorship[](n);
    bytes memory encodedSponsorships = abi.encode(sponsorships)

In which represents the `paymasterAndData` as:

    abi.encodePacked(originalPaymasterAndData)

This enables the frontend interface to decode the `paymasterAndData` and extract the individual sponsorships for the paymaster, presenting the user the list of assets in which they are approving the gas fees for.

##
Entrypoint Functions

The paymaster in Entrypoint is expected to emit the following events for a successful paymaster sponsorship for reimbursement of gas fees to the end user.

    event SponsorshipCreated(
        address indexed paymaster,
        address indexed sponsor,
        uint256 amount,
        uint256 chainId,
        address contractAddress,
        uint256 tokenId // this is optional
    );