Skip to content

Commit

Permalink
[update metadata] add reset metadata fields (#74)
Browse files Browse the repository at this point in the history
* [update metadata] add reset metadata fields

* [update metadata] update version
  • Loading branch information
mike-diamond authored Aug 1, 2024
1 parent 6fd357d commit db27174
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v3-subgraph",
"version": "2.0.4",
"version": "2.0.5",
"description": "Subgraph for the StakeWise Protocol",
"repository": "https://github.com/stakewise/v3-subgraph",
"license": "AGPL-3.0-only",
Expand Down
7 changes: 6 additions & 1 deletion src/mappings/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,19 @@ export function handleMetadataUpdated(event: MetadataUpdated): void {
const vault = Vault.load(vaultAddress) as Vault

vault.metadataIpfsHash = params.metadataIpfsHash
vault.metadataUpdatedAt = event.block.timestamp

vault.description = ''
vault.displayName = ''
vault.imageUrl = ''

const data = ipfs.cat(params.metadataIpfsHash)

if (data) {
const parsedJson = json.try_fromBytes(data)

if (parsedJson.isOk && !parsedJson.isError) {
updateMetadata(parsedJson.value, vault)
vault.metadataUpdatedAt = event.block.timestamp
}
}

Expand Down

0 comments on commit db27174

Please sign in to comment.