From d9df005a3a6f2e8a1b44d2a795d9dced8bf8f525 Mon Sep 17 00:00:00 2001 From: catShaark Date: Wed, 4 Jan 2023 17:43:17 +0700 Subject: [PATCH 1/4] update proto --- proto/buf.gen.gogo.yaml | 2 +- .../absfee/v1beta1/params.proto | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/proto/buf.gen.gogo.yaml b/proto/buf.gen.gogo.yaml index 4e8fb72..acee612 100644 --- a/proto/buf.gen.gogo.yaml +++ b/proto/buf.gen.gogo.yaml @@ -5,4 +5,4 @@ plugins: opt: plugins=grpc,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mcosmos/orm/v1alpha1/orm.proto=github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1 - name: grpc-gateway out: .. - opt: logtostderr=true,allow_colon_final_segments=true + opt: logtostderr=true diff --git a/proto/feeabstraction/absfee/v1beta1/params.proto b/proto/feeabstraction/absfee/v1beta1/params.proto index a425470..558d519 100644 --- a/proto/feeabstraction/absfee/v1beta1/params.proto +++ b/proto/feeabstraction/absfee/v1beta1/params.proto @@ -13,19 +13,19 @@ option go_package = "github.com/notional-labs/feeabstraction/v1/x/feeabs/types"; message Params { // only ibc osmosis is allowed to be used as fee token // this is the ibc denom of osmosis - string allowed_ibc_token = 1 + string osmosis_ibc_denom = 1 [(gogoproto.moretags) = "yaml:\"allowed_token\"" ]; - - // this is query period - google.protobuf.Duration query_period = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - - // this is swap period - google.protobuf.Duration swap_period = 3 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - // this is connection to osmosis - string osmosis_connection = 4; + // connection id to osmosis chain + string osmosis_ibc_connection_id = 2; + + // contract on osmosis with custom ibc logic for fetching spot price + string osmosis_query_contract = 3; - // counterparty ibc query contract - string counterparty_query_contract = 5; + // we'll update the fee rate each `fee_rate_update_period` + google.protobuf.Duration fee_rate_update_period = 4 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + + // we'll swap our accumulated ibc fee to native token each `accumulated_fee_swap_period` + google.protobuf.Duration accumulated_fee_swap_period = 5 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; } \ No newline at end of file From 409684de9fc3d4dc668ba6c48dfba60c1be1d4a9 Mon Sep 17 00:00:00 2001 From: catShaark Date: Wed, 4 Jan 2023 17:43:56 +0700 Subject: [PATCH 2/4] update params --- .../v1/x/feeabs/types/feepool.pb.go | 46 -- .../v1/x/feeabs/types/genesis.pb.go | 337 ----------- .../v1/x/feeabs/types/params.pb.go | 550 ------------------ x/feeabs/types/params.pb.go | 228 ++++---- 4 files changed, 115 insertions(+), 1046 deletions(-) delete mode 100644 github.com/notional-labs/feeabstraction/v1/x/feeabs/types/feepool.pb.go delete mode 100644 github.com/notional-labs/feeabstraction/v1/x/feeabs/types/genesis.pb.go delete mode 100644 github.com/notional-labs/feeabstraction/v1/x/feeabs/types/params.pb.go diff --git a/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/feepool.pb.go b/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/feepool.pb.go deleted file mode 100644 index 8cf235d..0000000 --- a/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/feepool.pb.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: feeabstraction/absfee/v1beta1/feepool.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func init() { - proto.RegisterFile("feeabstraction/absfee/v1beta1/feepool.proto", fileDescriptor_aeac12e01fe4cbff) -} - -var fileDescriptor_aeac12e01fe4cbff = []byte{ - // 215 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x8e, 0x31, 0x4e, 0xc5, 0x30, - 0x0c, 0x86, 0xdb, 0x85, 0x81, 0x11, 0x31, 0x3d, 0x41, 0x0e, 0x00, 0x22, 0x56, 0xc5, 0xc4, 0xca, - 0x15, 0xd8, 0xd8, 0x9c, 0xca, 0x0d, 0x91, 0xd2, 0x38, 0xc4, 0x79, 0x15, 0xbd, 0x05, 0xc7, 0x62, - 0xec, 0xc8, 0x88, 0xda, 0x8b, 0xa0, 0xb6, 0x01, 0x09, 0x86, 0xb7, 0x59, 0xf6, 0xf7, 0x7f, 0xfe, - 0xcf, 0x6f, 0x3b, 0x22, 0x34, 0x92, 0x13, 0xb6, 0xd9, 0x71, 0x00, 0x34, 0xd2, 0x11, 0xc1, 0xd0, - 0x18, 0xca, 0xd8, 0x40, 0x47, 0x14, 0x99, 0xbd, 0x8e, 0x89, 0x33, 0x5f, 0x5c, 0xff, 0x85, 0xf5, - 0x0e, 0xeb, 0x02, 0x1f, 0x2e, 0x2d, 0x5b, 0xde, 0x48, 0x58, 0xa7, 0x3d, 0x74, 0xb8, 0xb2, 0xcc, - 0xd6, 0x13, 0x60, 0x74, 0x80, 0x21, 0x70, 0xc6, 0x35, 0x2b, 0xe5, 0x7a, 0xd3, 0xb2, 0xf4, 0x2c, - 0x60, 0x50, 0x08, 0x5e, 0x8f, 0x94, 0xc6, 0xdf, 0xdf, 0x11, 0xad, 0x0b, 0x1b, 0xfc, 0xc3, 0x9e, - 0xee, 0x1a, 0x31, 0x61, 0x5f, 0xbc, 0x8f, 0x4f, 0x1f, 0xb3, 0xaa, 0xa7, 0x59, 0xd5, 0x5f, 0xb3, - 0xaa, 0xdf, 0x17, 0x55, 0x4d, 0x8b, 0xaa, 0x3e, 0x17, 0x55, 0x3d, 0x3f, 0x58, 0x97, 0x5f, 0x8e, - 0x46, 0xb7, 0xdc, 0x43, 0xe0, 0x55, 0x84, 0xfe, 0xce, 0xa3, 0x11, 0xf8, 0xa7, 0x1f, 0x1a, 0x78, - 0x2b, 0x3b, 0xc8, 0x63, 0x24, 0x31, 0x67, 0x9b, 0xfb, 0xfe, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x79, - 0x5e, 0x2e, 0x48, 0x35, 0x01, 0x00, 0x00, -} diff --git a/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/genesis.pb.go b/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/genesis.pb.go deleted file mode 100644 index 3da3130..0000000 --- a/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/genesis.pb.go +++ /dev/null @@ -1,337 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: feeabstraction/absfee/v1beta1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the feeabs module. -type GenesisState struct { - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_c85d049bd82004cc, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() *Params { - if m != nil { - return m.Params - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "feeabstraction.absfee.v1beta1.GenesisState") -} - -func init() { - proto.RegisterFile("feeabstraction/absfee/v1beta1/genesis.proto", fileDescriptor_c85d049bd82004cc) -} - -var fileDescriptor_c85d049bd82004cc = []byte{ - // 274 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x8f, 0xb1, 0x4a, 0xf4, 0x40, - 0x14, 0x85, 0x93, 0x66, 0x8b, 0xfc, 0xbf, 0x85, 0x8b, 0x85, 0x04, 0x1d, 0x25, 0x20, 0x88, 0xe2, - 0x5c, 0xa2, 0x95, 0x96, 0xdb, 0xd8, 0x2e, 0x6e, 0x67, 0xe5, 0x9d, 0x70, 0x77, 0x0c, 0x24, 0x73, - 0x63, 0x66, 0x76, 0x31, 0x6f, 0xe1, 0x63, 0x59, 0x6e, 0x69, 0x25, 0x92, 0xb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 0x40, 0x65, 0xe1, 0xcf, 0x80, 0x75, 0x0a, 0xcf, 0xfe, 0x0e, 0x5c, 0x53, 0x91, 0x55, - 0x93, 0xa1, 0xfd, 0xd5, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x71, 0xd3, 0xe7, 0xf9, 0x97, 0x01, - 0x00, 0x00, -} - -func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) 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 ErrIntOverflowGenesis - } - 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", 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 m.Params == nil { - m.Params = &Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/params.pb.go b/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/params.pb.go deleted file mode 100644 index 928f776..0000000 --- a/github.com/notional-labs/feeabstraction/v1/x/feeabs/types/params.pb.go +++ /dev/null @@ -1,550 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: feeabstraction/absfee/v1beta1/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/genproto/googleapis/api/annotations" - 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 - -// Params defines the parameters for the feeabs module. -type Params struct { - // only ibc osmosis is allowed to be used as fee token - // this is the ibc denom of osmosis - AllowedIbcToken string `protobuf:"bytes,1,opt,name=allowed_ibc_token,json=allowedIbcToken,proto3" json:"allowed_ibc_token,omitempty" yaml:"allowed_token"` - // this is query period - QueryPeriod time.Duration `protobuf:"bytes,2,opt,name=query_period,json=queryPeriod,proto3,stdduration" json:"query_period"` - // this is swap period - SwapPeriod time.Duration `protobuf:"bytes,3,opt,name=swap_period,json=swapPeriod,proto3,stdduration" json:"swap_period"` - // this is connection to osmosis - OsmosisConnection string `protobuf:"bytes,4,opt,name=osmosis_connection,json=osmosisConnection,proto3" json:"osmosis_connection,omitempty"` - // counterparty ibc query contract - CounterpartyQueryContract string `protobuf:"bytes,5,opt,name=counterparty_query_contract,json=counterpartyQueryContract,proto3" json:"counterparty_query_contract,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_64e66a0978c84086, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetAllowedIbcToken() string { - if m != nil { - return m.AllowedIbcToken - } - return "" -} - -func (m *Params) GetQueryPeriod() time.Duration { - if m != nil { - return m.QueryPeriod - } - return 0 -} - -func (m *Params) GetSwapPeriod() time.Duration { - if m != nil { - return m.SwapPeriod - } - return 0 -} - -func (m *Params) GetOsmosisConnection() string { - if m != nil { - return m.OsmosisConnection - } - return "" -} - -func (m *Params) GetCounterpartyQueryContract() string { - if m != nil { - return m.CounterpartyQueryContract - } - return "" -} - -func init() { - proto.RegisterType((*Params)(nil), "feeabstraction.absfee.v1beta1.Params") -} - -func init() { - proto.RegisterFile("feeabstraction/absfee/v1beta1/params.proto", fileDescriptor_64e66a0978c84086) -} - -var fileDescriptor_64e66a0978c84086 = []byte{ - // 405 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xb1, 0x8e, 0xd3, 0x30, - 0x1c, 0xc6, 0x93, 0x03, 0x4e, 0xe0, 0x22, 0xa1, 0x8b, 0x6e, 0xc8, 0x15, 0x48, 0x4f, 0x9d, 0x4e, - 0x95, 0x1a, 0xab, 0x30, 0xc1, 0xc0, 0xd0, 0x56, 0x48, 0x6c, 0xa5, 0x30, 0xb1, 0x44, 0x7f, 0xbb, - 0x6e, 0x88, 0x48, 0xfc, 0x0f, 0xb6, 0xd3, 0x92, 0xb7, 0x60, 0xe4, 0x91, 0x2a, 0xb1, 0x74, 0x64, - 0x2a, 0xa8, 0x7d, 0x03, 0x9e, 0x00, 0xc5, 0x71, 0x51, 0x61, 0xba, 0x2d, 0xf6, 0xf7, 0xfb, 0x3e, - 0x7f, 0xff, 0xd8, 0x64, 0xb0, 0x14, 0x02, 0x98, 0x36, 0x0a, 0xb8, 0xc9, 0x50, 0x52, 0x60, 0x7a, - 0x29, 0x04, 0x5d, 0x8d, 0x98, 0x30, 0x30, 0xa2, 0x25, 0x28, 0x28, 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, 0x09, 0x47, 0x29, 0x85, 0xbd, 0x83, 0xf0, 0x6e, 0x33, 0xd4, 0xfc, 0xc2, 0x29, 0x93, 0xbf, - 0x42, 0xf0, 0x8a, 0x3c, 0xe6, 0x58, 0x49, 0x23, 0x54, 0x09, 0xca, 0xd4, 0x49, 0x3b, 0x09, 0x47, - 0x69, 0xaf, 0x2f, 0xbc, 0x67, 0x7d, 0x57, 0xa7, 0xc8, 0xdb, 0x86, 0x98, 0x38, 0x60, 0xfc, 0x6e, - 0xb3, 0x8f, 0xfc, 0xed, 0x3e, 0xf2, 0x7f, 0xed, 0x23, 0xff, 0xeb, 0x21, 0xf2, 0xb6, 0x87, 0xc8, - 0xfb, 0x71, 0x88, 0xbc, 0x0f, 0x2f, 0xd2, 0xcc, 0x7c, 0xac, 0x58, 0xcc, 0xb1, 0xa0, 0x12, 0x9b, - 0xc3, 0x20, 0x1f, 0xe6, 0xc0, 0x34, 0xfd, 0xef, 0x2d, 0xad, 0x46, 0xf4, 0x8b, 0xdb, 0xa3, 0xa6, - 0x2e, 0x85, 0x66, 0xe7, 0x76, 0xd8, 0xe7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x64, 0x7d, 0x86, - 0x5d, 0x76, 0x02, 0x00, 0x00, -} - -func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CounterpartyQueryContract) > 0 { - i -= len(m.CounterpartyQueryContract) - copy(dAtA[i:], m.CounterpartyQueryContract) - i = encodeVarintParams(dAtA, i, uint64(len(m.CounterpartyQueryContract))) - i-- - dAtA[i] = 0x2a - } - if len(m.OsmosisConnection) > 0 { - i -= len(m.OsmosisConnection) - copy(dAtA[i:], m.OsmosisConnection) - i = encodeVarintParams(dAtA, i, uint64(len(m.OsmosisConnection))) - i-- - dAtA[i] = 0x22 - } - n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.SwapPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.SwapPeriod):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintParams(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x1a - n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.QueryPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.QueryPeriod):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintParams(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x12 - if len(m.AllowedIbcToken) > 0 { - i -= len(m.AllowedIbcToken) - copy(dAtA[i:], m.AllowedIbcToken) - i = encodeVarintParams(dAtA, i, uint64(len(m.AllowedIbcToken))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.AllowedIbcToken) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.QueryPeriod) - n += 1 + l + sovParams(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.SwapPeriod) - n += 1 + l + sovParams(uint64(l)) - l = len(m.OsmosisConnection) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - l = len(m.CounterpartyQueryContract) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) 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 ErrIntOverflowParams - } - 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowedIbcToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AllowedIbcToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field QueryPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.QueryPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SwapPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.SwapPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OsmosisConnection", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OsmosisConnection = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyQueryContract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CounterpartyQueryContract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(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, ErrIntOverflowParams - } - 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, ErrIntOverflowParams - } - 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, ErrIntOverflowParams - } - 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, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/feeabs/types/params.pb.go b/x/feeabs/types/params.pb.go index 928f776..bfdb207 100644 --- a/x/feeabs/types/params.pb.go +++ b/x/feeabs/types/params.pb.go @@ -7,9 +7,9 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/genproto/googleapis/api/annotations" io "io" math "math" @@ -33,15 +33,15 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Params struct { // only ibc osmosis is allowed to be used as fee token // this is the ibc denom of osmosis - AllowedIbcToken string `protobuf:"bytes,1,opt,name=allowed_ibc_token,json=allowedIbcToken,proto3" json:"allowed_ibc_token,omitempty" yaml:"allowed_token"` - // this is query period - QueryPeriod time.Duration `protobuf:"bytes,2,opt,name=query_period,json=queryPeriod,proto3,stdduration" json:"query_period"` - // this is swap period - SwapPeriod time.Duration `protobuf:"bytes,3,opt,name=swap_period,json=swapPeriod,proto3,stdduration" json:"swap_period"` - // this is connection to osmosis - OsmosisConnection string `protobuf:"bytes,4,opt,name=osmosis_connection,json=osmosisConnection,proto3" json:"osmosis_connection,omitempty"` - // counterparty ibc query contract - CounterpartyQueryContract string `protobuf:"bytes,5,opt,name=counterparty_query_contract,json=counterpartyQueryContract,proto3" json:"counterparty_query_contract,omitempty"` + OsmosisIbcDenom string `protobuf:"bytes,1,opt,name=osmosis_ibc_denom,json=osmosisIbcDenom,proto3" json:"osmosis_ibc_denom,omitempty" yaml:"allowed_token"` + // connection id to osmosis chain + OsmosisIbcConnectionId string `protobuf:"bytes,2,opt,name=osmosis_ibc_connection_id,json=osmosisIbcConnectionId,proto3" json:"osmosis_ibc_connection_id,omitempty"` + // contract on osmosis with custom ibc logic for fetching spot price + OsmosisQueryContract string `protobuf:"bytes,3,opt,name=osmosis_query_contract,json=osmosisQueryContract,proto3" json:"osmosis_query_contract,omitempty"` + // we'll update the fee rate each `fee_rate_update_period` + FeeRateUpdatePeriod time.Duration `protobuf:"bytes,4,opt,name=fee_rate_update_period,json=feeRateUpdatePeriod,proto3,stdduration" json:"fee_rate_update_period"` + // we'll swap our accumulated ibc fee to native token each `accumulated_fee_swap_period` + AccumulatedFeeSwapPeriod time.Duration `protobuf:"bytes,5,opt,name=accumulated_fee_swap_period,json=accumulatedFeeSwapPeriod,proto3,stdduration" json:"accumulated_fee_swap_period"` } func (m *Params) Reset() { *m = Params{} } @@ -77,39 +77,39 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetAllowedIbcToken() string { +func (m *Params) GetOsmosisIbcDenom() string { if m != nil { - return m.AllowedIbcToken + return m.OsmosisIbcDenom } return "" } -func (m *Params) GetQueryPeriod() time.Duration { +func (m *Params) GetOsmosisIbcConnectionId() string { if m != nil { - return m.QueryPeriod + return m.OsmosisIbcConnectionId } - return 0 + return "" } -func (m *Params) GetSwapPeriod() time.Duration { +func (m *Params) GetOsmosisQueryContract() string { if m != nil { - return m.SwapPeriod + return m.OsmosisQueryContract } - return 0 + return "" } -func (m *Params) GetOsmosisConnection() string { +func (m *Params) GetFeeRateUpdatePeriod() time.Duration { if m != nil { - return m.OsmosisConnection + return m.FeeRateUpdatePeriod } - return "" + return 0 } -func (m *Params) GetCounterpartyQueryContract() string { +func (m *Params) GetAccumulatedFeeSwapPeriod() time.Duration { if m != nil { - return m.CounterpartyQueryContract + return m.AccumulatedFeeSwapPeriod } - return "" + return 0 } func init() { @@ -121,33 +121,35 @@ func init() { } var fileDescriptor_64e66a0978c84086 = []byte{ - // 405 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xb1, 0x8e, 0xd3, 0x30, - 0x1c, 0xc6, 0x93, 0x03, 0x4e, 0xe0, 0x22, 0xa1, 0x8b, 0x6e, 0xc8, 0x15, 0x48, 0x4f, 0x9d, 0x4e, - 0x95, 0x1a, 0xab, 0x30, 0xc1, 0xc0, 0xd0, 0x56, 0x48, 0x6c, 0xa5, 0x30, 0xb1, 0x44, 0x7f, 0xbb, - 0x6e, 0x88, 0x48, 0xfc, 0x0f, 0xb6, 0xd3, 0x92, 0xb7, 0x60, 0xe4, 0x91, 0x2a, 0xb1, 0x74, 0x64, - 0x2a, 0xa8, 0x7d, 0x03, 0x9e, 0x00, 0xc5, 0x71, 0x51, 0x61, 0xba, 0x2d, 0xf6, 0xf7, 0xfb, 0x3e, - 0x7f, 0xff, 0xd8, 0x64, 0xb0, 0x14, 0x02, 0x98, 0x36, 0x0a, 0xb8, 0xc9, 0x50, 0x52, 0x60, 0x7a, - 0x29, 0x04, 0x5d, 0x8d, 0x98, 0x30, 0x30, 0xa2, 0x25, 0x28, 0x28, 0x74, 0x5c, 0x2a, 0x34, 0x18, - 0x3c, 0xfd, 0x97, 0x8d, 0x5b, 0x36, 0x76, 0x6c, 0xf7, 0x32, 0xc5, 0x14, 0x2d, 0x49, 0x9b, 0xaf, - 0xd6, 0xd4, 0x7d, 0x92, 0x22, 0xa6, 0xb9, 0xa0, 0x50, 0x66, 0x14, 0xa4, 0x44, 0x03, 0x8d, 0xd7, - 0x45, 0x76, 0x07, 0x1c, 0x75, 0x81, 0x9a, 0x32, 0xd0, 0x82, 0x7e, 0xae, 0x84, 0xaa, 0x4f, 0x8e, - 0x4e, 0x33, 0x69, 0x61, 0xc7, 0x46, 0x2e, 0xc9, 0xae, 0x58, 0xb5, 0xa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x71, 0x88, 0xbc, 0x0f, 0x2f, 0xd2, 0xcc, 0x7c, 0xac, 0x58, 0xcc, 0xb1, 0xa0, 0x12, 0x9b, - 0xc3, 0x20, 0x1f, 0xe6, 0xc0, 0x34, 0xfd, 0xef, 0x2d, 0xad, 0x46, 0xf4, 0x8b, 0xdb, 0xa3, 0xa6, - 0x2e, 0x85, 0x66, 0xe7, 0x76, 0xd8, 0xe7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x64, 0x7d, 0x86, - 0x5d, 0x76, 0x02, 0x00, 0x00, + // 433 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6f, 0xd3, 0x40, + 0x10, 0xc5, 0xe3, 0x02, 0x15, 0x98, 0x03, 0xc2, 0x44, 0x95, 0x1b, 0xc0, 0xa9, 0x72, 0xaa, 0x2a, + 0xe1, 0x55, 0x80, 0x4b, 0x39, 0xa6, 0x11, 0x52, 0x6f, 0x25, 0x15, 0x12, 0xe2, 0x62, 0xcd, 0xda, + 0x63, 0xb3, 0xc2, 0xde, 0x59, 0xbc, 0xeb, 0x86, 0x7c, 0x0b, 0x8e, 0x7c, 0xa4, 0x1e, 0x7b, 0xe4, + 0x54, 0x50, 0xf2, 0x0d, 0xb8, 0x23, 0xa1, 0xdd, 0x6c, 0x20, 0x70, 0xea, 0xc9, 0x7f, 0xde, 0x7b, + 0xbf, 0xd9, 0x79, 0xda, 0xf0, 0xa8, 0x44, 0x04, 0xae, 0x4d, 0x0b, 0xb9, 0x11, 0x24, 0x19, 0x70, + 0x5d, 0x22, 0xb2, 0x8b, 0x31, 0x47, 0x03, 0x63, 0xa6, 0xa0, 0x85, 0x46, 0xa7, 0xaa, 0x25, 0x43, + 0xd1, 0xd3, 0x7f, 0xbd, 0xe9, 0xda, 0x9b, 0x7a, 0xef, 0xa0, 0x5f, 0x51, 0x45, 0xce, 0xc9, 0xec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c, 0xbd, 0xbc, 0x1e, 0xf6, 0xbe, 0x7e, 0x1f, 0x06, 0xb3, + 0x47, 0x25, 0xe2, 0x0c, 0x0c, 0xbe, 0x75, 0x80, 0x33, 0x97, 0x8f, 0x78, 0xf8, 0x18, 0xf2, 0xbc, + 0x6b, 0xba, 0x1a, 0x0c, 0x16, 0x99, 0x9d, 0xa2, 0xe7, 0xa0, 0x36, 0xf8, 0x3b, 0x37, 0xc7, 0xc7, + 0x5b, 0x9c, 0xd7, 0x88, 0xe7, 0x73, 0x50, 0xeb, 0x19, 0x93, 0xf3, 0xcb, 0x65, 0x12, 0x5c, 0x2d, + 0x93, 0xe0, 0xc7, 0x32, 0x09, 0xbe, 0xac, 0x92, 0xde, 0xd5, 0x2a, 0xe9, 0x7d, 0x5b, 0x25, 0xbd, + 0xf7, 0xc7, 0x95, 0x30, 0x1f, 0x3a, 0x9e, 0xe6, 0xd4, 0x30, 0x49, 0x16, 0x08, 0xf5, 0xb3, 0x1a, + 0xb8, 0x66, 0xff, 0xdd, 0xbe, 0x8b, 0x31, 0xfb, 0xec, 0xff, 0x31, 0xb3, 0x50, 0xa8, 0xf9, 0xae, + 0x3b, 0xcb, 0x8b, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcd, 0xea, 0xee, 0x41, 0xa8, 0x02, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -170,40 +172,40 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.CounterpartyQueryContract) > 0 { - i -= len(m.CounterpartyQueryContract) - copy(dAtA[i:], m.CounterpartyQueryContract) - i = encodeVarintParams(dAtA, i, uint64(len(m.CounterpartyQueryContract))) - i-- - dAtA[i] = 0x2a - } - if len(m.OsmosisConnection) > 0 { - i -= len(m.OsmosisConnection) - copy(dAtA[i:], m.OsmosisConnection) - i = encodeVarintParams(dAtA, i, uint64(len(m.OsmosisConnection))) - i-- - dAtA[i] = 0x22 - } - n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.SwapPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.SwapPeriod):]) + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.AccumulatedFeeSwapPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.AccumulatedFeeSwapPeriod):]) if err1 != nil { return 0, err1 } i -= n1 i = encodeVarintParams(dAtA, i, uint64(n1)) i-- - dAtA[i] = 0x1a - n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.QueryPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.QueryPeriod):]) + dAtA[i] = 0x2a + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.FeeRateUpdatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.FeeRateUpdatePeriod):]) if err2 != nil { return 0, err2 } i -= n2 i = encodeVarintParams(dAtA, i, uint64(n2)) i-- - dAtA[i] = 0x12 - if len(m.AllowedIbcToken) > 0 { - i -= len(m.AllowedIbcToken) - copy(dAtA[i:], m.AllowedIbcToken) - i = encodeVarintParams(dAtA, i, uint64(len(m.AllowedIbcToken))) + dAtA[i] = 0x22 + if len(m.OsmosisQueryContract) > 0 { + i -= len(m.OsmosisQueryContract) + copy(dAtA[i:], m.OsmosisQueryContract) + i = encodeVarintParams(dAtA, i, uint64(len(m.OsmosisQueryContract))) + i-- + dAtA[i] = 0x1a + } + if len(m.OsmosisIbcConnectionId) > 0 { + i -= len(m.OsmosisIbcConnectionId) + copy(dAtA[i:], m.OsmosisIbcConnectionId) + i = encodeVarintParams(dAtA, i, uint64(len(m.OsmosisIbcConnectionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.OsmosisIbcDenom) > 0 { + i -= len(m.OsmosisIbcDenom) + copy(dAtA[i:], m.OsmosisIbcDenom) + i = encodeVarintParams(dAtA, i, uint64(len(m.OsmosisIbcDenom))) i-- dAtA[i] = 0xa } @@ -227,22 +229,22 @@ func (m *Params) Size() (n int) { } var l int _ = l - l = len(m.AllowedIbcToken) + l = len(m.OsmosisIbcDenom) if l > 0 { n += 1 + l + sovParams(uint64(l)) } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.QueryPeriod) - n += 1 + l + sovParams(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.SwapPeriod) - n += 1 + l + sovParams(uint64(l)) - l = len(m.OsmosisConnection) + l = len(m.OsmosisIbcConnectionId) if l > 0 { n += 1 + l + sovParams(uint64(l)) } - l = len(m.CounterpartyQueryContract) + l = len(m.OsmosisQueryContract) if l > 0 { n += 1 + l + sovParams(uint64(l)) } + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.FeeRateUpdatePeriod) + n += 1 + l + sovParams(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.AccumulatedFeeSwapPeriod) + n += 1 + l + sovParams(uint64(l)) return n } @@ -283,7 +285,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowedIbcToken", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisIbcDenom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -311,13 +313,13 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AllowedIbcToken = string(dAtA[iNdEx:postIndex]) + m.OsmosisIbcDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field QueryPeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisIbcConnectionId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -327,30 +329,29 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthParams } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthParams } if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.QueryPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.OsmosisIbcConnectionId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SwapPeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisQueryContract", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -360,30 +361,29 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthParams } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthParams } if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.SwapPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.OsmosisQueryContract = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OsmosisConnection", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeeRateUpdatePeriod", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -393,29 +393,30 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthParams } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthParams } if postIndex > l { return io.ErrUnexpectedEOF } - m.OsmosisConnection = string(dAtA[iNdEx:postIndex]) + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.FeeRateUpdatePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyQueryContract", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AccumulatedFeeSwapPeriod", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -425,23 +426,24 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthParams } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthParams } if postIndex > l { return io.ErrUnexpectedEOF } - m.CounterpartyQueryContract = string(dAtA[iNdEx:postIndex]) + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.AccumulatedFeeSwapPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex From 68bf27009419a6794812aef14a32ba9dcc5e78db Mon Sep 17 00:00:00 2001 From: catShaark Date: Wed, 4 Jan 2023 18:18:06 +0700 Subject: [PATCH 3/4] update params.go --- x/feeabs/types/params.go | 57 ++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/x/feeabs/types/params.go b/x/feeabs/types/params.go index 4e3dbe8..4acad99 100644 --- a/x/feeabs/types/params.go +++ b/x/feeabs/types/params.go @@ -1,6 +1,8 @@ package types import ( + "fmt" + "strings" time "time" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -8,21 +10,20 @@ import ( // Feeabs params default values . const ( - // After pass, ISO 8601 format for when swap in end period DefaultSwapPeriod time.Duration = time.Minute * 100 - // After pass, ISO 8601 format for when they can no longer burn EXP DefaultQueryPeriod time.Duration = time.Minute * 1 - // Contract address in Osmosis . DefaultContractAddress string = "" ) // Parameter keys store keys. var ( - KeyAllowedToken = []byte("allowed_token") - KeySwapPeriod = []byte("swap_period") - KeyQueryPeriod = []byte("query_period") + KeyOsmosisIbcDenom = []byte("osmosis_ibc_denom") + KeyOsmosisIbcConnectionId = []byte("osmosis_ibc_connection_id") + KeyOsmosisQueryContract = []byte("osmosis_query_contract") + KeyFeeRateUpdatePeriod = []byte("fee_rate_update_period") + KeyAccumulatedFeeSwapPeriod = []byte("accumulated_fee_swap_period") _ paramtypes.ParamSet = &Params{} ) @@ -35,15 +36,49 @@ func ParamKeyTable() paramtypes.KeyTable { // Implements params.ParamSet. func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyAllowedToken, &p.AllowedIbcToken, validateToken), - paramtypes.NewParamSetPair(KeySwapPeriod, &p.SwapPeriod, validatePeriod), - paramtypes.NewParamSetPair(KeyQueryPeriod, &p.SwapPeriod, validatePeriod), + paramtypes.NewParamSetPair(KeyOsmosisIbcDenom, &p.OsmosisIbcDenom, validateOsmosisIbcDenom), + paramtypes.NewParamSetPair(KeyOsmosisIbcConnectionId, &p.OsmosisIbcConnectionId, validateIbcConnectionId), + paramtypes.NewParamSetPair(KeyOsmosisQueryContract, &p.OsmosisQueryContract, validateOsmosisQueryContract), + paramtypes.NewParamSetPair(KeyFeeRateUpdatePeriod, &p.FeeRateUpdatePeriod, noOp), + paramtypes.NewParamSetPair(KeyAccumulatedFeeSwapPeriod, &p.AccumulatedFeeSwapPeriod, noOp), } } -func validateToken(i interface{}) error { +func noOp(i interface{}) error { return nil } -func validatePeriod(i interface{}) error { + +func validateOsmosisIbcDenom(i interface{}) error { + denom, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if strings.HasPrefix(denom, "ibc/") { + return fmt.Errorf("osmosis ibc denom doesn't have ibc prefix") + } + + return nil +} + +func validateIbcConnectionId(i interface{}) error { + connectionId, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if !strings.HasPrefix(connectionId, "connection-") { + return fmt.Errorf("wrong connection id format") + } + + return nil +} + +func validateOsmosisQueryContract(i interface{}) error { + _, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return nil } From 6caa96370f5f6763430e683630cde5c1a5b24667 Mon Sep 17 00:00:00 2001 From: catShaark Date: Thu, 5 Jan 2023 01:01:31 +0700 Subject: [PATCH 4/4] change some names --- .../absfee/v1beta1/params.proto | 8 +- x/feeabs/types/params.go | 14 +-- x/feeabs/types/params.pb.go | 90 +++++++++---------- 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/proto/feeabstraction/absfee/v1beta1/params.proto b/proto/feeabstraction/absfee/v1beta1/params.proto index 558d519..8e3d649 100644 --- a/proto/feeabstraction/absfee/v1beta1/params.proto +++ b/proto/feeabstraction/absfee/v1beta1/params.proto @@ -22,10 +22,10 @@ message Params { // contract on osmosis with custom ibc logic for fetching spot price string osmosis_query_contract = 3; - // we'll update the fee rate each `fee_rate_update_period` - google.protobuf.Duration fee_rate_update_period = 4 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + // we'll update the fee rate each `osmosis_exchange_rate_update_period` + google.protobuf.Duration osmosis_exchange_rate_update_period = 4 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - // we'll swap our accumulated ibc fee to native token each `accumulated_fee_swap_period` - google.protobuf.Duration accumulated_fee_swap_period = 5 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + // we'll swap our accumulated osmosis fee to native token each `accumulated_osmosis_fee_swap_period` + google.protobuf.Duration accumulated_osmosis_fee_swap_period = 5 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; } \ No newline at end of file diff --git a/x/feeabs/types/params.go b/x/feeabs/types/params.go index 4acad99..fcf47c5 100644 --- a/x/feeabs/types/params.go +++ b/x/feeabs/types/params.go @@ -19,11 +19,11 @@ const ( // Parameter keys store keys. var ( - KeyOsmosisIbcDenom = []byte("osmosis_ibc_denom") - KeyOsmosisIbcConnectionId = []byte("osmosis_ibc_connection_id") - KeyOsmosisQueryContract = []byte("osmosis_query_contract") - KeyFeeRateUpdatePeriod = []byte("fee_rate_update_period") - KeyAccumulatedFeeSwapPeriod = []byte("accumulated_fee_swap_period") + KeyOsmosisIbcDenom = []byte("osmosis_ibc_denom") + KeyOsmosisIbcConnectionId = []byte("osmosis_ibc_connection_id") + KeyOsmosisQueryContract = []byte("osmosis_query_contract") + KeyOsmosisExchangeRateUpdatePeriod = []byte("osmosis_exchange_rate_update_period") + KeyAccumulatedOsmosisFeeSwapPeriod = []byte("accumulated_osmosis_fee_swap_period") _ paramtypes.ParamSet = &Params{} ) @@ -39,8 +39,8 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyOsmosisIbcDenom, &p.OsmosisIbcDenom, validateOsmosisIbcDenom), paramtypes.NewParamSetPair(KeyOsmosisIbcConnectionId, &p.OsmosisIbcConnectionId, validateIbcConnectionId), paramtypes.NewParamSetPair(KeyOsmosisQueryContract, &p.OsmosisQueryContract, validateOsmosisQueryContract), - paramtypes.NewParamSetPair(KeyFeeRateUpdatePeriod, &p.FeeRateUpdatePeriod, noOp), - paramtypes.NewParamSetPair(KeyAccumulatedFeeSwapPeriod, &p.AccumulatedFeeSwapPeriod, noOp), + paramtypes.NewParamSetPair(KeyOsmosisExchangeRateUpdatePeriod, &p.OsmosisExchangeRateUpdatePeriod, noOp), + paramtypes.NewParamSetPair(KeyAccumulatedOsmosisFeeSwapPeriod, &p.AccumulatedOsmosisFeeSwapPeriod, noOp), } } diff --git a/x/feeabs/types/params.pb.go b/x/feeabs/types/params.pb.go index bfdb207..86af149 100644 --- a/x/feeabs/types/params.pb.go +++ b/x/feeabs/types/params.pb.go @@ -38,10 +38,10 @@ type Params struct { OsmosisIbcConnectionId string `protobuf:"bytes,2,opt,name=osmosis_ibc_connection_id,json=osmosisIbcConnectionId,proto3" json:"osmosis_ibc_connection_id,omitempty"` // contract on osmosis with custom ibc logic for fetching spot price OsmosisQueryContract string `protobuf:"bytes,3,opt,name=osmosis_query_contract,json=osmosisQueryContract,proto3" json:"osmosis_query_contract,omitempty"` - // we'll update the fee rate each `fee_rate_update_period` - FeeRateUpdatePeriod time.Duration `protobuf:"bytes,4,opt,name=fee_rate_update_period,json=feeRateUpdatePeriod,proto3,stdduration" json:"fee_rate_update_period"` - // we'll swap our accumulated ibc fee to native token each `accumulated_fee_swap_period` - AccumulatedFeeSwapPeriod time.Duration `protobuf:"bytes,5,opt,name=accumulated_fee_swap_period,json=accumulatedFeeSwapPeriod,proto3,stdduration" json:"accumulated_fee_swap_period"` + // we'll update the fee rate each `osmosis_exchange_rate_update_period` + OsmosisExchangeRateUpdatePeriod time.Duration `protobuf:"bytes,4,opt,name=osmosis_exchange_rate_update_period,json=osmosisExchangeRateUpdatePeriod,proto3,stdduration" json:"osmosis_exchange_rate_update_period"` + // we'll swap our accumulated osmosis fee to native token each `accumulated_osmosis_fee_swap_period` + AccumulatedOsmosisFeeSwapPeriod time.Duration `protobuf:"bytes,5,opt,name=accumulated_osmosis_fee_swap_period,json=accumulatedOsmosisFeeSwapPeriod,proto3,stdduration" json:"accumulated_osmosis_fee_swap_period"` } func (m *Params) Reset() { *m = Params{} } @@ -98,16 +98,16 @@ func (m *Params) GetOsmosisQueryContract() string { return "" } -func (m *Params) GetFeeRateUpdatePeriod() time.Duration { +func (m *Params) GetOsmosisExchangeRateUpdatePeriod() time.Duration { if m != nil { - return m.FeeRateUpdatePeriod + return m.OsmosisExchangeRateUpdatePeriod } return 0 } -func (m *Params) GetAccumulatedFeeSwapPeriod() time.Duration { +func (m *Params) GetAccumulatedOsmosisFeeSwapPeriod() time.Duration { if m != nil { - return m.AccumulatedFeeSwapPeriod + return m.AccumulatedOsmosisFeeSwapPeriod } return 0 } @@ -121,35 +121,35 @@ func init() { } var fileDescriptor_64e66a0978c84086 = []byte{ - // 433 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6f, 0xd3, 0x40, - 0x10, 0xc5, 0xe3, 0x02, 0x15, 0x98, 0x03, 0xc2, 0x44, 0x95, 0x1b, 0xc0, 0xa9, 0x72, 0xaa, 0x2a, - 0xe1, 0x55, 0x80, 0x4b, 0x39, 0xa6, 0x11, 0x52, 0x6f, 0x25, 0x15, 0x12, 0xe2, 0x62, 0xcd, 0xda, - 0x63, 0xb3, 0xc2, 0xde, 0x59, 0xbc, 0xeb, 0x86, 0x7c, 0x0b, 0x8e, 0x7c, 0xa4, 0x1e, 0x7b, 0xe4, - 0x54, 0x50, 0xf2, 0x0d, 0xb8, 0x23, 0xa1, 0xdd, 0x6c, 0x20, 0x70, 0xea, 0xc9, 0x7f, 0xde, 0x7b, - 0xbf, 0xd9, 0x79, 0xda, 0xf0, 0xa8, 0x44, 0x04, 0xae, 0x4d, 0x0b, 0xb9, 0x11, 0x24, 0x19, 0x70, - 0x5d, 0x22, 0xb2, 0x8b, 0x31, 0x47, 0x03, 0x63, 0xa6, 0xa0, 0x85, 0x46, 0xa7, 0xaa, 0x25, 0x43, - 0xd1, 0xd3, 0x7f, 0xbd, 0xe9, 0xda, 0x9b, 0x7a, 0xef, 0xa0, 0x5f, 0x51, 0x45, 0xce, 0xc9, 0xec, - 0xdb, 0x3a, 0x34, 0x78, 0x52, 0x11, 0x55, 0x35, 0x32,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 0xb3, - 0x47, 0x25, 0xe2, 0x0c, 0x0c, 0xbe, 0x75, 0x80, 0x33, 0x97, 0x8f, 0x78, 0xf8, 0x18, 0xf2, 0xbc, - 0x6b, 0xba, 0x1a, 0x0c, 0x16, 0x99, 0x9d, 0xa2, 0xe7, 0xa0, 0x36, 0xf8, 0x3b, 0x37, 0xc7, 0xc7, - 0x5b, 0x9c, 0xd7, 0x88, 0xe7, 0x73, 0x50, 0xeb, 0x19, 0x93, 0xf3, 0xcb, 0x65, 0x12, 0x5c, 0x2d, - 0x93, 0xe0, 0xc7, 0x32, 0x09, 0xbe, 0xac, 0x92, 0xde, 0xd5, 0x2a, 0xe9, 0x7d, 0x5b, 0x25, 0xbd, - 0xf7, 0xc7, 0x95, 0x30, 0x1f, 0x3a, 0x9e, 0xe6, 0xd4, 0x30, 0x49, 0x16, 0x08, 0xf5, 0xb3, 0x1a, - 0xb8, 0x66, 0xff, 0xdd, 0xbe, 0x8b, 0x31, 0xfb, 0xec, 0xff, 0x31, 0xb3, 0x50, 0xa8, 0xf9, 0xae, - 0x3b, 0xcb, 0x8b, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcd, 0xea, 0xee, 0x41, 0xa8, 0x02, 0x00, - 0x00, + // 445 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcd, 0x6e, 0xd3, 0x40, + 0x14, 0x85, 0x63, 0x0a, 0x15, 0x98, 0x05, 0xc2, 0x8a, 0x90, 0x1b, 0x81, 0x53, 0x85, 0x4d, 0x55, + 0x09, 0x8f, 0x02, 0x6c, 0xca, 0x32, 0x0d, 0x48, 0x5d, 0x51, 0x52, 0xb1, 0x61, 0x63, 0xdd, 0x19, + 0xdf, 0xb8, 0x16, 0xf6, 0x5c, 0xd7, 0x33, 0x6e, 0x9a, 0xb7, 0x60, 0xc9, 0x0b, 0xf0, 0x2e, 0x5d, + 0x76, 0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0x47, 0x7a, 0xf5, + 0x3b, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x2d, 0xd2, 0x36, 0xd0, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -172,7 +172,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.AccumulatedFeeSwapPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.AccumulatedFeeSwapPeriod):]) + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.AccumulatedOsmosisFeeSwapPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.AccumulatedOsmosisFeeSwapPeriod):]) if err1 != nil { return 0, err1 } @@ -180,7 +180,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(n1)) i-- dAtA[i] = 0x2a - n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.FeeRateUpdatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.FeeRateUpdatePeriod):]) + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.OsmosisExchangeRateUpdatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.OsmosisExchangeRateUpdatePeriod):]) if err2 != nil { return 0, err2 } @@ -241,9 +241,9 @@ func (m *Params) Size() (n int) { if l > 0 { n += 1 + l + sovParams(uint64(l)) } - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.FeeRateUpdatePeriod) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.OsmosisExchangeRateUpdatePeriod) n += 1 + l + sovParams(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.AccumulatedFeeSwapPeriod) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.AccumulatedOsmosisFeeSwapPeriod) n += 1 + l + sovParams(uint64(l)) return n } @@ -381,7 +381,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeRateUpdatePeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisExchangeRateUpdatePeriod", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -408,13 +408,13 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.FeeRateUpdatePeriod, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.OsmosisExchangeRateUpdatePeriod, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccumulatedFeeSwapPeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AccumulatedOsmosisFeeSwapPeriod", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -441,7 +441,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.AccumulatedFeeSwapPeriod, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.AccumulatedOsmosisFeeSwapPeriod, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex