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:
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
-
Build project
npm run compile
-
Create an
.env
file using the.env.example
file as a template -
Execute tests (requires rpc url(s) to be set in
.env
)
npm run test
- Run specific test
forge test -vv --fork-url $(grep BASE_URL .env | cut -d '=' -f2) --mt TEST_NAME
See
deployments/
folder
- Optimism deployments found in
deployments/Optimism.json
- Optimism Goerli deployments found in
deployments/OptimismGoerli.json
- Base deployments found in
deployments/Base.json
- Base Goerli deployments found in
deployments/BaseGoerli.json
See
audits/
folder
- Internal audits found in
audits/internal/
- External audits found in
audits/external/