SAFEEnginestores all SAFEs' states and system coin balances, as well as the amount of collateral and debt each address has. This contract is self-contained and has no external dependencies.
LiquidationEngineis meant to check if a SAFE is unsafe (the value of the issued debt is too high compared to the collateral value) and start a collateral auction that sells a portion of the SAFE's collateral in order to cover a share of its debt.
AccountingEnginestores the overall system surplus and debt data. It is meant to settle deficit via debt auctions and dispose off surplus via surplus auctions or basic transfers.
SAFEEngine- A bug in the
SAFEEnginecould be fatal and would lead to collateral or debt being stuck in the system
LiquidationEngine- A bug in the
LiquidationEnginecould lead debt or collateral being assigned to addresses from where they cannot be recovered. Compared to MCD, the
LiquidationEnginecan call external contracts that are meant to save SAFEs by adding more collateral in the system. These "insurance" contracts, if coded incorrectly, can change system state without actually adding any collateral and thus block the engine from starting new auctions. The
liquidateSAFE(bytes32 collateralType, address cdp)function also uses mutexes to prevent re-entrancy. If a mutex is not unassigned at the end of the call, it can prevent the
LiquidationEnginefrom liquidating a specific SAFE in the future.
AccountingEngine- A bug in the
AccountingEnginewould prevent the system from reaching equilibrium (by auctioning debt or disposing off surplus).
LiquidationEnginerely (directly or indirectly) on the
OracleRelayerwhich in turn receives price data from multiple trusted sources. If the price feed oracles fail, it's possible that SAFEs will be unfairly liquidated or that users will generate unbacked debt.
SAFEEngine- Malicious governance can steal collateral (
modifyCollateralBalance) or mint unbacked debt for no apparent reason (
createUnbackedDebt/addition of worthless collateral types).
LiquidationEngine- Governance could misconfigure liquidation parameters (e.g an extremely low or high
AccountingEngine- Malicious governance can set null addresses as the
surplusAuctionHouseand thus not allow the system to reach equilibrium or even trigger settlement. The can also set a faulty
AccountingEngine.systemStakingPoolwhich can prevent the engine from starting new debt auctions and thus leave deficit in the system
SAFEEngine(Level 2 Gov Minimization) - the
SAFEEnginewill need an external contract to automatically set the
globalDebtCeilingand each collateral's individual
debtCeilings. Apart from this, governance can remove control from the
LiquidationEngine(Level 1 Gov Minimization) - the
LiquidationEnginemay have an external contract authorized to periodically set
onAuctionSystemCoinLimitdepending on the current outstanding amount of system coins generated. Governance will also need to have control over connecting and disconnecting saviour contracts because they are external dependencies connected to other protocols/3rd parties. Apart from these, governance can remove control over this contract.
AccountingEngine(Level 2 Gov Minimization) - the
AccountingEnginemust authorize an external contract to automatically set
debtAuctionBidSizeaccording to the protocol token and system coin market prices. Governance may also keep control over setting
systemStakingPoolin case the staking pool still needs to be upgraded and may cause problems in the engine.