richΛrd 3fea0a5201
refactor: do not keep track of membership registration order (#14)
* refactor: do not keep track of membership registration order
* unify terminology for mdetails
* more DRY in LinearPriceCalculator
* improve terminology consistency (#16)
* refactor, minor fixes
* do not reset ongoing grace period on extension (cf. spec change)
* minor renaming, comments
* refactor, group functions by funcitonality
* extract membership expiration calculation to internal function
* save active duration per membership (must carry over after extension)
* optional lazy erasure from membership set
* minor fixes in tests
* fix: off-by-one: end index can't be equal to next free index
* minor refactoring, comments
* define period boundaries: start inclusive, end exclusive
* separate eraseMembership functions to user-focused (lazy) and admin-focused (tree cleanup)
* minor fix to maintain line lengths
* unify membership-related events
* add test for  zero grace period
* fix typo in comment

Co-authored-by: richΛrd <info@richardramos.me>

---------

Co-authored-by: richΛrd <info@richardramos.me>

* code review

* refactor: unique register function

* fix: split errors of `_eraseMembershipLazily`

* chore: minor naming clarifications

---------

Co-authored-by: Sergei Tikhomirov <sergey.s.tikhomirov@gmail.com>
2024-10-08 08:58:43 -04:00
2024-05-21 00:46:20 +00:00
2024-05-30 19:21:55 +05:30
2024-05-22 00:04:00 +05:30
2024-05-21 00:46:20 +00:00
2024-05-21 00:46:20 +00:00
2024-05-21 00:46:20 +00:00
2024-05-21 00:46:20 +00:00
2024-05-21 00:46:20 +00:00
2024-05-21 00:46:20 +00:00
2024-05-21 00:46:20 +00:00
2024-05-30 19:21:55 +05:30
2024-05-21 00:46:20 +00:00
2024-09-05 17:17:49 -04:00
2024-05-21 00:46:20 +00:00
2024-05-21 00:46:20 +00:00

waku-rlnv2-contract Github Actions Foundry License: MIT

Waku's RLNv2 contracts, which include -

  • LazyIMT, which allows the root of the chain to be accessible on-chain.

What's Inside

  • 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

Usage

This is a list of the most frequently needed commands.

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:

$ 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.

Deploy to Sepolia:

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

Format the contracts:

$ forge fmt

Gas Usage

Get a gas report:

$ forge test --gas-report

Lint

Lint the contracts:

$ pnpm lint

Fixing linting issues

For any errors in solidity files, run forge fmt. For errors in any other file type, run pnpm prettier:write.

Test

Run the tests:

$ forge test

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.

License

This project is licensed under MIT.

Description
rln-v2 Contracts for Waku
Readme
Languages
Shell 100%