0g-chain/x/pricefeed/abci.go
2019-11-27 09:45:59 -05:00

21 lines
420 B
Go

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
}