Skip to content

Commit

Permalink
refactor(finance): rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Gancho Manev committed Jun 5, 2023
1 parent 8cfdd44 commit 968e073
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/finance/src/liability/liquidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ pub fn check_liability<Asset>(
asset: Coin<Asset>,
total_due: Coin<Asset>,
overdue: Coin<Asset>,
liquidation_threshold: Coin<Asset>,
min_asset_threshold: Coin<Asset>,
) -> Status<Asset>
where
Asset: Currency,
{
debug_assert!(total_due <= asset);
debug_assert!(overdue <= total_due);
may_ask_liquidation_liability(spec, asset, total_due, liquidation_threshold)
may_ask_liquidation_liability(spec, asset, total_due, min_asset_threshold)
.max(may_ask_liquidation_overdue(
asset,
overdue,
liquidation_threshold,
min_asset_threshold,
))
.unwrap_or_else(|| no_liquidation(spec, asset, total_due))
}
Expand All @@ -121,7 +121,7 @@ fn may_ask_liquidation_liability<Asset>(
spec: &Liability,
asset: Coin<Asset>,
total_due: Coin<Asset>,
liquidation_threshold: Coin<Asset>,
min_asset_threshold: Coin<Asset>,
) -> Option<Status<Asset>>
where
Asset: Currency,
Expand All @@ -133,22 +133,22 @@ where
healthy_ltv: spec.healthy_percent(),
},
spec.amount_to_liquidate(asset, total_due),
liquidation_threshold,
min_asset_threshold,
)
}

fn may_ask_liquidation_overdue<Asset>(
asset: Coin<Asset>,
overdue: Coin<Asset>,
liquidation_threshold: Coin<Asset>,
min_asset_threshold: Coin<Asset>,
) -> Option<Status<Asset>>
where
Asset: Currency,
{
if overdue < Coin::new(MIN_LIQUIDATION_AMOUNT) {
None
} else {
may_ask_liquidation(asset, Cause::Overdue(), overdue, liquidation_threshold)
may_ask_liquidation(asset, Cause::Overdue(), overdue, min_asset_threshold)
}
}

Expand Down

0 comments on commit 968e073

Please sign in to comment.