Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting a nav attribute on metadata scopes #1791

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
82f7160
add nav protos to metadata module for scopes
nullpointer0x00 Jan 2, 2024
b33ec18
refactor proto, add scope-id to add nav tx
nullpointer0x00 Jan 2, 2024
d63a70c
add validations, add msg interface
nullpointer0x00 Jan 2, 2024
244791c
add nav key
nullpointer0x00 Jan 2, 2024
ccba0a7
add keeper methods, update typed event
nullpointer0x00 Jan 3, 2024
f77ce00
add usd_mils and volume to write scope
nullpointer0x00 Jan 3, 2024
1c2818c
Merge branch 'main' into 1749-support-setting-a-NAV-attribute-on-meta…
nullpointer0x00 Jan 16, 2024
c1eec18
add net asset value keeper call to msg server
nullpointer0x00 Jan 16, 2024
539bdd4
add nav when writing scope
nullpointer0x00 Jan 16, 2024
012eba4
add new parameters to write scope msg, add command line flags for usd…
nullpointer0x00 Jan 16, 2024
959988e
add genesis navs
nullpointer0x00 Jan 16, 2024
0fec3e9
add change log
nullpointer0x00 Jan 17, 2024
439b894
Merge branch 'main' into 1749-support-setting-a-NAV-attribute-on-meta…
nullpointer0x00 Jan 21, 2024
5c2c45c
rename mils to mills, add net asset values command
nullpointer0x00 Jan 21, 2024
42c157c
change some naming, add validate basic tests, cmdline test
nullpointer0x00 Jan 22, 2024
babcba6
fix property name
nullpointer0x00 Jan 22, 2024
b259445
add validation test
nullpointer0x00 Jan 22, 2024
f11c3da
add msg server test, remove check of scope id, move metadata app init…
nullpointer0x00 Jan 23, 2024
c219d33
add scope net asset value query
nullpointer0x00 Jan 23, 2024
9f1b48e
fix test
nullpointer0x00 Jan 23, 2024
8f9e6a0
add better error handling
nullpointer0x00 Jan 23, 2024
3ce60b4
remove unneeded check, add tests for keeper
nullpointer0x00 Jan 23, 2024
4bb85d4
Add ParseNetAssertValueString test
nullpointer0x00 Jan 23, 2024
e022773
add query server tests
nullpointer0x00 Jan 23, 2024
19a4da5
add more tests, refactor method name
nullpointer0x00 Jan 23, 2024
2b4f59e
fix test
nullpointer0x00 Jan 24, 2024
5b7a805
fix marker references for scope, fix a few missed mils to mills
nullpointer0x00 Jan 24, 2024
bae57a5
Merge branch 'main' into 1749-support-setting-a-NAV-attribute-on-meta…
nullpointer0x00 Jan 24, 2024
601f14b
ugh missed test assert
nullpointer0x00 Jan 24, 2024
a0f7cc3
fix proto doc
nullpointer0x00 Jan 24, 2024
0e4cb85
merge main
nullpointer0x00 Jan 24, 2024
4949743
remove volume from scope net asset value, update code and tests, add …
nullpointer0x00 Jan 25, 2024
ecd81aa
merge main
nullpointer0x00 Jan 25, 2024
d2e956a
better error logging
nullpointer0x00 Jan 25, 2024
3b89fc5
error changes, lint fix
nullpointer0x00 Jan 25, 2024
38ce700
change error message again
nullpointer0x00 Jan 26, 2024
ae5647e
Merge branch 'main' into 1749-support-setting-a-NAV-attribute-on-meta…
iramiller Jan 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Features

* Add the ibcratelimit module [#1498](https://github.com/provenance-io/provenance/issues/1498).
* Add NAV support for metadata scopes [#1749](https://github.com/provenance-io/provenance/issues/1749).
* Add fix for NAV units to tourmaline upgrade handler [#1815](https://github.com/provenance-io/provenance/issues/1815).

### Improvements
Expand Down
8 changes: 4 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,6 @@ func New(
appCodec, keys[attributetypes.StoreKey], app.GetSubspace(attributetypes.ModuleName), app.AccountKeeper, &app.NameKeeper,
)

app.MetadataKeeper = metadatakeeper.NewKeeper(
appCodec, keys[metadatatypes.StoreKey], app.GetSubspace(metadatatypes.ModuleName), app.AccountKeeper, app.AuthzKeeper, app.AttributeKeeper,
)

markerReqAttrBypassAddrs := []sdk.AccAddress{
authtypes.NewModuleAddress(authtypes.FeeCollectorName), // Allow collecting fees in restricted coins.
authtypes.NewModuleAddress(rewardtypes.ModuleName), // Allow rewards to hold onto restricted coins.
Expand All @@ -584,6 +580,10 @@ func New(
NewGroupCheckerFunc(app.GroupKeeper),
)

app.MetadataKeeper = metadatakeeper.NewKeeper(
appCodec, keys[metadatatypes.StoreKey], app.GetSubspace(metadatatypes.ModuleName), app.AccountKeeper, app.AuthzKeeper, app.AttributeKeeper, app.MarkerKeeper,
)

app.HoldKeeper = holdkeeper.NewKeeper(
appCodec, keys[hold.StoreKey], app.BankKeeper,
)
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

129 changes: 129 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39670,6 +39670,76 @@ paths:
format: boolean
tags:
- Query
'/provenance/metadata/v1/netassetvalues/{id}':
get:
summary: ScopeNetAssetValues returns net asset values for scope
operationId: ScopeNetAssetValues
responses:
'200':
description: A successful response.
schema:
type: object
properties:
net_asset_values:
type: array
items:
type: object
properties:
price:
title: price is the complete value of the asset's volume
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the
custom method

signatures required by gogoproto.
updated_block_height:
type: string
format: uint64
title: updated_block_height is the block height of last update
title: NetAssetValue defines a scope's net asset value
title: net asset values for scope
description: >-
QueryNetAssetValuesRequest is the response type for the
Query/NetAssetValues method.
default:
description: An unexpected error response
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: id
description: scopeid metadata address
in: path
required: true
type: string
tags:
- Query
'/provenance/metadata/v1/ownership/{address}':
get:
summary: >-
Expand Down Expand Up @@ -85796,6 +85866,27 @@ definitions:
on or off chain) to define an input

parameter
provenance.metadata.v1.NetAssetValue:
type: object
properties:
price:
title: price is the complete value of the asset's volume
type: object
properties:
denom:
type: string
amount:
type: string
description: |-
Coin defines a token with a denomination and an amount.

NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
updated_block_height:
type: string
format: uint64
title: updated_block_height is the block height of last update
title: NetAssetValue defines a scope's net asset value
provenance.metadata.v1.OSAllLocatorsRequest:
type: object
properties:
Expand Down Expand Up @@ -86612,6 +86703,39 @@ definitions:
include_request is a flag for whether to include this request in
your result.
description: QueryParamsResponse is the response type for the Query/Params RPC method.
provenance.metadata.v1.QueryScopeNetAssetValuesResponse:
type: object
properties:
net_asset_values:
type: array
items:
type: object
properties:
price:
title: price is the complete value of the asset's volume
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the custom
method

signatures required by gogoproto.
updated_block_height:
type: string
format: uint64
title: updated_block_height is the block height of last update
title: NetAssetValue defines a scope's net asset value
title: net asset values for scope
description: >-
QueryNetAssetValuesRequest is the response type for the
Query/NetAssetValues method.
provenance.metadata.v1.Record:
type: object
properties:
Expand Down Expand Up @@ -93518,6 +93642,11 @@ definitions:
description: >-
MsgAddContractSpecToScopeSpecResponse is the response type for the
Msg/AddContractSpecToScopeSpec RPC method.
provenance.metadata.v1.MsgAddNetAssetValuesResponse:
type: object
title: >-
MsgAddNetAssetValuesResponse defines the Msg/AddNetAssetValue response
type
provenance.metadata.v1.MsgAddScopeDataAccessResponse:
type: object
title: >-
Expand Down
118 changes: 118 additions & 0 deletions docs/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@
- [EventSessionCreated](#provenance.metadata.v1.EventSessionCreated)
- [EventSessionDeleted](#provenance.metadata.v1.EventSessionDeleted)
- [EventSessionUpdated](#provenance.metadata.v1.EventSessionUpdated)
- [EventSetNetAssetValue](#provenance.metadata.v1.EventSetNetAssetValue)
- [EventTxCompleted](#provenance.metadata.v1.EventTxCompleted)

- [provenance/metadata/v1/metadata.proto](#provenance/metadata/v1/metadata.proto)
Expand All @@ -376,6 +377,7 @@

- [provenance/metadata/v1/scope.proto](#provenance/metadata/v1/scope.proto)
- [AuditFields](#provenance.metadata.v1.AuditFields)
- [NetAssetValue](#provenance.metadata.v1.NetAssetValue)
- [Party](#provenance.metadata.v1.Party)
- [Process](#provenance.metadata.v1.Process)
- [Record](#provenance.metadata.v1.Record)
Expand All @@ -393,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)
Expand Down Expand Up @@ -447,6 +450,8 @@
- [OwnershipResponse](#provenance.metadata.v1.OwnershipResponse)
- [QueryParamsRequest](#provenance.metadata.v1.QueryParamsRequest)
- [QueryParamsResponse](#provenance.metadata.v1.QueryParamsResponse)
- [QueryScopeNetAssetValuesRequest](#provenance.metadata.v1.QueryScopeNetAssetValuesRequest)
- [QueryScopeNetAssetValuesResponse](#provenance.metadata.v1.QueryScopeNetAssetValuesResponse)
- [RecordSpecificationRequest](#provenance.metadata.v1.RecordSpecificationRequest)
- [RecordSpecificationResponse](#provenance.metadata.v1.RecordSpecificationResponse)
- [RecordSpecificationWrapper](#provenance.metadata.v1.RecordSpecificationWrapper)
Expand Down Expand Up @@ -482,6 +487,8 @@
- [provenance/metadata/v1/tx.proto](#provenance/metadata/v1/tx.proto)
- [MsgAddContractSpecToScopeSpecRequest](#provenance.metadata.v1.MsgAddContractSpecToScopeSpecRequest)
- [MsgAddContractSpecToScopeSpecResponse](#provenance.metadata.v1.MsgAddContractSpecToScopeSpecResponse)
- [MsgAddNetAssetValuesRequest](#provenance.metadata.v1.MsgAddNetAssetValuesRequest)
- [MsgAddNetAssetValuesResponse](#provenance.metadata.v1.MsgAddNetAssetValuesResponse)
- [MsgAddScopeDataAccessRequest](#provenance.metadata.v1.MsgAddScopeDataAccessRequest)
- [MsgAddScopeDataAccessResponse](#provenance.metadata.v1.MsgAddScopeDataAccessResponse)
- [MsgAddScopeOwnerRequest](#provenance.metadata.v1.MsgAddScopeOwnerRequest)
Expand Down Expand Up @@ -5516,6 +5523,24 @@ EventSessionUpdated is an event message indicating a session has been updated.



<a name="provenance.metadata.v1.EventSetNetAssetValue"></a>

### EventSetNetAssetValue
EventSetNetAssetValue event emitted when Net Asset Value for a scope is update or added


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `scope_id` | [string](#string) | | |
| `price` | [string](#string) | | |
| `volume` | [string](#string) | | |
| `source` | [string](#string) | | |






<a name="provenance.metadata.v1.EventTxCompleted"></a>

### EventTxCompleted
Expand Down Expand Up @@ -5861,6 +5886,22 @@ AuditFields capture information about the last account to make modifications and



<a name="provenance.metadata.v1.NetAssetValue"></a>

### NetAssetValue
NetAssetValue defines a scope's net asset value


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `price` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | price is the complete value of the asset's volume |
| `updated_block_height` | [uint64](#uint64) | | updated_block_height is the block height of last update |






<a name="provenance.metadata.v1.Party"></a>

### Party
Expand Down Expand Up @@ -6103,6 +6144,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 |






<a name="provenance.metadata.v1.MarkerNetAssetValues"></a>

### 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 |



Expand Down Expand Up @@ -6951,6 +7009,36 @@ QueryParamsResponse is the response type for the Query/Params RPC method.



<a name="provenance.metadata.v1.QueryScopeNetAssetValuesRequest"></a>

### QueryScopeNetAssetValuesRequest
QueryNetAssetValuesRequest is the request type for the Query/NetAssetValues method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `id` | [string](#string) | | scopeid metadata address |






<a name="provenance.metadata.v1.QueryScopeNetAssetValuesResponse"></a>

### QueryScopeNetAssetValuesResponse
QueryNetAssetValuesRequest is the response type for the Query/NetAssetValues method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `net_asset_values` | [NetAssetValue](#provenance.metadata.v1.NetAssetValue) | repeated | net asset values for scope |






<a name="provenance.metadata.v1.RecordSpecificationRequest"></a>

### RecordSpecificationRequest
Expand Down Expand Up @@ -7535,6 +7623,7 @@ The specification_id can either be a uuid, e.g. def6bc0a-c9dd-4874-948f-5206e606
| `OSLocatorsByScope` | [OSLocatorsByScopeRequest](#provenance.metadata.v1.OSLocatorsByScopeRequest) | [OSLocatorsByScopeResponse](#provenance.metadata.v1.OSLocatorsByScopeResponse) | OSLocatorsByScope returns all ObjectStoreLocator entries for a for all signer's present in the specified scope. | GET|/provenance/metadata/v1/locator/scope/{scope_id}|
| `OSAllLocators` | [OSAllLocatorsRequest](#provenance.metadata.v1.OSAllLocatorsRequest) | [OSAllLocatorsResponse](#provenance.metadata.v1.OSAllLocatorsResponse) | OSAllLocators returns all ObjectStoreLocator entries. | GET|/provenance/metadata/v1/locators/all|
| `AccountData` | [AccountDataRequest](#provenance.metadata.v1.AccountDataRequest) | [AccountDataResponse](#provenance.metadata.v1.AccountDataResponse) | AccountData gets the account data associated with a metadata address. Currently, only scope ids are supported. | GET|/provenance/metadata/v1/accountdata/{metadata_addr}|
| `ScopeNetAssetValues` | [QueryScopeNetAssetValuesRequest](#provenance.metadata.v1.QueryScopeNetAssetValuesRequest) | [QueryScopeNetAssetValuesResponse](#provenance.metadata.v1.QueryScopeNetAssetValuesResponse) | ScopeNetAssetValues returns net asset values for scope | GET|/provenance/metadata/v1/netassetvalues/{id}|

<!-- end services -->

Expand Down Expand Up @@ -7574,6 +7663,33 @@ MsgAddContractSpecToScopeSpecResponse is the response type for the Msg/AddContra



<a name="provenance.metadata.v1.MsgAddNetAssetValuesRequest"></a>

### MsgAddNetAssetValuesRequest
MsgAddNetAssetValuesRequest defines the Msg/AddNetAssetValues request type


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `scope_id` | [string](#string) | | |
| `signers` | [string](#string) | repeated | |
| `net_asset_values` | [NetAssetValue](#provenance.metadata.v1.NetAssetValue) | repeated | |






<a name="provenance.metadata.v1.MsgAddNetAssetValuesResponse"></a>

### MsgAddNetAssetValuesResponse
MsgAddNetAssetValuesResponse defines the Msg/AddNetAssetValue response type






<a name="provenance.metadata.v1.MsgAddScopeDataAccessRequest"></a>

### MsgAddScopeDataAccessRequest
Expand Down Expand Up @@ -8195,6 +8311,7 @@ MsgWriteScopeRequest is the request type for the Msg/WriteScope RPC method.
| `signers` | [string](#string) | repeated | signers is the list of address of those signing this request. |
| `scope_uuid` | [string](#string) | | scope_uuid is an optional uuid string, e.g. "91978ba2-5f35-459a-86a7-feca1b0512e0" If provided, it will be used to generate the MetadataAddress for the scope which will override the scope_id in the provided scope. If not provided (or it is an empty string), nothing special happens. If there is a value in scope.scope_id that is different from the one created from this uuid, an error is returned. |
| `spec_uuid` | [string](#string) | | spec_uuid is an optional scope specification uuid string, e.g. "dc83ea70-eacd-40fe-9adf-1cf6148bf8a2" If provided, it will be used to generate the MetadataAddress for the scope specification which will override the specification_id in the provided scope. If not provided (or it is an empty string), nothing special happens. If there is a value in scope.specification_id that is different from the one created from this uuid, an error is returned. |
| `usd_mills` | [uint64](#uint64) | | usd_mills value of scope in usd mills (1234 = $1.234) used for net asset value |



Expand Down Expand Up @@ -8334,6 +8451,7 @@ Msg defines the Metadata Msg service.
| `DeleteOSLocator` | [MsgDeleteOSLocatorRequest](#provenance.metadata.v1.MsgDeleteOSLocatorRequest) | [MsgDeleteOSLocatorResponse](#provenance.metadata.v1.MsgDeleteOSLocatorResponse) | DeleteOSLocator deletes an existing ObjectStoreLocator record. | |
| `ModifyOSLocator` | [MsgModifyOSLocatorRequest](#provenance.metadata.v1.MsgModifyOSLocatorRequest) | [MsgModifyOSLocatorResponse](#provenance.metadata.v1.MsgModifyOSLocatorResponse) | ModifyOSLocator updates an ObjectStoreLocator record by the current owner. | |
| `SetAccountData` | [MsgSetAccountDataRequest](#provenance.metadata.v1.MsgSetAccountDataRequest) | [MsgSetAccountDataResponse](#provenance.metadata.v1.MsgSetAccountDataResponse) | SetAccountData associates some basic data with a metadata address. Currently, only scope ids are supported. | |
| `AddNetAssetValues` | [MsgAddNetAssetValuesRequest](#provenance.metadata.v1.MsgAddNetAssetValuesRequest) | [MsgAddNetAssetValuesResponse](#provenance.metadata.v1.MsgAddNetAssetValuesResponse) | AddNetAssetValues set the net asset value for a scope | |

<!-- end services -->

Expand Down
Loading
Loading