NexusMutual / smart-contracts

GNU General Public License v3.0
170 stars 62 forks source link

Feature: Move ipfs hashes to storage #1171

Closed shark0der closed 4 months ago

shark0der commented 4 months ago

Context

Up until now the ipfs hashes of the products and product types were emitted as events which made it a bit more difficult for the frontend to fetch them without an indexer. Given those events are only triggered by AB members there aren't a lot of them.

Changes proposed in this pull request

This PR the ipfs hashes from being emitted as events into contract storage. Those can be added when adding/editing the product or product type or by pushing them individually without a product edit.

Test plan

Added unit tests for all functions that deal with metadata as well as a migration script that fetches all events from the Cover contract and outputs the tx data that an AB can manually send to set the metadata in the CoverProducts contract.

Checklist

Review

When reviewing a PR, please indicate intention in comments using the following emojis: