generated from rhinestonewtf/module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 89a028c
Showing
19 changed files
with
5,318 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
PK= | ||
DEPLOYMENT_SENDER= | ||
DEPLOYMENT_RPC= | ||
ETHERSCAN_API_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-lint.yaml@main" | ||
|
||
build: | ||
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-build.yaml@main" | ||
|
||
test: | ||
needs: ["lint", "build"] | ||
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test.yaml@main" | ||
with: | ||
foundry-fuzz-runs: 5000 | ||
foundry-profile: "test" | ||
match-path: "test/**/*.sol" | ||
|
||
test-simulate: | ||
needs: ["lint", "build"] | ||
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-simulate.yaml@main" | ||
with: | ||
foundry-fuzz-runs: 5000 | ||
foundry-profile: "test" | ||
match-path: "test/**/*.sol" | ||
|
||
test-multi-account: | ||
needs: ["lint", "build"] | ||
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-multi-account.yaml@main" | ||
with: | ||
foundry-fuzz-runs: 5000 | ||
foundry-profile: "test" | ||
match-path: "test/**/*.sol" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Compiler files | ||
cache/ | ||
out/ | ||
broadcast | ||
|
||
# Docs | ||
docs/ | ||
|
||
# Dotenv file | ||
.env | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shamefully-hoist=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"avoid-low-level-calls": "off", | ||
"code-complexity": ["error", 9], | ||
"compiler-version": ["error", ">=0.8.0"], | ||
"contract-name-camelcase": "off", | ||
"const-name-snakecase": "off", | ||
"func-name-mixedcase": "off", | ||
"func-visibility": ["error", { "ignoreConstructors": true }], | ||
"max-line-length": ["error", 123], | ||
"named-parameters-mapping": "warn", | ||
"no-empty-blocks": "off", | ||
"not-rely-on-time": "off", | ||
"one-contract-per-file": "off", | ||
"var-name-mixedcase": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
test/ | ||
script/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
## Module Template | ||
|
||
**A template for building smart account modules using the [ModuleKit](https://github.com/rhinestonewtf/modulekit)** | ||
|
||
## Using the template | ||
|
||
### Install dependencies | ||
|
||
```shell | ||
pnpm install | ||
``` | ||
|
||
### Update ModuleKit | ||
|
||
```shell | ||
pnpm update rhinestonewtf/modulekit | ||
``` | ||
|
||
### Building modules | ||
|
||
1. Create a new file in `src` and inherit from the appropriate interface (see templates) | ||
2. After you finished writing your module, run the following command: | ||
|
||
```shell | ||
forge build | ||
``` | ||
|
||
### Testing modules | ||
|
||
1. Create a new `.t.sol` file in `test` and inherit from the correct testing kit (see templates) | ||
2. After you finished writing your tests, run the following command: | ||
|
||
```shell | ||
forge test | ||
``` | ||
|
||
### Deploying modules | ||
|
||
1. Import your modules into the `script/DeployModule.s.sol` file. | ||
2. Create a `.env` file in the root directory based on the `.env.example` file and fill in the variables. | ||
3. Run the following command: | ||
|
||
```shell | ||
source .env && forge script script/DeployModule.s.sol:DeployModuleScript --rpc-url $DEPLOYMENT_RPC --broadcast --sender $DEPLOYMENT_SENDER --verify | ||
``` | ||
|
||
Your module is now deployed to the blockchain and verified on Etherscan. | ||
|
||
If the verification fails, you can manually verify it on Etherscan using the following command: | ||
|
||
```shell | ||
source .env && forge verify-contract --chain-id [YOUR_CHAIN_ID] --watch --etherscan-api-key $ETHERSCAN_API_KEY [YOUR_MODULE_ADDRESS] src/[PATH_TO_MODULE].sol:[MODULE_CONTRACT_NAME] | ||
``` | ||
|
||
## Tutorials | ||
|
||
For general explainers and guided walkthroughs of building a module, check out our [documentation](https://docs.rhinestone.wtf/modulekit). | ||
|
||
## Using this repo | ||
|
||
To install the dependencies, run: | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
To build the project, run: | ||
|
||
```bash | ||
forge build | ||
``` | ||
|
||
To run the tests, run: | ||
|
||
```bash | ||
forge test | ||
``` | ||
|
||
## Contributing | ||
|
||
For feature or change requests, feel free to open a PR, start a discussion or get in touch with us. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[profile.default] | ||
emv_version = "paris" | ||
src = "src" | ||
out = "out" | ||
script = "script" | ||
libs = ["node_modules"] | ||
fs_permissions = [{ access = "read", path = "out-optimized" }, { access = "read-write", path = "gas_calculations" }] | ||
allow_paths = ["*", "/"] | ||
|
||
[rpc_endpoints] | ||
mainnet = "${MAINNET_RPC_URL}" | ||
|
||
[fmt] | ||
bracket_spacing = true | ||
int_types = "long" | ||
line_length = 100 | ||
multiline_func_header = "all" | ||
number_underscore = "thousands" | ||
quote_style = "double" | ||
tab_width = 4 | ||
wrap_comments = true |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "@rhinestone/module-template", | ||
"version": "0.4.1", | ||
"description": "A Foundry template for building modules using the ModuleKit", | ||
"license": "GPL-3.0", | ||
"author": { | ||
"name": "Rhinestone", | ||
"url": "https://rhinestone.wtf" | ||
}, | ||
"scripts": { | ||
"build": "forge build", | ||
"build:optimized": "FOUNDRY_PROFILE=optimized forge build", | ||
"build:smt": "FOUNDRY_PROFILE=smt forge build", | ||
"clean": "rm -rf artifacts broadcast cache docs out out-optimized out-svg", | ||
"gas:report": "forge test --gas-report --mp \"./test/integration/**/*.sol\" --nmt \"test(Fuzz)?_RevertWhen_\\w{1,}?\"", | ||
"gas:snapshot": "forge snapshot --mp \"./test/integration/**/*.sol\" --nmt \"test(Fuzz)?_RevertWhen_\\w{1,}?\"", | ||
"gas:snapshot:optimized": "pnpm run build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --mp \"./test/integration/**/*.sol\" --nmt \"test(Fork)?(Fuzz)?_RevertWhen_\\w{1,}?\"", | ||
"lint": "pnpm run lint:sol && bun run prettier:check", | ||
"lint:sol": "forge fmt --check && pnpm solhint \"{script,src,test}/**/*.sol\"", | ||
"prepack": "pnpm install && bash ./shell/prepare-artifacts.sh", | ||
"prettier:check": "prettier --check \"**/*.{json,md,svg,yml}\"", | ||
"prettier:write": "prettier --write \"**/*.{json,md,svg,yml}\"", | ||
"test": "forge test", | ||
"test:lite": "FOUNDRY_PROFILE=lite forge test", | ||
"test:optimized": "pnpm run build:optimized && FOUNDRY_PROFILE=test-optimized forge test" | ||
}, | ||
"dependencies": { | ||
"@rhinestone/modulekit": "^0.4.5" | ||
}, | ||
"files": [ | ||
"src", | ||
"test", | ||
"script", | ||
"package.json", | ||
"foundry.toml", | ||
"remappings.txt" | ||
], | ||
"homepage": "https://docs.rhinestone.wtf/module-template", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/rhinestonewtf/module-template.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/rhinestonewtf/module-template/issues" | ||
}, | ||
"keywords": [ | ||
"account abstraction", | ||
"smart account modules", | ||
"module template" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.