Skip to content

Commit

Permalink
.5s epoch speedup (#8159)
Browse files Browse the repository at this point in the history
(cherry picked from commit a716488)
  • Loading branch information
ValarDragon authored and mergify[bot] committed Apr 28, 2024
1 parent 957c581 commit e4bea69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion x/incentives/keeper/distribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
// DistributionValueCache is a cache for when we calculate the minimum value
// an underlying token must be to be distributed.
type DistributionValueCache struct {
minDistrValue sdk.Coin
denomToMinValueMap map[string]osmomath.Int
}

Expand Down Expand Up @@ -624,7 +625,7 @@ func (k Keeper) distributeInternal(

// Retrieve the min value for distribution.
// If any distribution amount is valued less than what the param is set, it will be skipped.
minValueForDistr := k.GetParams(ctx).MinValueForDistribution
minValueForDistr := minDistrValueCache.minDistrValue

remainCoins := gauge.Coins.Sub(gauge.DistributedCoins...)

Expand Down Expand Up @@ -926,6 +927,7 @@ func (k Keeper) Distribute(ctx sdk.Context, gauges []types.Gauge) (sdk.Coins, er
// While this isn't precise as it doesn't account for price impact, it is good enough for the sole
// purpose of determining if we should distribute the token or not.
minDistrValueCache := &DistributionValueCache{
minDistrValue: k.GetParams(ctx).MinValueForDistribution,
denomToMinValueMap: make(map[string]osmomath.Int),
}

Expand Down

0 comments on commit e4bea69

Please sign in to comment.