mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
chore: linting
This commit is contained in:
parent
6bf1a4ce5b
commit
407361313e
@ -8,10 +8,10 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/supply"
|
||||
)
|
||||
|
||||
// distantFuture is a very large time value to use as initial the ending time for auctions.
|
||||
// DistantFuture is a very large time value to use as initial the ending time for auctions.
|
||||
// It is not set to the max time supported. This can cause problems with time comparisons, see https://stackoverflow.com/a/32620397.
|
||||
// Also amino panics when encoding times ≥ the start of year 10000.
|
||||
var DistantFuture time.Time = time.Date(9000, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
var DistantFuture = time.Date(9000, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
// Auction is an interface for handling common actions on auctions.
|
||||
type Auction interface {
|
||||
@ -57,6 +57,7 @@ func (a BaseAuction) GetBid() sdk.Coin { return a.Bid }
|
||||
// GetEndTime is a getter for auction end time.
|
||||
func (a BaseAuction) GetEndTime() time.Time { return a.EndTime }
|
||||
|
||||
// Validate verifies that the auction end time is before max end time
|
||||
func (a BaseAuction) Validate() error {
|
||||
if a.EndTime.After(a.MaxEndTime) {
|
||||
return fmt.Errorf("MaxEndTime < EndTime (%s < %s)", a.MaxEndTime, a.EndTime)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package types
|
||||
|
||||
// Events for auction module
|
||||
const (
|
||||
EventTypeAuctionStart = "auction_start"
|
||||
EventTypeAuctionBid = "auction_bid"
|
||||
|
@ -20,9 +20,11 @@ const (
|
||||
// DefaultParamspace default name for parameter store
|
||||
DefaultParamspace = ModuleName
|
||||
|
||||
// QuerierRoute route used for abci queries
|
||||
QuerierRoute = ModuleName
|
||||
)
|
||||
|
||||
// Key prefixes
|
||||
var (
|
||||
AuctionKeyPrefix = []byte{0x00} // prefix for keys that store auctions
|
||||
AuctionByTimeKeyPrefix = []byte{0x01} // prefix for keys that are part of the auctionsByTime index
|
||||
@ -30,10 +32,12 @@ var (
|
||||
NextAuctionIDKey = []byte{0x02} // key for the next auction id
|
||||
)
|
||||
|
||||
// GetAuctionKey returns the bytes of an auction key
|
||||
func GetAuctionKey(auctionID uint64) []byte {
|
||||
return Uint64ToBytes(auctionID)
|
||||
}
|
||||
|
||||
// GetAuctionByTimeKey returns the key for iterating auctions by time
|
||||
func GetAuctionByTimeKey(endTime time.Time, auctionID uint64) []byte {
|
||||
return append(sdk.FormatTimeBytes(endTime), Uint64ToBytes(auctionID)...)
|
||||
}
|
||||
|
@ -54,11 +54,10 @@ func ParamKeyTable() subspace.KeyTable {
|
||||
}
|
||||
|
||||
// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs.
|
||||
// nolint
|
||||
func (p *Params) ParamSetPairs() subspace.ParamSetPairs {
|
||||
return subspace.ParamSetPairs{
|
||||
{KeyAuctionBidDuration, &p.BidDuration},
|
||||
{KeyAuctionDuration, &p.MaxAuctionDuration},
|
||||
{Key: KeyAuctionBidDuration, Value: &p.BidDuration},
|
||||
{Key: KeyAuctionDuration, Value: &p.MaxAuctionDuration},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@ func (n QueryResAuctions) String() string {
|
||||
|
||||
// QueryAllAuctionParams is the params for an auctions query
|
||||
type QueryAllAuctionParams struct {
|
||||
Page int `json"page:" yaml:"page"`
|
||||
Limit int `json"limit:" yaml:"limit"`
|
||||
Page int `json:"page" yaml:"page"`
|
||||
Limit int `json:"limit" yaml:"limit"`
|
||||
}
|
||||
|
||||
// NewQueryAllAuctionParams creates a new QueryAllAuctionParams
|
||||
|
Loading…
Reference in New Issue
Block a user