Skip to content

Midas-Protocol/contracts

Repository files navigation

Contracts

Main repository for Midas Capital's contracts

Structure

 ┌── README.md                        <- The top-level README
 ├── .github/workflows                <- CICD pipeline definition
 ├── .vscode                          <- IDE configs
 │
 ├── out                              <- (forge-generated, git ignored)
 │    ├── *.sol/*.json                <- All the built contracts
 │    └──  ...
 │
 ├── lib                              <- git submodules with forge-based dependencies
 │    ├── flywheel-v2                 <- Tribe flywheel contracts
 │    ├── fuse-flywheel               <- Fuse flywheel contracts
 │    ├── oz-contracts-upgradeable    <- OpenZeppelin deps
 │    └──  ...                        <- other deps
 │
 ├── contracts                        <- All of our contracts
 │    ├── test                        <- Forge-based tests
 │    ├── compound                    <- Compound interfaces
 │    ├── external                    <- External contracts we require
 │    ├── oracles                     <- Oracle contracts
 │    ├── utils                       <- Utility contracts
 │    └──  ...                        <- Main Fuse contracts
 │
 ├── foundry.toml                     <- forge configs
 ├── remappings.txt                   <- forge remappings
 └── package.json                     <- npm deps

Dev Workflow

1. Install dependencies: npm & foundry (forge + cast)

Forge dependencies

>>> curl -L https://foundry.paradigm.xyz | bash
>>> foundryup
# ensure forge and cast are available in your $PATH
# install submodule libraries via forge
>>> forge install

NPM dependencies

>>> npm install

2. Build the contracts

>>> forge build

3. Run the tests for a specific chain id

# export the relevant env variables, or set them in an .env file
>>> export TEST_RUN_CHAINID=1
>>> export  ETHEREUM_MAINNET_RPC_URL=https://rpc.ankr.com/eth
>>> export ETHEREUM_MAINNET_ARCHIVE_RPC_URL=https://rpc.ankr.com/eth

Run the entire test suite

>>> forge test --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test|StellaERC4626Test|CurveERC4626Test|EllipsisERC4626Test|HelioERC4626Test|WombatERC4626Test|MiniChefERC4626Test|AaveV3ERC4626Test'

Check the CI.yaml file to see what chains we run the tests against

4. Lint

>>> npm run prettier