From 959988e9a8408fa1148645e9aa5531f43ac4e947 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 16 Jan 2024 11:35:20 -0700 Subject: [PATCH] add genesis navs --- docs/proto-docs.md | 18 ++ proto/provenance/metadata/v1/genesis.proto | 15 + x/metadata/keeper/genesis.go | 28 +- x/metadata/types/genesis.go | 9 +- x/metadata/types/genesis.pb.go | 344 +++++++++++++++++++-- 5 files changed, 380 insertions(+), 34 deletions(-) diff --git a/docs/proto-docs.md b/docs/proto-docs.md index 61b323b5ce..5d841c7fff 100644 --- a/docs/proto-docs.md +++ b/docs/proto-docs.md @@ -395,6 +395,7 @@ - [provenance/metadata/v1/genesis.proto](#provenance/metadata/v1/genesis.proto) - [GenesisState](#provenance.metadata.v1.GenesisState) + - [MarkerNetAssetValues](#provenance.metadata.v1.MarkerNetAssetValues) - [provenance/metadata/v1/p8e/p8e.proto](#provenance/metadata/v1/p8e/p8e.proto) - [Condition](#provenance.metadata.v1.p8e.Condition) @@ -6140,6 +6141,23 @@ GenesisState defines the account module's genesis state. | `record_specifications` | [RecordSpecification](#provenance.metadata.v1.RecordSpecification) | repeated | | | `o_s_locator_params` | [OSLocatorParams](#provenance.metadata.v1.OSLocatorParams) | | | | `object_store_locators` | [ObjectStoreLocator](#provenance.metadata.v1.ObjectStoreLocator) | repeated | | +| `net_asset_values` | [MarkerNetAssetValues](#provenance.metadata.v1.MarkerNetAssetValues) | repeated | Net asset values assigned to scopes | + + + + + + + + +### MarkerNetAssetValues +MarkerNetAssetValues defines the net asset values for a scope + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | address defines the scope address | +| `net_asset_values` | [NetAssetValue](#provenance.metadata.v1.NetAssetValue) | repeated | net_asset_values that are assigned to scope | diff --git a/proto/provenance/metadata/v1/genesis.proto b/proto/provenance/metadata/v1/genesis.proto index e037c3b9c4..3f6a280faa 100644 --- a/proto/provenance/metadata/v1/genesis.proto +++ b/proto/provenance/metadata/v1/genesis.proto @@ -31,4 +31,19 @@ message GenesisState { OSLocatorParams o_s_locator_params = 8 [(gogoproto.nullable) = false]; repeated ObjectStoreLocator object_store_locators = 9 [(gogoproto.nullable) = false]; + + // Net asset values assigned to scopes + repeated MarkerNetAssetValues net_asset_values = 10 [(gogoproto.nullable) = false]; +} + +// MarkerNetAssetValues defines the net asset values for a scope +message MarkerNetAssetValues { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address defines the scope address + string address = 1; + + // net_asset_values that are assigned to scope + repeated NetAssetValue net_asset_values = 2 [(gogoproto.nullable) = false]; } diff --git a/x/metadata/keeper/genesis.go b/x/metadata/keeper/genesis.go index e5986374eb..b30a2d659f 100644 --- a/x/metadata/keeper/genesis.go +++ b/x/metadata/keeper/genesis.go @@ -61,6 +61,16 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { } } } + + for _, mNavs := range data.NetAssetValues { + for _, nav := range mNavs.NetAssetValues { + address, err := types.MetadataAddressFromBech32(mNavs.Address) + if err != nil { + panic(err) + } + k.SetNetAssetValue(ctx, address, types.NewNetAssetValue(nav.Price, nav.Volume), types.ModuleName) + } + } } // ExportGenesis exports the current keeper state of the metadata module.ExportGenesis @@ -134,5 +144,21 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState) { panic(err) } - return types.NewGenesisState(params, oslocatorparams, scopes, sessions, records, scopeSpecs, contractSpecs, recordSpecs, objectStoreLocators) + markerNetAssetValues := make([]types.MarkerNetAssetValues, len(scopes)) + for i := range scopes { + var markerNavs types.MarkerNetAssetValues + var navs []types.NetAssetValue + err := k.IterateNetAssetValues(ctx, scopes[i].ScopeId, func(nav types.NetAssetValue) (stop bool) { + navs = append(navs, nav) + return false + }) + if err != nil { + panic(err) + } + markerNavs.Address = scopes[i].ScopeId.String() + markerNavs.NetAssetValues = navs + markerNetAssetValues[i] = markerNavs + } + + return types.NewGenesisState(params, oslocatorparams, scopes, sessions, records, scopeSpecs, contractSpecs, recordSpecs, objectStoreLocators, markerNetAssetValues) } diff --git a/x/metadata/types/genesis.go b/x/metadata/types/genesis.go index b432ec8e2a..c9db6a9986 100644 --- a/x/metadata/types/genesis.go +++ b/x/metadata/types/genesis.go @@ -16,6 +16,8 @@ func NewGenesisState( contracSpecs []ContractSpecification, recordSpecs []RecordSpecification, objectStoreLocators []ObjectStoreLocator, + netAssetValues []MarkerNetAssetValues, + ) *GenesisState { return &GenesisState{ Params: params, @@ -27,11 +29,14 @@ func NewGenesisState( ContractSpecifications: contracSpecs, RecordSpecifications: recordSpecs, ObjectStoreLocators: objectStoreLocators, + NetAssetValues: netAssetValues, } } // DefaultGenesisState returns a zero-value genesis state. func DefaultGenesisState() *GenesisState { - return &GenesisState{Params: DefaultParams(), - OSLocatorParams: DefaultOSLocatorParams()} + return &GenesisState{ + Params: DefaultParams(), + OSLocatorParams: DefaultOSLocatorParams(), + } } diff --git a/x/metadata/types/genesis.pb.go b/x/metadata/types/genesis.pb.go index c8d31427b1..53b1ee25b9 100644 --- a/x/metadata/types/genesis.pb.go +++ b/x/metadata/types/genesis.pb.go @@ -36,6 +36,8 @@ type GenesisState struct { RecordSpecifications []RecordSpecification `protobuf:"bytes,7,rep,name=record_specifications,json=recordSpecifications,proto3" json:"record_specifications"` OSLocatorParams OSLocatorParams `protobuf:"bytes,8,opt,name=o_s_locator_params,json=oSLocatorParams,proto3" json:"o_s_locator_params"` ObjectStoreLocators []ObjectStoreLocator `protobuf:"bytes,9,rep,name=object_store_locators,json=objectStoreLocators,proto3" json:"object_store_locators"` + // Net asset values assigned to scopes + NetAssetValues []MarkerNetAssetValues `protobuf:"bytes,10,rep,name=net_asset_values,json=netAssetValues,proto3" json:"net_asset_values"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -71,8 +73,50 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo +// MarkerNetAssetValues defines the net asset values for a scope +type MarkerNetAssetValues struct { + // address defines the scope address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // net_asset_values that are assigned to scope + NetAssetValues []NetAssetValue `protobuf:"bytes,2,rep,name=net_asset_values,json=netAssetValues,proto3" json:"net_asset_values"` +} + +func (m *MarkerNetAssetValues) Reset() { *m = MarkerNetAssetValues{} } +func (m *MarkerNetAssetValues) String() string { return proto.CompactTextString(m) } +func (*MarkerNetAssetValues) ProtoMessage() {} +func (*MarkerNetAssetValues) Descriptor() ([]byte, []int) { + return fileDescriptor_a835c20198efc302, []int{1} +} +func (m *MarkerNetAssetValues) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MarkerNetAssetValues) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MarkerNetAssetValues.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 *MarkerNetAssetValues) XXX_Merge(src proto.Message) { + xxx_messageInfo_MarkerNetAssetValues.Merge(m, src) +} +func (m *MarkerNetAssetValues) XXX_Size() int { + return m.Size() +} +func (m *MarkerNetAssetValues) XXX_DiscardUnknown() { + xxx_messageInfo_MarkerNetAssetValues.DiscardUnknown(m) +} + +var xxx_messageInfo_MarkerNetAssetValues proto.InternalMessageInfo + func init() { proto.RegisterType((*GenesisState)(nil), "provenance.metadata.v1.GenesisState") + proto.RegisterType((*MarkerNetAssetValues)(nil), "provenance.metadata.v1.MarkerNetAssetValues") } func init() { @@ -80,37 +124,42 @@ func init() { } var fileDescriptor_a835c20198efc302 = []byte{ - // 473 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xcf, 0x6e, 0x13, 0x31, - 0x10, 0xc6, 0x77, 0x69, 0xd9, 0x06, 0x17, 0x09, 0xc9, 0xa4, 0x65, 0xa9, 0xc4,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15, 0xfc, 0xbf, 0x68, 0x05, - 0x87, 0x5f, 0x2f, 0x87, 0x49, 0x78, 0x35, 0x4c, 0xc2, 0x7f, 0xc3, 0x24, 0xfc, 0x35, 0x4a, 0x82, - 0xab, 0x51, 0x12, 0xfc, 0x19, 0x25, 0x01, 0x79, 0x2c, 0xc1, 0x13, 0x76, 0x1c, 0x9e, 0xbe, 0xea, - 0x49, 0xfd, 0xf9, 0x5b, 0x27, 0xe5, 0xd0, 0xcf, 0x26, 0xd0, 0x9e, 0x84, 0x5b, 0xff, 0xb2, 0xef, - 0x93, 0x17, 0xa9, 0x7f, 0x54, 0x02, 0x3b, 0x91, 0x79, 0x89, 0x2f, 0xaf, 0x03, 0x00, 0x00, 0xff, - 0xff, 0x3a, 0xcc, 0x7d, 0x59, 0x80, 0x04, 0x00, 0x00, + // 549 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0x6d, 0x5a, 0x92, 0x74, 0x8b, 0x00, 0x2d, 0x69, 0x31, 0x95, 0x70, 0xaa, 0x88, 0x8a, + 0xa8, 0x50, 0x5b, 0x2d, 0x9c, 0x00, 0x21, 0xb5, 0x1c, 0xb8, 0x00, 0xad, 0x12, 0xc1, 0xa1, 0x42, + 0xb2, 0x36, 0x9b, 0x6d, 0x30, 0x4d, 0x3c, 0xd6, 0xce, 0x36, 0x82, 0x37, 0xe0, 0x08, 0x6f, 0xd0, + 0xc7, 0xe9, 0xb1, 0x47, 0x4e, 0x08, 0x25, 0x17, 0xae, 0xbc, 0x01, 0xca, 0x7a, 0xdd, 0x34, 0x8d, + 0x37, 0xdc, 0x6c, 0xcf, 0xff, 0xfd, 0xff, 0x8c, 0x3d, 0x5e, 0xf2, 0x20, 0x95, 0x30, 0x10, 0x09, + 0x4b, 0xb8, 0x08, 0xfb, 0x42, 0xb1, 0x0e, 0x53, 0x2c, 0x1c, 0x6c, 0x87, 0x5d, 0x91, 0x08, 0x8c, + 0x31, 0x48, 0x25, 0x28, 0xa0, 0xab, 0x13, 0x55, 0x90, 0xab, 0x82, 0xc1, 0xf6, 0x5a, 0xb5, 0x0b, + 0x5d, 0xd0, 0x92, 0x70, 0x7c, 0x95, 0xa9, 0xd7, 0x36, 0x2c, 0x9e, 0x17, 0x64, 0x26, 0xab, 0x5b, + 0x64, 0xc8, 0x21, 0x15, 0x46, 0xb3, 0x69, 0xd3, 0xa4, 0x82, 0xc7, 0x47, 0x31, 0x67, 0x2a, 0x86, + 0xc4, 0x68, 0x1b, 0x16, 0x2d, 0xb4, 0x3f, 0x0b, 0xae, 0x50, 0x81, 0x34, 0xae, 0xf5, 0xbf, 0x25, + 0x72, 0xe3, 0x75, 0x36, 0x60, 0x4b, 0x31, 0x25, 0xe8, 0x0b, 0x52, 0x4a, 0x99, 0x64, 0x7d, 0xf4, + 0xdc, 0x75, 0xb7, 0xb1, 0xbc, 0xe3, 0x07, 0xc5, 0x03, 0x07, 0x07, 0x5a, 0xb5, 0xb7, 0x78, 0xf6, + 0xab, 0xe6, 0x34, 0x0d, 0x43, 0x9f, 0x93, 0x92, 0xee, 0x19, 0xbd, 0x6b, 0xeb, 0x0b, 0x8d, 0xe5, + 0x9d, 0xfb, 0x36, 0xba, 0x35, 0x56, 0xe5, 0x70, 0x86, 0xd0, 0x5d, 0x52, 0x41, 0x81, 0x18, 0x43, + 0x82, 0xde, 0x82, 0xc6, 0x6b, 0x56, 0x3c, 0xd3, 0x19, 0x83, 0x0b, 0x8c, 0xbe, 0x24, 0x65, 0x29, + 0x38, 0xc8, 0x0e, 0x7a, 0x8b, 0xda, 0xc1, 0xda, 0x7e, 0x53, 0xcb, 0x8c, 0x41, 0x0e, 0x51, 0x4e, + 0xaa, 0xba, 0x99, 0x68, 0xea, 0xad, 0xa2, 0x77, 0x5d, 0x9b, 0x6d, 0xce, 0x9d, 0xa6, 0x75, 0x19, + 0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0xe5, 0xfd, 0xbf, 0x9e, 0xf6, 0x8e, 0xcf, 0x86, 0xbe, + 0x7b, 0x3e, 0xf4, 0xdd, 0xdf, 0x43, 0xdf, 0xfd, 0x3e, 0xf2, 0x9d, 0xf3, 0x91, 0xef, 0xfc, 0x1c, + 0xf9, 0x0e, 0xb9, 0x17, 0x83, 0x25, 0xe2, 0xc0, 0x3d, 0x7c, 0xda, 0x8d, 0xd5, 0xa7, 0x93, 0x76, + 0xc0, 0xa1, 0x1f, 0x4e, 0x44, 0x5b, 0x31, 0x5c, 0xba, 0x0b, 0xbf, 0x4c, 0xce, 0x20, 0xf5, 0x35, + 0x15, 0xd8, 0x2e, 0xe9, 0xb3, 0xe7, 0xc9, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x60, 0x12, + 0x92, 0x72, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -133,6 +182,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NetAssetValues) > 0 { + for iNdEx := len(m.NetAssetValues) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NetAssetValues[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + } if len(m.ObjectStoreLocators) > 0 { for iNdEx := len(m.ObjectStoreLocators) - 1; iNdEx >= 0; iNdEx-- { { @@ -254,6 +317,50 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MarkerNetAssetValues) 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 *MarkerNetAssetValues) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MarkerNetAssetValues) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NetAssetValues) > 0 { + for iNdEx := len(m.NetAssetValues) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NetAssetValues[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -317,6 +424,31 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.NetAssetValues) > 0 { + for _, e := range m.NetAssetValues { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *MarkerNetAssetValues) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.NetAssetValues) > 0 { + for _, e := range m.NetAssetValues { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -659,6 +791,156 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetAssetValues", 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 + } + m.NetAssetValues = append(m.NetAssetValues, MarkerNetAssetValues{}) + if err := m.NetAssetValues[len(m.NetAssetValues)-1].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 (m *MarkerNetAssetValues) 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: MarkerNetAssetValues: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MarkerNetAssetValues: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetAssetValues", 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 + } + m.NetAssetValues = append(m.NetAssetValues, NetAssetValue{}) + if err := m.NetAssetValues[len(m.NetAssetValues)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:])