mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-28 09:15:24 +00:00
7eede47769
* refactor bidding test * add some more bid test cases * add balance checks to bid tests * add more checks to bid tests * add min bid increments * protect against negative lot amounts * fix params tests * change endblocker to beginblocker * update spec * fix params tests * fix: update alias Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
19 lines
424 B
Markdown
19 lines
424 B
Markdown
# Begin Block
|
|
|
|
At the start of each block, auctions that have reached `EndTime` are closed. The logic to close auctions is as follows:
|
|
|
|
```go
|
|
var expiredAuctions []uint64
|
|
k.IterateAuctionsByTime(ctx, ctx.BlockTime(), func(id uint64) bool {
|
|
expiredAuctions = append(expiredAuctions, id)
|
|
return false
|
|
})
|
|
|
|
for _, id := range expiredAuctions {
|
|
err := k.CloseAuction(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
```
|