diff --git a/proto/reserve/vaults/proposal.proto b/proto/reserve/vaults/proposal.proto new file mode 100644 index 0000000..b1d0289 --- /dev/null +++ b/proto/reserve/vaults/proposal.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package reserve.vaults; + +import "gogoproto/gogo.proto"; +import "reserve/vaults/tx.proto"; +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; + + +option go_package = "github.com/onomyprotocol/reserve/x/vaults/types"; + + +message ActiveCollateralProposal { + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (amino.name) = "reserve/ActiveCollateralProposal"; + + string title = 1; + string description = 2; + MsgActiveCollateral active_collateral = 3 [(gogoproto.nullable) = false]; +} + +message UpdatesCollateralProposal { + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (amino.name) = "reserve/UpdatesCollateralProposal"; + + string title = 1; + string description = 2; + MsgUpdatesCollateral updates_collateral = 3 [(gogoproto.nullable) = false]; +} diff --git a/script/proposal-1.json b/script/proposal-1.json new file mode 100644 index 0000000..7f7fc6e --- /dev/null +++ b/script/proposal-1.json @@ -0,0 +1,13 @@ +{ + "messages": [{ + "@type": "/reserve.vaults.MsgActiveCollateral", + "denom": "atom", + "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", + "min_collateral_ratio": "0.5", + "liquidation_ratio":"0.5", + "max_debt":"10000" + }], + "deposit": "100000000stake", + "title": "My proposal", + "summary": "A short summary of my proposal" + } \ No newline at end of file diff --git a/script/vaults-gov-test.sh b/script/vaults-gov-test.sh new file mode 100755 index 0000000..3231dc8 --- /dev/null +++ b/script/vaults-gov-test.sh @@ -0,0 +1,137 @@ +#!/bin/bash +set -xeu + +# always returns true so set -e doesn't exit if it is not running. +killall reserved || true +rm -rf $HOME/.reserved/ + +mkdir $HOME/.reserved +mkdir $HOME/.reserved/validator1 +mkdir $HOME/.reserved/validator2 +mkdir $HOME/.reserved/validator3 + +# init all three validators +reserved init --chain-id=testing-1 validator1 --home=$HOME/.reserved/validator1 +reserved init --chain-id=testing-1 validator2 --home=$HOME/.reserved/validator2 +reserved init --chain-id=testing-1 validator3 --home=$HOME/.reserved/validator3 + +# create keys for all three validators +mnemonic1="top toddler wrist parade hobby supply odor ginger resource copy square tell vanish pride volcano effort planet style transfer pipe wise bus tuition luxury" +mnemonic2="panther giant oyster hand song region chunk coil laundry glance ball denial void ramp palm fiscal pizza soccer before upset diet valid story cement" +mnemonic3="gap track crop knee galaxy square case resemble subway math moon mom casino trade finish exotic author comic gap margin elegant claw fire business" + +echo $mnemonic1| reserved keys add validator1 --recover --keyring-backend=test --home=$HOME/.reserved/validator1 +echo $mnemonic2| reserved keys add validator2 --recover --keyring-backend=test --home=$HOME/.reserved/validator2 +echo $mnemonic3| reserved keys add validator3 --recover --keyring-backend=test --home=$HOME/.reserved/validator3 + +# create validator node with tokens to transfer to the three other nodes +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis gentx validator1 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator1 --chain-id=testing-1 +reserved genesis gentx validator2 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator2 --chain-id=testing-1 +reserved genesis gentx validator3 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator3 --chain-id=testing-1 + +# cp validator2/config/gentx/*.json $HOME/.reserved/validator1/config/gentx/ +# cp validator3/config/gentx/*.json $HOME/.reserved/validator1/config/gentx/ +reserved genesis collect-gentxs --home=$HOME/.reserved/validator1 + +# change app.toml values +VALIDATOR1_APP_TOML=$HOME/.reserved/validator1/config/app.toml +VALIDATOR2_APP_TOML=$HOME/.reserved/validator2/config/app.toml +VALIDATOR3_APP_TOML=$HOME/.reserved/validator3/config/app.toml + +# validator1 +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9050|g' $VALIDATOR1_APP_TOML +sed -i -E 's|127.0.0.1:9090|127.0.0.1:9050|g' $VALIDATOR1_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR1_APP_TOML + +# validator2 +sed -i -E 's|tcp://0.0.0.0:1317|tcp://0.0.0.0:1316|g' $VALIDATOR2_APP_TOML +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9088|g' $VALIDATOR2_APP_TOML +sed -i -E 's|0.0.0.0:9091|0.0.0.0:9089|g' $VALIDATOR2_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR2_APP_TOML + +# validator3 +sed -i -E 's|tcp://0.0.0.0:1317|tcp://0.0.0.0:1315|g' $VALIDATOR3_APP_TOML +sed -i -E 's|0.0.0.0:9090|0.0.0.0:9086|g' $VALIDATOR3_APP_TOML +sed -i -E 's|0.0.0.0:9091|0.0.0.0:9087|g' $VALIDATOR3_APP_TOML +sed -i -E 's|minimum-gas-prices = ""|minimum-gas-prices = "0.0001stake"|g' $VALIDATOR3_APP_TOML + +# change config.toml values +VALIDATOR1_CONFIG=$HOME/.reserved/validator1/config/config.toml +VALIDATOR2_CONFIG=$HOME/.reserved/validator2/config/config.toml +VALIDATOR3_CONFIG=$HOME/.reserved/validator3/config/config.toml + + +# validator1 +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR1_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR1_CONFIG + + +# validator2 +sed -i -E 's|tcp://127.0.0.1:26658|tcp://127.0.0.1:26655|g' $VALIDATOR2_CONFIG +sed -i -E 's|tcp://127.0.0.1:26657|tcp://127.0.0.1:26654|g' $VALIDATOR2_CONFIG +sed -i -E 's|tcp://0.0.0.0:26656|tcp://0.0.0.0:26653|g' $VALIDATOR2_CONFIG +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR2_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR2_CONFIG +sed -i -E 's|prometheus_listen_addr = ":26660"|prometheus_listen_addr = ":26630"|g' $VALIDATOR2_CONFIG + +# validator3 +sed -i -E 's|tcp://127.0.0.1:26658|tcp://127.0.0.1:26652|g' $VALIDATOR3_CONFIG +sed -i -E 's|tcp://127.0.0.1:26657|tcp://127.0.0.1:26651|g' $VALIDATOR3_CONFIG +sed -i -E 's|tcp://0.0.0.0:26656|tcp://0.0.0.0:26650|g' $VALIDATOR3_CONFIG +sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $VALIDATOR3_CONFIG +sed -i -E 's|prometheus = false|prometheus = true|g' $VALIDATOR3_CONFIG +sed -i -E 's|prometheus_listen_addr = ":26660"|prometheus_listen_addr = ":26620"|g' $VALIDATOR3_CONFIG + +# copy, update validator1 genesis file to validator2-3 +update_test_genesis () { + cat $HOME/.reserved/validator1/config/genesis.json | jq "$1" > tmp.json && mv tmp.json $HOME/.reserved/validator1/config/genesis.json +} + +update_test_genesis '.app_state["gov"]["params"]["voting_period"] = "15s"' +update_test_genesis '.app_state["gov"]["params"]["expedited_voting_period"] = "10s"' + +cp $HOME/.reserved/validator1/config/genesis.json $HOME/.reserved/validator2/config/genesis.json +cp $HOME/.reserved/validator1/config/genesis.json $HOME/.reserved/validator3/config/genesis.json + +# copy tendermint node id of validator1 to persistent peers of validator2-3 +node1=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator1) +node2=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator2) +node3=$(reserved tendermint show-node-id --home=$HOME/.reserved/validator3) +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator1/config/config.toml +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator2/config/config.toml +sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656,$node2@localhost:26656,$node3@localhost:26656\"|g" $HOME/.reserved/validator3/config/config.toml + + +# # start all three validators +screen -S onomy1 -t onomy1 -d -m reserved start --home=$HOME/.reserved/validator1 +screen -S onomy2 -t onomy2 -d -m reserved start --home=$HOME/.reserved/validator2 +screen -S onomy3 -t onomy3 -d -m reserved start --home=$HOME/.reserved/validator3 + +# submit proposal add usdt +sleep 7 +reserved q gov proposals +# reserved tx gov submit-legacy-proposal active-collateral "title" "description" "atom" "10" "0.1" "10000" 10000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator1 --from validator1 -y --chain-id testing-1 --fees 20stake + +reserved tx gov submit-proposal ./script/proposal-1.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y + +# # vote +sleep 7 +reserved tx gov vote 1 yes --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 1 yes --from validator2 --keyring-backend test --home ~/.reserved/validator2 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 1 yes --from validator3 --keyring-backend test --home ~/.reserved/validator3 --chain-id testing-1 -y --fees 20stake + +# wait voting_perio=15s +echo "========sleep==========" +sleep 15 +reserved q gov proposals + +killall reserved || true \ No newline at end of file diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index d49be15..d12398f 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -135,6 +135,12 @@ func (k *Keeper) ScopedKeeper() exported.ScopedKeeper { return k.scopedKeeper } +// need to delete when merging with oracle func (k *Keeper) GetPrice(ctx context.Context, denom string) math.LegacyDec { return math.LegacyZeroDec() } + +// need to delete when merging with oracle +func (k *Keeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error { + return nil +} diff --git a/x/vaults/keeper/keeper.go b/x/vaults/keeper/keeper.go index 667eb86..69b9596 100644 --- a/x/vaults/keeper/keeper.go +++ b/x/vaults/keeper/keeper.go @@ -89,6 +89,11 @@ func (k *Keeper) ActiveCollateralAsset( }, MintAvailable: maxDebt, } + err := k.OracleKeeper.AddNewSymbolToBandOracleRequest(ctx, denom, 1) + if err != nil { + return err + } + return k.VaultsManager.Set(ctx, denom, vm) } diff --git a/x/vaults/keeper/mock/oracle_keeper.go b/x/vaults/keeper/mock/oracle_keeper.go index b299612..41ec7b6 100644 --- a/x/vaults/keeper/mock/oracle_keeper.go +++ b/x/vaults/keeper/mock/oracle_keeper.go @@ -23,3 +23,7 @@ func (s *MockOracleKeeper) GetPrice(ctx context.Context, denom string) math.Lega func (s *MockOracleKeeper) SetPrice(denom string, price math.LegacyDec) { s.prices[denom] = price } + +func (s *MockOracleKeeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error { + return nil +} diff --git a/x/vaults/keeper/msg_server.go b/x/vaults/keeper/msg_server.go index 6841f9d..71c43e3 100644 --- a/x/vaults/keeper/msg_server.go +++ b/x/vaults/keeper/msg_server.go @@ -36,6 +36,10 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam // Add new Active Collateral via gov func (k msgServer) ActiveCollateral(ctx context.Context, msg *types.MsgActiveCollateral) (*types.MsgActiveCollateralResponse, error) { + if k.authority != msg.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + err := k.ActiveCollateralAsset(ctx, msg.Denom, msg.MinCollateralRatio, msg.LiquidationRatio, msg.MaxDebt) if err != nil { return nil, err diff --git a/x/vaults/module/module.go b/x/vaults/module/module.go index c5b91a9..cfb0fe3 100644 --- a/x/vaults/module/module.go +++ b/x/vaults/module/module.go @@ -17,7 +17,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - // govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" abci "github.com/cometbft/cometbft/abci/types" @@ -178,9 +178,9 @@ type ModuleInputs struct { type ModuleOutputs struct { depinject.Out - PsmKeeper keeper.Keeper - Module appmodule.AppModule - // GovHandler govv1beta1.HandlerRoute + PsmKeeper keeper.Keeper + Module appmodule.AppModule + GovHandler govv1beta1.HandlerRoute } func ProvideModule(in ModuleInputs) ModuleOutputs { @@ -206,7 +206,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { in.BankKeeper, ) - // govHandler := govv1beta1.HandlerRoute{RouteKey: types.RouterKey, Handler: NewStablecoinProposalHandler(&k)} + govHandler := govv1beta1.HandlerRoute{RouteKey: types.RouterKey, Handler: NewVaultsProposalHandler(k)} - return ModuleOutputs{PsmKeeper: *k, Module: m} //GovHandler: govHandler} + return ModuleOutputs{PsmKeeper: *k, Module: m, GovHandler: govHandler} } diff --git a/x/vaults/module/proposal_handle.go b/x/vaults/module/proposal_handle.go new file mode 100644 index 0000000..b5cf877 --- /dev/null +++ b/x/vaults/module/proposal_handle.go @@ -0,0 +1,25 @@ +package vaults + +import ( + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + + "github.com/onomyprotocol/reserve/x/vaults/keeper" + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +func NewVaultsProposalHandler(k *keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch c := content.(type) { + case *types.ActiveCollateralProposal: + return k.ActiveCollateralAsset(ctx, c.ActiveCollateral.Denom, c.ActiveCollateral.MinCollateralRatio, c.ActiveCollateral.LiquidationRatio, c.ActiveCollateral.MaxDebt) + case *types.UpdatesCollateralProposal: + return k.UpdatesCollateralAsset(ctx, c.UpdatesCollateral.Denom, c.UpdatesCollateral.MinCollateralRatio, c.UpdatesCollateral.LiquidationRatio, c.UpdatesCollateral.MaxDebt) + default: + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s proposal content type: %T", types.ModuleName, c) + } + } +} diff --git a/x/vaults/types/codec.go b/x/vaults/types/codec.go index 2bc6880..b4e7a34 100644 --- a/x/vaults/types/codec.go +++ b/x/vaults/types/codec.go @@ -1,12 +1,19 @@ package types import ( + "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - // this line is used by starport scaffolding # 1 + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) +// RegisterLegacyAminoCodec registers all necessary param module types with a given LegacyAmino codec. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&ActiveCollateralProposal{}, "reserve/ActiveCollateralProposal", nil) + cdc.RegisterConcrete(&UpdatesCollateralProposal{}, "reserve/UpdatesCollateralProposal", nil) +} + func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { // this line is used by starport scaffolding # 3 @@ -21,4 +28,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgRepay{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &ActiveCollateralProposal{}, + &UpdatesCollateralProposal{}, + ) + } diff --git a/x/vaults/types/errors.go b/x/vaults/types/errors.go index ebf7cc0..046d86b 100644 --- a/x/vaults/types/errors.go +++ b/x/vaults/types/errors.go @@ -8,5 +8,7 @@ import ( // x/vaults module sentinel errors var ( - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrInvalidActiveCollateralProposal = sdkerrors.Register(ModuleName, 2, "invalid active collateral proposal") + ErrInvalidUpdatesCollateralProposal = sdkerrors.Register(ModuleName, 3, "invalid updates collateral proposal") ) diff --git a/x/vaults/types/expected_keepers.go b/x/vaults/types/expected_keepers.go index 8cb6e04..d319bb9 100644 --- a/x/vaults/types/expected_keepers.go +++ b/x/vaults/types/expected_keepers.go @@ -30,4 +30,5 @@ type BankKeeper interface { type OracleKeeper interface { GetPrice(ctx context.Context, denom string) math.LegacyDec + AddNewSymbolToBandOracleRequest(ctx context.Context, symbol string, oracleScriptId int64) error } diff --git a/x/vaults/types/keys.go b/x/vaults/types/keys.go index 6b0a95c..d1a4b04 100644 --- a/x/vaults/types/keys.go +++ b/x/vaults/types/keys.go @@ -3,12 +3,13 @@ package types import "cosmossdk.io/collections" const ( - ModuleName = "vaults" + ModuleName = "vaults" // StoreKey is the string store representation StoreKey = ModuleName - + ReserveModuleName = "reserve" + RouterKey = ModuleName ) var ( diff --git a/x/vaults/types/msgs.go b/x/vaults/types/msgs.go index 1a81363..1c8d245 100644 --- a/x/vaults/types/msgs.go +++ b/x/vaults/types/msgs.go @@ -1,9 +1,16 @@ package types import ( + sdkerrors "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) +const ( + ProposalTypeActiveCollateralProposal string = "ActiveCollateralProposal" + ProposalTypeUpdatesCollateralProposal string = "UpdatesCollateralProposal" +) + var ( Query_serviceDesc = _Query_serviceDesc Msg_serviceDesc = _Msg_serviceDesc @@ -55,3 +62,77 @@ func NewMsgClose(vaultId uint64, sender string) MsgClose { Sender: sender, } } + +func (m *ActiveCollateralProposal) GetDescription() string { + return " " +} + +func (m *ActiveCollateralProposal) GetTitle() string { + return " " +} + +func (m *ActiveCollateralProposal) ProposalRoute() string { + return RouterKey +} + +func (m *ActiveCollateralProposal) ProposalType() string { + return ProposalTypeActiveCollateralProposal +} + +func (m *ActiveCollateralProposal) ValidateBasic() error { + a := m.ActiveCollateral + if a.Denom == "" { + return sdkerrors.Wrap(ErrInvalidActiveCollateralProposal, "empty denom") + } + + if a.MinCollateralRatio.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidActiveCollateralProposal, "less than zero") + } + + if a.LiquidationRatio.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidActiveCollateralProposal, "less than zero") + } + + if a.MaxDebt.LT(math.ZeroInt()) { + return sdkerrors.Wrap(ErrInvalidActiveCollateralProposal, "less than zero") + } + + return nil +} + +func (m *UpdatesCollateralProposal) GetDescription() string { + return " " +} + +func (m *UpdatesCollateralProposal) GetTitle() string { + return " " +} + +func (m *UpdatesCollateralProposal) ProposalRoute() string { + return RouterKey +} + +func (m *UpdatesCollateralProposal) ProposalType() string { + return ProposalTypeActiveCollateralProposal +} + +func (m *UpdatesCollateralProposal) ValidateBasic() error { + a := m.UpdatesCollateral + if a.Denom == "" { + return sdkerrors.Wrap(ErrInvalidUpdatesCollateralProposal, "empty denom") + } + + if a.MinCollateralRatio.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidUpdatesCollateralProposal, "less than zero") + } + + if a.LiquidationRatio.LT(math.LegacyZeroDec()) { + return sdkerrors.Wrap(ErrInvalidUpdatesCollateralProposal, "less than zero") + } + + if a.MaxDebt.LT(math.ZeroInt()) { + return sdkerrors.Wrap(ErrInvalidUpdatesCollateralProposal, "less than zero") + } + + return nil +} diff --git a/x/vaults/types/proposal.pb.go b/x/vaults/types/proposal.pb.go new file mode 100644 index 0000000..723b706 --- /dev/null +++ b/x/vaults/types/proposal.pb.go @@ -0,0 +1,666 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reserve/vaults/proposal.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ActiveCollateralProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ActiveCollateral MsgActiveCollateral `protobuf:"bytes,3,opt,name=active_collateral,json=activeCollateral,proto3" json:"active_collateral"` +} + +func (m *ActiveCollateralProposal) Reset() { *m = ActiveCollateralProposal{} } +func (m *ActiveCollateralProposal) String() string { return proto.CompactTextString(m) } +func (*ActiveCollateralProposal) ProtoMessage() {} +func (*ActiveCollateralProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_784ca0e6565c75e5, []int{0} +} +func (m *ActiveCollateralProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ActiveCollateralProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ActiveCollateralProposal.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 *ActiveCollateralProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_ActiveCollateralProposal.Merge(m, src) +} +func (m *ActiveCollateralProposal) XXX_Size() int { + return m.Size() +} +func (m *ActiveCollateralProposal) XXX_DiscardUnknown() { + xxx_messageInfo_ActiveCollateralProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_ActiveCollateralProposal proto.InternalMessageInfo + +type UpdatesCollateralProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + UpdatesCollateral MsgUpdatesCollateral `protobuf:"bytes,3,opt,name=updates_collateral,json=updatesCollateral,proto3" json:"updates_collateral"` +} + +func (m *UpdatesCollateralProposal) Reset() { *m = UpdatesCollateralProposal{} } +func (m *UpdatesCollateralProposal) String() string { return proto.CompactTextString(m) } +func (*UpdatesCollateralProposal) ProtoMessage() {} +func (*UpdatesCollateralProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_784ca0e6565c75e5, []int{1} +} +func (m *UpdatesCollateralProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdatesCollateralProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdatesCollateralProposal.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 *UpdatesCollateralProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdatesCollateralProposal.Merge(m, src) +} +func (m *UpdatesCollateralProposal) XXX_Size() int { + return m.Size() +} +func (m *UpdatesCollateralProposal) XXX_DiscardUnknown() { + xxx_messageInfo_UpdatesCollateralProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdatesCollateralProposal proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ActiveCollateralProposal)(nil), "reserve.vaults.ActiveCollateralProposal") + proto.RegisterType((*UpdatesCollateralProposal)(nil), "reserve.vaults.UpdatesCollateralProposal") +} + +func init() { proto.RegisterFile("reserve/vaults/proposal.proto", fileDescriptor_784ca0e6565c75e5) } + +var fileDescriptor_784ca0e6565c75e5 = []byte{ + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0x4a, 0x2d, 0x4e, + 0x2d, 0x2a, 0x4b, 0xd5, 0x2f, 0x4b, 0x2c, 0xcd, 0x29, 0x29, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc8, + 0x2f, 0x4e, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xeb, 0x41, 0xa4, + 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x38, 0x9a, + 0x21, 0x25, 0x15, 0x50, 0x09, 0xc1, 0xc4, 0xdc, 0xcc, 0xbc, 0x7c, 0x7d, 0x30, 0x09, 0x15, 0x92, + 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x87, 0x18, 0x02, 0xe1, 0x40, 0xa4, 0x94, 0x3e, 0x33, + 0x72, 0x49, 0x38, 0x26, 0x97, 0x64, 0x96, 0xa5, 0x3a, 0xe7, 0xe7, 0xe4, 0x24, 0x96, 0xa4, 0x16, + 0x25, 0xe6, 0x04, 0x40, 0xdd, 0x23, 0x24, 0xc2, 0xc5, 0x5a, 0x92, 0x59, 0x92, 0x93, 0x2a, 0xc1, + 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe1, 0x08, 0x29, 0x70, 0x71, 0xa7, 0xa4, 0x16, 0x27, 0x17, + 0x65, 0x16, 0x94, 0x64, 0xe6, 0xe7, 0x49, 0x30, 0x81, 0xe5, 0x90, 0x85, 0x84, 0xc2, 0xb8, 0x04, + 0x13, 0xc1, 0x66, 0xc6, 0x27, 0xc3, 0x0d, 0x95, 0x60, 0x56, 0x60, 0xd4, 0xe0, 0x36, 0x52, 0xd6, + 0x43, 0xf5, 0x9d, 0x9e, 0x6f, 0x71, 0x3a, 0xba, 0xfd, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, + 0x09, 0x24, 0xa2, 0x89, 0x5b, 0xb9, 0x77, 0x2c, 0x90, 0x67, 0x38, 0xb5, 0x45, 0x57, 0x0a, 0xea, + 0x85, 0xf4, 0xfc, 0x32, 0xbd, 0x32, 0xc3, 0xa4, 0xd4, 0x92, 0x44, 0x43, 0x3d, 0xe7, 0xfc, 0xbc, + 0x92, 0xd4, 0xbc, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x14, 0x60, 0x41, 0x83, 0xcb, 0x63, 0x4a, 0x3f, + 0x18, 0xb9, 0x24, 0x43, 0x0b, 0x52, 0x12, 0x4b, 0x52, 0x8b, 0xa9, 0xe8, 0xed, 0x48, 0x2e, 0xa1, + 0x52, 0x88, 0xa1, 0x98, 0xfe, 0x56, 0xc1, 0xe2, 0x6f, 0x0c, 0x17, 0x40, 0x3d, 0x2e, 0x58, 0x8a, + 0x2e, 0x61, 0xe5, 0x41, 0x9c, 0xcf, 0x15, 0x61, 0x3e, 0xc7, 0xe9, 0x39, 0x27, 0xcf, 0x13, 0x8f, + 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, + 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, + 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcf, 0xcb, 0xcf, 0xad, 0x04, 0xa7, 0x90, 0xe4, 0xfc, 0x1c, 0x7d, + 0x98, 0xa9, 0x15, 0xf0, 0xc4, 0x56, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x56, 0x60, 0x0c, 0x08, + 0x00, 0x00, 0xff, 0xff, 0x62, 0xbd, 0x9e, 0x9d, 0xd0, 0x02, 0x00, 0x00, +} + +func (m *ActiveCollateralProposal) 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 *ActiveCollateralProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ActiveCollateralProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ActiveCollateral.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposal(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UpdatesCollateralProposal) 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 *UpdatesCollateralProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdatesCollateralProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.UpdatesCollateral.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposal(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintProposal(dAtA []byte, offset int, v uint64) int { + offset -= sovProposal(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ActiveCollateralProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = m.ActiveCollateral.Size() + n += 1 + l + sovProposal(uint64(l)) + return n +} + +func (m *UpdatesCollateralProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = m.UpdatesCollateral.Size() + n += 1 + l + sovProposal(uint64(l)) + return n +} + +func sovProposal(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozProposal(x uint64) (n int) { + return sovProposal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ActiveCollateralProposal) 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 ErrIntOverflowProposal + } + 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: ActiveCollateralProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ActiveCollateralProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + 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 ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + 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 ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveCollateral", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ActiveCollateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProposal(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProposal + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpdatesCollateralProposal) 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 ErrIntOverflowProposal + } + 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: UpdatesCollateralProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdatesCollateralProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + 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 ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + 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 ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatesCollateral", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.UpdatesCollateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProposal(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProposal + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipProposal(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProposal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProposal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProposal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthProposal + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProposal + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthProposal + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthProposal = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProposal = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProposal = fmt.Errorf("proto: unexpected end of group") +)