Fix formula for computing native amounts on banks

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-08-19 11:45:38 +02:00
parent b3a33a4a53
commit 8f55e20a05
1 changed files with 4 additions and 4 deletions

View File

@ -247,23 +247,23 @@ export class Bank {
}
nativeDeposits(): I80F48 {
return this.cachedIndexedTotalDeposits.mul(this.depositIndex);
return this.indexedDeposits.mul(this.depositIndex);
}
nativeBorrows(): I80F48 {
return this.cachedIndexedTotalBorrows.mul(this.borrowIndex);
return this.indexedBorrows.mul(this.borrowIndex);
}
uiDeposits(): number {
return nativeI80F48ToUi(
this.cachedIndexedTotalDeposits.mul(this.depositIndex),
this.indexedDeposits.mul(this.depositIndex),
this.mintDecimals,
).toNumber();
}
uiBorrows(): number {
return nativeI80F48ToUi(
this.cachedIndexedTotalBorrows.mul(this.borrowIndex),
this.indexedBorrows.mul(this.borrowIndex),
this.mintDecimals,
).toNumber();
}