-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example foundry package #1287
base: master
Are you sure you want to change the base?
Example foundry package #1287
Conversation
Some comments / next steps:
|
We should ideally be able to run all tests etc for all packages at root level in the monorepo, so we may need to review our CI |
…art-contracts into example-foundry
name: test | ||
|
||
on: workflow_dispatch | ||
|
||
env: | ||
FOUNDRY_PROFILE: ci | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
fail-fast: true | ||
|
||
name: Foundry project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Run Forge build | ||
run: | | ||
forge --version | ||
forge build --sizes | ||
id: build | ||
|
||
- name: Run Forge tests | ||
run: | | ||
forge test -vvv | ||
id: test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need this file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, since we run those from the root we don't need it here.
[profile.default] | ||
src = "src" | ||
out = "artifacts" | ||
libs = ["lib"] | ||
remappings = [ | ||
"@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/", | ||
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/", | ||
"ds-test/=lib/forge-std/lib/ds-test/src/", | ||
"forge-std/=lib/forge-std/src/", | ||
] | ||
|
||
# OPTIMIZER SETTINGS | ||
optimizer = true | ||
optimizer_runs = 200 | ||
|
||
# RPC SETTINGS | ||
|
||
[rpc_endpoints] | ||
default = "http://localhost:8545" | ||
mumbai = "https://rpc-mumbai.maticvigil.com/" | ||
|
||
# ETHERSCAN SETTINGS | ||
|
||
[etherscan] | ||
mumbai = { key = "YOUR_API_KEY_HERE" } | ||
|
||
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this file contains secrets maybe is better to rename it to foundry.toml.example
and add foundry.toml
to git ignore file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can import env secrets into foundry.toml
there is no need to create .example
.
I will update it slightly so its shown how to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If git submodules is the foundry way of doing things 👎 maybe we must install forge-std as a submodule (the files inside
lib/forge-std
can be removed from this PR)? - If we decide to base everything on hardhat maybe we must consider https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-foundry to use the npm scripts (using npm implies using nodejs anyway)
- We may need an explanation on the rust toolchain foundry uses and how to install it, use it, etc ?
|
Description
This PR introduces base Foundry package setup.
Documentation for Foundry: https://book.getfoundry.sh/
Setup
Navigate to the
example-foundry
package directory and run following commands:Download foundry on your machine:
curl -L https://foundry.paradigm.xyz | bash
Setup foundry:
You should now be able to successfully run:
Testing
Build contracts:
Run tests:
forge test
Deploy to local test network:
Run local network
Deploy contracts:
Note: Above PK is derived from
test junk
mnemonic account 0.