git clone git@github.com:Semios-Protocol/SemiOS-contract.git
cd SemiOS-contract
pnpm install # install Solhint, Prettier, and other Node.js deps
This is a list of the most frequently needed commands.
Build the contracts:
$ npm install
Build the contracts:
$ forge build
Delete the build artifacts and cache directories:
$ forge clean
Compile the contracts:
$ forge build
Get a test coverage report:
$ forge coverage
Deploy to Anvil:
$ ENV=<your env> forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545
For this script to work, you need to have a MNEMONIC
environment variable set to a valid
BIP39 mnemonic, or providing the private key by adding --private-key=
It is also required that the path deployed-contract-info/-d4a.json exsits and neccessary keys for contract names are prepared. You can see deployed-contract-info/test-d4a.json as an example and run
$ ENV=test forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545
After deploying, all contracts' addresses are recorded in deployed-contract-info/-d4a.json. Make sure that the environment name in your deploy commond is consistent with the contract address file name prefix before "-d4a.json"
For instructions on how to deploy to a testnet or mainnet, check out the Solidity Scripting tutorial.
$ bash updateAbiANDSelector.sh
Files are generated in path deployed-contract-info
Format the contracts:
$ forge fmt
Get a gas report:
$ forge test --gas-report
Lint the contracts:
$ pnpm lint
Run the tests:
$ forge test
auto test on push is specified in .github/workflows/main.yml
- Foundry uses git submodules to manage dependencies. For detailed instructions on working with dependencies, please refer to the guide in the book
- You don't have to create a
.env
file, but filling in the environment variables may be useful when debugging and testing against a fork.
- abigger87/femplate
- cleanunicorn/ethereum-smartcontract-template
- foundry-rs/forge-template
- FrankieIsLost/forge-template
This project is licensed under MIT.