2023-08-28 11:27:47 +00:00
|
|
|
# Communities Contracts [![Github Actions][gha-badge]][gha] [![Foundry][foundry-badge]][foundry]
|
2023-01-19 11:21:41 +00:00
|
|
|
|
2023-08-28 11:27:47 +00:00
|
|
|
[gha]: https://github.com/status-im/communities-contracts/actions
|
2023-09-19 09:46:15 +00:00
|
|
|
[gha-badge]: https://github.com/status-im/communities-contracts/actions/workflows/test.yml/badge.svg
|
2023-08-28 11:27:47 +00:00
|
|
|
[foundry]: https://getfoundry.sh/
|
|
|
|
[foundry-badge]: https://img.shields.io/badge/Built%20with-Foundry-FFDB1C.svg
|
2023-01-19 11:21:41 +00:00
|
|
|
|
2023-08-28 11:27:47 +00:00
|
|
|
## Usage
|
2023-01-19 11:21:41 +00:00
|
|
|
|
2023-08-28 11:27:47 +00:00
|
|
|
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/DeployOwnerToken.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
|
|
|
|
$ pnpm lint
|
|
|
|
```
|
|
|
|
|
|
|
|
### Test
|
|
|
|
|
|
|
|
Run the tests:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ forge test
|
2023-01-19 11:21:41 +00:00
|
|
|
```
|