From a4c1b16dc7b1fd869c3c0e0b9a731ea7f7012283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDongLieu=E2=80=9D?= Date: Thu, 3 Oct 2024 14:24:29 +0700 Subject: [PATCH 1/2] updates vaults --- proto/reserve/vaults/tx.proto | 47 ++- x/vaults/keeper/keeper.go | 24 +- x/vaults/keeper/msg_server.go | 19 +- x/vaults/keeper/vault.go | 93 ++--- x/vaults/keeper/vaults_test.go | 4 +- x/vaults/types/codec.go | 1 + x/vaults/types/tx.pb.go | 643 ++++++++++++++++++++++++++++----- 7 files changed, 688 insertions(+), 143 deletions(-) diff --git a/proto/reserve/vaults/tx.proto b/proto/reserve/vaults/tx.proto index ec2158d..7ca0d80 100644 --- a/proto/reserve/vaults/tx.proto +++ b/proto/reserve/vaults/tx.proto @@ -22,6 +22,10 @@ service Msg { rpc ActiveCollateral(MsgActiveCollateral) returns (MsgActiveCollateralResponse); + // UpdatesCollateral defines a method for update a collateral asset + rpc UpdatesCollateral(MsgUpdatesCollateral) + returns (MsgUpdatesCollateralResponse); + // CreateVault defines a method for creating a new vault and mint token rpc CreateVault(MsgCreateVault) returns (MsgCreateVaultResponse); @@ -97,19 +101,52 @@ message MsgActiveCollateral { message MsgActiveCollateralResponse {} // MsgCreateValidator defines a SDK message for creating a new validator. -message MsgCreateVault { +message MsgUpdatesCollateral { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - option (cosmos.msg.v1.signer) = "owner"; + option (cosmos.msg.v1.signer) = "authority"; string denom = 1; - string owner = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string min_collateral_ratio = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string liquidation_ratio = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string max_debt = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; + + string authority = 5 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgActiveCollateralResponse defines the Msg/ActiveCollateral response type. +message MsgUpdatesCollateralResponse {} + +// MsgCreateValidator defines a SDK message for creating a new validator. +message MsgCreateVault { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "owner"; + + string owner = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - cosmos.base.v1beta1.Coin collateral = 3 + cosmos.base.v1beta1.Coin collateral = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - cosmos.base.v1beta1.Coin minted = 4 + cosmos.base.v1beta1.Coin minted = 3 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } diff --git a/x/vaults/keeper/keeper.go b/x/vaults/keeper/keeper.go index d76383e..667eb86 100644 --- a/x/vaults/keeper/keeper.go +++ b/x/vaults/keeper/keeper.go @@ -19,7 +19,7 @@ type Keeper struct { accountKeeper types.AccountKeeper // Temporarily leave it public to easily replace it with mocks. // TODO: Make it private - OracleKeeper types.OracleKeeper + OracleKeeper types.OracleKeeper // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. @@ -92,6 +92,28 @@ func (k *Keeper) ActiveCollateralAsset( return k.VaultsManager.Set(ctx, denom, vm) } +func (k *Keeper) UpdatesCollateralAsset( + ctx context.Context, + denom string, + minCollateralRatio math.LegacyDec, + liquidationRatio math.LegacyDec, + maxDebt math.Int, +) error { + // Check if asset alreay be actived + vm, err := k.GetVaultManager(ctx, denom) + if err != nil { + return fmt.Errorf("denom %s not activated", denom) + } + amountMinted := vm.Params.MaxDebt.Sub(vm.MintAvailable) + + vm.Params.MinCollateralRatio = minCollateralRatio + vm.Params.LiquidationRatio = liquidationRatio + vm.Params.MaxDebt = maxDebt + vm.MintAvailable = maxDebt.Sub(amountMinted) + + return k.VaultsManager.Set(ctx, denom, vm) +} + func (k *Keeper) GetVaultManager( ctx context.Context, denom string, diff --git a/x/vaults/keeper/msg_server.go b/x/vaults/keeper/msg_server.go index 0dc0166..857c589 100644 --- a/x/vaults/keeper/msg_server.go +++ b/x/vaults/keeper/msg_server.go @@ -34,6 +34,7 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam return &types.MsgUpdateParamsResponse{}, nil } +// Add new Active Collateral via gov func (k msgServer) ActiveCollateral(ctx context.Context, msg *types.MsgActiveCollateral) (*types.MsgActiveCollateralResponse, error) { err := k.ActiveCollateralAsset(ctx, msg.Denom, msg.MinCollateralRatio, msg.LiquidationRatio, msg.MaxDebt) if err != nil { @@ -43,14 +44,26 @@ func (k msgServer) ActiveCollateral(ctx context.Context, msg *types.MsgActiveCol return &types.MsgActiveCollateralResponse{}, nil } +// Add new Updates Collateral via gov +func (k msgServer) UpdatesCollateral(ctx context.Context, msg *types.MsgUpdatesCollateral) (*types.MsgUpdatesCollateralResponse, error) { + err := k.UpdatesCollateralAsset(ctx, msg.Denom, msg.MinCollateralRatio, msg.LiquidationRatio, msg.MaxDebt) + if err != nil { + return nil, err + } + + return &types.MsgUpdatesCollateralResponse{}, nil +} + +// Create new vault, send Collateral and receive back an amount Minted func (k msgServer) CreateVault(ctx context.Context, msg *types.MsgCreateVault) (*types.MsgCreateVaultResponse, error) { - err := k.CreateNewVault(ctx, msg.Denom, sdk.MustAccAddressFromBech32(msg.Owner), msg.Collateral, msg.Minted) + err := k.CreateNewVault(ctx, sdk.MustAccAddressFromBech32(msg.Owner), msg.Collateral, msg.Minted) if err != nil { return nil, err } return &types.MsgCreateVaultResponse{}, nil } +// Send additional Collateral func (k msgServer) Deposit(ctx context.Context, msg *types.MsgDeposit) (*types.MsgDepositResponse, error) { err := k.DepositToVault(ctx, msg.VaultId, sdk.MustAccAddressFromBech32(msg.Sender), msg.Amount) if err != nil { @@ -59,6 +72,7 @@ func (k msgServer) Deposit(ctx context.Context, msg *types.MsgDeposit) (*types.M return &types.MsgDepositResponse{}, nil } +// Withdraw a amount Collateral, make sure the remaining Collateral value is still more than the loan amount func (k msgServer) Withdraw(ctx context.Context, msg *types.MsgWithdraw) (*types.MsgWithdrawResponse, error) { err := k.WithdrawFromVault(ctx, msg.VaultId, sdk.MustAccAddressFromBech32(msg.Sender), msg.Amount) if err != nil { @@ -67,6 +81,7 @@ func (k msgServer) Withdraw(ctx context.Context, msg *types.MsgWithdraw) (*types return &types.MsgWithdrawResponse{}, nil } +// additional loan, collateral is still guaranteed func (k msgServer) Mint(ctx context.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) { err := k.MintCoin(ctx, msg.VaultId, sdk.MustAccAddressFromBech32(msg.Sender), msg.Amount) if err != nil { @@ -75,6 +90,7 @@ func (k msgServer) Mint(ctx context.Context, msg *types.MsgMint) (*types.MsgMint return &types.MsgMintResponse{}, nil } +// repay part or all of a loan func (k msgServer) Repay(ctx context.Context, msg *types.MsgRepay) (*types.MsgRepayResponse, error) { err := k.RepayDebt(ctx, msg.VaultId, sdk.MustAccAddressFromBech32(msg.Sender), msg.Amount) if err != nil { @@ -83,6 +99,7 @@ func (k msgServer) Repay(ctx context.Context, msg *types.MsgRepay) (*types.MsgRe return &types.MsgRepayResponse{}, nil } +// claim back the CollateralLocked, ensuring the debt is paid off func (k msgServer) Close(ctx context.Context, msg *types.MsgClose) (*types.MsgCloseResponse, error) { vault, err := k.GetVault(ctx, msg.VaultId) if err != nil { diff --git a/x/vaults/keeper/vault.go b/x/vaults/keeper/vault.go index 0999644..259cf97 100644 --- a/x/vaults/keeper/vault.go +++ b/x/vaults/keeper/vault.go @@ -14,11 +14,11 @@ import ( func (k *Keeper) CreateNewVault( ctx context.Context, - denom string, owner sdk.AccAddress, collateral sdk.Coin, mint sdk.Coin, ) error { + denom := collateral.Denom vm, err := k.GetVaultManager(ctx, denom) if err != nil { return fmt.Errorf("%s was not actived", denom) @@ -32,10 +32,6 @@ func (k *Keeper) CreateNewVault( return fmt.Errorf("initial mint should be greater than min. Got %v, expected %v", mint, params.MinInitialDebt) } - if vm.MintAvailable.LT(mint.Amount) { - return fmt.Errorf("exeed max debt") - } - // Calculate collateral ratio price := k.OracleKeeper.GetPrice(ctx, denom) // TODO: recalculate with denom decimal? @@ -47,8 +43,12 @@ func (k *Keeper) CreateNewVault( } feeAmount := math.LegacyNewDecFromInt(mint.Amount).Mul(params.MintingFee).TruncateInt() - feeCoins := sdk.NewCoins(sdk.NewCoin(mint.Denom, feeAmount)) - mintedCoins := feeCoins.Add(mint) + feeCoin := sdk.NewCoin(mint.Denom, feeAmount) + mintedCoin := feeCoin.Add(mint) + + if vm.MintAvailable.LT(mintedCoin.Amount) { + return fmt.Errorf("exeed max debt") + } vaultId, vaultAddress := k.GetVaultIdAndAddress(ctx) @@ -59,12 +59,12 @@ func (k *Keeper) CreateNewVault( } // Mint and transfer to user and reserve - err = k.bankKeeper.MintCoins(ctx, types.ModuleName, mintedCoins) + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(mintedCoin)) if err != nil { return err } - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, feeCoins) + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(feeCoin)) if err != nil { return err } @@ -78,7 +78,7 @@ func (k *Keeper) CreateNewVault( vault := types.Vault{ Id: vaultId, Owner: owner.String(), - Debt: mintedCoins[0], + Debt: mintedCoin, CollateralLocked: collateral, Status: types.ACTIVE, Address: vaultAddress.String(), @@ -88,7 +88,7 @@ func (k *Keeper) CreateNewVault( return err } // Update vault manager - vm.MintAvailable = vm.MintAvailable.Sub(mintedCoins[0].Amount) + vm.MintAvailable = vm.MintAvailable.Sub(mintedCoin.Amount) return k.VaultsManager.Set(ctx, denom, vm) } @@ -125,17 +125,13 @@ func (k *Keeper) MintCoin( return err } if vault.Status != types.ACTIVE { - return fmt.Errorf("Vault is not actived") + return fmt.Errorf("vault is not actived") } vm, err := k.GetVaultManager(ctx, vault.CollateralLocked.Denom) if err != nil { return fmt.Errorf("%s was not actived", vault.CollateralLocked.Denom) } - if vm.MintAvailable.LT(mint.Amount) { - return fmt.Errorf("exeed max debt") - } - params := k.GetParams(ctx) lockedCoin := vault.CollateralLocked @@ -143,23 +139,26 @@ func (k *Keeper) MintCoin( lockedValue := math.LegacyNewDecFromInt(lockedCoin.Amount).Mul(price) feeAmount := math.LegacyNewDecFromInt(mint.Amount).Mul(params.MintingFee).TruncateInt() - feeCoins := sdk.NewCoins(sdk.NewCoin(mint.Denom, feeAmount)) - mintedAmount := feeAmount.Add(mint.Amount) - mintedCoins := feeCoins.Add(mint) + feeCoin := sdk.NewCoin(mint.Denom, feeAmount) + mintedCoin := feeCoin.Add(mint) // calculate ratio - ratio := lockedValue.Quo(math.LegacyNewDecFromInt(vault.Debt.Amount.Add(mintedAmount))) + ratio := lockedValue.Quo(math.LegacyNewDecFromInt(vault.Debt.Amount.Add(mintedCoin.Amount))) if ratio.LT(vm.Params.MinCollateralRatio) { return fmt.Errorf("collateral ratio invalid, got %d, min %d", ratio, vm.Params.MinCollateralRatio) } + if vm.MintAvailable.LT(mintedCoin.Amount) { + return fmt.Errorf("exeed max debt") + } + // Mint and transfer to user and reserve - err = k.bankKeeper.MintCoins(ctx, types.ModuleName, mintedCoins) + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(mintedCoin)) if err != nil { return err } - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, feeCoins) + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(feeCoin)) if err != nil { return err } @@ -170,16 +169,15 @@ func (k *Keeper) MintCoin( } // Update vault debt - vault.Debt = vault.Debt.Add(sdk.NewCoin(vault.Debt.Denom, mintedAmount)) + vault.Debt = vault.Debt.Add(sdk.NewCoin(vault.Debt.Denom, mintedCoin.Amount)) err = k.SetVault(ctx, vault) if err != nil { return err } // Update vault manager - vm.MintAvailable = vm.MintAvailable.Sub(mintedCoins[0].Amount) + vm.MintAvailable = vm.MintAvailable.Sub(mintedCoin.Amount) return k.VaultsManager.Set(ctx, vault.CollateralLocked.Denom, vm) - } func (k *Keeper) RepayDebt( @@ -193,7 +191,7 @@ func (k *Keeper) RepayDebt( return err } if vault.Status != types.ACTIVE { - return fmt.Errorf("Vault is not actived") + return fmt.Errorf("vault is not actived") } vm, err := k.GetVaultManager(ctx, vault.CollateralLocked.Denom) if err != nil { @@ -236,8 +234,13 @@ func (k *Keeper) DepositToVault( if err != nil { return err } + + if collateral.Denom != vault.CollateralLocked.Denom { + return fmt.Errorf("vaultId %d does not accept denom %s", vaultId, collateral.Denom) + } + if vault.Status != types.ACTIVE { - return fmt.Errorf("Vault is not actived") + return fmt.Errorf("vault is not actived") } // Lock collateral asset @@ -262,7 +265,7 @@ func (k *Keeper) WithdrawFromVault( return err } if vault.Status != types.ACTIVE { - return fmt.Errorf("Vault is not actived") + return fmt.Errorf("vault is not actived") } if vault.CollateralLocked.Amount.LT(collateral.Amount) { @@ -388,12 +391,12 @@ func (k *Keeper) GetLiquidations( func (k *Keeper) Liquidate( ctx context.Context, liquidation types.Liquidation, -) (error, bool, sdk.Coin) { +) (bool, sdk.Coin, error) { params := k.GetParams(ctx) vm, err := k.GetVaultManager(ctx, liquidation.Denom) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } totalDebt := sdk.NewCoin(params.MintDenom, math.ZeroInt()) @@ -407,7 +410,7 @@ func (k *Keeper) Liquidate( balances := k.bankKeeper.GetAllBalances(ctx, vaultAddr) err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, vaultAddr, types.ModuleName, balances) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } vault.Status = types.LIQUIDATED } @@ -422,13 +425,13 @@ func (k *Keeper) Liquidate( // Burn debt err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(totalDebt)) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } // Increase mint available vm.MintAvailable = vm.MintAvailable.Add(totalDebt.Amount) err = k.VaultsManager.Set(ctx, liquidation.Denom, vm) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } // If remain sold, send to reserve @@ -436,7 +439,7 @@ func (k *Keeper) Liquidate( if remain.Amount.GT(math.ZeroInt()) { err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(remain)) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } } @@ -454,16 +457,16 @@ func (k *Keeper) Liquidate( if penaltyAmount.GTE(collateralRemain.Amount) { err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(collateralRemain)) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } } else { err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(sdk.NewCoin(collateralRemain.Denom, penaltyAmount))) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(vault.Owner), sdk.NewCoins(sdk.NewCoin(collateralRemain.Denom, collateralRemain.Amount.Sub(penaltyAmount)))) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } } } @@ -474,13 +477,13 @@ func (k *Keeper) Liquidate( // Burn sold amount err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sold)) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } // Increase mint available vm.MintAvailable = vm.MintAvailable.Add(sold.Amount) err = k.VaultsManager.Set(ctx, liquidation.Denom, vm) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } // No collateral remain @@ -490,7 +493,7 @@ func (k *Keeper) Liquidate( for _, vault := range liquidation.LiquidatingVaults { k.SetVault(ctx, *vault) } - return nil, true, totalDebt.Sub(sold) + return true, totalDebt.Sub(sold), nil } else { // If there some collateral asset remain, try to reconstitue vault // Priority by collateral ratio at momment @@ -502,7 +505,7 @@ func (k *Keeper) Liquidate( penaltyAmount := math.LegacyNewDecFromInt(vault.Debt.Amount).Quo(vault.LiquidationPrice).Mul(params.LiquidationPenalty).TruncateInt() err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(sdk.NewCoin(liquidation.Denom, penaltyAmount))) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } vault.CollateralLocked.Amount = vault.CollateralLocked.Amount.Sub(penaltyAmount) totalCollateralRemain.Amount = totalCollateralRemain.Amount.Sub(penaltyAmount) @@ -525,7 +528,7 @@ func (k *Keeper) Liquidate( // Lock collateral to vault address err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(vault.Address), sdk.NewCoins(vault.CollateralLocked)) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } totalRemainDebt = totalRemainDebt.Sub(vault.Debt) totalCollateralRemain = totalCollateralRemain.Sub(vault.CollateralLocked) @@ -540,7 +543,7 @@ func (k *Keeper) Liquidate( if totalCollateralRemain.Amount.GT(math.ZeroInt()) { err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(totalCollateralRemain)) if err != nil { - return err, false, sdk.Coin{} + return false, sdk.Coin{}, err } } @@ -550,7 +553,7 @@ func (k *Keeper) Liquidate( for _, vault := range liquidation.LiquidatingVaults { k.SetVault(ctx, *vault) } - return nil, true, totalRemainDebt + return true, totalRemainDebt, nil } } @@ -559,7 +562,7 @@ func (k *Keeper) Liquidate( for _, vault := range liquidation.LiquidatingVaults { k.SetVault(ctx, *vault) } - return nil, false, sdk.Coin{} + return false, sdk.Coin{}, nil } func (k *Keeper) GetVault( diff --git a/x/vaults/keeper/vaults_test.go b/x/vaults/keeper/vaults_test.go index 6533806..c553645 100644 --- a/x/vaults/keeper/vaults_test.go +++ b/x/vaults/keeper/vaults_test.go @@ -106,7 +106,7 @@ func (s *KeeperTestSuite) TestCreateNewVault() { for _, t := range tests { s.Run(t.name, func() { t.setup() - err := s.k.CreateNewVault(s.Ctx, t.denom, t.owner, t.collateral, t.mint) + err := s.k.CreateNewVault(s.Ctx, t.owner, t.collateral, t.mint) if t.expErr { s.Require().Error(err) } else { @@ -545,7 +545,7 @@ func (s *KeeperTestSuite) TestLiquidate() { s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, soldCoins) } - err, isShortfall, shortfallAmount := s.App.VaultsKeeper.Liquidate(s.Ctx, t.liquidation) + isShortfall, shortfallAmount, err := s.App.VaultsKeeper.Liquidate(s.Ctx, t.liquidation) fmt.Println("errrrr", err, isShortfall, shortfallAmount) if t.reserveBalances != nil { diff --git a/x/vaults/types/codec.go b/x/vaults/types/codec.go index 85e226f..2bc6880 100644 --- a/x/vaults/types/codec.go +++ b/x/vaults/types/codec.go @@ -13,6 +13,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateParams{}, &MsgActiveCollateral{}, + &MsgUpdatesCollateral{}, &MsgCreateVault{}, &MsgDeposit{}, &MsgWithdraw{}, diff --git a/x/vaults/types/tx.pb.go b/x/vaults/types/tx.pb.go index 68a346e..1a7c198 100644 --- a/x/vaults/types/tx.pb.go +++ b/x/vaults/types/tx.pb.go @@ -207,19 +207,97 @@ func (m *MsgActiveCollateralResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgActiveCollateralResponse proto.InternalMessageInfo +// MsgCreateValidator defines a SDK message for creating a new validator. +type MsgUpdatesCollateral struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + MinCollateralRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=min_collateral_ratio,json=minCollateralRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_collateral_ratio"` + LiquidationRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_ratio"` + MaxDebt cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=max_debt,json=maxDebt,proto3,customtype=cosmossdk.io/math.Int" json:"max_debt"` + Authority string `protobuf:"bytes,5,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgUpdatesCollateral) Reset() { *m = MsgUpdatesCollateral{} } +func (m *MsgUpdatesCollateral) String() string { return proto.CompactTextString(m) } +func (*MsgUpdatesCollateral) ProtoMessage() {} +func (*MsgUpdatesCollateral) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{4} +} +func (m *MsgUpdatesCollateral) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdatesCollateral) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdatesCollateral.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 *MsgUpdatesCollateral) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdatesCollateral.Merge(m, src) +} +func (m *MsgUpdatesCollateral) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdatesCollateral) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdatesCollateral.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdatesCollateral proto.InternalMessageInfo + +// MsgActiveCollateralResponse defines the Msg/ActiveCollateral response type. +type MsgUpdatesCollateralResponse struct { +} + +func (m *MsgUpdatesCollateralResponse) Reset() { *m = MsgUpdatesCollateralResponse{} } +func (m *MsgUpdatesCollateralResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdatesCollateralResponse) ProtoMessage() {} +func (*MsgUpdatesCollateralResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bbce2367024dc47b, []int{5} +} +func (m *MsgUpdatesCollateralResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdatesCollateralResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdatesCollateralResponse.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 *MsgUpdatesCollateralResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdatesCollateralResponse.Merge(m, src) +} +func (m *MsgUpdatesCollateralResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdatesCollateralResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdatesCollateralResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdatesCollateralResponse proto.InternalMessageInfo + // MsgCreateValidator defines a SDK message for creating a new validator. type MsgCreateVault struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - Collateral types.Coin `protobuf:"bytes,3,opt,name=collateral,proto3" json:"collateral"` - Minted types.Coin `protobuf:"bytes,4,opt,name=minted,proto3" json:"minted"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Collateral types.Coin `protobuf:"bytes,2,opt,name=collateral,proto3" json:"collateral"` + Minted types.Coin `protobuf:"bytes,3,opt,name=minted,proto3" json:"minted"` } func (m *MsgCreateVault) Reset() { *m = MsgCreateVault{} } func (m *MsgCreateVault) String() string { return proto.CompactTextString(m) } func (*MsgCreateVault) ProtoMessage() {} func (*MsgCreateVault) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{4} + return fileDescriptor_bbce2367024dc47b, []int{6} } func (m *MsgCreateVault) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -256,7 +334,7 @@ func (m *MsgCreateVaultResponse) Reset() { *m = MsgCreateVaultResponse{} func (m *MsgCreateVaultResponse) String() string { return proto.CompactTextString(m) } func (*MsgCreateVaultResponse) ProtoMessage() {} func (*MsgCreateVaultResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{5} + return fileDescriptor_bbce2367024dc47b, []int{7} } func (m *MsgCreateVaultResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -297,7 +375,7 @@ func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } func (m *MsgDeposit) String() string { return proto.CompactTextString(m) } func (*MsgDeposit) ProtoMessage() {} func (*MsgDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{6} + return fileDescriptor_bbce2367024dc47b, []int{8} } func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -334,7 +412,7 @@ func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } func (*MsgDepositResponse) ProtoMessage() {} func (*MsgDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{7} + return fileDescriptor_bbce2367024dc47b, []int{9} } func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -375,7 +453,7 @@ func (m *MsgWithdraw) Reset() { *m = MsgWithdraw{} } func (m *MsgWithdraw) String() string { return proto.CompactTextString(m) } func (*MsgWithdraw) ProtoMessage() {} func (*MsgWithdraw) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{8} + return fileDescriptor_bbce2367024dc47b, []int{10} } func (m *MsgWithdraw) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -412,7 +490,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_bbce2367024dc47b, []int{9} + return fileDescriptor_bbce2367024dc47b, []int{11} } func (m *MsgWithdrawResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -452,7 +530,7 @@ func (m *MsgMint) Reset() { *m = MsgMint{} } func (m *MsgMint) String() string { return proto.CompactTextString(m) } func (*MsgMint) ProtoMessage() {} func (*MsgMint) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{10} + return fileDescriptor_bbce2367024dc47b, []int{12} } func (m *MsgMint) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -489,7 +567,7 @@ func (m *MsgMintResponse) Reset() { *m = MsgMintResponse{} } func (m *MsgMintResponse) String() string { return proto.CompactTextString(m) } func (*MsgMintResponse) ProtoMessage() {} func (*MsgMintResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{11} + return fileDescriptor_bbce2367024dc47b, []int{13} } func (m *MsgMintResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -529,7 +607,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_bbce2367024dc47b, []int{12} + return fileDescriptor_bbce2367024dc47b, []int{14} } func (m *MsgRepay) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -566,7 +644,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_bbce2367024dc47b, []int{13} + return fileDescriptor_bbce2367024dc47b, []int{15} } func (m *MsgRepayResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -605,7 +683,7 @@ func (m *MsgClose) Reset() { *m = MsgClose{} } func (m *MsgClose) String() string { return proto.CompactTextString(m) } func (*MsgClose) ProtoMessage() {} func (*MsgClose) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{14} + return fileDescriptor_bbce2367024dc47b, []int{16} } func (m *MsgClose) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -642,7 +720,7 @@ func (m *MsgCloseResponse) Reset() { *m = MsgCloseResponse{} } func (m *MsgCloseResponse) String() string { return proto.CompactTextString(m) } func (*MsgCloseResponse) ProtoMessage() {} func (*MsgCloseResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bbce2367024dc47b, []int{15} + return fileDescriptor_bbce2367024dc47b, []int{17} } func (m *MsgCloseResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -676,6 +754,8 @@ func init() { proto.RegisterType((*MsgUpdateParamsResponse)(nil), "reserve.vaults.MsgUpdateParamsResponse") proto.RegisterType((*MsgActiveCollateral)(nil), "reserve.vaults.MsgActiveCollateral") proto.RegisterType((*MsgActiveCollateralResponse)(nil), "reserve.vaults.MsgActiveCollateralResponse") + proto.RegisterType((*MsgUpdatesCollateral)(nil), "reserve.vaults.MsgUpdatesCollateral") + proto.RegisterType((*MsgUpdatesCollateralResponse)(nil), "reserve.vaults.MsgUpdatesCollateralResponse") proto.RegisterType((*MsgCreateVault)(nil), "reserve.vaults.MsgCreateVault") proto.RegisterType((*MsgCreateVaultResponse)(nil), "reserve.vaults.MsgCreateVaultResponse") proto.RegisterType((*MsgDeposit)(nil), "reserve.vaults.MsgDeposit") @@ -693,64 +773,66 @@ func init() { func init() { proto.RegisterFile("reserve/vaults/tx.proto", fileDescriptor_bbce2367024dc47b) } var fileDescriptor_bbce2367024dc47b = []byte{ - // 901 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x92, 0x38, 0x3f, 0x5e, 0x50, 0x49, 0xb6, 0x6e, 0xe2, 0x6c, 0x84, 0x1d, 0xb9, 0x12, - 0x54, 0x41, 0xdd, 0x6d, 0x52, 0xa9, 0x12, 0x11, 0x07, 0x1a, 0xfb, 0x62, 0xd1, 0x95, 0x90, 0x51, - 0x01, 0x71, 0xb1, 0xc6, 0xbb, 0xa3, 0xf5, 0x88, 0xdd, 0x19, 0xb3, 0x33, 0x76, 0xe3, 0x1b, 0xe2, - 0x54, 0x71, 0xe2, 0xc6, 0xb5, 0x47, 0x40, 0x20, 0xe5, 0xd0, 0x0b, 0xff, 0x41, 0x8f, 0x55, 0x4f, - 0x88, 0x43, 0x85, 0x92, 0x43, 0x38, 0xf1, 0x37, 0xa0, 0x9d, 0x99, 0x5d, 0xaf, 0x9d, 0x75, 0x08, - 0x82, 0x43, 0x2e, 0x89, 0x67, 0xbf, 0xf7, 0xbe, 0xf7, 0xbd, 0xf7, 0xe6, 0xcd, 0x0c, 0x6c, 0xc5, - 0x98, 0xe3, 0x78, 0x84, 0x9d, 0x11, 0x1a, 0x86, 0x82, 0x3b, 0xe2, 0xd8, 0x1e, 0xc4, 0x4c, 0x30, - 0xf3, 0x86, 0x06, 0x6c, 0x05, 0x58, 0x95, 0x80, 0x05, 0x4c, 0x42, 0x4e, 0xf2, 0x4b, 0x59, 0x59, - 0x3b, 0x33, 0xee, 0x03, 0x14, 0xa3, 0x88, 0x6b, 0x70, 0x03, 0x45, 0x84, 0x32, 0x47, 0xfe, 0xd5, - 0x9f, 0xb6, 0x3d, 0xc6, 0x23, 0xc6, 0xbb, 0x8a, 0x48, 0x2d,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, 0x00, 0x00, + // 938 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0x92, 0x38, 0x3f, 0x5e, 0x50, 0x49, 0xb6, 0x6e, 0xe2, 0x6c, 0x60, 0x1d, 0xb9, 0x08, + 0xaa, 0x40, 0x77, 0x9b, 0x56, 0xaa, 0x44, 0xc4, 0x81, 0x26, 0xbe, 0x58, 0x74, 0x25, 0x64, 0x54, + 0x40, 0x5c, 0xac, 0xf1, 0xee, 0x68, 0x3d, 0x62, 0x77, 0xc6, 0xec, 0x8c, 0xdd, 0xf8, 0x86, 0x38, + 0x21, 0x4e, 0xdc, 0xe0, 0xd8, 0x23, 0x20, 0x90, 0x72, 0xe8, 0x85, 0xff, 0xa0, 0xc7, 0xaa, 0xa7, + 0x8a, 0x43, 0x85, 0x92, 0x43, 0xb8, 0xf2, 0x1f, 0xa0, 0x9d, 0x19, 0xaf, 0xd7, 0xce, 0x3a, 0x0d, + 0x82, 0x43, 0x0e, 0x5c, 0x92, 0x8c, 0xbf, 0xf7, 0xbe, 0xf7, 0x7d, 0xf3, 0x66, 0x9e, 0x27, 0xb0, + 0x91, 0x60, 0x8e, 0x93, 0x01, 0x76, 0x07, 0xa8, 0x1f, 0x09, 0xee, 0x8a, 0x43, 0xa7, 0x97, 0x30, + 0xc1, 0xcc, 0x2b, 0x1a, 0x70, 0x14, 0x60, 0x55, 0x42, 0x16, 0x32, 0x09, 0xb9, 0xe9, 0x5f, 0x2a, + 0xca, 0xda, 0x9a, 0x4a, 0xef, 0xa1, 0x04, 0xc5, 0x5c, 0x83, 0x6b, 0x28, 0x26, 0x94, 0xb9, 0xf2, + 0xa7, 0xfe, 0x68, 0xd3, 0x67, 0x3c, 0x66, 0xbc, 0xad, 0x88, 0xd4, 0x42, 0x43, 0x1b, 0x6a, 0xe5, + 0xc6, 0x3c,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f2, 0xfb, 0x2c, 0x72, 0xc7, 0x4f, + 0xeb, 0xd1, 0x7f, 0x2e, 0xc3, 0x1e, 0xe6, 0x9d, 0x05, 0x19, 0x70, 0xe7, 0xef, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x1e, 0x12, 0x40, 0x06, 0xd8, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -770,6 +852,8 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) // ActiveCollateral defines a method for enable a collateral asset ActiveCollateral(ctx context.Context, in *MsgActiveCollateral, opts ...grpc.CallOption) (*MsgActiveCollateralResponse, error) + // UpdatesCollateral defines a method for update a collateral asset + UpdatesCollateral(ctx context.Context, in *MsgUpdatesCollateral, opts ...grpc.CallOption) (*MsgUpdatesCollateralResponse, error) // CreateVault defines a method for creating a new vault and mint token CreateVault(ctx context.Context, in *MsgCreateVault, opts ...grpc.CallOption) (*MsgCreateVaultResponse, error) // Deposit defines a method for depositing collateral assets to vault @@ -811,6 +895,15 @@ func (c *msgClient) ActiveCollateral(ctx context.Context, in *MsgActiveCollatera return out, nil } +func (c *msgClient) UpdatesCollateral(ctx context.Context, in *MsgUpdatesCollateral, opts ...grpc.CallOption) (*MsgUpdatesCollateralResponse, error) { + out := new(MsgUpdatesCollateralResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/UpdatesCollateral", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) CreateVault(ctx context.Context, in *MsgCreateVault, opts ...grpc.CallOption) (*MsgCreateVaultResponse, error) { out := new(MsgCreateVaultResponse) err := c.cc.Invoke(ctx, "/reserve.vaults.Msg/CreateVault", in, out, opts...) @@ -872,6 +965,8 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // ActiveCollateral defines a method for enable a collateral asset ActiveCollateral(context.Context, *MsgActiveCollateral) (*MsgActiveCollateralResponse, error) + // UpdatesCollateral defines a method for update a collateral asset + UpdatesCollateral(context.Context, *MsgUpdatesCollateral) (*MsgUpdatesCollateralResponse, error) // CreateVault defines a method for creating a new vault and mint token CreateVault(context.Context, *MsgCreateVault) (*MsgCreateVaultResponse, error) // Deposit defines a method for depositing collateral assets to vault @@ -897,6 +992,9 @@ func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateP func (*UnimplementedMsgServer) ActiveCollateral(ctx context.Context, req *MsgActiveCollateral) (*MsgActiveCollateralResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ActiveCollateral not implemented") } +func (*UnimplementedMsgServer) UpdatesCollateral(ctx context.Context, req *MsgUpdatesCollateral) (*MsgUpdatesCollateralResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatesCollateral not implemented") +} func (*UnimplementedMsgServer) CreateVault(ctx context.Context, req *MsgCreateVault) (*MsgCreateVaultResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateVault not implemented") } @@ -956,6 +1054,24 @@ func _Msg_ActiveCollateral_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_UpdatesCollateral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdatesCollateral) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdatesCollateral(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Msg/UpdatesCollateral", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdatesCollateral(ctx, req.(*MsgUpdatesCollateral)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_CreateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgCreateVault) if err := dec(in); err != nil { @@ -1076,6 +1192,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ActiveCollateral", Handler: _Msg_ActiveCollateral_Handler, }, + { + MethodName: "UpdatesCollateral", + Handler: _Msg_UpdatesCollateral_Handler, + }, { MethodName: "CreateVault", Handler: _Msg_CreateVault_Handler, @@ -1258,6 +1378,96 @@ func (m *MsgActiveCollateralResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *MsgUpdatesCollateral) 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 *MsgUpdatesCollateral) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdatesCollateral) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0x2a + } + { + size := m.MaxDebt.Size() + i -= size + if _, err := m.MaxDebt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.LiquidationRatio.Size() + i -= size + if _, err := m.LiquidationRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.MinCollateralRatio.Size() + i -= size + if _, err := m.MinCollateralRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdatesCollateralResponse) 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 *MsgUpdatesCollateralResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdatesCollateralResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgCreateVault) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1287,7 +1497,7 @@ func (m *MsgCreateVault) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a { size, err := m.Collateral.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1297,19 +1507,12 @@ func (m *MsgCreateVault) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 if len(m.Owner) > 0 { i -= len(m.Owner) copy(dAtA[i:], m.Owner) i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) i-- - dAtA[i] = 0x12 - } - 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] = 0xa } return len(dAtA) - i, nil @@ -1735,7 +1938,7 @@ func (m *MsgActiveCollateralResponse) Size() (n int) { return n } -func (m *MsgCreateVault) Size() (n int) { +func (m *MsgUpdatesCollateral) Size() (n int) { if m == nil { return 0 } @@ -1745,6 +1948,34 @@ func (m *MsgCreateVault) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = m.MinCollateralRatio.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.LiquidationRatio.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MaxDebt.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdatesCollateralResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreateVault) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l l = len(m.Owner) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -2335,7 +2566,7 @@ func (m *MsgActiveCollateralResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { +func (m *MsgUpdatesCollateral) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2358,10 +2589,10 @@ func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateVault: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdatesCollateral: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateVault: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdatesCollateral: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2397,6 +2628,240 @@ func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCollateralRatio", 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 + } + if err := m.MinCollateralRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationRatio", 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 + } + if err := m.LiquidationRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDebt", 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 + } + if err := m.MaxDebt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = 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 *MsgUpdatesCollateralResponse) 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: MsgUpdatesCollateralResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdatesCollateralResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *MsgCreateVault) 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: MsgCreateVault: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateVault: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } @@ -2428,7 +2893,7 @@ func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { } m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Collateral", wireType) } @@ -2461,7 +2926,7 @@ func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Minted", wireType) } From d2956c4a53b2e4cb1c0ac67539ebc1f59e3847c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDongLieu=E2=80=9D?= Date: Thu, 3 Oct 2024 14:26:20 +0700 Subject: [PATCH 2/2] minor --- x/vaults/keeper/msg_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/vaults/keeper/msg_server.go b/x/vaults/keeper/msg_server.go index 857c589..6841f9d 100644 --- a/x/vaults/keeper/msg_server.go +++ b/x/vaults/keeper/msg_server.go @@ -44,7 +44,7 @@ func (k msgServer) ActiveCollateral(ctx context.Context, msg *types.MsgActiveCol return &types.MsgActiveCollateralResponse{}, nil } -// Add new Updates Collateral via gov +// Updates Collateral via gov func (k msgServer) UpdatesCollateral(ctx context.Context, msg *types.MsgUpdatesCollateral) (*types.MsgUpdatesCollateralResponse, error) { err := k.UpdatesCollateralAsset(ctx, msg.Denom, msg.MinCollateralRatio, msg.LiquidationRatio, msg.MaxDebt) if err != nil {