Waku's RLNv2 contracts, which include -
- LazyIMT, which allows the root of the chain to be accessible on-chain.
- Forge: compile, test, fuzz, format, and deploy smart contracts
- Forge Std: collection of helpful contracts and cheatcodes for testing
- Solhint Community: linter for Solidity code
pnpm
(installation instructions)
Install dependencies before first run:
pnpm install
This is a list of the most frequently needed commands.
Build the contracts:
$ forge build
Delete the build artifacts and cache directories:
$ forge clean
Compile the contracts:
$ forge build
Get a test coverage report:
$ forge coverage
$ TOKEN_ADDRESS=0x1122334455667788990011223344556677889900 forge script script/Deploy.s.sol --broadcast --rpc-url localhost --tc Deploy
Replace the TOKEN_ADDRESS
value by a token address you have deployed on anvil. A TestToken
is available in
test/TestToken.sol
and can be deployed with
forge script test/TestToken.sol --broadcast --rpc-url localhost --tc TestTokenFactory
For this script to work, you need to have a MNEMONIC
environment variable set to a valid
BIP39 mnemonic.
Ensure that you use the cast wallet to store private keys that will be used in deployments.
$ export RPC_URL=<rpc-url>
$ export ACCOUNT=<account name in foundry keystore>
$ pnpm deploy:sepolia
Format the contracts:
$ forge fmt
Get a gas report:
$ forge test --gas-report
Lint the contracts:
$ pnpm lint
For any errors in solidity files, run forge fmt
. For errors in any other file type, run pnpm prettier:write
.
Run the tests:
$ forge test
- 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
.env
file, but filling in the environment variables may be useful when debugging and testing against a fork.
The contract implementation aims to follow the specification that also describes ownership (see Governance and upgradability section).
As of commit afb858, the Owner
privileges are assigned to the msg.sender
of the membership registration transaction.
The Owner
has the following privileges:
- set the token and price of one message published per epoch (link);
- authorize upgrades to a new implementation contract (link);
- set the price calculator contract address (link);
- set the maximum total rate limit of all memberships in the membership set (link);
- set the minimum (link) and maximum (link) rate limit of one membership;
- set the duration of the active period (link) and grace period (link) of new memberships (see the state transition diagram of a membership).
The pause functionality for contract functions is not yet implemented.
This project is licensed under MIT.