-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include claimable balances in Asset Stats endpoint #3476
Comments
Initial thought was to add this into the AssetStatsProcessor. The process being roughly:
However, that might have the same issue as #3380 and #3306, where the Second thought, is we could do it dynamically in the |
@paulbellamy I believe you should be able to implement it in the AssetStatsProcessor. You don't need to have any logic to check who created the claimable balance or how the claimable balance was claimed or clawed back. When you create a claimable balance I think there will be two Similarly when you claim or clawback a claimable balance, that operation should produce two I think these are the only cases you need to handle: // only handle changes involving claimable balances
switch {
case change.Pre == nil && change.Post != nil:
// Created
newCb := change.Post.Data.MustClaimableBalance()
// increase claimable balance stats
case change.Pre != nil && change.Post != nil:
// claimable balances are immutable so this case should never happen
case change.Pre != nil && change.Post == nil:
// Removed
oldCb := change.Pre.Data.MustClaimableBalance()
// decrease claimable balance stats
default:
return errors.New("Invalid io.Change: change.Pre == nil && change.Post == nil")
} |
^ What @tamirms said, just one quick note on: // claimable balances are immutable so this case should never happen I think there's one case in which it's possible: when the sponsor is changed. But this won't affect the amount nor the asset. |
…ats summaries (#3502) * Refactor AssetStatProcessor to make space for handling new change types * WIP --adding claimable balances * Fix two bugs * Add support for claimable balance in processor also add tests * Add API implementation and tests * attempting to refactor * Handle special case of native asset * Update docs * update CHANGELOG * Fixing test * rename function * Refactor AssetStatSet * improve commit functions * Fix godoc strings * Update services/horizon/internal/docs/reference/endpoints/assets-all.md Co-authored-by: Bartek Nowotarski <[email protected]> * Update changelog * Move claimable balance balance and accounts out of the structs * use ingest.Change in assetStatSet.Add* methods Co-authored-by: tamirms <[email protected]> Co-authored-by: Bartek Nowotarski <[email protected]>
Asset stats (
/assets
) don't include claimable balances. We probably should add number of claimable balances holding a given asset with the sum amount. This can be either part of #3454 or in a separate PR.The text was updated successfully, but these errors were encountered: