Skip to content

Commit ca70cb2

Browse files
author
hashkid
committed
add protobuf
1 parent a26318e commit ca70cb2

10 files changed

Lines changed: 232 additions & 0 deletions

File tree

proto/side/auction/auction.proto

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
syntax = "proto3";
2+
package side.auction;
3+
4+
import "gogoproto/gogo.proto";
5+
// import "side/btcbridge/params.proto";
6+
// import "side/btcbridge/btcbridge.proto";
7+
8+
option go_package = "github.com/sideprotocol/side/x/auction/types";
9+
10+
message Bid {
11+
string auction_id = 1;
12+
string bidder = 2;
13+
int64 bid_price = 3;
14+
Coin bid_amount = 4;
15+
BidStatus status = 5;
16+
}
17+
18+
message Auction {
19+
string id = 1;
20+
Coin deposited_asset = 2;
21+
string borrower = 3;
22+
int64 liquidated_price = 4;
23+
int64 liquidated_time = 5;
24+
int64 expected_value = 6;
25+
int64 bidded_value = 7;
26+
AuctionStatus status = 8;
27+
string payment_tx_id = 9;
28+
}
29+
30+
enum AssetType {
31+
Bitcoin = 1;
32+
}
33+
34+
enum AuctionStatus {
35+
AuctionOpen = 1;
36+
AuctionClose = 2;
37+
}
38+
39+
enum BidStatus {
40+
Bidding = 1;
41+
Accepted = 2;
42+
Rejected = 3;
43+
}

proto/side/auction/genesis.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax = "proto3";
2+
package side.auction;
3+
4+
import "gogoproto/gogo.proto";
5+
// import "side/btcbridge/params.proto";
6+
// import "side/btcbridge/btcbridge.proto";
7+
8+
option go_package = "github.com/sideprotocol/side/x/auction/types";
9+
10+

proto/side/auction/params.proto

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
syntax = "proto3";
2+
package side.auction;
3+
4+
import "gogoproto/gogo.proto";
5+
// import "side/btcbridge/params.proto";
6+
// import "side/btcbridge/btcbridge.proto";
7+
8+
option go_package = "github.com/sideprotocol/side/x/auction/types";
9+
10+
// Params defines the parameters for the module.
11+
message Params {
12+
uint32 price_drop_period = 1;
13+
uint32 initial_discount = 2;
14+
uint32 fee_rate = 3;
15+
uint64 min_bid_amount = 4;
16+
}

proto/side/auction/query.proto

Whitespace-only changes.

proto/side/auction/tx.proto

Whitespace-only changes.

proto/side/dlc/dlc.proto

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
syntax = "proto3";
2+
package side.dlc;
3+
4+
import "gogoproto/gogo.proto";
5+
// import "side/btcbridge/params.proto";
6+
// import "side/btcbridge/btcbridge.proto";
7+
8+
option go_package = "github.com/sideprotocol/side/x/dlc/types";
9+
10+
enum AnnouncementStatus {
11+
Announcement_Unspecified = 1;
12+
Announcement_Pending = 2;
13+
Announcement_Ready = 3;
14+
}
15+
16+
message DLCAnnouncement {
17+
string id = 1;
18+
DLCEvent oracle_event = 2;
19+
string signature = 3;
20+
AnnouncementStatus status = 4;
21+
}
22+
23+
message DLCAttestation {
24+
string announcement_id = 1;
25+
string time = 2;
26+
string outcome = 3;
27+
string signature = 4;
28+
}
29+
30+
message DLCEvent {
31+
uint32 maturity_epoch = 2;
32+
string nonce = 3;
33+
string descriptor = 4;
34+
string pubkey = 5;
35+
}
36+
37+
38+

proto/side/dlc/genesis.proto

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
syntax = "proto3";
2+
package side.dlc;
3+
4+
import "gogoproto/gogo.proto";
5+
6+
import "side/dlc/params.proto";
7+
import "side/dlc/dlc.proto";
8+
9+
option go_package = "github.com/sideprotocol/side/x/dlc/types";
10+
11+
// GenesisState defines the dlc module's genesis state.
12+
message GenesisState {
13+
Params params = 1 [(gogoproto.nullable) = false];
14+
15+
repeated DLCAnnouncement announcements = 2;
16+
repeated DLCAttestation attestations = 3;
17+
}

proto/side/dlc/params.proto

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
syntax = "proto3";
2+
package side.dlc;
3+
4+
import "gogoproto/gogo.proto";
5+
6+
option go_package = "github.com/sideprotocol/side/x/dlc/types";
7+
8+
message PriceInterval {
9+
string price_pair = 1;
10+
int32 interval = 2;
11+
}
12+
13+
// Params defines the parameters for the module.
14+
message Params {
15+
repeated PriceInterval price_interval = 1;
16+
}

proto/side/dlc/query.proto

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
syntax = "proto3";
2+
package side.dlc;
3+
4+
import "gogoproto/gogo.proto";
5+
import "google/api/annotations.proto";
6+
import "cosmos/base/query/v1beta1/pagination.proto";
7+
import "side/dlc/params.proto";
8+
import "side/dlc/dlc.proto";
9+
10+
option go_package = "github.com/sideprotocol/side/x/dlc/types";
11+
12+
// Query defines the gRPC querier service.
13+
service Query {
14+
// Parameters queries the parameters of the module.
15+
rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) {
16+
option (google.api.http).get = "/side/dlc/params";
17+
}
18+
rpc QueryAnnouncements(QueryAnnouncementRequest) returns (QueryAnnouncementResponse) {
19+
option (google.api.http).get = "/side/dlc/announcements";
20+
}
21+
rpc QueryPrices(QueryPriceRequest) returns (QueryPricesResponse) {
22+
option (google.api.http).get = "/side/dlc/announcements";
23+
}
24+
25+
}
26+
27+
// QueryParamsRequest is request type for the QueryParams RPC method.
28+
message QueryParamsRequest {
29+
}
30+
31+
// QueryParamsResponse is response type for the QueryParams RPC method.
32+
message QueryParamsResponse {
33+
Params params = 1;
34+
}
35+
36+
// QueryAnnouncementRequest is request type for the Query/QueryAnnouncements RPC method.
37+
message QueryAnnouncementRequest {
38+
string status = 1;
39+
cosmos.base.query.v1beta1.PageRequest pagination = 2;
40+
}
41+
42+
// QueryAnnouncementResponse is response type for the Query/QueryAnnouncements RPC method.
43+
message QueryAnnouncementResponse {
44+
repeated DLCAnnouncement announcements = 1;
45+
cosmos.base.query.v1beta1.PageResponse pagination = 2;
46+
}
47+
48+
// QueryAnnouncementRequest is request type for the Query/QueryAnnouncements RPC method.
49+
message QueryPriceRequest {
50+
string symbol = 1;
51+
}
52+
53+
// QueryAnnouncementResponse is response type for the Query/QueryAnnouncements RPC method.
54+
message QueryPricesResponse {
55+
uint32 price = 1;
56+
}
57+

proto/side/dlc/tx.proto

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
syntax = "proto3";
2+
package side.dlc;
3+
4+
import "gogoproto/gogo.proto";
5+
6+
option go_package = "github.com/sideprotocol/side/x/dlc/types";
7+
8+
// Msg defines the Msg service.
9+
service Msg {
10+
option (cosmos.msg.v1.service) = true;
11+
12+
rpc SubmitAnnounceNonce (MsgSubmitAnnouncementNonce) returns (MsgSubmitAnnouncementNonceResponse);
13+
rpc SubmitAttestation(MsgSubmitAttestation) returns (MsgSubmitAttestationResponse);
14+
}
15+
16+
message MsgSubmitAnnouncementNonce {
17+
option (cosmos.msg.v1.signer) = "sender";
18+
19+
string sender = 1;
20+
string announcement_id = 2;
21+
string nonce = 3;
22+
string signature = 4;
23+
}
24+
25+
message MsgSubmitAnnouncementNonceResponse {}
26+
27+
28+
message MsgSubmitAttestation {
29+
option (cosmos.msg.v1.signer) = "sender";
30+
string sender = 1;
31+
string announcement_id = 2;
32+
string signature = 3;
33+
}
34+
35+
message MsgSubmitAttestationResponse {}

0 commit comments

Comments
 (0)