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.
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.
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.
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.
adjisb
left a comment
There was a problem hiding this comment.
- If git submodules is the foundry way of doing things 👎 maybe we must install forge-std as a submodule (the files inside
lib/forge-stdcan 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-foundrypackage directory and run following commands:Download foundry on your machine:
curl -L https://foundry.paradigm.xyz | bashSetup foundry:
You should now be able to successfully run:
Testing
Build contracts:
Run tests:
forge testDeploy to local test network:
Run local network
Deploy contracts:
Note: Above PK is derived from
test junkmnemonic account 0.