more defensive coding
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
da93f1118e
commit
4ee4ab829f
|
@ -204,6 +204,15 @@ export class HealthCache {
|
|||
return ZERO_I80F48;
|
||||
}
|
||||
|
||||
if (
|
||||
sourceBank.initLiabWeight
|
||||
.sub(targetBank.initAssetWeight)
|
||||
.abs()
|
||||
.lte(ZERO_I80F48)
|
||||
) {
|
||||
return ZERO_I80F48;
|
||||
}
|
||||
|
||||
// The health_ratio is a nonlinear based on swap amount.
|
||||
// For large swap amounts the slope is guaranteed to be negative, but small amounts
|
||||
// can have positive slope (e.g. using source deposits to pay back target borrows).
|
||||
|
|
Loading…
Reference in New Issue