/wrapped-m-token

Non rebasing M token alternative with additional possibility to preserve and forward yield to earners

Primary LanguageSolidityOtherNOASSERTION

Wrapped M Token - Smart Wrapper contract

Overview

Non-rebasing M token alternative with an additional possibility to preserve and forward yield to earners.

Development

Installation

You may have to install the following tools to use this repository:

  • foundry to compile and test contracts
  • lcov to generate the code coverage report
  • yarn to manage node dependencies
  • slither to static analyze contracts

Install dependencies:

npm install
forge install

Env

Copy .env and write down the env variables needed to run this project.

cp .env.example .env

Compile

Run the following command to compile the contracts:

forge compile

Coverage

Forge is used for coverage, run it with:

npm run coverage

You can then consult the report by opening coverage/index.html:

open coverage/index.html

Test

To run all tests:

forge test

Run test that matches a test contract:

forge test --mc <test-contract-name>

Test a specific test case:

forge test --mt <test-case-name>

To run slither:

npm run slither

Code quality

Prettier is used to format Solidity code. Use it by running:

npm run prettier

Solhint is used to lint Solidity files. Run it with:

npm run solhint

Or to autofix some issues:

npm run solhint-fix

CI

The following Github Actions workflow are setup to run on push and pull requests:

It will build the contracts and run the test coverage, as well as a gas report.

The coverage report will be displayed in the PR by github-actions-report-lcov and the gas report by foundry-gas-diff.

For the workflows to work, you will need to setup the MNEMONIC_FOR_TESTS and MAINNET_RPC_URL repository secrets in the settings of your Github repository.

Some additional workflows are available if you wish to add fuzz, integration and invariant tests:

You will need to uncomment them to activate them.

Documentation

Forge is used to generate the documentation. Run it with:

npm run doc