From b753d71e72ae488654a93493a03df06d5f84a863 Mon Sep 17 00:00:00 2001 From: Gidon Katten <55109236+gidonkatten@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:10:58 +0100 Subject: [PATCH] fix: fixed calculation of net yield (#112) --- .changeset/plenty-rockets-greet.md | 5 +++++ src/chains/evm/hub/modules/folks-hub-loan.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/plenty-rockets-greet.md diff --git a/.changeset/plenty-rockets-greet.md b/.changeset/plenty-rockets-greet.md new file mode 100644 index 0000000..bb978ed --- /dev/null +++ b/.changeset/plenty-rockets-greet.md @@ -0,0 +1,5 @@ +--- +"@folks-finance/xchain-sdk": patch +--- + +fixed calculation of net yield diff --git a/src/chains/evm/hub/modules/folks-hub-loan.ts b/src/chains/evm/hub/modules/folks-hub-loan.ts index d2e848d..ab36398 100644 --- a/src/chains/evm/hub/modules/folks-hub-loan.ts +++ b/src/chains/evm/hub/modules/folks-hub-loan.ts @@ -479,7 +479,7 @@ export function getUserLoansInfo( if (dn.greaterThan(totalCollateralBalanceValue, 0)) { netRate = dn.div(netRate, totalCollateralBalanceValue); - netYield = dn.div(netRate, totalCollateralBalanceValue); + netYield = dn.div(netYield, totalCollateralBalanceValue); } const loanToValueRatio = calcLtvRatio(totalBorrowBalanceValue, totalCollateralBalanceValue);