From b806c1c231ee2c4a3f1fefe8bcf36b638d380e41 Mon Sep 17 00:00:00 2001 From: KIMURA Yu <33382781+KimuraYu45z@users.noreply.github.com> Date: Tue, 15 Aug 2023 17:55:03 +0800 Subject: [PATCH 01/12] feat: backward-proposal --- proto/ununifi/yieldaggregator/yieldaggregator.proto | 10 ++++++++++ x/yieldaggregator/types/codec.go | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/proto/ununifi/yieldaggregator/yieldaggregator.proto b/proto/ununifi/yieldaggregator/yieldaggregator.proto index ce9a6fc77..8067526be 100644 --- a/proto/ununifi/yieldaggregator/yieldaggregator.proto +++ b/proto/ununifi/yieldaggregator/yieldaggregator.proto @@ -43,3 +43,13 @@ message Strategy { string name = 4; string git_url = 5; } + +// Deprecated: Just for backward compatibility of query proposals +message ProposalAddStrategy { + string title = 1; + string description = 2; + string denom = 3; + string contract_address = 4; + string name = 5; + string git_url = 6; +} diff --git a/x/yieldaggregator/types/codec.go b/x/yieldaggregator/types/codec.go index b732abfb4..92751d28e 100644 --- a/x/yieldaggregator/types/codec.go +++ b/x/yieldaggregator/types/codec.go @@ -5,6 +5,8 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" + + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func RegisterCodec(cdc *codec.LegacyAmino) { @@ -23,6 +25,12 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgDeleteVault{}, ) + // Deprecated: Just for backward compatibility of query proposals + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &ProposalAddStrategy{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } From b082fbf769b7d15768f86fdf825d3f383e1cc45e Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:10:52 +0900 Subject: [PATCH 02/12] proto-gen --- x/yieldaggregator/types/yieldaggregator.pb.go | 499 ++++++++++++++++-- 1 file changed, 464 insertions(+), 35 deletions(-) diff --git a/x/yieldaggregator/types/yieldaggregator.pb.go b/x/yieldaggregator/types/yieldaggregator.pb.go index 120f5b306..286c217e9 100644 --- a/x/yieldaggregator/types/yieldaggregator.pb.go +++ b/x/yieldaggregator/types/yieldaggregator.pb.go @@ -225,10 +225,96 @@ func (m *Strategy) GetGitUrl() string { return "" } +// Deprecated: Just for backward compatibility of query proposals +type ProposalAddStrategy struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` + ContractAddress string `protobuf:"bytes,4,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + GitUrl string `protobuf:"bytes,6,opt,name=git_url,json=gitUrl,proto3" json:"git_url,omitempty"` +} + +func (m *ProposalAddStrategy) Reset() { *m = ProposalAddStrategy{} } +func (m *ProposalAddStrategy) String() string { return proto.CompactTextString(m) } +func (*ProposalAddStrategy) ProtoMessage() {} +func (*ProposalAddStrategy) Descriptor() ([]byte, []int) { + return fileDescriptor_7877bd9c4573997d, []int{3} +} +func (m *ProposalAddStrategy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProposalAddStrategy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProposalAddStrategy.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 *ProposalAddStrategy) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProposalAddStrategy.Merge(m, src) +} +func (m *ProposalAddStrategy) XXX_Size() int { + return m.Size() +} +func (m *ProposalAddStrategy) XXX_DiscardUnknown() { + xxx_messageInfo_ProposalAddStrategy.DiscardUnknown(m) +} + +var xxx_messageInfo_ProposalAddStrategy proto.InternalMessageInfo + +func (m *ProposalAddStrategy) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *ProposalAddStrategy) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *ProposalAddStrategy) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *ProposalAddStrategy) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *ProposalAddStrategy) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ProposalAddStrategy) GetGitUrl() string { + if m != nil { + return m.GitUrl + } + return "" +} + func init() { proto.RegisterType((*StrategyWeight)(nil), "ununifi.yieldaggregator.StrategyWeight") proto.RegisterType((*Vault)(nil), "ununifi.yieldaggregator.Vault") proto.RegisterType((*Strategy)(nil), "ununifi.yieldaggregator.Strategy") + proto.RegisterType((*ProposalAddStrategy)(nil), "ununifi.yieldaggregator.ProposalAddStrategy") } func init() { @@ -236,41 +322,44 @@ func init() { } var fileDescriptor_7877bd9c4573997d = []byte{ - // 535 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xcd, 0x6e, 0x13, 0x3d, - 0x14, 0x86, 0x33, 0xf9, 0xeb, 0x57, 0xe7, 0xa3, 0xad, 0x4c, 0xa0, 0xd3, 0x22, 0x4d, 0xa2, 0x6c, - 0x08, 0x8b, 0x78, 0x48, 0xb9, 0x02, 0xd2, 0x08, 0xa9, 0x88, 0xd5, 0x54, 0x01, 0xc4, 0x66, 0xe4, - 0xcc, 0x18, 0xe7, 0xa8, 0x19, 0x3b, 0xb2, 0x9d, 0x86, 0x48, 0x5c, 0x00, 0x4b, 0x2e, 0xa6, 0x17, - 0xd1, 0x65, 0xe9, 0x0a, 0xb1, 0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xed, 0xae, 0xf3, 0x0e, 0x2f, 0xc6, 0xa8, 0x2c, 0x68, 0xc6, 0x72, 0x90, 0xdb, 0x51, - 0x7e, 0xc6, 0xfb, 0x68, 0x8b, 0x83, 0x89, 0xa7, 0x6a, 0x6c, 0x71, 0x44, 0x55, 0x0e, 0x66, 0xa0, - 0xc6, 0xbd, 0xd7, 0x97, 0x8b, 0xc0, 0xbb, 0x5a, 0x04, 0xde, 0xcf, 0x45, 0xe0, 0x7d, 0x5d, 0x06, - 0x85, 0xab, 0x65, 0x50, 0xf8, 0xbe, 0x0c, 0x0a, 0x1f, 0x9e, 0x73, 0x30, 0xa3, 0xe9, 0x90, 0x24, - 0x32, 0x0b, 0x07, 0x62, 0x20, 0xe0, 0x15, 0x84, 0xc9, 0x88, 0x82, 0x08, 0x3f, 0xfd, 0xf5, 0x44, - 0xcd, 0x7c, 0xc2, 0xf4, 0xb0, 0x9a, 0xbf, 0x97, 0x17, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x09, - 0xf3, 0x35, 0x62, 0xca, 0x03, 0x00, 0x00, + // 592 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x4f, 0x13, 0x41, + 0x18, 0xee, 0xf6, 0x0b, 0x99, 0x2a, 0x90, 0x01, 0x65, 0xc1, 0x64, 0x69, 0x7a, 0xb1, 0x1e, 0xd8, + 0x15, 0xfc, 0x05, 0x40, 0x63, 0x82, 0xf1, 0x60, 0x96, 0xa0, 0xc6, 0xcb, 0x66, 0xba, 0x33, 0x4e, + 0xdf, 0xb0, 0x3b, 0xd3, 0xcc, 0x4c, 0xa9, 0x4d, 0xfc, 0x01, 0x1e, 0xfd, 0x31, 0xdc, 0xfc, 0x03, + 0x1c, 0x91, 0x93, 0xf1, 0x40, 0x4c, 0xfb, 0x47, 0x4c, 0x77, 0x76, 0x4b, 0x41, 0xf4, 0xc0, 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, 0xa4, 0x2c, + 0x33, 0x72, 0x31, 0xcc, 0xce, 0x78, 0x1d, 0x2d, 0x70, 0x30, 0xd1, 0x40, 0x25, 0xd6, 0x8e, 0xb0, + 0xce, 0xc1, 0x1c, 0xab, 0xa4, 0xf5, 0xdd, 0x41, 0xab, 0x6f, 0x95, 0xec, 0x4b, 0x4d, 0x92, 0x3d, + 0x4a, 0xe7, 0x55, 0x19, 0x30, 0x09, 0x2b, 0x54, 0x65, 0x01, 0x6e, 0xa2, 0x06, 0x65, 0x3a, 0x56, + 0xd0, 0x37, 0x20, 0x45, 0xbe, 0x78, 0xf3, 0xa9, 0xeb, 0xd7, 0x54, 0xe6, 0x5f, 0x73, 0x97, 0xfa, + 0xea, 0xff, 0xd5, 0xd7, 0xee, 0x56, 0x5f, 0x9f, 0x57, 0xbf, 0xff, 0xfa, 0x7c, 0xec, 0x39, 0x17, + 0x63, 0xcf, 0xf9, 0x3d, 0xf6, 0x9c, 0x6f, 0x13, 0xaf, 0x74, 0x31, 0xf1, 0x4a, 0x3f, 0x27, 0x5e, + 0xe9, 0xe3, 0x0b, 0x0e, 0xa6, 0x37, 0xe8, 0xfa, 0xb1, 0x4c, 0x83, 0x63, 0x71, 0x2c, 0xe0, 0x15, + 0x04, 0x71, 0x8f, 0x80, 0x08, 0x3e, 0xff, 0xf5, 0x83, 0x31, 0xa3, 0x3e, 0xd3, 0xdd, 0x7a, 0xf6, + 0xb5, 0xbf, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0xd1, 0xbf, 0xe2, 0xfe, 0x88, 0x04, 0x00, 0x00, } func (m *StrategyWeight) Marshal() (dAtA []byte, err error) { @@ -453,6 +542,71 @@ func (m *Strategy) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ProposalAddStrategy) 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 *ProposalAddStrategy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProposalAddStrategy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GitUrl) > 0 { + i -= len(m.GitUrl) + copy(dAtA[i:], m.GitUrl) + i = encodeVarintYieldaggregator(dAtA, i, uint64(len(m.GitUrl))) + i-- + dAtA[i] = 0x32 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintYieldaggregator(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x2a + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintYieldaggregator(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintYieldaggregator(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintYieldaggregator(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintYieldaggregator(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintYieldaggregator(dAtA []byte, offset int, v uint64) int { offset -= sovYieldaggregator(v) base := offset @@ -538,6 +692,39 @@ func (m *Strategy) Size() (n int) { return n } +func (m *ProposalAddStrategy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovYieldaggregator(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovYieldaggregator(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovYieldaggregator(uint64(l)) + } + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovYieldaggregator(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovYieldaggregator(uint64(l)) + } + l = len(m.GitUrl) + if l > 0 { + n += 1 + l + sovYieldaggregator(uint64(l)) + } + return n +} + func sovYieldaggregator(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1112,6 +1299,248 @@ func (m *Strategy) Unmarshal(dAtA []byte) error { } return nil } +func (m *ProposalAddStrategy) 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 ErrIntOverflowYieldaggregator + } + 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: ProposalAddStrategy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProposalAddStrategy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYieldaggregator + } + 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 ErrInvalidLengthYieldaggregator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYieldaggregator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYieldaggregator + } + 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 ErrInvalidLengthYieldaggregator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYieldaggregator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYieldaggregator + } + 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 ErrInvalidLengthYieldaggregator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYieldaggregator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYieldaggregator + } + 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 ErrInvalidLengthYieldaggregator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYieldaggregator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYieldaggregator + } + 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 ErrInvalidLengthYieldaggregator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYieldaggregator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GitUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYieldaggregator + } + 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 ErrInvalidLengthYieldaggregator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYieldaggregator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GitUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipYieldaggregator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthYieldaggregator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipYieldaggregator(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 01f437417decc570da8cf2fce9f7bb45b1166c7b Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:34:27 +0900 Subject: [PATCH 03/12] fix: proposal --- x/yieldaggregator/types/proposal.go | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 x/yieldaggregator/types/proposal.go diff --git a/x/yieldaggregator/types/proposal.go b/x/yieldaggregator/types/proposal.go new file mode 100644 index 000000000..3cc29c2ed --- /dev/null +++ b/x/yieldaggregator/types/proposal.go @@ -0,0 +1,45 @@ +// Deprecated: Just for backward compatibility +package types + +import ( + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +const ( + // ProposalTypeAddStrategy defines the type for a ProposalAddStrategy + ProposalTypeAddStrategy = "AddStrategy" +) + +func init() { + govtypes.RegisterProposalType(ProposalTypeAddStrategy) +} + +// Assert ProposalAddStrategy implements govtypes.Content at compile-time +var _ govtypes.Content = &ProposalAddStrategy{} + +func NewProposalAddStrategy(title, description string, denom, contractAddr, name, gitUrl string) *ProposalAddStrategy { + return &ProposalAddStrategy{ + Title: title, + Description: description, + Denom: denom, + ContractAddress: contractAddr, + Name: name, + GitUrl: gitUrl, + } +} + +// ProposalRoute returns the routing key of a parameter change proposal. +func (p *ProposalAddStrategy) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of a parameter change proposal. +func (p *ProposalAddStrategy) ProposalType() string { return ProposalTypeAddStrategy } + +// ValidateBasic validates the parameter change proposal +func (p *ProposalAddStrategy) ValidateBasic() error { + err := govtypes.ValidateAbstract(p) + if err != nil { + return err + } + + return nil +} From 10d185824db75972d8b19ba9a1d5afc6089fa509 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:35:43 +0900 Subject: [PATCH 04/12] feat: v3.2.1 --- app/upgrades/v3.2.1/constants.go | 22 +++++++++++++++ app/upgrades/v3.2.1/upgrades.go | 46 ++++++++++++++++++++++++++++++++ app/upgrades/v3.2/upgrades.go | 5 +--- 3 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 app/upgrades/v3.2.1/constants.go create mode 100644 app/upgrades/v3.2.1/upgrades.go diff --git a/app/upgrades/v3.2.1/constants.go b/app/upgrades/v3.2.1/constants.go new file mode 100644 index 000000000..5a64239e4 --- /dev/null +++ b/app/upgrades/v3.2.1/constants.go @@ -0,0 +1,22 @@ +package v3_2_1 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types" + buildertypes "github.com/skip-mev/pob/x/builder/types" + + "github.com/UnUniFi/chain/app/upgrades" + nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types" +) + +const UpgradeName string = "v3_2_1" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{nftfactorytypes.StoreKey, buildertypes.StoreKey, ibchookstypes.StoreKey}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v3.2.1/upgrades.go b/app/upgrades/v3.2.1/upgrades.go new file mode 100644 index 000000000..1fdd2a24b --- /dev/null +++ b/app/upgrades/v3.2.1/upgrades.go @@ -0,0 +1,46 @@ +package v3_2_1 + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/UnUniFi/chain/app/keepers" + "github.com/UnUniFi/chain/app/upgrades" + yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" +) + +func CreateUpgradeHandler(mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) + + iyaParams := yieldaggregatortypes.Params{} + paramtypes.NewKeyTable().RegisterParamSet(&yieldaggregatortypes.Params{}) + keepers.GetSubspace(yieldaggregatortypes.ModuleName).WithKeyTable(yieldaggregatortypes.ParamKeyTable()).GetParamSet(ctx, &iyaParams) + + vm, err := mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return vm, err + } + + factoryParam, err := keepers.NftfactoryKeeper.GetParams(ctx) + if err != nil { + return vm, err + } + factoryParam.ClassCreationFee = []sdk.Coin{} + factoryParam.FeeCollectorAddress = "" + _ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam) + + iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, yieldaggregatortypes.ModuleName).String() + _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) + + return vm, nil + } +} diff --git a/app/upgrades/v3.2/upgrades.go b/app/upgrades/v3.2/upgrades.go index 357e5e389..1dbbf04b8 100644 --- a/app/upgrades/v3.2/upgrades.go +++ b/app/upgrades/v3.2/upgrades.go @@ -38,10 +38,7 @@ func CreateUpgradeHandler(mm *module.Manager, factoryParam.FeeCollectorAddress = "" _ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam) - // iyaParam, err := keepers.YieldaggregatorKeeper.GetParams(ctx) - // if err != nil { - // return vm, err - // } + iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, yieldaggregatortypes.ModuleName).String() _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) return vm, nil From 3879023429f9fe685a0e43f806780f6523831d7d Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:37:43 +0900 Subject: [PATCH 05/12] v3.2 revert --- app/upgrades/v3.2/upgrades.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/upgrades/v3.2/upgrades.go b/app/upgrades/v3.2/upgrades.go index 1dbbf04b8..b4914fc15 100644 --- a/app/upgrades/v3.2/upgrades.go +++ b/app/upgrades/v3.2/upgrades.go @@ -38,7 +38,10 @@ func CreateUpgradeHandler(mm *module.Manager, factoryParam.FeeCollectorAddress = "" _ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam) - iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, yieldaggregatortypes.ModuleName).String() + // iyaParam, err := keepers.YieldaggregatorKeeper.GetParams(ctx) + // if err != nil { + // return vm, err + // } _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) return vm, nil From e291e905b9e8ef5d0b9e083f7f9f028754d94ad4 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:38:06 +0900 Subject: [PATCH 06/12] chore --- app/upgrades/v3.2/upgrades.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/upgrades/v3.2/upgrades.go b/app/upgrades/v3.2/upgrades.go index b4914fc15..357e5e389 100644 --- a/app/upgrades/v3.2/upgrades.go +++ b/app/upgrades/v3.2/upgrades.go @@ -41,7 +41,7 @@ func CreateUpgradeHandler(mm *module.Manager, // iyaParam, err := keepers.YieldaggregatorKeeper.GetParams(ctx) // if err != nil { // return vm, err - // } _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) + // } _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) return vm, nil From 0927ba5d7eb6f21d11d7e84984cffe573a00b1e5 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:45:08 +0900 Subject: [PATCH 07/12] fix: collector addr --- app/upgrades/v3.2.1/upgrades.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/upgrades/v3.2.1/upgrades.go b/app/upgrades/v3.2.1/upgrades.go index 1fdd2a24b..c6d1d1d75 100644 --- a/app/upgrades/v3.2.1/upgrades.go +++ b/app/upgrades/v3.2.1/upgrades.go @@ -9,6 +9,8 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/UnUniFi/chain/app/keepers" "github.com/UnUniFi/chain/app/upgrades" yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" @@ -38,7 +40,7 @@ func CreateUpgradeHandler(mm *module.Manager, factoryParam.FeeCollectorAddress = "" _ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam) - iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, yieldaggregatortypes.ModuleName).String() + iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName).String() _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) return vm, nil From 3cb2773831c58e6605a944922e391def288f0490 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:48:03 +0900 Subject: [PATCH 08/12] chore: comment position --- x/yieldaggregator/types/proposal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/yieldaggregator/types/proposal.go b/x/yieldaggregator/types/proposal.go index 3cc29c2ed..cde499ba2 100644 --- a/x/yieldaggregator/types/proposal.go +++ b/x/yieldaggregator/types/proposal.go @@ -1,4 +1,3 @@ -// Deprecated: Just for backward compatibility package types import ( @@ -17,6 +16,7 @@ func init() { // Assert ProposalAddStrategy implements govtypes.Content at compile-time var _ govtypes.Content = &ProposalAddStrategy{} +// Deprecated: Just for backward compatibility func NewProposalAddStrategy(title, description string, denom, contractAddr, name, gitUrl string) *ProposalAddStrategy { return &ProposalAddStrategy{ Title: title, From a10a39adf0a8e38fba983fd1f9bc5820f28b0aa5 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:52:23 +0900 Subject: [PATCH 09/12] feat: app --- app/app.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 29f1308c5..09b234e16 100644 --- a/app/app.go +++ b/app/app.go @@ -62,6 +62,7 @@ import ( v3 "github.com/UnUniFi/chain/app/upgrades/v3" v3_1 "github.com/UnUniFi/chain/app/upgrades/v3.1" v3_2 "github.com/UnUniFi/chain/app/upgrades/v3.2" + v3_2_1 "github.com/UnUniFi/chain/app/upgrades/v3.2.1" ) const Name = "ununifi" @@ -104,7 +105,7 @@ var ( stakeibctypes.ModuleName: true, } - Upgrades = []upgrades.Upgrade{v3.Upgrade, v3_1.Upgrade, v3_2.Upgrade} + Upgrades = []upgrades.Upgrade{v3.Upgrade, v3_1.Upgrade, v3_2.Upgrade, v3_2_1.Upgrade} ) var ( From 97c9c979c523ef99f704361768fb675ee5032243 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 20:04:13 +0900 Subject: [PATCH 10/12] fix: address --- app/upgrades/v3.2.1/upgrades.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/upgrades/v3.2.1/upgrades.go b/app/upgrades/v3.2.1/upgrades.go index c6d1d1d75..baef614d9 100644 --- a/app/upgrades/v3.2.1/upgrades.go +++ b/app/upgrades/v3.2.1/upgrades.go @@ -40,7 +40,7 @@ func CreateUpgradeHandler(mm *module.Manager, factoryParam.FeeCollectorAddress = "" _ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam) - iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName).String() + iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName).GetAddress().String() _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) return vm, nil From 08dc616e53ecb5b365e7e5e0db208e612b11c436 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 20:26:57 +0900 Subject: [PATCH 11/12] for testnet upgrade --- app/upgrades/v3.2.1/constants.go | 6 +----- app/upgrades/v3.2.1/upgrades.go | 15 ++------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/app/upgrades/v3.2.1/constants.go b/app/upgrades/v3.2.1/constants.go index 5a64239e4..546b60d27 100644 --- a/app/upgrades/v3.2.1/constants.go +++ b/app/upgrades/v3.2.1/constants.go @@ -3,11 +3,7 @@ package v3_2_1 import ( store "github.com/cosmos/cosmos-sdk/store/types" - ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types" - buildertypes "github.com/skip-mev/pob/x/builder/types" - "github.com/UnUniFi/chain/app/upgrades" - nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types" ) const UpgradeName string = "v3_2_1" @@ -16,7 +12,7 @@ var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, CreateUpgradeHandler: CreateUpgradeHandler, StoreUpgrades: store.StoreUpgrades{ - Added: []string{nftfactorytypes.StoreKey, buildertypes.StoreKey, ibchookstypes.StoreKey}, + Added: []string{}, Deleted: []string{}, }, } diff --git a/app/upgrades/v3.2.1/upgrades.go b/app/upgrades/v3.2.1/upgrades.go index baef614d9..721e79657 100644 --- a/app/upgrades/v3.2.1/upgrades.go +++ b/app/upgrades/v3.2.1/upgrades.go @@ -7,13 +7,10 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/UnUniFi/chain/app/keepers" "github.com/UnUniFi/chain/app/upgrades" - yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" ) func CreateUpgradeHandler(mm *module.Manager, @@ -23,25 +20,17 @@ func CreateUpgradeHandler(mm *module.Manager, return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) - iyaParams := yieldaggregatortypes.Params{} - paramtypes.NewKeyTable().RegisterParamSet(&yieldaggregatortypes.Params{}) - keepers.GetSubspace(yieldaggregatortypes.ModuleName).WithKeyTable(yieldaggregatortypes.ParamKeyTable()).GetParamSet(ctx, &iyaParams) - vm, err := mm.RunMigrations(ctx, configurator, vm) if err != nil { return vm, err } - factoryParam, err := keepers.NftfactoryKeeper.GetParams(ctx) + iyaParams, err := keepers.YieldaggregatorKeeper.GetParams(ctx) if err != nil { return vm, err } - factoryParam.ClassCreationFee = []sdk.Coin{} - factoryParam.FeeCollectorAddress = "" - _ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam) - iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName).GetAddress().String() - _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) + _ = keepers.YieldaggregatorKeeper.SetParams(ctx, iyaParams) return vm, nil } From 75cf2f5e2798f96ce6187f98f99b4506619a7be4 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 15 Aug 2023 20:28:50 +0900 Subject: [PATCH 12/12] Revert "for testnet upgrade" This reverts commit 08dc616e53ecb5b365e7e5e0db208e612b11c436. --- app/upgrades/v3.2.1/constants.go | 6 +++++- app/upgrades/v3.2.1/upgrades.go | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v3.2.1/constants.go b/app/upgrades/v3.2.1/constants.go index 546b60d27..5a64239e4 100644 --- a/app/upgrades/v3.2.1/constants.go +++ b/app/upgrades/v3.2.1/constants.go @@ -3,7 +3,11 @@ package v3_2_1 import ( store "github.com/cosmos/cosmos-sdk/store/types" + ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types" + buildertypes "github.com/skip-mev/pob/x/builder/types" + "github.com/UnUniFi/chain/app/upgrades" + nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types" ) const UpgradeName string = "v3_2_1" @@ -12,7 +16,7 @@ var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, CreateUpgradeHandler: CreateUpgradeHandler, StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, + Added: []string{nftfactorytypes.StoreKey, buildertypes.StoreKey, ibchookstypes.StoreKey}, Deleted: []string{}, }, } diff --git a/app/upgrades/v3.2.1/upgrades.go b/app/upgrades/v3.2.1/upgrades.go index 721e79657..baef614d9 100644 --- a/app/upgrades/v3.2.1/upgrades.go +++ b/app/upgrades/v3.2.1/upgrades.go @@ -7,10 +7,13 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/UnUniFi/chain/app/keepers" "github.com/UnUniFi/chain/app/upgrades" + yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" ) func CreateUpgradeHandler(mm *module.Manager, @@ -20,17 +23,25 @@ func CreateUpgradeHandler(mm *module.Manager, return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) + iyaParams := yieldaggregatortypes.Params{} + paramtypes.NewKeyTable().RegisterParamSet(&yieldaggregatortypes.Params{}) + keepers.GetSubspace(yieldaggregatortypes.ModuleName).WithKeyTable(yieldaggregatortypes.ParamKeyTable()).GetParamSet(ctx, &iyaParams) + vm, err := mm.RunMigrations(ctx, configurator, vm) if err != nil { return vm, err } - iyaParams, err := keepers.YieldaggregatorKeeper.GetParams(ctx) + factoryParam, err := keepers.NftfactoryKeeper.GetParams(ctx) if err != nil { return vm, err } + factoryParam.ClassCreationFee = []sdk.Coin{} + factoryParam.FeeCollectorAddress = "" + _ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam) + iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName).GetAddress().String() - _ = keepers.YieldaggregatorKeeper.SetParams(ctx, iyaParams) + _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) return vm, nil }