Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
z0r0z authored Dec 17, 2024
0 parents commit 6441f81
Show file tree
Hide file tree
Showing 11 changed files with 808 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Tester:test(string) (runs: 256, μ: 47790, ~: 24790)
TesterTest:testTest() (gas: 29940)
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out
cache
6 changes: 6 additions & 0 deletions .gitmodules
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
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# [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.25-black)](https://docs.soliditylang.org/en/v0.8.25/) [![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
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.
24 changes: 24 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[profile.default]
solc_version = "0.8.26"
evm_version = "cancun"

optimizer = true
optimizer_runs = 9_999_999

remappings = [
"@solady=lib/solady/",
"@forge=lib/forge-std/src/"
]

[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"
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at 75b3fc
1 change: 1 addition & 0 deletions lib/solady
Submodule solady added at 65a32c
12 changes: 12 additions & 0 deletions src/Tester.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// 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 {
emit Tested(data = _data);
}
}
22 changes: 22 additions & 0 deletions test/Tester.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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 internal 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.
tester = new Tester();
}

function testTest() public payable {
tester.test("ommm");
}
}

0 comments on commit 6441f81

Please sign in to comment.