balancednetwork / balanced-network-info

ℹ️ Balanced network analytics.
https://stats.balanced.network
MIT License
0 stars 0 forks source link

Create an endpoint for the Stability fund #110

Closed hetfly closed 2 years ago

hetfly commented 2 years ago

Related to https://github.com/balancednetwork/balanced-network-info/issues/109

We will need to query stability fund balances based on timestamp, it would be ideal to have it similar to DAO fund endpoint, see https://balanced.sudoblock.io/api/v1/docs#/stats/get_daofund_balance_sheet_api_v1_stats_daofund_balance_sheet_get

example timestamp 1652252887000000

BennyOptions commented 2 years ago

@hetfly this endpoint should help you. @robcxyz can answer questions if it's not clear from the docs. You enter a timestamp and it returns a blockheight closest to the timestamp. From there, the UI can ping the node for balanceOf (blockHeight) for different tokens and different contracts. We should migrate all single-point-in-time API usage to this model. It's a new feature supported by ICON Nodes that allows you to query state at a given block height

https://tracker.v2.mainnet.sng.vultr.icon.community/api/v1/docs/index.html#/Blocks/get_api_v1_blocks_timestamp__timestamp

BennyOptions commented 2 years ago

This should also help when calling the icon node once you have the blockHeight

https://www.icondev.io/icon-stack/client-apis/json-rpc-api/v3.

So to summarize, this can be used for single-point-in-time queries. For example, let's compare today's DAO Fund bnUSD holdings to its bnUSD holdings on May 1st.

Calling backend API:

Calling ICON Node API: