Skip to content

Commit 8ee1fe4

Browse files
authored
Merge pull request #453 from persistenceOne/puneet/add-pobtypes
chore: add pob types so testnet gov can be unmarshalled
2 parents 13104b1 + 4a3610f commit 8ee1fe4

10 files changed

Lines changed: 2760 additions & 0 deletions

File tree

proto/pob/builder/v1/genesis.proto

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
syntax = "proto3";
2+
package pob.builder.v1;
3+
4+
import "gogoproto/gogo.proto";
5+
import "cosmos/base/v1beta1/coin.proto";
6+
import "amino/amino.proto";
7+
8+
option go_package = "github.com/persistenceOne/persistence-sdk/v6/x/pob/types";
9+
10+
// Params defines the parameters of the x/builder module.
11+
message Params {
12+
option deprecated = true;
13+
option (amino.name) = "cosmos-sdk/x/builder/Params";
14+
15+
// max_bundle_size is the maximum number of transactions that can be bundled
16+
// in a single bundle.
17+
uint32 max_bundle_size = 1;
18+
19+
// escrow_account_address is the address of the account that will receive a
20+
// portion of the bid proceeds.
21+
bytes escrow_account_address = 2;
22+
23+
// reserve_fee specifies the bid floor for the auction.
24+
cosmos.base.v1beta1.Coin reserve_fee = 3
25+
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
26+
27+
// min_bid_increment specifies the minimum amount that the next bid must be
28+
// greater than the previous bid.
29+
cosmos.base.v1beta1.Coin min_bid_increment = 4
30+
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
31+
32+
// front_running_protection specifies whether front running and sandwich
33+
// attack protection is enabled.
34+
bool front_running_protection = 5;
35+
36+
// proposer_fee defines the portion of the winning bid that goes to the block
37+
// proposer that proposed the block.
38+
string proposer_fee = 6 [
39+
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
40+
(gogoproto.nullable) = false
41+
];
42+
}

proto/pob/builder/v1/query.proto

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
syntax = "proto3";
2+
package pob.builder.v1;
3+
4+
import "gogoproto/gogo.proto";
5+
import "google/api/annotations.proto";
6+
import "cosmos/query/v1/query.proto";
7+
import "pob/builder/v1/genesis.proto";
8+
9+
option go_package = "github.com/persistenceOne/persistence-sdk/v6/x/pob/types";
10+
11+
// Query defines the x/builder querier service.
12+
service Query {
13+
option deprecated = true;
14+
15+
// Params queries the parameters of the x/builder module.
16+
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
17+
option (google.api.http).get = "/pob/builder/v1/params";
18+
}
19+
}
20+
21+
// QueryParamsRequest is the request type for the Query/Params RPC method.
22+
message QueryParamsRequest {
23+
option deprecated = true;
24+
}
25+
26+
// QueryParamsResponse is the response type for the Query/Params RPC method.
27+
message QueryParamsResponse {
28+
option deprecated = true;
29+
// params defines the parameters of the module.
30+
Params params = 1 [ (gogoproto.nullable) = false ];
31+
}

proto/pob/builder/v1/tx.proto

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
syntax = "proto3";
2+
package pob.builder.v1;
3+
4+
import "gogoproto/gogo.proto";
5+
import "google/api/annotations.proto";
6+
import "cosmos/base/v1beta1/coin.proto";
7+
import "pob/builder/v1/genesis.proto";
8+
import "cosmos_proto/cosmos.proto";
9+
import "cosmos/msg/v1/msg.proto";
10+
import "amino/amino.proto";
11+
12+
option go_package = "github.com/persistenceOne/persistence-sdk/v6/x/pob/types";
13+
14+
// Msg defines the x/builder Msg service.
15+
service Msg {
16+
option deprecated = true;
17+
option (cosmos.msg.v1.service) = true;
18+
19+
// AuctionBid defines a method for sending bids to the x/builder module.
20+
rpc AuctionBid(MsgAuctionBid) returns (MsgAuctionBidResponse) {
21+
option (google.api.http).post = "/pob/builder/v1/bid";
22+
};
23+
24+
// UpdateParams defines a governance operation for updating the x/builder
25+
// module parameters. The authority is hard-coded to the x/gov module account.
26+
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
27+
}
28+
29+
// MsgAuctionBid defines a request type for sending bids to the x/builder
30+
// module.
31+
message MsgAuctionBid {
32+
option deprecated = true;
33+
option (cosmos.msg.v1.signer) = "bidder";
34+
option (amino.name) = "pob/x/builder/MsgAuctionBid";
35+
36+
option (gogoproto.equal) = false;
37+
38+
// bidder is the address of the account that is submitting a bid to the
39+
// auction.
40+
string bidder = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
41+
// bid is the amount of coins that the bidder is bidding to participate in the
42+
// auction.
43+
cosmos.base.v1beta1.Coin bid = 2
44+
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
45+
// transactions are the bytes of the transactions that the bidder wants to
46+
// bundle together.
47+
repeated bytes transactions = 3;
48+
}
49+
50+
// MsgAuctionBidResponse defines the Msg/AuctionBid response type.
51+
message MsgAuctionBidResponse {
52+
option deprecated = true;
53+
}
54+
55+
// MsgUpdateParams defines a request type for updating the x/builder module
56+
// parameters.
57+
message MsgUpdateParams {
58+
option deprecated = true;
59+
option (cosmos.msg.v1.signer) = "authority";
60+
option (amino.name) = "pob/x/builder/MsgUpdateParams";
61+
62+
option (gogoproto.equal) = false;
63+
64+
// authority is the address of the account that is authorized to update the
65+
// x/builder module parameters.
66+
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
67+
// params is the new parameters for the x/builder module.
68+
Params params = 2 [ (gogoproto.nullable) = false ];
69+
}
70+
71+
// MsgUpdateParamsResponse defines the Msg/UpdateParams response type.
72+
message MsgUpdateParamsResponse {
73+
option deprecated = true;
74+
}

x/pob/types/codec.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package types
2+
3+
import (
4+
"github.com/cosmos/cosmos-sdk/codec"
5+
"github.com/cosmos/cosmos-sdk/codec/legacy"
6+
"github.com/cosmos/cosmos-sdk/codec/types"
7+
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
8+
sdk "github.com/cosmos/cosmos-sdk/types"
9+
"github.com/cosmos/cosmos-sdk/types/msgservice"
10+
)
11+
12+
var (
13+
amino = codec.NewLegacyAmino()
14+
ModuleCdc = codec.NewAminoCodec(amino)
15+
)
16+
17+
func init() {
18+
RegisterLegacyAminoCodec(amino)
19+
cryptocodec.RegisterCrypto(amino)
20+
sdk.RegisterLegacyAminoCodec(amino)
21+
}
22+
23+
// RegisterLegacyAminoCodec registers the necessary x/builder interfaces and
24+
// concrete types on the provided LegacyAmino codec. These types are used for
25+
// Amino JSON serialization.
26+
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
27+
legacy.RegisterAminoMsg(cdc, &MsgAuctionBid{}, "pob/x/builder/MsgAuctionBid")
28+
legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "pob/x/builder/MsgUpdateParams")
29+
30+
cdc.RegisterConcrete(Params{}, "pob/builder/Params", nil)
31+
}
32+
33+
// RegisterInterfaces registers the x/builder interfaces types with the
34+
// interface registry.
35+
func RegisterInterfaces(registry types.InterfaceRegistry) {
36+
registry.RegisterImplementations(
37+
(*sdk.Msg)(nil),
38+
&MsgAuctionBid{},
39+
&MsgUpdateParams{},
40+
)
41+
42+
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
43+
}

0 commit comments

Comments
 (0)