Skip to content

Conversation

@AntipasBen23
Copy link

Summary

Fixes stablecoin tracking in Polkadot treasury by replacing the heroku-api export with direct blockchain queries.

Problem

Issue #14231 reported that several million dollars in stablecoins (USDC and USDT) within the Polkadot treasury were showing as $0 on DefiLlama.

Solution

  • Replaced heroku-api export with direct implementation using @polkadot/api
  • Added USDC and USDT balance fetching from:
    • Asset Hub (3 treasury addresses)
    • Hydration network (4 treasury addresses)
  • Properly categorized stablecoins using addCGToken() method
  • Added @polkadot/api dependency to package.json

Changes

  • Modified projects/treasury/polkadot.js to use direct chain queries
  • Added @polkadot/api to dependencies
  • Updated package-lock.json

Testing

  • Adapter loads without errors
  • Module exports correctly (timetravel, polkadot, methodology)
  • All dependencies installed successfully

Result

Stablecoins will now display actual values instead of $0 in the Polkadot treasury breakdown.

Resolves #14231

- Replace heroku-api export with direct implementation
- Add USDC and USDT tracking from Asset Hub and Hydration
- Properly categorize stablecoins in treasury breakdown
- Add @polkadot/api dependency to package.json
- Fixes issue where stablecoins showed as $0

Resolves DefiLlama#14231
@AntipasBen23 AntipasBen23 force-pushed the fix/polkadot-treasury-stablecoins-14231 branch from 8f3dd30 to 29242dd Compare October 31, 2025 02:40
@llamabutler
Copy link

Error while running adapter at :

Please revert changes to package.json / package-lock.json

@AntipasBen23
Copy link
Author

Hi @llamabutler,

Thank you for the feedback! I have a question about the approach:

I noticed that polkadot-api.js already contains the stablecoin tracking implementation (USDC and USDT), but polkadot.js uses the heroku-api export which fetches from an external service.

Looking at other Polkadot-based adapters (like bifrost-dex), they follow this same pattern:

  • index.js uses heroku-api
  • api.js contains the actual implementation with @polkadot/api

My questions:

  1. Should I revert polkadot.js back to using heroku-api (the original approach)?
  2. If so, how do we ensure the heroku service uses the updated polkadot-api.js code that tracks stablecoins?
  3. Or is there a different way to include @polkadot/api dependency without adding it to package.json?

The core issue is that stablecoin tracking code exists in polkadot-api.js but isn't being executed because the heroku endpoint doesn't seem to have the updated implementation.

Could you clarify the preferred approach? Happy to adjust the PR accordingly.

Thanks!

@waynebruce0x
Copy link
Collaborator

Hey thanks for the PR - has this been fixed now? I am seeing

--- tvl ---
USDT 6.91 M
USDC 4.64 M
MYTH 211.85 k
Total: 11.77 M

@waynebruce0x waynebruce0x self-assigned this Nov 3, 2025
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.

Add stablecoin amount to Polkadot treasury

3 participants