diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c19e0b449..79101814db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [1654](https://github.com/umee-network/umee/pull/1654) Leverage historacle integration. - [1685](https://github.com/umee-network/umee/pull/1685) Add medians param to Token registry. - [1683](https://github.com/umee-network/umee/pull/1683) Add MaxBorrow query and allow returning all denoms from MaxWithdraw. +- [1690](https://github.com/umee-network/umee/pull/1690) Add MaxBorrow message type. ## [v3.3.0](https://github.com/umee-network/umee/releases/tag/v3.3.0) - 2022-12-20 diff --git a/proto/umee/leverage/v1/tx.proto b/proto/umee/leverage/v1/tx.proto index 0438ceac30..2c1b8fdef8 100644 --- a/proto/umee/leverage/v1/tx.proto +++ b/proto/umee/leverage/v1/tx.proto @@ -36,6 +36,9 @@ service Msg { // 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. + rpc MaxBorrow(MsgMaxBorrow) returns (MsgMaxBorrowResponse); + // Repay allows a user to repay previously borrowed tokens and interest. rpc Repay(MsgRepay) returns (MsgRepayResponse); @@ -99,6 +102,15 @@ message MsgBorrow { 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 { @@ -162,6 +174,12 @@ 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. diff --git a/x/leverage/README.md b/x/leverage/README.md index faa5f0bb92..61dcd90efe 100644 --- a/x/leverage/README.md +++ b/x/leverage/README.md @@ -80,6 +80,8 @@ Users have the following actions available to them: Interest will accrue on borrows for as long as they are not paid off, with the amount owed increasing at a rate of the asset's [Borrow APY](#borrow-apy). +- `MsgMaxBorrow` borrows assets by automatically calculating the maximum amount that can be borrowed. + - `MsgRepay` assets of a borrowed type, directly reducing the amount owed. Repayments that exceed a borrower's amount owed in the selected denomination succeed at paying the reduced amount rather than failing outright. diff --git a/x/leverage/client/cli/tx.go b/x/leverage/client/cli/tx.go index b6485ecb10..c5d744f714 100644 --- a/x/leverage/client/cli/tx.go +++ b/x/leverage/client/cli/tx.go @@ -30,6 +30,7 @@ func GetTxCmd() *cobra.Command { GetCmdCollateralize(), GetCmdDecollateralize(), GetCmdBorrow(), + GetCmdMaxBorrow(), GetCmdRepay(), GetCmdLiquidate(), GetCmdSupplyCollateral(), @@ -213,6 +214,30 @@ func GetCmdBorrow() *cobra.Command { return cmd } +// GetCmdMaxBorrow creates a Cobra command to generate or broadcast a +// transaction with a MsgBorrow message. +func GetCmdMaxBorrow() *cobra.Command { + cmd := &cobra.Command{ + Use: "max-borrow [denom]", + Args: cobra.ExactArgs(1), + Short: "Borrow the maximum acceptable amount of a supported asset", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgMaxBorrow(clientCtx.GetFromAddress(), args[0]) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + // GetCmdRepay creates a Cobra command to generate or broadcast a // transaction with a MsgRepay message. func GetCmdRepay() *cobra.Command { diff --git a/x/leverage/client/tests/tests.go b/x/leverage/client/tests/tests.go index 6ff414dfdf..99f9c5b8fe 100644 --- a/x/leverage/client/tests/tests.go +++ b/x/leverage/client/tests/tests.go @@ -190,7 +190,16 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { "borrow", cli.GetCmdBorrow(), []string{ - "249uumee", // produces a borrowed amount of 250 due to rounding + "150uumee", + }, + nil, + } + + maxborrow := testTransaction{ + "max-borrow", + cli.GetCmdMaxBorrow(), + []string{ + "uumee", // should borrow up to the max of 250 uumee, which will become 251 due to rounding }, nil, } @@ -253,13 +262,13 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { &types.QueryAccountBalancesResponse{}, &types.QueryAccountBalancesResponse{ Supplied: sdk.NewCoins( - sdk.NewInt64Coin(appparams.BondDenom, 1000), + sdk.NewInt64Coin(appparams.BondDenom, 1001), ), Collateral: sdk.NewCoins( sdk.NewInt64Coin(types.ToUTokenDenom(appparams.BondDenom), 1000), ), Borrowed: sdk.NewCoins( - sdk.NewInt64Coin(appparams.BondDenom, 250), + sdk.NewInt64Coin(appparams.BondDenom, 251), ), }, }, @@ -275,16 +284,16 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { // This result is umee's oracle exchange rate from // app/test_helpers.go/IntegrationTestNetworkConfig // times the amount of umee, and then times params - // (1000 / 1000000) * 34.21 = 0.03421 - SuppliedValue: sdk.MustNewDecFromStr("0.03421"), - // (1000 / 1000000) * 34.21 = 0.03421 - CollateralValue: sdk.MustNewDecFromStr("0.03421"), - // (250 / 1000000) * 34.21 = 0.0085525 - BorrowedValue: sdk.MustNewDecFromStr("0.0085525"), - // (1000 / 1000000) * 34.21 * 0.25 = 0.0085525 - BorrowLimit: sdk.MustNewDecFromStr("0.0085525"), - // (1000 / 1000000) * 0.25 * 34.21 = 0.0085525 - LiquidationThreshold: sdk.MustNewDecFromStr("0.0085525"), + // (1001 / 1000000) * 34.21 = 0.03424421 + SuppliedValue: sdk.MustNewDecFromStr("0.03424421"), + // (1001 / 1000000) * 34.21 = 0.03424421 + CollateralValue: sdk.MustNewDecFromStr("0.03424421"), + // (251 / 1000000) * 34.21 = 0.00858671 + BorrowedValue: sdk.MustNewDecFromStr("0.00858671"), + // (1001 / 1000000) * 34.21 * 0.25 = 0.0085610525 + BorrowLimit: sdk.MustNewDecFromStr("0.0085610525"), + // (1001 / 1000000) * 0.25 * 34.21 = 0.0085610525 + LiquidationThreshold: sdk.MustNewDecFromStr("0.0085610525"), }, }, { @@ -442,6 +451,7 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { addCollateral, supplyCollateral, borrow, + maxborrow, ) // These queries run while the supplying and borrowing is active to produce nonzero output diff --git a/x/leverage/keeper/msg_server.go b/x/leverage/keeper/msg_server.go index 197cb9fcae..632c4a3239 100644 --- a/x/leverage/keeper/msg_server.go +++ b/x/leverage/keeper/msg_server.go @@ -322,6 +322,68 @@ func (s msgServer) Borrow( return &types.MsgBorrowResponse{}, err } +func (s msgServer) MaxBorrow( + goCtx context.Context, + msg *types.MsgMaxBorrow, +) (*types.MsgMaxBorrowResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + borrowerAddr, err := sdk.AccAddressFromBech32(msg.Borrower) + if err != nil { + return nil, err + } + + currentMaxBorrow, err := s.keeper.maxBorrow(ctx, borrowerAddr, msg.Denom, false) + if err != nil { + return nil, err + } + historicMaxBorrow, err := s.keeper.maxBorrow(ctx, borrowerAddr, msg.Denom, true) + if err != nil { + return nil, err + } + + maxBorrow := sdk.NewCoin( + msg.Denom, + sdk.MinInt(currentMaxBorrow.Amount, historicMaxBorrow.Amount), + ) + if maxBorrow.IsZero() { + return nil, types.ErrMaxBorrowZero + } + + if err := s.keeper.Borrow(ctx, borrowerAddr, maxBorrow); err != nil { + return nil, err + } + + // Fail here if borrower ends up over their borrow limit under current or historic prices + err = s.keeper.assertBorrowerHealth(ctx, borrowerAddr) + if err != nil { + return nil, err + } + + // Check MaxSupplyUtilization after transaction + if err = s.keeper.checkSupplyUtilization(ctx, maxBorrow.Denom); err != nil { + return nil, err + } + + // Check MinCollateralLiquidity is still satisfied after the transaction + if err = s.keeper.checkCollateralLiquidity(ctx, maxBorrow.Denom); err != nil { + return nil, err + } + + s.keeper.Logger(ctx).Debug( + "assets borrowed", + "borrower", msg.Borrower, + "amount", maxBorrow.String(), + ) + err = ctx.EventManager().EmitTypedEvent(&types.EventBorrow{ + Borrower: msg.Borrower, + Asset: maxBorrow, + }) + return &types.MsgMaxBorrowResponse{ + Borrowed: maxBorrow, + }, err +} + func (s msgServer) Repay( goCtx context.Context, msg *types.MsgRepay, diff --git a/x/leverage/keeper/msg_server_test.go b/x/leverage/keeper/msg_server_test.go index 961073e621..65d9885645 100644 --- a/x/leverage/keeper/msg_server_test.go +++ b/x/leverage/keeper/msg_server_test.go @@ -1248,6 +1248,138 @@ func (s *IntegrationTestSuite) TestMsgBorrow() { } } +func (s *IntegrationTestSuite) TestMsgMaxBorrow() { + type testCase struct { + msg string + addr sdk.AccAddress + coin sdk.Coin + err error + } + + app, ctx, srv, require := s.app, s.ctx, s.msgSrvr, s.Require() + + // create and fund a supplier which supplies 100 UMEE and 100 ATOM + supplier := s.newAccount(coin(umeeDenom, 100_000000), coin(atomDenom, 100_000000)) + s.supply(supplier, coin(umeeDenom, 100_000000), coin(atomDenom, 100_000000)) + + // create a borrower which supplies and collateralizes 100 ATOM + borrower := s.newAccount(coin(atomDenom, 100_000000)) + s.supply(borrower, coin(atomDenom, 100_000000)) + s.collateralize(borrower, coin("u/"+atomDenom, 100_000000)) + + // create an additional supplier (DUMP, PUMP tokens) + surplus := s.newAccount(coin(dumpDenom, 100_000000), coin(pumpDenom, 100_000000)) + s.supply(surplus, coin(pumpDenom, 100_000000)) + s.supply(surplus, coin(dumpDenom, 100_000000)) + + // this will be a DUMP (historic price 1.00, current price 0.50) borrower + // using PUMP (historic price 1.00, current price 2.00) collateral + dumpborrower := s.newAccount(coin(pumpDenom, 100_000000)) + s.supply(dumpborrower, coin(pumpDenom, 100_000000)) + s.collateralize(dumpborrower, coin("u/"+pumpDenom, 100_000000)) + // collateral value is $200 (current) or $100 (historic) + // collateral weights are always 0.25 in testing + + // this will be a PUMP (historic price 1.00, current price 2.00) borrower + // using DUMP (historic price 1.00, current price 0.50) collateral + pumpborrower := s.newAccount(coin(dumpDenom, 100_000000)) + s.supply(pumpborrower, coin(dumpDenom, 100_000000)) + s.collateralize(pumpborrower, coin("u/"+dumpDenom, 100_000000)) + // collateral value is $50 (current) or $100 (historic) + // collateral weights are always 0.25 in testing + + tcs := []testCase{ + { + "uToken", + borrower, + coin("u/"+umeeDenom, 0), + types.ErrUToken, + }, + { + "unregistered token", + borrower, + coin("abcd", 0), + types.ErrNotRegisteredToken, + }, + { + "zero collateral", + supplier, + coin(atomDenom, 0), + types.ErrMaxBorrowZero, + }, + { + "atom borrow", + borrower, + coin(atomDenom, 25_000000), + nil, + }, + { + "already borrowed max", + borrower, + coin(atomDenom, 0), + types.ErrMaxBorrowZero, + }, + { + "dump borrower", + dumpborrower, + coin(dumpDenom, 25_000000), + nil, + }, + { + "pump borrower", + pumpborrower, + coin(pumpDenom, 6_250000), + nil, + }, + } + + for _, tc := range tcs { + msg := &types.MsgMaxBorrow{ + Borrower: tc.addr.String(), + Denom: tc.coin.Denom, + } + if tc.err != nil { + _, err := srv.MaxBorrow(ctx, msg) + require.ErrorIs(err, tc.err, tc.msg) + } else { + // initial state + iBalance := app.BankKeeper.GetAllBalances(ctx, tc.addr) + iCollateral := app.LeverageKeeper.GetBorrowerCollateral(ctx, tc.addr) + iUTokenSupply := app.LeverageKeeper.GetAllUTokenSupply(ctx) + iExchangeRate := app.LeverageKeeper.DeriveExchangeRate(ctx, tc.coin.Denom) + iBorrowed := app.LeverageKeeper.GetBorrowerBorrows(ctx, tc.addr) + + // verify the output of borrow function + resp, err := srv.MaxBorrow(ctx, msg) + require.NoError(err, tc.msg) + require.Equal(&types.MsgMaxBorrowResponse{ + Borrowed: tc.coin, + }, resp, tc.msg) + + // final state + fBalance := app.BankKeeper.GetAllBalances(ctx, tc.addr) + fCollateral := app.LeverageKeeper.GetBorrowerCollateral(ctx, tc.addr) + fUTokenSupply := app.LeverageKeeper.GetAllUTokenSupply(ctx) + fExchangeRate := app.LeverageKeeper.DeriveExchangeRate(ctx, tc.coin.Denom) + fBorrowed := app.LeverageKeeper.GetBorrowerBorrows(ctx, tc.addr) + + // verify token balance is increased by expected amount + require.Equal(iBalance.Add(tc.coin), fBalance, tc.msg, "balances") + // verify uToken collateral unchanged + require.Equal(iCollateral, fCollateral, tc.msg, "collateral") + // verify uToken supply is unchanged + require.Equal(iUTokenSupply, fUTokenSupply, tc.msg, "uToken supply") + // verify uToken exchange rate is unchanged + require.Equal(iExchangeRate, fExchangeRate, tc.msg, "uToken exchange rate") + // verify borrowed coins increased by expected amount + require.Equal(iBorrowed.Add(tc.coin), fBorrowed, "borrowed coins") + + // check all available invariants + s.checkInvariants(tc.msg) + } + } +} + func (s *IntegrationTestSuite) TestMsgRepay() { type testCase struct { msg string diff --git a/x/leverage/types/codec.go b/x/leverage/types/codec.go index 962754593a..50bdda67f4 100644 --- a/x/leverage/types/codec.go +++ b/x/leverage/types/codec.go @@ -37,6 +37,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgGovUpdateRegistry{}, "umee/leverage/MsgGovUpdateRegistry", nil) cdc.RegisterConcrete(&MsgSupplyCollateral{}, "umee/leverage/MsgSupplyCollateral", nil) cdc.RegisterConcrete(&MsgMaxWithdraw{}, "umee/leverage/MsgMaxWithdraw", nil) + cdc.RegisterConcrete(&MsgMaxBorrow{}, "umee/leverage/MsgMaxBorrow", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -52,6 +53,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgGovUpdateRegistry{}, &MsgSupplyCollateral{}, &MsgMaxWithdraw{}, + &MsgMaxBorrow{}, ) registry.RegisterImplementations( diff --git a/x/leverage/types/errors.go b/x/leverage/types/errors.go index befbd260de..cb5481a086 100644 --- a/x/leverage/types/errors.go +++ b/x/leverage/types/errors.go @@ -37,6 +37,7 @@ var ( ErrLiquidationIneligible = sdkerrors.Register(ModuleName, 403, "borrower not eligible for liquidation") ErrMaxWithdrawZero = sdkerrors.Register(ModuleName, 404, "max withdraw amount was zero") ErrNoHistoricMedians = sdkerrors.Register(ModuleName, 405, "insufficient historic medians available") + ErrMaxBorrowZero = sdkerrors.Register(ModuleName, 406, "max borrow amount was zero") // 5XX = Market Conditions ErrLendingPoolInsufficient = sdkerrors.Register(ModuleName, 500, "lending pool insufficient") diff --git a/x/leverage/types/tx.go b/x/leverage/types/tx.go index 48acd24c7a..902c17ce5e 100644 --- a/x/leverage/types/tx.go +++ b/x/leverage/types/tx.go @@ -174,6 +174,30 @@ func (msg *MsgBorrow) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } +func NewMsgMaxBorrow(borrower sdk.AccAddress, denom string) *MsgMaxBorrow { + return &MsgMaxBorrow{ + Borrower: borrower.String(), + Denom: denom, + } +} + +func (msg MsgMaxBorrow) Route() string { return sdk.MsgTypeURL(&msg) } +func (msg MsgMaxBorrow) Type() string { return sdk.MsgTypeURL(&msg) } + +func (msg *MsgMaxBorrow) ValidateBasic() error { + return validateSenderAndDenom(msg.Borrower, msg.Denom) +} + +func (msg *MsgMaxBorrow) GetSigners() []sdk.AccAddress { + return checkers.Signers(msg.Borrower) +} + +// GetSignBytes get the bytes for the message signer to sign on +func (msg *MsgMaxBorrow) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + func NewMsgRepay(borrower sdk.AccAddress, asset sdk.Coin) *MsgRepay { return &MsgRepay{ Borrower: borrower.String(), diff --git a/x/leverage/types/tx.pb.go b/x/leverage/types/tx.pb.go index 6e97c04c3a..959ea00ee0 100644 --- a/x/leverage/types/tx.pb.go +++ b/x/leverage/types/tx.pb.go @@ -301,6 +301,52 @@ func (*MsgBorrow) XXX_MessageName() string { return "umee.leverage.v1.MsgBorrow" } +// MsgMaxBorrow represents a user's request to borrow a base asset type +// from the module, using the maximum available amount. +type MsgMaxBorrow struct { + // Borrower is the account address taking a loan and the signer + // of the message. + Borrower string `protobuf:"bytes,1,opt,name=borrower,proto3" json:"borrower,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *MsgMaxBorrow) Reset() { *m = MsgMaxBorrow{} } +func (m *MsgMaxBorrow) String() string { return proto.CompactTextString(m) } +func (*MsgMaxBorrow) ProtoMessage() {} +func (*MsgMaxBorrow) Descriptor() ([]byte, []int) { + return fileDescriptor_72683128ee6e8843, []int{6} +} +func (m *MsgMaxBorrow) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMaxBorrow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMaxBorrow.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMaxBorrow) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMaxBorrow.Merge(m, src) +} +func (m *MsgMaxBorrow) XXX_Size() int { + return m.Size() +} +func (m *MsgMaxBorrow) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMaxBorrow.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMaxBorrow proto.InternalMessageInfo + +func (*MsgMaxBorrow) XXX_MessageName() string { + return "umee.leverage.v1.MsgMaxBorrow" +} + // MsgRepay represents a user's request to repay a borrowed base asset // type to the module. type MsgRepay struct { @@ -314,7 +360,7 @@ func (m *MsgRepay) Reset() { *m = MsgRepay{} } func (m *MsgRepay) String() string { return proto.CompactTextString(m) } func (*MsgRepay) ProtoMessage() {} func (*MsgRepay) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{6} + return fileDescriptor_72683128ee6e8843, []int{7} } func (m *MsgRepay) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -369,7 +415,7 @@ func (m *MsgLiquidate) Reset() { *m = MsgLiquidate{} } func (m *MsgLiquidate) String() string { return proto.CompactTextString(m) } func (*MsgLiquidate) ProtoMessage() {} func (*MsgLiquidate) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{7} + return fileDescriptor_72683128ee6e8843, []int{8} } func (m *MsgLiquidate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -413,7 +459,7 @@ func (m *MsgSupplyCollateral) Reset() { *m = MsgSupplyCollateral{} } func (m *MsgSupplyCollateral) String() string { return proto.CompactTextString(m) } func (*MsgSupplyCollateral) ProtoMessage() {} func (*MsgSupplyCollateral) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{8} + return fileDescriptor_72683128ee6e8843, []int{9} } func (m *MsgSupplyCollateral) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -456,7 +502,7 @@ func (m *MsgSupplyResponse) Reset() { *m = MsgSupplyResponse{} } func (m *MsgSupplyResponse) String() string { return proto.CompactTextString(m) } func (*MsgSupplyResponse) ProtoMessage() {} func (*MsgSupplyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{9} + return fileDescriptor_72683128ee6e8843, []int{10} } func (m *MsgSupplyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -499,7 +545,7 @@ func (m *MsgWithdrawResponse) Reset() { *m = MsgWithdrawResponse{} } func (m *MsgWithdrawResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawResponse) ProtoMessage() {} func (*MsgWithdrawResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{10} + return fileDescriptor_72683128ee6e8843, []int{11} } func (m *MsgWithdrawResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -544,7 +590,7 @@ func (m *MsgMaxWithdrawResponse) Reset() { *m = MsgMaxWithdrawResponse{} func (m *MsgMaxWithdrawResponse) String() string { return proto.CompactTextString(m) } func (*MsgMaxWithdrawResponse) ProtoMessage() {} func (*MsgMaxWithdrawResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{11} + return fileDescriptor_72683128ee6e8843, []int{12} } func (m *MsgMaxWithdrawResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -585,7 +631,7 @@ func (m *MsgCollateralizeResponse) Reset() { *m = MsgCollateralizeRespon func (m *MsgCollateralizeResponse) String() string { return proto.CompactTextString(m) } func (*MsgCollateralizeResponse) ProtoMessage() {} func (*MsgCollateralizeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{12} + return fileDescriptor_72683128ee6e8843, []int{13} } func (m *MsgCollateralizeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -626,7 +672,7 @@ func (m *MsgDecollateralizeResponse) Reset() { *m = MsgDecollateralizeRe func (m *MsgDecollateralizeResponse) String() string { return proto.CompactTextString(m) } func (*MsgDecollateralizeResponse) ProtoMessage() {} func (*MsgDecollateralizeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{13} + return fileDescriptor_72683128ee6e8843, []int{14} } func (m *MsgDecollateralizeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -667,7 +713,7 @@ func (m *MsgBorrowResponse) Reset() { *m = MsgBorrowResponse{} } func (m *MsgBorrowResponse) String() string { return proto.CompactTextString(m) } func (*MsgBorrowResponse) ProtoMessage() {} func (*MsgBorrowResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{14} + return fileDescriptor_72683128ee6e8843, []int{15} } func (m *MsgBorrowResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -700,6 +746,49 @@ func (*MsgBorrowResponse) XXX_MessageName() string { return "umee.leverage.v1.MsgBorrowResponse" } +// MsgMaxBorrowResponse defines the Msg/MaxBorrow response type. +type MsgMaxBorrowResponse struct { + // Borrowed is the amount of tokens borrowed. + Borrowed types.Coin `protobuf:"bytes,1,opt,name=borrowed,proto3" json:"borrowed"` +} + +func (m *MsgMaxBorrowResponse) Reset() { *m = MsgMaxBorrowResponse{} } +func (m *MsgMaxBorrowResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMaxBorrowResponse) ProtoMessage() {} +func (*MsgMaxBorrowResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_72683128ee6e8843, []int{16} +} +func (m *MsgMaxBorrowResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMaxBorrowResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMaxBorrowResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMaxBorrowResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMaxBorrowResponse.Merge(m, src) +} +func (m *MsgMaxBorrowResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMaxBorrowResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMaxBorrowResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMaxBorrowResponse proto.InternalMessageInfo + +func (*MsgMaxBorrowResponse) XXX_MessageName() string { + return "umee.leverage.v1.MsgMaxBorrowResponse" +} + // MsgRepayResponse defines the Msg/Repay response type. type MsgRepayResponse struct { // Repaid is the amount of base tokens repaid to the module. @@ -710,7 +799,7 @@ func (m *MsgRepayResponse) Reset() { *m = MsgRepayResponse{} } func (m *MsgRepayResponse) String() string { return proto.CompactTextString(m) } func (*MsgRepayResponse) ProtoMessage() {} func (*MsgRepayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{15} + return fileDescriptor_72683128ee6e8843, []int{17} } func (m *MsgRepayResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -760,7 +849,7 @@ func (m *MsgLiquidateResponse) Reset() { *m = MsgLiquidateResponse{} } func (m *MsgLiquidateResponse) String() string { return proto.CompactTextString(m) } func (*MsgLiquidateResponse) ProtoMessage() {} func (*MsgLiquidateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{16} + return fileDescriptor_72683128ee6e8843, []int{18} } func (m *MsgLiquidateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -803,7 +892,7 @@ func (m *MsgSupplyCollateralResponse) Reset() { *m = MsgSupplyCollateral func (m *MsgSupplyCollateralResponse) String() string { return proto.CompactTextString(m) } func (*MsgSupplyCollateralResponse) ProtoMessage() {} func (*MsgSupplyCollateralResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{17} + return fileDescriptor_72683128ee6e8843, []int{19} } func (m *MsgSupplyCollateralResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -851,7 +940,7 @@ type MsgGovUpdateRegistry struct { func (m *MsgGovUpdateRegistry) Reset() { *m = MsgGovUpdateRegistry{} } func (*MsgGovUpdateRegistry) ProtoMessage() {} func (*MsgGovUpdateRegistry) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{18} + return fileDescriptor_72683128ee6e8843, []int{20} } func (m *MsgGovUpdateRegistry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -892,7 +981,7 @@ func (m *MsgGovUpdateRegistryResponse) Reset() { *m = MsgGovUpdateRegist func (m *MsgGovUpdateRegistryResponse) String() string { return proto.CompactTextString(m) } func (*MsgGovUpdateRegistryResponse) ProtoMessage() {} func (*MsgGovUpdateRegistryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_72683128ee6e8843, []int{19} + return fileDescriptor_72683128ee6e8843, []int{21} } func (m *MsgGovUpdateRegistryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -931,6 +1020,7 @@ func init() { proto.RegisterType((*MsgCollateralize)(nil), "umee.leverage.v1.MsgCollateralize") proto.RegisterType((*MsgDecollateralize)(nil), "umee.leverage.v1.MsgDecollateralize") proto.RegisterType((*MsgBorrow)(nil), "umee.leverage.v1.MsgBorrow") + proto.RegisterType((*MsgMaxBorrow)(nil), "umee.leverage.v1.MsgMaxBorrow") proto.RegisterType((*MsgRepay)(nil), "umee.leverage.v1.MsgRepay") proto.RegisterType((*MsgLiquidate)(nil), "umee.leverage.v1.MsgLiquidate") proto.RegisterType((*MsgSupplyCollateral)(nil), "umee.leverage.v1.MsgSupplyCollateral") @@ -940,6 +1030,7 @@ func init() { proto.RegisterType((*MsgCollateralizeResponse)(nil), "umee.leverage.v1.MsgCollateralizeResponse") proto.RegisterType((*MsgDecollateralizeResponse)(nil), "umee.leverage.v1.MsgDecollateralizeResponse") proto.RegisterType((*MsgBorrowResponse)(nil), "umee.leverage.v1.MsgBorrowResponse") + proto.RegisterType((*MsgMaxBorrowResponse)(nil), "umee.leverage.v1.MsgMaxBorrowResponse") proto.RegisterType((*MsgRepayResponse)(nil), "umee.leverage.v1.MsgRepayResponse") proto.RegisterType((*MsgLiquidateResponse)(nil), "umee.leverage.v1.MsgLiquidateResponse") proto.RegisterType((*MsgSupplyCollateralResponse)(nil), "umee.leverage.v1.MsgSupplyCollateralResponse") @@ -950,66 +1041,68 @@ func init() { func init() { proto.RegisterFile("umee/leverage/v1/tx.proto", fileDescriptor_72683128ee6e8843) } var fileDescriptor_72683128ee6e8843 = []byte{ - // 938 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6f, 0xe3, 0x44, - 0x14, 0x8f, 0xfb, 0x45, 0xf3, 0xd2, 0x5d, 0xba, 0xde, 0x8a, 0x4d, 0xbd, 0x8b, 0x13, 0x0c, 0x8b, - 0xaa, 0x15, 0xb5, 0x69, 0x57, 0x80, 0x04, 0xac, 0x10, 0xd9, 0x95, 0x2a, 0x2d, 0x58, 0x5a, 0xb9, - 0x20, 0x04, 0x12, 0x14, 0x27, 0x1e, 0x26, 0x56, 0x13, 0x4f, 0x98, 0x99, 0x24, 0x0d, 0x47, 0x2e, - 0x70, 0xe4, 0xc0, 0x81, 0x63, 0x0f, 0x1c, 0x39, 0x70, 0xe0, 0x8f, 0x28, 0xb7, 0x15, 0x27, 0x4e, - 0x08, 0xda, 0x03, 0xfc, 0x19, 0xc8, 0x33, 0xf6, 0x38, 0x1f, 0xde, 0xd4, 0x7c, 0xe4, 0x96, 0x37, - 0xbf, 0xdf, 0xfb, 0xbd, 0x37, 0x6f, 0xde, 0xcb, 0x33, 0x6c, 0xf7, 0xbb, 0x08, 0x39, 0x1d, 0x34, - 0x40, 0xd4, 0xc7, 0xc8, 0x19, 0xec, 0x39, 0xfc, 0xc4, 0xee, 0x51, 0xc2, 0x89, 0xbe, 0x19, 0x43, - 0x76, 0x0a, 0xd9, 0x83, 0x3d, 0xc3, 0x6c, 0x11, 0xd6, 0x25, 0xcc, 0x69, 0xfa, 0x2c, 0xa6, 0x36, - 0x11, 0xf7, 0xf7, 0x9c, 0x16, 0x09, 0x23, 0xe9, 0x61, 0xdc, 0x48, 0xf0, 0x2e, 0xc3, 0xb1, 0x52, - 0x97, 0xe1, 0x04, 0xd8, 0x96, 0xc0, 0x91, 0xb0, 0x1c, 0x69, 0x24, 0xd0, 0x16, 0x26, 0x98, 0xc8, - 0xf3, 0xf8, 0x57, 0x72, 0x5a, 0x9b, 0x49, 0x4b, 0xe5, 0x21, 0x08, 0xd6, 0x27, 0x50, 0x76, 0x19, - 0x3e, 0xec, 0xf7, 0x7a, 0x9d, 0x91, 0x6e, 0xc0, 0x3a, 0x8b, 0x7f, 0x85, 0x88, 0x56, 0xb5, 0xba, - 0xb6, 0x53, 0xf6, 0x94, 0xad, 0xbf, 0x02, 0xab, 0x3e, 0x63, 0x88, 0x57, 0x97, 0xea, 0xda, 0x4e, - 0x65, 0x7f, 0xdb, 0x4e, 0xa2, 0xc7, 0x77, 0xb0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54, 0x84, 0xa5, 0xc2, 0x3c, 0x84, - 0xb5, 0x64, 0xe3, 0xe7, 0x3f, 0xa0, 0x04, 0x9f, 0xf0, 0x80, 0x93, 0x7f, 0x6e, 0xfa, 0x01, 0xac, - 0x26, 0xdb, 0x3d, 0x97, 0x2d, 0x30, 0xc3, 0x7a, 0x32, 0xa6, 0x84, 0x0e, 0xa1, 0x3c, 0xb6, 0xc6, - 0x73, 0x1d, 0x14, 0x6e, 0xbc, 0x38, 0x1f, 0x57, 0xa2, 0x6d, 0xd8, 0x9c, 0xd9, 0xb6, 0xb7, 0xe7, - 0xf4, 0x65, 0x46, 0x33, 0x76, 0x0b, 0xd1, 0x54, 0xa4, 0x63, 0xb8, 0x36, 0xfb, 0xff, 0x92, 0x9f, - 0xe6, 0x0c, 0xcf, 0xb0, 0x8b, 0xf1, 0xd2, 0x60, 0x0d, 0xef, 0xec, 0x0f, 0xb3, 0x74, 0x76, 0x6e, - 0x6a, 0x8f, 0xcf, 0x4d, 0xed, 0xf7, 0x73, 0x53, 0xfb, 0xe6, 0xc2, 0x2c, 0x9d, 0x5d, 0x98, 0xda, - 0xe3, 0x0b, 0xb3, 0xf4, 0xeb, 0x85, 0x59, 0xfa, 0xe8, 0x65, 0x1c, 0xf2, 0x76, 0xbf, 0x69, 0xb7, - 0x48, 0xd7, 0x89, 0xb5, 0x77, 0x23, 0xc4, 0x87, 0x84, 0x1e, 0x0b, 0xc3, 0x19, 0xdc, 0x75, 0x4e, - 0xb2, 0x6f, 0x7d, 0x3e, 0xea, 0x21, 0xd6, 0x5c, 0x13, 0x9f, 0xf9, 0x77, 0xff, 0x0e, 0x00, 0x00, - 0xff, 0xff, 0x68, 0xd6, 0x2f, 0x6b, 0xa0, 0x0c, 0x00, 0x00, + // 973 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x8f, 0xdb, 0x44, + 0x14, 0x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0xac, 0xd3, 0xf8, 0x57, 0x88, 0x48, 0x55, + 0xab, 0x6b, 0x3b, 0x65, 0x57, 0xd9, 0xfa, 0x2b, 0xb0, 0xea, 0x51, 0x8a, 0x58, 0x75, 0xa9, 0xae, + 0xed, 0x54, 0xf6, 0xb7, 0x6d, 0x99, 0x3d, 0xbe, 0x83, 0x2d, 0xef, 0x60, 0xdf, 0xc5, 0x61, 0xd4, + 0x58, 0x39, 0xfd, 0xbd, 0x56, 0x72, 0x05, 0xda, 0xfa, 0x0c, 0x2a, 0x4d, 0x1a, 0x7c, 0x18, 0xb2, + 0x8e, 0x4f, 0xbc, 0xd1, 0x22, 0x32, 0x34, 0xe0, 0x72, 0x93, 0x06, 0x4d, 0xef, 0xb8, 0x50, 0x92, + 0x2d, 0x58, 0xf5, 0x51, 0x84, 0x7b, 0x3c, 0x49, 0xd9, 0x15, 0x86, 0x85, 0x60, 0xb3, 0x49, 0x83, + 0xbb, 0xb8, 0xdb, 0xf5, 0x18, 0x22, 0x5e, 0x37, 0xfc, 0x12, 0xc5, 0x2c, 0x2d, 0x4c, 0x08, 0x1e, + 0xa5, 0x2c, 0x89, 0xfd, 0x5f, 0xa5, 0x06, 0xa0, 0x37, 0x69, 0x70, 0x0f, 0xb5, 0x17, 0x9d, 0x48, + 0x74, 0xb5, 0xc1, 0x59, 0x16, 0xc1, 0xff, 0x36, 0x6c, 0x88, 0x9a, 0x17, 0x48, 0x91, 0x5f, 0xf1, + 0x4f, 0x60, 0xbd, 0x49, 0x03, 0x17, 0xf5, 0xbd, 0xf1, 0x22, 0x04, 0xfe, 0xa0, 0x71, 0x85, 0xef, + 0x85, 0x5f, 0x0c, 0x42, 0xdf, 0x63, 0x48, 0x37, 0x01, 0xba, 0xd2, 0xc0, 0x49, 0x96, 0xcc, 0xc9, + 0x84, 0x86, 0xa5, 0x29, 0x0d, 0x77, 0xa0, 0x4c, 0x62, 0xa1, 0x3d, 0x14, 0xb1, 0xea, 0x72, 0x31, + 0x1d, 0x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, 0x27, 0xe6, 0xde, 0x8d, 0x10, 0x1b, 0x61, 0x72, 0xc4, 0x0d, 0x67, 0x78, + 0xdb, 0x39, 0x4e, 0xff, 0xd7, 0xb0, 0x71, 0x1f, 0xd1, 0xd6, 0x1a, 0xff, 0x4b, 0x73, 0xfb, 0x9f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x28, 0x3a, 0xec, 0x23, 0x8c, 0x0d, 0x00, 0x00, } func (this *MsgGovUpdateRegistry) Equal(that interface{}) bool { @@ -1087,6 +1180,8 @@ type MsgClient interface { Decollateralize(ctx context.Context, in *MsgDecollateralize, opts ...grpc.CallOption) (*MsgDecollateralizeResponse, error) // Borrow allows a user to borrow tokens from the module if they have sufficient collateral. Borrow(ctx context.Context, in *MsgBorrow, opts ...grpc.CallOption) (*MsgBorrowResponse, error) + // MaxBorrow allows a user to borrow the maximum amount of tokens their collateral will allow. + MaxBorrow(ctx context.Context, in *MsgMaxBorrow, opts ...grpc.CallOption) (*MsgMaxBorrowResponse, error) // Repay allows a user to repay previously borrowed tokens and interest. Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) // Liquidate allows a user to repay a different user's borrowed coins in exchange for some @@ -1161,6 +1256,15 @@ func (c *msgClient) Borrow(ctx context.Context, in *MsgBorrow, opts ...grpc.Call return out, nil } +func (c *msgClient) MaxBorrow(ctx context.Context, in *MsgMaxBorrow, opts ...grpc.CallOption) (*MsgMaxBorrowResponse, error) { + out := new(MsgMaxBorrowResponse) + err := c.cc.Invoke(ctx, "/umee.leverage.v1.Msg/MaxBorrow", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) { out := new(MsgRepayResponse) err := c.cc.Invoke(ctx, "/umee.leverage.v1.Msg/Repay", in, out, opts...) @@ -1215,6 +1319,8 @@ type MsgServer interface { Decollateralize(context.Context, *MsgDecollateralize) (*MsgDecollateralizeResponse, error) // Borrow allows a user to borrow tokens from the module if they have sufficient collateral. Borrow(context.Context, *MsgBorrow) (*MsgBorrowResponse, error) + // MaxBorrow allows a user to borrow the maximum amount of tokens their collateral will allow. + MaxBorrow(context.Context, *MsgMaxBorrow) (*MsgMaxBorrowResponse, error) // Repay allows a user to repay previously borrowed tokens and interest. Repay(context.Context, *MsgRepay) (*MsgRepayResponse, error) // Liquidate allows a user to repay a different user's borrowed coins in exchange for some @@ -1249,6 +1355,9 @@ func (*UnimplementedMsgServer) Decollateralize(ctx context.Context, req *MsgDeco func (*UnimplementedMsgServer) Borrow(ctx context.Context, req *MsgBorrow) (*MsgBorrowResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Borrow not implemented") } +func (*UnimplementedMsgServer) MaxBorrow(ctx context.Context, req *MsgMaxBorrow) (*MsgMaxBorrowResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MaxBorrow not implemented") +} func (*UnimplementedMsgServer) Repay(ctx context.Context, req *MsgRepay) (*MsgRepayResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Repay not implemented") } @@ -1374,6 +1483,24 @@ func _Msg_Borrow_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } +func _Msg_MaxBorrow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMaxBorrow) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MaxBorrow(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/umee.leverage.v1.Msg/MaxBorrow", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MaxBorrow(ctx, req.(*MsgMaxBorrow)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_Repay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgRepay) if err := dec(in); err != nil { @@ -1474,6 +1601,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Borrow", Handler: _Msg_Borrow_Handler, }, + { + MethodName: "MaxBorrow", + Handler: _Msg_MaxBorrow_Handler, + }, { MethodName: "Repay", Handler: _Msg_Repay_Handler, @@ -1732,6 +1863,43 @@ func (m *MsgBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgMaxBorrow) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMaxBorrow) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMaxBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Borrower) > 0 { + i -= len(m.Borrower) + copy(dAtA[i:], m.Borrower) + i = encodeVarintTx(dAtA, i, uint64(len(m.Borrower))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MsgRepay) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2044,6 +2212,39 @@ func (m *MsgBorrowResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgMaxBorrowResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMaxBorrowResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMaxBorrowResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Borrowed.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *MsgRepayResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2361,6 +2562,23 @@ func (m *MsgBorrow) Size() (n int) { return n } +func (m *MsgMaxBorrow) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Borrower) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgRepay) Size() (n int) { if m == nil { return 0 @@ -2476,6 +2694,17 @@ func (m *MsgBorrowResponse) Size() (n int) { return n } +func (m *MsgMaxBorrowResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Borrowed.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + func (m *MsgRepayResponse) Size() (n int) { if m == nil { return 0 @@ -3250,6 +3479,120 @@ func (m *MsgBorrow) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgMaxBorrow) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgMaxBorrow: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMaxBorrow: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Borrower", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Borrower = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgRepay) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4091,6 +4434,89 @@ func (m *MsgBorrowResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgMaxBorrowResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgMaxBorrowResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMaxBorrowResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Borrowed", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Borrowed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgRepayResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0