mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 15:55: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"
|
"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.
|
// 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.
|
// 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.
|
// Auction is an interface for handling common actions on auctions.
|
||||||
type Auction interface {
|
type Auction interface {
|
||||||
@ -57,6 +57,7 @@ func (a BaseAuction) GetBid() sdk.Coin { return a.Bid }
|
|||||||
// GetEndTime is a getter for auction end time.
|
// GetEndTime is a getter for auction end time.
|
||||||
func (a BaseAuction) GetEndTime() time.Time { return a.EndTime }
|
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 {
|
func (a BaseAuction) Validate() error {
|
||||||
if a.EndTime.After(a.MaxEndTime) {
|
if a.EndTime.After(a.MaxEndTime) {
|
||||||
return fmt.Errorf("MaxEndTime < EndTime (%s < %s)", a.MaxEndTime, a.EndTime)
|
return fmt.Errorf("MaxEndTime < EndTime (%s < %s)", a.MaxEndTime, a.EndTime)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
|
// Events for auction module
|
||||||
const (
|
const (
|
||||||
EventTypeAuctionStart = "auction_start"
|
EventTypeAuctionStart = "auction_start"
|
||||||
EventTypeAuctionBid = "auction_bid"
|
EventTypeAuctionBid = "auction_bid"
|
||||||
|
@ -20,9 +20,11 @@ const (
|
|||||||
// DefaultParamspace default name for parameter store
|
// DefaultParamspace default name for parameter store
|
||||||
DefaultParamspace = ModuleName
|
DefaultParamspace = ModuleName
|
||||||
|
|
||||||
|
// QuerierRoute route used for abci queries
|
||||||
QuerierRoute = ModuleName
|
QuerierRoute = ModuleName
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Key prefixes
|
||||||
var (
|
var (
|
||||||
AuctionKeyPrefix = []byte{0x00} // prefix for keys that store auctions
|
AuctionKeyPrefix = []byte{0x00} // prefix for keys that store auctions
|
||||||
AuctionByTimeKeyPrefix = []byte{0x01} // prefix for keys that are part of the auctionsByTime index
|
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
|
NextAuctionIDKey = []byte{0x02} // key for the next auction id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GetAuctionKey returns the bytes of an auction key
|
||||||
func GetAuctionKey(auctionID uint64) []byte {
|
func GetAuctionKey(auctionID uint64) []byte {
|
||||||
return Uint64ToBytes(auctionID)
|
return Uint64ToBytes(auctionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAuctionByTimeKey returns the key for iterating auctions by time
|
||||||
func GetAuctionByTimeKey(endTime time.Time, auctionID uint64) []byte {
|
func GetAuctionByTimeKey(endTime time.Time, auctionID uint64) []byte {
|
||||||
return append(sdk.FormatTimeBytes(endTime), Uint64ToBytes(auctionID)...)
|
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.
|
// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs.
|
||||||
// nolint
|
|
||||||
func (p *Params) ParamSetPairs() subspace.ParamSetPairs {
|
func (p *Params) ParamSetPairs() subspace.ParamSetPairs {
|
||||||
return subspace.ParamSetPairs{
|
return subspace.ParamSetPairs{
|
||||||
{KeyAuctionBidDuration, &p.BidDuration},
|
{Key: KeyAuctionBidDuration, Value: &p.BidDuration},
|
||||||
{KeyAuctionDuration, &p.MaxAuctionDuration},
|
{Key: KeyAuctionDuration, Value: &p.MaxAuctionDuration},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ func (n QueryResAuctions) String() string {
|
|||||||
|
|
||||||
// QueryAllAuctionParams is the params for an auctions query
|
// QueryAllAuctionParams is the params for an auctions query
|
||||||
type QueryAllAuctionParams struct {
|
type QueryAllAuctionParams struct {
|
||||||
Page int `json"page:" yaml:"page"`
|
Page int `json:"page" yaml:"page"`
|
||||||
Limit int `json"limit:" yaml:"limit"`
|
Limit int `json:"limit" yaml:"limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewQueryAllAuctionParams creates a new QueryAllAuctionParams
|
// NewQueryAllAuctionParams creates a new QueryAllAuctionParams
|
||||||
|
Loading…
Reference in New Issue
Block a user