Skip to content

Community Staking Module is the first ever permissionless staking module in Lido

License

Notifications You must be signed in to change notification settings

lidofinance/community-staking-module

Repository files navigation

CSM Logo

Lido Community Staking Module

This project is under heavy development. Do not consider any code as final.

Getting Started

just deps
  • Config environment variables
cp .env.sample .env

Fill vars in the .env file with your own values

  • Build and test contracts
just

Run tests

Run unit tests only

just test-unit

For the following tests, make sure that the following variables are set in the .env file:

export CHAIN=devnet
export RPC_URL=

Deploy CSM to the fork and run deployment and integration tests over it

just test-local

Run all tests in one (unit, deployment, integration)

just test-all

Make a gas report

It requires all unit tests to be green

just gas-report

Add new dependencies

Dependencies are managed using yarn. To install new dependencies, run:

yarn add <package-name>

Whenever you install new libraries using yarn, make sure to update your remappings.txt.

Advanced testing scenarios using local fork

Deploy contracts to the local fork

just deploy-local

Set up environment for the local fork Further test commands require the following environment variables to be set:

export RPC_URL=http://127.0.0.1:8545
export DEPLOY_CONFIG=./artifacts/local/deploy-devnet.json

The result of deployment is ./artifacts/local/deploy-devnet.json deployment config, which is required for integration testing

Verify deploy by running deployment tests. Note that these are meant to be run only right after deployment, so they don't supposed to be green after any actions in the contracts

just test-deployment

Integration tests should pass either before a vote, or after at any state of contracts

just test-integration

There also fork helper scripts to prepare a fork state for e.g. UI testing purposes

just simulate-vote

After a vote, you can test the contracts in the new state. It includes both integration and post-voting tests

just test-post-voting

Kill fork after testing

just kill-fork

Deploy on a chain

The following commands are related to the deployment process:

  • Dry run of deploy script to be sure it works as expected
just deploy-prod-dry
  • Broadcast transactions

Note: pass --legacy arg in case of the following error: Failed to get EIP-1559 fees

just deploy-prod

After that there should be artifacts in the ./artifacts/latest directory, which is might be moved to the particular directory and committed

mv ./artifacts/latest ./artifacts/$CHAIN

About

Community Staking Module is the first ever permissionless staking module in Lido

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published