-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathabci.go
37 lines (32 loc) · 896 Bytes
/
abci.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package keeper
import (
"context"
"time"
"github.com/cosmos/cosmos-sdk/telemetry"
"github.com/ignite/modules/x/fundraising/types"
)
func (k Keeper) BeginBlocker(ctx context.Context) error {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)
// Get all auctions from the store and execute operations depending on auction status.
auctions, err := k.Auctions(ctx)
if err != nil {
return err
}
for _, auction := range auctions {
switch auction.GetStatus() {
case types.AuctionStatusStandBy:
if err := k.ExecuteStandByStatus(ctx, auction); err != nil {
return err
}
case types.AuctionStatusStarted:
if err := k.ExecuteStartedStatus(ctx, auction); err != nil {
return err
}
case types.AuctionStatusVesting:
if err := k.ExecuteVestingStatus(ctx, auction); err != nil {
return err
}
}
}
return nil
}