Skip to content

Commit

Permalink
fix more issues
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Aug 28, 2023
1 parent 9172949 commit 80170b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion x/concentrated-liquidity/math/precompute.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

var (
sdkOneDec = sdk.OneDec()
sdkNineDec = sdk.NewDec(9)
sdkTenDec = sdk.NewDec(10)
powersOfTen []sdk.Dec
negPowersOfTen []sdk.Dec
Expand Down
12 changes: 7 additions & 5 deletions x/incentives/keeper/distribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (k Keeper) AllocateAcrossGauges(ctx sdk.Context) error {

// only allow distribution if the GroupGauge is Active
if gauge.IsActiveGauge(currTime) {
coinsToDistributePerInternalGauge, coinsToDistributeThisEpoch, err := k.calcSplitPolicyCoins(ctx, groupGauge.SplittingPolicy, gauge, groupGauge)
coinsToDistributePerInternalGauge, coinsToDistributeThisEpoch, err := k.calcSplitPolicyCoins(groupGauge.SplittingPolicy, gauge, groupGauge)
if err != nil {
return err
}
Expand All @@ -298,7 +298,9 @@ func (k Keeper) AllocateAcrossGauges(ctx sdk.Context) error {

// we distribute tokens from groupGauge to internal gauge therefore update groupGauge fields
// updates filledEpoch and distributedCoins
k.updateGaugePostDistribute(ctx, *gauge, coinsToDistributeThisEpoch)
if err := k.updateGaugePostDistribute(ctx, *gauge, coinsToDistributeThisEpoch); err != nil {
return err
}
}
}

Expand All @@ -307,7 +309,8 @@ func (k Keeper) AllocateAcrossGauges(ctx sdk.Context) error {

// calcSplitPolicyCoins calculates tokens to split given a policy and groupGauge.
// TODO: add volume split policy
func (k Keeper) calcSplitPolicyCoins(ctx sdk.Context, policy types.SplittingPolicy, groupGauge *types.Gauge, groupGaugeObj types.GroupGauge) (sdk.Coins, sdk.Coins, error) {
// nolint: unused
func (k Keeper) calcSplitPolicyCoins(policy types.SplittingPolicy, groupGauge *types.Gauge, groupGaugeObj types.GroupGauge) (sdk.Coins, sdk.Coins, error) {
if policy == types.Evenly {
remainCoins := groupGauge.Coins.Sub(groupGauge.DistributedCoins)

Expand All @@ -327,7 +330,6 @@ func (k Keeper) calcSplitPolicyCoins(ctx sdk.Context, policy types.SplittingPoli
} else {
return nil, nil, fmt.Errorf("GroupGauge id %d doesnot have enought coins to distribute.", &groupGauge.Id)
}

}

// distributeInternal runs the distribution logic for a gauge, and adds the sends to
Expand Down Expand Up @@ -528,7 +530,7 @@ func (k Keeper) Distribute(ctx sdk.Context, gauges []types.Gauge) (sdk.Coins, er
ctx.Logger().Debug("distributeSyntheticInternal, gauge id %d, %d", "module", types.ModuleName, "gaugeId", gauge.Id, "height", ctx.BlockHeight())
gaugeDistributedCoins, err = k.distributeSyntheticInternal(ctx, gauge, filteredLocks, &distrInfo)
} else {
// Do not distribue if LockQueryType = Group, because if we distribute here we will be double distributing.
// Do not distributed if LockQueryType = Group, because if we distribute here we will be double distributing.
if gauge.DistributeTo.LockQueryType == lockuptypes.ByGroup {
continue
}
Expand Down
1 change: 0 additions & 1 deletion x/incentives/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,4 @@ func NoLockInternalGaugeDenom(poolId uint64) string {
// KeyGroupGaugeForId returns key for a given groupGaugeId.
func KeyGroupGaugeForId(groupGaugeId uint64) []byte {
return []byte(fmt.Sprintf("%s%s%d%s", GroupGaugePrefix, "|", groupGaugeId, "|"))

}

0 comments on commit 80170b7

Please sign in to comment.