From 64fb81f9effafc2aeae14fdcdca375e6ed80d9a9 Mon Sep 17 00:00:00 2001 From: Lucas Manuel Date: Thu, 7 Dec 2023 11:20:13 -0500 Subject: [PATCH] feat: add diagrams --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d81894..e0d11ce 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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`. ***