From 0e3719057a2ac24bb2af39dc36121400d7645d34 Mon Sep 17 00:00:00 2001 From: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> Date: Sat, 25 Nov 2023 05:24:15 +0100 Subject: [PATCH] fix: fix incentive abci division by zero error --- config.yml | 4 ++++ docs/static/openapi.yml | 4 ++++ x/incentive/keeper/keeper_lps.go | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config.yml b/config.yml index d45b68926..85569e0da 100644 --- a/config.yml +++ b/config.yml @@ -32,6 +32,10 @@ validators: bonded: 100000000uelys genesis: app_state: + clock: + params: + contract_addresses: + ["elys14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s3fsthx"] crisis: constant_fee: denom: uelys diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index f3b64545d..8693376b9 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -82951,11 +82951,15 @@ definitions: properties: token_out_amount: type: string + discount: + type: string elys.amm.MsgSwapExactAmountOutResponse: type: object properties: token_in_amount: type: string + discount: + type: string elys.amm.OraclePoolSlippageTrack: type: object properties: diff --git a/x/incentive/keeper/keeper_lps.go b/x/incentive/keeper/keeper_lps.go index 6c3865f51..eab9950e3 100644 --- a/x/incentive/keeper/keeper_lps.go +++ b/x/incentive/keeper/keeper_lps.go @@ -39,7 +39,10 @@ func (k Keeper) CalculateRewardsForLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, c // Calculate Proxy TVL share considering multiplier proxyTVL := tvl.Mul(poolInfo.Multiplier) - poolShare := proxyTVL.Quo(totalProxyTVL) + poolShare := sdk.ZeroDec() + if totalProxyTVL.IsPositive() { + poolShare = proxyTVL.Quo(totalProxyTVL) + } // Calculate new Eden for this pool newEdenAllocatedForPool := poolShare.MulInt(edenAmountPerEpochLp)