balancednetwork / balanced-network-info

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

Change Fee Calculations in performance details #124

Closed BennyOptions closed 1 year ago

BennyOptions commented 2 years ago

Currently, the performance details section uses an event streamer from the old balanced backend architecture. Instead, I'd like to use three contract APIs to get the most accurate data. These APIs should be called with blockHeight as a parameter in order to compare different dates. The contract APIs are on the Fee Handler contract, address below.

Fee Handler: cx5faae53c4dbd1fbe4a2eb4aab6565030f10da5c6

Red: getLoanFeesAccrued Yellow: getSwapFeesAccruedByToken (cx88fd7df7ddff82f7cc735c871dc519838cb235bb) Pink: getSwapFeesAccruedByToken (cx2609b924e33ef00b648a409245c7ea394c467824) Blue: getSwapFeesAccruedByToken (cxf61cd5a45dc9f91c15aa65831a30a90d59a09619) Orange: getStabilityFundFeesAccrued

As a quick example, let's say the user selects "past day" as displayed in the image below. Let's calculate the Red Box in left column and right column. The format for the example will be APIcall (blockHeight)

Left Column = getLoanFeesAccrued (May 13th blockHeight) - getLoanFeesAccrued (May 12th blockHeight) Right Column = getLoanFeesAccrued (May 11th blockHeight) - getLoanFeesAccrued (May 10th blockHeight)

fee page