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

24 lines
630 B
Go
Raw Normal View History

2019-11-25 19:46:02 +00:00
package auction
import (
"errors"
"time"
"github.com/cosmos/cosmos-sdk/telemetry"
2019-11-25 19:46:02 +00:00
sdk "github.com/cosmos/cosmos-sdk/types"
2024-05-01 03:17:24 +00:00
"github.com/0glabs/0g-chain/x/auction/keeper"
"github.com/0glabs/0g-chain/x/auction/types"
2019-11-25 19:46:02 +00:00
)
// BeginBlocker closes all expired auctions at the end of each block. It panics if
// there's an error other than ErrAuctionNotFound.
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)
err := k.CloseExpiredAuctions(ctx)
if err != nil && !errors.Is(err, types.ErrAuctionNotFound) {
panic(err)
2019-11-25 19:46:02 +00:00
}
}