Skip to content

Commit

Permalink
feat: Add diagrams (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-manuel authored Dec 7, 2023
1 parent 1c480e1 commit a1ca29c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
This repo contains five contracts:

### `src/SparkLendFreezerMom.sol`
A contract that will have `RISK_ADMIN_ROLE` & `EMERGENCY_ADMIN_ROLE` in SparkLend, and has four functions:
A contract that will have `RISK_ADMIN_ROLE` (can freeze markets) & `EMERGENCY_ADMIN_ROLE` (can pause markets) in SparkLend, and has four functions:
- `freezeAllMarkets`: Freezes all markets in SparkLend, callable by the `hat` in the Chief, an authorized contract (ward) or by the PauseProxy in MakerDAO.
- `freezeMarket`: Freezes a single market in SparkLend, callable by the `hat` in the Chief, an authorized contract (ward) or by the PauseProxy in MakerDAO.
- `pauseAllMarkets`: Pauses all markets in SparkLend, callable by the `hat` in the Chief, an authorized contract (ward) or by the PauseProxy in MakerDAO.
Expand All @@ -30,7 +30,25 @@ A spell that can be set as the `hat` in the Chief to pauses all markets in Spark
### `src/spells/EmergencySpell_SparkLend_PauseSingleAsset.sol`
A spell that can be set as the `hat` in the Chief to pause a specific market in SparkLend by calling `pauseMarket(reserve, true)` in `SparkLendFreezerMom`. A separate spell is needed for each market, with the reserve being declared in the constructor.

## Execution Flow Diagrams

The below diagrams outlines the execution flow of freezing a single market in SparkLend for both token-based governance in MakerDAO and the emergency multisig, which will be added as a `ward` in the FreezerMom.
The same execution flow applies to all actions, this is a single example.

### Spell Execution Flow

For token-based governance to execute a freeze/pause in SparkLend, a pre-deployed spell must be voted to be the `hat` by MKR holders. Once that is done, any account can call `execute()` on the spell, which will call the FreezerMom. The FreezerMom will a permissioned account in SparkLend with the ability to both freeze and pause.

![Call Routing - Spell](https://github.com/marsfoundation/sparklend-freezer/assets/44272939/8ec26367-099f-476d-986e-b61403747172)

### Multisig Execution Flow

For the multisig to execute a freeze/pause in SparkLend, the quorum must be reached and then the desired function can be called directly on the FreezerMom. The FreezerMom will a permissioned account in SparkLend with the ability to both freeze and pause.

![Call Routing - Multisig 2](https://github.com/marsfoundation/sparklend-freezer/assets/44272939/136a9dbf-bd95-436b-a789-e4d5ddcb3cde)

## Testing

To run the tests, run `forge test`.

***
Expand Down

0 comments on commit a1ca29c

Please sign in to comment.