Skip to content

Latest commit

 

History

History
136 lines (88 loc) · 2.83 KB

README.md

File metadata and controls

136 lines (88 loc) · 2.83 KB

Getting Started

git clone git@github.com:Semios-Protocol/SemiOS-contract.git
cd SemiOS-contract
pnpm install # install Solhint, Prettier, and other Node.js deps

Usage

This is a list of the most frequently needed commands.

install package

Build the contracts:

$ npm install

Build

Build the contracts:

$ forge build

Clean

Delete the build artifacts and cache directories:

$ forge clean

Compile

Compile the contracts:

$ forge build

Coverage

Get a test coverage report:

$ forge coverage

Deploy

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.

Generate abi and selectors

$ bash updateAbiANDSelector.sh

Files are generated in path deployed-contract-info

Format

Format the contracts:

$ forge fmt

Gas Usage

Get a gas report:

$ forge test --gas-report

Lint

Lint the contracts:

$ pnpm lint

Test

Run the tests:

$ forge test

auto test on push is specified in .github/workflows/main.yml

Notes

  1. Foundry uses git submodules to manage dependencies. For detailed instructions on working with dependencies, please refer to the guide in the book
  2. 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.

Related Efforts

License

This project is licensed under MIT.