diff --git a/ts/client/src/accounts/bank.ts b/ts/client/src/accounts/bank.ts index 76e197566..a002024b1 100644 --- a/ts/client/src/accounts/bank.ts +++ b/ts/client/src/accounts/bank.ts @@ -268,6 +268,10 @@ export class Bank { ).toNumber(); } + /** + * + * @returns borrow rate, 0 is 0% where 1 is 100% + */ getBorrowRate(): I80F48 { const totalBorrows = this.nativeBorrows(); const totalDeposits = this.nativeDeposits(); @@ -298,6 +302,18 @@ export class Bank { } } + /** + * + * @returns borrow rate percentage + */ + getBorrowRateUi(): number { + return this.getBorrowRate().toNumber() * 100; + } + + /** + * + * @returns deposit rate, 0 is 0% where 1 is 100% + */ getDepositRate(): I80F48 { const borrowRate = this.getBorrowRate(); const totalBorrows = this.nativeBorrows(); @@ -312,6 +328,14 @@ export class Bank { const utilization = totalBorrows.div(totalDeposits); return utilization.mul(borrowRate); } + + /** + * + * @returns deposit rate percentage + */ + getDepositRateUi(): number { + return this.getDepositRate().toNumber() * 100; + } } export class MintInfo {