Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Add SponsorEverythingPaymaster #256

Conversation

jihoonsong
Copy link
Contributor

@jihoonsong jihoonsong commented Jul 3, 2024

What is this PR doing?

This PR adds SponsorEverythingPaymaster contract and its test, which can serve as references when developing more complex paymasters.

How can these changes be manually tested?

Its test is included in the existing plugin tests. i.e., run yarn hardhat test in packages/plugins will test the changes.

Does this PR resolve or contribute to any issues?

No.

Checklist

  • I have manually tested these changes
  • Post a link to the PR in the group chat

Guidelines

  • If your PR is not ready, mark it as a draft
  • The resolve conversation button is for reviewers, not authors
    • (But add a 'done' comment or similar)

Copy link
Contributor

@jacque006 jacque006 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall solid starting example, thanks for the contribution 👍

const paymasterAddress = await paymaster.getAddress();

// Paymaster deposits.
await paymaster.deposit({ value: ethers.parseEther("1") })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion

Suggested change
await paymaster.deposit({ value: ethers.parseEther("1") })
await paymaster.deposit({ value: oneEther })

Can also do this in a few other spots.

bytes32 userOpHash,
uint256 maxCost
) internal virtual override returns (bytes memory context, uint256 validationData) {
// Validation logic comes here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be explicit with return values here. Either:

Suggested change
// Validation logic comes here.
// Validation logic comes here.
// Approve everything
// validUntil & validAfter of 0 means infinite valid time range
return ("", _packValidationData(false, 0, 0))

Or

        // Validation logic comes here.
        // Approve everything
        return ("", 0)

@jacque006 jacque006 merged commit 84dc6d1 into getwax:main Jul 3, 2024
2 checks passed
@jihoonsong jihoonsong deleted the feature/sponsor-everything-paymaster branch July 4, 2024 14:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants