From 24c7c3962ae87cdaed7e0052fb426b26ac2369bb Mon Sep 17 00:00:00 2001 From: Pratik Date: Sat, 5 Nov 2022 19:58:59 +0530 Subject: [PATCH 1/2] audit 6-fix --- x/lend/keeper/iter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/lend/keeper/iter.go b/x/lend/keeper/iter.go index 147bc8229..4ab424890 100644 --- a/x/lend/keeper/iter.go +++ b/x/lend/keeper/iter.go @@ -213,7 +213,7 @@ func (k Keeper) ReBalanceStableRates(ctx sdk.Context, borrowPos types.BorrowAsse perc2, _ := sdk.NewDecFromStr(types.Perc2) // 90% if borrowPos.StableBorrowRate.GTE(assetStats.StableBorrowApr.Add(perc1)) { // condition 1, 𝑆 ≥ 𝑆𝑡 + 20% borrowPos.StableBorrowRate = assetStats.StableBorrowApr - } else if (borrowPos.StableBorrowRate.Add(perc1)).LTE(assetStats.StableBorrowApr) || utilizationRatio.GT(perc2) { // condition 2, 𝑆 + 20% ≤ 𝑆𝑡 ∨ 𝑢𝑡𝑖𝑙𝑖𝑧𝑎𝑡𝑖𝑜𝑛 ≥ 90% + } else if (assetStats.StableBorrowApr.Add(perc1)).LTE(borrowPos.StableBorrowRate) || utilizationRatio.GTE(perc2) { // condition 2, 𝑆 + 20% ≤ 𝑆𝑡 ∨ 𝑢𝑡𝑖𝑙𝑖𝑧𝑎𝑡𝑖𝑜𝑛 ≥ 90% borrowPos.StableBorrowRate = assetStats.StableBorrowApr } From dd4827b9013c38e92104d31b385756adf2311504 Mon Sep 17 00:00:00 2001 From: Pratik Date: Sat, 5 Nov 2022 20:10:11 +0530 Subject: [PATCH 2/2] audit 6-fix, comments added --- x/lend/keeper/iter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/lend/keeper/iter.go b/x/lend/keeper/iter.go index 4ab424890..3acb031ea 100644 --- a/x/lend/keeper/iter.go +++ b/x/lend/keeper/iter.go @@ -211,9 +211,9 @@ func (k Keeper) ReBalanceStableRates(ctx sdk.Context, borrowPos types.BorrowAsse } perc1, _ := sdk.NewDecFromStr(types.Perc1) // 20% perc2, _ := sdk.NewDecFromStr(types.Perc2) // 90% - if borrowPos.StableBorrowRate.GTE(assetStats.StableBorrowApr.Add(perc1)) { // condition 1, 𝑆 ≥ 𝑆𝑡 + 20% + if borrowPos.StableBorrowRate.GTE(assetStats.StableBorrowApr.Add(perc1)) { // condition 1, 𝑆 ≥ 𝑆𝑡 + 20%, S is the rate at which you borrowed, and St is the current stable rate in the system. borrowPos.StableBorrowRate = assetStats.StableBorrowApr - } else if (assetStats.StableBorrowApr.Add(perc1)).LTE(borrowPos.StableBorrowRate) || utilizationRatio.GTE(perc2) { // condition 2, 𝑆 + 20% ≤ 𝑆𝑡 ∨ 𝑢𝑡𝑖𝑙𝑖𝑧𝑎𝑡𝑖𝑜𝑛 ≥ 90% + } else if (borrowPos.StableBorrowRate.Add(perc1)).LTE(assetStats.StableBorrowApr) || utilizationRatio.GTE(perc2) { // condition 2, 𝑆 + 20% ≤ 𝑆𝑡 ∨ 𝑢𝑡𝑖𝑙𝑖𝑧𝑎𝑡𝑖𝑜𝑛 ≥ 90% borrowPos.StableBorrowRate = assetStats.StableBorrowApr }