threefoldtech / tfchain_graphql

Graphql for TFchain
Apache License 2.0
2 stars 3 forks source link

Index TFT price #98

Closed DylanVerstraete closed 3 months ago

DylanVerstraete commented 1 year ago

Index event: https://github.com/threefoldtech/tfchain/blob/bb09e8e88cbc055a89057d4bc084014c66fdd1a4/substrate-node/pallets/pallet-tft-price/src/lib.rs#L98

LeeSmet commented 1 year ago

Bump, also the average price stored. One use case is to check the actual historic cost of a contract in USD, by querying the bill reports for a contract and multiplying with the average price at the time of billing.

sameh-farouk commented 6 months ago

Update

It makes sense to index the averagePriceStored event, as Lee suggested.

Work Completed:

I ran into an issue with the priceStored event. The price was stored at older runtimes in U16F16 encoded format as hex. I'll go through its implementation in fixed crate to see how I should decode the U16F16 hex value in JS to be indexed as a number instead.

Remaining Time: 1-2 days.

Resources: