git clone [email protected]:Semios-Protocol/SemiOS-contract.git
cd SemiOS-contract
pnpm install # install Solhint, Prettier, and other Node.js depsThis is a list of the most frequently needed commands.
Build the contracts:
$ npm installBuild the contracts:
$ forge buildDelete the build artifacts and cache directories:
$ forge cleanCompile the contracts:
$ forge buildGet a test coverage report:
$ forge coverageDeploy to Anvil:
$ ENV=<your env> forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545For 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:8545After 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.shFiles are generated in path deployed-contract-info
Format the contracts:
$ forge fmtGet a gas report:
$ forge test --gas-reportLint the contracts:
$ pnpm lintRun the tests:
$ forge testauto 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
.envfile, 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.