mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 18:15:19 +00:00
673790465d
* optimize pricefeed endblocker to iterate all markets only once to remove overhead of opening and closing iterator for each market individually. In addition, extend tests to cover 100% of abci and price updating behavior. * use test cases that can't be confused with mean to ensure median is always used
18 lines
453 B
Go
18 lines
453 B
Go
package pricefeed
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/cosmos/cosmos-sdk/telemetry"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/kava-labs/kava/x/pricefeed/keeper"
|
|
"github.com/kava-labs/kava/x/pricefeed/types"
|
|
)
|
|
|
|
// EndBlocker updates the current pricefeed
|
|
func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
|
|
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)
|
|
|
|
k.SetCurrentPricesForAllMarkets(ctx)
|
|
}
|