Skip to content

Kwenta/paymaster

Repository files navigation

Margin Paymaster

Github Actions Foundry License: GPL-3.0

An ERC-4337 compliant custom Paymaster contract (MarginPaymaster) which sponsors optimistically sponsors transactions signed by a privileged actor, the authorizer.

The MarginPaymaster will attempt to recoup gas costs in USDC from a users smart wallet account and failing that their SNX-V3 margin.

You can see here a visual outlining the full ERC-4337 flow with our MarginPaymaster:

Contracts

tree src/

src
├── MarginPaymaster.sol
├── interfaces
│   └── external
│       ├── IEngine.sol
│       ├── INftModule.sol
│       ├── IPerpsMarketProxy.sol
│       ├── IUniswapV3Pool.sol
│       ├── IV3SwapRouter.sol
│       └── IWETH9.sol
└── libraries
    ├── FullMath.sol
    ├── OracleLibrary.sol
    └── TickMath.sol

Tests

  1. Follow the Foundry guide to working on an existing project

  2. Build project

npm run compile
  1. Create an .env file using the .env.example file as a template

  2. Execute tests (requires rpc url(s) to be set in .env)

npm run test
  1. Run specific test
forge test -vv --fork-url $(grep BASE_URL .env | cut -d '=' -f2) --mt TEST_NAME

Deployment Addresses

See deployments/ folder

  1. Optimism deployments found in deployments/Optimism.json
  2. Optimism Goerli deployments found in deployments/OptimismGoerli.json
  3. Base deployments found in deployments/Base.json
  4. Base Goerli deployments found in deployments/BaseGoerli.json

Audits

See audits/ folder

  1. Internal audits found in audits/internal/
  2. External audits found in audits/external/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages