A trove action will revert if it moves the Shrine from normal mode into recovery mode (i.e. worsens Shrine's LTV to 70% of Shrine's threshold).
Once in recovery mode, thresholds are not immediately scaled. Instead, they are scaled after an additional buffer of 5% of the Shrine's threshold is exceeded i.e. the Shrine's LTV reaches 75% of its threshold.
Once in recovery mode, if a trove's LTV is worse than its target recovery mode LTV (i.e. 70% of its threshold), then any trove action that worsens the LTV will revert.
Once in recovery mode, if a trove's LTV is not worse than its target recovery mode LTV, then it can take any action provided its LTV does not exceed target recovery mode LTV (i.e. 70% of its threshold), in which case it would revert.
When in recovery mode, a trove's threshold is scaled based on how far its current LTV exceeds it target recovery mode LTV.
Note that once in recovery mode, there are two different thresholds for a trove:1. the recovery mode target threshold, which acts as a limitation by preventing forge and withdraw if they would cause the trove's LTV to worsen [UPDATE - a better name for this would actually be recovery mode target LTV];2. the threshold for liquidation, which is likely different from (1) once it starts to be scaled after the Shrine's LTV exceeds the buffer.
Fix https://github.com/code-423n4/2024-01-opus-findings/issues/9
Summary of changes:
Note that once in recovery mode, there are two different thresholds for a trove:1. the recovery mode target threshold, which acts as a limitation by preventing forge and withdraw if they would cause the trove's LTV to worsen [UPDATE - a better name for this would actually be recovery mode target LTV];2. the threshold for liquidation, which is likely different from (1) once it starts to be scaled after the Shrine's LTV exceeds the buffer.