/
tx.proto
211 lines (183 loc) · 9.31 KB
/
tx.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
syntax = "proto3";
package tendermint.liquidity.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos_proto/coin.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "github.com/gravity-devs/liquidity/x/liquidity/types";
// Msg defines the liquidity Msg service.
service Msg {
// Submit a create liquidity pool message.
rpc CreatePool(MsgCreatePool) returns (MsgCreatePoolResponse);
// Submit a deposit to the liquidity pool batch.
rpc DepositWithinBatch(MsgDepositWithinBatch) returns (MsgDepositWithinBatchResponse);
// Submit a withdraw from the liquidity pool batch.
rpc WithdrawWithinBatch(MsgWithdrawWithinBatch) returns (MsgWithdrawWithinBatchResponse);
// Submit a swap to the liquidity pool batch.
rpc Swap(MsgSwapWithinBatch) returns (MsgSwapWithinBatchResponse);
}
// MsgCreatePool defines an sdk.Msg type that supports submitting a create liquidity pool tx.
//
// See: https://github.com/gravity-devs/liquidity/blob/develop/x/liquidity/spec/04_messages.md
message MsgCreatePool {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string pool_creator_address = 1 [(gogoproto.moretags) = "yaml:\"pool_creator_address\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "account address of the origin of this message",
example: "\"cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun\"",
format: "sdk.AccAddress"
}];
// id of the target pool type, must match the value in the pool. Only pool-type-id 1 is supported.
uint32 pool_type_id = 2 [(gogoproto.moretags) = "yaml:\"pool_type_id\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"1\"",
format: "uint32"
}];
// reserve coin pair of the pool to deposit.
repeated cosmos.base.v1beta1.Coin deposit_coins = 4 [(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"deposit_coins\"",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "[{\"denom\": \"denomX\", \"amount\": \"1000000\"}, {\"denom\": \"denomY\", \"amount\": \"2000000\"}]",
format: "sdk.Coins"
}];
}
// MsgCreatePoolResponse defines the Msg/CreatePool response type.
message MsgCreatePoolResponse {}
// `MsgDepositWithinBatch defines` an `sdk.Msg` type that supports submitting
// a deposit request to the batch of the liquidity pool.
// Deposit is submitted to the batch of the Liquidity pool with the specified
// `pool_id`, `deposit_coins` for reserve.
// This request is stacked in the batch of the liquidity pool, is not processed
// immediately, and is processed in the `endblock` at the same time as other requests.
//
// See: https://github.com/gravity-devs/liquidity/blob/develop/x/liquidity/spec/04_messages.md
message MsgDepositWithinBatch {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string depositor_address = 1 [(gogoproto.moretags) = "yaml:\"depositor_address\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "account address of the origin of this message",
example: "\"cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun\"",
format: "sdk.AccAddress"
}];
// id of the target pool
uint64 pool_id = 2 [(gogoproto.moretags) = "yaml:\"pool_id\"", (gogoproto.jsontag) = "pool_id",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"1\"",
format: "uint64"
}];
// reserve coin pair of the pool to deposit
repeated cosmos.base.v1beta1.Coin deposit_coins = 3 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"deposit_coins\"",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "[{\"denom\": \"denomX\", \"amount\": \"1000000\"}, {\"denom\": \"denomY\", \"amount\": \"2000000\"}]",
format: "sdk.Coins"
}];
}
// MsgDepositWithinBatchResponse defines the Msg/DepositWithinBatch response type.
message MsgDepositWithinBatchResponse {}
// `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that supports submitting
// a withdraw request to the batch of the liquidity pool.
// Withdraw is submitted to the batch from the Liquidity pool with the
// specified `pool_id`, `pool_coin` of the pool.
// This request is stacked in the batch of the liquidity pool, is not processed
// immediately, and is processed in the `endblock` at the same time as other requests.
//
// See: https://github.com/gravity-devs/liquidity/blob/develop/x/liquidity/spec/04_messages.md
message MsgWithdrawWithinBatch {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string withdrawer_address = 1 [ (gogoproto.moretags) = "yaml:\"withdrawer_address\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "account address of the origin of this message",
example: "\"cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun\"",
format: "sdk.AccAddress"
}];
// id of the target pool
uint64 pool_id = 2 [(gogoproto.moretags) = "yaml:\"pool_id\"", (gogoproto.jsontag) = "pool_id",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"1\"",
format: "uint64"
}];
cosmos.base.v1beta1.Coin pool_coin = 3 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"pool_coin\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"denom\": \"poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4\", \"amount\": \"1000\"}",
format: "sdk.Coin"
}];
}
// MsgWithdrawWithinBatchResponse defines the Msg/WithdrawWithinBatch response type.
message MsgWithdrawWithinBatchResponse {}
// `MsgSwapWithinBatch` defines an sdk.Msg type that supports submitting a swap offer request to the batch of the liquidity pool.
// Submit swap offer to the liquidity pool batch with the specified the `pool_id`, `swap_type_id`,
// `demand_coin_denom` with the coin and the price you're offering
// and `offer_coin_fee` must be half of offer coin amount * current `params.swap_fee_rate` and ceil for reservation to pay fees.
// This request is stacked in the batch of the liquidity pool, is not processed
// immediately, and is processed in the `endblock` at the same time as other requests.
// You must request the same fields as the pool.
// Only the default `swap_type_id` 1 is supported.
//
// See: https://github.com/gravity-devs/liquidity/tree/develop/doc
// https://github.com/gravity-devs/liquidity/blob/develop/x/liquidity/spec/04_messages.md
message MsgSwapWithinBatch {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address of swap requester
string swap_requester_address = 1 [(gogoproto.moretags) = "yaml:\"swap_requester_address\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "account address of the origin of this message",
example: "\"cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun\"",
format: "sdk.AccAddress"
}];
// id of swap type, must match the value in the pool. Only `swap_type_id` 1 is supported.
uint64 pool_id = 2 [(gogoproto.moretags) = "yaml:\"pool_id\"", (gogoproto.jsontag) = "pool_id",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"1\"",
format: "uint64"
}];
// id of swap type. Must match the value in the pool.
uint32 swap_type_id = 3 [(gogoproto.moretags) = "yaml:\"swap_type_id\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"1\"",
format: "uint32"
}];
// offer sdk.coin for the swap request, must match the denom in the pool.
cosmos.base.v1beta1.Coin offer_coin = 4 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"offer_coin\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"denom\": \"denomX\", \"amount\": \"1000000\"}",
format: "sdk.Coin"
}];
// denom of demand coin to be exchanged on the swap request, must match the denom in the pool.
string demand_coin_denom = 5 [(gogoproto.moretags) = "yaml:\"demand_coin_denom\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"denomB\"",
}];
// half of offer coin amount * params.swap_fee_rate and ceil for reservation to pay fees.
cosmos.base.v1beta1.Coin offer_coin_fee = 6 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"offer_coin_fee\"",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"denom\": \"denomX\", \"amount\": \"5000\"}",
format: "sdk.Coin"
}
];
// limit order price for the order, the price is the exchange ratio of X/Y
// where X is the amount of the first coin and Y is the amount
// of the second coin when their denoms are sorted alphabetically.
string order_price = 7 [
(gogoproto.moretags) = "yaml:\"order_price\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"1.1\"",
format: "sdk.Dec"
}];
}
// MsgSwapWithinBatchResponse defines the Msg/Swap response type.
message MsgSwapWithinBatchResponse {}