Consistent variable naming

This commit is contained in:
Prathamesh Musale 2024-02-26 18:12:05 +05:30
parent 43afe3fc2a
commit 56930ffa35
14 changed files with 35 additions and 35 deletions

View File

@ -7169,7 +7169,7 @@ type QueryAuctionRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Auction ID
// Auction id
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
@ -7243,7 +7243,7 @@ type QueryBidRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Auction ID
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"`
// Bidder address
Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"`
@ -7326,7 +7326,7 @@ type QueryBidsRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Auction ID
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"`
}

View File

@ -3371,7 +3371,7 @@ type MsgCommitBid struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Auction ID
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"`
// Commit Hash
CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"`
@ -3463,7 +3463,7 @@ type MsgRevealBid struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Auction ID
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"`
// Commit Hash
Reveal string `protobuf:"bytes,2,opt,name=reveal,proto3" json:"reveal,omitempty"`

2
go.mod
View File

@ -37,6 +37,7 @@ require (
github.com/ipld/go-ipld-prime v0.21.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.17.0
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.32.0
@ -169,7 +170,6 @@ require (
go.etcd.io/bbolt v1.3.8 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.15.0 // indirect

View File

@ -77,7 +77,7 @@ message QueryAuctionsResponse {
// AuctionRequest is the format for querying a specific auction
message QueryAuctionRequest {
// Auction ID
// Auction id
string id = 1;
}
@ -89,7 +89,7 @@ message QueryAuctionResponse {
// BidRequest is the format for querying a specific bid in an auction
message QueryBidRequest {
// Auction ID
// Auction id
string auction_id = 1;
// Bidder address
string bidder = 2;
@ -103,7 +103,7 @@ message QueryBidResponse {
// BidsRequest is the format for querying all bids in an auction
message QueryBidsRequest {
// Auction ID
// Auction id
string auction_id = 1;
}

View File

@ -85,7 +85,7 @@ message MsgCommitBid {
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// Auction ID
// Auction id
string auction_id = 1 [(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""];
// Commit Hash
@ -109,7 +109,7 @@ message MsgRevealBid {
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// Auction ID
// Auction id
string auction_id = 1 [(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""];
// Commit Hash

View File

@ -11,7 +11,7 @@ const (
AttributeKeyRevealFee = "reveal-fee"
AttributeKeyMinimumBid = "minimum-bid"
AttributeKeySigner = "signer"
AttributeKeyAuctionID = "auction-id"
AttributeKeyAuctionId = "auction-id"
AttributeKeyCommitHash = "commit-hash"
AttributeKeyReveal = "reveal"

View File

@ -8,11 +8,11 @@ import (
// Used to, for example, prevent deletion of a auction that's in use.
type AuctionUsageKeeper interface {
ModuleName() string
UsesAuction(ctx sdk.Context, auctionID string) bool
UsesAuction(ctx sdk.Context, auctionId string) bool
OnAuction(ctx sdk.Context, auctionID string)
OnAuctionBid(ctx sdk.Context, auctionID string, bidderAddress string)
OnAuctionWinnerSelected(ctx sdk.Context, auctionID string)
OnAuction(ctx sdk.Context, auctionId string)
OnAuctionBid(ctx sdk.Context, auctionId string, bidderAddress string)
OnAuctionWinnerSelected(ctx sdk.Context, auctionId string)
}
// AuctionHooksWrapper is a wrapper for modules to inject AuctionUsageKeeper using depinject.

View File

@ -473,13 +473,13 @@ func (k Keeper) RevealBid(ctx sdk.Context, msg auctiontypes.MsgRevealBid) (*auct
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Reveal JSON unmarshal error.")
}
chainID, err := wnsUtils.GetAttributeAsString(reveal, "chainId")
if err != nil || chainID != ctx.ChainID() {
chainId, err := wnsUtils.GetAttributeAsString(reveal, "chainId")
if err != nil || chainId != ctx.ChainID() {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal chainID.")
}
auctionID, err := wnsUtils.GetAttributeAsString(reveal, "auctionId")
if err != nil || auctionID != msg.AuctionId {
auctionId, err := wnsUtils.GetAttributeAsString(reveal, "auctionId")
if err != nil || auctionId != msg.AuctionId {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal auction Id.")
}

View File

@ -67,7 +67,7 @@ func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid)
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
auctiontypes.EventTypeCommitBid,
sdk.NewAttribute(auctiontypes.AttributeKeyAuctionID, msg.AuctionId),
sdk.NewAttribute(auctiontypes.AttributeKeyAuctionId, msg.AuctionId),
sdk.NewAttribute(auctiontypes.AttributeKeyCommitHash, msg.CommitHash),
),
sdk.NewEvent(
@ -98,7 +98,7 @@ func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid)
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
auctiontypes.EventTypeRevealBid,
sdk.NewAttribute(auctiontypes.AttributeKeyAuctionID, msg.AuctionId),
sdk.NewAttribute(auctiontypes.AttributeKeyAuctionId, msg.AuctionId),
sdk.NewAttribute(auctiontypes.AttributeKeyReveal, msg.Reveal),
),
sdk.NewEvent(

View File

@ -25,9 +25,9 @@ func NewMsgCreateAuction(params Params, signer sdk.AccAddress) MsgCreateAuction
}
// NewMsgCommitBid is the constructor function for MsgCommitBid.
func NewMsgCommitBid(auctionID string, commitHash string, signer sdk.AccAddress) MsgCommitBid {
func NewMsgCommitBid(auctionId string, commitHash string, signer sdk.AccAddress) MsgCommitBid {
return MsgCommitBid{
AuctionId: auctionID,
AuctionId: auctionId,
CommitHash: commitHash,
Signer: signer.String(),
}

View File

@ -217,7 +217,7 @@ func (m *QueryAuctionsResponse) GetPagination() *query.PageRequest {
// AuctionRequest is the format for querying a specific auction
type QueryAuctionRequest struct {
// Auction ID
// Auction id
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
@ -309,7 +309,7 @@ func (m *QueryAuctionResponse) GetAuction() *Auction {
// BidRequest is the format for querying a specific bid in an auction
type QueryBidRequest struct {
// Auction ID
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"`
// Bidder address
Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"`
@ -410,7 +410,7 @@ func (m *QueryBidResponse) GetBid() *Bid {
// BidsRequest is the format for querying all bids in an auction
type QueryBidsRequest struct {
// Auction ID
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"`
}

View File

@ -125,7 +125,7 @@ var xxx_messageInfo_MsgCreateAuctionResponse proto.InternalMessageInfo
// CommitBid defines the message to commit a bid
type MsgCommitBid struct {
// Auction ID
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auction_id" yaml:"auction_id"`
// Commit Hash
CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty" json:"commit_hash" yaml:"commit_hash"`
@ -207,7 +207,7 @@ var xxx_messageInfo_MsgCommitBidResponse proto.InternalMessageInfo
// RevealBid defines the message to reveal a bid
type MsgRevealBid struct {
// Auction ID
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auction_id" yaml:"auction_id"`
// Commit Hash
Reveal string `protobuf:"bytes,2,opt,name=reveal,proto3" json:"reveal,omitempty" json:"reveal" yaml:"reveal"`

View File

@ -29,14 +29,14 @@ const (
BidStatusRevealed = "reveal"
)
// AuctionId simplifies generation of auction IDs.
// AuctionId simplifies generation of auction ids.
type AuctionId struct {
Address sdk.Address
AccNum uint64
Sequence uint64
}
// Generate creates the auction ID.
// Generate creates the auction id.
func (auctionId AuctionId) Generate() string {
hasher := sha256.New()
str := fmt.Sprintf("%s:%d:%d", auctionId.Address.String(), auctionId.AccNum, auctionId.Sequence)

View File

@ -41,19 +41,19 @@ func (k RecordKeeper) ModuleName() string {
return registrytypes.ModuleName
}
func (k RecordKeeper) UsesAuction(ctx sdk.Context, auctionID string) bool {
func (k RecordKeeper) UsesAuction(ctx sdk.Context, auctionId string) bool {
panic("unimplemented")
}
func (k RecordKeeper) OnAuction(ctx sdk.Context, auctionID string) {
func (k RecordKeeper) OnAuction(ctx sdk.Context, auctionId string) {
panic("unimplemented")
}
func (k RecordKeeper) OnAuctionBid(ctx sdk.Context, auctionID string, bidderAddress string) {
func (k RecordKeeper) OnAuctionBid(ctx sdk.Context, auctionId string, bidderAddress string) {
panic("unimplemented")
}
func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionID string) {
func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionId string) {
panic("unimplemented")
}