Rari-Capital/vaults

๐Ÿ”’ Provide way to force loss

Closed this issue ยท 3 comments

if cToken has a ton of insolvent borrowers it wont show a loss for underlyingBalanceOf just revert when we try to redeem our full balance. we need a way to fix accounting in this state.

depends on how modular we want the fix. could either have a super generic function that just transfers all of a cToken to the owner for them to deal with. but that could be dangerous cuz things done with the cToken would have to be atomic to prevent loss frontrunning

we could go less generic and have a withdrawXFromStrategyAndMarkDepleted or something that redeems that amount, then clears the strategy bal?? aaa idk

^^ could be helpful... we could impl a forceSyncStrategy() func that reads max redeem and updates total balance based on it. that function should probably distrust the strategy tho or else ppl can harvest and revert the force sync?

but tbh i prefer the flexibilty we get with a yankStrategy() func that lets us transfer an amount of cTokens to the caller. we could then build a ForceLossModule able to call yankStrategy, handle redeeming the ctokens at a loss and returning them