functions for rates in bank in ui
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
8f55e20a05
commit
f0dff030a7
|
@ -268,6 +268,10 @@ export class Bank {
|
||||||
).toNumber();
|
).toNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @returns borrow rate, 0 is 0% where 1 is 100%
|
||||||
|
*/
|
||||||
getBorrowRate(): I80F48 {
|
getBorrowRate(): I80F48 {
|
||||||
const totalBorrows = this.nativeBorrows();
|
const totalBorrows = this.nativeBorrows();
|
||||||
const totalDeposits = this.nativeDeposits();
|
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 {
|
getDepositRate(): I80F48 {
|
||||||
const borrowRate = this.getBorrowRate();
|
const borrowRate = this.getBorrowRate();
|
||||||
const totalBorrows = this.nativeBorrows();
|
const totalBorrows = this.nativeBorrows();
|
||||||
|
@ -312,6 +328,14 @@ export class Bank {
|
||||||
const utilization = totalBorrows.div(totalDeposits);
|
const utilization = totalBorrows.div(totalDeposits);
|
||||||
return utilization.mul(borrowRate);
|
return utilization.mul(borrowRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @returns deposit rate percentage
|
||||||
|
*/
|
||||||
|
getDepositRateUi(): number {
|
||||||
|
return this.getDepositRate().toNumber() * 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MintInfo {
|
export class MintInfo {
|
||||||
|
|
Loading…
Reference in New Issue