Skip to content

Commit

Permalink
πŸ“š βš™οΈ Update Readme etc. with magin paymaster stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyrharper committed Jul 16, 2024
1 parent 84dce55 commit fc52c3b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
13 changes: 3 additions & 10 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
MAINNET_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/KEY
OPTIMISM_RPC_URL=https://opt-mainnet.g.alchemy.com/v2/KEY
BASE_RPC_URL=https://base-mainnet.g.alchemy.com/v2/KEY
GOERLI_RPC_URL=https://eth-goerli.g.alchemy.com/v2/KEY
OPTIMISM_GOERLI_RPC_URL=https://opt-goerli.g.alchemy.com/v2/KEY
BASE_GOERLI_RPC_URL=https://base-goerli.g.alchemy.com/v2/KEY
PRIVATE_KEY=KEY
ETHERSCAN_API_KEY=KEY
OPTIMISM_ETHERSCAN_API_KEY=KEY
BASESCAN_API_KEY=KEY
BASE_URL=https://base-mainnet.g.alchemy.com/v2/<KEY>
BASESCAN_API_KEY=KEY
ETHERSCAN_API_KEY=KEY
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# foundry-scaffold
# Margin Paymaster

[![Github Actions][gha-badge]][gha]
[![Foundry][foundry-badge]][foundry]
Expand All @@ -11,26 +11,29 @@
[license]: https://opensource.org/license/GPL-3.0/
[license-badge]: https://img.shields.io/badge/GitHub-GPL--3.0-informational

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

## Getting Started

1. Create an `.env` file using the `.env.example` file as a template
2. Update `package.json` with your project name, description, etc.
3. Update the `README.md` with your project name, description, etc.
4. Add required **Repository Secrets** to your github repository settings
> Navigate to `Settings > Secrets and variables > Actions` and add whatever secrets are required for your project's CI.
5. The current template CI will fail until the following repository secrets are added: `OPTIMISM_GOERLI_RPC_URL` and `ETHERSCAN_API_KEY`. See `.github/workflows/*` for more details.
6. Finally, run `npm run coverage:generate-lcov` to generate a coverage report for your project and commit the results to your remote repository
> This will be used by the CI to determine when changes to your project have caused the coverage to drop below a certain threshold.
The `MarginPaymaster` will attempt to recoup gas costs in USDC from a users smart wallet account and failing that their SNX-V3 margin.

## Contracts

> `tree src/`
```
src/
└── Counter.sol
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
Expand All @@ -43,17 +46,18 @@ src/
npm run compile
```

3. Execute tests (requires rpc url(s) to be set in `.env`)
3. Create an `.env` file using the `.env.example` file as a template

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

```
npm run test
```

4. Run specific test
> `OPTIMISM_GOERLI_RPC_URL` can be replaced with `OPTIMISM_RPC_URL` if a mainnet fork is desired

```
forge test --fork-url $(grep OPTIMISM_GOERLI_RPC_URL .env | cut -d '=' -f2) --match-test TEST_NAME -vvv
forge test -vv --fork-url $(grep BASE_URL .env | cut -d '=' -f2) --mt TEST_NAME
```

## Deployment Addresses
Expand All @@ -70,4 +74,4 @@ forge test --fork-url $(grep OPTIMISM_GOERLI_RPC_URL .env | cut -d '=' -f2) --ma
> See `audits/` folder
1. Internal audits found in `audits/internal/`
2. External audits found in `audits/external/`
2. External audits found in `audits/external/`
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "foundry-scaffold",
"name": "margin-paymaster",
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"homepage": "https://github.com/Kwenta/foundry-scaffold#readme",
Expand Down

0 comments on commit fc52c3b

Please sign in to comment.