pegnet / pegnetd

The pegnet daemon to track txs, conversions, etc
Other
13 stars 14 forks source link

Rich list API request and cli command #91

Closed WhoSoup closed 4 years ago

WhoSoup commented 4 years ago

Was doing this for PNMC, figured I might as well include the functionality in the cli.

Adds two api calls:

I separated them because the logic for each is much different. Calculating the global rich list is more expensive than an asset rich list because I'm doing the conversions and sorting after the query. It is theoretically possible to build a query that does the conversions but due to the structure of the table, this was far easier to implement.

The asset-rich list returns a list of the top X addresses, the asset balance, and the pUSD equivalent value. The global list adds up the pUSD equivalent of all assets of that address and only returns the pUSD equivalent sum.