Skip to content

Commit

Permalink
feat: check losses
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Oct 19, 2023
1 parent 4cc2105 commit 89b106f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion contracts/debtAllocators/GenericDebtAllocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,23 @@ contract GenericDebtAllocator is Governance {

// Check if it's over the threshold.
if (toPull > config.minimumChange) {
// Can't lower debt if there is unrealised losses.
if (
_vault.assess_share_of_unrealised_losses(
_strategy,
params.current_debt
) > 0
) {
return (false, bytes("unrealised loss"));
}

// If so return true and the calldata.
return (
true,
abi.encodeCall(
_vault.update_debt,
(_strategy, params.current_debt - toPull)
)
)
);
}
}
Expand Down

0 comments on commit 89b106f

Please sign in to comment.