-
Notifications
You must be signed in to change notification settings - Fork 170
/
tx.proto
266 lines (226 loc) · 11.7 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
syntax = "proto3";
package umee.leverage.v1;
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "umee/leverage/v1/leverage.proto";
option go_package = "github.com/umee-network/umee/v5/x/leverage/types";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.messagename_all) = true;
// Msg defines the x/leverage module's Msg service.
service Msg {
// Supply moves tokens from user balance to the module for lending or collateral.
// The user receives uTokens in return.
rpc Supply(MsgSupply) returns (MsgSupplyResponse);
// Withdraw moves previously supplied tokens from the module back to the user balance in
// exchange for burning uTokens.
rpc Withdraw(MsgWithdraw) returns (MsgWithdrawResponse);
// MaxWithdraw moves previously supplied tokens from the module back to the user balance in
// exchange for burning uTokens. It automatically calculates the maximum valid amount to withdraw.
// Zero is returned if no more tokens can be withdrawn.
rpc MaxWithdraw(MsgMaxWithdraw) returns (MsgMaxWithdrawResponse);
// Collateralize enables selected uTokens as collateral, which moves them to the module.
rpc Collateralize(MsgCollateralize) returns (MsgCollateralizeResponse);
// Decollateralize disables selected uTokens as collateral. They are returned to the user's
// balance from the module.
rpc Decollateralize(MsgDecollateralize) returns (MsgDecollateralizeResponse);
// Borrow allows a user to borrow tokens from the module if they have sufficient collateral.
rpc Borrow(MsgBorrow) returns (MsgBorrowResponse);
// MaxBorrow allows a user to borrow the maximum amount of tokens their collateral will allow.
// Zero is returned if no more can be borrowed.
rpc MaxBorrow(MsgMaxBorrow) returns (MsgMaxBorrowResponse);
// Repay allows a user to repay previously borrowed tokens and interest.
rpc Repay(MsgRepay) returns (MsgRepayResponse);
// Liquidate allows a user to repay a different user's borrowed coins in exchange for some
// of the target's collateral.
rpc Liquidate(MsgLiquidate) returns (MsgLiquidateResponse);
// LeveragedLiquidate allows a user to repay a different user's borrowed coins in exchange for some
// of the target's collateral. For leveraged liquidations, the tokens to repay are borrowed instead of
// being taken from the liquidator's wallet, and the reward is immediately collateralized. Borrow
// limit checks for the liquidator are deferred until after the reward is collateralized, allowing
// this initial borrow to exceed the liquidator's borrow limit as long as it is healthy by the end
// of the transaction. Repay amount is calculated automatically, so the liquidator only specifies
// repay and reward token denoms. For safety, the liquidator cannot exceed 80% of their borrow limit when
// executing this transaction, instead of the regular 100%. Also allows repayment and reward denoms to
// be left blank - if not specified, the module will automatically select the first (alphabetically by denom)
// borrow and/or collateral on the target account and the proceed normally.
rpc LeveragedLiquidate(MsgLeveragedLiquidate) returns (MsgLeveragedLiquidateResponse);
// SupplyCollateral combines the Supply and Collateralize actions.
rpc SupplyCollateral(MsgSupplyCollateral) returns (MsgSupplyCollateralResponse);
// GovUpdateRegistry adds new tokens to the token registry or
// updates existing tokens with new settings.
rpc GovUpdateRegistry(MsgGovUpdateRegistry) returns (MsgGovUpdateRegistryResponse);
}
// MsgSupply represents a user's request to supply assets to the module.
message MsgSupply {
// Supplier is the account address supplying assets and the signer of the message.
string supplier = 1;
cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false];
}
// MsgWithdraw represents a user's request to withdraw supplied assets.
// Asset must be a uToken.
message MsgWithdraw {
// Supplier is the account address withdrawing assets and the signer of the message.
string supplier = 1;
cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false];
}
// MsgMaxWithdraw represents a user's request to withdraw the maximum valid amount of supplied assets.
message MsgMaxWithdraw {
// Supplier is the account address withdrawing assets and the signer of the message.
string supplier = 1;
// Denom is base token denom to withdraw
string denom = 2;
}
// MsgCollateralize represents a user's request to enable selected
// uTokens as collateral.
message MsgCollateralize {
// Borrower is the account address adding collateral and the signer of the message.
string borrower = 1;
cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false];
}
// MsgDecollateralize represents a user's request to disable selected
// uTokens as collateral.
message MsgDecollateralize {
// Borrower is the account address removing collateral and the signer of the message.
string borrower = 1;
cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false];
}
// MsgBorrow represents a user's request to borrow a base asset type
// from the module.
message MsgBorrow {
// Borrower is the account address taking a loan and the signer
// of the message.
string borrower = 1;
cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false];
}
// MsgMaxBorrow represents a user's request to borrow a base asset type
// from the module, using the maximum available amount.
message MsgMaxBorrow {
// Borrower is the account address taking a loan and the signer
// of the message.
string borrower = 1;
string denom = 2;
}
// MsgRepay represents a user's request to repay a borrowed base asset
// type to the module.
message MsgRepay {
// Borrower is the account address repaying a loan and the signer
// of the message.
string borrower = 1;
cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false];
}
// MsgLiquidate is the request structure for the Liquidate RPC.
message MsgLiquidate {
// Liquidator is the account address performing a liquidation and the signer
// of the message.
string liquidator = 1;
// Borrower is the account whose borrow is being repaid, and collateral consumed,
// by the liquidation. It does not sign the message.
string borrower = 2;
// Repayment is the maximum amount of base tokens that the liquidator is willing
// to repay.
cosmos.base.v1beta1.Coin repayment = 3 [(gogoproto.nullable) = false];
// RewardDenom is the denom that the liquidator will receive as a liquidation reward.
// If it is a uToken, the liquidator will receive uTokens from the borrower's
// collateral. If it is a base token, the uTokens will be redeemed directly at
// a reduced Liquidation Incentive, and the liquidator will receive base tokens.
string reward_denom = 4;
}
// MsgLeveragedLiquidate is the request structure for the LeveragedLiquidate RPC.
message MsgLeveragedLiquidate {
// Liquidator is the account address performing a liquidation and the signer
// of the message.
string liquidator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Borrower is the account whose borrow is being repaid, and collateral consumed,
// by the liquidation. It does not sign the message.
string borrower = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// RepayDenom is the base token that the liquidator will borrow in order to repay on behalf of
// the borrower.
string repay_denom = 3;
// RewardDenom is the uToken denom that the liquidator will receive as a liquidation reward
// and immediately collateralize.
string reward_denom = 4;
}
// MsgSupplyCollateral represents a user's request to supply and collateralize assets to the module.
message MsgSupplyCollateral {
// Supplier is the account address supplying assets and the signer of the message.
string supplier = 1;
cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false];
}
// MsgSupplyResponse defines the Msg/Supply response type.
message MsgSupplyResponse {
// Received is the amount of uTokens received.
cosmos.base.v1beta1.Coin received = 1 [(gogoproto.nullable) = false];
}
// MsgWithdrawResponse defines the Msg/Withdraw response type.
message MsgWithdrawResponse {
// Received is the amount of base tokens received.
cosmos.base.v1beta1.Coin received = 1 [(gogoproto.nullable) = false];
}
// MsgMaxWithdrawResponse defines the Msg/MaxWithdraw response type.
message MsgMaxWithdrawResponse {
// Withdrawn is the amount of uTokens withdrawn.
cosmos.base.v1beta1.Coin withdrawn = 1 [(gogoproto.nullable) = false];
// Received is the amount of base tokens received.
cosmos.base.v1beta1.Coin received = 2 [(gogoproto.nullable) = false];
}
// MsgCollateralizeResponse defines the Msg/Collateralize response type.
message MsgCollateralizeResponse {}
// MsgDecollateralizeResponse defines the Msg/Decollateralize response type.
message MsgDecollateralizeResponse {}
// MsgBorrowResponse defines the Msg/Borrow response type.
message MsgBorrowResponse {}
// MsgMaxBorrowResponse defines the Msg/MaxBorrow response type.
message MsgMaxBorrowResponse {
// Borrowed is the amount of tokens borrowed.
cosmos.base.v1beta1.Coin borrowed = 1 [(gogoproto.nullable) = false];
}
// MsgRepayResponse defines the Msg/Repay response type.
message MsgRepayResponse {
// Repaid is the amount of base tokens repaid to the module.
cosmos.base.v1beta1.Coin repaid = 1 [(gogoproto.nullable) = false];
}
// MsgLiquidateResponse defines the Msg/Liquidate response type.
message MsgLiquidateResponse {
// Repaid is the amount of borrowed base tokens that the liquidator repaid
// to the module on behalf of the borrower.
cosmos.base.v1beta1.Coin repaid = 1 [(gogoproto.nullable) = false];
// Collateral is the amount of the borrower's uToken collateral that
// was liquidated.
cosmos.base.v1beta1.Coin collateral = 2 [(gogoproto.nullable) = false];
// Reward is the amount of base tokens that the liquidator received from
// the module as reward for the liquidation.
cosmos.base.v1beta1.Coin reward = 3 [(gogoproto.nullable) = false];
}
// MsgLeveragedLiquidateResponse defines the Msg/LeveragedLiquidate response type.
message MsgLeveragedLiquidateResponse {
// Repaid is the amount of base tokens that the liquidator borrowed and repaid
// to the module on behalf of the borrower.
cosmos.base.v1beta1.Coin repaid = 1 [(gogoproto.nullable) = false];
// Reward is the amount of collateral that the liquidator gained
// as reward for the liquidation.
cosmos.base.v1beta1.Coin reward = 2 [(gogoproto.nullable) = false];
}
// MsgSupplyCollateralResponse defines the Msg/SupplyCollateral response type.
message MsgSupplyCollateralResponse {
// Collateralized is the amount of uTokens collateralized.
cosmos.base.v1beta1.Coin collateralized = 1 [(gogoproto.nullable) = false];
}
// MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type.
message MsgGovUpdateRegistry {
option (gogoproto.equal) = true;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string title = 2;
string description = 3;
// add_tokens defines new token settings.
repeated Token add_tokens = 4 [(gogoproto.nullable) = false];
// update_tokens defines the new settings for existed tokens.
repeated Token update_tokens = 5 [(gogoproto.nullable) = false];
}
// MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type.
message MsgGovUpdateRegistryResponse {}