return 0 on depositRate and borrowRate when no deposits or borrows
This commit is contained in:
parent
a5b5aabbd3
commit
28585ffacd
|
@ -89,6 +89,10 @@ export class MangoGroup {
|
|||
|
||||
const totalBorrows = this.getUiTotalBorrow(tokenIndex)
|
||||
const totalDeposits = this.getUiTotalDeposit(tokenIndex)
|
||||
|
||||
if (totalDeposits === 0 && totalBorrows === 0) {
|
||||
return 0
|
||||
}
|
||||
if (totalDeposits <= totalBorrows) {
|
||||
return MAX_RATE
|
||||
}
|
||||
|
@ -107,7 +111,9 @@ export class MangoGroup {
|
|||
const borrowRate = this.getBorrowRate(tokenIndex)
|
||||
const totalBorrows = this.getUiTotalBorrow(tokenIndex)
|
||||
const totalDeposits = this.getUiTotalDeposit(tokenIndex)
|
||||
if (totalDeposits === 0) {
|
||||
if (totalDeposits === 0 && totalBorrows === 0) {
|
||||
return 0
|
||||
} else if (totalDeposits === 0) {
|
||||
return MAX_RATE
|
||||
}
|
||||
const utilization = totalBorrows / totalDeposits
|
||||
|
|
Loading…
Reference in New Issue