Skip to content

Conversation

@dylanjeffers
Copy link
Contributor

@dylanjeffers dylanjeffers commented Dec 16, 2025

Fixes issue where user balances and balance history showed different values. Updated user balances to follow same approach as balance history

Key fixes:

  • Updated v1_users_coins.go, v1_users_coin.go, and v1_wallet_coins.go to use the artist_coin_prices VIEW instead of COALESCE(stats.price, pools.price_usd).
  • Added artist_coin_pools.price_usd as a fallback in the price priority chain.

Now the price priority order is:

  • DAMM V2 pool price
  • DBC pool price
  • artist_coin_stats.price
  • artist_coin_pools.price_usd (new fallback)

Copy link
Contributor

@rickyrombo rickyrombo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome - this fixes Roneil?

FROM artist_coins
LEFT JOIN artist_coin_stats stats ON artist_coins.mint = stats.mint
LEFT JOIN artist_coin_pools pools ON artist_coins.mint = pools.base_mint
LEFT JOIN artist_coin_prices acp ON acp.mint = artist_coins.mint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit personal taste but I really don't like initialisms

ON stats.mint = artist_coins.mint;
LEFT JOIN artist_coin_stats AS stats
ON stats.mint = artist_coins.mint
LEFT JOIN artist_coin_pools AS pools
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this table is effectively deprecated, I think we can leave this out. was planning to drop this table entirely at some point

@dylanjeffers
Copy link
Contributor Author

Awesome - this fixes Roneil?

Yes that's the hope!

@dylanjeffers dylanjeffers merged commit 0d728f0 into main Dec 16, 2025
4 of 5 checks passed
@dylanjeffers dylanjeffers deleted the fix-user-balance branch December 16, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants