0g-chain/x/pricefeed/abci.go

21 lines
420 B
Go
Raw Normal View History

2019-11-27 14:45:59 +00:00
package pricefeed
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// EndBlocker updates the current pricefeed
func EndBlocker(ctx sdk.Context, k Keeper) {
// Update the current price of each asset.
for _, a := range k.GetAssetParams(ctx) {
if a.Active {
err := k.SetCurrentPrices(ctx, a.AssetCode)
if err != nil {
// TODO emit an event that price failed to update
continue
}
}
}
return
}