generated from z0r0z/zenplate
-
Notifications
You must be signed in to change notification settings - Fork 7
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 f5c4d88
Showing
12 changed files
with
835 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,29 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu. | ||
{ | ||
"name": "Ubuntu", | ||
// Or, use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile. | ||
"image": "mcr.microsoft.com/devcontainers/base:jammy", | ||
"features": { | ||
"ghcr.io/devcontainers/features/rust:1": { | ||
"version": "latest", | ||
"profile": "default" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"JuanBlanco.solidity" | ||
] | ||
} | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "curl -L https://foundry.paradigm.xyz | bash && source /home/vscode/.bashrc && foundryup" | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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,2 @@ | ||
Tester:test(string) (runs: 256, μ: 47361, ~: 24565) | ||
TesterTest:testTest() (gas: 27613) |
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,36 @@ | ||
name: ci | ||
|
||
on: [push] | ||
|
||
jobs: | ||
tests: | ||
name: Forge Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
- name: dependencies | ||
run: forge install | ||
- name: tests | ||
run: forge test | ||
|
||
snapshot: | ||
name: Forge Snapshot | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
- name: dependencies | ||
run: forge install | ||
- name: check contract sizes | ||
run: forge build --sizes | ||
- name: check gas snapshots | ||
run: forge snapshot --check |
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,2 @@ | ||
out | ||
cache |
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,6 @@ | ||
[submodule "lib/solady"] | ||
path = lib/solady | ||
url = https://github.com/vectorized/solady | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std |
Large diffs are not rendered by default.
Oops, something went wrong.
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,43 @@ | ||
# [zenplate](https://github.com/z0r0z/zenplate) [![License: AGPL-3.0-only](https://img.shields.io/badge/License-AGPL-black.svg)](https://opensource.org/license/agpl-v3/) [![solidity](https://img.shields.io/badge/solidity-%5E0.8.19-black)](https://docs.soliditylang.org/en/v0.8.19/) [![Foundry](https://img.shields.io/badge/Built%20with-Foundry-000000.svg)](https://getfoundry.sh/) ![tests](https://github.com/z0r0z/zenplate/actions/workflows/ci.yml/badge.svg) | ||
|
||
Simpler foundry template. | ||
|
||
## Getting Started | ||
|
||
Click [`use this template`](https://github.com/z0r0z/zenplate/generate) to start. | ||
|
||
Run: `curl -L https://foundry.paradigm.xyz | bash && source ~/.bashrc && foundryup` | ||
|
||
Build the foundry project with `forge build`. Run tests with `forge test`. Measure gas with `forge snapshot`. Format with `forge fmt`. | ||
|
||
## GitHub Actions | ||
|
||
Contracts will be tested and gas measured on every push and pull request. | ||
|
||
You can edit the CI script in [.github/workflows/ci.yml](./.github/workflows/ci.yml). | ||
|
||
## Blueprint | ||
|
||
```txt | ||
lib | ||
├─ forge-std — https://github.com/foundry-rs/forge-std | ||
scripts | ||
├─ Deploy.s.sol — Test Deployment | ||
src | ||
├─ Tester — Tester Contract | ||
test | ||
└─ Tester.t - Test Contract | ||
``` | ||
|
||
## Notable Mentions | ||
|
||
- [femplate](https://github.com/refcell/femplate) | ||
- [prb-foundry-template](https://github.dev/PaulRBerg/foundry-template) | ||
|
||
## Disclaimer | ||
|
||
*These smart contracts and testing suite are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of anything provided herein or through related user interfaces. This repository and related code have not been audited and as such there can be no assurance anything will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.* | ||
|
||
## License | ||
|
||
See [LICENSE](./LICENSE) for more details. |
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,19 @@ | ||
[profile.default] | ||
solc_version = "0.8.24" | ||
evm_version = "shanghai" | ||
|
||
optimizer = true | ||
optimizer_runs = 9_999_999 | ||
|
||
[profile.via-ir] | ||
via_ir = true | ||
|
||
[fmt] | ||
line_length = 100 | ||
|
||
[rpc_endpoints] | ||
main = "https://rpc.ankr.com/eth" | ||
base = "https://rpc.ankr.com/base" | ||
poly = "https://rpc.ankr.com/polygon" | ||
opti = "https://rpc.ankr.com/optimism" | ||
arbi = "https://rpc.ankr.com/arbitrum" |
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,14 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
pragma solidity ^0.8.19; | ||
|
||
contract Tester { | ||
event Tested(string _data); | ||
|
||
string public data; | ||
|
||
function test(string calldata _data) public payable { | ||
data = _data; | ||
|
||
emit Tested(_data); | ||
} | ||
} |
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 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
pragma solidity ^0.8.19; | ||
|
||
import {Tester} from "../src/Tester.sol"; | ||
import {Test} from "../lib/forge-std/src/Test.sol"; | ||
|
||
contract TesterTest is Test { | ||
Tester immutable tester = new Tester(); | ||
|
||
function setUp() public payable { | ||
// vm.createSelectFork(vm.rpcUrl('main')); // Ethereum mainnet fork. | ||
// vm.createSelectFork(vm.rpcUrl('base')); // Base OptimismL2 fork. | ||
// vm.createSelectFork(vm.rpcUrl('poly')); // Polygon network fork. | ||
// vm.createSelectFork(vm.rpcUrl('opti')); // Optimism EthL2 fork. | ||
// vm.createSelectFork(vm.rpcUrl('arbi')); // Arbitrum EthL2 fork. | ||
} | ||
|
||
function testTest() public payable { | ||
tester.test("ommm"); | ||
} | ||
} |