Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add diagrams #6

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading