fix scaling of weights

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-12-09 06:08:23 +01:00
parent 82a120df0d
commit 794f298ded
2 changed files with 6 additions and 2 deletions

View File

@ -308,6 +308,7 @@ export class Bank implements BankForHealth {
scaledInitAssetWeight(): I80F48 {
const depositsQuote = this.nativeDeposits().mul(this.price);
if (
this.depositWeightScaleStartQuote >= Number.MAX_SAFE_INTEGER ||
depositsQuote.lte(I80F48.fromNumber(this.depositWeightScaleStartQuote))
) {
return this.initAssetWeight;
@ -319,7 +320,10 @@ export class Bank implements BankForHealth {
scaledInitLiabWeight(): I80F48 {
const borrowsQuote = this.nativeBorrows().mul(this.price);
if (borrowsQuote.lte(I80F48.fromNumber(this.borrowWeightScaleStartQuote))) {
if (
this.borrowWeightScaleStartQuote >= Number.MAX_SAFE_INTEGER ||
borrowsQuote.lte(I80F48.fromNumber(this.borrowWeightScaleStartQuote))
) {
return this.initLiabWeight;
}
return this.initLiabWeight.mul(

View File

@ -17,7 +17,7 @@ const PAYER_KEYPAIR =
process.env.PAYER_KEYPAIR_OVERRIDE || process.env.MB_PAYER_KEYPAIR;
const USER_KEYPAIR =
process.env.USER_KEYPAIR_OVERRIDE || process.env.MB_PAYER_KEYPAIR;
const GROUP_NUM = Number(process.env.GROUP_NUM || 2);
const GROUP_NUM = Number(process.env.GROUP_NUM || 0);
const CLUSTER: Cluster =
(process.env.CLUSTER_OVERRIDE as Cluster) || 'mainnet-beta';