From b7aa6dbd5dca9edf5a717d8aa7c253606648c150 Mon Sep 17 00:00:00 2001 From: microwavedcola1 <89031858+microwavedcola1@users.noreply.github.com> Date: Sat, 24 Sep 2022 07:11:57 +0200 Subject: [PATCH] ts: tiny liabs pushes health ratio beyond what I80F48 can support (#243) * ts: tiny liabs pushes health ratio beyond what I80F48 can support Signed-off-by: microwavedcola1 * add alias Signed-off-by: microwavedcola1 Signed-off-by: microwavedcola1 --- package.json | 1 + ts/client/src/accounts/healthCache.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a6a92dff5..9e46e2836 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "build": "npm run build:esm; npm run build:cjs", "build:cjs": "tsc -p tsconfig.cjs.json", "build:esm": "tsc -p tsconfig.esm.json", + "test": "ts-mocha ts/client/**/*.spec.ts", "clean": "rm -rf dist", "example1-user": "ts-node ts/client/src/scripts/example1-user.ts", "example1-admin": "ts-node ts/client/src/scripts/example1-admin.ts", diff --git a/ts/client/src/accounts/healthCache.ts b/ts/client/src/accounts/healthCache.ts index 703a987c4..6762ab45e 100644 --- a/ts/client/src/accounts/healthCache.ts +++ b/ts/client/src/accounts/healthCache.ts @@ -173,7 +173,7 @@ export class HealthCache { } } - if (liabs.isPos()) { + if (liabs.gt(I80F48.fromNumber(0.001))) { return HUNDRED_I80F48().mul(assets.sub(liabs).div(liabs)); } else { return MAX_I80F48();