# Berachain Contracts ## Usage This is a list of the most frequently needed commands. ### Build Build the contracts: ```sh $ forge build ``` ### Clean Delete the build artifacts and cache directories: ```sh $ forge clean ``` ### Compile Compile the contracts: ```sh $ forge build ``` ### Coverage Get a test coverage report: ```sh $ forge coverage ``` ### Deploy Deploy to Anvil: ```sh $ 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](https://iancoleman.io/bip39/). For instructions on how to deploy to a testnet or mainnet, check out the [Solidity Scripting](https://book.getfoundry.sh/tutorials/solidity-scripting.html) tutorial. ### Format Format the contracts: ```sh $ forge fmt ``` ### Gas Usage Get a gas report: ```sh $ forge test --gas-report ``` ### Lint Lint the contracts: ```sh $ bun run lint ``` ### Test Run the tests: ```sh $ forge test ``` Generate test coverage and output result to the terminal: ```sh $ bun run test:coverage ``` Generate test coverage with lcov report (you'll have to open the `./coverage/index.html` file in your browser, to do so simply copy paste the path): ```sh $ bun run test:coverage:report ``` ## Related Efforts - [abigger87/femplate](https://github.com/abigger87/femplate) - [cleanunicorn/ethereum-smartcontract-template](https://github.com/cleanunicorn/ethereum-smartcontract-template) - [foundry-rs/forge-template](https://github.com/foundry-rs/forge-template) - [FrankieIsLost/forge-template](https://github.com/FrankieIsLost/forge-template) ## License This project is licensed under BUSL 1.1. ## Solstat Follow instructions to install [solstat](https://github.com/0xKitsune/solstat) locally and run. Currently, named parameters in mappings causes solstat to panic and is unable to produce the solstat_report.md ([issue](https://github.com/0xKitsune/solstat/issues/87)).