From 0d519e7a0e906fb8fa2f7bac9dbf243965a98806 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Thu, 13 Jul 2023 22:47:54 +0530 Subject: [PATCH 01/17] WIP: add liquidation params for inflation rate changes --- proto/umee/ugov/v1/events.proto | 6 + proto/umee/ugov/v1/genesis.proto | 5 + proto/umee/ugov/v1/query.proto | 14 + proto/umee/ugov/v1/tx.proto | 16 ++ proto/umee/ugov/v1/ugov.proto | 29 +++ x/ugov/client/cli/query.go | 24 ++ x/ugov/codec.go | 2 + x/ugov/events.pb.go | 211 +++++++++++++-- x/ugov/genesis.go | 9 +- x/ugov/genesis.pb.go | 92 +++++-- x/ugov/keeper/genesis.go | 9 +- x/ugov/keeper/keys.go | 5 +- x/ugov/keeper/msg_server.go | 16 ++ x/ugov/keeper/params.go | 13 + x/ugov/keeper/params_test.go | 17 ++ x/ugov/keeper/query_server.go | 14 +- x/ugov/liquidation_params.go | 37 +++ x/ugov/module/module.go | 3 +- x/ugov/msg.go | 32 ++- x/ugov/query.pb.go | 386 +++++++++++++++++++++++++-- x/ugov/query.pb.gw.go | 65 +++++ x/ugov/tx.pb.go | 431 ++++++++++++++++++++++++++++--- x/ugov/ugov.pb.go | 428 ++++++++++++++++++++++++++++++ 23 files changed, 1749 insertions(+), 115 deletions(-) create mode 100644 proto/umee/ugov/v1/ugov.proto create mode 100644 x/ugov/liquidation_params.go create mode 100644 x/ugov/ugov.pb.go diff --git a/proto/umee/ugov/v1/events.proto b/proto/umee/ugov/v1/events.proto index 4da45564e9..c4e4bdaf58 100644 --- a/proto/umee/ugov/v1/events.proto +++ b/proto/umee/ugov/v1/events.proto @@ -4,6 +4,7 @@ package umee.ugov.v1; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; +import "umee/ugov/v1/ugov.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; option (gogoproto.goproto_getters_all) = false; @@ -17,3 +18,8 @@ message EventMinGasPrice { message EventEmergencyGroup { string emergency_group = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } + +// EventLiquidationParams is emitted when GovUpdateLiquidationParams is correctly executed. +message EventLiquidationParams { + LiquidationParams liquidation_params = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto index 8f7684c1b6..f45b2e1b91 100644 --- a/proto/umee/ugov/v1/genesis.proto +++ b/proto/umee/ugov/v1/genesis.proto @@ -3,7 +3,9 @@ package umee.ugov.v1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; +import "umee/ugov/v1/ugov.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; option (gogoproto.goproto_getters_all) = false; @@ -14,4 +16,7 @@ message GenesisState { // Emergency Group address string emergency_group = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // LiquidationParams is params for new liquidation inflation rate params for staking denoms + LiquidationParams liquidation_params = 3 [(gogoproto.nullable) = false]; } diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto index 685593805c..39d826df70 100644 --- a/proto/umee/ugov/v1/query.proto +++ b/proto/umee/ugov/v1/query.proto @@ -5,6 +5,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "umee/ugov/v1/ugov.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; @@ -21,6 +22,11 @@ service Query { rpc EmergencyGroup(QueryEmergencyGroup) returns (QueryEmergencyGroupResponse) { option (google.api.http).get = "/umee/ugov/v1/emergency-group"; } + + // LiquidationParams + rpc LiquidationParams(QueryLiquidationParams) returns (QueryLiquidationParamsResponse) { + option (google.api.http).get = "/umee/ugov/v1/liquidation-params"; + } } // QueryMinGasPrice is a request type. @@ -38,3 +44,11 @@ message QueryEmergencyGroup {} message QueryEmergencyGroupResponse { string emergency_group = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } + +// QueryLiquidationParams request type. +message QueryLiquidationParams {} + +// QueryLiquidationParamsResponse response type. +message QueryLiquidationParamsResponse { + LiquidationParams liquidation_params = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/umee/ugov/v1/tx.proto b/proto/umee/ugov/v1/tx.proto index 993f985522..512841087e 100644 --- a/proto/umee/ugov/v1/tx.proto +++ b/proto/umee/ugov/v1/tx.proto @@ -5,6 +5,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; +import "umee/ugov/v1/ugov.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; @@ -17,6 +18,9 @@ service Msg { // GovSetEmergencyGroup sets emergency group address. rpc GovSetEmergencyGroup(MsgGovSetEmergencyGroup) returns (MsgGovSetEmergencyGroupResponse); + + // GovUpdateLiquidationParams sets new liquidation params for inflation + rpc GovUpdateLiquidationParams(MsgGovUpdateLiquidationParams) returns (GovUpdateLiquidationParamsResponse); } // MsgGovUpdateMinGasPrice request type. @@ -43,3 +47,15 @@ message MsgGovSetEmergencyGroup { // MsgGovSetEmergencyGroupResponse response type. message MsgGovSetEmergencyGroupResponse {}; + +// MsgGovUpdateLiquidationParams request type. +message MsgGovUpdateLiquidationParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + LiquidationParams liquidation_params = 2 [(gogoproto.nullable) = false]; +} + +// GovUpdateLiquidationParamsResponse response type. +message GovUpdateLiquidationParamsResponse {} \ No newline at end of file diff --git a/proto/umee/ugov/v1/ugov.proto b/proto/umee/ugov/v1/ugov.proto new file mode 100644 index 0000000000..c060e0956b --- /dev/null +++ b/proto/umee/ugov/v1/ugov.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package umee.ugov.v1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "google/protobuf/duration.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/umee-network/umee/v5/x/ugov"; +option (gogoproto.goproto_getters_all) = false; + +// LiquidationParams +message LiquidationParams { + // max_supply is the maximum supply for liquidation. + cosmos.base.v1beta1.Coin max_supply = 1 [(gogoproto.nullable) = false]; + // inflation_cycle_duration is duration for changing the inflation rates for liquidation. + google.protobuf.Duration inflation_cycle_duration = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "inflation_cycle_duration,omitempty", + (gogoproto.moretags) = "yaml:\"inflation_cycle_duration\"" + ]; + // inflation_reduction_rate is reduction rate for inflation every inflation cycle. + string inflation_reduction_rate = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/x/ugov/client/cli/query.go b/x/ugov/client/cli/query.go index 7e4255b37b..9f3882924a 100644 --- a/x/ugov/client/cli/query.go +++ b/x/ugov/client/cli/query.go @@ -22,6 +22,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand( QueryMinGasPrice(), + QueryLiquidationParams(), ) return cmd @@ -49,3 +50,26 @@ func QueryMinGasPrice() *cobra.Command { return cmd } + +// QueryLiquidationParams create the Msg/QueryLiquidationParams CLI. +func QueryLiquidationParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "liquidation-params", + Args: cobra.NoArgs, + Short: "Query the liquidation params", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := ugov.NewQueryClient(clientCtx) + resp, err := queryClient.LiquidationParams(cmd.Context(), &ugov.QueryLiquidationParams{}) + return cli.PrintOrErr(resp, err, clientCtx) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ugov/codec.go b/x/ugov/codec.go index c578c4d2c5..c5a9d96407 100644 --- a/x/ugov/codec.go +++ b/x/ugov/codec.go @@ -31,6 +31,7 @@ func init() { func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgGovUpdateMinGasPrice{}, proto.MessageName(&MsgGovUpdateMinGasPrice{}), nil) cdc.RegisterConcrete(&MsgGovSetEmergencyGroup{}, "umee/ugov/MsgGovSetEmergencyGroup", nil) + cdc.RegisterConcrete(&MsgGovUpdateLiquidationParams{}, "umee/ugov/MsgGovUpdateLiquidationParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -38,6 +39,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { (*sdk.Msg)(nil), &MsgGovUpdateMinGasPrice{}, &MsgGovSetEmergencyGroup{}, + &MsgGovUpdateLiquidationParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/ugov/events.pb.go b/x/ugov/events.pb.go index a2ed607097..3f8f94589c 100644 --- a/x/ugov/events.pb.go +++ b/x/ugov/events.pb.go @@ -101,35 +101,77 @@ func (m *EventEmergencyGroup) XXX_DiscardUnknown() { var xxx_messageInfo_EventEmergencyGroup proto.InternalMessageInfo +// EventLiquidationParams is emitted when GovUpdateLiquidationParams is correctly executed. +type EventLiquidationParams struct { + LiquidationParams LiquidationParams `protobuf:"bytes,1,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` +} + +func (m *EventLiquidationParams) Reset() { *m = EventLiquidationParams{} } +func (m *EventLiquidationParams) String() string { return proto.CompactTextString(m) } +func (*EventLiquidationParams) ProtoMessage() {} +func (*EventLiquidationParams) Descriptor() ([]byte, []int) { + return fileDescriptor_0885cdf0808da4ea, []int{2} +} +func (m *EventLiquidationParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventLiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventLiquidationParams.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 *EventLiquidationParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventLiquidationParams.Merge(m, src) +} +func (m *EventLiquidationParams) XXX_Size() int { + return m.Size() +} +func (m *EventLiquidationParams) XXX_DiscardUnknown() { + xxx_messageInfo_EventLiquidationParams.DiscardUnknown(m) +} + +var xxx_messageInfo_EventLiquidationParams proto.InternalMessageInfo + func init() { proto.RegisterType((*EventMinGasPrice)(nil), "umee.ugov.v1.EventMinGasPrice") proto.RegisterType((*EventEmergencyGroup)(nil), "umee.ugov.v1.EventEmergencyGroup") + proto.RegisterType((*EventLiquidationParams)(nil), "umee.ugov.v1.EventLiquidationParams") } func init() { proto.RegisterFile("umee/ugov/v1/events.proto", fileDescriptor_0885cdf0808da4ea) } var fileDescriptor_0885cdf0808da4ea = []byte{ - // 308 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0x41, 0x4a, 0xc3, 0x40, - 0x18, 0x85, 0x13, 0x14, 0xc1, 0x58, 0xaa, 0xd4, 0x2e, 0xda, 0x22, 0x63, 0xe9, 0x42, 0xba, 0xe9, - 0x0c, 0x51, 0x3c, 0x40, 0x6b, 0x4b, 0xdd, 0x08, 0x52, 0x37, 0x22, 0x42, 0x49, 0xa6, 0x3f, 0xe3, - 0x20, 0x99, 0xbf, 0xcc, 0x24, 0xa3, 0xde, 0xc2, 0xc3, 0x78, 0x88, 0x2e, 0x8b, 0x2b, 0x57, 0xa2, - 0xcd, 0x45, 0x64, 0x92, 0x88, 0xb8, 0xfb, 0xdf, 0x7b, 0x3f, 0xdf, 0x83, 0x17, 0xb4, 0xb3, 0x04, - 0x80, 0x65, 0x02, 0x2d, 0xb3, 0x21, 0x03,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x64, 0xfa, 0x90, 0xc5, 0x94, - 0x63, 0xc2, 0xdc, 0x7e, 0x03, 0x05, 0xe9, 0x13, 0xea, 0xc7, 0x42, 0x30, 0x7b, 0xce, 0x9e, 0x8b, - 0xb1, 0xe3, 0x9d, 0x62, 0x84, 0xb3, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x47, 0x3b, 0x1f, - 0x80, 0x01, 0x00, 0x00, + // 365 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xc1, 0x6e, 0xda, 0x30, + 0x1c, 0xc6, 0x13, 0x6d, 0x9a, 0xb4, 0x80, 0xd8, 0x96, 0xa1, 0x0d, 0xd0, 0x64, 0x10, 0x87, 0x89, + 0x0b, 0xb6, 0xc2, 0xb4, 0x07, 0x80, 0x82, 0xe8, 0xa1, 0x95, 0x10, 0xed, 0xa1, 0xaa, 0x2a, 0x45, + 0x49, 0xf8, 0xcb, 0xb5, 0x4a, 0x6c, 0x6a, 0x27, 0x69, 0xfb, 0x16, 0x7d, 0x98, 0x3e, 0x04, 0x47, + 0xd4, 0x53, 0x4f, 0x55, 0x0b, 0x2f, 0x52, 0xd9, 0x49, 0x45, 0x11, 0x37, 0xff, 0xbf, 0xcf, 0xfe, + 0x7e, 0x7f, 0x7f, 0x4e, 0x3d, 0x8d, 0x01, 0x48, 0x4a, 0x45, 0x46, 0x32, 0x8f, 0x40, 0x06, 0x3c, + 0x51, 0x78, 0x21, 0x45, 0x22, 0xdc, 0xb2, 0xb6, 0xb0, 0xb6, 0x70, 0xe6, 0x35, 0x50, 0x24, 0x54, + 0x2c, 0x14, 0x09, 0x03, 0x05, 0x24, 0xf3, 0x42, 0x48, 0x02, 0x8f, 0x44, 0x82, 0xf1, 0xfc, 0x76, + 0xa3, 0x9e, 0xfb, 0xbe, 0x99, 0x48, 0x3e, 0x14, 0x56, 0x95, 0x0a, 0x2a, 0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0xac, 0xf3, 0xbf, 0x94, 0x25, 0x97, 0x69, 0x88, 0x23, 0x11, 0x13, 0x4d, 0xe8, 0x72, 0x48, + 0x6e, 0x84, 0xbc, 0x32, 0x03, 0xc9, 0xfe, 0x93, 0x5b, 0xd3, 0x79, 0xf8, 0xc5, 0x94, 0xfe, 0xef, + 0x2d, 0x00, 0x00, 0xff, 0xff, 0x99, 0x00, 0x8c, 0x2f, 0x09, 0x02, 0x00, 0x00, } func (m *EventMinGasPrice) Marshal() (dAtA []byte, err error) { @@ -199,6 +241,39 @@ func (m *EventEmergencyGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventLiquidationParams) 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 *EventLiquidationParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventLiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -238,6 +313,17 @@ func (m *EventEmergencyGroup) Size() (n int) { return n } +func (m *EventLiquidationParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.LiquidationParams.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -410,6 +496,89 @@ func (m *EventEmergencyGroup) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventLiquidationParams) 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 ErrIntOverflowEvents + } + 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: EventLiquidationParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventLiquidationParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ugov/genesis.go b/x/ugov/genesis.go index cde8f144e9..83ae7a6753 100644 --- a/x/ugov/genesis.go +++ b/x/ugov/genesis.go @@ -7,10 +7,15 @@ import ( // DefaultGenesis creates a default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - MinGasPrice: coin.UmeeDec("0.1"), + MinGasPrice: coin.UmeeDec("0.1"), + LiquidationParams: DefaultLiquidationParams(), } } func (gs *GenesisState) Validate() error { - return gs.MinGasPrice.Validate() + if err := gs.MinGasPrice.Validate(); err != nil { + return err + } + + return gs.LiquidationParams.Validate() } diff --git a/x/ugov/genesis.pb.go b/x/ugov/genesis.pb.go index fd19fa093e..595c703d08 100644 --- a/x/ugov/genesis.pb.go +++ b/x/ugov/genesis.pb.go @@ -9,6 +9,7 @@ import ( types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" @@ -30,6 +31,8 @@ type GenesisState struct { MinGasPrice types.DecCoin `protobuf:"bytes,1,opt,name=min_gas_price,json=minGasPrice,proto3" json:"min_gas_price"` // Emergency Group address EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` + // LiquidationParams is params for new liquidation inflation rate params for staking denoms + LiquidationParams LiquidationParams `protobuf:"bytes,3,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -72,26 +75,30 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/genesis.proto", fileDescriptor_82f39cd8e8ede8c7) } var fileDescriptor_82f39cd8e8ede8c7 = []byte{ - // 296 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0x41, 0x4a, 0x03, 0x31, - 0x14, 0x86, 0x27, 0x22, 0x82, 0xd3, 0xaa, 0x50, 0xba, 0xa8, 0x45, 0x62, 0x71, 0x21, 0xdd, 0x34, - 0x61, 0x14, 0x0f, 0xd0, 0x5a, 0xec, 0x56, 0xda, 0x9d, 0x9b, 0x32, 0x33,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f8, 0x5f, 0x98, 0xf9, 0xfc, 0x64, 0xba, 0xf9, 0xa5, 0xd1, 0x66, 0x47, 0xc9, 0x76, 0x47, 0xc9, - 0xcf, 0x8e, 0x92, 0xb7, 0x8a, 0x46, 0xdb, 0x8a, 0x46, 0x5f, 0x15, 0x8d, 0x1e, 0x2e, 0x85, 0x74, - 0x8f, 0x45, 0xc6, 0x72, 0x54, 0xdc, 0xdf, 0x68, 0xa4, 0xc1, 0x3d, 0xa3, 0x79, 0xaa, 0x07, 0x5e, - 0xde, 0xf0, 0x97, 0xfa, 0xa2, 0xd9, 0x41, 0xbd, 0xe8, 0xf5, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xfc, 0x94, 0x81, 0x77, 0x65, 0x01, 0x00, 0x00, + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x4f, 0x4e, 0xe3, 0x30, + 0x14, 0xc6, 0x93, 0x99, 0xd1, 0x48, 0x93, 0x76, 0x40, 0x44, 0x95, 0x08, 0x15, 0x72, 0x2b, 0x16, + 0xa8, 0x9b, 0xda, 0x0a, 0x88, 0x03, 0xb4, 0x54, 0x74, 0xc3, 0xa2, 0x6a, 0x59, 0xb1, 0x89, 0x9c, + 0xc4, 0x18, 0x8b, 0xc6, 0x2e, 0xb6, 0x13, 0xe0, 0x16, 0x1c, 0x86, 0x43, 0x74, 0x59, 0xb1, 0x62, + 0x85, 0xa0, 0x3d, 0x00, 0x57, 0x40, 0x76, 0x52, 0xfe, 0x88, 0x5d, 0x9e, 0x7e, 0xdf, 0xfb, 0xf2, + 0xf3, 0xf3, 0x9a, 0x79, 0x46, 0x08, 0xca, 0xa9, 0x28, 0x50, 0x11, 0x22, 0x4a, 0x38, 0x51, 0x4c, + 0xc1, 0x99, 0x14, 0x5a, 0xf8, 0x75, 0xc3, 0xa0, 0x61, 0xb0, 0x08, 0x9b, 0x0d, 0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, 0xe9, 0x0f, 0x30, 0x98, 0xbf, 0x02, 0x67, 0xbe, 0x04, 0xee, 0x62, 0x09, + 0xdc, 0x97, 0x25, 0x70, 0xef, 0x57, 0xc0, 0x59, 0xac, 0x80, 0xf3, 0xb4, 0x02, 0xce, 0xf9, 0x3e, + 0x65, 0xfa, 0x32, 0x8f, 0x61, 0x22, 0x32, 0x64, 0xfe, 0xd0, 0xe5, 0x44, 0xdf, 0x08, 0x79, 0x65, + 0x07, 0x54, 0x1c, 0xa1, 0x5b, 0x7b, 0xbd, 0xf8, 0xaf, 0x3d, 0xdf, 0xe1, 0x7b, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x72, 0x20, 0x86, 0x2e, 0xf4, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -114,6 +121,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a if len(m.EmergencyGroup) > 0 { i -= len(m.EmergencyGroup) copy(dAtA[i:], m.EmergencyGroup) @@ -157,6 +174,8 @@ func (m *GenesisState) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + l = m.LiquidationParams.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -260,6 +279,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } m.EmergencyGroup = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ugov/keeper/genesis.go b/x/ugov/keeper/genesis.go index 55c51c2fcd..c5cbbcee2b 100644 --- a/x/ugov/keeper/genesis.go +++ b/x/ugov/keeper/genesis.go @@ -4,10 +4,15 @@ import "github.com/umee-network/umee/v5/x/ugov" func (k Keeper) ExportGenesis() *ugov.GenesisState { return &ugov.GenesisState{ - MinGasPrice: k.MinGasPrice(), + MinGasPrice: k.MinGasPrice(), + LiquidationParams: k.LiquidationParams(), } } func (k Keeper) InitGenesis(gs *ugov.GenesisState) error { - return k.SetMinGasPrice(gs.MinGasPrice) + if err := k.SetMinGasPrice(gs.MinGasPrice); err != nil { + return err + } + + return k.SetLiquidationParams(gs.LiquidationParams) } diff --git a/x/ugov/keeper/keys.go b/x/ugov/keeper/keys.go index 7e613b48de..7a2533067a 100644 --- a/x/ugov/keeper/keys.go +++ b/x/ugov/keeper/keys.go @@ -2,6 +2,7 @@ package keeper // store key prefixes var ( - keyMinGasPrice = []byte{0x01} - keyEmergencyGroup = []byte{0x02} + keyMinGasPrice = []byte{0x01} + keyEmergencyGroup = []byte{0x02} + KeyLiquidationParams = []byte{0x03} ) diff --git a/x/ugov/keeper/msg_server.go b/x/ugov/keeper/msg_server.go index de8c8a1b02..2ef62b5e61 100644 --- a/x/ugov/keeper/msg_server.go +++ b/x/ugov/keeper/msg_server.go @@ -53,3 +53,19 @@ func (m msgServer) GovSetEmergencyGroup(ctx context.Context, msg *ugov.MsgGovSet return &ugov.MsgGovSetEmergencyGroupResponse{}, nil } + +// GovUpdateLiquidationParams implements ugov.MsgServer. +func (m msgServer) GovUpdateLiquidationParams(ctx context.Context, msg *ugov.MsgGovUpdateLiquidationParams) ( + *ugov.GovUpdateLiquidationParamsResponse, error) { + sdkCtx, err := sdkutil.StartMsg(ctx, msg) + if err != nil { + return nil, err + } + + err = m.kb.Keeper(&sdkCtx).SetLiquidationParams(msg.LiquidationParams) + if err != nil { + return nil, err + } + + return &ugov.GovUpdateLiquidationParamsResponse{}, nil +} diff --git a/x/ugov/keeper/params.go b/x/ugov/keeper/params.go index 181ac9f95a..4647fdc767 100644 --- a/x/ugov/keeper/params.go +++ b/x/ugov/keeper/params.go @@ -5,6 +5,7 @@ import ( "github.com/umee-network/umee/v5/util/coin" "github.com/umee-network/umee/v5/util/store" + "github.com/umee-network/umee/v5/x/ugov" ) func (k Keeper) SetMinGasPrice(p sdk.DecCoin) error { @@ -26,3 +27,15 @@ func (k Keeper) SetEmergencyGroup(p sdk.AccAddress) { func (k Keeper) EmergencyGroup() sdk.AccAddress { return store.GetAddress(k.store, keyEmergencyGroup) } + +func (k Keeper) SetLiquidationParams(lp ugov.LiquidationParams) error { + return store.SetValue(k.store, KeyLiquidationParams, &lp, "liquidation_params") +} + +func (k Keeper) LiquidationParams() ugov.LiquidationParams { + lp := store.GetValue[*ugov.LiquidationParams](k.store, KeyLiquidationParams, "liquidation_params") + if lp == nil { + return ugov.LiquidationParams{} + } + return *lp +} diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index 6c14659489..01f147d2f4 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -6,8 +6,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + appparams "github.com/umee-network/umee/v5/app/params" "github.com/umee-network/umee/v5/tests/accs" "github.com/umee-network/umee/v5/util/coin" + "github.com/umee-network/umee/v5/x/ugov" ) func TestGasPrice(t *testing.T) { @@ -34,3 +36,18 @@ func TestEmergencyGroup(t *testing.T) { k.SetEmergencyGroup(accs.Alice) require.Equal(k.EmergencyGroup(), accs.Alice) } + +func TestLiquidationParams(t *testing.T) { + t.Parallel() + require := require.New(t) + k := initKeeper(t) + + require.Equal(k.LiquidationParams(), ugov.LiquidationParams{}, + "when nothing is set, empty address should be returned") + + dlp := ugov.DefaultLiquidationParams() + k.SetLiquidationParams(dlp) + rlp := k.LiquidationParams() + require.Equal(rlp, dlp) + require.Equal(rlp.MaxSupply.GetDenom(), appparams.BondDenom) +} diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index 8d3a5788a7..4e1c90c1fb 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -21,14 +21,18 @@ func NewQuerier(kb Builder) Querier { // MinTxFees returns minimum transaction fees. func (q Querier) MinGasPrice(ctx context.Context, _ *ugov.QueryMinGasPrice) (*ugov.QueryMinGasPriceResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - return &ugov.QueryMinGasPriceResponse{MinGasPrice: q.Keeper(&sdkCtx).MinGasPrice()}, - nil + return &ugov.QueryMinGasPriceResponse{MinGasPrice: q.Keeper(&sdkCtx).MinGasPrice()}, nil } func (q Querier) EmergencyGroup(ctx context.Context, _ *ugov.QueryEmergencyGroup, ) (*ugov.QueryEmergencyGroupResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - return &ugov.QueryEmergencyGroupResponse{ - EmergencyGroup: q.Keeper(&sdkCtx).EmergencyGroup().String()}, - nil + return &ugov.QueryEmergencyGroupResponse{EmergencyGroup: q.Keeper(&sdkCtx).EmergencyGroup().String()}, nil +} + +// LiquidationParams returns liquidation params +func (q Querier) LiquidationParams(ctx context.Context, _ *ugov.QueryLiquidationParams) ( + *ugov.QueryLiquidationParamsResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return &ugov.QueryLiquidationParamsResponse{LiquidationParams: q.Keeper(&sdkCtx).LiquidationParams()}, nil } diff --git a/x/ugov/liquidation_params.go b/x/ugov/liquidation_params.go new file mode 100644 index 0000000000..f90304ab5e --- /dev/null +++ b/x/ugov/liquidation_params.go @@ -0,0 +1,37 @@ +package ugov + +import ( + fmt "fmt" + time "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + appparams "github.com/umee-network/umee/v5/app/params" +) + +var ( + DefaultMaxSupply = sdk.NewCoin(appparams.BondDenom, sdk.NewInt(12_000000000)) + DefaultInflationCycleDuration = time.Second * time.Duration(60*60*24*365) + DefaultInflationReductionRate = sdk.MustNewDecFromStr("0.01") +) + +func DefaultLiquidationParams() LiquidationParams { + return LiquidationParams{ + MaxSupply: DefaultMaxSupply, + InflationCycleDuration: DefaultInflationCycleDuration, + InflationReductionRate: DefaultInflationReductionRate, + } +} + +func (lp LiquidationParams) Validate() error { + if lp.MaxSupply.Amount.LT(math.NewInt(0)) { + return fmt.Errorf("%s must be not negative: %s", "max_supply", lp.MaxSupply.Amount.String()) + } + + if lp.InflationReductionRate.LT(sdk.ZeroDec()) { + return fmt.Errorf("%s must be not negative: %s", "inflation reduction rate ", lp.InflationReductionRate.String()) + } + + return nil +} diff --git a/x/ugov/module/module.go b/x/ugov/module/module.go index 53a23b3365..f0f4291076 100644 --- a/x/ugov/module/module.go +++ b/x/ugov/module/module.go @@ -104,8 +104,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { var genState ugov.GenesisState cdc.MustUnmarshalJSON(data, &genState) - util.Panic( - am.kb.Keeper(&ctx).InitGenesis(&genState)) + util.Panic(am.kb.Keeper(&ctx).InitGenesis(&genState)) return []abci.ValidatorUpdate{} } diff --git a/x/ugov/msg.go b/x/ugov/msg.go index 2b2c913b94..26510f4b1e 100644 --- a/x/ugov/msg.go +++ b/x/ugov/msg.go @@ -10,12 +10,10 @@ import ( ) var ( - _, _ sdk.Msg = &MsgGovUpdateMinGasPrice{}, - &MsgGovSetEmergencyGroup{} + _, _, _ sdk.Msg = &MsgGovUpdateMinGasPrice{}, &MsgGovSetEmergencyGroup{}, &MsgGovUpdateLiquidationParams{} // amino - _, _ legacytx.LegacyMsg = &MsgGovUpdateMinGasPrice{}, - &MsgGovSetEmergencyGroup{} + _, _, _ legacytx.LegacyMsg = &MsgGovUpdateMinGasPrice{}, &MsgGovSetEmergencyGroup{}, &MsgGovUpdateLiquidationParams{} ) // ValidateBasic implements Msg @@ -71,3 +69,29 @@ func (msg MsgGovSetEmergencyGroup) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) } func (msg MsgGovSetEmergencyGroup) Type() string { return sdk.MsgTypeURL(&msg) } + +// +// MsgGovUpdateLiquidationParams +// + +// Msg interface implementation + +func (msg *MsgGovUpdateLiquidationParams) ValidateBasic() error { + if err := checkers.IsGovAuthority(msg.Authority); err != nil { + return err + } + return msg.LiquidationParams.Validate() +} + +// GetSignBytes implements Msg +func (msg *MsgGovUpdateLiquidationParams) GetSigners() []sdk.AccAddress { + return checkers.Signers(msg.Authority) +} + +// LegacyMsg.Type implementations +func (msg MsgGovUpdateLiquidationParams) Route() string { return "" } + +func (msg MsgGovUpdateLiquidationParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} +func (msg MsgGovUpdateLiquidationParams) Type() string { return sdk.MsgTypeURL(&msg) } diff --git a/x/ugov/query.pb.go b/x/ugov/query.pb.go index c1238cff22..ed92641835 100644 --- a/x/ugov/query.pb.go +++ b/x/ugov/query.pb.go @@ -181,44 +181,127 @@ func (m *QueryEmergencyGroupResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEmergencyGroupResponse proto.InternalMessageInfo +// QueryLiquidationParams request type. +type QueryLiquidationParams struct { +} + +func (m *QueryLiquidationParams) Reset() { *m = QueryLiquidationParams{} } +func (m *QueryLiquidationParams) String() string { return proto.CompactTextString(m) } +func (*QueryLiquidationParams) ProtoMessage() {} +func (*QueryLiquidationParams) Descriptor() ([]byte, []int) { + return fileDescriptor_25fa04679024a47d, []int{4} +} +func (m *QueryLiquidationParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLiquidationParams.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 *QueryLiquidationParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLiquidationParams.Merge(m, src) +} +func (m *QueryLiquidationParams) XXX_Size() int { + return m.Size() +} +func (m *QueryLiquidationParams) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLiquidationParams.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLiquidationParams proto.InternalMessageInfo + +// QueryLiquidationParamsResponse response type. +type QueryLiquidationParamsResponse struct { + LiquidationParams LiquidationParams `protobuf:"bytes,1,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` +} + +func (m *QueryLiquidationParamsResponse) Reset() { *m = QueryLiquidationParamsResponse{} } +func (m *QueryLiquidationParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLiquidationParamsResponse) ProtoMessage() {} +func (*QueryLiquidationParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_25fa04679024a47d, []int{5} +} +func (m *QueryLiquidationParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLiquidationParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLiquidationParamsResponse.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 *QueryLiquidationParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLiquidationParamsResponse.Merge(m, src) +} +func (m *QueryLiquidationParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLiquidationParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLiquidationParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLiquidationParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryMinGasPrice)(nil), "umee.ugov.v1.QueryMinGasPrice") proto.RegisterType((*QueryMinGasPriceResponse)(nil), "umee.ugov.v1.QueryMinGasPriceResponse") proto.RegisterType((*QueryEmergencyGroup)(nil), "umee.ugov.v1.QueryEmergencyGroup") proto.RegisterType((*QueryEmergencyGroupResponse)(nil), "umee.ugov.v1.QueryEmergencyGroupResponse") + proto.RegisterType((*QueryLiquidationParams)(nil), "umee.ugov.v1.QueryLiquidationParams") + proto.RegisterType((*QueryLiquidationParamsResponse)(nil), "umee.ugov.v1.QueryLiquidationParamsResponse") } func init() { proto.RegisterFile("umee/ugov/v1/query.proto", fileDescriptor_25fa04679024a47d) } var fileDescriptor_25fa04679024a47d = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x6e, 0xd4, 0x30, - 0x10, 0x86, 0x93, 0x0a, 0x90, 0xf0, 0x42, 0x41, 0xa6, 0x48, 0xcb, 0xb6, 0x75, 0x61, 0x11, 0x15, - 0x1c, 0x62, 0x2b, 0x45, 0x3c, 0x40, 0x97, 0x42, 0x4f, 0x48, 0xb0, 0xdc, 0xb8, 0x2c, 0x4e, 0x3a, - 0x32, 0x16, 0xc4, 0x13, 0xec, 0x24, 0x50, 0x8e, 0x48, 0x9c, 0xb8, 0x20, 0xf1, 0x2a, 0x3c, 0xc4, - 0x1e, 0x2b, 0xb8, 0x70, 0x42, 0xb0, 0xcb, 0x83, 0xa0, 0x38, 0xe9, 0x6a, 0x53, 0x55, 0xf4, 0x16, - 0xcf, 0x3f, 0xf9, 0xff, 0xcf, 0x33, 0x26, 0xfd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, 0x5a, 0x84, 0xdd, - 0x83, 0x03, 0x0b, 0xce, 0x3d, 0x2f, 0xac, 0x36, 0x6a, 0xbc, 0x0a, 0x1d, 0xab, 0x9d, 0xcf, 0x2b, - 0xe4, 0xbc, 0x8f, 0xa0, 0x1f, 0x48, 0x6f, 0xe9, 0x86, 0x94, 0xf1, 0xe5, 0x3d, 0xf0, 0x93, 0x13, - 0x18, 0x6c, 0xff, 0x5f, 0x3f, 0x66, 0x1c, 0xde, 0xfe, 0xf8, 0xe3, 0xef, 0xd7, 0x95, 0x4d, 0xba, - 0x2e, 0x3a, 0x1b, 0xcf, 0xb4, 0x89, 0x94, 0x74, 0x91, 0x9f, 0x1a, 0xfd, 0x14, 0x92, 0xd5, 0xee, - 0x1d, 0xe9, 0xad, 0x53, 0xfc, 0xbb, 0x2d, 0x83, 0x7b, 0x67, 0xb6, 0x2c, 0x28, 0xee, 0x78, 0x8a, - 0x2d, 0xba, 0xd9, 0xa5, 0x58, 0x0c, 0x23, 0xf2, 0xd3, 0x1b, 0xed, 0x4d, 0xff, 0xb0, 0x60, 0x3a, - 0x63, 0xe1, 0xd1, 0x8c, 0x85, 0xbf, 0x67, 0x2c, 0xfc, 0x32, 0x67, 0xc1, 0xd1, 0x9c, 0x05, 0x3f, - 0xe7, 0x2c, 0x78, 0xb1, 0xad, 0x74, 0xf1, 0xaa, 0x4c, 0x78, 0x8a, 0x99, 0xb7, 0x89, 0x0c, 0x14, - 0xef, 0xd0, 0xbe, 0x6e, 0x3c, 0xab, 0x07, 0xe2, 0xbd, 0x37, 0x4e, 0x2e, 0xf8, 0xb7, 0x74, 0xff, - 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x09, 0xc1, 0x74, 0x1a, 0xe4, 0x02, 0x00, 0x00, + // 515 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x6f, 0xd3, 0x30, + 0x18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1, 0x9e, 0xc9, + 0x11, 0xbe, 0xb7, 0xc0, 0x52, 0x7d, 0xeb, 0xf0, 0xfa, 0x82, 0xf9, 0xf5, 0x16, 0xe7, 0xf6, 0x7f, + 0x5b, 0x2a, 0x8a, 0x5b, 0x86, 0xa2, 0x05, 0xd7, 0xeb, 0x14, 0x55, 0x3c, 0x9e, 0xc9, 0x13, 0x7e, + 0xb4, 0xc0, 0xf2, 0xdc, 0xf2, 0xe0, 0xcd, 0x05, 0x3e, 0x73, 0x5d, 0xce, 0x9d, 0xe3, 0x74, 0x55, + 0x40, 0x5b, 0x06, 0xc8, 0x85, 0x1b, 0x75, 0xa0, 0xa9, 0x80, 0xbc, 0x22, 0xe1, 0xce, 0xee, 0xf0, + 0x17, 0x6a, 0x0c, 0x47, 0xc8, 0x3a, 0x1a, 0x21, 0xeb, 0xe7, 0x08, 0x59, 0x1f, 0xc6, 0xa8, 0x71, + 0x34, 0x46, 0x8d, 0xef, 0x63, 0xd4, 0x78, 0xbe, 0xc9, 0x78, 0xf2, 0x32, 0x0d, 0xfc, 0x50, 0x46, + 0x66, 0x92, 0x27, 0x68, 0xf2, 0x5a, 0xaa, 0x57, 0xc5, 0xd8, 0xec, 0x1e, 0x7e, 0x63, 0x66, 0x07, + 0x67, 0xcc, 0x1f, 0x77, 0xf7, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0x1a, 0xee, 0xd4, 0x23, + 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -237,6 +320,8 @@ type QueryClient interface { MinGasPrice(ctx context.Context, in *QueryMinGasPrice, opts ...grpc.CallOption) (*QueryMinGasPriceResponse, error) // EmergencyGroup returns emergency group address EmergencyGroup(ctx context.Context, in *QueryEmergencyGroup, opts ...grpc.CallOption) (*QueryEmergencyGroupResponse, error) + // LiquidationParams + LiquidationParams(ctx context.Context, in *QueryLiquidationParams, opts ...grpc.CallOption) (*QueryLiquidationParamsResponse, error) } type queryClient struct { @@ -265,12 +350,23 @@ func (c *queryClient) EmergencyGroup(ctx context.Context, in *QueryEmergencyGrou return out, nil } +func (c *queryClient) LiquidationParams(ctx context.Context, in *QueryLiquidationParams, opts ...grpc.CallOption) (*QueryLiquidationParamsResponse, error) { + out := new(QueryLiquidationParamsResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/LiquidationParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // MinGasPrice returns minimum transaction fees. MinGasPrice(context.Context, *QueryMinGasPrice) (*QueryMinGasPriceResponse, error) // EmergencyGroup returns emergency group address EmergencyGroup(context.Context, *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) + // LiquidationParams + LiquidationParams(context.Context, *QueryLiquidationParams) (*QueryLiquidationParamsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -283,6 +379,9 @@ func (*UnimplementedQueryServer) MinGasPrice(ctx context.Context, req *QueryMinG func (*UnimplementedQueryServer) EmergencyGroup(ctx context.Context, req *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EmergencyGroup not implemented") } +func (*UnimplementedQueryServer) LiquidationParams(ctx context.Context, req *QueryLiquidationParams) (*QueryLiquidationParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LiquidationParams not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -324,6 +423,24 @@ func _Query_EmergencyGroup_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Query_LiquidationParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLiquidationParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LiquidationParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/umee.ugov.v1.Query/LiquidationParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LiquidationParams(ctx, req.(*QueryLiquidationParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "umee.ugov.v1.Query", HandlerType: (*QueryServer)(nil), @@ -336,6 +453,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "EmergencyGroup", Handler: _Query_EmergencyGroup_Handler, }, + { + MethodName: "LiquidationParams", + Handler: _Query_LiquidationParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "umee/ugov/v1/query.proto", @@ -450,6 +571,62 @@ func (m *QueryEmergencyGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *QueryLiquidationParams) 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 *QueryLiquidationParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryLiquidationParamsResponse) 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 *QueryLiquidationParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLiquidationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -503,6 +680,26 @@ func (m *QueryEmergencyGroupResponse) Size() (n int) { return n } +func (m *QueryLiquidationParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryLiquidationParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.LiquidationParams.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -774,6 +971,139 @@ func (m *QueryEmergencyGroupResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryLiquidationParams) 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 ErrIntOverflowQuery + } + 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: QueryLiquidationParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLiquidationParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLiquidationParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryLiquidationParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLiquidationParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ugov/query.pb.gw.go b/x/ugov/query.pb.gw.go index c541046c98..bd4d5f658c 100644 --- a/x/ugov/query.pb.gw.go +++ b/x/ugov/query.pb.gw.go @@ -69,6 +69,24 @@ func local_request_Query_EmergencyGroup_0(ctx context.Context, marshaler runtime } +func request_Query_LiquidationParams_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLiquidationParams + var metadata runtime.ServerMetadata + + msg, err := client.LiquidationParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LiquidationParams_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLiquidationParams + var metadata runtime.ServerMetadata + + msg, err := server.LiquidationParams(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -121,6 +139,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_LiquidationParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LiquidationParams_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LiquidationParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -202,6 +243,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_LiquidationParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_LiquidationParams_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LiquidationParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -209,10 +270,14 @@ var ( pattern_Query_MinGasPrice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "min-gas-price"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_EmergencyGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "emergency-group"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LiquidationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "liquidation-params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_MinGasPrice_0 = runtime.ForwardResponseMessage forward_Query_EmergencyGroup_0 = runtime.ForwardResponseMessage + + forward_Query_LiquidationParams_0 = runtime.ForwardResponseMessage ) diff --git a/x/ugov/tx.pb.go b/x/ugov/tx.pb.go index 88de6e818b..660cd9a37c 100644 --- a/x/ugov/tx.pb.go +++ b/x/ugov/tx.pb.go @@ -184,45 +184,128 @@ func (m *MsgGovSetEmergencyGroupResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGovSetEmergencyGroupResponse proto.InternalMessageInfo +// MsgGovUpdateLiquidationParams request type. +type MsgGovUpdateLiquidationParams struct { + // authority must be the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + LiquidationParams LiquidationParams `protobuf:"bytes,2,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` +} + +func (m *MsgGovUpdateLiquidationParams) Reset() { *m = MsgGovUpdateLiquidationParams{} } +func (m *MsgGovUpdateLiquidationParams) String() string { return proto.CompactTextString(m) } +func (*MsgGovUpdateLiquidationParams) ProtoMessage() {} +func (*MsgGovUpdateLiquidationParams) Descriptor() ([]byte, []int) { + return fileDescriptor_9ffc07de1c6ee91b, []int{4} +} +func (m *MsgGovUpdateLiquidationParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgGovUpdateLiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgGovUpdateLiquidationParams.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 *MsgGovUpdateLiquidationParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgGovUpdateLiquidationParams.Merge(m, src) +} +func (m *MsgGovUpdateLiquidationParams) XXX_Size() int { + return m.Size() +} +func (m *MsgGovUpdateLiquidationParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgGovUpdateLiquidationParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgGovUpdateLiquidationParams proto.InternalMessageInfo + +// GovUpdateLiquidationParamsResponse response type. +type GovUpdateLiquidationParamsResponse struct { +} + +func (m *GovUpdateLiquidationParamsResponse) Reset() { *m = GovUpdateLiquidationParamsResponse{} } +func (m *GovUpdateLiquidationParamsResponse) String() string { return proto.CompactTextString(m) } +func (*GovUpdateLiquidationParamsResponse) ProtoMessage() {} +func (*GovUpdateLiquidationParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ffc07de1c6ee91b, []int{5} +} +func (m *GovUpdateLiquidationParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GovUpdateLiquidationParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GovUpdateLiquidationParamsResponse.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 *GovUpdateLiquidationParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GovUpdateLiquidationParamsResponse.Merge(m, src) +} +func (m *GovUpdateLiquidationParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *GovUpdateLiquidationParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GovUpdateLiquidationParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GovUpdateLiquidationParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgGovUpdateMinGasPrice)(nil), "umee.ugov.v1.MsgGovUpdateMinGasPrice") proto.RegisterType((*MsgGovUpdateMinGasPriceResponse)(nil), "umee.ugov.v1.MsgGovUpdateMinGasPriceResponse") proto.RegisterType((*MsgGovSetEmergencyGroup)(nil), "umee.ugov.v1.MsgGovSetEmergencyGroup") proto.RegisterType((*MsgGovSetEmergencyGroupResponse)(nil), "umee.ugov.v1.MsgGovSetEmergencyGroupResponse") + proto.RegisterType((*MsgGovUpdateLiquidationParams)(nil), "umee.ugov.v1.MsgGovUpdateLiquidationParams") + proto.RegisterType((*GovUpdateLiquidationParamsResponse)(nil), "umee.ugov.v1.GovUpdateLiquidationParamsResponse") } func init() { proto.RegisterFile("umee/ugov/v1/tx.proto", fileDescriptor_9ffc07de1c6ee91b) } var fileDescriptor_9ffc07de1c6ee91b = []byte{ - // 434 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0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 0x04, 0xd3, 0x39, 0x41, 0x17, 0x73, 0x82, 0xbe, 0xcf, 0x09, 0x7a, 0xbb, 0x20, 0xc1, 0xc5, - 0x82, 0x04, 0x5f, 0x17, 0x24, 0x78, 0x71, 0x8f, 0x0b, 0x77, 0x9a, 0xc5, 0x34, 0xd1, 0x92, 0x79, - 0xd9, 0xae, 0x02, 0xf7, 0x5a, 0x9b, 0x97, 0x45, 0xc0, 0xf2, 0x87, 0xec, 0xac, 0x78, 0x4a, 0xf1, - 0xd5, 0x62, 0x9b, 0x1f, 0xfc, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x5e, 0xa9, 0xbb, 0x4f, 0x5e, 0x03, - 0x00, 0x00, + // 512 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x3f, 0x6f, 0x13, 0x31, + 0x1c, 0xbd, 0x2b, 0x08, 0xa9, 0x2e, 0x14, 0x71, 0x0a, 0x6a, 0x38, 0xc1, 0xa5, 0x44, 0x80, 0x2a, + 0x50, 0x6c, 0x52, 0x04, 0x43, 0xb7, 0x86, 0x42, 0x16, 0x22, 0x55, 0x29, 0x2c, 0x2c, 0x91, 0x73, + 0xb1, 0x5c, 0x8b, 0xd8, 0x3e, 0x6c, 0xdf, 0xd1, 0x8a, 0x8d, 0x4f, 0xc0, 0xc8, 0xc8, 0xc0, 0x8a, + 0xc4, 0xc0, 0xca, 0x9e, 0xb1, 0x62, 0x62, 0xaa, 0x20, 0x19, 0xf8, 0x1a, 0xe8, 0x2e, 0x4e, 0xd3, + 0x70, 0xb9, 0x82, 0xb2, 0x9d, 0xfd, 0x9e, 0xdf, 0x9f, 0xfb, 0x59, 0x06, 0x57, 0x63, 0x4e, 0x08, + 0x8a, 0xa9, 0x4c, 0x50, 0x52, 0x47, 0xe6, 0x00, 0x46, 0x4a, 0x1a, 0xe9, 0x5d, 0x4c, 0xb7, 0x61, + 0xba, 0x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x10, + 0xf3, 0x46, 0xaa, 0x57, 0xd9, 0x02, 0x25, 0x0f, 0xd1, 0x41, 0xf6, 0x5e, 0x74, 0x2f, 0x64, 0x0f, + 0xc6, 0x83, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xbb, 0x8d, 0x2c, 0xda, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -241,6 +324,8 @@ type MsgClient interface { GovUpdateMinGasPrice(ctx context.Context, in *MsgGovUpdateMinGasPrice, opts ...grpc.CallOption) (*MsgGovUpdateMinGasPriceResponse, error) // GovSetEmergencyGroup sets emergency group address. GovSetEmergencyGroup(ctx context.Context, in *MsgGovSetEmergencyGroup, opts ...grpc.CallOption) (*MsgGovSetEmergencyGroupResponse, error) + // GovUpdateLiquidationParams sets new liquidation params for inflation + GovUpdateLiquidationParams(ctx context.Context, in *MsgGovUpdateLiquidationParams, opts ...grpc.CallOption) (*GovUpdateLiquidationParamsResponse, error) } type msgClient struct { @@ -269,12 +354,23 @@ func (c *msgClient) GovSetEmergencyGroup(ctx context.Context, in *MsgGovSetEmerg return out, nil } +func (c *msgClient) GovUpdateLiquidationParams(ctx context.Context, in *MsgGovUpdateLiquidationParams, opts ...grpc.CallOption) (*GovUpdateLiquidationParamsResponse, error) { + out := new(GovUpdateLiquidationParamsResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Msg/GovUpdateLiquidationParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // GovUpdateMinGasPrice sets protocol controlled tx min fees. GovUpdateMinGasPrice(context.Context, *MsgGovUpdateMinGasPrice) (*MsgGovUpdateMinGasPriceResponse, error) // GovSetEmergencyGroup sets emergency group address. GovSetEmergencyGroup(context.Context, *MsgGovSetEmergencyGroup) (*MsgGovSetEmergencyGroupResponse, error) + // GovUpdateLiquidationParams sets new liquidation params for inflation + GovUpdateLiquidationParams(context.Context, *MsgGovUpdateLiquidationParams) (*GovUpdateLiquidationParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -287,6 +383,9 @@ func (*UnimplementedMsgServer) GovUpdateMinGasPrice(ctx context.Context, req *Ms func (*UnimplementedMsgServer) GovSetEmergencyGroup(ctx context.Context, req *MsgGovSetEmergencyGroup) (*MsgGovSetEmergencyGroupResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GovSetEmergencyGroup not implemented") } +func (*UnimplementedMsgServer) GovUpdateLiquidationParams(ctx context.Context, req *MsgGovUpdateLiquidationParams) (*GovUpdateLiquidationParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovUpdateLiquidationParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -328,6 +427,24 @@ func _Msg_GovSetEmergencyGroup_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Msg_GovUpdateLiquidationParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgGovUpdateLiquidationParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).GovUpdateLiquidationParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/umee.ugov.v1.Msg/GovUpdateLiquidationParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).GovUpdateLiquidationParams(ctx, req.(*MsgGovUpdateLiquidationParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "umee.ugov.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -340,6 +457,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "GovSetEmergencyGroup", Handler: _Msg_GovSetEmergencyGroup_Handler, }, + { + MethodName: "GovUpdateLiquidationParams", + Handler: _Msg_GovUpdateLiquidationParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "umee/ugov/v1/tx.proto", @@ -468,6 +589,69 @@ func (m *MsgGovSetEmergencyGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } +func (m *MsgGovUpdateLiquidationParams) 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 *MsgGovUpdateLiquidationParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgGovUpdateLiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GovUpdateLiquidationParamsResponse) 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 *GovUpdateLiquidationParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovUpdateLiquidationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -529,6 +713,30 @@ func (m *MsgGovSetEmergencyGroupResponse) Size() (n int) { return n } +func (m *MsgGovUpdateLiquidationParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.LiquidationParams.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *GovUpdateLiquidationParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -864,6 +1072,171 @@ func (m *MsgGovSetEmergencyGroupResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgGovUpdateLiquidationParams) 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: MsgGovUpdateLiquidationParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgGovUpdateLiquidationParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationParams", 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.LiquidationParams.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 *GovUpdateLiquidationParamsResponse) 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: GovUpdateLiquidationParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GovUpdateLiquidationParamsResponse: 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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ugov/ugov.pb.go b/x/ugov/ugov.pb.go new file mode 100644 index 0000000000..d9248ac6cc --- /dev/null +++ b/x/ugov/ugov.pb.go @@ -0,0 +1,428 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: umee/ugov/v1/ugov.proto + +package ugov + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/durationpb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// LiquidationParams +type LiquidationParams struct { + // max_supply is the maximum supply for liquidation denom. + MaxSupply types.Coin `protobuf:"bytes,1,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply"` + // inflation_cycle_duration is duration for changing the inflation rates for liquidation. + InflationCycleDuration time.Duration `protobuf:"bytes,2,opt,name=inflation_cycle_duration,json=inflationCycleDuration,proto3,stdduration" json:"inflation_cycle_duration,omitempty" yaml:"inflation_cycle_duration"` + // inflation_reduction_rate is reduction rate for inflation every inflation cycle. + InflationReductionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=inflation_reduction_rate,json=inflationReductionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation_reduction_rate"` +} + +func (m *LiquidationParams) Reset() { *m = LiquidationParams{} } +func (m *LiquidationParams) String() string { return proto.CompactTextString(m) } +func (*LiquidationParams) ProtoMessage() {} +func (*LiquidationParams) Descriptor() ([]byte, []int) { + return fileDescriptor_b75ef21394c8e122, []int{0} +} +func (m *LiquidationParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LiquidationParams.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 *LiquidationParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_LiquidationParams.Merge(m, src) +} +func (m *LiquidationParams) XXX_Size() int { + return m.Size() +} +func (m *LiquidationParams) XXX_DiscardUnknown() { + xxx_messageInfo_LiquidationParams.DiscardUnknown(m) +} + +var xxx_messageInfo_LiquidationParams proto.InternalMessageInfo + +func init() { + proto.RegisterType((*LiquidationParams)(nil), "umee.ugov.v1.LiquidationParams") +} + +func init() { proto.RegisterFile("umee/ugov/v1/ugov.proto", fileDescriptor_b75ef21394c8e122) } + +var fileDescriptor_b75ef21394c8e122 = []byte{ + // 401 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xb1, 0xae, 0xd3, 0x30, + 0x14, 0x86, 0xe3, 0x0b, 0x42, 0xba, 0x81, 0x85, 0x08, 0x41, 0xee, 0x1d, 0x9c, 0xaa, 0x03, 0xea, + 0x40, 0x6d, 0x05, 0xc4, 0x82, 0x10, 0x43, 0x9a, 0x91, 0x01, 0xc2, 0xc6, 0x12, 0x39, 0x8e, 0x1b, + 0xac, 0xc6, 0x71, 0x48, 0xec, 0xd0, 0xbc, 0x05, 0x23, 0x4f, 0xc0, 0x13, 0xf0, 0x10, 0x1d, 0x2b, + 0x26, 0xc4, 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de, 0xfc, 0x5c, 0xc4, 0x23, 0x29, 0xb8, 0x62, 0xa2, + 0x54, 0xed, 0x9f, 0xce, 0xf3, 0x5a, 0x22, 0xf2, 0x67, 0x67, 0x7b, 0xe7, 0x9f, 0x7e, 0x78, 0x20, + 0xba, 0xff, 0x5f, 0x5e, 0xf5, 0xea, 0x34, 0xca, 0x69, 0x4e, 0x39, 0x2b, 0x96, 0x6a, 0x3a, 0xdc, + 0x88, 0x62, 0xee, 0x8d, 0x19, 0x58, 0x5c, 0x06, 0xcf, 0x7b, 0x98, 0xef, 0x9d, 0xf7, 0x30, 0xe3, + 0xea, 0x9d, 0x4e, 0x10, 0x95, 0x62, 0xdc, 0xe0, 0x78, 0x2c, 0xeb, 0x74, 0x83, 0x55, 0x5b, 0xb2, + 0x1a, 0x85, 0x8c, 0x7e, 0xfd, 0xb2, 0xb4, 0xc7, 0x3d, 0x85, 0x8c, 0x9e, 0xcc, 0x8d, 0xa6, 0xf0, + 0x88, 0x28, 0x16, 0x84, 0xbb, 0x5f, 0xd0, 0xda, 0x1d, 0x20, 0xd8, 0x1f, 0x20, 0xf8, 0x79, 0x80, + 0xe0, 0xe3, 0x11, 0x5a, 0xfb, 0x23, 0xb4, 0xbe, 0x1d, 0xa1, 0xf5, 0xf6, 0x74, 0x56, 0xff, 0x3d, + 0x96, 0x05, 0x53, 0x1f, 0x64, 0xb5, 0x31, 0x05, 0x6e, 0x9e, 0xe2, 0xad, 0xf9, 0x41, 0xc9, 0x2d, + 0xb3, 0xbb, 0x27, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x60, 0x78, 0x0f, 0xaa, 0x5d, 0x02, 0x00, + 0x00, +} + +func (m *LiquidationParams) 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 *LiquidationParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.InflationReductionRate.Size() + i -= size + if _, err := m.InflationReductionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintUgov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.InflationCycleDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.InflationCycleDuration):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintUgov(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x12 + { + size, err := m.MaxSupply.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintUgov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintUgov(dAtA []byte, offset int, v uint64) int { + offset -= sovUgov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *LiquidationParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MaxSupply.Size() + n += 1 + l + sovUgov(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.InflationCycleDuration) + n += 1 + l + sovUgov(uint64(l)) + l = m.InflationReductionRate.Size() + n += 1 + l + sovUgov(uint64(l)) + return n +} + +func sovUgov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozUgov(x uint64) (n int) { + return sovUgov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LiquidationParams) 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 ErrIntOverflowUgov + } + 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: LiquidationParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LiquidationParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowUgov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthUgov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthUgov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowUgov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthUgov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthUgov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.InflationCycleDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationReductionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowUgov + } + 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 ErrInvalidLengthUgov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthUgov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationReductionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipUgov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthUgov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipUgov(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, ErrIntOverflowUgov + } + 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, ErrIntOverflowUgov + } + 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, ErrIntOverflowUgov + } + 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, ErrInvalidLengthUgov + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupUgov + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthUgov + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthUgov = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowUgov = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupUgov = fmt.Errorf("proto: unexpected end of group") +) From 50880a8537c99066bf2470d86101724bc3673463 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Fri, 14 Jul 2023 20:22:09 +0530 Subject: [PATCH 02/17] add new token emission implementation --- app/app.go | 5 +- proto/umee/ugov/v1/genesis.proto | 3 + proto/umee/ugov/v1/query.proto | 17 +- x/mint/module/abci.go | 110 +++++++++ x/mint/module/module.go | 42 ++++ x/ugov/client/cli/query.go | 24 ++ x/ugov/genesis.pb.go | 101 ++++++-- x/ugov/keeper/genesis.go | 18 +- x/ugov/keeper/keys.go | 7 +- x/ugov/keeper/params.go | 10 + x/ugov/keeper/params_test.go | 21 ++ x/ugov/keeper/query_server.go | 11 + x/ugov/liquidation_params.go | 6 +- x/ugov/query.pb.go | 408 ++++++++++++++++++++++++++++--- x/ugov/query.pb.gw.go | 65 +++++ x/ugov/ugov.pb.go | 2 +- 16 files changed, 779 insertions(+), 71 deletions(-) create mode 100644 x/mint/module/abci.go create mode 100644 x/mint/module/module.go diff --git a/app/app.go b/app/app.go index 96bf1f145e..850fca4387 100644 --- a/app/app.go +++ b/app/app.go @@ -71,7 +71,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" - "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/nft" @@ -143,6 +142,8 @@ import ( uibcoracle "github.com/umee-network/umee/v5/x/uibc/oracle" uibcquota "github.com/umee-network/umee/v5/x/uibc/quota" uibcquotakeeper "github.com/umee-network/umee/v5/x/uibc/quota/keeper" + + umint "github.com/umee-network/umee/v5/x/mint/module" ) var ( @@ -667,7 +668,7 @@ func New( crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil), + umint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, app.UGovKeeperB), // need to dereference StakingKeeper because x/distribution uses interface casting :( // TODO: in the next SDK version we can remove the dereference slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, *app.StakingKeeper), diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto index f45b2e1b91..8468cbb220 100644 --- a/proto/umee/ugov/v1/genesis.proto +++ b/proto/umee/ugov/v1/genesis.proto @@ -3,6 +3,7 @@ package umee.ugov.v1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "umee/ugov/v1/ugov.proto"; @@ -19,4 +20,6 @@ message GenesisState { // LiquidationParams is params for new liquidation inflation rate params for staking denoms LiquidationParams liquidation_params = 3 [(gogoproto.nullable) = false]; + // Unix timestamp when the inflation cycle is started + google.protobuf.Timestamp inflation_cycle_start_time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto index 39d826df70..8f1d98f4d0 100644 --- a/proto/umee/ugov/v1/query.proto +++ b/proto/umee/ugov/v1/query.proto @@ -5,6 +5,8 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + import "umee/ugov/v1/ugov.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; @@ -27,6 +29,11 @@ service Query { rpc LiquidationParams(QueryLiquidationParams) returns (QueryLiquidationParamsResponse) { option (google.api.http).get = "/umee/ugov/v1/liquidation-params"; } + + // InflationCycleStartTime returns when inflation cycle is started + rpc InflationCycleStartTime(QueryInflationCycleStartTime) returns (QueryInflationCycleStartTimeResponse) { + option (google.api.http).get = "/umee/ugov/v1/inflation-cycle"; + } } // QueryMinGasPrice is a request type. @@ -51,4 +58,12 @@ message QueryLiquidationParams {} // QueryLiquidationParamsResponse response type. message QueryLiquidationParamsResponse { LiquidationParams liquidation_params = 1 [(gogoproto.nullable) = false]; -} \ No newline at end of file +} + +// QueryInflationCycleStartTime request type. +message QueryInflationCycleStartTime {} + +// QueryInflationCycleStartTimeResponse response type. +message QueryInflationCycleStartTimeResponse { + google.protobuf.Timestamp inflation_cycle_start_time = 1 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; +} diff --git a/x/mint/module/abci.go b/x/mint/module/abci.go new file mode 100644 index 0000000000..b46f9e07b3 --- /dev/null +++ b/x/mint/module/abci.go @@ -0,0 +1,110 @@ +package mint + +import ( + "time" + + "github.com/cosmos/cosmos-sdk/telemetry" + sdk "github.com/cosmos/cosmos-sdk/types" + mk "github.com/cosmos/cosmos-sdk/x/mint/keeper" + "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/umee-network/umee/v5/util" + ugov "github.com/umee-network/umee/v5/x/ugov" + ugovkeeper "github.com/umee-network/umee/v5/x/ugov/keeper" +) + +// BeginBlock implements BeginBlock for the x/mint module. +func BeginBlock(ctx sdk.Context, ugovKeeper ugovkeeper.Keeper, mintKeeper mk.Keeper) { + defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) + // liquidation params + lp := ugovKeeper.LiquidationParams() + // mint module params + mintParams := mintKeeper.GetParams(ctx) + + totalStakingSupply := mintKeeper.StakingTokenSupply(ctx) + if totalStakingSupply.GTE(lp.MaxSupply.Amount) { + // supply is already reached the maximum amount, so no more minting the staking token + return + } + + // fetch stored minter & params + minter := mintKeeper.GetMinter(ctx) + bondedRatio := mintKeeper.BondedRatio(ctx) + // recalculate inflation rate + minter.Inflation = InflationCalculationFn(ctx, ugovKeeper, mintKeeper, lp, mintParams, bondedRatio, minter.Inflation) + minter.AnnualProvisions = minter.NextAnnualProvisions(mintParams, totalStakingSupply) + mintKeeper.SetMinter(ctx, minter) + + // mint coins, update supply + mintedCoin := minter.BlockProvision(mintParams) + mintedCoins := sdk.NewCoins(mintedCoin) + + err := mintKeeper.MintCoins(ctx, mintedCoins) + util.Panic(err) + + // send the minted coins to the fee collector account + err = mintKeeper.AddCollectedFees(ctx, mintedCoins) + util.Panic(err) + + if mintedCoin.Amount.IsInt64() { + defer telemetry.ModuleSetGauge(types.ModuleName, float32(mintedCoin.Amount.Int64()), "minted_tokens") + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeMint, + sdk.NewAttribute(types.AttributeKeyBondedRatio, bondedRatio.String()), + sdk.NewAttribute(types.AttributeKeyInflation, minter.Inflation.String()), + sdk.NewAttribute(types.AttributeKeyAnnualProvisions, minter.AnnualProvisions.String()), + sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), + ), + ) +} + +func InflationCalculationFn(ctx sdk.Context, ugovKeeper ugovkeeper.Keeper, mintKeeper mk.Keeper, + lp ugov.LiquidationParams, params types.Params, bondedRatio sdk.Dec, currentInflation sdk.Dec) sdk.Dec { + + // inflation cycle is completed , so we need to update the inflation max and min rate + icst, err := ugovKeeper.GetInflationCycleStartTime() + util.Panic(err) + + // TODO: needs to verify when to update this cycle time like in migrations or in this BeginBlock ? + // first time start time is zero + if !icst.IsZero() && ctx.BlockTime().After(icst.Add(lp.InflationCycleDuration)) { + params.InflationMax = params.InflationMax.Mul(sdk.OneDec().Sub(lp.InflationReductionRate)) + params.InflationMin = params.InflationMin.Mul(sdk.OneDec().Sub(lp.InflationReductionRate)) + + // update the changed inflation min and max rates + mintKeeper.SetParams(ctx, params) + + // update the executed time of inflation cycle + err := ugovKeeper.SetInflationCycleStartTime(ctx.BlockTime()) + util.Panic(err) + ctx.Logger().Info("inflation rates are updated", + "inflation_max", params.InflationMax, "inflation_min", params.InflationMin, + "inflation_cycle_start_time", ctx.BlockTime().String(), + ) + } + + // The target annual inflation rate is recalculated for each previsions cycle. The + // inflation is also subject to a rate change (positive or negative) depending on + // the distance from the desired ratio (67%). The maximum rate change possible is + // defined to be 13% per year, however the annual inflation is capped as between + // 7% and 20%. + + // (1 - bondedRatio/GoalBonded) * InflationRateChange + inflationRateChangePerYear := sdk.OneDec(). + Sub(bondedRatio.Quo(params.GoalBonded)). + Mul(params.InflationRateChange) + inflationRateChange := inflationRateChangePerYear.Quo(sdk.NewDec(int64(params.BlocksPerYear))) + + // adjust the new annual inflation for this next cycle + inflation := currentInflation.Add(inflationRateChange) // note inflationRateChange may be negative + if inflation.GT(params.InflationMax) { + inflation = params.InflationMax + } + if inflation.LT(params.InflationMin) { + inflation = params.InflationMin + } + + return inflation +} diff --git a/x/mint/module/module.go b/x/mint/module/module.go new file mode 100644 index 0000000000..31960824ea --- /dev/null +++ b/x/mint/module/module.go @@ -0,0 +1,42 @@ +package mint + +import ( + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/mint" + mk "github.com/cosmos/cosmos-sdk/x/mint/keeper" + "github.com/cosmos/cosmos-sdk/x/mint/types" + abci "github.com/tendermint/tendermint/abci/types" + + ugovkeeper "github.com/umee-network/umee/v5/x/ugov/keeper" +) + +var ( + _ module.AppModule = AppModule{} +) + +type AppModule struct { + mint.AppModule + mintKeeper mk.Keeper + ugovKB ugovkeeper.Builder +} + +func NewAppModule(cdc codec.Codec, keeper mk.Keeper, ak types.AccountKeeper, ugovkb ugovkeeper.Builder, +) AppModule { + return AppModule{ + AppModule: mint.NewAppModule(cdc, keeper, ak, nil), + mintKeeper: keeper, + ugovKB: ugovkb, + } +} + +// Name implements module.AppModule. +func (AppModule) Name() string { + return types.ModuleName +} + +// BeginBlock executes all ABCI BeginBlock logic respective to the x/uibc module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + BeginBlock(ctx, am.ugovKB.Keeper(&ctx), am.mintKeeper) +} diff --git a/x/ugov/client/cli/query.go b/x/ugov/client/cli/query.go index 9f3882924a..85aea566bf 100644 --- a/x/ugov/client/cli/query.go +++ b/x/ugov/client/cli/query.go @@ -23,6 +23,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand( QueryMinGasPrice(), QueryLiquidationParams(), + QueryInflationCyleStartedTime(), ) return cmd @@ -73,3 +74,26 @@ func QueryLiquidationParams() *cobra.Command { return cmd } + +// QueryInflationCyleStartedTime create the Msg/QueryInflationCyleStartedTime CLI. +func QueryInflationCyleStartedTime() *cobra.Command { + cmd := &cobra.Command{ + Use: "inflation-cycle-start-time", + Args: cobra.NoArgs, + Short: "Query the When the Inflation Cycle is Started", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := ugov.NewQueryClient(clientCtx) + resp, err := queryClient.InflationCycleStartTime(cmd.Context(), &ugov.QueryInflationCycleStartTime{}) + return cli.PrintOrErr(resp, err, clientCtx) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ugov/genesis.pb.go b/x/ugov/genesis.pb.go index 595c703d08..68de94ea67 100644 --- a/x/ugov/genesis.pb.go +++ b/x/ugov/genesis.pb.go @@ -9,16 +9,20 @@ import ( types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -33,6 +37,8 @@ type GenesisState struct { EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` // LiquidationParams is params for new liquidation inflation rate params for staking denoms LiquidationParams LiquidationParams `protobuf:"bytes,3,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` + // Unix timestamp when the inflation cycle is started + InflationCycleStartTime time.Time `protobuf:"bytes,4,opt,name=inflation_cycle_start_time,json=inflationCycleStartTime,proto3,stdtime" json:"inflation_cycle_start_time"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -75,30 +81,34 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/genesis.proto", fileDescriptor_82f39cd8e8ede8c7) } var fileDescriptor_82f39cd8e8ede8c7 = []byte{ - // 362 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x4f, 0x4e, 0xe3, 0x30, - 0x14, 0xc6, 0x93, 0x99, 0xd1, 0x48, 0x93, 0x76, 0x40, 0x44, 0x95, 0x08, 0x15, 0x72, 0x2b, 0x16, - 0xa8, 0x9b, 0xda, 0x0a, 0x88, 0x03, 0xb4, 0x54, 0x74, 0xc3, 0xa2, 0x6a, 0x59, 0xb1, 0x89, 0x9c, - 0xc4, 0x18, 0x8b, 0xc6, 0x2e, 0xb6, 0x13, 0xe0, 0x16, 0x1c, 0x86, 0x43, 0x74, 0x59, 0xb1, 0x62, - 0x85, 0xa0, 0x3d, 0x00, 0x57, 0x40, 0x76, 0x52, 0xfe, 0x88, 0x5d, 0x9e, 0x7e, 0xdf, 0xfb, 0xf2, - 0xf3, 0xf3, 0x9a, 0x79, 0x46, 0x08, 0xca, 0xa9, 0x28, 0x50, 0x11, 0x22, 0x4a, 0x38, 0x51, 0x4c, - 0xc1, 0x99, 0x14, 0x5a, 0xf8, 0x75, 0xc3, 0xa0, 0x61, 0xb0, 0x08, 0x9b, 0x0d, 0x2a, 0xa8, 0xb0, - 0x00, 0x99, 0xaf, 0x32, 0xd3, 0x04, 0x89, 0x50, 0x99, 0x50, 0x28, 0xc6, 0x8a, 0xa0, 0x22, 0x8c, - 0x89, 0xc6, 0x21, 0x4a, 0x04, 0xe3, 0x6b, 0x4e, 0x85, 0xa0, 0x53, 0x82, 0xec, 0x14, 0xe7, 0x17, - 0x28, 0xcd, 0x25, 0xd6, 0x4c, 0xac, 0xf9, 0x4e, 0xb9, 0x1f, 0x95, 0xc5, 0xe5, 0x50, 0xa1, 0xed, - 0x6f, 0x6a, 0x56, 0xc3, 0x82, 0xbd, 0x37, 0xd7, 0xab, 0x0f, 0x4b, 0xd3, 0x89, 0xc6, 0x9a, 0xf8, - 0x27, 0xde, 0xff, 0x8c, 0xf1, 0x88, 0x62, 0xd3, 0xc3, 0x12, 0x12, 0xb8, 0x6d, 0xb7, 0x53, 0x3b, - 0xd8, 0x85, 0x55, 0x9f, 0x91, 0x83, 0x95, 0x1c, 0x1c, 0x90, 0xe4, 0x58, 0x30, 0xde, 0xff, 0x33, - 0x7f, 0x6e, 0x39, 0xe3, 0x5a, 0xc6, 0xf8, 0x10, 0xab, 0x91, 0x59, 0xf3, 0x7b, 0xde, 0x26, 0xc9, - 0x88, 0xa4, 0x84, 0x27, 0x77, 0x11, 0x95, 0x22, 0x9f, 0x05, 0xbf, 0xda, 0x6e, 0xe7, 0x5f, 0x3f, - 0x78, 0x7c, 0xe8, 0x36, 0xaa, 0xb2, 0x5e, 0x9a, 0x4a, 0xa2, 0xd4, 0x44, 0x4b, 0xc6, 0xe9, 0x78, - 0xe3, 0x63, 0x61, 0x68, 0xf2, 0xfe, 0x99, 0xe7, 0x4f, 0xd9, 0x75, 0xce, 0x52, 0xfb, 0xc8, 0x68, - 0x86, 0x25, 0xce, 0x54, 0xf0, 0xdb, 0xfa, 0xb4, 0xe0, 0xd7, 0x83, 0xc2, 0xd3, 0xcf, 0xdc, 0xc8, - 0xc6, 0x2a, 0xa5, 0xad, 0xe9, 0x0f, 0x30, 0x98, 0xbf, 0x02, 0x67, 0xbe, 0x04, 0xee, 0x62, 0x09, - 0xdc, 0x97, 0x25, 0x70, 0xef, 0x57, 0xc0, 0x59, 0xac, 0x80, 0xf3, 0xb4, 0x02, 0xce, 0xf9, 0x3e, - 0x65, 0xfa, 0x32, 0x8f, 0x61, 0x22, 0x32, 0x64, 0xfe, 0xd0, 0xe5, 0x44, 0xdf, 0x08, 0x79, 0x65, - 0x07, 0x54, 0x1c, 0xa1, 0x5b, 0x7b, 0xbd, 0xf8, 0xaf, 0x3d, 0xdf, 0xe1, 0x7b, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x72, 0x20, 0x86, 0x2e, 0xf4, 0x01, 0x00, 0x00, + // 424 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xcf, 0x6e, 0xd4, 0x30, + 0x10, 0xc6, 0x93, 0x52, 0x21, 0x48, 0x0b, 0x88, 0xa8, 0x52, 0x43, 0x84, 0xbc, 0x15, 0x07, 0xd4, + 0x4b, 0x6d, 0x2d, 0x88, 0x07, 0xe8, 0xb6, 0x62, 0x2f, 0x1c, 0xaa, 0xdd, 0x9e, 0xb8, 0x44, 0x8e, + 0x33, 0x35, 0x16, 0xb1, 0x1d, 0x6c, 0x27, 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0xea, 0xe4, 0xbf, 0x78, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -121,6 +131,14 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.InflationCycleStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStartTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintGenesis(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x22 { size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -176,6 +194,8 @@ func (m *GenesisState) Size() (n int) { } l = m.LiquidationParams.Size() n += 1 + l + sovGenesis(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStartTime) + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -312,6 +332,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleStartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.InflationCycleStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ugov/keeper/genesis.go b/x/ugov/keeper/genesis.go index c5cbbcee2b..dc853d6b59 100644 --- a/x/ugov/keeper/genesis.go +++ b/x/ugov/keeper/genesis.go @@ -1,11 +1,17 @@ package keeper -import "github.com/umee-network/umee/v5/x/ugov" +import ( + "github.com/umee-network/umee/v5/util" + "github.com/umee-network/umee/v5/x/ugov" +) func (k Keeper) ExportGenesis() *ugov.GenesisState { + lcst, err := k.GetInflationCycleStartTime() + util.Panic(err) return &ugov.GenesisState{ - MinGasPrice: k.MinGasPrice(), - LiquidationParams: k.LiquidationParams(), + MinGasPrice: k.MinGasPrice(), + LiquidationParams: k.LiquidationParams(), + InflationCycleStartTime: *lcst, } } @@ -14,5 +20,9 @@ func (k Keeper) InitGenesis(gs *ugov.GenesisState) error { return err } - return k.SetLiquidationParams(gs.LiquidationParams) + if err := k.SetLiquidationParams(gs.LiquidationParams); err != nil { + return err + } + + return k.SetInflationCycleStartTime(gs.InflationCycleStartTime) } diff --git a/x/ugov/keeper/keys.go b/x/ugov/keeper/keys.go index 7a2533067a..d99422108b 100644 --- a/x/ugov/keeper/keys.go +++ b/x/ugov/keeper/keys.go @@ -2,7 +2,8 @@ package keeper // store key prefixes var ( - keyMinGasPrice = []byte{0x01} - keyEmergencyGroup = []byte{0x02} - KeyLiquidationParams = []byte{0x03} + keyMinGasPrice = []byte{0x01} + keyEmergencyGroup = []byte{0x02} + KeyLiquidationParams = []byte{0x03} + KeyInflationCycleStartTime = []byte{0x04} ) diff --git a/x/ugov/keeper/params.go b/x/ugov/keeper/params.go index 4647fdc767..1c4b689072 100644 --- a/x/ugov/keeper/params.go +++ b/x/ugov/keeper/params.go @@ -1,6 +1,8 @@ package keeper import ( + "time" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/umee-network/umee/v5/util/coin" @@ -39,3 +41,11 @@ func (k Keeper) LiquidationParams() ugov.LiquidationParams { } return *lp } + +func (k Keeper) SetInflationCycleStartTime(startTime time.Time) error { + return store.SetBinValue(k.store, KeyInflationCycleStartTime, &startTime, "inflation_cycle_start_time") +} + +func (k Keeper) GetInflationCycleStartTime() (*time.Time, error) { + return store.GetBinValue[*time.Time](k.store, KeyInflationCycleStartTime, "inflation_cycle_start_time") +} diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index 01f147d2f4..766023fbe1 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -2,6 +2,7 @@ package keeper import ( "testing" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -51,3 +52,23 @@ func TestLiquidationParams(t *testing.T) { require.Equal(rlp, dlp) require.Equal(rlp.MaxSupply.GetDenom(), appparams.BondDenom) } + +func TestInflationCycleStartTime(t *testing.T) { + t.Parallel() + require := require.New(t) + k := initKeeper(t) + + st := time.Time{} + err := k.SetInflationCycleStartTime(st) + require.NoError(err) + in_c, err := k.GetInflationCycleStartTime() + require.NoError(err) + require.Equal(in_c.IsZero(), true, "it should be default zero time") + + icst := time.Now() + err = k.SetInflationCycleStartTime(icst) + require.NoError(err) + ricst, err := k.GetInflationCycleStartTime() + require.NoError(err) + require.Equal(ricst.Equal(icst), true, "inflation cycle start time should be same") +} diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index 4e1c90c1fb..722f4a4a10 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -36,3 +36,14 @@ func (q Querier) LiquidationParams(ctx context.Context, _ *ugov.QueryLiquidation sdkCtx := sdk.UnwrapSDKContext(ctx) return &ugov.QueryLiquidationParamsResponse{LiquidationParams: q.Keeper(&sdkCtx).LiquidationParams()}, nil } + +// InflationCycleStartTime return when the inflation cycle is started +func (q Querier) InflationCycleStartTime(ctx context.Context, _ *ugov.QueryInflationCycleStartTime) ( + *ugov.QueryInflationCycleStartTimeResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + icst, err := q.Keeper(&sdkCtx).GetInflationCycleStartTime() + if err != nil { + return nil, err + } + return &ugov.QueryInflationCycleStartTimeResponse{InflationCycleStartTime: icst}, nil +} diff --git a/x/ugov/liquidation_params.go b/x/ugov/liquidation_params.go index f90304ab5e..9fab211f95 100644 --- a/x/ugov/liquidation_params.go +++ b/x/ugov/liquidation_params.go @@ -11,9 +11,11 @@ import ( ) var ( - DefaultMaxSupply = sdk.NewCoin(appparams.BondDenom, sdk.NewInt(12_000000000)) + DefaultMaxSupply = sdk.NewCoin(appparams.BondDenom, sdk.NewInt(12_000000000_0000000)) + // One year for default inflation cycle DefaultInflationCycleDuration = time.Second * time.Duration(60*60*24*365) - DefaultInflationReductionRate = sdk.MustNewDecFromStr("0.01") + // 25% reduction rate for every inflation cyle + DefaultInflationReductionRate = sdk.MustNewDecFromStr("0.25") ) func DefaultLiquidationParams() LiquidationParams { diff --git a/x/ugov/query.pb.go b/x/ugov/query.pb.go index ed92641835..5442d80abb 100644 --- a/x/ugov/query.pb.go +++ b/x/ugov/query.pb.go @@ -11,19 +11,23 @@ import ( _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -256,6 +260,81 @@ func (m *QueryLiquidationParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLiquidationParamsResponse proto.InternalMessageInfo +// QueryInflationCycleStartTime request type. +type QueryInflationCycleStartTime struct { +} + +func (m *QueryInflationCycleStartTime) Reset() { *m = QueryInflationCycleStartTime{} } +func (m *QueryInflationCycleStartTime) String() string { return proto.CompactTextString(m) } +func (*QueryInflationCycleStartTime) ProtoMessage() {} +func (*QueryInflationCycleStartTime) Descriptor() ([]byte, []int) { + return fileDescriptor_25fa04679024a47d, []int{6} +} +func (m *QueryInflationCycleStartTime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryInflationCycleStartTime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryInflationCycleStartTime.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 *QueryInflationCycleStartTime) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryInflationCycleStartTime.Merge(m, src) +} +func (m *QueryInflationCycleStartTime) XXX_Size() int { + return m.Size() +} +func (m *QueryInflationCycleStartTime) XXX_DiscardUnknown() { + xxx_messageInfo_QueryInflationCycleStartTime.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryInflationCycleStartTime proto.InternalMessageInfo + +// QueryInflationCycleStartTimeResponse response type. +type QueryInflationCycleStartTimeResponse struct { + InflationCycleStartTime *time.Time `protobuf:"bytes,1,opt,name=inflation_cycle_start_time,json=inflationCycleStartTime,proto3,stdtime" json:"inflation_cycle_start_time,omitempty"` +} + +func (m *QueryInflationCycleStartTimeResponse) Reset() { *m = QueryInflationCycleStartTimeResponse{} } +func (m *QueryInflationCycleStartTimeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryInflationCycleStartTimeResponse) ProtoMessage() {} +func (*QueryInflationCycleStartTimeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_25fa04679024a47d, []int{7} +} +func (m *QueryInflationCycleStartTimeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryInflationCycleStartTimeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryInflationCycleStartTimeResponse.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 *QueryInflationCycleStartTimeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryInflationCycleStartTimeResponse.Merge(m, src) +} +func (m *QueryInflationCycleStartTimeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryInflationCycleStartTimeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryInflationCycleStartTimeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryInflationCycleStartTimeResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryMinGasPrice)(nil), "umee.ugov.v1.QueryMinGasPrice") proto.RegisterType((*QueryMinGasPriceResponse)(nil), "umee.ugov.v1.QueryMinGasPriceResponse") @@ -263,45 +342,54 @@ func init() { proto.RegisterType((*QueryEmergencyGroupResponse)(nil), "umee.ugov.v1.QueryEmergencyGroupResponse") proto.RegisterType((*QueryLiquidationParams)(nil), "umee.ugov.v1.QueryLiquidationParams") proto.RegisterType((*QueryLiquidationParamsResponse)(nil), "umee.ugov.v1.QueryLiquidationParamsResponse") + proto.RegisterType((*QueryInflationCycleStartTime)(nil), "umee.ugov.v1.QueryInflationCycleStartTime") + proto.RegisterType((*QueryInflationCycleStartTimeResponse)(nil), "umee.ugov.v1.QueryInflationCycleStartTimeResponse") } func init() { proto.RegisterFile("umee/ugov/v1/query.proto", fileDescriptor_25fa04679024a47d) } var fileDescriptor_25fa04679024a47d = []byte{ - // 515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0xc6, 0x1b, 0xfe, 0x49, 0xb8, 0x30, 0x98, 0x19, 0x10, 0xb2, 0xcd, 0x1d, 0x01, 0xa6, 0x21, - 0x91, 0x58, 0x1d, 0xe2, 0x03, 0xac, 0x0c, 0x76, 0x01, 0x69, 0x14, 0x4e, 0x5c, 0x8a, 0x93, 0x5a, - 0xc6, 0xa2, 0xb1, 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, 0x7e, - 0xb4, 0xc0, 0xf2, 0xdc, 0xf2, 0xe0, 0xcd, 0x05, 0x3e, 0x73, 0x5d, 0xce, 0x9d, 0xe3, 0x74, 0x55, - 0x40, 0x5b, 0x06, 0xc8, 0x85, 0x1b, 0x75, 0xa0, 0xa9, 0x80, 0xbc, 0x22, 0xe1, 0xce, 0xee, 0xf0, - 0x17, 0x6a, 0x0c, 0x47, 0xc8, 0x3a, 0x1a, 0x21, 0xeb, 0xe7, 0x08, 0x59, 0x1f, 0xc6, 0xa8, 0x71, - 0x34, 0x46, 0x8d, 0xef, 0x63, 0xd4, 0x78, 0xbe, 0xc9, 0x78, 0xf2, 0x32, 0x0d, 0xfc, 0x50, 0x46, - 0x66, 0x92, 0x27, 0x68, 0xf2, 0x5a, 0xaa, 0x57, 0xc5, 0xd8, 0xec, 0x1e, 0x7e, 0x63, 0x66, 0x07, - 0x67, 0xcc, 0x1f, 0x77, 0xf7, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0x1a, 0xee, 0xd4, 0x23, - 0x04, 0x00, 0x00, + // 628 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x4f, 0xd4, 0x4e, + 0x1c, 0xc6, 0xb7, 0xbf, 0xf0, 0x33, 0x3a, 0x28, 0xca, 0x88, 0xb2, 0x16, 0xe8, 0x62, 0x45, 0x82, + 0xc6, 0xce, 0x64, 0x31, 0xbe, 0x00, 0x16, 0x94, 0x98, 0x68, 0x82, 0x0b, 0x27, 0x2f, 0x75, 0x5a, + 0x86, 0x3a, 0x71, 0x3b, 0x53, 0x3a, 0x6d, 0x15, 0x8f, 0x26, 0x1e, 0xbc, 0x61, 0x7c, 0x03, 0xbe, + 0x08, 0x5f, 0x81, 0xa7, 0x3d, 0x12, 0xbd, 0x78, 0x42, 0x05, 0x5f, 0x88, 0xe9, 0xf4, 0x8f, 0x5b, + 0xb6, 0xfc, 0xb9, 0xed, 0xcc, 0xf3, 0xec, 0xf7, 0x79, 0xbe, 0xd3, 0x0f, 0x68, 0xc6, 0x3e, 0xa5, + 0x38, 0xf6, 0x44, 0x82, 0x93, 0x36, 0xde, 0x8e, 0x69, 0xb8, 0x83, 0x82, 0x50, 0x44, 0x02, 0x5e, + 0x4c, 0x15, 0x94, 0x2a, 0x28, 0x69, 0xeb, 0x86, 0x2b, 0xa4, 0x2f, 0x24, 0x76, 0x88, 0xa4, 0x38, + 0x69, 0x3b, 0x34, 0x22, 0x6d, 0xec, 0x0a, 0xc6, 0x33, 0xb7, 0x7e, 0x23, 0xd3, 0x6d, 0x75, 0xc2, + 0xd9, 0x21, 0x97, 0x26, 0x3c, 0xe1, 0x89, 0xec, 0x3e, 0xfd, 0x95, 0xdf, 0x4e, 0x7b, 0x42, 0x78, + 0x3d, 0x8a, 0x49, 0xc0, 0x30, 0xe1, 0x5c, 0x44, 0x24, 0x62, 0x82, 0x17, 0xff, 0x69, 0xe5, 0xaa, + 0x3a, 0x39, 0xf1, 0x16, 0x8e, 0x98, 0x4f, 0x65, 0x44, 0xfc, 0x20, 0x37, 0x4c, 0x56, 0x7a, 0xab, + 0x96, 0x4a, 0x30, 0x21, 0xb8, 0xf2, 0x2c, 0xdd, 0xe2, 0x29, 0xe3, 0xab, 0x44, 0xae, 0x85, 0xcc, + 0xa5, 0xa6, 0x03, 0x9a, 0x47, 0xef, 0xba, 0x54, 0x06, 0x82, 0x4b, 0x0a, 0x1f, 0x81, 0x4b, 0x3e, + 0xe3, 0xb6, 0x47, 0xd2, 0xee, 0xcc, 0xa5, 0x4d, 0x6d, 0x56, 0x5b, 0x18, 0x5d, 0x9c, 0x46, 0xf9, + 0x0e, 0xe9, 0xc2, 0x28, 0x5f, 0x18, 0xad, 0x50, 0x77, 0x59, 0x30, 0xde, 0x19, 0xe9, 0xef, 0xb7, + 0x1a, 0xdd, 0x51, 0x7f, 0x20, 0xe3, 0x1a, 0xb8, 0xaa, 0x32, 0x1e, 0xfa, 0x34, 0xf4, 0x28, 0x77, + 0x77, 0x56, 0x43, 0x11, 0x07, 0xe6, 0x0b, 0x30, 0x55, 0x73, 0x5d, 0xa6, 0x2f, 0x81, 0xcb, 0xb4, + 0x50, 0x6c, 0x2f, 0x95, 0x54, 0xfe, 0x85, 0x4e, 0xf3, 0xdb, 0x17, 0x6b, 0x22, 0xaf, 0xb0, 0xb4, + 0xb9, 0x19, 0x52, 0x29, 0xd7, 0xa3, 0x90, 0x71, 0xaf, 0x3b, 0x46, 0xab, 0x09, 0x4d, 0x70, 0x5d, + 0x25, 0x3c, 0x61, 0xdb, 0x31, 0xdb, 0x54, 0xaf, 0xb8, 0x46, 0x42, 0xe2, 0x4b, 0x33, 0x01, 0x46, + 0xbd, 0x52, 0xc6, 0x6f, 0x00, 0xd8, 0xfb, 0x27, 0xda, 0x81, 0x52, 0xf3, 0x17, 0x68, 0xa1, 0x41, + 0x00, 0xd0, 0xd0, 0x90, 0xfc, 0x11, 0xc6, 0x7b, 0x43, 0xb9, 0x06, 0x98, 0x56, 0xb9, 0x8f, 0xf9, + 0x56, 0x4f, 0xdd, 0x2f, 0xef, 0xb8, 0x3d, 0xba, 0x1e, 0x91, 0x30, 0xda, 0x60, 0x3e, 0x35, 0x3f, + 0x68, 0x60, 0xee, 0x24, 0x43, 0x59, 0x8f, 0x00, 0x9d, 0x15, 0x16, 0xdb, 0x4d, 0x3d, 0xb6, 0x4c, + 0x4d, 0x76, 0x4a, 0x43, 0x5e, 0x53, 0x47, 0x19, 0x2a, 0xa8, 0x40, 0x05, 0x6d, 0x14, 0xa8, 0x74, + 0xce, 0xf7, 0xf7, 0x5b, 0xda, 0xee, 0xcf, 0x96, 0xd6, 0x9d, 0x64, 0xf5, 0x51, 0x8b, 0x5f, 0x47, + 0xc0, 0xff, 0xaa, 0x0b, 0x7c, 0x0b, 0x46, 0x07, 0xf8, 0x80, 0x46, 0x75, 0xfd, 0xa3, 0xfc, 0xe8, + 0xf3, 0x27, 0xeb, 0xc5, 0x0e, 0xe6, 0xad, 0x77, 0xdf, 0xff, 0x7c, 0xfa, 0x6f, 0x06, 0x4e, 0xe1, + 0x0a, 0xb1, 0x3e, 0xe3, 0x96, 0x47, 0xa4, 0xa5, 0x98, 0x83, 0xef, 0x35, 0x30, 0x56, 0x25, 0x04, + 0xde, 0xac, 0x99, 0x5f, 0xb5, 0xe8, 0x77, 0x4e, 0xb5, 0x94, 0x2d, 0x6e, 0xab, 0x16, 0x2d, 0x38, + 0x53, 0x6d, 0x51, 0xa2, 0x64, 0x29, 0xf6, 0xe0, 0x47, 0x0d, 0x8c, 0x0f, 0x7d, 0x68, 0x38, 0x57, + 0x93, 0x33, 0xe4, 0xd2, 0xef, 0x9d, 0xc5, 0x55, 0x16, 0x5a, 0x50, 0x85, 0x4c, 0x38, 0x5b, 0x2d, + 0x34, 0x00, 0x93, 0x95, 0xd1, 0x08, 0x3f, 0x6b, 0x60, 0xf2, 0x18, 0x50, 0xe0, 0xdd, 0x9a, 0xcc, + 0x63, 0xbc, 0xfa, 0xe2, 0xd9, 0xbd, 0xa7, 0x3d, 0x5b, 0x09, 0x93, 0xa5, 0xa0, 0xec, 0xac, 0xf4, + 0x7f, 0x1b, 0x8d, 0xfe, 0x81, 0xa1, 0xed, 0x1d, 0x18, 0xda, 0xaf, 0x03, 0x43, 0xdb, 0x3d, 0x34, + 0x1a, 0x7b, 0x87, 0x46, 0xe3, 0xc7, 0xa1, 0xd1, 0x78, 0x3e, 0xef, 0xb1, 0xe8, 0x65, 0xec, 0x20, + 0x57, 0xf8, 0x6a, 0x8c, 0xc5, 0x69, 0xf4, 0x5a, 0x84, 0xaf, 0xb2, 0x99, 0xc9, 0x03, 0xfc, 0x46, + 0x0d, 0x76, 0xce, 0x29, 0x82, 0xef, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x04, 0x2a, 0x75, 0xf5, + 0x93, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -322,6 +410,8 @@ type QueryClient interface { EmergencyGroup(ctx context.Context, in *QueryEmergencyGroup, opts ...grpc.CallOption) (*QueryEmergencyGroupResponse, error) // LiquidationParams LiquidationParams(ctx context.Context, in *QueryLiquidationParams, opts ...grpc.CallOption) (*QueryLiquidationParamsResponse, error) + // InflationCycleStartTime returns when inflation cycle is started + InflationCycleStartTime(ctx context.Context, in *QueryInflationCycleStartTime, opts ...grpc.CallOption) (*QueryInflationCycleStartTimeResponse, error) } type queryClient struct { @@ -359,6 +449,15 @@ func (c *queryClient) LiquidationParams(ctx context.Context, in *QueryLiquidatio return out, nil } +func (c *queryClient) InflationCycleStartTime(ctx context.Context, in *QueryInflationCycleStartTime, opts ...grpc.CallOption) (*QueryInflationCycleStartTimeResponse, error) { + out := new(QueryInflationCycleStartTimeResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/InflationCycleStartTime", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // MinGasPrice returns minimum transaction fees. @@ -367,6 +466,8 @@ type QueryServer interface { EmergencyGroup(context.Context, *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) // LiquidationParams LiquidationParams(context.Context, *QueryLiquidationParams) (*QueryLiquidationParamsResponse, error) + // InflationCycleStartTime returns when inflation cycle is started + InflationCycleStartTime(context.Context, *QueryInflationCycleStartTime) (*QueryInflationCycleStartTimeResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -382,6 +483,9 @@ func (*UnimplementedQueryServer) EmergencyGroup(ctx context.Context, req *QueryE func (*UnimplementedQueryServer) LiquidationParams(ctx context.Context, req *QueryLiquidationParams) (*QueryLiquidationParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LiquidationParams not implemented") } +func (*UnimplementedQueryServer) InflationCycleStartTime(ctx context.Context, req *QueryInflationCycleStartTime) (*QueryInflationCycleStartTimeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InflationCycleStartTime not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -441,6 +545,24 @@ func _Query_LiquidationParams_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_InflationCycleStartTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryInflationCycleStartTime) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).InflationCycleStartTime(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/umee.ugov.v1.Query/InflationCycleStartTime", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).InflationCycleStartTime(ctx, req.(*QueryInflationCycleStartTime)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "umee.ugov.v1.Query", HandlerType: (*QueryServer)(nil), @@ -457,6 +579,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "LiquidationParams", Handler: _Query_LiquidationParams_Handler, }, + { + MethodName: "InflationCycleStartTime", + Handler: _Query_InflationCycleStartTime_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "umee/ugov/v1/query.proto", @@ -627,6 +753,62 @@ func (m *QueryLiquidationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *QueryInflationCycleStartTime) 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 *QueryInflationCycleStartTime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryInflationCycleStartTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryInflationCycleStartTimeResponse) 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 *QueryInflationCycleStartTimeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryInflationCycleStartTimeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InflationCycleStartTime != nil { + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.InflationCycleStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.InflationCycleStartTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintQuery(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -700,6 +882,28 @@ func (m *QueryLiquidationParamsResponse) Size() (n int) { return n } +func (m *QueryInflationCycleStartTime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryInflationCycleStartTimeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.InflationCycleStartTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.InflationCycleStartTime) + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1104,6 +1308,142 @@ func (m *QueryLiquidationParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryInflationCycleStartTime) 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 ErrIntOverflowQuery + } + 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: QueryInflationCycleStartTime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryInflationCycleStartTime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryInflationCycleStartTimeResponse) 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 ErrIntOverflowQuery + } + 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: QueryInflationCycleStartTimeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryInflationCycleStartTimeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleStartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InflationCycleStartTime == nil { + m.InflationCycleStartTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.InflationCycleStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ugov/query.pb.gw.go b/x/ugov/query.pb.gw.go index bd4d5f658c..587bff035f 100644 --- a/x/ugov/query.pb.gw.go +++ b/x/ugov/query.pb.gw.go @@ -87,6 +87,24 @@ func local_request_Query_LiquidationParams_0(ctx context.Context, marshaler runt } +func request_Query_InflationCycleStartTime_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInflationCycleStartTime + var metadata runtime.ServerMetadata + + msg, err := client.InflationCycleStartTime(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_InflationCycleStartTime_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInflationCycleStartTime + var metadata runtime.ServerMetadata + + msg, err := server.InflationCycleStartTime(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -162,6 +180,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_InflationCycleStartTime_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_InflationCycleStartTime_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_InflationCycleStartTime_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -263,6 +304,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_InflationCycleStartTime_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_InflationCycleStartTime_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_InflationCycleStartTime_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -272,6 +333,8 @@ var ( pattern_Query_EmergencyGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "emergency-group"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_LiquidationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "liquidation-params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_InflationCycleStartTime_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation-cycle"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -280,4 +343,6 @@ var ( forward_Query_EmergencyGroup_0 = runtime.ForwardResponseMessage forward_Query_LiquidationParams_0 = runtime.ForwardResponseMessage + + forward_Query_InflationCycleStartTime_0 = runtime.ForwardResponseMessage ) diff --git a/x/ugov/ugov.pb.go b/x/ugov/ugov.pb.go index d9248ac6cc..59988c8ca0 100644 --- a/x/ugov/ugov.pb.go +++ b/x/ugov/ugov.pb.go @@ -32,7 +32,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // LiquidationParams type LiquidationParams struct { - // max_supply is the maximum supply for liquidation denom. + // max_supply is the maximum supply for liquidation. MaxSupply types.Coin `protobuf:"bytes,1,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply"` // inflation_cycle_duration is duration for changing the inflation rates for liquidation. InflationCycleDuration time.Duration `protobuf:"bytes,2,opt,name=inflation_cycle_duration,json=inflationCycleDuration,proto3,stdduration" json:"inflation_cycle_duration,omitempty" yaml:"inflation_cycle_duration"` From 59f23d28f605be4f40bef16995cc4f6f50b5dabf Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Mon, 17 Jul 2023 13:49:55 +0530 Subject: [PATCH 03/17] inflation rate change condition updated --- proto/umee/ugov/v1/genesis.proto | 1 - x/mint/module/abci.go | 6 ++-- x/ugov/genesis.pb.go | 56 +++++++++++++++----------------- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto index 8468cbb220..f280f2084f 100644 --- a/proto/umee/ugov/v1/genesis.proto +++ b/proto/umee/ugov/v1/genesis.proto @@ -4,7 +4,6 @@ package umee.ugov.v1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "google/protobuf/timestamp.proto"; -import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "umee/ugov/v1/ugov.proto"; diff --git a/x/mint/module/abci.go b/x/mint/module/abci.go index b46f9e07b3..4e3f181c6c 100644 --- a/x/mint/module/abci.go +++ b/x/mint/module/abci.go @@ -67,9 +67,9 @@ func InflationCalculationFn(ctx sdk.Context, ugovKeeper ugovkeeper.Keeper, mintK icst, err := ugovKeeper.GetInflationCycleStartTime() util.Panic(err) - // TODO: needs to verify when to update this cycle time like in migrations or in this BeginBlock ? - // first time start time is zero - if !icst.IsZero() && ctx.BlockTime().After(icst.Add(lp.InflationCycleDuration)) { + // Initially inflation_cycle start time is zero + // Once chain start inflation cycle start time will be inflation rate change executed block time + if ctx.BlockTime().After(icst.Add(lp.InflationCycleDuration)) { params.InflationMax = params.InflationMax.Mul(sdk.OneDec().Sub(lp.InflationReductionRate)) params.InflationMin = params.InflationMin.Mul(sdk.OneDec().Sub(lp.InflationReductionRate)) diff --git a/x/ugov/genesis.pb.go b/x/ugov/genesis.pb.go index 68de94ea67..486858a66a 100644 --- a/x/ugov/genesis.pb.go +++ b/x/ugov/genesis.pb.go @@ -10,7 +10,6 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" @@ -81,34 +80,33 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/genesis.proto", fileDescriptor_82f39cd8e8ede8c7) } var fileDescriptor_82f39cd8e8ede8c7 = []byte{ - // 424 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xcf, 0x6e, 0xd4, 0x30, - 0x10, 0xc6, 0x93, 0x52, 0x21, 0x48, 0x0b, 0x88, 0xa8, 0x52, 0x43, 0x84, 0xbc, 0x15, 0x07, 0xd4, - 0x4b, 0x6d, 0x2d, 0x88, 0x07, 0xe8, 0xb6, 0x62, 0x2f, 0x1c, 0xaa, 0xdd, 0x9e, 0xb8, 0x44, 0x8e, - 0x33, 0x35, 0x16, 0xb1, 0x1d, 0x6c, 0x27, 0xd0, 0xb7, 0xe8, 0xc3, 0xf0, 0x10, 0x7b, 0xac, 0x7a, - 0xe2, 0xc4, 0x9f, 0xdd, 0x17, 0x41, 0x76, 0x92, 0x42, 0x7b, 0xf3, 0xe8, 0xfb, 0xfc, 0x9b, 0x6f, - 0x66, 0x92, 0xbc, 0x95, 0x00, 0xa4, 0xe5, 0xba, 0x23, 0xdd, 0x94, 0x70, 0x50, 0x60, 0x85, 0xc5, - 0x8d, 0xd1, 0x4e, 0xa7, 0xbb, 0x5e, 0xc3, 0x5e, 0xc3, 0xdd, 0x34, 0xdf, 0xe3, 0x9a, 0xeb, 0x20, - 0x10, 0xff, 0xea, 0x3d, 0x39, 0x62, 0xda, 0x4a, 0x6d, 0x49, 0x49, 0x2d, 0x90, 0x6e, 0x5a, 0x82, - 0xa3, 0x53, 0xc2, 0xb4, 0x50, 0x83, 0x3e, 0xe1, 0x5a, 0xf3, 0x1a, 0x48, 0xa8, 0xca, 0xf6, 0x82, - 0x38, 0x21, 0xc1, 0x3a, 0x2a, 0x9b, 0x11, 0x70, 0xdf, 0x50, 0xb5, 0x86, 0x3a, 0xa1, 0x47, 0xc0, - 0x8b, 0xbe, 0x41, 0xd1, 0x77, 0xee, 0x8b, 0x41, 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, 0x1e, 0xb3, 0xf4, - 0x14, 0xef, 0x9b, 0x9d, 0xae, 0xfe, 0xa0, 0x68, 0xb5, 0x46, 0xf1, 0xf5, 0x1a, 0xc5, 0xbf, 0xd7, - 0x28, 0xbe, 0xda, 0xa0, 0xe8, 0x7a, 0x83, 0xa2, 0x1f, 0x1b, 0x14, 0x7d, 0x7c, 0xcd, 0x85, 0xfb, - 0xd4, 0x96, 0x98, 0x69, 0x49, 0xfc, 0x10, 0x47, 0x0a, 0xdc, 0x57, 0x6d, 0x3e, 0x87, 0x82, 0x74, - 0xef, 0xc8, 0xb7, 0x70, 0xa0, 0xf2, 0x61, 0x68, 0xfe, 0xf6, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xd6, 0xea, 0xe4, 0xbf, 0x78, 0x02, 0x00, 0x00, + // 414 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xcd, 0x6e, 0xd4, 0x30, + 0x14, 0x85, 0x93, 0x52, 0x21, 0x48, 0x0b, 0x88, 0xa8, 0x52, 0x43, 0x84, 0x9c, 0x8a, 0x05, 0xea, + 0xa6, 0xb6, 0x02, 0xe2, 0x01, 0x9a, 0x56, 0xcc, 0x86, 0x45, 0x35, 0xd3, 0x15, 0x9b, 0xc8, 0xf1, + 0xdc, 0x1a, 0x8b, 0xd8, 0x0e, 0xb6, 0x13, 0xe8, 0x5b, 0xf4, 0x61, 0x78, 0x88, 0x59, 0x56, 0x5d, + 0xb1, 0xe2, 0x67, 0xe6, 0x45, 0x90, 0x9d, 0xb4, 0xfc, 0xec, 0x7c, 0x75, 0xce, 0xfd, 0x7c, 0x7c, + 0x9c, 0xe4, 0xbd, 0x04, 0x20, 0x3d, 0xd7, 0x03, 0x19, 0x4a, 0xc2, 0x41, 0x81, 0x15, 0x16, 0x77, + 0x46, 0x3b, 0x9d, 0xee, 0x7a, 0x0d, 0x7b, 0x0d,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0xdd, 0x1f, + 0xdf, 0x59, 0xb0, 0x4d, 0x91, 0x9e, 0xb6, 0xff, 0x0b, 0x29, 0x4d, 0x72, 0xa1, 0x2e, 0xda, 0x91, + 0xc9, 0x2e, 0x59, 0x0b, 0xb5, 0x75, 0xd4, 0xb8, 0xda, 0xd7, 0x99, 0x6d, 0x07, 0x7a, 0x8e, 0xc7, + 0xae, 0xf1, 0x6d, 0xd7, 0xf8, 0xfc, 0xb6, 0xeb, 0xea, 0x81, 0x07, 0x5f, 0xfd, 0x28, 0xe2, 0xf9, + 0xfe, 0x1d, 0xe7, 0xc4, 0x63, 0x16, 0x9e, 0xe2, 0x7d, 0xd5, 0xe9, 0xea, 0x17, 0x8a, 0x56, 0x6b, + 0x14, 0x5f, 0xaf, 0x51, 0xfc, 0x73, 0x8d, 0xe2, 0xab, 0x0d, 0x8a, 0xae, 0x37, 0x28, 0xfa, 0xb6, + 0x41, 0xd1, 0xfb, 0x97, 0x5c, 0xb8, 0x0f, 0x7d, 0x83, 0x99, 0x96, 0xc4, 0x3f, 0xe2, 0x48, 0x81, + 0xfb, 0xac, 0xcd, 0xc7, 0x30, 0x90, 0xe1, 0x0d, 0xf9, 0x12, 0x3e, 0xa8, 0xb9, 0x1f, 0x2e, 0x7f, + 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x13, 0x66, 0x6e, 0x59, 0x58, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { From 8f8b68b6df9101f6d2e8ee631502358338ac4edc Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 18 Jul 2023 18:10:38 +0530 Subject: [PATCH 04/17] rename the LiquidationParams to InflationParams --- app/app.go | 2 +- proto/umee/ugov/v1/events.proto | 6 +- proto/umee/ugov/v1/genesis.proto | 4 +- proto/umee/ugov/v1/query.proto | 18 +-- proto/umee/ugov/v1/tx.proto | 16 +-- proto/umee/ugov/v1/ugov.proto | 4 +- x/mint/{module => }/abci.go | 14 +- x/mint/expected_keepers.go | 27 ++++ x/mint/{module => }/module.go | 0 x/ugov/client/cli/query.go | 2 +- x/ugov/codec.go | 4 +- x/ugov/events.pb.go | 104 +++++++-------- x/ugov/genesis.go | 6 +- x/ugov/genesis.pb.go | 66 +++++----- x/ugov/keeper/genesis.go | 4 +- x/ugov/keeper/keys.go | 2 +- x/ugov/keeper/msg_server.go | 11 +- x/ugov/keeper/params.go | 10 +- x/ugov/keeper/params_test.go | 10 +- x/ugov/keeper/query_server.go | 8 +- x/ugov/liquidation_params.go | 6 +- x/ugov/msg.go | 18 +-- x/ugov/query.pb.go | 219 +++++++++++++++---------------- x/ugov/query.pb.gw.go | 28 ++-- x/ugov/tx.pb.go | 200 ++++++++++++++-------------- x/ugov/ugov.pb.go | 99 +++++++------- 26 files changed, 456 insertions(+), 432 deletions(-) rename x/mint/{module => }/abci.go (87%) create mode 100644 x/mint/expected_keepers.go rename x/mint/{module => }/module.go (100%) diff --git a/app/app.go b/app/app.go index 850fca4387..6237008f4c 100644 --- a/app/app.go +++ b/app/app.go @@ -143,7 +143,7 @@ import ( uibcquota "github.com/umee-network/umee/v5/x/uibc/quota" uibcquotakeeper "github.com/umee-network/umee/v5/x/uibc/quota/keeper" - umint "github.com/umee-network/umee/v5/x/mint/module" + umint "github.com/umee-network/umee/v5/x/mint" ) var ( diff --git a/proto/umee/ugov/v1/events.proto b/proto/umee/ugov/v1/events.proto index c4e4bdaf58..3643e917b2 100644 --- a/proto/umee/ugov/v1/events.proto +++ b/proto/umee/ugov/v1/events.proto @@ -19,7 +19,7 @@ message EventEmergencyGroup { string emergency_group = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// EventLiquidationParams is emitted when GovUpdateLiquidationParams is correctly executed. -message EventLiquidationParams { - LiquidationParams liquidation_params = 1 [(gogoproto.nullable) = false]; +// EventInflationParams is emitted when GovUpdateInflationParams is correctly executed. +message EventInflationParams { + InflationParams inflation_params = 1 [(gogoproto.nullable) = false]; } \ No newline at end of file diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto index f280f2084f..186c57f4f7 100644 --- a/proto/umee/ugov/v1/genesis.proto +++ b/proto/umee/ugov/v1/genesis.proto @@ -17,8 +17,8 @@ message GenesisState { // Emergency Group address string emergency_group = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // LiquidationParams is params for new liquidation inflation rate params for staking denoms - LiquidationParams liquidation_params = 3 [(gogoproto.nullable) = false]; + // InflationParams is params for inflation rate changes + InflationParams inflation_params = 3 [(gogoproto.nullable) = false]; // Unix timestamp when the inflation cycle is started google.protobuf.Timestamp inflation_cycle_start_time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto index 8f1d98f4d0..99211793fb 100644 --- a/proto/umee/ugov/v1/query.proto +++ b/proto/umee/ugov/v1/query.proto @@ -25,12 +25,12 @@ service Query { option (google.api.http).get = "/umee/ugov/v1/emergency-group"; } - // LiquidationParams - rpc LiquidationParams(QueryLiquidationParams) returns (QueryLiquidationParamsResponse) { - option (google.api.http).get = "/umee/ugov/v1/liquidation-params"; + // InflationParams returns params of inflation reduction rates + rpc InflationParams(QueryInflationParams) returns (QueryInflationParamsResponse) { + option (google.api.http).get = "/umee/ugov/v1/inflation-params"; } - // InflationCycleStartTime returns when inflation cycle is started + // InflationCycleStartTime returns inflation cycle start time rpc InflationCycleStartTime(QueryInflationCycleStartTime) returns (QueryInflationCycleStartTimeResponse) { option (google.api.http).get = "/umee/ugov/v1/inflation-cycle"; } @@ -52,12 +52,12 @@ message QueryEmergencyGroupResponse { string emergency_group = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// QueryLiquidationParams request type. -message QueryLiquidationParams {} +// QueryInflationParams request type. +message QueryInflationParams {} -// QueryLiquidationParamsResponse response type. -message QueryLiquidationParamsResponse { - LiquidationParams liquidation_params = 1 [(gogoproto.nullable) = false]; +// QueryInflationParamsResponse response type. +message QueryInflationParamsResponse { + InflationParams inflation_params = 1 [(gogoproto.nullable) = false]; } // QueryInflationCycleStartTime request type. diff --git a/proto/umee/ugov/v1/tx.proto b/proto/umee/ugov/v1/tx.proto index 512841087e..5cc46886c0 100644 --- a/proto/umee/ugov/v1/tx.proto +++ b/proto/umee/ugov/v1/tx.proto @@ -19,8 +19,8 @@ service Msg { // GovSetEmergencyGroup sets emergency group address. rpc GovSetEmergencyGroup(MsgGovSetEmergencyGroup) returns (MsgGovSetEmergencyGroupResponse); - // GovUpdateLiquidationParams sets new liquidation params for inflation - rpc GovUpdateLiquidationParams(MsgGovUpdateLiquidationParams) returns (GovUpdateLiquidationParamsResponse); + // GovUpdateInflationParams sets new params for inflation rate change. + rpc GovUpdateInflationParams(MsgGovUpdateInflationParams) returns (GovUpdateInflationParamsResponse); } // MsgGovUpdateMinGasPrice request type. @@ -48,14 +48,14 @@ message MsgGovSetEmergencyGroup { // MsgGovSetEmergencyGroupResponse response type. message MsgGovSetEmergencyGroupResponse {}; -// MsgGovUpdateLiquidationParams request type. -message MsgGovUpdateLiquidationParams { +// MsgGovUpdateInflationParams request type. +message MsgGovUpdateInflationParams { option (cosmos.msg.v1.signer) = "authority"; // authority must be the address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - LiquidationParams liquidation_params = 2 [(gogoproto.nullable) = false]; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + InflationParams inflation_params = 2 [(gogoproto.nullable) = false]; } -// GovUpdateLiquidationParamsResponse response type. -message GovUpdateLiquidationParamsResponse {} \ No newline at end of file +// GovUpdateInflationParamsResponse response type. +message GovUpdateInflationParamsResponse {} \ No newline at end of file diff --git a/proto/umee/ugov/v1/ugov.proto b/proto/umee/ugov/v1/ugov.proto index c060e0956b..1ab02b690a 100644 --- a/proto/umee/ugov/v1/ugov.proto +++ b/proto/umee/ugov/v1/ugov.proto @@ -9,8 +9,8 @@ import "cosmos_proto/cosmos.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; option (gogoproto.goproto_getters_all) = false; -// LiquidationParams -message LiquidationParams { +// InflationParams params for changing the inflation min rate and max rate of mint module params. +message InflationParams { // max_supply is the maximum supply for liquidation. cosmos.base.v1beta1.Coin max_supply = 1 [(gogoproto.nullable) = false]; // inflation_cycle_duration is duration for changing the inflation rates for liquidation. diff --git a/x/mint/module/abci.go b/x/mint/abci.go similarity index 87% rename from x/mint/module/abci.go rename to x/mint/abci.go index 4e3f181c6c..cf1e56ee4f 100644 --- a/x/mint/module/abci.go +++ b/x/mint/abci.go @@ -5,18 +5,16 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - mk "github.com/cosmos/cosmos-sdk/x/mint/keeper" "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/umee-network/umee/v5/util" ugov "github.com/umee-network/umee/v5/x/ugov" - ugovkeeper "github.com/umee-network/umee/v5/x/ugov/keeper" ) -// BeginBlock implements BeginBlock for the x/mint module. -func BeginBlock(ctx sdk.Context, ugovKeeper ugovkeeper.Keeper, mintKeeper mk.Keeper) { +// BeginBlock overrides the mint module BeginBlock. +func BeginBlock(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper MintKeeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) - // liquidation params - lp := ugovKeeper.LiquidationParams() + // inflation rate change params + lp := ugovKeeper.InflationParams() // mint module params mintParams := mintKeeper.GetParams(ctx) @@ -60,8 +58,8 @@ func BeginBlock(ctx sdk.Context, ugovKeeper ugovkeeper.Keeper, mintKeeper mk.Kee ) } -func InflationCalculationFn(ctx sdk.Context, ugovKeeper ugovkeeper.Keeper, mintKeeper mk.Keeper, - lp ugov.LiquidationParams, params types.Params, bondedRatio sdk.Dec, currentInflation sdk.Dec) sdk.Dec { +func InflationCalculationFn(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper MintKeeper, + lp ugov.InflationParams, params types.Params, bondedRatio sdk.Dec, currentInflation sdk.Dec) sdk.Dec { // inflation cycle is completed , so we need to update the inflation max and min rate icst, err := ugovKeeper.GetInflationCycleStartTime() diff --git a/x/mint/expected_keepers.go b/x/mint/expected_keepers.go new file mode 100644 index 0000000000..8b9366c016 --- /dev/null +++ b/x/mint/expected_keepers.go @@ -0,0 +1,27 @@ +package mint + +import ( + "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + ugov "github.com/umee-network/umee/v5/x/ugov" +) + +type UGovKeeper interface { + SetInflationCycleStartTime(startTime time.Time) error + GetInflationCycleStartTime() (*time.Time, error) + InflationParams() ugov.InflationParams +} + +type MintKeeper interface { + SetParams(ctx sdk.Context, params minttypes.Params) + GetParams(ctx sdk.Context) (params minttypes.Params) + StakingTokenSupply(ctx sdk.Context) math.Int + SetMinter(ctx sdk.Context, minter minttypes.Minter) + GetMinter(ctx sdk.Context) (minter minttypes.Minter) + BondedRatio(ctx sdk.Context) sdk.Dec + MintCoins(ctx sdk.Context, newCoins sdk.Coins) error + AddCollectedFees(ctx sdk.Context, fees sdk.Coins) error +} diff --git a/x/mint/module/module.go b/x/mint/module.go similarity index 100% rename from x/mint/module/module.go rename to x/mint/module.go diff --git a/x/ugov/client/cli/query.go b/x/ugov/client/cli/query.go index 85aea566bf..224d06d142 100644 --- a/x/ugov/client/cli/query.go +++ b/x/ugov/client/cli/query.go @@ -65,7 +65,7 @@ func QueryLiquidationParams() *cobra.Command { } queryClient := ugov.NewQueryClient(clientCtx) - resp, err := queryClient.LiquidationParams(cmd.Context(), &ugov.QueryLiquidationParams{}) + resp, err := queryClient.InflationParams(cmd.Context(), &ugov.QueryInflationParams{}) return cli.PrintOrErr(resp, err, clientCtx) }, } diff --git a/x/ugov/codec.go b/x/ugov/codec.go index c5a9d96407..d5e1a18331 100644 --- a/x/ugov/codec.go +++ b/x/ugov/codec.go @@ -31,7 +31,7 @@ func init() { func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgGovUpdateMinGasPrice{}, proto.MessageName(&MsgGovUpdateMinGasPrice{}), nil) cdc.RegisterConcrete(&MsgGovSetEmergencyGroup{}, "umee/ugov/MsgGovSetEmergencyGroup", nil) - cdc.RegisterConcrete(&MsgGovUpdateLiquidationParams{}, "umee/ugov/MsgGovUpdateLiquidationParams", nil) + cdc.RegisterConcrete(&MsgGovUpdateInflationParams{}, "umee/ugov/MsgGovUpdateInflationParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -39,7 +39,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { (*sdk.Msg)(nil), &MsgGovUpdateMinGasPrice{}, &MsgGovSetEmergencyGroup{}, - &MsgGovUpdateLiquidationParams{}, + &MsgGovUpdateInflationParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/ugov/events.pb.go b/x/ugov/events.pb.go index 3f8f94589c..e220863a84 100644 --- a/x/ugov/events.pb.go +++ b/x/ugov/events.pb.go @@ -101,23 +101,23 @@ func (m *EventEmergencyGroup) XXX_DiscardUnknown() { var xxx_messageInfo_EventEmergencyGroup proto.InternalMessageInfo -// EventLiquidationParams is emitted when GovUpdateLiquidationParams is correctly executed. -type EventLiquidationParams struct { - LiquidationParams LiquidationParams `protobuf:"bytes,1,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` +// EventInflationParams is emitted when GovUpdateInflationParams is correctly executed. +type EventInflationParams struct { + InflationParams InflationParams `protobuf:"bytes,1,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` } -func (m *EventLiquidationParams) Reset() { *m = EventLiquidationParams{} } -func (m *EventLiquidationParams) String() string { return proto.CompactTextString(m) } -func (*EventLiquidationParams) ProtoMessage() {} -func (*EventLiquidationParams) Descriptor() ([]byte, []int) { +func (m *EventInflationParams) Reset() { *m = EventInflationParams{} } +func (m *EventInflationParams) String() string { return proto.CompactTextString(m) } +func (*EventInflationParams) ProtoMessage() {} +func (*EventInflationParams) Descriptor() ([]byte, []int) { return fileDescriptor_0885cdf0808da4ea, []int{2} } -func (m *EventLiquidationParams) XXX_Unmarshal(b []byte) error { +func (m *EventInflationParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventLiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventInflationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventLiquidationParams.Marshal(b, m, deterministic) + return xxx_messageInfo_EventInflationParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -127,51 +127,51 @@ func (m *EventLiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *EventLiquidationParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventLiquidationParams.Merge(m, src) +func (m *EventInflationParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventInflationParams.Merge(m, src) } -func (m *EventLiquidationParams) XXX_Size() int { +func (m *EventInflationParams) XXX_Size() int { return m.Size() } -func (m *EventLiquidationParams) XXX_DiscardUnknown() { - xxx_messageInfo_EventLiquidationParams.DiscardUnknown(m) +func (m *EventInflationParams) XXX_DiscardUnknown() { + xxx_messageInfo_EventInflationParams.DiscardUnknown(m) } -var xxx_messageInfo_EventLiquidationParams proto.InternalMessageInfo +var xxx_messageInfo_EventInflationParams proto.InternalMessageInfo func init() { proto.RegisterType((*EventMinGasPrice)(nil), "umee.ugov.v1.EventMinGasPrice") proto.RegisterType((*EventEmergencyGroup)(nil), "umee.ugov.v1.EventEmergencyGroup") - proto.RegisterType((*EventLiquidationParams)(nil), "umee.ugov.v1.EventLiquidationParams") + proto.RegisterType((*EventInflationParams)(nil), "umee.ugov.v1.EventInflationParams") } func init() { proto.RegisterFile("umee/ugov/v1/events.proto", fileDescriptor_0885cdf0808da4ea) } var fileDescriptor_0885cdf0808da4ea = []byte{ - // 365 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xc1, 0x6e, 0xda, 0x30, - 0x1c, 0xc6, 0x13, 0x6d, 0x9a, 0xb4, 0x80, 0xd8, 0x96, 0xa1, 0x0d, 0xd0, 0x64, 0x10, 0x87, 0x89, - 0x0b, 0xb6, 0xc2, 0xb4, 0x07, 0x80, 0x82, 0xe8, 0xa1, 0x95, 0x10, 0xed, 0xa1, 0xaa, 0x2a, 0x45, - 0x49, 0xf8, 0xcb, 0xb5, 0x4a, 0x6c, 0x6a, 0x27, 0x69, 0xfb, 0x16, 0x7d, 0x98, 0x3e, 0x04, 0x47, - 0xd4, 0x53, 0x4f, 0x55, 0x0b, 0x2f, 0x52, 0xd9, 0x49, 0x45, 0x11, 0x37, 0xff, 0xbf, 0xcf, 0xfe, - 0x7e, 0x7f, 0x7f, 0x4e, 0x3d, 0x8d, 0x01, 0x48, 0x4a, 0x45, 0x46, 0x32, 0x8f, 0x40, 0x06, 0x3c, - 0x51, 0x78, 0x21, 0x45, 0x22, 0xdc, 0xb2, 0xb6, 0xb0, 0xb6, 0x70, 0xe6, 0x35, 0x50, 0x24, 0x54, - 0x2c, 0x14, 0x09, 0x03, 0x05, 0x24, 0xf3, 0x42, 0x48, 0x02, 0x8f, 0x44, 0x82, 0xf1, 0xfc, 0x76, - 0xa3, 0x9e, 0xfb, 0xbe, 0x99, 0x48, 0x3e, 0x14, 0x56, 0x95, 0x0a, 0x2a, 0x72, 0x5d, 0x9f, 0x0a, - 0xf5, 0xf7, 0x0e, 0xd9, 0x60, 0x8c, 0xd1, 0xbe, 0x70, 0xbe, 0x8f, 0xf4, 0x1e, 0xc7, 0x8c, 0x8f, - 0x03, 0x35, 0x91, 0x2c, 0x02, 0xf7, 0xd0, 0xa9, 0xc4, 0x8c, 0xfb, 0x34, 0xd0,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 0xff, 0x99, 0x00, 0x8c, 0x2f, 0x09, 0x02, 0x00, 0x00, + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xc1, 0x6a, 0xe2, 0x40, + 0x1c, 0xc6, 0x13, 0x76, 0x59, 0xd8, 0x28, 0x2a, 0x59, 0x61, 0x55, 0x76, 0x67, 0xc5, 0xc3, 0xe2, + 0xc5, 0x19, 0xe2, 0xb2, 0x0f, 0xa0, 0xab, 0xb8, 0x3d, 0xb4, 0x88, 0xbd, 0x94, 0x52, 0x08, 0x49, + 0xfc, 0x3b, 0x1d, 0xda, 0xcc, 0xc8, 0x4c, 0x92, 0xb6, 0x6f, 0xd1, 0x87, 0xe9, 0x43, 0x78, 0x94, + 0x9e, 0x7a, 0x2a, 0xad, 0xbe, 0x48, 0x99, 0x49, 0xa4, 0xd5, 0x5b, 0xfe, 0xbf, 0x2f, 0xf3, 0x7d, + 0x1f, 0x9f, 0xd3, 0x4c, 0x63, 0x00, 0x92, 0x52, 0x91, 0x91, 0xcc, 0x23, 0x90, 0x01, 0x4f, 0x14, + 0x5e, 0x4a, 0x91, 0x08, 0xb7, 0xac, 0x25, 0xac, 0x25, 0x9c, 0x79, 0x2d, 0x14, 0x09, 0x15, 0x0b, + 0x45, 0xc2, 0x40, 0x01, 0xc9, 0xbc, 0x10, 0x92, 0xc0, 0x23, 0x91, 0x60, 0x3c, 0xff, 0xbb, 0xd5, + 0xcc, 0x75, 0xdf, 0x5c, 0x24, 0x3f, 0x0a, 0xa9, 0x4e, 0x05, 0x15, 0x39, 0xd7, 0x5f, 0x05, 0xfd, + 0xbe, 0x97, 0x6c, 0x62, 0x8c, 0xd0, 0xb9, 0x70, 0x6a, 0x63, 0xdd, 0xe3, 0x98, 0xf1, 0x49, 0xa0, + 0xa6, 0x92, 0x45, 0xe0, 0xfe, 0x77, 0x2a, 0x31, 0xe3, 0x3e, 0x0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xff, 0xff, 0x75, 0x63, 0xc9, 0x35, 0x01, 0x02, 0x00, 0x00, } func (m *EventMinGasPrice) Marshal() (dAtA []byte, err error) { @@ -241,7 +241,7 @@ func (m *EventEmergencyGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventLiquidationParams) Marshal() (dAtA []byte, err error) { +func (m *EventInflationParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -251,18 +251,18 @@ func (m *EventLiquidationParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventLiquidationParams) MarshalTo(dAtA []byte) (int, error) { +func (m *EventInflationParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventLiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventInflationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.InflationParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -313,13 +313,13 @@ func (m *EventEmergencyGroup) Size() (n int) { return n } -func (m *EventLiquidationParams) Size() (n int) { +func (m *EventInflationParams) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.LiquidationParams.Size() + l = m.InflationParams.Size() n += 1 + l + sovEvents(uint64(l)) return n } @@ -496,7 +496,7 @@ func (m *EventEmergencyGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventLiquidationParams) Unmarshal(dAtA []byte) error { +func (m *EventInflationParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -519,15 +519,15 @@ func (m *EventLiquidationParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventLiquidationParams: wiretype end group for non-group") + return fmt.Errorf("proto: EventInflationParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventLiquidationParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventInflationParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidationParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -554,7 +554,7 @@ func (m *EventLiquidationParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LiquidationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.InflationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/genesis.go b/x/ugov/genesis.go index 83ae7a6753..2a6fc00104 100644 --- a/x/ugov/genesis.go +++ b/x/ugov/genesis.go @@ -7,8 +7,8 @@ import ( // DefaultGenesis creates a default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - MinGasPrice: coin.UmeeDec("0.1"), - LiquidationParams: DefaultLiquidationParams(), + MinGasPrice: coin.UmeeDec("0.1"), + InflationParams: DefaultInflationParams(), } } @@ -17,5 +17,5 @@ func (gs *GenesisState) Validate() error { return err } - return gs.LiquidationParams.Validate() + return gs.InflationParams.Validate() } diff --git a/x/ugov/genesis.pb.go b/x/ugov/genesis.pb.go index 486858a66a..2e3d416889 100644 --- a/x/ugov/genesis.pb.go +++ b/x/ugov/genesis.pb.go @@ -34,8 +34,8 @@ type GenesisState struct { MinGasPrice types.DecCoin `protobuf:"bytes,1,opt,name=min_gas_price,json=minGasPrice,proto3" json:"min_gas_price"` // Emergency Group address EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` - // LiquidationParams is params for new liquidation inflation rate params for staking denoms - LiquidationParams LiquidationParams `protobuf:"bytes,3,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` + // InflationParams is params for inflation rate changes + InflationParams InflationParams `protobuf:"bytes,3,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` // Unix timestamp when the inflation cycle is started InflationCycleStartTime time.Time `protobuf:"bytes,4,opt,name=inflation_cycle_start_time,json=inflationCycleStartTime,proto3,stdtime" json:"inflation_cycle_start_time"` } @@ -80,33 +80,33 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/genesis.proto", fileDescriptor_82f39cd8e8ede8c7) } var fileDescriptor_82f39cd8e8ede8c7 = []byte{ - // 414 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xcd, 0x6e, 0xd4, 0x30, - 0x14, 0x85, 0x93, 0x52, 0x21, 0x48, 0x0b, 0x88, 0xa8, 0x52, 0x43, 0x84, 0x9c, 0x8a, 0x05, 0xea, - 0xa6, 0xb6, 0x02, 0xe2, 0x01, 0x9a, 0x56, 0xcc, 0x86, 0x45, 0x35, 0xd3, 0x15, 0x9b, 0xc8, 0xf1, - 0xdc, 0x1a, 0x8b, 0xd8, 0x0e, 0xb6, 0x13, 0xe8, 0x5b, 0xf4, 0x61, 0x78, 0x88, 0x59, 0x56, 0x5d, - 0xb1, 0xe2, 0x67, 0xe6, 0x45, 0x90, 0x9d, 0xb4, 0xfc, 0xec, 0x7c, 0x75, 0xce, 0xfd, 0x7c, 0x7c, - 0x9c, 0xe4, 0xbd, 0x04, 0x20, 0x3d, 0xd7, 0x03, 0x19, 0x4a, 0xc2, 0x41, 0x81, 0x15, 0x16, 0x77, - 0x46, 0x3b, 0x9d, 0xee, 0x7a, 0x0d, 0x7b, 0x0d, 0x0f, 0x65, 0xbe, 0xc7, 0x35, 0xd7, 0x41, 0x20, - 0xfe, 0x34, 0x7a, 0x72, 0xc4, 0xb4, 0x95,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, 0x2e, 0xda, 0x91, - 0xc9, 0x2e, 0x59, 0x0b, 0xb5, 0x75, 0xd4, 0xb8, 0xda, 0xd7, 0x99, 0x6d, 0x07, 0x7a, 0x8e, 0xc7, - 0xae, 0xf1, 0x6d, 0xd7, 0xf8, 0xfc, 0xb6, 0xeb, 0xea, 0x81, 0x07, 0x5f, 0xfd, 0x28, 0xe2, 0xf9, - 0xfe, 0x1d, 0xe7, 0xc4, 0x63, 0x16, 0x9e, 0xe2, 0x7d, 0xd5, 0xe9, 0xea, 0x17, 0x8a, 0x56, 0x6b, - 0x14, 0x5f, 0xaf, 0x51, 0xfc, 0x73, 0x8d, 0xe2, 0xab, 0x0d, 0x8a, 0xae, 0x37, 0x28, 0xfa, 0xb6, - 0x41, 0xd1, 0xfb, 0x97, 0x5c, 0xb8, 0x0f, 0x7d, 0x83, 0x99, 0x96, 0xc4, 0x3f, 0xe2, 0x48, 0x81, - 0xfb, 0xac, 0xcd, 0xc7, 0x30, 0x90, 0xe1, 0x0d, 0xf9, 0x12, 0x3e, 0xa8, 0xb9, 0x1f, 0x2e, 0x7f, - 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x13, 0x66, 0x6e, 0x59, 0x58, 0x02, 0x00, 0x00, + // 412 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0x4f, 0x6e, 0xd4, 0x30, + 0x18, 0xc5, 0x93, 0x52, 0x21, 0x48, 0x0b, 0x45, 0x51, 0xa5, 0x86, 0x08, 0x3c, 0x15, 0x0b, 0xd4, + 0x4d, 0x6d, 0x05, 0xc4, 0x01, 0x9a, 0x56, 0x8c, 0xd8, 0xa0, 0x6a, 0x86, 0x15, 0x9b, 0xc8, 0x71, + 0xbf, 0x1a, 0x8b, 0xb1, 0x1d, 0xd9, 0x4e, 0xa0, 0xb7, 0xe8, 0x61, 0x38, 0xc4, 0x2c, 0x58, 0x8c, + 0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, 0x38, 0xc0, 0xce, 0xae, 0xae, 0x0c, 0x58, 0x3b, 0x75, 0x46, + 0x28, 0x3e, 0x79, 0xbc, 0x59, 0x18, 0x7b, 0x7f, 0xfa, 0x3e, 0x79, 0x22, 0xd4, 0xf5, 0x8c, 0x3a, + 0xa1, 0x55, 0xd5, 0x50, 0x43, 0xa5, 0xcd, 0xee, 0x85, 0x34, 0xcf, 0xf1, 0xdd, 0x3e, 0xf1, 0xbb, + 0xb5, 0xeb, 0x32, 0x98, 0x86, 0x38, 0x07, 0x62, 0xfb, 0x77, 0x4a, 0x93, 0xfc, 0x3f, 0x8f, 0xdd, + 0xb0, 0x19, 0x54, 0xd6, 0x51, 0xe3, 0x2a, 0x5f, 0x64, 0xb6, 0x1b, 0xc8, 0x39, 0xee, 0x5b, 0xc6, + 0xeb, 0x96, 0xf1, 0x87, 0x75, 0xcb, 0xe5, 0x03, 0x8f, 0xbd, 0xfd, 0x3d, 0x8a, 0x27, 0x47, 0x1b, + 0xce, 0xb9, 0xc7, 0x4c, 0x3d, 0xc5, 0xfb, 0xca, 0x8b, 0xf9, 0x5f, 0x14, 0xcd, 0x97, 0x28, 0x5e, + 0x2c, 0x51, 0xfc, 0x67, 0x89, 0xe2, 0xdb, 0x15, 0x8a, 0x16, 0x2b, 0x14, 0xfd, 0x5c, 0xa1, 0xe8, + 0xe3, 0x4b, 0x2e, 0xdc, 0xa7, 0xb6, 0xc6, 0x4c, 0x4b, 0xe2, 0x2f, 0x70, 0xaa, 0xc0, 0x7d, 0xd1, + 0xe6, 0x73, 0x18, 0x48, 0xf7, 0x86, 0x7c, 0x0d, 0x4f, 0x53, 0xdf, 0x0f, 0x87, 0xbf, 0xfe, 0x17, + 0x00, 0x00, 0xff, 0xff, 0x55, 0xec, 0x79, 0x6c, 0x52, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -138,7 +138,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 { - size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.InflationParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -190,7 +190,7 @@ func (m *GenesisState) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } - l = m.LiquidationParams.Size() + l = m.InflationParams.Size() n += 1 + l + sovGenesis(uint64(l)) l = github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStartTime) n += 1 + l + sovGenesis(uint64(l)) @@ -299,7 +299,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidationParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -326,7 +326,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LiquidationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.InflationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/keeper/genesis.go b/x/ugov/keeper/genesis.go index dc853d6b59..e88403704a 100644 --- a/x/ugov/keeper/genesis.go +++ b/x/ugov/keeper/genesis.go @@ -10,7 +10,7 @@ func (k Keeper) ExportGenesis() *ugov.GenesisState { util.Panic(err) return &ugov.GenesisState{ MinGasPrice: k.MinGasPrice(), - LiquidationParams: k.LiquidationParams(), + InflationParams: k.InflationParams(), InflationCycleStartTime: *lcst, } } @@ -20,7 +20,7 @@ func (k Keeper) InitGenesis(gs *ugov.GenesisState) error { return err } - if err := k.SetLiquidationParams(gs.LiquidationParams); err != nil { + if err := k.SetInflationParams(gs.InflationParams); err != nil { return err } diff --git a/x/ugov/keeper/keys.go b/x/ugov/keeper/keys.go index d99422108b..0368f3e759 100644 --- a/x/ugov/keeper/keys.go +++ b/x/ugov/keeper/keys.go @@ -4,6 +4,6 @@ package keeper var ( keyMinGasPrice = []byte{0x01} keyEmergencyGroup = []byte{0x02} - KeyLiquidationParams = []byte{0x03} + KeyInflationParams = []byte{0x03} KeyInflationCycleStartTime = []byte{0x04} ) diff --git a/x/ugov/keeper/msg_server.go b/x/ugov/keeper/msg_server.go index 2ef62b5e61..5a56e9c168 100644 --- a/x/ugov/keeper/msg_server.go +++ b/x/ugov/keeper/msg_server.go @@ -54,18 +54,19 @@ func (m msgServer) GovSetEmergencyGroup(ctx context.Context, msg *ugov.MsgGovSet return &ugov.MsgGovSetEmergencyGroupResponse{}, nil } -// GovUpdateLiquidationParams implements ugov.MsgServer. -func (m msgServer) GovUpdateLiquidationParams(ctx context.Context, msg *ugov.MsgGovUpdateLiquidationParams) ( - *ugov.GovUpdateLiquidationParamsResponse, error) { +// GovUpdateInflationParams implements ugov.MsgServer. +func (m msgServer) GovUpdateInflationParams(ctx context.Context, msg *ugov.MsgGovUpdateInflationParams) ( + *ugov.GovUpdateInflationParamsResponse, error) { + sdkCtx, err := sdkutil.StartMsg(ctx, msg) if err != nil { return nil, err } - err = m.kb.Keeper(&sdkCtx).SetLiquidationParams(msg.LiquidationParams) + err = m.kb.Keeper(&sdkCtx).SetInflationParams(msg.InflationParams) if err != nil { return nil, err } - return &ugov.GovUpdateLiquidationParamsResponse{}, nil + return &ugov.GovUpdateInflationParamsResponse{}, nil } diff --git a/x/ugov/keeper/params.go b/x/ugov/keeper/params.go index 1c4b689072..f5136c0722 100644 --- a/x/ugov/keeper/params.go +++ b/x/ugov/keeper/params.go @@ -30,14 +30,14 @@ func (k Keeper) EmergencyGroup() sdk.AccAddress { return store.GetAddress(k.store, keyEmergencyGroup) } -func (k Keeper) SetLiquidationParams(lp ugov.LiquidationParams) error { - return store.SetValue(k.store, KeyLiquidationParams, &lp, "liquidation_params") +func (k Keeper) SetInflationParams(lp ugov.InflationParams) error { + return store.SetValue(k.store, KeyInflationParams, &lp, "liquidation_params") } -func (k Keeper) LiquidationParams() ugov.LiquidationParams { - lp := store.GetValue[*ugov.LiquidationParams](k.store, KeyLiquidationParams, "liquidation_params") +func (k Keeper) InflationParams() ugov.InflationParams { + lp := store.GetValue[*ugov.InflationParams](k.store, KeyInflationParams, "liquidation_params") if lp == nil { - return ugov.LiquidationParams{} + return ugov.InflationParams{} } return *lp } diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index 766023fbe1..0dc40e9c2e 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -43,12 +43,12 @@ func TestLiquidationParams(t *testing.T) { require := require.New(t) k := initKeeper(t) - require.Equal(k.LiquidationParams(), ugov.LiquidationParams{}, - "when nothing is set, empty address should be returned") + require.Equal(k.InflationParams(), ugov.InflationParams{}, + "when nothing is set, empty inflationp params should return") - dlp := ugov.DefaultLiquidationParams() - k.SetLiquidationParams(dlp) - rlp := k.LiquidationParams() + dlp := ugov.DefaultInflationParams() + k.SetInflationParams(dlp) + rlp := k.InflationParams() require.Equal(rlp, dlp) require.Equal(rlp.MaxSupply.GetDenom(), appparams.BondDenom) } diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index 722f4a4a10..133184a570 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -30,11 +30,11 @@ func (q Querier) EmergencyGroup(ctx context.Context, _ *ugov.QueryEmergencyGroup return &ugov.QueryEmergencyGroupResponse{EmergencyGroup: q.Keeper(&sdkCtx).EmergencyGroup().String()}, nil } -// LiquidationParams returns liquidation params -func (q Querier) LiquidationParams(ctx context.Context, _ *ugov.QueryLiquidationParams) ( - *ugov.QueryLiquidationParamsResponse, error) { +// InflationParams returns inflation rate change params +func (q Querier) InflationParams(ctx context.Context, _ *ugov.QueryInflationParams) ( + *ugov.QueryInflationParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - return &ugov.QueryLiquidationParamsResponse{LiquidationParams: q.Keeper(&sdkCtx).LiquidationParams()}, nil + return &ugov.QueryInflationParamsResponse{InflationParams: q.Keeper(&sdkCtx).InflationParams()}, nil } // InflationCycleStartTime return when the inflation cycle is started diff --git a/x/ugov/liquidation_params.go b/x/ugov/liquidation_params.go index 9fab211f95..8ec54d0758 100644 --- a/x/ugov/liquidation_params.go +++ b/x/ugov/liquidation_params.go @@ -18,15 +18,15 @@ var ( DefaultInflationReductionRate = sdk.MustNewDecFromStr("0.25") ) -func DefaultLiquidationParams() LiquidationParams { - return LiquidationParams{ +func DefaultInflationParams() InflationParams { + return InflationParams{ MaxSupply: DefaultMaxSupply, InflationCycleDuration: DefaultInflationCycleDuration, InflationReductionRate: DefaultInflationReductionRate, } } -func (lp LiquidationParams) Validate() error { +func (lp InflationParams) Validate() error { if lp.MaxSupply.Amount.LT(math.NewInt(0)) { return fmt.Errorf("%s must be not negative: %s", "max_supply", lp.MaxSupply.Amount.String()) } diff --git a/x/ugov/msg.go b/x/ugov/msg.go index 26510f4b1e..a7acecd234 100644 --- a/x/ugov/msg.go +++ b/x/ugov/msg.go @@ -10,10 +10,10 @@ import ( ) var ( - _, _, _ sdk.Msg = &MsgGovUpdateMinGasPrice{}, &MsgGovSetEmergencyGroup{}, &MsgGovUpdateLiquidationParams{} + _, _, _ sdk.Msg = &MsgGovUpdateMinGasPrice{}, &MsgGovSetEmergencyGroup{}, &MsgGovUpdateInflationParams{} // amino - _, _, _ legacytx.LegacyMsg = &MsgGovUpdateMinGasPrice{}, &MsgGovSetEmergencyGroup{}, &MsgGovUpdateLiquidationParams{} + _, _, _ legacytx.LegacyMsg = &MsgGovUpdateMinGasPrice{}, &MsgGovSetEmergencyGroup{}, &MsgGovUpdateInflationParams{} ) // ValidateBasic implements Msg @@ -71,27 +71,27 @@ func (msg MsgGovSetEmergencyGroup) GetSignBytes() []byte { func (msg MsgGovSetEmergencyGroup) Type() string { return sdk.MsgTypeURL(&msg) } // -// MsgGovUpdateLiquidationParams +// MsgGovUpdateInflationParams // // Msg interface implementation -func (msg *MsgGovUpdateLiquidationParams) ValidateBasic() error { +func (msg *MsgGovUpdateInflationParams) ValidateBasic() error { if err := checkers.IsGovAuthority(msg.Authority); err != nil { return err } - return msg.LiquidationParams.Validate() + return msg.InflationParams.Validate() } // GetSignBytes implements Msg -func (msg *MsgGovUpdateLiquidationParams) GetSigners() []sdk.AccAddress { +func (msg *MsgGovUpdateInflationParams) GetSigners() []sdk.AccAddress { return checkers.Signers(msg.Authority) } // LegacyMsg.Type implementations -func (msg MsgGovUpdateLiquidationParams) Route() string { return "" } +func (msg MsgGovUpdateInflationParams) Route() string { return "" } -func (msg MsgGovUpdateLiquidationParams) GetSignBytes() []byte { +func (msg MsgGovUpdateInflationParams) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) } -func (msg MsgGovUpdateLiquidationParams) Type() string { return sdk.MsgTypeURL(&msg) } +func (msg MsgGovUpdateInflationParams) Type() string { return sdk.MsgTypeURL(&msg) } diff --git a/x/ugov/query.pb.go b/x/ugov/query.pb.go index 5442d80abb..89794af742 100644 --- a/x/ugov/query.pb.go +++ b/x/ugov/query.pb.go @@ -185,22 +185,22 @@ func (m *QueryEmergencyGroupResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEmergencyGroupResponse proto.InternalMessageInfo -// QueryLiquidationParams request type. -type QueryLiquidationParams struct { +// QueryInflationParams request type. +type QueryInflationParams struct { } -func (m *QueryLiquidationParams) Reset() { *m = QueryLiquidationParams{} } -func (m *QueryLiquidationParams) String() string { return proto.CompactTextString(m) } -func (*QueryLiquidationParams) ProtoMessage() {} -func (*QueryLiquidationParams) Descriptor() ([]byte, []int) { +func (m *QueryInflationParams) Reset() { *m = QueryInflationParams{} } +func (m *QueryInflationParams) String() string { return proto.CompactTextString(m) } +func (*QueryInflationParams) ProtoMessage() {} +func (*QueryInflationParams) Descriptor() ([]byte, []int) { return fileDescriptor_25fa04679024a47d, []int{4} } -func (m *QueryLiquidationParams) XXX_Unmarshal(b []byte) error { +func (m *QueryInflationParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryLiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryInflationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryLiquidationParams.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryInflationParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -210,35 +210,35 @@ func (m *QueryLiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryLiquidationParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLiquidationParams.Merge(m, src) +func (m *QueryInflationParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryInflationParams.Merge(m, src) } -func (m *QueryLiquidationParams) XXX_Size() int { +func (m *QueryInflationParams) XXX_Size() int { return m.Size() } -func (m *QueryLiquidationParams) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLiquidationParams.DiscardUnknown(m) +func (m *QueryInflationParams) XXX_DiscardUnknown() { + xxx_messageInfo_QueryInflationParams.DiscardUnknown(m) } -var xxx_messageInfo_QueryLiquidationParams proto.InternalMessageInfo +var xxx_messageInfo_QueryInflationParams proto.InternalMessageInfo -// QueryLiquidationParamsResponse response type. -type QueryLiquidationParamsResponse struct { - LiquidationParams LiquidationParams `protobuf:"bytes,1,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` +// QueryInflationParamsResponse response type. +type QueryInflationParamsResponse struct { + InflationParams InflationParams `protobuf:"bytes,1,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` } -func (m *QueryLiquidationParamsResponse) Reset() { *m = QueryLiquidationParamsResponse{} } -func (m *QueryLiquidationParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLiquidationParamsResponse) ProtoMessage() {} -func (*QueryLiquidationParamsResponse) Descriptor() ([]byte, []int) { +func (m *QueryInflationParamsResponse) Reset() { *m = QueryInflationParamsResponse{} } +func (m *QueryInflationParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryInflationParamsResponse) ProtoMessage() {} +func (*QueryInflationParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_25fa04679024a47d, []int{5} } -func (m *QueryLiquidationParamsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryInflationParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryLiquidationParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryInflationParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryLiquidationParamsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryInflationParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -248,17 +248,17 @@ func (m *QueryLiquidationParamsResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryLiquidationParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLiquidationParamsResponse.Merge(m, src) +func (m *QueryInflationParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryInflationParamsResponse.Merge(m, src) } -func (m *QueryLiquidationParamsResponse) XXX_Size() int { +func (m *QueryInflationParamsResponse) XXX_Size() int { return m.Size() } -func (m *QueryLiquidationParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLiquidationParamsResponse.DiscardUnknown(m) +func (m *QueryInflationParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryInflationParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryLiquidationParamsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryInflationParamsResponse proto.InternalMessageInfo // QueryInflationCycleStartTime request type. type QueryInflationCycleStartTime struct { @@ -340,8 +340,8 @@ func init() { proto.RegisterType((*QueryMinGasPriceResponse)(nil), "umee.ugov.v1.QueryMinGasPriceResponse") proto.RegisterType((*QueryEmergencyGroup)(nil), "umee.ugov.v1.QueryEmergencyGroup") proto.RegisterType((*QueryEmergencyGroupResponse)(nil), "umee.ugov.v1.QueryEmergencyGroupResponse") - proto.RegisterType((*QueryLiquidationParams)(nil), "umee.ugov.v1.QueryLiquidationParams") - proto.RegisterType((*QueryLiquidationParamsResponse)(nil), "umee.ugov.v1.QueryLiquidationParamsResponse") + proto.RegisterType((*QueryInflationParams)(nil), "umee.ugov.v1.QueryInflationParams") + proto.RegisterType((*QueryInflationParamsResponse)(nil), "umee.ugov.v1.QueryInflationParamsResponse") proto.RegisterType((*QueryInflationCycleStartTime)(nil), "umee.ugov.v1.QueryInflationCycleStartTime") proto.RegisterType((*QueryInflationCycleStartTimeResponse)(nil), "umee.ugov.v1.QueryInflationCycleStartTimeResponse") } @@ -349,47 +349,46 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/query.proto", fileDescriptor_25fa04679024a47d) } var fileDescriptor_25fa04679024a47d = []byte{ - // 628 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x4f, 0xd4, 0x4e, - 0x1c, 0xc6, 0xb7, 0xbf, 0xf0, 0x33, 0x3a, 0x28, 0xca, 0x88, 0xb2, 0x16, 0xe8, 0x62, 0x45, 0x82, - 0xc6, 0xce, 0x64, 0x31, 0xbe, 0x00, 0x16, 0x94, 0x98, 0x68, 0x82, 0x0b, 0x27, 0x2f, 0x75, 0x5a, - 0x86, 0x3a, 0x71, 0x3b, 0x53, 0x3a, 0x6d, 0x15, 0x8f, 0x26, 0x1e, 0xbc, 0x61, 0x7c, 0x03, 0xbe, - 0x08, 0x5f, 0x81, 0xa7, 0x3d, 0x12, 0xbd, 0x78, 0x42, 0x05, 0x5f, 0x88, 0xe9, 0xf4, 0x8f, 0x5b, - 0xb6, 0xfc, 0xb9, 0xed, 0xcc, 0xf3, 0xec, 0xf7, 0x79, 0xbe, 0xd3, 0x0f, 0x68, 0xc6, 0x3e, 0xa5, - 0x38, 0xf6, 0x44, 0x82, 0x93, 0x36, 0xde, 0x8e, 0x69, 0xb8, 0x83, 0x82, 0x50, 0x44, 0x02, 0x5e, - 0x4c, 0x15, 0x94, 0x2a, 0x28, 0x69, 0xeb, 0x86, 0x2b, 0xa4, 0x2f, 0x24, 0x76, 0x88, 0xa4, 0x38, - 0x69, 0x3b, 0x34, 0x22, 0x6d, 0xec, 0x0a, 0xc6, 0x33, 0xb7, 0x7e, 0x23, 0xd3, 0x6d, 0x75, 0xc2, - 0xd9, 0x21, 0x97, 0x26, 0x3c, 0xe1, 0x89, 0xec, 0x3e, 0xfd, 0x95, 0xdf, 0x4e, 0x7b, 0x42, 0x78, - 0x3d, 0x8a, 0x49, 0xc0, 0x30, 0xe1, 0x5c, 0x44, 0x24, 0x62, 0x82, 0x17, 0xff, 0x69, 0xe5, 0xaa, - 0x3a, 0x39, 0xf1, 0x16, 0x8e, 0x98, 0x4f, 0x65, 0x44, 0xfc, 0x20, 0x37, 0x4c, 0x56, 0x7a, 0xab, - 0x96, 0x4a, 0x30, 0x21, 0xb8, 0xf2, 0x2c, 0xdd, 0xe2, 0x29, 0xe3, 0xab, 0x44, 0xae, 0x85, 0xcc, - 0xa5, 0xa6, 0x03, 0x9a, 0x47, 0xef, 0xba, 0x54, 0x06, 0x82, 0x4b, 0x0a, 0x1f, 0x81, 0x4b, 0x3e, - 0xe3, 0xb6, 0x47, 0xd2, 0xee, 0xcc, 0xa5, 0x4d, 0x6d, 0x56, 0x5b, 0x18, 0x5d, 0x9c, 0x46, 0xf9, - 0x0e, 0xe9, 0xc2, 0x28, 0x5f, 0x18, 0xad, 0x50, 0x77, 0x59, 0x30, 0xde, 0x19, 0xe9, 0xef, 0xb7, - 0x1a, 0xdd, 0x51, 0x7f, 0x20, 0xe3, 0x1a, 0xb8, 0xaa, 0x32, 0x1e, 0xfa, 0x34, 0xf4, 0x28, 0x77, - 0x77, 0x56, 0x43, 0x11, 0x07, 0xe6, 0x0b, 0x30, 0x55, 0x73, 0x5d, 0xa6, 0x2f, 0x81, 0xcb, 0xb4, - 0x50, 0x6c, 0x2f, 0x95, 0x54, 0xfe, 0x85, 0x4e, 0xf3, 0xdb, 0x17, 0x6b, 0x22, 0xaf, 0xb0, 0xb4, - 0xb9, 0x19, 0x52, 0x29, 0xd7, 0xa3, 0x90, 0x71, 0xaf, 0x3b, 0x46, 0xab, 0x09, 0x4d, 0x70, 0x5d, - 0x25, 0x3c, 0x61, 0xdb, 0x31, 0xdb, 0x54, 0xaf, 0xb8, 0x46, 0x42, 0xe2, 0x4b, 0x33, 0x01, 0x46, - 0xbd, 0x52, 0xc6, 0x6f, 0x00, 0xd8, 0xfb, 0x27, 0xda, 0x81, 0x52, 0xf3, 0x17, 0x68, 0xa1, 0x41, - 0x00, 0xd0, 0xd0, 0x90, 0xfc, 0x11, 0xc6, 0x7b, 0x43, 0xb9, 0x06, 0x98, 0x56, 0xb9, 0x8f, 0xf9, - 0x56, 0x4f, 0xdd, 0x2f, 0xef, 0xb8, 0x3d, 0xba, 0x1e, 0x91, 0x30, 0xda, 0x60, 0x3e, 0x35, 0x3f, - 0x68, 0x60, 0xee, 0x24, 0x43, 0x59, 0x8f, 0x00, 0x9d, 0x15, 0x16, 0xdb, 0x4d, 0x3d, 0xb6, 0x4c, - 0x4d, 0x76, 0x4a, 0x43, 0x5e, 0x53, 0x47, 0x19, 0x2a, 0xa8, 0x40, 0x05, 0x6d, 0x14, 0xa8, 0x74, - 0xce, 0xf7, 0xf7, 0x5b, 0xda, 0xee, 0xcf, 0x96, 0xd6, 0x9d, 0x64, 0xf5, 0x51, 0x8b, 0x5f, 0x47, - 0xc0, 0xff, 0xaa, 0x0b, 0x7c, 0x0b, 0x46, 0x07, 0xf8, 0x80, 0x46, 0x75, 0xfd, 0xa3, 0xfc, 0xe8, - 0xf3, 0x27, 0xeb, 0xc5, 0x0e, 0xe6, 0xad, 0x77, 0xdf, 0xff, 0x7c, 0xfa, 0x6f, 0x06, 0x4e, 0xe1, - 0x0a, 0xb1, 0x3e, 0xe3, 0x96, 0x47, 0xa4, 0xa5, 0x98, 0x83, 0xef, 0x35, 0x30, 0x56, 0x25, 0x04, - 0xde, 0xac, 0x99, 0x5f, 0xb5, 0xe8, 0x77, 0x4e, 0xb5, 0x94, 0x2d, 0x6e, 0xab, 0x16, 0x2d, 0x38, - 0x53, 0x6d, 0x51, 0xa2, 0x64, 0x29, 0xf6, 0xe0, 0x47, 0x0d, 0x8c, 0x0f, 0x7d, 0x68, 0x38, 0x57, - 0x93, 0x33, 0xe4, 0xd2, 0xef, 0x9d, 0xc5, 0x55, 0x16, 0x5a, 0x50, 0x85, 0x4c, 0x38, 0x5b, 0x2d, - 0x34, 0x00, 0x93, 0x95, 0xd1, 0x08, 0x3f, 0x6b, 0x60, 0xf2, 0x18, 0x50, 0xe0, 0xdd, 0x9a, 0xcc, - 0x63, 0xbc, 0xfa, 0xe2, 0xd9, 0xbd, 0xa7, 0x3d, 0x5b, 0x09, 0x93, 0xa5, 0xa0, 0xec, 0xac, 0xf4, - 0x7f, 0x1b, 0x8d, 0xfe, 0x81, 0xa1, 0xed, 0x1d, 0x18, 0xda, 0xaf, 0x03, 0x43, 0xdb, 0x3d, 0x34, - 0x1a, 0x7b, 0x87, 0x46, 0xe3, 0xc7, 0xa1, 0xd1, 0x78, 0x3e, 0xef, 0xb1, 0xe8, 0x65, 0xec, 0x20, - 0x57, 0xf8, 0x6a, 0x8c, 0xc5, 0x69, 0xf4, 0x5a, 0x84, 0xaf, 0xb2, 0x99, 0xc9, 0x03, 0xfc, 0x46, - 0x0d, 0x76, 0xce, 0x29, 0x82, 0xef, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x04, 0x2a, 0x75, 0xf5, - 0x93, 0x05, 0x00, 0x00, + // 613 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4f, 0x6f, 0xd3, 0x30, + 0x1c, 0x6d, 0xd0, 0x40, 0xe0, 0xc1, 0x36, 0x99, 0xc1, 0x4a, 0xb6, 0xa5, 0x23, 0xc0, 0x04, 0x48, + 0xb1, 0xd5, 0x21, 0x3e, 0xc0, 0xba, 0xc1, 0xc4, 0x01, 0x34, 0xba, 0x9d, 0xb8, 0x04, 0x27, 0xf3, + 0x82, 0x45, 0x63, 0x87, 0x38, 0x29, 0x94, 0x23, 0x12, 0x87, 0xdd, 0x26, 0xf1, 0x05, 0xf8, 0x10, + 0x9c, 0xf8, 0x04, 0x3d, 0x4e, 0x70, 0xe1, 0x34, 0xa0, 0xe5, 0x83, 0xa0, 0x38, 0x7f, 0xd6, 0x44, + 0xa5, 0xe5, 0x16, 0xff, 0xde, 0xcb, 0xef, 0xbd, 0x67, 0x3f, 0x50, 0x8f, 0x7d, 0x4a, 0x71, 0xec, + 0x89, 0x2e, 0xee, 0x36, 0xf1, 0x9b, 0x98, 0x86, 0x3d, 0x14, 0x84, 0x22, 0x12, 0xf0, 0x72, 0x82, + 0xa0, 0x04, 0x41, 0xdd, 0xa6, 0x6e, 0xb8, 0x42, 0xfa, 0x42, 0x62, 0x87, 0x48, 0x8a, 0xbb, 0x4d, + 0x87, 0x46, 0xa4, 0x89, 0x5d, 0xc1, 0x78, 0xca, 0xd6, 0x6f, 0xa4, 0xb8, 0xad, 0x4e, 0x38, 0x3d, + 0x64, 0xd0, 0xa2, 0x27, 0x3c, 0x91, 0xce, 0x93, 0xaf, 0x6c, 0xba, 0xe2, 0x09, 0xe1, 0x75, 0x28, + 0x26, 0x01, 0xc3, 0x84, 0x73, 0x11, 0x91, 0x88, 0x09, 0x9e, 0xff, 0xd3, 0xc8, 0x50, 0x75, 0x72, + 0xe2, 0x43, 0x1c, 0x31, 0x9f, 0xca, 0x88, 0xf8, 0x41, 0x46, 0x58, 0x2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xed, 0x64, 0x60, 0x68, 0xbf, 0x06, 0x86, 0x76, 0x3c, + 0x34, 0x6a, 0x27, 0x43, 0xa3, 0xf6, 0x63, 0x68, 0xd4, 0x5e, 0xac, 0x7b, 0x2c, 0x7a, 0x15, 0x3b, + 0xc8, 0x15, 0xbe, 0x5a, 0x63, 0x71, 0x1a, 0xbd, 0x15, 0xe1, 0xeb, 0x74, 0x67, 0xf7, 0x21, 0x7e, + 0xa7, 0x16, 0x3b, 0x17, 0x54, 0x73, 0x1f, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x12, 0x82, + 0x0a, 0x81, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -408,9 +407,9 @@ type QueryClient interface { MinGasPrice(ctx context.Context, in *QueryMinGasPrice, opts ...grpc.CallOption) (*QueryMinGasPriceResponse, error) // EmergencyGroup returns emergency group address EmergencyGroup(ctx context.Context, in *QueryEmergencyGroup, opts ...grpc.CallOption) (*QueryEmergencyGroupResponse, error) - // LiquidationParams - LiquidationParams(ctx context.Context, in *QueryLiquidationParams, opts ...grpc.CallOption) (*QueryLiquidationParamsResponse, error) - // InflationCycleStartTime returns when inflation cycle is started + // InflationParams returns params of inflation reduction rates + InflationParams(ctx context.Context, in *QueryInflationParams, opts ...grpc.CallOption) (*QueryInflationParamsResponse, error) + // InflationCycleStartTime returns inflation cycle start time InflationCycleStartTime(ctx context.Context, in *QueryInflationCycleStartTime, opts ...grpc.CallOption) (*QueryInflationCycleStartTimeResponse, error) } @@ -440,9 +439,9 @@ func (c *queryClient) EmergencyGroup(ctx context.Context, in *QueryEmergencyGrou return out, nil } -func (c *queryClient) LiquidationParams(ctx context.Context, in *QueryLiquidationParams, opts ...grpc.CallOption) (*QueryLiquidationParamsResponse, error) { - out := new(QueryLiquidationParamsResponse) - err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/LiquidationParams", in, out, opts...) +func (c *queryClient) InflationParams(ctx context.Context, in *QueryInflationParams, opts ...grpc.CallOption) (*QueryInflationParamsResponse, error) { + out := new(QueryInflationParamsResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/InflationParams", in, out, opts...) if err != nil { return nil, err } @@ -464,9 +463,9 @@ type QueryServer interface { MinGasPrice(context.Context, *QueryMinGasPrice) (*QueryMinGasPriceResponse, error) // EmergencyGroup returns emergency group address EmergencyGroup(context.Context, *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) - // LiquidationParams - LiquidationParams(context.Context, *QueryLiquidationParams) (*QueryLiquidationParamsResponse, error) - // InflationCycleStartTime returns when inflation cycle is started + // InflationParams returns params of inflation reduction rates + InflationParams(context.Context, *QueryInflationParams) (*QueryInflationParamsResponse, error) + // InflationCycleStartTime returns inflation cycle start time InflationCycleStartTime(context.Context, *QueryInflationCycleStartTime) (*QueryInflationCycleStartTimeResponse, error) } @@ -480,8 +479,8 @@ func (*UnimplementedQueryServer) MinGasPrice(ctx context.Context, req *QueryMinG func (*UnimplementedQueryServer) EmergencyGroup(ctx context.Context, req *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EmergencyGroup not implemented") } -func (*UnimplementedQueryServer) LiquidationParams(ctx context.Context, req *QueryLiquidationParams) (*QueryLiquidationParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LiquidationParams not implemented") +func (*UnimplementedQueryServer) InflationParams(ctx context.Context, req *QueryInflationParams) (*QueryInflationParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InflationParams not implemented") } func (*UnimplementedQueryServer) InflationCycleStartTime(ctx context.Context, req *QueryInflationCycleStartTime) (*QueryInflationCycleStartTimeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InflationCycleStartTime not implemented") @@ -527,20 +526,20 @@ func _Query_EmergencyGroup_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _Query_LiquidationParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLiquidationParams) +func _Query_InflationParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryInflationParams) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).LiquidationParams(ctx, in) + return srv.(QueryServer).InflationParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/umee.ugov.v1.Query/LiquidationParams", + FullMethod: "/umee.ugov.v1.Query/InflationParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LiquidationParams(ctx, req.(*QueryLiquidationParams)) + return srv.(QueryServer).InflationParams(ctx, req.(*QueryInflationParams)) } return interceptor(ctx, in, info, handler) } @@ -576,8 +575,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_EmergencyGroup_Handler, }, { - MethodName: "LiquidationParams", - Handler: _Query_LiquidationParams_Handler, + MethodName: "InflationParams", + Handler: _Query_InflationParams_Handler, }, { MethodName: "InflationCycleStartTime", @@ -697,7 +696,7 @@ func (m *QueryEmergencyGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *QueryLiquidationParams) Marshal() (dAtA []byte, err error) { +func (m *QueryInflationParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -707,12 +706,12 @@ func (m *QueryLiquidationParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLiquidationParams) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryInflationParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryInflationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -720,7 +719,7 @@ func (m *QueryLiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryLiquidationParamsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryInflationParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -730,18 +729,18 @@ func (m *QueryLiquidationParamsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLiquidationParamsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryInflationParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLiquidationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryInflationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.InflationParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -862,7 +861,7 @@ func (m *QueryEmergencyGroupResponse) Size() (n int) { return n } -func (m *QueryLiquidationParams) Size() (n int) { +func (m *QueryInflationParams) Size() (n int) { if m == nil { return 0 } @@ -871,13 +870,13 @@ func (m *QueryLiquidationParams) Size() (n int) { return n } -func (m *QueryLiquidationParamsResponse) Size() (n int) { +func (m *QueryInflationParamsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.LiquidationParams.Size() + l = m.InflationParams.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -1175,7 +1174,7 @@ func (m *QueryEmergencyGroupResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLiquidationParams) Unmarshal(dAtA []byte) error { +func (m *QueryInflationParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1198,10 +1197,10 @@ func (m *QueryLiquidationParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLiquidationParams: wiretype end group for non-group") + return fmt.Errorf("proto: QueryInflationParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLiquidationParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryInflationParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1225,7 +1224,7 @@ func (m *QueryLiquidationParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLiquidationParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryInflationParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1248,15 +1247,15 @@ func (m *QueryLiquidationParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLiquidationParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryInflationParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLiquidationParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryInflationParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidationParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1283,7 +1282,7 @@ func (m *QueryLiquidationParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LiquidationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.InflationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/query.pb.gw.go b/x/ugov/query.pb.gw.go index 587bff035f..b6c40dcdce 100644 --- a/x/ugov/query.pb.gw.go +++ b/x/ugov/query.pb.gw.go @@ -69,20 +69,20 @@ func local_request_Query_EmergencyGroup_0(ctx context.Context, marshaler runtime } -func request_Query_LiquidationParams_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLiquidationParams +func request_Query_InflationParams_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInflationParams var metadata runtime.ServerMetadata - msg, err := client.LiquidationParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.InflationParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_LiquidationParams_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLiquidationParams +func local_request_Query_InflationParams_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInflationParams var metadata runtime.ServerMetadata - msg, err := server.LiquidationParams(ctx, &protoReq) + msg, err := server.InflationParams(ctx, &protoReq) return msg, metadata, err } @@ -157,7 +157,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_LiquidationParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InflationParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -168,7 +168,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_LiquidationParams_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_InflationParams_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -176,7 +176,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_LiquidationParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InflationParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -284,7 +284,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_LiquidationParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InflationParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -293,14 +293,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_LiquidationParams_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_InflationParams_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_LiquidationParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InflationParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -332,7 +332,7 @@ var ( pattern_Query_EmergencyGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "emergency-group"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_LiquidationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "liquidation-params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_InflationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation-params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_InflationCycleStartTime_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation-cycle"}, "", runtime.AssumeColonVerbOpt(false))) ) @@ -342,7 +342,7 @@ var ( forward_Query_EmergencyGroup_0 = runtime.ForwardResponseMessage - forward_Query_LiquidationParams_0 = runtime.ForwardResponseMessage + forward_Query_InflationParams_0 = runtime.ForwardResponseMessage forward_Query_InflationCycleStartTime_0 = runtime.ForwardResponseMessage ) diff --git a/x/ugov/tx.pb.go b/x/ugov/tx.pb.go index 660cd9a37c..d137eaaa0c 100644 --- a/x/ugov/tx.pb.go +++ b/x/ugov/tx.pb.go @@ -184,25 +184,25 @@ func (m *MsgGovSetEmergencyGroupResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGovSetEmergencyGroupResponse proto.InternalMessageInfo -// MsgGovUpdateLiquidationParams request type. -type MsgGovUpdateLiquidationParams struct { +// MsgGovUpdateInflationParams request type. +type MsgGovUpdateInflationParams struct { // authority must be the address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - LiquidationParams LiquidationParams `protobuf:"bytes,2,opt,name=liquidation_params,json=liquidationParams,proto3" json:"liquidation_params"` + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + InflationParams InflationParams `protobuf:"bytes,2,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` } -func (m *MsgGovUpdateLiquidationParams) Reset() { *m = MsgGovUpdateLiquidationParams{} } -func (m *MsgGovUpdateLiquidationParams) String() string { return proto.CompactTextString(m) } -func (*MsgGovUpdateLiquidationParams) ProtoMessage() {} -func (*MsgGovUpdateLiquidationParams) Descriptor() ([]byte, []int) { +func (m *MsgGovUpdateInflationParams) Reset() { *m = MsgGovUpdateInflationParams{} } +func (m *MsgGovUpdateInflationParams) String() string { return proto.CompactTextString(m) } +func (*MsgGovUpdateInflationParams) ProtoMessage() {} +func (*MsgGovUpdateInflationParams) Descriptor() ([]byte, []int) { return fileDescriptor_9ffc07de1c6ee91b, []int{4} } -func (m *MsgGovUpdateLiquidationParams) XXX_Unmarshal(b []byte) error { +func (m *MsgGovUpdateInflationParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgGovUpdateLiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgGovUpdateInflationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgGovUpdateLiquidationParams.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgGovUpdateInflationParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -212,34 +212,34 @@ func (m *MsgGovUpdateLiquidationParams) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *MsgGovUpdateLiquidationParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgGovUpdateLiquidationParams.Merge(m, src) +func (m *MsgGovUpdateInflationParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgGovUpdateInflationParams.Merge(m, src) } -func (m *MsgGovUpdateLiquidationParams) XXX_Size() int { +func (m *MsgGovUpdateInflationParams) XXX_Size() int { return m.Size() } -func (m *MsgGovUpdateLiquidationParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgGovUpdateLiquidationParams.DiscardUnknown(m) +func (m *MsgGovUpdateInflationParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgGovUpdateInflationParams.DiscardUnknown(m) } -var xxx_messageInfo_MsgGovUpdateLiquidationParams proto.InternalMessageInfo +var xxx_messageInfo_MsgGovUpdateInflationParams proto.InternalMessageInfo -// GovUpdateLiquidationParamsResponse response type. -type GovUpdateLiquidationParamsResponse struct { +// GovUpdateInflationParamsResponse response type. +type GovUpdateInflationParamsResponse struct { } -func (m *GovUpdateLiquidationParamsResponse) Reset() { *m = GovUpdateLiquidationParamsResponse{} } -func (m *GovUpdateLiquidationParamsResponse) String() string { return proto.CompactTextString(m) } -func (*GovUpdateLiquidationParamsResponse) ProtoMessage() {} -func (*GovUpdateLiquidationParamsResponse) Descriptor() ([]byte, []int) { +func (m *GovUpdateInflationParamsResponse) Reset() { *m = GovUpdateInflationParamsResponse{} } +func (m *GovUpdateInflationParamsResponse) String() string { return proto.CompactTextString(m) } +func (*GovUpdateInflationParamsResponse) ProtoMessage() {} +func (*GovUpdateInflationParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9ffc07de1c6ee91b, []int{5} } -func (m *GovUpdateLiquidationParamsResponse) XXX_Unmarshal(b []byte) error { +func (m *GovUpdateInflationParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GovUpdateLiquidationParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GovUpdateInflationParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GovUpdateLiquidationParamsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_GovUpdateInflationParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -249,63 +249,63 @@ func (m *GovUpdateLiquidationParamsResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *GovUpdateLiquidationParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GovUpdateLiquidationParamsResponse.Merge(m, src) +func (m *GovUpdateInflationParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GovUpdateInflationParamsResponse.Merge(m, src) } -func (m *GovUpdateLiquidationParamsResponse) XXX_Size() int { +func (m *GovUpdateInflationParamsResponse) XXX_Size() int { return m.Size() } -func (m *GovUpdateLiquidationParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GovUpdateLiquidationParamsResponse.DiscardUnknown(m) +func (m *GovUpdateInflationParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GovUpdateInflationParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_GovUpdateLiquidationParamsResponse proto.InternalMessageInfo +var xxx_messageInfo_GovUpdateInflationParamsResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgGovUpdateMinGasPrice)(nil), "umee.ugov.v1.MsgGovUpdateMinGasPrice") proto.RegisterType((*MsgGovUpdateMinGasPriceResponse)(nil), "umee.ugov.v1.MsgGovUpdateMinGasPriceResponse") proto.RegisterType((*MsgGovSetEmergencyGroup)(nil), "umee.ugov.v1.MsgGovSetEmergencyGroup") proto.RegisterType((*MsgGovSetEmergencyGroupResponse)(nil), "umee.ugov.v1.MsgGovSetEmergencyGroupResponse") - proto.RegisterType((*MsgGovUpdateLiquidationParams)(nil), "umee.ugov.v1.MsgGovUpdateLiquidationParams") - proto.RegisterType((*GovUpdateLiquidationParamsResponse)(nil), "umee.ugov.v1.GovUpdateLiquidationParamsResponse") + proto.RegisterType((*MsgGovUpdateInflationParams)(nil), "umee.ugov.v1.MsgGovUpdateInflationParams") + proto.RegisterType((*GovUpdateInflationParamsResponse)(nil), "umee.ugov.v1.GovUpdateInflationParamsResponse") } func init() { proto.RegisterFile("umee/ugov/v1/tx.proto", fileDescriptor_9ffc07de1c6ee91b) } var fileDescriptor_9ffc07de1c6ee91b = []byte{ - // 512 bytes of a gzipped FileDescriptorProto + // 510 bytes of a gzipped FileDescriptorProto 0x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 0x15, 0xce, 0xcf, 0x8b, 0x40, 0xb9, 0x70, 0x76, 0x0f, 0x8a, 0x8d, 0x9f, 0x83, + 0x56, 0x60, 0x1e, 0xfa, 0xbf, 0x5f, 0xdb, 0xda, 0x19, 0xfe, 0xf6, 0x9d, 0xe1, 0xc8, 0x77, 0x8f, + 0x47, 0xbe, 0xfb, 0x6b, 0xe4, 0xbb, 0x1f, 0xc6, 0xbe, 0x73, 0x3c, 0xf6, 0x9d, 0x93, 0xb1, 0xef, + 0xbc, 0xbe, 0x4f, 0x99, 0xd9, 0x8f, 0xfa, 0x30, 0x90, 0x1c, 0x25, 0xbc, 0x0d, 0x41, 0xcc, 0x3b, + 0xa9, 0xde, 0xa6, 0x07, 0x14, 0x3f, 0x46, 0x87, 0xe9, 0xfb, 0xd0, 0xbf, 0x92, 0x3e, 0x10, 0x8f, + 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x3a, 0x00, 0x74, 0x14, 0xca, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -324,8 +324,8 @@ type MsgClient interface { GovUpdateMinGasPrice(ctx context.Context, in *MsgGovUpdateMinGasPrice, opts ...grpc.CallOption) (*MsgGovUpdateMinGasPriceResponse, error) // GovSetEmergencyGroup sets emergency group address. GovSetEmergencyGroup(ctx context.Context, in *MsgGovSetEmergencyGroup, opts ...grpc.CallOption) (*MsgGovSetEmergencyGroupResponse, error) - // GovUpdateLiquidationParams sets new liquidation params for inflation - GovUpdateLiquidationParams(ctx context.Context, in *MsgGovUpdateLiquidationParams, opts ...grpc.CallOption) (*GovUpdateLiquidationParamsResponse, error) + // GovUpdateInflationParams sets new params for inflation rate change. + GovUpdateInflationParams(ctx context.Context, in *MsgGovUpdateInflationParams, opts ...grpc.CallOption) (*GovUpdateInflationParamsResponse, error) } type msgClient struct { @@ -354,9 +354,9 @@ func (c *msgClient) GovSetEmergencyGroup(ctx context.Context, in *MsgGovSetEmerg return out, nil } -func (c *msgClient) GovUpdateLiquidationParams(ctx context.Context, in *MsgGovUpdateLiquidationParams, opts ...grpc.CallOption) (*GovUpdateLiquidationParamsResponse, error) { - out := new(GovUpdateLiquidationParamsResponse) - err := c.cc.Invoke(ctx, "/umee.ugov.v1.Msg/GovUpdateLiquidationParams", in, out, opts...) +func (c *msgClient) GovUpdateInflationParams(ctx context.Context, in *MsgGovUpdateInflationParams, opts ...grpc.CallOption) (*GovUpdateInflationParamsResponse, error) { + out := new(GovUpdateInflationParamsResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Msg/GovUpdateInflationParams", in, out, opts...) if err != nil { return nil, err } @@ -369,8 +369,8 @@ type MsgServer interface { GovUpdateMinGasPrice(context.Context, *MsgGovUpdateMinGasPrice) (*MsgGovUpdateMinGasPriceResponse, error) // GovSetEmergencyGroup sets emergency group address. GovSetEmergencyGroup(context.Context, *MsgGovSetEmergencyGroup) (*MsgGovSetEmergencyGroupResponse, error) - // GovUpdateLiquidationParams sets new liquidation params for inflation - GovUpdateLiquidationParams(context.Context, *MsgGovUpdateLiquidationParams) (*GovUpdateLiquidationParamsResponse, error) + // GovUpdateInflationParams sets new params for inflation rate change. + GovUpdateInflationParams(context.Context, *MsgGovUpdateInflationParams) (*GovUpdateInflationParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -383,8 +383,8 @@ func (*UnimplementedMsgServer) GovUpdateMinGasPrice(ctx context.Context, req *Ms func (*UnimplementedMsgServer) GovSetEmergencyGroup(ctx context.Context, req *MsgGovSetEmergencyGroup) (*MsgGovSetEmergencyGroupResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GovSetEmergencyGroup not implemented") } -func (*UnimplementedMsgServer) GovUpdateLiquidationParams(ctx context.Context, req *MsgGovUpdateLiquidationParams) (*GovUpdateLiquidationParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GovUpdateLiquidationParams not implemented") +func (*UnimplementedMsgServer) GovUpdateInflationParams(ctx context.Context, req *MsgGovUpdateInflationParams) (*GovUpdateInflationParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovUpdateInflationParams not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { @@ -427,20 +427,20 @@ func _Msg_GovSetEmergencyGroup_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _Msg_GovUpdateLiquidationParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgGovUpdateLiquidationParams) +func _Msg_GovUpdateInflationParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgGovUpdateInflationParams) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).GovUpdateLiquidationParams(ctx, in) + return srv.(MsgServer).GovUpdateInflationParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/umee.ugov.v1.Msg/GovUpdateLiquidationParams", + FullMethod: "/umee.ugov.v1.Msg/GovUpdateInflationParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).GovUpdateLiquidationParams(ctx, req.(*MsgGovUpdateLiquidationParams)) + return srv.(MsgServer).GovUpdateInflationParams(ctx, req.(*MsgGovUpdateInflationParams)) } return interceptor(ctx, in, info, handler) } @@ -458,8 +458,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_GovSetEmergencyGroup_Handler, }, { - MethodName: "GovUpdateLiquidationParams", - Handler: _Msg_GovUpdateLiquidationParams_Handler, + MethodName: "GovUpdateInflationParams", + Handler: _Msg_GovUpdateInflationParams_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -589,7 +589,7 @@ func (m *MsgGovSetEmergencyGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *MsgGovUpdateLiquidationParams) Marshal() (dAtA []byte, err error) { +func (m *MsgGovUpdateInflationParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -599,18 +599,18 @@ func (m *MsgGovUpdateLiquidationParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgGovUpdateLiquidationParams) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgGovUpdateInflationParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgGovUpdateLiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgGovUpdateInflationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.LiquidationParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.InflationParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -629,7 +629,7 @@ func (m *MsgGovUpdateLiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *GovUpdateLiquidationParamsResponse) Marshal() (dAtA []byte, err error) { +func (m *GovUpdateInflationParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -639,12 +639,12 @@ func (m *GovUpdateLiquidationParamsResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *GovUpdateLiquidationParamsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *GovUpdateInflationParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GovUpdateLiquidationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GovUpdateInflationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -713,7 +713,7 @@ func (m *MsgGovSetEmergencyGroupResponse) Size() (n int) { return n } -func (m *MsgGovUpdateLiquidationParams) Size() (n int) { +func (m *MsgGovUpdateInflationParams) Size() (n int) { if m == nil { return 0 } @@ -723,12 +723,12 @@ func (m *MsgGovUpdateLiquidationParams) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.LiquidationParams.Size() + l = m.InflationParams.Size() n += 1 + l + sovTx(uint64(l)) return n } -func (m *GovUpdateLiquidationParamsResponse) Size() (n int) { +func (m *GovUpdateInflationParamsResponse) Size() (n int) { if m == nil { return 0 } @@ -1072,7 +1072,7 @@ func (m *MsgGovSetEmergencyGroupResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgGovUpdateLiquidationParams) Unmarshal(dAtA []byte) error { +func (m *MsgGovUpdateInflationParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1095,10 +1095,10 @@ func (m *MsgGovUpdateLiquidationParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgGovUpdateLiquidationParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgGovUpdateInflationParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgGovUpdateLiquidationParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgGovUpdateInflationParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1135,7 +1135,7 @@ func (m *MsgGovUpdateLiquidationParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidationParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1162,7 +1162,7 @@ func (m *MsgGovUpdateLiquidationParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LiquidationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.InflationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1187,7 +1187,7 @@ func (m *MsgGovUpdateLiquidationParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *GovUpdateLiquidationParamsResponse) Unmarshal(dAtA []byte) error { +func (m *GovUpdateInflationParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1210,10 +1210,10 @@ func (m *GovUpdateLiquidationParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GovUpdateLiquidationParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GovUpdateInflationParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GovUpdateLiquidationParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GovUpdateInflationParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/ugov/ugov.pb.go b/x/ugov/ugov.pb.go index 59988c8ca0..ce9255b493 100644 --- a/x/ugov/ugov.pb.go +++ b/x/ugov/ugov.pb.go @@ -30,8 +30,8 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// LiquidationParams -type LiquidationParams struct { +// InflationParams params for changing the inflation min rate and max rate of mint module params. +type InflationParams struct { // max_supply is the maximum supply for liquidation. MaxSupply types.Coin `protobuf:"bytes,1,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply"` // inflation_cycle_duration is duration for changing the inflation rates for liquidation. @@ -40,18 +40,18 @@ type LiquidationParams struct { InflationReductionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=inflation_reduction_rate,json=inflationReductionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation_reduction_rate"` } -func (m *LiquidationParams) Reset() { *m = LiquidationParams{} } -func (m *LiquidationParams) String() string { return proto.CompactTextString(m) } -func (*LiquidationParams) ProtoMessage() {} -func (*LiquidationParams) Descriptor() ([]byte, []int) { +func (m *InflationParams) Reset() { *m = InflationParams{} } +func (m *InflationParams) String() string { return proto.CompactTextString(m) } +func (*InflationParams) ProtoMessage() {} +func (*InflationParams) Descriptor() ([]byte, []int) { return fileDescriptor_b75ef21394c8e122, []int{0} } -func (m *LiquidationParams) XXX_Unmarshal(b []byte) error { +func (m *InflationParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *LiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *InflationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_LiquidationParams.Marshal(b, m, deterministic) + return xxx_messageInfo_InflationParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -61,55 +61,54 @@ func (m *LiquidationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *LiquidationParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_LiquidationParams.Merge(m, src) +func (m *InflationParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_InflationParams.Merge(m, src) } -func (m *LiquidationParams) XXX_Size() int { +func (m *InflationParams) XXX_Size() int { return m.Size() } -func (m *LiquidationParams) XXX_DiscardUnknown() { - xxx_messageInfo_LiquidationParams.DiscardUnknown(m) +func (m *InflationParams) XXX_DiscardUnknown() { + xxx_messageInfo_InflationParams.DiscardUnknown(m) } -var xxx_messageInfo_LiquidationParams proto.InternalMessageInfo +var xxx_messageInfo_InflationParams proto.InternalMessageInfo func init() { - proto.RegisterType((*LiquidationParams)(nil), "umee.ugov.v1.LiquidationParams") + proto.RegisterType((*InflationParams)(nil), "umee.ugov.v1.InflationParams") } func init() { proto.RegisterFile("umee/ugov/v1/ugov.proto", fileDescriptor_b75ef21394c8e122) } var fileDescriptor_b75ef21394c8e122 = []byte{ - // 401 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xb1, 0xae, 0xd3, 0x30, - 0x14, 0x86, 0xe3, 0x0b, 0x42, 0xba, 0x81, 0x85, 0x08, 0x41, 0xee, 0x1d, 0x9c, 0xaa, 0x03, 0xea, - 0x40, 0x6d, 0x05, 0xc4, 0x82, 0x10, 0x43, 0x9a, 0x91, 0x01, 0xc2, 0xc6, 0x12, 0x39, 0x8e, 0x1b, - 0xac, 0xc6, 0x71, 0x48, 0xec, 0xd0, 0xbc, 0x05, 0x23, 0x4f, 0xc0, 0x13, 0xf0, 0x10, 0x1d, 0x2b, - 0x26, 0xc4, 0x10, 0xa0, 0xdd, 0x18, 0x11, 0x0f, 0x80, 0xe2, 0x24, 0xa8, 0x4b, 0x27, 0xfb, 0xf8, - 0x3f, 0xff, 0x7f, 0x3e, 0x1d, 0xd9, 0x7e, 0xa0, 0x05, 0x63, 0x58, 0x67, 0xb2, 0xc1, 0x8d, 0x6f, - 0x4e, 0x54, 0x56, 0x52, 0x49, 0xe7, 0x4e, 0x2f, 0x20, 0xf3, 0xd0, 0xf8, 0xd7, 0xf7, 0x32, 0x99, - 0x49, 0x23, 0xe0, 0xfe, 0x36, 0xf4, 0x5c, 0x43, 0x2a, 0x6b, 0x21, 0x6b, 0x9c, 0x90, 0x9a, 0xe1, - 0xc6, 0x4f, 0x98, 0x22, 0x3e, 0xa6, 0x92, 0x17, 0x93, 0x9e, 0x49, 0x99, 0xe5, 0x0c, 0x9b, 0x2a, - 0xd1, 0x6b, 0x9c, 0xea, 0x8a, 0x28, 0x2e, 0x27, 0xfd, 0x6a, 0xf0, 0xc7, 0x43, 0xf0, 0x50, 0x0c, - 0xd2, 0xfc, 0xef, 0x85, 0x7d, 0xf7, 0x25, 0x7f, 0xaf, 0x79, 0x6a, 0x0c, 0xaf, 0x48, 0x45, 0x44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0xb4, 0xbe, 0x1d, 0xa1, 0xf5, 0xf6, 0x74, 0x56, 0xff, 0x3d, - 0x96, 0x05, 0x53, 0x1f, 0x64, 0xb5, 0x31, 0x05, 0x6e, 0x9e, 0xe2, 0xad, 0xf9, 0x41, 0xc9, 0x2d, - 0xb3, 0xbb, 0x27, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x60, 0x78, 0x0f, 0xaa, 0x5d, 0x02, 0x00, - 0x00, + // 400 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xb1, 0x8e, 0xd3, 0x30, + 0x18, 0xc7, 0xe3, 0x82, 0x90, 0x1a, 0x90, 0x90, 0x22, 0x04, 0x69, 0x07, 0xa7, 0xea, 0x80, 0x3a, + 0x50, 0x5b, 0x01, 0xb1, 0x20, 0xc4, 0x90, 0x66, 0x61, 0x83, 0xb0, 0xb1, 0x44, 0x8e, 0xeb, 0x86, + 0xa8, 0x71, 0x1c, 0x25, 0x4e, 0x68, 0xde, 0x82, 0x91, 0x27, 0xb8, 0x27, 0xb8, 0x87, 0xe8, 0x58, + 0xdd, 0x74, 0xba, 0x21, 0x77, 0xd7, 0x6e, 0x37, 0xf6, 0x09, 0x4e, 0x71, 0x92, 0x53, 0x97, 0x4e, + 0xf6, 0xe7, 0xff, 0xff, 0xfb, 0x7f, 0x3f, 0x7d, 0xb2, 0xfe, 0xae, 0xe0, 0x8c, 0xe1, 0x22, 0x14, + 0x25, 0x2e, 0x6d, 0x75, 0xa2, 0x34, 0x13, 0x52, 0x18, 0xaf, 0x1a, 0x01, 0xa9, 0x87, 0xd2, 0x1e, + 0xbf, 0x09, 0x45, 0x28, 0x94, 0x80, 0x9b, 0x5b, 0xeb, 0x19, 0x43, 0x2a, 0x72, 0x2e, 0x72, 0x1c, + 0x90, 0x9c, 0xe1, 0xd2, 0x0e, 0x98, 0x24, 0x36, 0xa6, 0x22, 0x4a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c8, 0x65, 0xf4, 0xea, 0x72, 0xae, 0x77, 0x7b, 0x72, 0x19, 0x3d, 0x99, 0xeb, 0xf5, 0xe1, 0x1e, + 0x91, 0xcc, 0x71, 0xb7, 0xf7, 0x50, 0xdb, 0xee, 0x21, 0xd8, 0xed, 0x21, 0xb8, 0xdb, 0x43, 0xf0, + 0xef, 0x00, 0xb5, 0xdd, 0x01, 0x6a, 0xd7, 0x07, 0xa8, 0xfd, 0x3e, 0x9d, 0xd5, 0x7c, 0x8e, 0x79, + 0xc2, 0xe4, 0x5f, 0x91, 0xad, 0x55, 0x81, 0xcb, 0xcf, 0x78, 0xa3, 0xfe, 0x4f, 0xf0, 0x42, 0xed, + 0xee, 0xd3, 0x63, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xc6, 0x75, 0x30, 0x5b, 0x02, 0x00, 0x00, } -func (m *LiquidationParams) Marshal() (dAtA []byte, err error) { +func (m *InflationParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -119,12 +118,12 @@ func (m *LiquidationParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *LiquidationParams) MarshalTo(dAtA []byte) (int, error) { +func (m *InflationParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *LiquidationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *InflationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -171,7 +170,7 @@ func encodeVarintUgov(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *LiquidationParams) Size() (n int) { +func (m *InflationParams) Size() (n int) { if m == nil { return 0 } @@ -192,7 +191,7 @@ func sovUgov(x uint64) (n int) { func sozUgov(x uint64) (n int) { return sovUgov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *LiquidationParams) Unmarshal(dAtA []byte) error { +func (m *InflationParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -215,10 +214,10 @@ func (m *LiquidationParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: LiquidationParams: wiretype end group for non-group") + return fmt.Errorf("proto: InflationParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: LiquidationParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: InflationParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: From 5df26bb929ba9ced6135f0a07371ef9cca3964c3 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 18 Jul 2023 18:13:27 +0530 Subject: [PATCH 05/17] fix the lint --- x/mint/abci.go | 4 ++-- x/mint/expected_keepers.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/mint/abci.go b/x/mint/abci.go index cf1e56ee4f..ecfbe9e22e 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -11,7 +11,7 @@ import ( ) // BeginBlock overrides the mint module BeginBlock. -func BeginBlock(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper MintKeeper) { +func BeginBlock(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) // inflation rate change params lp := ugovKeeper.InflationParams() @@ -58,7 +58,7 @@ func BeginBlock(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper MintKeeper) { ) } -func InflationCalculationFn(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper MintKeeper, +func InflationCalculationFn(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper Keeper, lp ugov.InflationParams, params types.Params, bondedRatio sdk.Dec, currentInflation sdk.Dec) sdk.Dec { // inflation cycle is completed , so we need to update the inflation max and min rate diff --git a/x/mint/expected_keepers.go b/x/mint/expected_keepers.go index 8b9366c016..9354ba50f2 100644 --- a/x/mint/expected_keepers.go +++ b/x/mint/expected_keepers.go @@ -15,7 +15,7 @@ type UGovKeeper interface { InflationParams() ugov.InflationParams } -type MintKeeper interface { +type Keeper interface { SetParams(ctx sdk.Context, params minttypes.Params) GetParams(ctx sdk.Context) (params minttypes.Params) StakingTokenSupply(ctx sdk.Context) math.Int From f810e058bdd25d682088df5f590edfabc4beeb7d Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 18 Jul 2023 19:01:17 +0530 Subject: [PATCH 06/17] update the MaxSupply --- x/ugov/{liquidation_params.go => inflation_params.go} | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) rename x/ugov/{liquidation_params.go => inflation_params.go} (82%) diff --git a/x/ugov/liquidation_params.go b/x/ugov/inflation_params.go similarity index 82% rename from x/ugov/liquidation_params.go rename to x/ugov/inflation_params.go index 8ec54d0758..4136e349d5 100644 --- a/x/ugov/liquidation_params.go +++ b/x/ugov/inflation_params.go @@ -11,7 +11,8 @@ import ( ) var ( - DefaultMaxSupply = sdk.NewCoin(appparams.BondDenom, sdk.NewInt(12_000000000_0000000)) + // 21 Billition Maximum for Staking Bonding Denom + DefaultMaxSupply = sdk.NewCoin(appparams.BondDenom, sdk.NewInt(21_000000000)) // One year for default inflation cycle DefaultInflationCycleDuration = time.Second * time.Duration(60*60*24*365) // 25% reduction rate for every inflation cyle @@ -35,5 +36,9 @@ func (lp InflationParams) Validate() error { return fmt.Errorf("%s must be not negative: %s", "inflation reduction rate ", lp.InflationReductionRate.String()) } + if lp.InflationCycleDuration.Seconds() < 0 { + return fmt.Errorf("%s must be not negative: %s", "inflation cycle duration", lp.InflationCycleDuration.String()) + } + return nil } From 171eeca062ef2e809602b1ed0bf9ccad5eeb92e3 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Wed, 19 Jul 2023 19:33:48 +0530 Subject: [PATCH 07/17] rename inflation_cycle_start_time to inflation_cycle_start in params --- proto/umee/ugov/v1/genesis.proto | 5 +- proto/umee/ugov/v1/query.proto | 2 +- proto/umee/ugov/v1/ugov.proto | 10 ++-- x/mint/abci.go | 18 ++---- x/mint/expected_keepers.go | 4 +- x/ugov/genesis.pb.go | 64 ++++++++++----------- x/ugov/inflation_params.go | 24 +++----- x/ugov/keeper/genesis.go | 12 ++-- x/ugov/keeper/keys.go | 8 +-- x/ugov/keeper/params.go | 8 +-- x/ugov/keeper/params_test.go | 10 ++-- x/ugov/keeper/query_server.go | 4 +- x/ugov/query.pb.go | 98 ++++++++++++++++---------------- x/ugov/ugov.pb.go | 66 ++++++++++----------- 14 files changed, 159 insertions(+), 174 deletions(-) diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto index 186c57f4f7..9f6c71da4a 100644 --- a/proto/umee/ugov/v1/genesis.proto +++ b/proto/umee/ugov/v1/genesis.proto @@ -19,6 +19,7 @@ message GenesisState { // InflationParams is params for inflation rate changes InflationParams inflation_params = 3 [(gogoproto.nullable) = false]; - // Unix timestamp when the inflation cycle is started - google.protobuf.Timestamp inflation_cycle_start_time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + + // Time when the inflation cycle started + google.protobuf.Timestamp inflation_cycle_start = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto index 99211793fb..063d8ab3a3 100644 --- a/proto/umee/ugov/v1/query.proto +++ b/proto/umee/ugov/v1/query.proto @@ -65,5 +65,5 @@ message QueryInflationCycleStartTime {} // QueryInflationCycleStartTimeResponse response type. message QueryInflationCycleStartTimeResponse { - google.protobuf.Timestamp inflation_cycle_start_time = 1 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp inflation_cycle_start = 1 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; } diff --git a/proto/umee/ugov/v1/ugov.proto b/proto/umee/ugov/v1/ugov.proto index 1ab02b690a..8c43e34d3e 100644 --- a/proto/umee/ugov/v1/ugov.proto +++ b/proto/umee/ugov/v1/ugov.proto @@ -13,14 +13,14 @@ option (gogoproto.goproto_getters_all) = false; message InflationParams { // max_supply is the maximum supply for liquidation. cosmos.base.v1beta1.Coin max_supply = 1 [(gogoproto.nullable) = false]; - // inflation_cycle_duration is duration for changing the inflation rates for liquidation. - google.protobuf.Duration inflation_cycle_duration = 2 [ + // inflation_cycle duration after which inflation rates are changed. + google.protobuf.Duration inflation_cycle = 2 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, - (gogoproto.jsontag) = "inflation_cycle_duration,omitempty", - (gogoproto.moretags) = "yaml:\"inflation_cycle_duration\"" + (gogoproto.jsontag) = "inflation_cycle,omitempty", + (gogoproto.moretags) = "yaml:\"inflation_cycle\"" ]; - // inflation_reduction_rate is reduction rate for inflation every inflation cycle. + // inflation_reduction_rate for every inflation cycle. string inflation_reduction_rate = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", diff --git a/x/mint/abci.go b/x/mint/abci.go index ecfbe9e22e..d516dd0719 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -61,13 +61,13 @@ func BeginBlock(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper Keeper) { func InflationCalculationFn(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper Keeper, lp ugov.InflationParams, params types.Params, bondedRatio sdk.Dec, currentInflation sdk.Dec) sdk.Dec { - // inflation cycle is completed , so we need to update the inflation max and min rate - icst, err := ugovKeeper.GetInflationCycleStartTime() + icst, err := ugovKeeper.GetInflationCycleStart() util.Panic(err) // Initially inflation_cycle start time is zero // Once chain start inflation cycle start time will be inflation rate change executed block time - if ctx.BlockTime().After(icst.Add(lp.InflationCycleDuration)) { + if ctx.BlockTime().After(icst.Add(lp.InflationCycle)) { + // inflation cycle is completed , so we need to update the inflation max and min rate params.InflationMax = params.InflationMax.Mul(sdk.OneDec().Sub(lp.InflationReductionRate)) params.InflationMin = params.InflationMin.Mul(sdk.OneDec().Sub(lp.InflationReductionRate)) @@ -75,20 +75,14 @@ func InflationCalculationFn(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper K mintKeeper.SetParams(ctx, params) // update the executed time of inflation cycle - err := ugovKeeper.SetInflationCycleStartTime(ctx.BlockTime()) + err := ugovKeeper.SetInflationCycleStart(ctx.BlockTime()) util.Panic(err) - ctx.Logger().Info("inflation rates are updated", + ctx.Logger().Info("inflation min and max rates are updated", "inflation_max", params.InflationMax, "inflation_min", params.InflationMin, - "inflation_cycle_start_time", ctx.BlockTime().String(), + "inflation_cycle_start", ctx.BlockTime().String(), ) } - // The target annual inflation rate is recalculated for each previsions cycle. The - // inflation is also subject to a rate change (positive or negative) depending on - // the distance from the desired ratio (67%). The maximum rate change possible is - // defined to be 13% per year, however the annual inflation is capped as between - // 7% and 20%. - // (1 - bondedRatio/GoalBonded) * InflationRateChange inflationRateChangePerYear := sdk.OneDec(). Sub(bondedRatio.Quo(params.GoalBonded)). diff --git a/x/mint/expected_keepers.go b/x/mint/expected_keepers.go index 9354ba50f2..1b80bfe414 100644 --- a/x/mint/expected_keepers.go +++ b/x/mint/expected_keepers.go @@ -10,8 +10,8 @@ import ( ) type UGovKeeper interface { - SetInflationCycleStartTime(startTime time.Time) error - GetInflationCycleStartTime() (*time.Time, error) + SetInflationCycleStart(startTime time.Time) error + GetInflationCycleStart() (*time.Time, error) InflationParams() ugov.InflationParams } diff --git a/x/ugov/genesis.pb.go b/x/ugov/genesis.pb.go index 2e3d416889..da2e7c6099 100644 --- a/x/ugov/genesis.pb.go +++ b/x/ugov/genesis.pb.go @@ -36,8 +36,8 @@ type GenesisState struct { EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` // InflationParams is params for inflation rate changes InflationParams InflationParams `protobuf:"bytes,3,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` - // Unix timestamp when the inflation cycle is started - InflationCycleStartTime time.Time `protobuf:"bytes,4,opt,name=inflation_cycle_start_time,json=inflationCycleStartTime,proto3,stdtime" json:"inflation_cycle_start_time"` + // Time when the inflation cycle started + InflationCycleStart time.Time `protobuf:"bytes,4,opt,name=inflation_cycle_start,json=inflationCycleStart,proto3,stdtime" json:"inflation_cycle_start"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -80,33 +80,33 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/genesis.proto", fileDescriptor_82f39cd8e8ede8c7) } var fileDescriptor_82f39cd8e8ede8c7 = []byte{ - // 412 bytes of a gzipped FileDescriptorProto + // 409 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0x4f, 0x6e, 0xd4, 0x30, - 0x18, 0xc5, 0x93, 0x52, 0x21, 0x48, 0x0b, 0x45, 0x51, 0xa5, 0x86, 0x08, 0x3c, 0x15, 0x0b, 0xd4, - 0x4d, 0x6d, 0x05, 0xc4, 0x01, 0x9a, 0x56, 0x8c, 0xd8, 0xa0, 0x6a, 0x86, 0x15, 0x9b, 0xc8, 0x71, - 0xbf, 0x1a, 0x8b, 0xb1, 0x1d, 0xd9, 0x4e, 0xa0, 0xb7, 0xe8, 0x61, 0x38, 0xc4, 0x2c, 0x58, 0x8c, - 0x58, 0xb1, 0xe2, 0xcf, 0xcc, 0x45, 0x90, 0x9d, 0xcc, 0xd0, 0xd9, 0xe5, 0xcb, 0x7b, 0xdf, 0xcf, - 0xcf, 0xcf, 0x49, 0xde, 0x4a, 0x00, 0xd2, 0x72, 0xdd, 0x91, 0xae, 0x20, 0x1c, 0x14, 0x58, 0x61, - 0x71, 0x63, 0xb4, 0xd3, 0xe9, 0xbe, 0xd7, 0xb0, 0xd7, 0x70, 0x57, 0xe4, 0x87, 0x5c, 0x73, 0x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, 0xc6, 0xbe, 0x9f, 0xbe, 0x4b, 0x1e, 0x08, 0x75, 0x31, 0xa3, 0x4e, + 0x68, 0x55, 0x35, 0xd4, 0x50, 0x69, 0xb3, 0x5b, 0xc1, 0xe6, 0x19, 0xbe, 0x79, 0x4f, 0xfc, 0x76, + 0xd5, 0x3a, 0x0b, 0xa5, 0x41, 0x67, 0x4f, 0x6c, 0xbe, 0x4e, 0x3f, 0x24, 0x8f, 0xfe, 0xf3, 0xd8, + 0x25, 0x9b, 0x41, 0x65, 0x1d, 0x35, 0x2e, 0xdb, 0x0e, 0xd0, 0x1c, 0xf7, 0x07, 0xc6, 0xab, 0x03, + 0xe3, 0xf7, 0xab, 0x03, 0x97, 0x77, 0x3c, 0xf1, 0xea, 0xf7, 0x28, 0x9e, 0x3c, 0x5c, 0x23, 0x4e, + 0x3c, 0x61, 0xea, 0x01, 0xe5, 0xe9, 0xfc, 0x2f, 0x8a, 0xe6, 0x0b, 0x14, 0x5f, 0x2f, 0x50, 0xfc, + 0x67, 0x81, 0xe2, 0xab, 0x25, 0x8a, 0xae, 0x97, 0x28, 0xfa, 0xb9, 0x44, 0xd1, 0xc7, 0x17, 0x5c, + 0xb8, 0x4f, 0x6d, 0x8d, 0x99, 0x96, 0xc4, 0x7b, 0x1f, 0x29, 0x70, 0x5f, 0xb4, 0xf9, 0x1c, 0x06, + 0xd2, 0xbd, 0x26, 0x5f, 0xc3, 0x1f, 0xa9, 0x6f, 0x87, 0x0f, 0xbf, 0xfa, 0x17, 0x00, 0x00, 0xff, + 0xff, 0xeb, 0xd3, 0x3c, 0x9c, 0x49, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -129,7 +129,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.InflationCycleStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStartTime):]) + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.InflationCycleStart, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStart):]) if err1 != nil { return 0, err1 } @@ -192,7 +192,7 @@ func (m *GenesisState) Size() (n int) { } l = m.InflationParams.Size() n += 1 + l + sovGenesis(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStartTime) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStart) n += 1 + l + sovGenesis(uint64(l)) return n } @@ -332,7 +332,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleStartTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleStart", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -359,7 +359,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.InflationCycleStartTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.InflationCycleStart, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/inflation_params.go b/x/ugov/inflation_params.go index 4136e349d5..62f08124e7 100644 --- a/x/ugov/inflation_params.go +++ b/x/ugov/inflation_params.go @@ -8,36 +8,28 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" appparams "github.com/umee-network/umee/v5/app/params" -) - -var ( - // 21 Billition Maximum for Staking Bonding Denom - DefaultMaxSupply = sdk.NewCoin(appparams.BondDenom, sdk.NewInt(21_000000000)) - // One year for default inflation cycle - DefaultInflationCycleDuration = time.Second * time.Duration(60*60*24*365) - // 25% reduction rate for every inflation cyle - DefaultInflationReductionRate = sdk.MustNewDecFromStr("0.25") + "github.com/umee-network/umee/v5/util/coin" ) func DefaultInflationParams() InflationParams { return InflationParams{ - MaxSupply: DefaultMaxSupply, - InflationCycleDuration: DefaultInflationCycleDuration, - InflationReductionRate: DefaultInflationReductionRate, + MaxSupply: coin.New(appparams.BondDenom, 21_000000000), // 21 Billition Maximum for Staking Bonding Denom + InflationCycle: time.Hour * 24 * 365, // 2 years for default inflation cycle + InflationReductionRate: sdk.MustNewDecFromStr("0.25"), // 25% reduction rate for inflation cyle } } func (lp InflationParams) Validate() error { if lp.MaxSupply.Amount.LT(math.NewInt(0)) { - return fmt.Errorf("%s must be not negative: %s", "max_supply", lp.MaxSupply.Amount.String()) + return fmt.Errorf("max_supply must be not negative") } if lp.InflationReductionRate.LT(sdk.ZeroDec()) { - return fmt.Errorf("%s must be not negative: %s", "inflation reduction rate ", lp.InflationReductionRate.String()) + return fmt.Errorf("inflation reduction rate must be not negative") } - if lp.InflationCycleDuration.Seconds() < 0 { - return fmt.Errorf("%s must be not negative: %s", "inflation cycle duration", lp.InflationCycleDuration.String()) + if lp.InflationCycle.Seconds() <= 0 { + return fmt.Errorf("inflation cycle must be positive") } return nil diff --git a/x/ugov/keeper/genesis.go b/x/ugov/keeper/genesis.go index e88403704a..46958f7458 100644 --- a/x/ugov/keeper/genesis.go +++ b/x/ugov/keeper/genesis.go @@ -6,12 +6,12 @@ import ( ) func (k Keeper) ExportGenesis() *ugov.GenesisState { - lcst, err := k.GetInflationCycleStartTime() + lcst, err := k.GetInflationCycleStart() util.Panic(err) return &ugov.GenesisState{ - MinGasPrice: k.MinGasPrice(), - InflationParams: k.InflationParams(), - InflationCycleStartTime: *lcst, + MinGasPrice: k.MinGasPrice(), + InflationParams: k.InflationParams(), + InflationCycleStart: *lcst, } } @@ -19,10 +19,8 @@ func (k Keeper) InitGenesis(gs *ugov.GenesisState) error { if err := k.SetMinGasPrice(gs.MinGasPrice); err != nil { return err } - if err := k.SetInflationParams(gs.InflationParams); err != nil { return err } - - return k.SetInflationCycleStartTime(gs.InflationCycleStartTime) + return k.SetInflationCycleStart(gs.InflationCycleStart) } diff --git a/x/ugov/keeper/keys.go b/x/ugov/keeper/keys.go index 0368f3e759..12be2b6e85 100644 --- a/x/ugov/keeper/keys.go +++ b/x/ugov/keeper/keys.go @@ -2,8 +2,8 @@ package keeper // store key prefixes var ( - keyMinGasPrice = []byte{0x01} - keyEmergencyGroup = []byte{0x02} - KeyInflationParams = []byte{0x03} - KeyInflationCycleStartTime = []byte{0x04} + keyMinGasPrice = []byte{0x01} + keyEmergencyGroup = []byte{0x02} + KeyInflationParams = []byte{0x03} + KeyInflationCycleStart = []byte{0x04} ) diff --git a/x/ugov/keeper/params.go b/x/ugov/keeper/params.go index f5136c0722..2decd2a51e 100644 --- a/x/ugov/keeper/params.go +++ b/x/ugov/keeper/params.go @@ -42,10 +42,10 @@ func (k Keeper) InflationParams() ugov.InflationParams { return *lp } -func (k Keeper) SetInflationCycleStartTime(startTime time.Time) error { - return store.SetBinValue(k.store, KeyInflationCycleStartTime, &startTime, "inflation_cycle_start_time") +func (k Keeper) SetInflationCycleStart(startTime time.Time) error { + return store.SetBinValue(k.store, KeyInflationCycleStart, &startTime, "inflation_cycle_start") } -func (k Keeper) GetInflationCycleStartTime() (*time.Time, error) { - return store.GetBinValue[*time.Time](k.store, KeyInflationCycleStartTime, "inflation_cycle_start_time") +func (k Keeper) GetInflationCycleStart() (*time.Time, error) { + return store.GetBinValue[*time.Time](k.store, KeyInflationCycleStart, "inflation_cycle_start") } diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index 0dc40e9c2e..0be1cba57f 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -53,22 +53,22 @@ func TestLiquidationParams(t *testing.T) { require.Equal(rlp.MaxSupply.GetDenom(), appparams.BondDenom) } -func TestInflationCycleStartTime(t *testing.T) { +func TestInflationCycleStart(t *testing.T) { t.Parallel() require := require.New(t) k := initKeeper(t) st := time.Time{} - err := k.SetInflationCycleStartTime(st) + err := k.SetInflationCycleStart(st) require.NoError(err) - in_c, err := k.GetInflationCycleStartTime() + in_c, err := k.GetInflationCycleStart() require.NoError(err) require.Equal(in_c.IsZero(), true, "it should be default zero time") icst := time.Now() - err = k.SetInflationCycleStartTime(icst) + err = k.SetInflationCycleStart(icst) require.NoError(err) - ricst, err := k.GetInflationCycleStartTime() + ricst, err := k.GetInflationCycleStart() require.NoError(err) require.Equal(ricst.Equal(icst), true, "inflation cycle start time should be same") } diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index 133184a570..f9b7e12932 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -41,9 +41,9 @@ func (q Querier) InflationParams(ctx context.Context, _ *ugov.QueryInflationPara func (q Querier) InflationCycleStartTime(ctx context.Context, _ *ugov.QueryInflationCycleStartTime) ( *ugov.QueryInflationCycleStartTimeResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - icst, err := q.Keeper(&sdkCtx).GetInflationCycleStartTime() + icst, err := q.Keeper(&sdkCtx).GetInflationCycleStart() if err != nil { return nil, err } - return &ugov.QueryInflationCycleStartTimeResponse{InflationCycleStartTime: icst}, nil + return &ugov.QueryInflationCycleStartTimeResponse{InflationCycleStart: icst}, nil } diff --git a/x/ugov/query.pb.go b/x/ugov/query.pb.go index 89794af742..f205c7b78d 100644 --- a/x/ugov/query.pb.go +++ b/x/ugov/query.pb.go @@ -299,7 +299,7 @@ var xxx_messageInfo_QueryInflationCycleStartTime proto.InternalMessageInfo // QueryInflationCycleStartTimeResponse response type. type QueryInflationCycleStartTimeResponse struct { - InflationCycleStartTime *time.Time `protobuf:"bytes,1,opt,name=inflation_cycle_start_time,json=inflationCycleStartTime,proto3,stdtime" json:"inflation_cycle_start_time,omitempty"` + InflationCycleStart *time.Time `protobuf:"bytes,1,opt,name=inflation_cycle_start,json=inflationCycleStart,proto3,stdtime" json:"inflation_cycle_start,omitempty"` } func (m *QueryInflationCycleStartTimeResponse) Reset() { *m = QueryInflationCycleStartTimeResponse{} } @@ -349,46 +349,46 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/query.proto", fileDescriptor_25fa04679024a47d) } var fileDescriptor_25fa04679024a47d = []byte{ - // 613 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4f, 0x6f, 0xd3, 0x30, - 0x1c, 0x6d, 0xd0, 0x40, 0xe0, 0xc1, 0x36, 0x99, 0xc1, 0x4a, 0xb6, 0xa5, 0x23, 0xc0, 0x04, 0x48, - 0xb1, 0xd5, 0x21, 0x3e, 0xc0, 0xba, 0xc1, 0xc4, 0x01, 0x34, 0xba, 0x9d, 0xb8, 0x04, 0x27, 0xf3, - 0x82, 0x45, 0x63, 0x87, 0x38, 0x29, 0x94, 0x23, 0x12, 0x87, 0xdd, 0x26, 0xf1, 0x05, 0xf8, 0x10, - 0x9c, 0xf8, 0x04, 0x3d, 0x4e, 0x70, 0xe1, 0x34, 0xa0, 0xe5, 0x83, 0xa0, 0x38, 0x7f, 0xd6, 0x44, - 0xa5, 0xe5, 0x16, 0xff, 0xde, 0xcb, 0xef, 0xbd, 0x67, 0x3f, 0x50, 0x8f, 0x7d, 0x4a, 0x71, 0xec, - 0x89, 0x2e, 0xee, 0x36, 0xf1, 0x9b, 0x98, 0x86, 0x3d, 0x14, 0x84, 0x22, 0x12, 0xf0, 0x72, 0x82, - 0xa0, 0x04, 0x41, 0xdd, 0xa6, 0x6e, 0xb8, 0x42, 0xfa, 0x42, 0x62, 0x87, 0x48, 0x8a, 0xbb, 0x4d, - 0x87, 0x46, 0xa4, 0x89, 0x5d, 0xc1, 0x78, 0xca, 0xd6, 0x6f, 0xa4, 0xb8, 0xad, 0x4e, 0x38, 0x3d, - 0x64, 0xd0, 0xa2, 0x27, 0x3c, 0x91, 0xce, 0x93, 0xaf, 0x6c, 0xba, 0xe2, 0x09, 0xe1, 0x75, 0x28, - 0x26, 0x01, 0xc3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02, - 0x27, 0xea, 0x95, 0xb9, 0xfa, 0xc6, 0xff, 0x73, 0xa7, 0x5d, 0xd7, 0x99, 0x47, 0x55, 0xc6, 0xd6, - 0x76, 0xff, 0xb7, 0x51, 0xeb, 0x0f, 0x0c, 0xed, 0x64, 0x60, 0x68, 0xbf, 0x06, 0x86, 0x76, 0x3c, - 0x34, 0x6a, 0x27, 0x43, 0xa3, 0xf6, 0x63, 0x68, 0xd4, 0x5e, 0xac, 0x7b, 0x2c, 0x7a, 0x15, 0x3b, - 0xc8, 0x15, 0xbe, 0x5a, 0x63, 0x71, 0x1a, 0xbd, 0x15, 0xe1, 0xeb, 0x74, 0x67, 0xf7, 0x21, 0x7e, - 0xa7, 0x16, 0x3b, 0x17, 0x54, 0x73, 0x1f, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x12, 0x82, - 0x0a, 0x81, 0x05, 0x00, 0x00, + // 614 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x1b, 0x34, 0x10, 0x78, 0xb0, 0x4d, 0xde, 0xc6, 0x4a, 0xb6, 0xa5, 0x23, 0xc0, 0x04, + 0x48, 0xb1, 0xd5, 0x21, 0x3e, 0xc0, 0xba, 0xc1, 0xc4, 0x01, 0x34, 0xba, 0x1d, 0x10, 0x97, 0xe2, + 0x64, 0x5e, 0xb0, 0x68, 0xec, 0x10, 0x27, 0x85, 0x72, 0x42, 0x48, 0x1c, 0xb8, 0x4d, 0xe2, 0x0b, + 0xf0, 0x21, 0x38, 0xf1, 0x09, 0x7a, 0x9c, 0xe0, 0xc2, 0x69, 0x40, 0xcb, 0x07, 0x41, 0x71, 0xfe, + 0xac, 0x09, 0xa5, 0xe5, 0x56, 0xfb, 0x79, 0xfa, 0x3e, 0xbf, 0x37, 0x7e, 0x40, 0x35, 0xf2, 0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x52, 0x05, 0x83, 0xef, + 0x35, 0x30, 0x53, 0xac, 0x03, 0xbc, 0x3a, 0x62, 0x7e, 0xd1, 0xa2, 0xdf, 0x9a, 0x68, 0xc9, 0x29, + 0x6e, 0x28, 0x8a, 0x1a, 0x5c, 0x2d, 0x52, 0xe4, 0xbd, 0xb1, 0x54, 0xd1, 0xe0, 0x07, 0x0d, 0xcc, + 0x96, 0xde, 0x16, 0x9a, 0x23, 0x52, 0x4a, 0x1e, 0xfd, 0xf6, 0x64, 0x4f, 0x8e, 0xb2, 0xae, 0x50, + 0xd6, 0xa0, 0x51, 0x44, 0xc9, 0x1f, 0xc7, 0x4a, 0x8a, 0x07, 0x3f, 0x69, 0x60, 0xe9, 0x1f, 0xbd, + 0x80, 0x63, 0xf3, 0x8a, 0x5e, 0x7d, 0xe3, 0xff, 0xbd, 0x93, 0x3e, 0xd7, 0x29, 0xa3, 0xea, 0x60, + 0x63, 0xbb, 0xf7, 0xcb, 0xa8, 0xf4, 0xfa, 0x86, 0x76, 0xdc, 0x37, 0xb4, 0x9f, 0x7d, 0x43, 0x3b, + 0x1a, 0x18, 0x95, 0xe3, 0x81, 0x51, 0xf9, 0x3e, 0x30, 0x2a, 0x4f, 0xd7, 0x5d, 0x16, 0x3e, 0x8f, + 0x6c, 0xe4, 0x08, 0x4f, 0x8d, 0xb1, 0x38, 0x0d, 0x5f, 0x89, 0xe0, 0x45, 0x32, 0xb3, 0x73, 0x17, + 0xbf, 0x56, 0x83, 0xed, 0x73, 0xaa, 0xb5, 0x77, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x04, 0xf0, + 0x52, 0x05, 0x78, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -795,8 +795,8 @@ func (m *QueryInflationCycleStartTimeResponse) MarshalToSizedBuffer(dAtA []byte) _ = i var l int _ = l - if m.InflationCycleStartTime != nil { - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.InflationCycleStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.InflationCycleStartTime):]) + if m.InflationCycleStart != nil { + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.InflationCycleStart, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.InflationCycleStart):]) if err3 != nil { return 0, err3 } @@ -896,8 +896,8 @@ func (m *QueryInflationCycleStartTimeResponse) Size() (n int) { } var l int _ = l - if m.InflationCycleStartTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.InflationCycleStartTime) + if m.InflationCycleStart != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.InflationCycleStart) n += 1 + l + sovQuery(uint64(l)) } return n @@ -1388,7 +1388,7 @@ func (m *QueryInflationCycleStartTimeResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleStartTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleStart", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1415,10 +1415,10 @@ func (m *QueryInflationCycleStartTimeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.InflationCycleStartTime == nil { - m.InflationCycleStartTime = new(time.Time) + if m.InflationCycleStart == nil { + m.InflationCycleStart = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.InflationCycleStartTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.InflationCycleStart, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/ugov.pb.go b/x/ugov/ugov.pb.go index ce9255b493..d1f384cbb2 100644 --- a/x/ugov/ugov.pb.go +++ b/x/ugov/ugov.pb.go @@ -34,9 +34,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type InflationParams struct { // max_supply is the maximum supply for liquidation. MaxSupply types.Coin `protobuf:"bytes,1,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply"` - // inflation_cycle_duration is duration for changing the inflation rates for liquidation. - InflationCycleDuration time.Duration `protobuf:"bytes,2,opt,name=inflation_cycle_duration,json=inflationCycleDuration,proto3,stdduration" json:"inflation_cycle_duration,omitempty" yaml:"inflation_cycle_duration"` - // inflation_reduction_rate is reduction rate for inflation every inflation cycle. + // inflation_cycle duration after which inflation rates are changed. + InflationCycle time.Duration `protobuf:"bytes,2,opt,name=inflation_cycle,json=inflationCycle,proto3,stdduration" json:"inflation_cycle,omitempty" yaml:"inflation_cycle"` + // inflation_reduction_rate for every inflation cycle. InflationReductionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=inflation_reduction_rate,json=inflationReductionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation_reduction_rate"` } @@ -80,32 +80,32 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/ugov.proto", fileDescriptor_b75ef21394c8e122) } var fileDescriptor_b75ef21394c8e122 = []byte{ - // 400 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xb1, 0x8e, 0xd3, 0x30, - 0x18, 0xc7, 0xe3, 0x82, 0x90, 0x1a, 0x90, 0x90, 0x22, 0x04, 0x69, 0x07, 0xa7, 0xea, 0x80, 0x3a, - 0x50, 0x5b, 0x01, 0xb1, 0x20, 0xc4, 0x90, 0x66, 0x61, 0x83, 0xb0, 0xb1, 0x44, 0x8e, 0xeb, 0x86, - 0xa8, 0x71, 0x1c, 0x25, 0x4e, 0x68, 0xde, 0x82, 0x91, 0x27, 0xb8, 0x27, 0xb8, 0x87, 0xe8, 0x58, - 0xdd, 0x74, 0xba, 0x21, 0x77, 0xd7, 0x6e, 0x37, 0xf6, 0x09, 0x4e, 0x71, 0x92, 0x53, 0x97, 0x4e, - 0xf6, 0xe7, 0xff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, 0xeb, 0x9d, 0xfe, 0xbf, 0xb5, 0x80, 0xf7, - 0xf6, 0x49, 0x5e, 0x34, 0x6a, 0x3f, 0xca, 0x28, 0x4f, 0x39, 0x33, 0xb6, 0x2c, 0x68, 0x7b, 0x23, - 0x92, 0x99, 0xcf, 0x26, 0x60, 0x36, 0x74, 0xbe, 0x36, 0x30, 0x37, 0xb5, 0xf5, 0x3e, 0x8c, 0xe4, - 0x9f, 0x22, 0x40, 0x54, 0xf0, 0x6e, 0x7f, 0xdd, 0x31, 0xcf, 0x97, 0x6b, 0x2c, 0xab, 0x94, 0xe5, - 0xc8, 0x65, 0xf4, 0xea, 0x72, 0xae, 0x77, 0x7b, 0x72, 0x19, 0x3d, 0x99, 0xeb, 0xf5, 0xe1, 0x1e, - 0x91, 0xcc, 0x71, 0xb7, 0xf7, 0x50, 0xdb, 0xee, 0x21, 0xd8, 0xed, 0x21, 0xb8, 0xdb, 0x43, 0xf0, - 0xef, 0x00, 0xb5, 0xdd, 0x01, 0x6a, 0xd7, 0x07, 0xa8, 0xfd, 0x3e, 0x9d, 0xd5, 0x7c, 0x8e, 0x79, - 0xc2, 0xe4, 0x5f, 0x91, 0xad, 0x55, 0x81, 0xcb, 0xcf, 0x78, 0xa3, 0xfe, 0x4f, 0xf0, 0x42, 0xed, - 0xee, 0xd3, 0x63, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xc6, 0x75, 0x30, 0x5b, 0x02, 0x00, 0x00, + // 398 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x52, 0x3f, 0x8f, 0xd3, 0x30, + 0x14, 0x8f, 0x0b, 0x42, 0x6a, 0x40, 0x54, 0x8a, 0x50, 0x49, 0x3b, 0x38, 0x55, 0x07, 0xd4, 0x81, + 0xda, 0x0a, 0x88, 0x05, 0x21, 0x90, 0xd2, 0x2c, 0x6c, 0x28, 0x6c, 0x2c, 0x95, 0xe3, 0xba, 0x21, + 0x6a, 0x1c, 0x47, 0x89, 0x13, 0x9a, 0x99, 0x2f, 0xc0, 0xc8, 0x07, 0xe1, 0x43, 0x74, 0xa3, 0x62, + 0x42, 0x37, 0xe4, 0xee, 0xda, 0xed, 0xc6, 0xfb, 0x04, 0xa7, 0x38, 0x49, 0xef, 0xd4, 0xc9, 0xef, + 0xbd, 0xdf, 0x9f, 0xf7, 0xd3, 0x4b, 0xf4, 0x97, 0x39, 0x67, 0x0c, 0xe7, 0x81, 0x28, 0x70, 0x61, + 0xab, 0x17, 0x25, 0xa9, 0x90, 0xc2, 0x78, 0x56, 0x03, 0x48, 0x0d, 0x0a, 0x7b, 0xfc, 0x22, 0x10, + 0x81, 0x50, 0x00, 0xae, 0xab, 0x86, 0x33, 0x86, 0x54, 0x64, 0x5c, 0x64, 0xd8, 0x27, 0x19, 0xc3, + 0x85, 0xed, 0x33, 0x49, 0x6c, 0x4c, 0x45, 0x18, 0x77, 0x78, 0x20, 0x44, 0x10, 0x31, 0xac, 0x3a, + 0x3f, 0x5f, 0xe3, 0x55, 0x9e, 0x12, 0x19, 0x8a, 0x0e, 0x1f, 0x35, 0xfa, 0x65, 0x63, 0xdc, 0x34, + 0x0d, 0x34, 0xfd, 0xdb, 0xd3, 0x07, 0x9f, 0xe3, 0x75, 0xa4, 0xe8, 0x5f, 0x48, 0x4a, 0x78, 0x66, + 0x7c, 0xd4, 0x75, 0x4e, 0xb6, 0xcb, 0x2c, 0x4f, 0x92, 0xa8, 0x34, 0xc1, 0x04, 0xcc, 0x9e, 0xbe, + 0x19, 0xa1, 0x56, 0x56, 0x67, 0x40, 0x6d, 0x06, 0xb4, 0x10, 0x61, 0xec, 0x3c, 0xde, 0x55, 0x96, + 0xe6, 0xf5, 0x39, 0xd9, 0x7e, 0x55, 0x0a, 0xe3, 0x27, 0xd0, 0x07, 0x61, 0xe7, 0xb9, 0xa4, 0x25, + 0x8d, 0x98, 0xd9, 0x6b, 0x5d, 0x9a, 0xa4, 0xa8, 0x4b, 0x8a, 0xdc, 0x36, 0xa9, 0xf3, 0xa9, 0x76, + 0xb9, 0xa9, 0xac, 0xd1, 0x99, 0xf2, 0xb5, 0xe0, 0xa1, 0x64, 0x3c, 0x91, 0xe5, 0x6d, 0x65, 0x0d, + 0x4b, 0xc2, 0xa3, 0xf7, 0xd3, 0x33, 0xca, 0xf4, 0xf7, 0xa5, 0x05, 0xbc, 0xe7, 0xa7, 0xe9, 0xa2, + 0x1e, 0x1a, 0x85, 0x6e, 0xde, 0xf3, 0x52, 0xb6, 0xca, 0x69, 0x53, 0x11, 0xc9, 0xcc, 0x47, 0x13, + 0x30, 0xeb, 0x3b, 0x1f, 0xea, 0x95, 0x17, 0x95, 0xf5, 0x2a, 0x08, 0xe5, 0xf7, 0xdc, 0x47, 0x54, + 0xf0, 0xf6, 0x38, 0xed, 0x33, 0xcf, 0x56, 0x1b, 0x2c, 0xcb, 0x84, 0x65, 0xc8, 0x65, 0xf4, 0xdf, + 0x9f, 0xb9, 0xde, 0x1e, 0xc1, 0x65, 0xd4, 0x1b, 0x9e, 0xdc, 0xbd, 0xce, 0xdc, 0x23, 0x92, 0x39, + 0xee, 0xee, 0x1a, 0x6a, 0xbb, 0x03, 0x04, 0xfb, 0x03, 0x04, 0x57, 0x07, 0x08, 0x7e, 0x1d, 0xa1, + 0xb6, 0x3f, 0x42, 0xed, 0xff, 0x11, 0x6a, 0xdf, 0x1e, 0xee, 0xaa, 0xbf, 0xfc, 0x3c, 0x66, 0xf2, + 0x87, 0x48, 0x37, 0xaa, 0xc1, 0xc5, 0x3b, 0xbc, 0x55, 0x3f, 0x87, 0xff, 0x44, 0x5d, 0xe8, 0xed, + 0x5d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x62, 0x1a, 0x05, 0x7c, 0x38, 0x02, 0x00, 0x00, } func (m *InflationParams) Marshal() (dAtA []byte, err error) { @@ -138,7 +138,7 @@ func (m *InflationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x1a - n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.InflationCycleDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.InflationCycleDuration):]) + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.InflationCycle, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.InflationCycle):]) if err1 != nil { return 0, err1 } @@ -178,7 +178,7 @@ func (m *InflationParams) Size() (n int) { _ = l l = m.MaxSupply.Size() n += 1 + l + sovUgov(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.InflationCycleDuration) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.InflationCycle) n += 1 + l + sovUgov(uint64(l)) l = m.InflationReductionRate.Size() n += 1 + l + sovUgov(uint64(l)) @@ -255,7 +255,7 @@ func (m *InflationParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleDuration", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationCycle", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -282,7 +282,7 @@ func (m *InflationParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.InflationCycleDuration, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.InflationCycle, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From 69cd3faa8818826288412c99d0aa588335fcc43a Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Thu, 20 Jul 2023 16:05:51 +0530 Subject: [PATCH 08/17] change inflation reduction rate to bpmath.FixedBP (uint32) --- proto/umee/ugov/v1/ugov.proto | 5 +- x/mint/abci.go | 8 ++- x/ugov/inflation_params.go | 10 ++-- x/ugov/ugov.pb.go | 95 ++++++++++++++--------------------- 4 files changed, 51 insertions(+), 67 deletions(-) diff --git a/proto/umee/ugov/v1/ugov.proto b/proto/umee/ugov/v1/ugov.proto index 8c43e34d3e..5c234aac7f 100644 --- a/proto/umee/ugov/v1/ugov.proto +++ b/proto/umee/ugov/v1/ugov.proto @@ -21,9 +21,8 @@ message InflationParams { (gogoproto.moretags) = "yaml:\"inflation_cycle\"" ]; // inflation_reduction_rate for every inflation cycle. - string inflation_reduction_rate = 3 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + uint32 inflation_reduction_rate = 3 [ + (gogoproto.customtype) = "github.com/umee-network/umee/v5/util/bpmath.FixedBP", (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/x/mint/abci.go b/x/mint/abci.go index d516dd0719..4479031696 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -68,8 +68,12 @@ func InflationCalculationFn(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper K // Once chain start inflation cycle start time will be inflation rate change executed block time if ctx.BlockTime().After(icst.Add(lp.InflationCycle)) { // inflation cycle is completed , so we need to update the inflation max and min rate - params.InflationMax = params.InflationMax.Mul(sdk.OneDec().Sub(lp.InflationReductionRate)) - params.InflationMin = params.InflationMin.Mul(sdk.OneDec().Sub(lp.InflationReductionRate)) + // inflationReductionRate = 25 / 100 = 0.25 + inflationReductionRate := lp.InflationReductionRate.ToDec().Quo(sdk.NewDec(100)) + // InflationMax = PrevInflationMax * ( 1 - 0.25) + params.InflationMax = params.InflationMax.Mul(sdk.OneDec().Sub(inflationReductionRate)) + // InflationMin = PrevInflationMin * ( 1 - 0.25) + params.InflationMin = params.InflationMin.Mul(sdk.OneDec().Sub(inflationReductionRate)) // update the changed inflation min and max rates mintKeeper.SetParams(ctx, params) diff --git a/x/ugov/inflation_params.go b/x/ugov/inflation_params.go index 62f08124e7..fc0be0f684 100644 --- a/x/ugov/inflation_params.go +++ b/x/ugov/inflation_params.go @@ -5,9 +5,9 @@ import ( time "time" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" appparams "github.com/umee-network/umee/v5/app/params" + "github.com/umee-network/umee/v5/util/bpmath" "github.com/umee-network/umee/v5/util/coin" ) @@ -15,17 +15,17 @@ func DefaultInflationParams() InflationParams { return InflationParams{ MaxSupply: coin.New(appparams.BondDenom, 21_000000000), // 21 Billition Maximum for Staking Bonding Denom InflationCycle: time.Hour * 24 * 365, // 2 years for default inflation cycle - InflationReductionRate: sdk.MustNewDecFromStr("0.25"), // 25% reduction rate for inflation cyle + InflationReductionRate: bpmath.FixedBP(25), // 25% reduction rate for inflation cyle } } func (lp InflationParams) Validate() error { if lp.MaxSupply.Amount.LT(math.NewInt(0)) { - return fmt.Errorf("max_supply must be not negative") + return fmt.Errorf("max_supply must be positive") } - if lp.InflationReductionRate.LT(sdk.ZeroDec()) { - return fmt.Errorf("inflation reduction rate must be not negative") + if lp.InflationReductionRate > 100 { + return fmt.Errorf("inflation reduction must be between 0 to 100") } if lp.InflationCycle.Seconds() <= 0 { diff --git a/x/ugov/ugov.pb.go b/x/ugov/ugov.pb.go index d1f384cbb2..e1610d21c2 100644 --- a/x/ugov/ugov.pb.go +++ b/x/ugov/ugov.pb.go @@ -6,11 +6,11 @@ package ugov import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + github_com_umee_network_umee_v5_util_bpmath "github.com/umee-network/umee/v5/util/bpmath" _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" @@ -37,7 +37,7 @@ type InflationParams struct { // inflation_cycle duration after which inflation rates are changed. InflationCycle time.Duration `protobuf:"bytes,2,opt,name=inflation_cycle,json=inflationCycle,proto3,stdduration" json:"inflation_cycle,omitempty" yaml:"inflation_cycle"` // inflation_reduction_rate for every inflation cycle. - InflationReductionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=inflation_reduction_rate,json=inflationReductionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation_reduction_rate"` + InflationReductionRate github_com_umee_network_umee_v5_util_bpmath.FixedBP `protobuf:"varint,3,opt,name=inflation_reduction_rate,json=inflationReductionRate,proto3,customtype=github.com/umee-network/umee/v5/util/bpmath.FixedBP" json:"inflation_reduction_rate"` } func (m *InflationParams) Reset() { *m = InflationParams{} } @@ -80,32 +80,32 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/ugov.proto", fileDescriptor_b75ef21394c8e122) } var fileDescriptor_b75ef21394c8e122 = []byte{ - // 398 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x52, 0x3f, 0x8f, 0xd3, 0x30, - 0x14, 0x8f, 0x0b, 0x42, 0x6a, 0x40, 0x54, 0x8a, 0x50, 0x49, 0x3b, 0x38, 0x55, 0x07, 0xd4, 0x81, - 0xda, 0x0a, 0x88, 0x05, 0x21, 0x90, 0xd2, 0x2c, 0x6c, 0x28, 0x6c, 0x2c, 0x95, 0xe3, 0xba, 0x21, - 0x6a, 0x1c, 0x47, 0x89, 0x13, 0x9a, 0x99, 0x2f, 0xc0, 0xc8, 0x07, 0xe1, 0x43, 0x74, 0xa3, 0x62, - 0x42, 0x37, 0xe4, 0xee, 0xda, 0xed, 0xc6, 0xfb, 0x04, 0xa7, 0x38, 0x49, 0xef, 0xd4, 0xc9, 0xef, - 0xbd, 0xdf, 0x9f, 0xf7, 0xd3, 0x4b, 0xf4, 0x97, 0x39, 0x67, 0x0c, 0xe7, 0x81, 0x28, 0x70, 0x61, - 0xab, 0x17, 0x25, 0xa9, 0x90, 0xc2, 0x78, 0x56, 0x03, 0x48, 0x0d, 0x0a, 0x7b, 0xfc, 0x22, 0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0x17, 0x95, 0xf5, 0x2a, 0x08, 0xe5, 0xf7, 0xdc, 0x47, 0x54, - 0xf0, 0xf6, 0x38, 0xed, 0x33, 0xcf, 0x56, 0x1b, 0x2c, 0xcb, 0x84, 0x65, 0xc8, 0x65, 0xf4, 0xdf, - 0x9f, 0xb9, 0xde, 0x1e, 0xc1, 0x65, 0xd4, 0x1b, 0x9e, 0xdc, 0xbd, 0xce, 0xdc, 0x23, 0x92, 0x39, - 0xee, 0xee, 0x1a, 0x6a, 0xbb, 0x03, 0x04, 0xfb, 0x03, 0x04, 0x57, 0x07, 0x08, 0x7e, 0x1d, 0xa1, - 0xb6, 0x3f, 0x42, 0xed, 0xff, 0x11, 0x6a, 0xdf, 0x1e, 0xee, 0xaa, 0xbf, 0xfc, 0x3c, 0x66, 0xf2, - 0x87, 0x48, 0x37, 0xaa, 0xc1, 0xc5, 0x3b, 0xbc, 0x55, 0x3f, 0x87, 0xff, 0x44, 0x5d, 0xe8, 0xed, - 0x5d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x62, 0x1a, 0x05, 0x7c, 0x38, 0x02, 0x00, 0x00, + // 388 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x3d, 0xeb, 0xd3, 0x40, + 0x18, 0xcf, 0x55, 0x11, 0x8c, 0x2f, 0x85, 0x20, 0x35, 0xed, 0x70, 0x29, 0x1d, 0xa4, 0x83, 0xde, + 0x11, 0x8b, 0x8b, 0x82, 0x42, 0x5a, 0x04, 0xb7, 0x12, 0x37, 0x97, 0x72, 0x49, 0xaf, 0xe9, 0x61, + 0x2e, 0x17, 0x92, 0xbb, 0x98, 0xcc, 0x7e, 0x01, 0x47, 0x3f, 0x52, 0x27, 0xe9, 0x28, 0x0e, 0x51, + 0xdb, 0xcd, 0xd1, 0x4f, 0x20, 0xb9, 0x24, 0x15, 0xba, 0xfc, 0xa7, 0x7b, 0x9e, 0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 0xd7, 0x9f, 0x0e, 0xf0, 0x1f, 0x5e, 0xa6, 0xcb, 0x66, 0x68, 0x29, 0xd3, + 0xfe, 0xcf, 0xcb, 0xe8, 0x56, 0x85, 0x6d, 0x45, 0x24, 0xb5, 0x6f, 0x4d, 0xc1, 0xfc, 0x81, 0xf7, + 0xaa, 0x59, 0xf9, 0xa3, 0x76, 0x16, 0x11, 0x93, 0x7b, 0x15, 0xa0, 0x50, 0x70, 0xdc, 0xbc, 0xc6, + 0xb3, 0x84, 0xca, 0x4f, 0x22, 0xfb, 0xa8, 0x1b, 0x5c, 0xbc, 0xc0, 0x4a, 0xb2, 0x18, 0x07, 0x29, + 0x27, 0x72, 0x8f, 0xde, 0xb2, 0x92, 0x6e, 0xbd, 0xb5, 0x3f, 0xba, 0x98, 0xfb, 0xbd, 0xb7, 0x4f, + 0x24, 0xf5, 0x56, 0x87, 0xdf, 0xd0, 0x38, 0x9c, 0x20, 0x38, 0x9e, 0x20, 0xf8, 0x75, 0x82, 0xe0, + 0xcb, 0x19, 0x1a, 0xc7, 0x33, 0x34, 0xbe, 0x9f, 0xa1, 0xf1, 0xe1, 0xc9, 0x4d, 0xab, 0x4a, 0xfd, + 0x37, 0x82, 0x3b, 0xfa, 0x82, 0x16, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xf9, 0xa3, 0xcd, + 0x37, 0x02, 0x00, 0x00, } func (m *InflationParams) Marshal() (dAtA []byte, err error) { @@ -128,16 +128,11 @@ func (m *InflationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size := m.InflationReductionRate.Size() - i -= size - if _, err := m.InflationReductionRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintUgov(dAtA, i, uint64(size)) + if m.InflationReductionRate != 0 { + i = encodeVarintUgov(dAtA, i, uint64(m.InflationReductionRate)) + i-- + dAtA[i] = 0x18 } - i-- - dAtA[i] = 0x1a n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.InflationCycle, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.InflationCycle):]) if err1 != nil { return 0, err1 @@ -180,8 +175,9 @@ func (m *InflationParams) Size() (n int) { n += 1 + l + sovUgov(uint64(l)) l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.InflationCycle) n += 1 + l + sovUgov(uint64(l)) - l = m.InflationReductionRate.Size() - n += 1 + l + sovUgov(uint64(l)) + if m.InflationReductionRate != 0 { + n += 1 + sovUgov(uint64(m.InflationReductionRate)) + } return n } @@ -287,10 +283,10 @@ func (m *InflationParams) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field InflationReductionRate", wireType) } - var stringLen uint64 + m.InflationReductionRate = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUgov @@ -300,26 +296,11 @@ func (m *InflationParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.InflationReductionRate |= github_com_umee_network_umee_v5_util_bpmath.FixedBP(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthUgov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthUgov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InflationReductionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipUgov(dAtA[iNdEx:]) From 5260d9aeb4a3179099582fa80b4ca57acad4edee Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Fri, 21 Jul 2023 14:11:42 +0530 Subject: [PATCH 09/17] rename mint to umint --- app/app.go | 2 +- proto/umee/ugov/v1/genesis.proto | 2 +- proto/umee/ugov/v1/query.proto | 16 +- x/ugov/client/cli/query.go | 2 +- x/ugov/genesis.pb.go | 2 +- x/ugov/keeper/query_server.go | 8 +- x/ugov/query.pb.go | 222 +++++++++++++------------- x/ugov/query.pb.gw.go | 28 ++-- x/{mint => umint}/abci.go | 8 +- x/{mint => umint}/expected_keepers.go | 2 +- x/{mint => umint}/module.go | 2 +- 11 files changed, 150 insertions(+), 144 deletions(-) rename x/{mint => umint}/abci.go (92%) rename x/{mint => umint}/expected_keepers.go (98%) rename x/{mint => umint}/module.go (98%) diff --git a/app/app.go b/app/app.go index b2c08efae0..7c5e790886 100644 --- a/app/app.go +++ b/app/app.go @@ -143,7 +143,7 @@ import ( uibcquota "github.com/umee-network/umee/v5/x/uibc/quota" uibcquotakeeper "github.com/umee-network/umee/v5/x/uibc/quota/keeper" - umint "github.com/umee-network/umee/v5/x/mint" + "github.com/umee-network/umee/v5/x/umint" "github.com/umee-network/umee/v5/x/metoken" metokenkeeper "github.com/umee-network/umee/v5/x/metoken/keeper" diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto index 9f6c71da4a..71aacc7223 100644 --- a/proto/umee/ugov/v1/genesis.proto +++ b/proto/umee/ugov/v1/genesis.proto @@ -20,6 +20,6 @@ message GenesisState { // InflationParams is params for inflation rate changes InflationParams inflation_params = 3 [(gogoproto.nullable) = false]; - // Time when the inflation cycle started + // Time when the last inflation cycle started google.protobuf.Timestamp inflation_cycle_start = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto index 063d8ab3a3..28169a2ee6 100644 --- a/proto/umee/ugov/v1/query.proto +++ b/proto/umee/ugov/v1/query.proto @@ -30,9 +30,9 @@ service Query { option (google.api.http).get = "/umee/ugov/v1/inflation-params"; } - // InflationCycleStartTime returns inflation cycle start time - rpc InflationCycleStartTime(QueryInflationCycleStartTime) returns (QueryInflationCycleStartTimeResponse) { - option (google.api.http).get = "/umee/ugov/v1/inflation-cycle"; + // InflationCycleStart returns inflation cycle start time + rpc InflationCycleStart(QueryInflationCycleStart) returns (QueryInflationCycleStartResponse) { + option (google.api.http).get = "/umee/ugov/v1/inflation-cycle-start"; } } @@ -60,10 +60,10 @@ message QueryInflationParamsResponse { InflationParams inflation_params = 1 [(gogoproto.nullable) = false]; } -// QueryInflationCycleStartTime request type. -message QueryInflationCycleStartTime {} +// QueryInflationCycleStart request type. +message QueryInflationCycleStart {} -// QueryInflationCycleStartTimeResponse response type. -message QueryInflationCycleStartTimeResponse { - google.protobuf.Timestamp inflation_cycle_start = 1 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; +// QueryInflationCycleStartResponse response type. +message QueryInflationCycleStartResponse { + google.protobuf.Timestamp start = 1 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; } diff --git a/x/ugov/client/cli/query.go b/x/ugov/client/cli/query.go index 224d06d142..9ba40fef15 100644 --- a/x/ugov/client/cli/query.go +++ b/x/ugov/client/cli/query.go @@ -88,7 +88,7 @@ func QueryInflationCyleStartedTime() *cobra.Command { } queryClient := ugov.NewQueryClient(clientCtx) - resp, err := queryClient.InflationCycleStartTime(cmd.Context(), &ugov.QueryInflationCycleStartTime{}) + resp, err := queryClient.InflationCycleStart(cmd.Context(), &ugov.QueryInflationCycleStart{}) return cli.PrintOrErr(resp, err, clientCtx) }, } diff --git a/x/ugov/genesis.pb.go b/x/ugov/genesis.pb.go index da2e7c6099..24db2f30f5 100644 --- a/x/ugov/genesis.pb.go +++ b/x/ugov/genesis.pb.go @@ -36,7 +36,7 @@ type GenesisState struct { EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` // InflationParams is params for inflation rate changes InflationParams InflationParams `protobuf:"bytes,3,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` - // Time when the inflation cycle started + // Time when the last inflation cycle started InflationCycleStart time.Time `protobuf:"bytes,4,opt,name=inflation_cycle_start,json=inflationCycleStart,proto3,stdtime" json:"inflation_cycle_start"` } diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index f9b7e12932..bf74c7e94d 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -37,13 +37,13 @@ func (q Querier) InflationParams(ctx context.Context, _ *ugov.QueryInflationPara return &ugov.QueryInflationParamsResponse{InflationParams: q.Keeper(&sdkCtx).InflationParams()}, nil } -// InflationCycleStartTime return when the inflation cycle is started -func (q Querier) InflationCycleStartTime(ctx context.Context, _ *ugov.QueryInflationCycleStartTime) ( - *ugov.QueryInflationCycleStartTimeResponse, error) { +// InflationCycleStart return when the inflation cycle is started +func (q Querier) InflationCycleStart(ctx context.Context, _ *ugov.QueryInflationCycleStart) ( + *ugov.QueryInflationCycleStartResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) icst, err := q.Keeper(&sdkCtx).GetInflationCycleStart() if err != nil { return nil, err } - return &ugov.QueryInflationCycleStartTimeResponse{InflationCycleStart: icst}, nil + return &ugov.QueryInflationCycleStartResponse{Start: icst}, nil } diff --git a/x/ugov/query.pb.go b/x/ugov/query.pb.go index f205c7b78d..4c7755995c 100644 --- a/x/ugov/query.pb.go +++ b/x/ugov/query.pb.go @@ -260,22 +260,22 @@ func (m *QueryInflationParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryInflationParamsResponse proto.InternalMessageInfo -// QueryInflationCycleStartTime request type. -type QueryInflationCycleStartTime struct { +// QueryInflationCycleStart request type. +type QueryInflationCycleStart struct { } -func (m *QueryInflationCycleStartTime) Reset() { *m = QueryInflationCycleStartTime{} } -func (m *QueryInflationCycleStartTime) String() string { return proto.CompactTextString(m) } -func (*QueryInflationCycleStartTime) ProtoMessage() {} -func (*QueryInflationCycleStartTime) Descriptor() ([]byte, []int) { +func (m *QueryInflationCycleStart) Reset() { *m = QueryInflationCycleStart{} } +func (m *QueryInflationCycleStart) String() string { return proto.CompactTextString(m) } +func (*QueryInflationCycleStart) ProtoMessage() {} +func (*QueryInflationCycleStart) Descriptor() ([]byte, []int) { return fileDescriptor_25fa04679024a47d, []int{6} } -func (m *QueryInflationCycleStartTime) XXX_Unmarshal(b []byte) error { +func (m *QueryInflationCycleStart) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryInflationCycleStartTime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryInflationCycleStart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryInflationCycleStartTime.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryInflationCycleStart.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -285,35 +285,35 @@ func (m *QueryInflationCycleStartTime) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryInflationCycleStartTime) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryInflationCycleStartTime.Merge(m, src) +func (m *QueryInflationCycleStart) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryInflationCycleStart.Merge(m, src) } -func (m *QueryInflationCycleStartTime) XXX_Size() int { +func (m *QueryInflationCycleStart) XXX_Size() int { return m.Size() } -func (m *QueryInflationCycleStartTime) XXX_DiscardUnknown() { - xxx_messageInfo_QueryInflationCycleStartTime.DiscardUnknown(m) +func (m *QueryInflationCycleStart) XXX_DiscardUnknown() { + xxx_messageInfo_QueryInflationCycleStart.DiscardUnknown(m) } -var xxx_messageInfo_QueryInflationCycleStartTime proto.InternalMessageInfo +var xxx_messageInfo_QueryInflationCycleStart proto.InternalMessageInfo -// QueryInflationCycleStartTimeResponse response type. -type QueryInflationCycleStartTimeResponse struct { - InflationCycleStart *time.Time `protobuf:"bytes,1,opt,name=inflation_cycle_start,json=inflationCycleStart,proto3,stdtime" json:"inflation_cycle_start,omitempty"` +// QueryInflationCycleStartResponse response type. +type QueryInflationCycleStartResponse struct { + Start *time.Time `protobuf:"bytes,1,opt,name=start,proto3,stdtime" json:"start,omitempty"` } -func (m *QueryInflationCycleStartTimeResponse) Reset() { *m = QueryInflationCycleStartTimeResponse{} } -func (m *QueryInflationCycleStartTimeResponse) String() string { return proto.CompactTextString(m) } -func (*QueryInflationCycleStartTimeResponse) ProtoMessage() {} -func (*QueryInflationCycleStartTimeResponse) Descriptor() ([]byte, []int) { +func (m *QueryInflationCycleStartResponse) Reset() { *m = QueryInflationCycleStartResponse{} } +func (m *QueryInflationCycleStartResponse) String() string { return proto.CompactTextString(m) } +func (*QueryInflationCycleStartResponse) ProtoMessage() {} +func (*QueryInflationCycleStartResponse) Descriptor() ([]byte, []int) { return fileDescriptor_25fa04679024a47d, []int{7} } -func (m *QueryInflationCycleStartTimeResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryInflationCycleStartResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryInflationCycleStartTimeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryInflationCycleStartResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryInflationCycleStartTimeResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryInflationCycleStartResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -323,17 +323,17 @@ func (m *QueryInflationCycleStartTimeResponse) XXX_Marshal(b []byte, determinist return b[:n], nil } } -func (m *QueryInflationCycleStartTimeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryInflationCycleStartTimeResponse.Merge(m, src) +func (m *QueryInflationCycleStartResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryInflationCycleStartResponse.Merge(m, src) } -func (m *QueryInflationCycleStartTimeResponse) XXX_Size() int { +func (m *QueryInflationCycleStartResponse) XXX_Size() int { return m.Size() } -func (m *QueryInflationCycleStartTimeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryInflationCycleStartTimeResponse.DiscardUnknown(m) +func (m *QueryInflationCycleStartResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryInflationCycleStartResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryInflationCycleStartTimeResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryInflationCycleStartResponse proto.InternalMessageInfo func init() { proto.RegisterType((*QueryMinGasPrice)(nil), "umee.ugov.v1.QueryMinGasPrice") @@ -342,53 +342,53 @@ func init() { proto.RegisterType((*QueryEmergencyGroupResponse)(nil), "umee.ugov.v1.QueryEmergencyGroupResponse") proto.RegisterType((*QueryInflationParams)(nil), "umee.ugov.v1.QueryInflationParams") proto.RegisterType((*QueryInflationParamsResponse)(nil), "umee.ugov.v1.QueryInflationParamsResponse") - proto.RegisterType((*QueryInflationCycleStartTime)(nil), "umee.ugov.v1.QueryInflationCycleStartTime") - proto.RegisterType((*QueryInflationCycleStartTimeResponse)(nil), "umee.ugov.v1.QueryInflationCycleStartTimeResponse") + proto.RegisterType((*QueryInflationCycleStart)(nil), "umee.ugov.v1.QueryInflationCycleStart") + proto.RegisterType((*QueryInflationCycleStartResponse)(nil), "umee.ugov.v1.QueryInflationCycleStartResponse") } func init() { proto.RegisterFile("umee/ugov/v1/query.proto", fileDescriptor_25fa04679024a47d) } var fileDescriptor_25fa04679024a47d = []byte{ - // 614 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0xc6, 0x1b, 0x34, 0x10, 0x78, 0xb0, 0x4d, 0xde, 0xc6, 0x4a, 0xb6, 0xa5, 0x23, 0xc0, 0x04, - 0x48, 0xb1, 0xd5, 0x21, 0x3e, 0xc0, 0xba, 0xc1, 0xc4, 0x01, 0x34, 0xba, 0x1d, 0x10, 0x97, 0xe2, - 0x64, 0x5e, 0xb0, 0x68, 0xec, 0x10, 0x27, 0x85, 0x72, 0x42, 0x48, 0x1c, 0xb8, 0x4d, 0xe2, 0x0b, -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, 0x00, 0x00, + // 612 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0x3f, 0xb5, 0x9f, 0x60, 0x0a, 0x6d, 0x35, 0x2d, 0x10, 0xdc, 0xc6, 0x09, 0xae, 0x1a, + 0xf1, 0x23, 0xcf, 0x28, 0x45, 0x6c, 0xd8, 0x35, 0x2d, 0x54, 0x2c, 0x40, 0x25, 0x65, 0xc5, 0x82, + 0x30, 0x76, 0xa7, 0x66, 0x44, 0x3c, 0x63, 0x3c, 0x76, 0x20, 0x2c, 0x91, 0x58, 0xb0, 0xab, 0xc4, + 0x8e, 0xe7, 0xe8, 0x43, 0x64, 0x59, 0xc1, 0x86, 0x55, 0x81, 0x84, 0x07, 0x41, 0x1e, 0xff, 0x10, + 0x5b, 0x69, 0xcb, 0xce, 0x73, 0xcf, 0xb9, 0xf7, 0x9c, 0xeb, 0x7b, 0x40, 0x35, 0xf2, 0x28, 0xc5, + 0x91, 0x2b, 0xfa, 0xb8, 0xdf, 0xc2, 0x6f, 0x22, 0x1a, 0x0c, 0x90, 0x1f, 0x88, 0x50, 0xc0, 0x4b, + 0x31, 0x82, 0x62, 0x04, 0xf5, 0x5b, 0xba, 0xe1, 0x08, 0xe9, 0x09, 0x89, 0x6d, 0x22, 0x29, 0xee, + 0xb7, 0x6c, 0x1a, 0x92, 0x16, 0x76, 0x04, 0xe3, 0x09, 0x5b, 0xbf, 0x9e, 0xe0, 0x5d, 0xf5, 0xc2, + 0xc9, 0x23, 0x85, 0x96, 0x5d, 0xe1, 0x8a, 0xa4, 0x1e, 0x7f, 0xa5, 0xd5, 0x55, 0x57, 0x08, 0xb7, + 0x47, 0x31, 0xf1, 0x19, 0x26, 0x9c, 0x8b, 0x90, 0x84, 0x4c, 0xf0, 0xac, 0xa7, 0x9e, 0xa2, 0xea, + 0x65, 0x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0x9b, 0xf6, 0xf6, + 0xf0, 0x97, 0x51, 0x19, 0x8e, 0x0c, 0xed, 0x78, 0x64, 0x68, 0x3f, 0x47, 0x86, 0x76, 0x38, 0x36, + 0x2a, 0xc7, 0x63, 0xa3, 0xf2, 0x7d, 0x6c, 0x54, 0x9e, 0x37, 0x5d, 0x16, 0xbe, 0x8a, 0x6c, 0xe4, + 0x08, 0x4f, 0x0d, 0xb3, 0x38, 0x0d, 0xdf, 0x8a, 0xe0, 0x75, 0x32, 0xb9, 0x7f, 0x0f, 0xbf, 0x53, + 0xe3, 0xed, 0xff, 0x55, 0x42, 0xef, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x41, 0xbf, 0x24, 0x18, + 0x4b, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -409,8 +409,8 @@ type QueryClient interface { EmergencyGroup(ctx context.Context, in *QueryEmergencyGroup, opts ...grpc.CallOption) (*QueryEmergencyGroupResponse, error) // InflationParams returns params of inflation reduction rates InflationParams(ctx context.Context, in *QueryInflationParams, opts ...grpc.CallOption) (*QueryInflationParamsResponse, error) - // InflationCycleStartTime returns inflation cycle start time - InflationCycleStartTime(ctx context.Context, in *QueryInflationCycleStartTime, opts ...grpc.CallOption) (*QueryInflationCycleStartTimeResponse, error) + // InflationCycleStart returns inflation cycle start time + InflationCycleStart(ctx context.Context, in *QueryInflationCycleStart, opts ...grpc.CallOption) (*QueryInflationCycleStartResponse, error) } type queryClient struct { @@ -448,9 +448,9 @@ func (c *queryClient) InflationParams(ctx context.Context, in *QueryInflationPar return out, nil } -func (c *queryClient) InflationCycleStartTime(ctx context.Context, in *QueryInflationCycleStartTime, opts ...grpc.CallOption) (*QueryInflationCycleStartTimeResponse, error) { - out := new(QueryInflationCycleStartTimeResponse) - err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/InflationCycleStartTime", in, out, opts...) +func (c *queryClient) InflationCycleStart(ctx context.Context, in *QueryInflationCycleStart, opts ...grpc.CallOption) (*QueryInflationCycleStartResponse, error) { + out := new(QueryInflationCycleStartResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/InflationCycleStart", in, out, opts...) if err != nil { return nil, err } @@ -465,8 +465,8 @@ type QueryServer interface { EmergencyGroup(context.Context, *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) // InflationParams returns params of inflation reduction rates InflationParams(context.Context, *QueryInflationParams) (*QueryInflationParamsResponse, error) - // InflationCycleStartTime returns inflation cycle start time - InflationCycleStartTime(context.Context, *QueryInflationCycleStartTime) (*QueryInflationCycleStartTimeResponse, error) + // InflationCycleStart returns inflation cycle start time + InflationCycleStart(context.Context, *QueryInflationCycleStart) (*QueryInflationCycleStartResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -482,8 +482,8 @@ func (*UnimplementedQueryServer) EmergencyGroup(ctx context.Context, req *QueryE func (*UnimplementedQueryServer) InflationParams(ctx context.Context, req *QueryInflationParams) (*QueryInflationParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InflationParams not implemented") } -func (*UnimplementedQueryServer) InflationCycleStartTime(ctx context.Context, req *QueryInflationCycleStartTime) (*QueryInflationCycleStartTimeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InflationCycleStartTime not implemented") +func (*UnimplementedQueryServer) InflationCycleStart(ctx context.Context, req *QueryInflationCycleStart) (*QueryInflationCycleStartResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InflationCycleStart not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -544,20 +544,20 @@ func _Query_InflationParams_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Query_InflationCycleStartTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryInflationCycleStartTime) +func _Query_InflationCycleStart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryInflationCycleStart) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).InflationCycleStartTime(ctx, in) + return srv.(QueryServer).InflationCycleStart(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/umee.ugov.v1.Query/InflationCycleStartTime", + FullMethod: "/umee.ugov.v1.Query/InflationCycleStart", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).InflationCycleStartTime(ctx, req.(*QueryInflationCycleStartTime)) + return srv.(QueryServer).InflationCycleStart(ctx, req.(*QueryInflationCycleStart)) } return interceptor(ctx, in, info, handler) } @@ -579,8 +579,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_InflationParams_Handler, }, { - MethodName: "InflationCycleStartTime", - Handler: _Query_InflationCycleStartTime_Handler, + MethodName: "InflationCycleStart", + Handler: _Query_InflationCycleStart_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -752,7 +752,7 @@ func (m *QueryInflationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *QueryInflationCycleStartTime) Marshal() (dAtA []byte, err error) { +func (m *QueryInflationCycleStart) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -762,12 +762,12 @@ func (m *QueryInflationCycleStartTime) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryInflationCycleStartTime) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryInflationCycleStart) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryInflationCycleStartTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryInflationCycleStart) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -775,7 +775,7 @@ func (m *QueryInflationCycleStartTime) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *QueryInflationCycleStartTimeResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryInflationCycleStartResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -785,18 +785,18 @@ func (m *QueryInflationCycleStartTimeResponse) Marshal() (dAtA []byte, err error return dAtA[:n], nil } -func (m *QueryInflationCycleStartTimeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryInflationCycleStartResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryInflationCycleStartTimeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryInflationCycleStartResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.InflationCycleStart != nil { - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.InflationCycleStart, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.InflationCycleStart):]) + if m.Start != nil { + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Start, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Start):]) if err3 != nil { return 0, err3 } @@ -881,7 +881,7 @@ func (m *QueryInflationParamsResponse) Size() (n int) { return n } -func (m *QueryInflationCycleStartTime) Size() (n int) { +func (m *QueryInflationCycleStart) Size() (n int) { if m == nil { return 0 } @@ -890,14 +890,14 @@ func (m *QueryInflationCycleStartTime) Size() (n int) { return n } -func (m *QueryInflationCycleStartTimeResponse) Size() (n int) { +func (m *QueryInflationCycleStartResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.InflationCycleStart != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.InflationCycleStart) + if m.Start != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.Start) n += 1 + l + sovQuery(uint64(l)) } return n @@ -1307,7 +1307,7 @@ func (m *QueryInflationParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryInflationCycleStartTime) Unmarshal(dAtA []byte) error { +func (m *QueryInflationCycleStart) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1330,10 +1330,10 @@ func (m *QueryInflationCycleStartTime) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryInflationCycleStartTime: wiretype end group for non-group") + return fmt.Errorf("proto: QueryInflationCycleStart: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryInflationCycleStartTime: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryInflationCycleStart: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1357,7 +1357,7 @@ func (m *QueryInflationCycleStartTime) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryInflationCycleStartTimeResponse) Unmarshal(dAtA []byte) error { +func (m *QueryInflationCycleStartResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1380,15 +1380,15 @@ func (m *QueryInflationCycleStartTimeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryInflationCycleStartTimeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryInflationCycleStartResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryInflationCycleStartTimeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryInflationCycleStartResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleStart", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1415,10 +1415,10 @@ func (m *QueryInflationCycleStartTimeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.InflationCycleStart == nil { - m.InflationCycleStart = new(time.Time) + if m.Start == nil { + m.Start = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.InflationCycleStart, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.Start, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/query.pb.gw.go b/x/ugov/query.pb.gw.go index b6c40dcdce..214b2b99a7 100644 --- a/x/ugov/query.pb.gw.go +++ b/x/ugov/query.pb.gw.go @@ -87,20 +87,20 @@ func local_request_Query_InflationParams_0(ctx context.Context, marshaler runtim } -func request_Query_InflationCycleStartTime_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryInflationCycleStartTime +func request_Query_InflationCycleStart_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInflationCycleStart var metadata runtime.ServerMetadata - msg, err := client.InflationCycleStartTime(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.InflationCycleStart(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_InflationCycleStartTime_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryInflationCycleStartTime +func local_request_Query_InflationCycleStart_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInflationCycleStart var metadata runtime.ServerMetadata - msg, err := server.InflationCycleStartTime(ctx, &protoReq) + msg, err := server.InflationCycleStart(ctx, &protoReq) return msg, metadata, err } @@ -180,7 +180,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_InflationCycleStartTime_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InflationCycleStart_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -191,7 +191,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_InflationCycleStartTime_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_InflationCycleStart_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -199,7 +199,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_InflationCycleStartTime_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InflationCycleStart_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -304,7 +304,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_InflationCycleStartTime_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InflationCycleStart_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -313,14 +313,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_InflationCycleStartTime_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_InflationCycleStart_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_InflationCycleStartTime_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InflationCycleStart_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -334,7 +334,7 @@ var ( pattern_Query_InflationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation-params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_InflationCycleStartTime_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation-cycle"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_InflationCycleStart_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation-cycle-start"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -344,5 +344,5 @@ var ( forward_Query_InflationParams_0 = runtime.ForwardResponseMessage - forward_Query_InflationCycleStartTime_0 = runtime.ForwardResponseMessage + forward_Query_InflationCycleStart_0 = runtime.ForwardResponseMessage ) diff --git a/x/mint/abci.go b/x/umint/abci.go similarity index 92% rename from x/mint/abci.go rename to x/umint/abci.go index 4479031696..3117554252 100644 --- a/x/mint/abci.go +++ b/x/umint/abci.go @@ -1,4 +1,4 @@ -package mint +package umint import ( "time" @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/umee-network/umee/v5/util" + "github.com/umee-network/umee/v5/util/coin" ugov "github.com/umee-network/umee/v5/x/ugov" ) @@ -34,8 +35,13 @@ func BeginBlock(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper Keeper) { // mint coins, update supply mintedCoin := minter.BlockProvision(mintParams) + // checking the if mintedCoins + totalStakingSupply is more than max supply of staking denom + if mintedCoin.Amount.Add(totalStakingSupply).GT(lp.MaxSupply.Amount) { + mintedCoin = coin.New(mintParams.MintDenom, lp.MaxSupply.Amount.Sub(totalStakingSupply).Int64()) + } mintedCoins := sdk.NewCoins(mintedCoin) + // mint the coins err := mintKeeper.MintCoins(ctx, mintedCoins) util.Panic(err) diff --git a/x/mint/expected_keepers.go b/x/umint/expected_keepers.go similarity index 98% rename from x/mint/expected_keepers.go rename to x/umint/expected_keepers.go index 1b80bfe414..c2b7063d7d 100644 --- a/x/mint/expected_keepers.go +++ b/x/umint/expected_keepers.go @@ -1,4 +1,4 @@ -package mint +package umint import ( "time" diff --git a/x/mint/module.go b/x/umint/module.go similarity index 98% rename from x/mint/module.go rename to x/umint/module.go index 31960824ea..283e12d86f 100644 --- a/x/mint/module.go +++ b/x/umint/module.go @@ -1,4 +1,4 @@ -package mint +package umint import ( "github.com/cosmos/cosmos-sdk/codec" From 5dfc76dc6283aed92008ba19bd35687996f9196a Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Fri, 21 Jul 2023 14:16:43 +0530 Subject: [PATCH 10/17] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a883a72f31..f73246f71d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [2129](https://github.com/umee-network/umee/pull/2129) Emergency Group x/ugov proto. - [2146](https://github.com/umee-network/umee/pull/2146) Add store GetTimeMs and SetTimeMs. - [2157](https://github.com/umee-network/umee/pull/2157) Add `x/metoken` module. +- [2145](https://github.com/umee-network/umee/pull/2145) Add New `Inflation Parms` to x/ugov proto and added `inflation rate` change logic to umint ### Improvements From 2566e80d01c414be78690ffb7071fa6bc324d87c Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Sun, 23 Jul 2023 18:49:04 +0530 Subject: [PATCH 11/17] remove the umint and using umee inflaiton calculator for mint BeginBlock --- app/inflation/expected_keepers.go | 2 + app/inflation/inflatin.go | 51 -------------- app/inflation/inflation.go | 77 ++++++++++++++++++++ proto/umee/ugov/v1/events.proto | 2 +- x/ugov/events.pb.go | 58 ++++++++-------- x/ugov/inflation_params.go | 6 +- x/ugov/keeper/genesis.go | 2 +- x/ugov/keeper/params.go | 7 +- x/ugov/keeper/params_test.go | 2 +- x/ugov/keeper/query_server.go | 2 +- x/umint/abci.go | 112 ------------------------------ x/umint/expected_keepers.go | 27 ------- x/umint/module.go | 42 ----------- 13 files changed, 119 insertions(+), 271 deletions(-) delete mode 100644 app/inflation/inflatin.go create mode 100644 app/inflation/inflation.go delete mode 100644 x/umint/abci.go delete mode 100644 x/umint/expected_keepers.go delete mode 100644 x/umint/module.go diff --git a/app/inflation/expected_keepers.go b/app/inflation/expected_keepers.go index 4f9d97c84d..1ef525092e 100644 --- a/app/inflation/expected_keepers.go +++ b/app/inflation/expected_keepers.go @@ -3,8 +3,10 @@ package inflation import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) type MintKeeper interface { StakingTokenSupply(ctx sdk.Context) math.Int + SetParams(ctx sdk.Context, params minttypes.Params) } diff --git a/app/inflation/inflatin.go b/app/inflation/inflatin.go deleted file mode 100644 index efd8dc50c1..0000000000 --- a/app/inflation/inflatin.go +++ /dev/null @@ -1,51 +0,0 @@ -package inflation - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - - ugovkeeper "github.com/umee-network/umee/v5/x/ugov/keeper" -) - -type Calculator struct { - UgovKeeperB ugovkeeper.Builder - MintKeeper MintKeeper -} - -func (c Calculator) InflationRate( - ctx sdk.Context, minter minttypes.Minter, p minttypes.Params, bondedRatio sdk.Dec) sdk.Dec { - - maxSupply, _ := sdk.NewIntFromString("21_000_000_000_000_000000") - - totalSupply := c.MintKeeper.StakingTokenSupply(ctx) - if totalSupply.GTE(maxSupply) { - // supply is already reached the maximum amount, so inflation should be zero - return sdk.ZeroDec() - } - - // TODO: here we need to use a new inflation function and check if we need to go to the - // next inflation cycle - minter.Inflation = c.calculateInflation(ctx, minter, p, bondedRatio) - return readjustSupply(totalSupply, maxSupply, minter, p) -} - -func (c Calculator) calculateInflation( - ctx sdk.Context, minter minttypes.Minter, p minttypes.Params, bondedRatio sdk.Dec) sdk.Dec { - return minttypes.DefaultInflationCalculationFn(ctx, minter, p, bondedRatio) -} - -// TODO: add unit tests to this function -func readjustSupply(totalSupply, maxSupply math.Int, minter minttypes.Minter, params minttypes.Params) sdk.Dec { - minter.AnnualProvisions = minter.NextAnnualProvisions(params, totalSupply) - newSupply := minter.BlockProvision(params).Amount - newTotalSupply := totalSupply.Add(newSupply) - if newTotalSupply.GT(maxSupply) { - overdraft := newTotalSupply.Sub(maxSupply) - maxNewSupply := newSupply.Sub(overdraft) - factor := sdk.NewDecFromInt(maxNewSupply).QuoInt(newSupply) - minter.Inflation = minter.Inflation.Mul(factor) - } - - return minter.Inflation -} diff --git a/app/inflation/inflation.go b/app/inflation/inflation.go new file mode 100644 index 0000000000..1fb40af93f --- /dev/null +++ b/app/inflation/inflation.go @@ -0,0 +1,77 @@ +package inflation + +import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + + "github.com/umee-network/umee/v5/util" + ugovkeeper "github.com/umee-network/umee/v5/x/ugov/keeper" +) + +type Calculator struct { + UgovKeeperB ugovkeeper.Builder + MintKeeper MintKeeper +} + +func (c Calculator) InflationRate(ctx sdk.Context, minter minttypes.Minter, mintParams minttypes.Params, + bondedRatio sdk.Dec) sdk.Dec { + + ugovKeeper := c.UgovKeeperB.Keeper(&ctx) + inflationParams := ugovKeeper.InflationParams() + maxSupplyAmount := inflationParams.MaxSupply.Amount + + totalSupply := c.MintKeeper.StakingTokenSupply(ctx) + if totalSupply.GTE(maxSupplyAmount) { + // supply is already reached the maximum amount, so inflation should be zero + return sdk.ZeroDec() + } + + icst, err := ugovKeeper.GetInflationCycleStart() + util.Panic(err) + + // Initially inflation_cycle start time is zero + // Once chain start inflation cycle start time will be inflation rate change executed block time + if ctx.BlockTime().After(icst.Add(inflationParams.InflationCycle)) { + // inflation cycle is completed , so we need to update the inflation max and min rate + // inflationReductionRate = 25 / 100 = 0.25 + inflationReductionRate := inflationParams.InflationReductionRate.ToDec().Quo(sdk.NewDec(100)) + // InflationMax = PrevInflationMax * ( 1 - 0.25) + mintParams.InflationMax = mintParams.InflationMax.Mul(sdk.OneDec().Sub(inflationReductionRate)) + // InflationMin = PrevInflationMin * ( 1 - 0.25) + mintParams.InflationMin = mintParams.InflationMin.Mul(sdk.OneDec().Sub(inflationReductionRate)) + + // update the changed inflation min and max rates + c.MintKeeper.SetParams(ctx, mintParams) + + // update the executed time of inflation cycle + err := ugovKeeper.SetInflationCycleStart(ctx.BlockTime()) + util.Panic(err) + ctx.Logger().Info("inflation min and max rates are updated", + "inflation_max", mintParams.InflationMax, "inflation_min", mintParams.InflationMin, + "inflation_cycle_start", ctx.BlockTime().String(), + ) + } + + minter.Inflation = minttypes.DefaultInflationCalculationFn(ctx, minter, mintParams, bondedRatio) + return c.adjustInflation(totalSupply, inflationParams.MaxSupply.Amount, minter, mintParams) +} + +// adjustInflation check if newly minting coins will execeed the MaxSupply then it will adjust the inflation with +// respect to MaxSupply +func (c Calculator) adjustInflation(totalSupply, maxSupply math.Int, minter minttypes.Minter, + params minttypes.Params) sdk.Dec { + minter.AnnualProvisions = minter.NextAnnualProvisions(params, totalSupply) + newSupply := minter.BlockProvision(params).Amount + newTotalSupply := totalSupply.Add(newSupply) + if newTotalSupply.GT(maxSupply) { + newTotalSupply = maxSupply.Sub(totalSupply) + newAnnualProvision := newTotalSupply.Mul(sdk.NewInt(int64(params.BlocksPerYear))) + // AnnualProvisions = Inflation * TotalSupply + // Mint Coins = AnnualProvisions / BlocksPerYear + // so get the new Inflation + // Inflation = (New Mint Coins * BlocksPerYear ) / TotalSupply + return sdk.NewDec(newAnnualProvision.Quo(totalSupply).Int64()) + } + return minter.Inflation +} diff --git a/proto/umee/ugov/v1/events.proto b/proto/umee/ugov/v1/events.proto index 3643e917b2..2409b13720 100644 --- a/proto/umee/ugov/v1/events.proto +++ b/proto/umee/ugov/v1/events.proto @@ -21,5 +21,5 @@ message EventEmergencyGroup { // EventInflationParams is emitted when GovUpdateInflationParams is correctly executed. message EventInflationParams { - InflationParams inflation_params = 1 [(gogoproto.nullable) = false]; + InflationParams params = 1 [(gogoproto.nullable) = false]; } \ No newline at end of file diff --git a/x/ugov/events.pb.go b/x/ugov/events.pb.go index e220863a84..e9392f01c5 100644 --- a/x/ugov/events.pb.go +++ b/x/ugov/events.pb.go @@ -103,7 +103,7 @@ var xxx_messageInfo_EventEmergencyGroup proto.InternalMessageInfo // EventInflationParams is emitted when GovUpdateInflationParams is correctly executed. type EventInflationParams struct { - InflationParams InflationParams `protobuf:"bytes,1,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` + Params InflationParams `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *EventInflationParams) Reset() { *m = EventInflationParams{} } @@ -148,30 +148,30 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/events.proto", fileDescriptor_0885cdf0808da4ea) } var fileDescriptor_0885cdf0808da4ea = []byte{ - // 362 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xc1, 0x6a, 0xe2, 0x40, - 0x1c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0xd6, 0xac, 0x1c, 0xbf, 0x1b, 0xa9, 0xce, 0x99, - 0xf3, 0xcd, 0xb8, 0x8f, 0x63, 0x90, 0x14, 0x78, 0x74, 0x37, 0x91, 0x22, 0x5d, 0xba, 0x03, 0xa7, - 0x0a, 0x3b, 0xe2, 0x53, 0x8d, 0x1a, 0x76, 0xdb, 0xee, 0x7e, 0x1d, 0x36, 0x1e, 0x1f, 0x7a, 0xf5, - 0x22, 0x64, 0x30, 0x9f, 0x4b, 0x50, 0xea, 0x34, 0x91, 0x8c, 0xd3, 0x59, 0x05, 0xf6, 0x2c, 0x3a, - 0x0b, 0xa7, 0x6e, 0x9c, 0x8f, 0xf8, 0xe2, 0x3a, 0x48, 0x98, 0xe0, 0xd3, 0x40, 0x06, 0xb1, 0x72, - 0x4f, 0x9c, 0x1a, 0xdb, 0x21, 0x7f, 0x69, 0x98, 0xf1, 0x2e, 0xf5, 0x7f, 0xe2, 0x8f, 0x13, 0xe3, - 0x83, 0x87, 0x45, 0xfd, 0x2a, 0x3b, 0xc0, 0xa3, 0xd5, 0x2b, 0xb2, 0x56, 0x1b, 0x64, 0xaf, 0x37, - 0xc8, 0x7e, 0xd9, 0x20, 0xfb, 0x7e, 0x8b, 0xac, 0xf5, 0x16, 0x59, 0x4f, 0x5b, 0x64, 0x9d, 0xff, - 0xa6, 0x2c, 0xb9, 0x4c, 0x43, 0x1c, 0x89, 0x98, 0x68, 0xf7, 0x1e, 0x87, 0xe4, 0x46, 0xc8, 0x2b, - 0x73, 0x90, 0xec, 0x2f, 0xb9, 0x35, 0x5b, 0x87, 0x5f, 0xcc, 0xd8, 0x7f, 0xde, 0x02, 0x00, 0x00, - 0xff, 0xff, 0x75, 0x63, 0xc9, 0x35, 0x01, 0x02, 0x00, 0x00, + // 357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xc1, 0x4e, 0xea, 0x40, + 0x14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, 0xe8, 0x1b, 0xa4, 0x9a, 0x17, 0xce, 0xb6, + 0xa1, 0x0f, 0x22, 0x90, 0x14, 0x78, 0xf8, 0x38, 0x94, 0x22, 0x99, 0xbb, 0x5d, 0xe7, 0x3f, 0x7c, + 0x29, 0x53, 0xaa, 0xa5, 0xaa, 0xdd, 0xb0, 0x5b, 0xff, 0x7a, 0xd5, 0x97, 0xe7, 0x76, 0x25, 0x0f, + 0xe9, 0xce, 0x66, 0x12, 0x94, 0x9a, 0xc4, 0x92, 0x71, 0x3a, 0x2e, 0xc3, 0x06, 0xa2, 0x39, 0x71, + 0x2a, 0x86, 0x7c, 0xc6, 0xaf, 0xef, 0xfc, 0x98, 0x09, 0x3e, 0xf2, 0xa5, 0x1f, 0x29, 0xf7, 0xd8, + 0x29, 0xcc, 0xcd, 0xcb, 0x10, 0x8b, 0x9d, 0x3d, 0xfc, 0xf3, 0xb0, 0xf8, 0xd7, 0x7a, 0x5e, 0x3a, + 0xff, 0xd2, 0xeb, 0x2f, 0x3e, 0x90, 0xb5, 0x58, 0x21, 0x7b, 0xb9, 0x42, 0xf6, 0xfb, 0x0a, 0xd9, + 0x4f, 0x6b, 0x64, 0x2d, 0xd7, 0xc8, 0x7a, 0x5d, 0x23, 0xeb, 0xf2, 0x80, 0xb2, 0xf8, 0x26, 0x09, + 0x70, 0x28, 0x22, 0xa2, 0xa1, 0x6d, 0x0e, 0xf1, 0xbd, 0x90, 0xb7, 0x66, 0x20, 0xe9, 0x11, 0x79, + 0x30, 0x87, 0x0d, 0x0a, 0xe6, 0xb2, 0x87, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x04, 0xbd, 0x18, + 0xa5, 0xee, 0x01, 0x00, 0x00, } func (m *EventMinGasPrice) Marshal() (dAtA []byte, err error) { @@ -262,7 +262,7 @@ func (m *EventInflationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.InflationParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -319,7 +319,7 @@ func (m *EventInflationParams) Size() (n int) { } var l int _ = l - l = m.InflationParams.Size() + l = m.Params.Size() n += 1 + l + sovEvents(uint64(l)) return n } @@ -527,7 +527,7 @@ func (m *EventInflationParams) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflationParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -554,7 +554,7 @@ func (m *EventInflationParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.InflationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/inflation_params.go b/x/ugov/inflation_params.go index fc0be0f684..880aac387c 100644 --- a/x/ugov/inflation_params.go +++ b/x/ugov/inflation_params.go @@ -13,9 +13,9 @@ import ( func DefaultInflationParams() InflationParams { return InflationParams{ - MaxSupply: coin.New(appparams.BondDenom, 21_000000000), // 21 Billition Maximum for Staking Bonding Denom - InflationCycle: time.Hour * 24 * 365, // 2 years for default inflation cycle - InflationReductionRate: bpmath.FixedBP(25), // 25% reduction rate for inflation cyle + MaxSupply: coin.New(appparams.BondDenom, 21_000000000_000000), // 21 Billion Maximum + InflationCycle: time.Hour * 24 * 365, // 2 years for default inflation cycle + InflationReductionRate: bpmath.FixedBP(25), // 25% reduction rate for inflation cyle } } diff --git a/x/ugov/keeper/genesis.go b/x/ugov/keeper/genesis.go index 46958f7458..445d2fb53e 100644 --- a/x/ugov/keeper/genesis.go +++ b/x/ugov/keeper/genesis.go @@ -11,7 +11,7 @@ func (k Keeper) ExportGenesis() *ugov.GenesisState { return &ugov.GenesisState{ MinGasPrice: k.MinGasPrice(), InflationParams: k.InflationParams(), - InflationCycleStart: *lcst, + InflationCycleStart: lcst, } } diff --git a/x/ugov/keeper/params.go b/x/ugov/keeper/params.go index 2decd2a51e..8a9233afec 100644 --- a/x/ugov/keeper/params.go +++ b/x/ugov/keeper/params.go @@ -43,9 +43,10 @@ func (k Keeper) InflationParams() ugov.InflationParams { } func (k Keeper) SetInflationCycleStart(startTime time.Time) error { - return store.SetBinValue(k.store, KeyInflationCycleStart, &startTime, "inflation_cycle_start") + store.SetTimeMs(k.store, KeyInflationCycleStart, startTime) + return nil } -func (k Keeper) GetInflationCycleStart() (*time.Time, error) { - return store.GetBinValue[*time.Time](k.store, KeyInflationCycleStart, "inflation_cycle_start") +func (k Keeper) GetInflationCycleStart() (time.Time, error) { + return store.GetTimeMs(k.store, KeyInflationCycleStart) } diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index 0be1cba57f..456859c946 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -70,5 +70,5 @@ func TestInflationCycleStart(t *testing.T) { require.NoError(err) ricst, err := k.GetInflationCycleStart() require.NoError(err) - require.Equal(ricst.Equal(icst), true, "inflation cycle start time should be same") + require.Equal(ricst.UnixMilli(), icst.UnixMilli(), "inflation cycle start time should be same") } diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index bf74c7e94d..d51e227556 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -45,5 +45,5 @@ func (q Querier) InflationCycleStart(ctx context.Context, _ *ugov.QueryInflation if err != nil { return nil, err } - return &ugov.QueryInflationCycleStartResponse{Start: icst}, nil + return &ugov.QueryInflationCycleStartResponse{Start: &icst}, nil } diff --git a/x/umint/abci.go b/x/umint/abci.go deleted file mode 100644 index 3117554252..0000000000 --- a/x/umint/abci.go +++ /dev/null @@ -1,112 +0,0 @@ -package umint - -import ( - "time" - - "github.com/cosmos/cosmos-sdk/telemetry" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/umee-network/umee/v5/util" - "github.com/umee-network/umee/v5/util/coin" - ugov "github.com/umee-network/umee/v5/x/ugov" -) - -// BeginBlock overrides the mint module BeginBlock. -func BeginBlock(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper Keeper) { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) - // inflation rate change params - lp := ugovKeeper.InflationParams() - // mint module params - mintParams := mintKeeper.GetParams(ctx) - - totalStakingSupply := mintKeeper.StakingTokenSupply(ctx) - if totalStakingSupply.GTE(lp.MaxSupply.Amount) { - // supply is already reached the maximum amount, so no more minting the staking token - return - } - - // fetch stored minter & params - minter := mintKeeper.GetMinter(ctx) - bondedRatio := mintKeeper.BondedRatio(ctx) - // recalculate inflation rate - minter.Inflation = InflationCalculationFn(ctx, ugovKeeper, mintKeeper, lp, mintParams, bondedRatio, minter.Inflation) - minter.AnnualProvisions = minter.NextAnnualProvisions(mintParams, totalStakingSupply) - mintKeeper.SetMinter(ctx, minter) - - // mint coins, update supply - mintedCoin := minter.BlockProvision(mintParams) - // checking the if mintedCoins + totalStakingSupply is more than max supply of staking denom - if mintedCoin.Amount.Add(totalStakingSupply).GT(lp.MaxSupply.Amount) { - mintedCoin = coin.New(mintParams.MintDenom, lp.MaxSupply.Amount.Sub(totalStakingSupply).Int64()) - } - mintedCoins := sdk.NewCoins(mintedCoin) - - // mint the coins - err := mintKeeper.MintCoins(ctx, mintedCoins) - util.Panic(err) - - // send the minted coins to the fee collector account - err = mintKeeper.AddCollectedFees(ctx, mintedCoins) - util.Panic(err) - - if mintedCoin.Amount.IsInt64() { - defer telemetry.ModuleSetGauge(types.ModuleName, float32(mintedCoin.Amount.Int64()), "minted_tokens") - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeMint, - sdk.NewAttribute(types.AttributeKeyBondedRatio, bondedRatio.String()), - sdk.NewAttribute(types.AttributeKeyInflation, minter.Inflation.String()), - sdk.NewAttribute(types.AttributeKeyAnnualProvisions, minter.AnnualProvisions.String()), - sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), - ), - ) -} - -func InflationCalculationFn(ctx sdk.Context, ugovKeeper UGovKeeper, mintKeeper Keeper, - lp ugov.InflationParams, params types.Params, bondedRatio sdk.Dec, currentInflation sdk.Dec) sdk.Dec { - - icst, err := ugovKeeper.GetInflationCycleStart() - util.Panic(err) - - // Initially inflation_cycle start time is zero - // Once chain start inflation cycle start time will be inflation rate change executed block time - if ctx.BlockTime().After(icst.Add(lp.InflationCycle)) { - // inflation cycle is completed , so we need to update the inflation max and min rate - // inflationReductionRate = 25 / 100 = 0.25 - inflationReductionRate := lp.InflationReductionRate.ToDec().Quo(sdk.NewDec(100)) - // InflationMax = PrevInflationMax * ( 1 - 0.25) - params.InflationMax = params.InflationMax.Mul(sdk.OneDec().Sub(inflationReductionRate)) - // InflationMin = PrevInflationMin * ( 1 - 0.25) - params.InflationMin = params.InflationMin.Mul(sdk.OneDec().Sub(inflationReductionRate)) - - // update the changed inflation min and max rates - mintKeeper.SetParams(ctx, params) - - // update the executed time of inflation cycle - err := ugovKeeper.SetInflationCycleStart(ctx.BlockTime()) - util.Panic(err) - ctx.Logger().Info("inflation min and max rates are updated", - "inflation_max", params.InflationMax, "inflation_min", params.InflationMin, - "inflation_cycle_start", ctx.BlockTime().String(), - ) - } - - // (1 - bondedRatio/GoalBonded) * InflationRateChange - inflationRateChangePerYear := sdk.OneDec(). - Sub(bondedRatio.Quo(params.GoalBonded)). - Mul(params.InflationRateChange) - inflationRateChange := inflationRateChangePerYear.Quo(sdk.NewDec(int64(params.BlocksPerYear))) - - // adjust the new annual inflation for this next cycle - inflation := currentInflation.Add(inflationRateChange) // note inflationRateChange may be negative - if inflation.GT(params.InflationMax) { - inflation = params.InflationMax - } - if inflation.LT(params.InflationMin) { - inflation = params.InflationMin - } - - return inflation -} diff --git a/x/umint/expected_keepers.go b/x/umint/expected_keepers.go deleted file mode 100644 index c2b7063d7d..0000000000 --- a/x/umint/expected_keepers.go +++ /dev/null @@ -1,27 +0,0 @@ -package umint - -import ( - "time" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - ugov "github.com/umee-network/umee/v5/x/ugov" -) - -type UGovKeeper interface { - SetInflationCycleStart(startTime time.Time) error - GetInflationCycleStart() (*time.Time, error) - InflationParams() ugov.InflationParams -} - -type Keeper interface { - SetParams(ctx sdk.Context, params minttypes.Params) - GetParams(ctx sdk.Context) (params minttypes.Params) - StakingTokenSupply(ctx sdk.Context) math.Int - SetMinter(ctx sdk.Context, minter minttypes.Minter) - GetMinter(ctx sdk.Context) (minter minttypes.Minter) - BondedRatio(ctx sdk.Context) sdk.Dec - MintCoins(ctx sdk.Context, newCoins sdk.Coins) error - AddCollectedFees(ctx sdk.Context, fees sdk.Coins) error -} diff --git a/x/umint/module.go b/x/umint/module.go deleted file mode 100644 index 283e12d86f..0000000000 --- a/x/umint/module.go +++ /dev/null @@ -1,42 +0,0 @@ -package umint - -import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/mint" - mk "github.com/cosmos/cosmos-sdk/x/mint/keeper" - "github.com/cosmos/cosmos-sdk/x/mint/types" - abci "github.com/tendermint/tendermint/abci/types" - - ugovkeeper "github.com/umee-network/umee/v5/x/ugov/keeper" -) - -var ( - _ module.AppModule = AppModule{} -) - -type AppModule struct { - mint.AppModule - mintKeeper mk.Keeper - ugovKB ugovkeeper.Builder -} - -func NewAppModule(cdc codec.Codec, keeper mk.Keeper, ak types.AccountKeeper, ugovkb ugovkeeper.Builder, -) AppModule { - return AppModule{ - AppModule: mint.NewAppModule(cdc, keeper, ak, nil), - mintKeeper: keeper, - ugovKB: ugovkb, - } -} - -// Name implements module.AppModule. -func (AppModule) Name() string { - return types.ModuleName -} - -// BeginBlock executes all ABCI BeginBlock logic respective to the x/uibc module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlock(ctx, am.ugovKB.Keeper(&ctx), am.mintKeeper) -} From b7f6f2c2cbb40e8345226ea3da2fd928a0faf2c2 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 25 Jul 2023 17:18:11 +0530 Subject: [PATCH 12/17] move cycle start time to cycle end --- app/inflation/inflation.go | 14 +- proto/umee/ugov/v1/genesis.proto | 4 +- proto/umee/ugov/v1/query.proto | 20 +-- x/ugov/client/cli/query.go | 10 +- x/ugov/genesis.pb.go | 66 ++++----- x/ugov/keeper/genesis.go | 10 +- x/ugov/keeper/params.go | 4 +- x/ugov/keeper/params_test.go | 8 +- x/ugov/keeper/query_server.go | 12 +- x/ugov/query.pb.go | 230 +++++++++++++++---------------- x/ugov/query.pb.gw.go | 30 ++-- 11 files changed, 204 insertions(+), 204 deletions(-) diff --git a/app/inflation/inflation.go b/app/inflation/inflation.go index 1fb40af93f..42e4152871 100644 --- a/app/inflation/inflation.go +++ b/app/inflation/inflation.go @@ -27,12 +27,12 @@ func (c Calculator) InflationRate(ctx sdk.Context, minter minttypes.Minter, mint return sdk.ZeroDec() } - icst, err := ugovKeeper.GetInflationCycleStart() + cycleEnd, err := ugovKeeper.GetInflationCycleEnd() util.Panic(err) - // Initially inflation_cycle start time is zero - // Once chain start inflation cycle start time will be inflation rate change executed block time - if ctx.BlockTime().After(icst.Add(inflationParams.InflationCycle)) { + // Initially inflation_cycle end time is zero + // Once chain start inflation cycle end time will be executed block time + cycle duration + if ctx.BlockTime().After(cycleEnd) { // inflation cycle is completed , so we need to update the inflation max and min rate // inflationReductionRate = 25 / 100 = 0.25 inflationReductionRate := inflationParams.InflationReductionRate.ToDec().Quo(sdk.NewDec(100)) @@ -44,12 +44,12 @@ func (c Calculator) InflationRate(ctx sdk.Context, minter minttypes.Minter, mint // update the changed inflation min and max rates c.MintKeeper.SetParams(ctx, mintParams) - // update the executed time of inflation cycle - err := ugovKeeper.SetInflationCycleStart(ctx.BlockTime()) + // update the end time of current inflation cycle + err := ugovKeeper.SetInflationCycleEnd(ctx.BlockTime().Add(inflationParams.InflationCycle)) util.Panic(err) ctx.Logger().Info("inflation min and max rates are updated", "inflation_max", mintParams.InflationMax, "inflation_min", mintParams.InflationMin, - "inflation_cycle_start", ctx.BlockTime().String(), + "inflation_cycle_end", ctx.BlockTime().Add(inflationParams.InflationCycle).String(), ) } diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto index 71aacc7223..c02c6c0369 100644 --- a/proto/umee/ugov/v1/genesis.proto +++ b/proto/umee/ugov/v1/genesis.proto @@ -20,6 +20,6 @@ message GenesisState { // InflationParams is params for inflation rate changes InflationParams inflation_params = 3 [(gogoproto.nullable) = false]; - // Time when the last inflation cycle started - google.protobuf.Timestamp inflation_cycle_start = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + // Time when the current inflation cycle will end + google.protobuf.Timestamp inflation_cycle_end = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto index bc827afd24..73870da77a 100644 --- a/proto/umee/ugov/v1/query.proto +++ b/proto/umee/ugov/v1/query.proto @@ -27,12 +27,12 @@ service Query { // InflationParams returns params of inflation reduction rates rpc InflationParams(QueryInflationParams) returns (QueryInflationParamsResponse) { - option (google.api.http).get = "/umee/ugov/v1/inflation-params"; + option (google.api.http).get = "/umee/ugov/v1/inflation_params"; } - // InflationCycleStart returns inflation cycle start time - rpc InflationCycleStart(QueryInflationCycleStart) returns (QueryInflationCycleStartResponse) { - option (google.api.http).get = "/umee/ugov/v1/inflation-cycle-start"; + // InflationCycleEnd returns inflation cycle end time + rpc InflationCycleEnd(QueryInflationCycleEnd) returns (QueryInflationCycleEndResponse) { + option (google.api.http).get = "/umee/ugov/v1/inflation_cycle_end"; } } @@ -57,13 +57,13 @@ message QueryInflationParams {} // QueryInflationParamsResponse response type. message QueryInflationParamsResponse { - InflationParams inflation_params = 1 [(gogoproto.nullable) = false]; + InflationParams params = 1 [(gogoproto.nullable) = false]; } -// QueryInflationCycleStart request type. -message QueryInflationCycleStart {} +// QueryInflationCycleEnd request type. +message QueryInflationCycleEnd {} -// QueryInflationCycleStartResponse response type. -message QueryInflationCycleStartResponse { - google.protobuf.Timestamp start = 1 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; +// QueryInflationCycleEndResponse response type. +message QueryInflationCycleEndResponse { + google.protobuf.Timestamp end = 1 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; } diff --git a/x/ugov/client/cli/query.go b/x/ugov/client/cli/query.go index 9ba40fef15..2fb2ba03fd 100644 --- a/x/ugov/client/cli/query.go +++ b/x/ugov/client/cli/query.go @@ -23,7 +23,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand( QueryMinGasPrice(), QueryLiquidationParams(), - QueryInflationCyleStartedTime(), + QueryInflationCyleEnd(), ) return cmd @@ -75,10 +75,10 @@ func QueryLiquidationParams() *cobra.Command { return cmd } -// QueryInflationCyleStartedTime create the Msg/QueryInflationCyleStartedTime CLI. -func QueryInflationCyleStartedTime() *cobra.Command { +// QueryInflationCyleEnd create the Msg/QueryInflationCyleEnd CLI. +func QueryInflationCyleEnd() *cobra.Command { cmd := &cobra.Command{ - Use: "inflation-cycle-start-time", + Use: "inflation-cycle-end", Args: cobra.NoArgs, Short: "Query the When the Inflation Cycle is Started", RunE: func(cmd *cobra.Command, args []string) error { @@ -88,7 +88,7 @@ func QueryInflationCyleStartedTime() *cobra.Command { } queryClient := ugov.NewQueryClient(clientCtx) - resp, err := queryClient.InflationCycleStart(cmd.Context(), &ugov.QueryInflationCycleStart{}) + resp, err := queryClient.InflationCycleEnd(cmd.Context(), &ugov.QueryInflationCycleEnd{}) return cli.PrintOrErr(resp, err, clientCtx) }, } diff --git a/x/ugov/genesis.pb.go b/x/ugov/genesis.pb.go index 24db2f30f5..93245b5cc9 100644 --- a/x/ugov/genesis.pb.go +++ b/x/ugov/genesis.pb.go @@ -36,8 +36,8 @@ type GenesisState struct { EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` // InflationParams is params for inflation rate changes InflationParams InflationParams `protobuf:"bytes,3,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` - // Time when the last inflation cycle started - InflationCycleStart time.Time `protobuf:"bytes,4,opt,name=inflation_cycle_start,json=inflationCycleStart,proto3,stdtime" json:"inflation_cycle_start"` + // Time when the current inflation cycle will end + InflationCycleEnd time.Time `protobuf:"bytes,4,opt,name=inflation_cycle_end,json=inflationCycleEnd,proto3,stdtime" json:"inflation_cycle_end"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -80,33 +80,33 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/genesis.proto", fileDescriptor_82f39cd8e8ede8c7) } var fileDescriptor_82f39cd8e8ede8c7 = []byte{ - // 409 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0x4f, 0x6e, 0xd4, 0x30, - 0x14, 0xc6, 0x93, 0x52, 0x21, 0x48, 0x0b, 0x45, 0xa1, 0x88, 0x10, 0x81, 0xa7, 0x62, 0x81, 0xba, - 0xa9, 0xad, 0x80, 0x38, 0x40, 0xd3, 0x8a, 0x11, 0x1b, 0x54, 0xcd, 0xb0, 0x40, 0x6c, 0x22, 0xc7, - 0x7d, 0x35, 0x16, 0x63, 0x3b, 0xb2, 0x9d, 0x40, 0x6f, 0xd1, 0xc3, 0x70, 0x03, 0x36, 0xb3, 0xac, - 0x58, 0xb1, 0xe2, 0xcf, 0xcc, 0x45, 0x90, 0x9d, 0xcc, 0xd0, 0xd9, 0xe5, 0xe5, 0xfb, 0xde, 0x2f, - 0x3f, 0xbd, 0x24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xbe, 0x4b, 0x1e, 0x08, 0x75, 0x31, 0xa3, 0x4e, - 0x68, 0x55, 0x35, 0xd4, 0x50, 0x69, 0xb3, 0x5b, 0xc1, 0xe6, 0x19, 0xbe, 0x79, 0x4f, 0xfc, 0x76, - 0xd5, 0x3a, 0x0b, 0xa5, 0x41, 0x67, 0x4f, 0x6c, 0xbe, 0x4e, 0x3f, 0x24, 0x8f, 0xfe, 0xf3, 0xd8, - 0x25, 0x9b, 0x41, 0x65, 0x1d, 0x35, 0x2e, 0xdb, 0x0e, 0xd0, 0x1c, 0xf7, 0x07, 0xc6, 0xab, 0x03, - 0xe3, 0xf7, 0xab, 0x03, 0x97, 0x77, 0x3c, 0xf1, 0xea, 0xf7, 0x28, 0x9e, 0x3c, 0x5c, 0x23, 0x4e, - 0x3c, 0x61, 0xea, 0x01, 0xe5, 0xe9, 0xfc, 0x2f, 0x8a, 0xe6, 0x0b, 0x14, 0x5f, 0x2f, 0x50, 0xfc, - 0x67, 0x81, 0xe2, 0xab, 0x25, 0x8a, 0xae, 0x97, 0x28, 0xfa, 0xb9, 0x44, 0xd1, 0xc7, 0x17, 0x5c, - 0xb8, 0x4f, 0x6d, 0x8d, 0x99, 0x96, 0xc4, 0x7b, 0x1f, 0x29, 0x70, 0x5f, 0xb4, 0xf9, 0x1c, 0x06, - 0xd2, 0xbd, 0x26, 0x5f, 0xc3, 0x1f, 0xa9, 0x6f, 0x87, 0x0f, 0xbf, 0xfa, 0x17, 0x00, 0x00, 0xff, - 0xff, 0xeb, 0xd3, 0x3c, 0x9c, 0x49, 0x02, 0x00, 0x00, + // 407 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xcd, 0x6e, 0xd4, 0x30, + 0x14, 0x85, 0x93, 0x52, 0x21, 0x48, 0x0b, 0x85, 0x50, 0x89, 0x10, 0x81, 0xa7, 0x62, 0x81, 0xba, + 0xa9, 0xad, 0x80, 0x78, 0x80, 0xa6, 0x85, 0x11, 0x1b, 0x54, 0x4d, 0xbb, 0x62, 0x13, 0x39, 0xce, + 0xad, 0xb1, 0x18, 0xdb, 0x51, 0xec, 0x04, 0xfa, 0x16, 0xf3, 0x30, 0xec, 0xd9, 0xce, 0x72, 0xc4, + 0x8a, 0x15, 0x3f, 0x33, 0x2f, 0x82, 0xec, 0x64, 0x06, 0x66, 0x97, 0x9b, 0x73, 0xee, 0x97, 0x4f, + 0x37, 0x51, 0xda, 0x4a, 0x00, 0xd2, 0x72, 0xdd, 0x91, 0x2e, 0x23, 0x1c, 0x14, 0x18, 0x61, 0x70, + 0xdd, 0x68, 0xab, 0xe3, 0x7d, 0x97, 0x61, 0x97, 0xe1, 0x2e, 0x4b, 0x0f, 0xb9, 0xe6, 0xda, 0x07, + 0xc4, 0x3d, 0xf5, 0x9d, 0x14, 0x31, 0x6d, 0xa4, 0x36, 0xa4, 0xa4, 0x06, 0x48, 0x97, 0x95, 0x60, + 0x69, 0x46, 0x98, 0x16, 0x6a, 0xc8, 0x47, 0x5c, 0x6b, 0x3e, 0x05, 0xe2, 0xa7, 0xb2, 0xbd, 0x26, + 0x56, 0x48, 0x30, 0x96, 0xca, 0x7a, 0x28, 0x3c, 0xe9, 0x01, 0x45, 0x4f, 0xee, 0x87, 0x21, 0x7a, + 0xbc, 0xe5, 0xe6, 0x3d, 0x7c, 0xf0, 0xfc, 0xdb, 0x4e, 0xb4, 0x3f, 0xee, 0x55, 0x2f, 0x2d, 0xb5, + 0x10, 0xbf, 0x8d, 0xee, 0x49, 0xa1, 0x0a, 0x4e, 0x1d, 0x47, 0x30, 0x48, 0xc2, 0xa3, 0xf0, 0x78, + 0xef, 0xe5, 0x53, 0x3c, 0xf0, 0x9c, 0x1d, 0x1e, 0xec, 0xf0, 0x39, 0xb0, 0x33, 0x2d, 0x54, 0xbe, + 0x3b, 0xff, 0x39, 0x0a, 0x26, 0x7b, 0x52, 0xa8, 0x31, 0x35, 0x17, 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+ 0xbe, 0x7e, 0xae, 0x45, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -129,7 +129,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.InflationCycleStart, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStart):]) + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.InflationCycleEnd, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleEnd):]) if err1 != nil { return 0, err1 } @@ -192,7 +192,7 @@ func (m *GenesisState) Size() (n int) { } l = m.InflationParams.Size() n += 1 + l + sovGenesis(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleStart) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.InflationCycleEnd) n += 1 + l + sovGenesis(uint64(l)) return n } @@ -332,7 +332,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleStart", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationCycleEnd", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -359,7 +359,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.InflationCycleStart, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.InflationCycleEnd, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/keeper/genesis.go b/x/ugov/keeper/genesis.go index 445d2fb53e..3bcfd8de67 100644 --- a/x/ugov/keeper/genesis.go +++ b/x/ugov/keeper/genesis.go @@ -6,12 +6,12 @@ import ( ) func (k Keeper) ExportGenesis() *ugov.GenesisState { - lcst, err := k.GetInflationCycleStart() + cycleEndTime, err := k.GetInflationCycleEnd() util.Panic(err) return &ugov.GenesisState{ - MinGasPrice: k.MinGasPrice(), - InflationParams: k.InflationParams(), - InflationCycleStart: lcst, + MinGasPrice: k.MinGasPrice(), + InflationParams: k.InflationParams(), + InflationCycleEnd: cycleEndTime, } } @@ -22,5 +22,5 @@ func (k Keeper) InitGenesis(gs *ugov.GenesisState) error { if err := k.SetInflationParams(gs.InflationParams); err != nil { return err } - return k.SetInflationCycleStart(gs.InflationCycleStart) + return k.SetInflationCycleEnd(gs.InflationCycleEnd) } diff --git a/x/ugov/keeper/params.go b/x/ugov/keeper/params.go index 8a9233afec..ac29939005 100644 --- a/x/ugov/keeper/params.go +++ b/x/ugov/keeper/params.go @@ -42,11 +42,11 @@ func (k Keeper) InflationParams() ugov.InflationParams { return *lp } -func (k Keeper) SetInflationCycleStart(startTime time.Time) error { +func (k Keeper) SetInflationCycleEnd(startTime time.Time) error { store.SetTimeMs(k.store, KeyInflationCycleStart, startTime) return nil } -func (k Keeper) GetInflationCycleStart() (time.Time, error) { +func (k Keeper) GetInflationCycleEnd() (time.Time, error) { return store.GetTimeMs(k.store, KeyInflationCycleStart) } diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index 456859c946..de11b0e5ba 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -59,16 +59,16 @@ func TestInflationCycleStart(t *testing.T) { k := initKeeper(t) st := time.Time{} - err := k.SetInflationCycleStart(st) + err := k.SetInflationCycleEnd(st) require.NoError(err) - in_c, err := k.GetInflationCycleStart() + in_c, err := k.GetInflationCycleEnd() require.NoError(err) require.Equal(in_c.IsZero(), true, "it should be default zero time") icst := time.Now() - err = k.SetInflationCycleStart(icst) + err = k.SetInflationCycleEnd(icst) require.NoError(err) - ricst, err := k.GetInflationCycleStart() + ricst, err := k.GetInflationCycleEnd() require.NoError(err) require.Equal(ricst.UnixMilli(), icst.UnixMilli(), "inflation cycle start time should be same") } diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index d51e227556..2c0b44700e 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -34,16 +34,16 @@ func (q Querier) EmergencyGroup(ctx context.Context, _ *ugov.QueryEmergencyGroup func (q Querier) InflationParams(ctx context.Context, _ *ugov.QueryInflationParams) ( *ugov.QueryInflationParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - return &ugov.QueryInflationParamsResponse{InflationParams: q.Keeper(&sdkCtx).InflationParams()}, nil + return &ugov.QueryInflationParamsResponse{Params: q.Keeper(&sdkCtx).InflationParams()}, nil } -// InflationCycleStart return when the inflation cycle is started -func (q Querier) InflationCycleStart(ctx context.Context, _ *ugov.QueryInflationCycleStart) ( - *ugov.QueryInflationCycleStartResponse, error) { +// InflationCycleEnd return when the inflation cycle will be ended. +func (q Querier) InflationCycleEnd(ctx context.Context, _ *ugov.QueryInflationCycleEnd) ( + *ugov.QueryInflationCycleEndResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - icst, err := q.Keeper(&sdkCtx).GetInflationCycleStart() + cycleEndTime, err := q.Keeper(&sdkCtx).GetInflationCycleEnd() if err != nil { return nil, err } - return &ugov.QueryInflationCycleStartResponse{Start: &icst}, nil + return &ugov.QueryInflationCycleEndResponse{End: &cycleEndTime}, nil } diff --git a/x/ugov/query.pb.go b/x/ugov/query.pb.go index 64d5da9c20..cb70c1fa97 100644 --- a/x/ugov/query.pb.go +++ b/x/ugov/query.pb.go @@ -224,7 +224,7 @@ var xxx_messageInfo_QueryInflationParams proto.InternalMessageInfo // QueryInflationParamsResponse response type. type QueryInflationParamsResponse struct { - InflationParams InflationParams `protobuf:"bytes,1,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` + Params InflationParams `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *QueryInflationParamsResponse) Reset() { *m = QueryInflationParamsResponse{} } @@ -260,22 +260,22 @@ func (m *QueryInflationParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryInflationParamsResponse proto.InternalMessageInfo -// QueryInflationCycleStart request type. -type QueryInflationCycleStart struct { +// QueryInflationCycleEnd request type. +type QueryInflationCycleEnd struct { } -func (m *QueryInflationCycleStart) Reset() { *m = QueryInflationCycleStart{} } -func (m *QueryInflationCycleStart) String() string { return proto.CompactTextString(m) } -func (*QueryInflationCycleStart) ProtoMessage() {} -func (*QueryInflationCycleStart) Descriptor() ([]byte, []int) { +func (m *QueryInflationCycleEnd) Reset() { *m = QueryInflationCycleEnd{} } +func (m *QueryInflationCycleEnd) String() string { return proto.CompactTextString(m) } +func (*QueryInflationCycleEnd) ProtoMessage() {} +func (*QueryInflationCycleEnd) Descriptor() ([]byte, []int) { return fileDescriptor_25fa04679024a47d, []int{6} } -func (m *QueryInflationCycleStart) XXX_Unmarshal(b []byte) error { +func (m *QueryInflationCycleEnd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryInflationCycleStart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryInflationCycleEnd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryInflationCycleStart.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryInflationCycleEnd.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -285,35 +285,35 @@ func (m *QueryInflationCycleStart) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryInflationCycleStart) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryInflationCycleStart.Merge(m, src) +func (m *QueryInflationCycleEnd) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryInflationCycleEnd.Merge(m, src) } -func (m *QueryInflationCycleStart) XXX_Size() int { +func (m *QueryInflationCycleEnd) XXX_Size() int { return m.Size() } -func (m *QueryInflationCycleStart) XXX_DiscardUnknown() { - xxx_messageInfo_QueryInflationCycleStart.DiscardUnknown(m) +func (m *QueryInflationCycleEnd) XXX_DiscardUnknown() { + xxx_messageInfo_QueryInflationCycleEnd.DiscardUnknown(m) } -var xxx_messageInfo_QueryInflationCycleStart proto.InternalMessageInfo +var xxx_messageInfo_QueryInflationCycleEnd proto.InternalMessageInfo -// QueryInflationCycleStartResponse response type. -type QueryInflationCycleStartResponse struct { - Start *time.Time `protobuf:"bytes,1,opt,name=start,proto3,stdtime" json:"start,omitempty"` +// QueryInflationCycleEndResponse response type. +type QueryInflationCycleEndResponse struct { + End *time.Time `protobuf:"bytes,1,opt,name=end,proto3,stdtime" json:"end,omitempty"` } -func (m *QueryInflationCycleStartResponse) Reset() { *m = QueryInflationCycleStartResponse{} } -func (m *QueryInflationCycleStartResponse) String() string { return proto.CompactTextString(m) } -func (*QueryInflationCycleStartResponse) ProtoMessage() {} -func (*QueryInflationCycleStartResponse) Descriptor() ([]byte, []int) { +func (m *QueryInflationCycleEndResponse) Reset() { *m = QueryInflationCycleEndResponse{} } +func (m *QueryInflationCycleEndResponse) String() string { return proto.CompactTextString(m) } +func (*QueryInflationCycleEndResponse) ProtoMessage() {} +func (*QueryInflationCycleEndResponse) Descriptor() ([]byte, []int) { return fileDescriptor_25fa04679024a47d, []int{7} } -func (m *QueryInflationCycleStartResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryInflationCycleEndResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryInflationCycleStartResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryInflationCycleEndResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryInflationCycleStartResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryInflationCycleEndResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -323,17 +323,17 @@ func (m *QueryInflationCycleStartResponse) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *QueryInflationCycleStartResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryInflationCycleStartResponse.Merge(m, src) +func (m *QueryInflationCycleEndResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryInflationCycleEndResponse.Merge(m, src) } -func (m *QueryInflationCycleStartResponse) XXX_Size() int { +func (m *QueryInflationCycleEndResponse) XXX_Size() int { return m.Size() } -func (m *QueryInflationCycleStartResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryInflationCycleStartResponse.DiscardUnknown(m) +func (m *QueryInflationCycleEndResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryInflationCycleEndResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryInflationCycleStartResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryInflationCycleEndResponse proto.InternalMessageInfo func init() { proto.RegisterType((*QueryMinGasPrice)(nil), "umee.ugov.v1.QueryMinGasPrice") @@ -342,52 +342,52 @@ func init() { proto.RegisterType((*QueryEmergencyGroupResponse)(nil), "umee.ugov.v1.QueryEmergencyGroupResponse") proto.RegisterType((*QueryInflationParams)(nil), "umee.ugov.v1.QueryInflationParams") proto.RegisterType((*QueryInflationParamsResponse)(nil), "umee.ugov.v1.QueryInflationParamsResponse") - proto.RegisterType((*QueryInflationCycleStart)(nil), "umee.ugov.v1.QueryInflationCycleStart") - proto.RegisterType((*QueryInflationCycleStartResponse)(nil), "umee.ugov.v1.QueryInflationCycleStartResponse") + proto.RegisterType((*QueryInflationCycleEnd)(nil), "umee.ugov.v1.QueryInflationCycleEnd") + proto.RegisterType((*QueryInflationCycleEndResponse)(nil), "umee.ugov.v1.QueryInflationCycleEndResponse") } func init() { proto.RegisterFile("umee/ugov/v1/query.proto", fileDescriptor_25fa04679024a47d) } var fileDescriptor_25fa04679024a47d = []byte{ - // 604 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02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x4a, 0xc0, 0x84, 0x60, 0xf9, 0x69, 0xbc, 0xc5, 0x63, 0xca, 0x76, 0xac, 0x70, 0x37, 0xa0, 0x0e, - 0x31, 0x6d, 0x50, 0x29, 0xd6, 0xba, 0x24, 0xf4, 0x39, 0x0b, 0x09, 0x7c, 0x08, 0x2e, 0x7b, 0x94, - 0xf5, 0x5c, 0x2b, 0xf6, 0x4e, 0x1d, 0x52, 0xd1, 0x1a, 0xda, 0xcd, 0x85, 0x8d, 0x2a, 0x52, 0x3b, - 0xc4, 0x0b, 0x23, 0xb5, 0x30, 0xda, 0x26, 0xce, 0x16, 0xa7, 0xac, 0x33, 0x37, 0x3a, 0xa9, 0x97, - 0xba, 0x0b, 0xde, 0x94, 0xc6, 0x15, 0xb0, 0x22, 0x35, 0x1e, 0x78, 0x24, 0x70, 0x09, 0x73, 0x86, - 0x3b, 0x01, 0x8f, 0x7c, 0xf3, 0x25, 0x58, 0x9d, 0x51, 0xce, 0xd4, 0x37, 0xc1, 0x12, 0x49, 0x91, - 0x9e, 0x1b, 0x43, 0x52, 0xff, 0x62, 0xa7, 0xf2, 0xf5, 0xa8, 0x55, 0x56, 0x16, 0x36, 0xf7, 0xf7, - 0x03, 0x12, 0x86, 0x7b, 0x22, 0xa0, 0xcc, 0xed, 0x2e, 0x92, 0xbc, 0xc2, 0x55, 0x50, 0x96, 0x0a, - 0x8f, 0xd8, 0x41, 0x5f, 0xfe, 0xc3, 0x5d, 0x2b, 0xb0, 0xbc, 0xd0, 0x64, 0xa0, 0x3a, 0xab, 0x9e, - 0x49, 0x3f, 0x01, 0xcb, 0x34, 0x85, 0x7a, 0xbe, 0xc4, 0xd4, 0xee, 0x35, 0x34, 0x7d, 0x7a, 0x54, - 0x18, 0xa0, 0x96, 0x5f, 0xa2, 0x05, 0x3d, 0x5d, 0xfd, 0xe4, 0x8c, 0xbe, 0x35, 0x74, 0xfa, 0x64, - 0x4f, 0x58, 0x81, 0x30, 0x5f, 0x80, 0xc6, 0x69, 0x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9, 0xfb, 0xc4, 0x28, - 0x3d, 0x6f, 0xba, 0x54, 0xbc, 0x8a, 0x6c, 0xe4, 0x70, 0x4f, 0x0e, 0x6b, 0x31, 0x22, 0xde, 0xf2, - 0xe0, 0x75, 0x32, 0x79, 0x70, 0x0f, 0xbf, 0x93, 0xe3, 0xed, 0xff, 0x65, 0x42, 0xef, 0xfe, 0x09, - 0x00, 0x00, 0xff, 0xff, 0x72, 0xd4, 0x3b, 0xa3, 0x4b, 0x05, 0x00, 0x00, + // 598 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0xa1, 0x54, 0xb0, 0x85, 0x16, 0x96, 0x52, 0x82, 0x9b, 0x6c, 0x5a, 0x17, 0x22, 0x8a, + 0xe8, 0xae, 0x52, 0x04, 0x17, 0x4e, 0x4d, 0x5b, 0x2a, 0x0e, 0x48, 0x25, 0x70, 0x40, 0x70, 0x08, + 0xb6, 0xb3, 0x35, 0x2b, 0xe2, 0x5d, 0xe3, 0x8f, 0x40, 0x38, 0x22, 0x71, 0xe0, 0x56, 0xc1, 0xdf, + 0xe0, 0xc8, 0x8f, 0xc8, 0xb1, 0x82, 0x0b, 0xa7, 0x02, 0x09, 0x3f, 0x04, 0x79, 0xbd, 0xb6, 0x62, + 0x13, 0x5a, 0x6e, 0xde, 0x79, 0x6f, 0xe6, 0xbd, 0xf1, 0x1b, 0x50, 0x8e, 0x5c, 0x4a, 0x49, 0xe4, + 0x88, 0x1e, 0xe9, 0x35, 0xc8, 0xab, 0x88, 0xfa, 0x7d, 0xec, 0xf9, 0x22, 0x14, 0xf0, 0x6c, 0x8c, + 0xe0, 0x18, 0xc1, 0xbd, 0x86, 0x8e, 0x6c, 0x11, 0xb8, 0x22, 0x20, 0x96, 0x19, 0x50, 0xd2, 0x6b, + 0x58, 0x34, 0x34, 0x1b, 0x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7, + 0x00, 0x3f, 0x6a, 0xe0, 0xc2, 0x5f, 0x79, 0xc3, 0xab, 0x47, 0x29, 0xa5, 0x2c, 0xfd, 0xe6, 0xff, + 0xb0, 0x32, 0x47, 0xab, 0xd2, 0xd1, 0x0a, 0x5c, 0xfe, 0x97, 0x23, 0x3b, 0xee, 0x68, 0x53, 0xde, + 0x69, 0x6e, 0x0d, 0x7e, 0xa1, 0xd2, 0x60, 0x88, 0xb4, 0x83, 0x21, 0xd2, 0x7e, 0x0e, 0x91, 0xb6, + 0x3f, 0x42, 0xa5, 0x83, 0x11, 0x2a, 0x7d, 0x1f, 0xa1, 0xd2, 0xd3, 0xba, 0xc3, 0xc2, 0x17, 0x91, + 0x85, 0x6d, 0xe1, 0xca, 0x51, 0x6b, 0x9c, 0x86, 0xaf, 0x85, 0xff, 0x32, 0x99, 0xdb, 0xbb, 0x4d, + 0xde, 0xc8, 0xe1, 0xd6, 0xb4, 0xbc, 0xcb, 0x5b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x20, + 0x6c, 0x17, 0x28, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -408,8 +408,8 @@ type QueryClient interface { EmergencyGroup(ctx context.Context, in *QueryEmergencyGroup, opts ...grpc.CallOption) (*QueryEmergencyGroupResponse, error) // InflationParams returns params of inflation reduction rates InflationParams(ctx context.Context, in *QueryInflationParams, opts ...grpc.CallOption) (*QueryInflationParamsResponse, error) - // InflationCycleStart returns inflation cycle start time - InflationCycleStart(ctx context.Context, in *QueryInflationCycleStart, opts ...grpc.CallOption) (*QueryInflationCycleStartResponse, error) + // InflationCycleEnd returns inflation cycle end time + InflationCycleEnd(ctx context.Context, in *QueryInflationCycleEnd, opts ...grpc.CallOption) (*QueryInflationCycleEndResponse, error) } type queryClient struct { @@ -447,9 +447,9 @@ func (c *queryClient) InflationParams(ctx context.Context, in *QueryInflationPar return out, nil } -func (c *queryClient) InflationCycleStart(ctx context.Context, in *QueryInflationCycleStart, opts ...grpc.CallOption) (*QueryInflationCycleStartResponse, error) { - out := new(QueryInflationCycleStartResponse) - err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/InflationCycleStart", in, out, opts...) +func (c *queryClient) InflationCycleEnd(ctx context.Context, in *QueryInflationCycleEnd, opts ...grpc.CallOption) (*QueryInflationCycleEndResponse, error) { + out := new(QueryInflationCycleEndResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/InflationCycleEnd", in, out, opts...) if err != nil { return nil, err } @@ -464,8 +464,8 @@ type QueryServer interface { EmergencyGroup(context.Context, *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) // InflationParams returns params of inflation reduction rates InflationParams(context.Context, *QueryInflationParams) (*QueryInflationParamsResponse, error) - // InflationCycleStart returns inflation cycle start time - InflationCycleStart(context.Context, *QueryInflationCycleStart) (*QueryInflationCycleStartResponse, error) + // InflationCycleEnd returns inflation cycle end time + InflationCycleEnd(context.Context, *QueryInflationCycleEnd) (*QueryInflationCycleEndResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -481,8 +481,8 @@ func (*UnimplementedQueryServer) EmergencyGroup(ctx context.Context, req *QueryE func (*UnimplementedQueryServer) InflationParams(ctx context.Context, req *QueryInflationParams) (*QueryInflationParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InflationParams not implemented") } -func (*UnimplementedQueryServer) InflationCycleStart(ctx context.Context, req *QueryInflationCycleStart) (*QueryInflationCycleStartResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InflationCycleStart not implemented") +func (*UnimplementedQueryServer) InflationCycleEnd(ctx context.Context, req *QueryInflationCycleEnd) (*QueryInflationCycleEndResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InflationCycleEnd not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -543,20 +543,20 @@ func _Query_InflationParams_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Query_InflationCycleStart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryInflationCycleStart) +func _Query_InflationCycleEnd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryInflationCycleEnd) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).InflationCycleStart(ctx, in) + return srv.(QueryServer).InflationCycleEnd(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/umee.ugov.v1.Query/InflationCycleStart", + FullMethod: "/umee.ugov.v1.Query/InflationCycleEnd", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).InflationCycleStart(ctx, req.(*QueryInflationCycleStart)) + return srv.(QueryServer).InflationCycleEnd(ctx, req.(*QueryInflationCycleEnd)) } return interceptor(ctx, in, info, handler) } @@ -578,8 +578,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_InflationParams_Handler, }, { - MethodName: "InflationCycleStart", - Handler: _Query_InflationCycleStart_Handler, + MethodName: "InflationCycleEnd", + Handler: _Query_InflationCycleEnd_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -739,7 +739,7 @@ func (m *QueryInflationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, e var l int _ = l { - size, err := m.InflationParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -751,7 +751,7 @@ func (m *QueryInflationParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *QueryInflationCycleStart) Marshal() (dAtA []byte, err error) { +func (m *QueryInflationCycleEnd) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -761,12 +761,12 @@ func (m *QueryInflationCycleStart) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryInflationCycleStart) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryInflationCycleEnd) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryInflationCycleStart) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryInflationCycleEnd) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -774,7 +774,7 @@ func (m *QueryInflationCycleStart) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryInflationCycleStartResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryInflationCycleEndResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -784,18 +784,18 @@ func (m *QueryInflationCycleStartResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryInflationCycleStartResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryInflationCycleEndResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryInflationCycleStartResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryInflationCycleEndResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Start != nil { - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Start, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Start):]) + if m.End != nil { + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.End, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.End):]) if err3 != nil { return 0, err3 } @@ -875,12 +875,12 @@ func (m *QueryInflationParamsResponse) Size() (n int) { } var l int _ = l - l = m.InflationParams.Size() + l = m.Params.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryInflationCycleStart) Size() (n int) { +func (m *QueryInflationCycleEnd) Size() (n int) { if m == nil { return 0 } @@ -889,14 +889,14 @@ func (m *QueryInflationCycleStart) Size() (n int) { return n } -func (m *QueryInflationCycleStartResponse) Size() (n int) { +func (m *QueryInflationCycleEndResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Start != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.Start) + if m.End != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.End) n += 1 + l + sovQuery(uint64(l)) } return n @@ -1254,7 +1254,7 @@ func (m *QueryInflationParamsResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflationParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1281,7 +1281,7 @@ func (m *QueryInflationParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.InflationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1306,7 +1306,7 @@ func (m *QueryInflationParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryInflationCycleStart) Unmarshal(dAtA []byte) error { +func (m *QueryInflationCycleEnd) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1329,10 +1329,10 @@ func (m *QueryInflationCycleStart) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryInflationCycleStart: wiretype end group for non-group") + return fmt.Errorf("proto: QueryInflationCycleEnd: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryInflationCycleStart: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryInflationCycleEnd: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1356,7 +1356,7 @@ func (m *QueryInflationCycleStart) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryInflationCycleStartResponse) Unmarshal(dAtA []byte) error { +func (m *QueryInflationCycleEndResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1379,15 +1379,15 @@ func (m *QueryInflationCycleStartResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryInflationCycleStartResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryInflationCycleEndResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryInflationCycleStartResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryInflationCycleEndResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1414,10 +1414,10 @@ func (m *QueryInflationCycleStartResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Start == nil { - m.Start = new(time.Time) + if m.End == nil { + m.End = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.Start, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.End, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ugov/query.pb.gw.go b/x/ugov/query.pb.gw.go index a0d85d485c..9861335ca1 100644 --- a/x/ugov/query.pb.gw.go +++ b/x/ugov/query.pb.gw.go @@ -87,20 +87,20 @@ func local_request_Query_InflationParams_0(ctx context.Context, marshaler runtim } -func request_Query_InflationCycleStart_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryInflationCycleStart +func request_Query_InflationCycleEnd_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInflationCycleEnd var metadata runtime.ServerMetadata - msg, err := client.InflationCycleStart(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.InflationCycleEnd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_InflationCycleStart_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryInflationCycleStart +func local_request_Query_InflationCycleEnd_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInflationCycleEnd var metadata runtime.ServerMetadata - msg, err := server.InflationCycleStart(ctx, &protoReq) + msg, err := server.InflationCycleEnd(ctx, &protoReq) return msg, metadata, err } @@ -180,7 +180,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_InflationCycleStart_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InflationCycleEnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -191,7 +191,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_InflationCycleStart_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_InflationCycleEnd_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -199,7 +199,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_InflationCycleStart_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InflationCycleEnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -304,7 +304,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_InflationCycleStart_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InflationCycleEnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -313,14 +313,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_InflationCycleStart_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_InflationCycleEnd_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_InflationCycleStart_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InflationCycleEnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -332,9 +332,9 @@ var ( pattern_Query_EmergencyGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "emergency_group"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_InflationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation-params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_InflationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation_params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_InflationCycleStart_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation-cycle-start"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_InflationCycleEnd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation_cycle_end"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -344,5 +344,5 @@ var ( forward_Query_InflationParams_0 = runtime.ForwardResponseMessage - forward_Query_InflationCycleStart_0 = runtime.ForwardResponseMessage + forward_Query_InflationCycleEnd_0 = runtime.ForwardResponseMessage ) From 41d5ce32289f96d37e8aa4963a8dc53e149dc08f Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 25 Jul 2023 17:32:09 +0530 Subject: [PATCH 13/17] rename inflationReductionRate to factor --- app/inflation/inflation.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/inflation/inflation.go b/app/inflation/inflation.go index 42e4152871..dc9613defc 100644 --- a/app/inflation/inflation.go +++ b/app/inflation/inflation.go @@ -35,11 +35,11 @@ func (c Calculator) InflationRate(ctx sdk.Context, minter minttypes.Minter, mint if ctx.BlockTime().After(cycleEnd) { // inflation cycle is completed , so we need to update the inflation max and min rate // inflationReductionRate = 25 / 100 = 0.25 - inflationReductionRate := inflationParams.InflationReductionRate.ToDec().Quo(sdk.NewDec(100)) + factor := sdk.OneDec().Sub(inflationParams.InflationReductionRate.ToDec().Quo(sdk.NewDec(100))) // InflationMax = PrevInflationMax * ( 1 - 0.25) - mintParams.InflationMax = mintParams.InflationMax.Mul(sdk.OneDec().Sub(inflationReductionRate)) + mintParams.InflationMax = factor.Mul(mintParams.InflationMax) // InflationMin = PrevInflationMin * ( 1 - 0.25) - mintParams.InflationMin = mintParams.InflationMin.Mul(sdk.OneDec().Sub(inflationReductionRate)) + mintParams.InflationMin = factor.Mul(mintParams.InflationMin) // update the changed inflation min and max rates c.MintKeeper.SetParams(ctx, mintParams) From abf283d3a285274416a5320b2129925a2c3592bc Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 25 Jul 2023 18:54:02 +0530 Subject: [PATCH 14/17] using bpmath.FixedBP for inflation rate change --- app/inflation/inflation.go | 10 +++++----- x/ugov/inflation_params.go | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/inflation/inflation.go b/app/inflation/inflation.go index dc9613defc..b697e84d1a 100644 --- a/app/inflation/inflation.go +++ b/app/inflation/inflation.go @@ -6,6 +6,7 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/umee-network/umee/v5/util" + "github.com/umee-network/umee/v5/util/bpmath" ugovkeeper "github.com/umee-network/umee/v5/x/ugov/keeper" ) @@ -33,13 +34,12 @@ func (c Calculator) InflationRate(ctx sdk.Context, minter minttypes.Minter, mint // Initially inflation_cycle end time is zero // Once chain start inflation cycle end time will be executed block time + cycle duration if ctx.BlockTime().After(cycleEnd) { - // inflation cycle is completed , so we need to update the inflation max and min rate - // inflationReductionRate = 25 / 100 = 0.25 - factor := sdk.OneDec().Sub(inflationParams.InflationReductionRate.ToDec().Quo(sdk.NewDec(100))) + // new inflation cycle is starting , so we need to update the inflation max and min rate + factor := bpmath.One - inflationParams.InflationReductionRate // InflationMax = PrevInflationMax * ( 1 - 0.25) - mintParams.InflationMax = factor.Mul(mintParams.InflationMax) + mintParams.InflationMax = factor.MulDec(mintParams.InflationMax) // InflationMin = PrevInflationMin * ( 1 - 0.25) - mintParams.InflationMin = factor.Mul(mintParams.InflationMin) + mintParams.InflationMin = factor.MulDec(mintParams.InflationMin) // update the changed inflation min and max rates c.MintKeeper.SetParams(ctx, mintParams) diff --git a/x/ugov/inflation_params.go b/x/ugov/inflation_params.go index 880aac387c..5d49b697ad 100644 --- a/x/ugov/inflation_params.go +++ b/x/ugov/inflation_params.go @@ -15,20 +15,20 @@ func DefaultInflationParams() InflationParams { return InflationParams{ MaxSupply: coin.New(appparams.BondDenom, 21_000000000_000000), // 21 Billion Maximum InflationCycle: time.Hour * 24 * 365, // 2 years for default inflation cycle - InflationReductionRate: bpmath.FixedBP(25), // 25% reduction rate for inflation cyle + InflationReductionRate: bpmath.FixedBP(2500), // 25% reduction rate for inflation cyle } } -func (lp InflationParams) Validate() error { - if lp.MaxSupply.Amount.LT(math.NewInt(0)) { +func (ip InflationParams) Validate() error { + if ip.MaxSupply.Amount.LT(math.NewInt(0)) { return fmt.Errorf("max_supply must be positive") } - if lp.InflationReductionRate > 100 { - return fmt.Errorf("inflation reduction must be between 0 to 100") + if ip.InflationReductionRate > bpmath.One || ip.InflationReductionRate < 100 { + return fmt.Errorf("inflation reduction must be between 100(0.1) to 10000 (1)") } - if lp.InflationCycle.Seconds() <= 0 { + if ip.InflationCycle.Seconds() <= 0 { return fmt.Errorf("inflation cycle must be positive") } From d75dfae54476da977920d21dc4d3037e972e6c9c Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 25 Jul 2023 19:35:08 +0530 Subject: [PATCH 15/17] address the review comments --- app/inflation/inflation.go | 7 ---- proto/umee/ugov/v1/tx.proto | 4 +- x/ugov/inflation_params.go | 13 +++--- x/ugov/keeper/keys.go | 8 ++-- x/ugov/keeper/msg_server.go | 2 +- x/ugov/keeper/params.go | 14 +++---- x/ugov/keeper/params_test.go | 20 ++++----- x/ugov/msg.go | 2 +- x/ugov/tx.pb.go | 78 ++++++++++++++++++------------------ 9 files changed, 71 insertions(+), 77 deletions(-) diff --git a/app/inflation/inflation.go b/app/inflation/inflation.go index b697e84d1a..c2004fc319 100644 --- a/app/inflation/inflation.go +++ b/app/inflation/inflation.go @@ -31,20 +31,14 @@ func (c Calculator) InflationRate(ctx sdk.Context, minter minttypes.Minter, mint cycleEnd, err := ugovKeeper.GetInflationCycleEnd() util.Panic(err) - // Initially inflation_cycle end time is zero - // Once chain start inflation cycle end time will be executed block time + cycle duration if ctx.BlockTime().After(cycleEnd) { // new inflation cycle is starting , so we need to update the inflation max and min rate factor := bpmath.One - inflationParams.InflationReductionRate - // InflationMax = PrevInflationMax * ( 1 - 0.25) mintParams.InflationMax = factor.MulDec(mintParams.InflationMax) - // InflationMin = PrevInflationMin * ( 1 - 0.25) mintParams.InflationMin = factor.MulDec(mintParams.InflationMin) - // update the changed inflation min and max rates c.MintKeeper.SetParams(ctx, mintParams) - // update the end time of current inflation cycle err := ugovKeeper.SetInflationCycleEnd(ctx.BlockTime().Add(inflationParams.InflationCycle)) util.Panic(err) ctx.Logger().Info("inflation min and max rates are updated", @@ -69,7 +63,6 @@ func (c Calculator) adjustInflation(totalSupply, maxSupply math.Int, minter mint newAnnualProvision := newTotalSupply.Mul(sdk.NewInt(int64(params.BlocksPerYear))) // AnnualProvisions = Inflation * TotalSupply // Mint Coins = AnnualProvisions / BlocksPerYear - // so get the new Inflation // Inflation = (New Mint Coins * BlocksPerYear ) / TotalSupply return sdk.NewDec(newAnnualProvision.Quo(totalSupply).Int64()) } diff --git a/proto/umee/ugov/v1/tx.proto b/proto/umee/ugov/v1/tx.proto index 5cc46886c0..ba3879f5b2 100644 --- a/proto/umee/ugov/v1/tx.proto +++ b/proto/umee/ugov/v1/tx.proto @@ -53,8 +53,8 @@ message MsgGovUpdateInflationParams { option (cosmos.msg.v1.signer) = "authority"; // authority must be the address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - InflationParams inflation_params = 2 [(gogoproto.nullable) = false]; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + InflationParams params = 2 [(gogoproto.nullable) = false]; } // GovUpdateInflationParamsResponse response type. diff --git a/x/ugov/inflation_params.go b/x/ugov/inflation_params.go index 5d49b697ad..b8707446f2 100644 --- a/x/ugov/inflation_params.go +++ b/x/ugov/inflation_params.go @@ -1,11 +1,10 @@ package ugov import ( - fmt "fmt" time "time" "cosmossdk.io/math" - + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" appparams "github.com/umee-network/umee/v5/app/params" "github.com/umee-network/umee/v5/util/bpmath" "github.com/umee-network/umee/v5/util/coin" @@ -19,17 +18,19 @@ func DefaultInflationParams() InflationParams { } } +var zeroInt = math.NewInt(0) + func (ip InflationParams) Validate() error { - if ip.MaxSupply.Amount.LT(math.NewInt(0)) { - return fmt.Errorf("max_supply must be positive") + if ip.MaxSupply.Amount.LT(zeroInt) { + return sdkerrors.ErrInvalidRequest.Wrap("max_supply must be positive") } if ip.InflationReductionRate > bpmath.One || ip.InflationReductionRate < 100 { - return fmt.Errorf("inflation reduction must be between 100(0.1) to 10000 (1)") + return sdkerrors.ErrInvalidRequest.Wrap("inflation reduction must be between 100bp to 10'000bp") } if ip.InflationCycle.Seconds() <= 0 { - return fmt.Errorf("inflation cycle must be positive") + return sdkerrors.ErrInvalidRequest.Wrap("inflation cycle must be positive") } return nil diff --git a/x/ugov/keeper/keys.go b/x/ugov/keeper/keys.go index 12be2b6e85..cb8408213d 100644 --- a/x/ugov/keeper/keys.go +++ b/x/ugov/keeper/keys.go @@ -2,8 +2,8 @@ package keeper // store key prefixes var ( - keyMinGasPrice = []byte{0x01} - keyEmergencyGroup = []byte{0x02} - KeyInflationParams = []byte{0x03} - KeyInflationCycleStart = []byte{0x04} + keyMinGasPrice = []byte{0x01} + keyEmergencyGroup = []byte{0x02} + keyInflationParams = []byte{0x03} + keyInflationCycleEnd = []byte{0x04} ) diff --git a/x/ugov/keeper/msg_server.go b/x/ugov/keeper/msg_server.go index 5a56e9c168..ed6a079d51 100644 --- a/x/ugov/keeper/msg_server.go +++ b/x/ugov/keeper/msg_server.go @@ -63,7 +63,7 @@ func (m msgServer) GovUpdateInflationParams(ctx context.Context, msg *ugov.MsgGo return nil, err } - err = m.kb.Keeper(&sdkCtx).SetInflationParams(msg.InflationParams) + err = m.kb.Keeper(&sdkCtx).SetInflationParams(msg.Params) if err != nil { return nil, err } diff --git a/x/ugov/keeper/params.go b/x/ugov/keeper/params.go index ac29939005..4717b7bcd2 100644 --- a/x/ugov/keeper/params.go +++ b/x/ugov/keeper/params.go @@ -30,23 +30,23 @@ func (k Keeper) EmergencyGroup() sdk.AccAddress { return store.GetAddress(k.store, keyEmergencyGroup) } -func (k Keeper) SetInflationParams(lp ugov.InflationParams) error { - return store.SetValue(k.store, KeyInflationParams, &lp, "liquidation_params") +func (k Keeper) SetInflationParams(ip ugov.InflationParams) error { + return store.SetValue(k.store, keyInflationParams, &ip, "inflation_params") } func (k Keeper) InflationParams() ugov.InflationParams { - lp := store.GetValue[*ugov.InflationParams](k.store, KeyInflationParams, "liquidation_params") - if lp == nil { + ip := store.GetValue[*ugov.InflationParams](k.store, keyInflationParams, "inflation_params") + if ip == nil { return ugov.InflationParams{} } - return *lp + return *ip } func (k Keeper) SetInflationCycleEnd(startTime time.Time) error { - store.SetTimeMs(k.store, KeyInflationCycleStart, startTime) + store.SetTimeMs(k.store, keyInflationCycleEnd, startTime) return nil } func (k Keeper) GetInflationCycleEnd() (time.Time, error) { - return store.GetTimeMs(k.store, KeyInflationCycleStart) + return store.GetTimeMs(k.store, keyInflationCycleEnd) } diff --git a/x/ugov/keeper/params_test.go b/x/ugov/keeper/params_test.go index de11b0e5ba..3e8b06db76 100644 --- a/x/ugov/keeper/params_test.go +++ b/x/ugov/keeper/params_test.go @@ -46,14 +46,14 @@ func TestLiquidationParams(t *testing.T) { require.Equal(k.InflationParams(), ugov.InflationParams{}, "when nothing is set, empty inflationp params should return") - dlp := ugov.DefaultInflationParams() - k.SetInflationParams(dlp) - rlp := k.InflationParams() - require.Equal(rlp, dlp) - require.Equal(rlp.MaxSupply.GetDenom(), appparams.BondDenom) + dip := ugov.DefaultInflationParams() + k.SetInflationParams(dip) + p := k.InflationParams() + require.Equal(dip, p) + require.Equal(dip.MaxSupply.GetDenom(), appparams.BondDenom) } -func TestInflationCycleStart(t *testing.T) { +func TestInflationCycleEnd(t *testing.T) { t.Parallel() require := require.New(t) k := initKeeper(t) @@ -65,10 +65,10 @@ func TestInflationCycleStart(t *testing.T) { require.NoError(err) require.Equal(in_c.IsZero(), true, "it should be default zero time") - icst := time.Now() - err = k.SetInflationCycleEnd(icst) + cycleEnd := time.Now() + err = k.SetInflationCycleEnd(cycleEnd) require.NoError(err) - ricst, err := k.GetInflationCycleEnd() + end, err := k.GetInflationCycleEnd() require.NoError(err) - require.Equal(ricst.UnixMilli(), icst.UnixMilli(), "inflation cycle start time should be same") + require.Equal(end.UnixMilli(), cycleEnd.UnixMilli(), "inflation cycle end time should be same") } diff --git a/x/ugov/msg.go b/x/ugov/msg.go index a7acecd234..bd6f7833b3 100644 --- a/x/ugov/msg.go +++ b/x/ugov/msg.go @@ -80,7 +80,7 @@ func (msg *MsgGovUpdateInflationParams) ValidateBasic() error { if err := checkers.IsGovAuthority(msg.Authority); err != nil { return err } - return msg.InflationParams.Validate() + return msg.Params.Validate() } // GetSignBytes implements Msg diff --git a/x/ugov/tx.pb.go b/x/ugov/tx.pb.go index d137eaaa0c..c16d4ee1c3 100644 --- a/x/ugov/tx.pb.go +++ b/x/ugov/tx.pb.go @@ -187,8 +187,8 @@ var xxx_messageInfo_MsgGovSetEmergencyGroupResponse proto.InternalMessageInfo // MsgGovUpdateInflationParams request type. type MsgGovUpdateInflationParams struct { // authority must be the address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - InflationParams InflationParams `protobuf:"bytes,2,opt,name=inflation_params,json=inflationParams,proto3" json:"inflation_params"` + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Params InflationParams `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } func (m *MsgGovUpdateInflationParams) Reset() { *m = MsgGovUpdateInflationParams{} } @@ -273,39 +273,39 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/tx.proto", fileDescriptor_9ffc07de1c6ee91b) } var fileDescriptor_9ffc07de1c6ee91b = []byte{ - // 510 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x3f, 0x6f, 0x13, 0x31, - 0x14, 0xbf, 0x2b, 0x08, 0xa9, 0x2e, 0xb4, 0xe8, 0x14, 0xd4, 0x10, 0xe0, 0x12, 0x22, 0x81, 0x0a, - 0x52, 0x6c, 0xa5, 0x08, 0x86, 0x6e, 0x0d, 0x85, 0x88, 0x21, 0xa8, 0x4a, 0xc5, 0xc2, 0x12, 0x39, - 0x17, 0xe3, 0x5a, 0xd4, 0xf6, 0xc9, 0xf6, 0x1d, 0xed, 0xca, 0x27, 0x60, 0x64, 0x64, 0x60, 0x45, - 0x62, 0x80, 0xef, 0x90, 0xb1, 0x62, 0xea, 0x84, 0x20, 0x19, 0xf8, 0x1a, 0xe8, 0x2e, 0xbe, 0xa6, - 0xd7, 0xe4, 0xa0, 0xca, 0x76, 0x7e, 0xef, 0xe7, 0xdf, 0x9f, 0x7b, 0x4f, 0x06, 0x37, 0x22, 0x4e, - 0x08, 0x8a, 0xa8, 0x8c, 0x51, 0xdc, 0x44, 0xe6, 0x10, 0x86, 0x4a, 0x1a, 0xe9, 0x5d, 0x4d, 0xca, - 0x30, 0x29, 0xc3, 0xb8, 0x59, 0xf1, 0x03, 0xa9, 0xb9, 0xd4, 0xa8, 0x8f, 0x35, 0x41, 0x71, 0xb3, - 0x4f, 0x0c, 0x6e, 0xa2, 0x40, 0x32, 0x31, 0x41, 0x57, 0xd6, 0x6d, 0x9f, 0x6b, 0x9a, 0xb0, 0x70, - 0x4d, 0x6d, 0xe3, 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0xcb, 0xd3, 0x24, 0xdf, 0x5d, - 0x70, 0xeb, 0x6c, 0xda, 0x17, 0xe2, 0xcd, 0x01, 0x36, 0x4c, 0x8a, 0x5d, 0xac, 0x30, 0xd7, 0x0b, - 0xa7, 0x79, 0x09, 0xae, 0xb3, 0x8c, 0xaa, 0x17, 0xa6, 0x5c, 0x76, 0x46, 0x77, 0xe0, 0xd9, 0x05, - 0x85, 0xe7, 0x04, 0xed, 0x90, 0xd6, 0x58, 0xbe, 0x3c, 0x13, 0xad, 0x0e, 0x6a, 0x45, 0x9e, 0xb3, - 0x6c, 0x9b, 0x27, 0x4b, 0xe0, 0x52, 0x47, 0x53, 0xef, 0x00, 0x94, 0xe6, 0x2e, 0xdf, 0xbd, 0xbc, - 0x93, 0x82, 0xa1, 0x57, 0x1a, 0x17, 0x82, 0x65, 0xaa, 0x56, 0x6d, 0x76, 0x2f, 0xe6, 0xaa, 0xcd, - 0xc0, 0xe6, 0xab, 0x15, 0xce, 0xcf, 0x8b, 0x40, 0xb9, 0x70, 0x76, 0x0f, 0x8a, 0x8d, 0x9f, 0x83, - 0x56, 0x60, 0x1e, 0xfa, 0xbf, 0x5f, 0xdb, 0xda, 0x19, 0xfe, 0xf6, 0x9d, 0xe1, 0xc8, 0x77, 0x8f, - 0x47, 0xbe, 0xfb, 0x6b, 0xe4, 0xbb, 0x1f, 0xc6, 0xbe, 0x73, 0x3c, 0xf6, 0x9d, 0x93, 0xb1, 0xef, - 0xbc, 0xbe, 0x4f, 0x99, 0xd9, 0x8f, 0xfa, 0x30, 0x90, 0x1c, 0x25, 0xbc, 0x0d, 0x41, 0xcc, 0x3b, - 0xa9, 0xde, 0xa6, 0x07, 0x14, 0x3f, 0x46, 0x87, 0xe9, 0xfb, 0xd0, 0xbf, 0x92, 0x3e, 0x10, 0x8f, - 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x3a, 0x00, 0x74, 0x14, 0xca, 0x04, 0x00, 0x00, + // 505 bytes of a gzipped FileDescri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, 0x9f, 0x5d, 0x4b, 0x7c, 0x4e, 0xc6, + 0x8d, 0xc6, 0xb5, 0xcc, 0xe5, 0xa8, 0xa2, 0x4a, 0x9e, 0xc1, 0x49, 0x90, 0xcd, 0x93, 0x25, 0x74, + 0xa9, 0x65, 0x58, 0x70, 0x80, 0x0a, 0x0b, 0x37, 0xed, 0xee, 0xac, 0x81, 0x9c, 0x09, 0x97, 0x6a, + 0xff, 0x05, 0x9b, 0xa8, 0x3a, 0xb5, 0xf9, 0x25, 0x58, 0xa8, 0x36, 0x07, 0x5b, 0xac, 0x96, 0x3b, + 0xac, 0x20, 0x46, 0xc5, 0xdc, 0x41, 0xdd, 0xcf, 0x37, 0x7e, 0x0e, 0x5a, 0xc2, 0xb3, 0xd0, 0x7f, + 0xfd, 0xda, 0xc6, 0xce, 0xe0, 0x57, 0xe8, 0x0d, 0x86, 0xa1, 0x7f, 0x3c, 0x0c, 0xfd, 0x9f, 0xc3, + 0xd0, 0x7f, 0x3f, 0x0a, 0xbd, 0xe3, 0x51, 0xe8, 0x9d, 0x8c, 0x42, 0xef, 0xd5, 0x3d, 0xc6, 0xed, + 0x7e, 0xdc, 0xc5, 0x91, 0x12, 0x24, 0xe5, 0xad, 0x49, 0xb0, 0x6f, 0x95, 0x7e, 0x93, 0x1d, 0x48, + 0xf2, 0x88, 0x1c, 0x66, 0x8f, 0x41, 0x77, 0x39, 0x7b, 0x0d, 0x1e, 0xfe, 0x09, 0x00, 0x00, 0xff, + 0xff, 0x80, 0x1f, 0xda, 0x31, 0xb7, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -610,7 +610,7 @@ func (m *MsgGovUpdateInflationParams) MarshalToSizedBuffer(dAtA []byte) (int, er var l int _ = l { - size, err := m.InflationParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -723,7 +723,7 @@ func (m *MsgGovUpdateInflationParams) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.InflationParams.Size() + l = m.Params.Size() n += 1 + l + sovTx(uint64(l)) return n } @@ -1135,7 +1135,7 @@ func (m *MsgGovUpdateInflationParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflationParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1162,7 +1162,7 @@ func (m *MsgGovUpdateInflationParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.InflationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From ac4c8811bad59442455545487248b2f9899c07df Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 25 Jul 2023 19:40:36 +0530 Subject: [PATCH 16/17] fix the buf lint --- proto/umee/ugov/v1/ugov.proto | 1 - x/ugov/ugov.pb.go | 52 +++++++++++++++++------------------ 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/proto/umee/ugov/v1/ugov.proto b/proto/umee/ugov/v1/ugov.proto index 5c234aac7f..7e6b8ee640 100644 --- a/proto/umee/ugov/v1/ugov.proto +++ b/proto/umee/ugov/v1/ugov.proto @@ -4,7 +4,6 @@ package umee.ugov.v1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "google/protobuf/duration.proto"; -import "cosmos_proto/cosmos.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; option (gogoproto.goproto_getters_all) = false; diff --git a/x/ugov/ugov.pb.go b/x/ugov/ugov.pb.go index e1610d21c2..d26c98b65b 100644 --- a/x/ugov/ugov.pb.go +++ b/x/ugov/ugov.pb.go @@ -5,7 +5,6 @@ package ugov import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -80,32 +79,31 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/ugov.proto", fileDescriptor_b75ef21394c8e122) } var fileDescriptor_b75ef21394c8e122 = []byte{ - // 388 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x3d, 0xeb, 0xd3, 0x40, - 0x18, 0xcf, 0x55, 0x11, 0x8c, 0x2f, 0x85, 0x20, 0x35, 0xed, 0x70, 0x29, 0x1d, 0xa4, 0x83, 0xde, - 0x11, 0x8b, 0x8b, 0x82, 0x42, 0x5a, 0x04, 0xb7, 0x12, 0x37, 0x97, 0x72, 0x49, 0xaf, 0xe9, 0x61, - 0x2e, 0x17, 0x92, 0xbb, 0x98, 0xcc, 0x7e, 0x01, 0x47, 0x3f, 0x52, 0x27, 0xe9, 0x28, 0x0e, 0x51, - 0xdb, 0xcd, 0xd1, 0x4f, 0x20, 0xb9, 0x24, 0x15, 0xba, 0xfc, 0xa7, 0x7b, 0x9e, 0xe7, 0xf7, 0xf2, - 0xfc, 0xb8, 0x3b, 0xf3, 0xb1, 0xe2, 0x94, 0x62, 0x15, 0x89, 0x02, 0x17, 0xae, 0x3e, 0x51, 0x9a, - 0x09, 0x29, 0xac, 0xfb, 0x0d, 0x80, 0xf4, 0xa0, 0x70, 0x27, 0x8f, 0x22, 0x11, 0x09, 0x0d, 0xe0, - 0xa6, 0x6a, 0x39, 0x13, 0x18, 0x8a, 0x9c, 0x8b, 0x1c, 0x07, 0x24, 0xa7, 0xb8, 0x70, 0x03, 0x2a, - 0x89, 0x8b, 0x43, 0xc1, 0x92, 0x1e, 0x8f, 0x84, 0x88, 0x62, 0x8a, 0x75, 0x17, 0xa8, 0x1d, 0xde, - 0xaa, 0x8c, 0x48, 0x26, 0x7a, 0x7c, 0xdc, 0xea, 0x37, 0xad, 0x71, 0xdb, 0xb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5, 0x56, 0x87, 0xdf, 0xd0, 0x38, 0x9c, 0x20, 0x38, 0x9e, 0x20, 0xf8, 0x75, 0x82, 0xe0, - 0xcb, 0x19, 0x1a, 0xc7, 0x33, 0x34, 0xbe, 0x9f, 0xa1, 0xf1, 0xe1, 0xc9, 0x4d, 0xab, 0x4a, 0xfd, - 0x37, 0x82, 0x3b, 0xfa, 0x82, 0x16, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xf9, 0xa3, 0xcd, - 0x37, 0x02, 0x00, 0x00, + // 381 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x3f, 0xeb, 0xd3, 0x40, + 0x18, 0xce, 0x55, 0x11, 0x8c, 0x7f, 0x0a, 0x41, 0x6a, 0xda, 0xe1, 0x52, 0x3a, 0x48, 0x07, 0xbd, + 0x23, 0x16, 0x17, 0x05, 0x85, 0xb4, 0x08, 0x6e, 0x25, 0x6e, 0x2e, 0xe5, 0x92, 0x5e, 0xd3, 0xc3, + 0x5c, 0x2e, 0x24, 0x77, 0x31, 0x99, 0xfd, 0x02, 0x8e, 0x7e, 0xa4, 0x4e, 0xd2, 0x51, 0x1c, 0xa2, + 0xb6, 0x9b, 0xa3, 0x9f, 0x40, 0x72, 0x49, 0x2a, 0x74, 0xf9, 0x4d, 0xf7, 0xbe, 0xcf, 0xf3, 0xbe, + 0xcf, 0xf3, 0xf0, 0x72, 0xe6, 0x63, 0xc5, 0x29, 0xc5, 0x2a, 0x12, 0x05, 0x2e, 0x5c, 0xfd, 0xa2, + 0x34, 0x13, 0x52, 0x58, 0xf7, 0x1b, 0x02, 0x69, 0xa0, 0x70, 0x27, 0x8f, 0x22, 0x11, 0x09, 0x4d, + 0xe0, 0xa6, 0x6a, 0x67, 0x26, 0x30, 0x14, 0x39, 0x17, 0x39, 0x0e, 0x48, 0x4e, 0x71, 0xe1, 0x06, + 0x54, 0x12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48, 0x39, 0x91, 0x7b, 0xf4, 0x96, 0x95, 0x74, + 0xeb, 0xad, 0xfd, 0xd1, 0x45, 0xdc, 0xef, 0xb5, 0x7d, 0x22, 0xa9, 0xb7, 0x3a, 0xfc, 0x86, 0xc6, + 0xe1, 0x04, 0xc1, 0xf1, 0x04, 0xc1, 0xaf, 0x13, 0x04, 0x5f, 0xce, 0xd0, 0x38, 0x9e, 0xa1, 0xf1, + 0xfd, 0x0c, 0x8d, 0x0f, 0x4f, 0x6e, 0xb2, 0x2a, 0xf5, 0x07, 0x08, 0xee, 0xe8, 0x03, 0x2d, 0xfe, + 0x05, 0x00, 0x00, 0xff, 0xff, 0x68, 0xbd, 0xf3, 0x7e, 0x1c, 0x02, 0x00, 0x00, } func (m *InflationParams) Marshal() (dAtA []byte, err error) { From 3cbf87ec9c3e3cbf5f8a49af28f94d05e3a2c17b Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 26 Jul 2023 18:03:02 +0200 Subject: [PATCH 17/17] fix genesis --- x/ugov/genesis.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/x/ugov/genesis.go b/x/ugov/genesis.go index 2a6fc00104..a3944d5355 100644 --- a/x/ugov/genesis.go +++ b/x/ugov/genesis.go @@ -1,14 +1,17 @@ package ugov import ( + "time" + "github.com/umee-network/umee/v5/util/coin" ) // DefaultGenesis creates a default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - MinGasPrice: coin.UmeeDec("0.1"), - InflationParams: DefaultInflationParams(), + MinGasPrice: coin.UmeeDec("0.1"), + InflationParams: DefaultInflationParams(), + InflationCycleEnd: time.Unix(1, 0), } }