See spec for current protocol specification. For details on how to build and run a custom minter instance, see section "Adding a custom minter module" section in spec.
- git
- nodeJS
- node version manager
- pnpm - You need to have
pnpm
installed globally, you can runnpm i -g pnpm
to install it. - brew
- foundry - You can run
sh ./setup.sh
to install Foundry and its dependencies.
- Clone the repository
git clone git@github.com:soundxyz/sound-protocol.git
cd sound-protocol
- Setup node version
Either install the version specified in
nvmrc
or usenvm
to set it up:
nvm use
- Install packages
pnpm install
- Build contracts
pnpm build
- Run tests
pnpm test
- Print gas reports from tests
pnpm test:gas
We generally follow OpenZeppelin's conventions:
- Underscore
_before
private variables. - Underscore
after_
function arguments which shadow globals. - Natspec format for comments, using
@dev
for function descriptions.
To run prettier on all solidity files, uncomment the last line in .prettierrc.js
, then run npx prettier --write ./contracts/**/*.sol
To see logs when testing (v
== verbosity):
forge test -vvv
Code coverage:
We use codecov for analysing the code coverage reports generated by forge coverage. To view code coverage locally, you'll need to install lcov
(mac: brew install lcov
) and run:
pnpm test:coverage
This will produce the coverage report in /coverage
folder. Note that forge coverage
is still in active development so it often claims if/else branches are uncovered even when there are tests executed on them.
Create a .env in the root with:
PRIVATE_KEY=...
ETHERSCAN_KEY=...
# Make one of these for every network
GOERLI_RPC_URL=...
Then run:
pnpm deploy:goerli
According to the foundry docs, we should be able to verify on etherscan by appending this to the above command: --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv
, but that doesn't seem to work. Instead, we can verify each contract individually. Ex:
forge verify-contract --chain-id 5 --num-of-optimizations 200 --compiler-version v0.8.15 0x4613283c53669847c40eb0cf7946f1fb30b1f030 contracts/modules/Metadata/GoldenEggMetadataModule.sol:GoldenEggMetadataModule