-
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
Showing
11 changed files
with
164 additions
and
16 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 @@ | ||
{ | ||
"name": "My Codespace", | ||
"postCreateCommand": "curl -L https://foundry.paradigm.xyz | bash && source ~/.bashrc && foundryup" | ||
} |
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, μ: 63252, ~: 69216) | ||
TesterTest:testTest() (gas: 27690) |
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,58 @@ | ||
name: ci | ||
|
||
on: [push] | ||
|
||
jobs: | ||
tests: | ||
name: Forge Testing | ||
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: | ||
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 | ||
|
||
scripts: | ||
strategy: | ||
fail-fast: true | ||
name: Run Unix Scripts | ||
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 build --sizes | ||
continue-on-error: true | ||
- name: Run scripts | ||
run: | | ||
ls -lsa | ||
ls script/ | ||
for file in script/*; do | ||
forge script $file | ||
done |
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 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std |
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 |
---|---|---|
@@ -1,2 +1,44 @@ | ||
# zenplate | ||
The simplest foundry template for contract testing. | ||
# zenplate [![tests](https://github.com/z0r0z/zenplate/actions/workflows/ci.yml/badge.svg?label=tests)](https://github.com/z0r0z/zenplate/actions/workflows/ci.yml) [![Foundry][foundry-badge]][foundry] [![License: AGPL-3.0-only][license-badge]][license]![solidity](https://img.shields.io/badge/solidity-%5E0.8.19-black) | ||
|
||
[foundry]: https://getfoundry.sh/ | ||
[foundry-badge]: https://img.shields.io/badge/Built%20with-Foundry-FFDB1C.svg | ||
[license]: https://opensource.org/license/agpl-v3/ | ||
[license-badge]: https://img.shields.io/badge/License-AGPL-black.svg | ||
|
||
A very simple foundry template for contract testing. | ||
|
||
### Usage | ||
|
||
**Building & Testing** | ||
|
||
Build the foundry project with `forge build`. Run tests with `forge test`. Measure gas with `forge snapshot`. Format with `forge fmt`. | ||
|
||
### GitHub Actions | ||
|
||
This template comes with GitHub Actions pre-configured. Your contracts will be linted and tested on every push and pull | ||
request made to the `main` branch. | ||
|
||
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 — Example Contract Deployment Script | ||
src | ||
├─ Tester — Test Contract | ||
test | ||
└─ Tester.t - Testing Contract | ||
### Notable Mentions | ||
- [femplate](https://github.com/refcell/femplate) | ||
- [foundry-template](https://github.dev/PaulRBerg/foundry-template) | ||
### Disclaimer | ||
_These smart contracts are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the user interface or the smart contracts. They have not been audited and as such there can be no assurance they 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._ | ||
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,10 @@ | ||
[profile.default] | ||
solc = "0.8.19" | ||
optimizer_runs = 9_999_999 | ||
|
||
remappings = [ | ||
"@forge=lib/forge-std/src/" | ||
] | ||
|
||
[rpc_endpoints] | ||
mainnet = "https://rpc.ankr.com/eth" |
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,13 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
pragma solidity ^0.8.19; | ||
|
||
import {Script} from "@forge/Script.sol"; | ||
import {Tester} from "src/Tester.sol"; | ||
|
||
contract Deploy is Script { | ||
function run() public payable returns (Tester tester) { | ||
vm.startBroadcast(); | ||
tester = new Tester(); | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file was deleted.
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,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,15 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
pragma solidity ^0.8.19; | ||
|
||
import "../src/Tester.sol"; | ||
import "@forge/Test.sol"; | ||
|
||
contract TesterTest is Test { | ||
Tester immutable tester = new Tester(); | ||
|
||
function setup() public {} | ||
|
||
function testTest() public { | ||
tester.test("ommm"); | ||
} | ||
} |