SNT Staking contracts
Go to file
Ricardo Guilherme Schmidt dcc44813f4
chore(.gas-report, .gas-snapshot): update reports
2024-09-19 10:35:45 -03:00
.github chore(CI): update certora-cli to 7.10.2 2024-08-27 14:46:22 +02:00
.vscode refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
certora refactor(certora): introduce shared.spec to reuse helper functions 2024-09-19 14:35:08 +02:00
contracts fix(StakeManager): change order of call of mintBonusMP to fix intended behavior. 2024-09-12 11:44:48 +02:00
lib refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
script feat(script): add deployment script for new `StakeManager`s 2024-02-29 11:19:18 -03:00
test test(StakeManager): add test to catch bug in minting more bonus MPs when stake with lock 2024-09-12 11:44:48 +02:00
.editorconfig refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
.env.example refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
.gas-report chore(.gas-report, .gas-snapshot): update reports 2024-09-19 10:35:45 -03:00
.gas-snapshot chore(.gas-report, .gas-snapshot): update reports 2024-09-19 10:35:45 -03:00
.gitattributes refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
.gitignore chore(ci): add certora CI integration (#40) 2023-12-11 15:10:41 +01:00
.gitmodules refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
.prettier.yml refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
.prettierignore refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
.solhint.json refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
LICENSE Initial commit 2023-05-05 11:12:51 -03:00
PROPERTIES.md refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
README.md docs: fix codecov badge 2023-10-10 15:46:29 +02:00
codecov.yml refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
foundry.toml refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00
package.json chore(package.json): fix gas-report command 2024-09-11 15:18:24 +02:00
pnpm-lock.yaml chore: add adorno command to package.json 2024-09-10 13:05:06 +02:00
remappings.txt fix(remappings): add trailing slash to OZ remapping (#26) 2023-10-10 13:52:10 +02:00
slither.config.json refactor: migrate repository to foundry-template (#6) 2023-09-12 18:37:30 +02:00

README.md

SNT Staking contracts Github Actions Codecov Foundry

A Foundry-based template for developing Solidity smart contracts, with sensible defaults.

This is a fork of PaulRBerg's template and adjusted to Vac's smart contracts unit's needs. See Upstream differences to learn more about how this template differs from Paul's.

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

Getting Started

Click the Use this template button at the top of the page to create a new repository with this repo as the initial state.

Or, if you prefer to install the template manually:

$ mkdir my-project
$ cd my-project
$ forge init --template vacp2p/foundry-template
$ pnpm install # install Solhint, Prettier, and other Node.js deps

If this is your first time with Foundry, check out the installation instructions.

Features

This template builds upon the frameworks and libraries mentioned above, so for details about their specific features, please consult their respective documentation.

For example, if you're interested in exploring Foundry in more detail, you should look at the Foundry Book. In particular, you may be interested in reading the Writing Tests tutorial.

Upstream differences

As mentioned above, this template is a fork with adjustments specific to the needs of Vac's smart contract service unit. These differences are:

  • Removal of PRBTest - In an attempt to keep dependence on third-party code low, we've decided to remove this library as a standard dependency of every project within Vac. If we do see a need for it, we might bring it back in the future.
  • **PROPERTIES.md - For invariant testing and formal verification, we've introduced a PROPERTIES.md to document all protocol properties that must hold true.

Sensible Defaults

This template comes with a set of sensible default configurations for you to use. These defaults can be found in the following files:

├── .editorconfig
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solhint.json
├── foundry.toml
├── remappings.txt
└── slither.config.json

VSCode Integration

This template is IDE agnostic, but for the best user experience, you may want to use it in VSCode alongside Nomic Foundation's Solidity extension.

For guidance on how to integrate a Foundry project in VSCode, please refer to this guide.

GitHub Actions

This template comes with GitHub Actions pre-configured. Your contracts will be linted and tested on every push and pull request made to the main branch.

You can edit the CI script in .github/workflows/ci.yml.

Writing Tests

If you would like to view the logs in the terminal output you can add the -vvv flag and use console.log.

This template comes with an example test contract Foo.t.sol

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:

$ forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545

For this script to work, you need to have a MNEMONIC environment variable set to a valid BIP39 mnemonic.

For instructions on how to deploy to a testnet or mainnet, check out the Solidity Scripting tutorial.

Format

Format the contracts:

$ forge fmt

Gas Usage

Get a gas report:

$ forge test --gas-report

Lint

Lint the contracts:

$ pnpm lint

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.