Prevent the deposit and withdrawal of collateral within the same block in all vaults. This eliminates the use of flash loans to attack the protocol by manipulating the value of KEROSENE.
$$ K_{\text{value}} = \frac{TVL - D_{\text{supply}}}{K_{\text{supply}}} $$
This equation is used by the FOR loop just like a Chainlink price oracle to determine if a given Note’s total collateral value is at least 1.5x its DYAD minted balance.
The K_supply denominator will be provided from a separate contract. Initially this contract will query (total Kerosene supply - multisig Kerosene supply), but this can be changed to a different contract with different logic later on.
To accurately pre-calculate the value of KEROSENE for transactions involving minting DYAD or withdrawing non-KEROSENE collateral, we should define the equations as follows:
The deterministic value of KEROSENE, when minting DYAD, adds the desired mint quantity (D_mint) to the current total DYAD supply (D_supply):
$$ K_{\text{valuemint}} = \frac{TVL - (D_{\text{supply}} + D_{\text{mint}})}{K_{\text{supply}}} $$
The deterministic value of KEROSENE, when withdrawing non-KEROSENE collateral, must account for the reduction in TVL due to the withdrawal (C_withdraw):
$$ K_{\text{valuewithdraw}} = \frac{(TVL - C_{\text{withdraw}}) - D_{\text{supply}}}{K_{\text{supply}}} $$
These equations ensure that Notes can only withdraw non-Kerosene collateral and/ or mint more DYAD if there will be at least $1 of non-Kerosene collateral per DYAD minted in their Note upon the successful execution of the mint or withdrawal transaction.
They stack with the standard MCR checks described above.