Skip to content

Conversation

charleskimbest
Copy link

@charleskimbest charleskimbest commented Aug 24, 2025

NOTE

Please enable "Allow edits by maintainers" while putting up the PR.


  • If you would like to add a volume/fees/revenue adapter please submit the PR here.
  • If you would like to add a liquidations adapter, please refer to this readme document for details.
  1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.
  2. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
  3. Please fill the form below only if the PR is for listing a new protocol else it can be ignored/replaced with reason/details about the PR
  4. For updating listing info It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR
  5. Do not edit/push package-lock.json file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI
  6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap

Name (to be shown on DefiLlama):
SOLID

Twitter Link:
https://x.com/solid_capa

List of audit links if any:
https://github.com/SCV-Security/PublicReports/blob/main/CW/Capapult/Capapult%20-%20Money%20Market%20Contracts%20-%20Audit%20Report%20v1.0%20.pdf
https://github.com/SCV-Security/PublicReports/blob/fa51bf944593bf18d128b4f812b3150b218f0d25/Capapult%2FCapapult%20Finance%20-%20Oracle%20Contract%20-%20Audit%20Report%20v1.0.pdf

Website Link:
https://solid.online

Logo (High resolution, will be shown with rounded borders):
https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/solid.png

Current TVL:
95.8k USD (August 24, 2025) and dynamic — calculated via custody contracts (collaterals).

Treasury Addresses (if the protocol has treasury):
None

Chain:
Terra2 (Phoenix)

Coingecko ID:
solid-2 (https://api.coingecko.com/api/v3/coins/list)

Coinmarketcap ID:
N/A

Short Description (to be shown on DefiLlama):
SOLID is an over-collateralized stablecoin protocol on Terra2 (Phoenix). Users can deposit LSTs and IBC assets to mint the stablecoin SOLID. Its governance token is CAPA.

Token address and ticker if any:
• SOLID (stablecoin) → Contract: terra10aa3zdkrc7jwuf8ekl3zq7e7m42vmzqehcmu74e4egc7xkm5kr2s0muyst
• CAPA (governance token) → Contract: terra1t4p3u8khpd7f8qzurwyafxt648dya6mp6vur3vaapswt6m24gkuqrfdhar

Blockchain Explorers:
https://www.mintscan.io/terra
https://terrasco.pe

Category:
protocol

Oracle Provider(s):
• ampLUNA: Eris Protocol API
• bLUNA: Weighted pool price from Astroport & White Whale
• IBC assets: on-chain custody balances

Implementation Details:
• ampLUNA price pulled from Eris Protocol API.
• bLUNA price calculated via weighted average of Astroport & White Whale pools.
• USDC (Noble), axl.WBTC, axl.WETH, wSOL, wBNB read directly from custody contracts.

Documentation/Proof:
https://www.erisprotocol.com/terra/amplifier/LUNA
https://app.backbonelabs.io/liquid-staking/gravedigger/phoenix-1
https://github.com/SCV-Security/PublicReports
https://terra-api.cosmosrescue.dev:8443

forkedFrom:
None

methodology (what is being counted as TVL, how is TVL being calculated):
TVL = sum of all collateral vault balances:
• ampLUNA (Eris LST of LUNA): exchange rate from Eris API, with $3k min-effective filter.
• bLUNA (Backbone LST of LUNA): liquidity-weighted average rate from Astroport & White Whale bLUNA–LUNA pools.
• USDC (Noble IBC), wETH.axl, wBTC.axl, wSOL.wormhole, wBNB.wormhole: balances directly from custody contracts on Terra.

Github org/user (Optional):
https://github.com/solid-online

Notes:
• Uses LCD: https://terra-api.cosmosrescue.dev:8443
• Only counts collateral (no governance tokens, no protocol-owned assets).
• Custody contracts verified via on-chain registry and solid-online GitHub.

solid: fix lint (no-empty) by skipping failed pair in catch, row 126
@charleskimbest charleskimbest changed the title feat(solid): Terra TVL adapter feat(solid): Terra2 TVL adapter Aug 24, 2025
async function getLunaUsd() {
try {
const { data } = await axios.get("https://coins.llama.fi/prices/current/coingecko:terra-luna-2");
return data?.coins?.["coingecko:terra-luna-2"]?.price ?? 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we fetching price here instead of just returning a token balance?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback. For standard tokens I agree we should only return balances.
However, ampLUNA and bLUNA are LSTs (liquid staking derivatives) of LUNA, so their value is not 1:1 with LUNA but determined by an exchange rate.
Without applying the exchange rate, the TVL would be under/over-reported.

That’s why we fetch both balance and price (exchange rate) here directly.
If you prefer, we can instead return balances only and set up separate price feeds for ampLUNA and bLUNA, but this seemed the simpler integration.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm getting 501s from the Terra LCD when I try to test this

Copy link
Collaborator

Choose a reason for hiding this comment

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

We will move ampLUNA and bLUNA pricing into our coin prices server. Is there a better way to get the bLUNA rate than reading pool weights?

Copy link
Author

Choose a reason for hiding this comment

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

Updated the adapter to return balances only and removed all pricing/exchange-rate logic.

  • ampLUNA/bLUNA (and other assets) are now reported as raw balances.
  • Pricing, including LST exchange rates, should be handled by DefiLlama coin-prices infra.
  • Added TERRA_LCD env var (default: https://terra-api.cosmosrescue.dev:8443).
  • CW20 balances via wasm smart queries; IBC/native via bank balances.
  • Keys use "terra2:<cw20_contract>" and "terra2:<ibc_denom>".

Some Terra LCDs return 501/5xx. For local testing, please use:
https://terra-api.cosmosrescue.dev:8443
Examples:

  • CW20 smart query:
    GET /cosmwasm/wasm/v1/contract//smart/<base64({"balance":{"address":""}})>
  • Bank balances:
    GET /cosmos/bank/v1beta1/balances/
    You can also override via: export TERRA_LCD=https://terra-api.cosmosrescue.dev:8443

For LSTs please prefer on-chain exchange rate over pool weights.

bLUNA:
price(bLUNA) = exchange_rate * price(LUNA)
exchange_rate can be obtained from the hub/minter contract state
(either a direct "exchange_rate" field, or computed as total_bonded / total_shares).

ampLUNA:
price(ampLUNA) = exchange_rate * price(LUNA)
exchange_rate available via Eris public API (and on-chain as well).

Happy to provide exact hub/minter contract addresses & query schema if helpful.

Copy link
Author

Choose a reason for hiding this comment

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

The result of the updated code is below

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

hey could you give me more details on how to fetch the exchange_rate for bLUNA please? Thanks for your help

Copy link
Author

Choose a reason for hiding this comment

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

bLUNA doesn’t expose a direct exchange_rate endpoint like ampLUNA (Eris API).
Instead, we calculate its effective rate via liquidity-weighted pool prices:
• Astroport bLUNA–LUNA pool (contract: terra1h32epkd72x7st0wk49z35qlpsxf26pw4ydacs8acq6uka7hgshmq7z7vl9)
• White Whale bLUNA–LUNA pool (contract: terra1j5znhs9jeyty9u9jcagl3vefkvzwqp6u9tq9a3e5qrz4gmj2udyqp0z0xc)

For each pool:
1. Query pool reserves (via LCD wasm/contract/{pair}/smart with { pool: {} }).
2. Extract LUNA reserve (uluna) and bLUNA reserve (CW20 address terra17aj4ty4sz4yhgm08na8drc0v03v2jwr3waxcqrwhajj729zhl7zqnpc0ml).
3. Compute the price as LUNA_reserve / bLUNA_reserve.
4. Weight the rate by the LUNA-side liquidity, to avoid small pools skewing results.
5. Skip pools if their LUNA-side liquidity < $3k (to filter out dust).
6. Final bLUNA exchange_rate = weighted average across valid pools.

This way, the exchange_rate dynamically reflects the actual market ratio of bLUNA to LUNA.

@waynebruce0x waynebruce0x self-assigned this Aug 25, 2025
@charleskimbest
Copy link
Author

I’ve now included the borrowed function to reflect the total SOLID supply. Please see the attached screenshot for the test output.image


for (const pair of ADDR.bLUNA.pairs) {
try {
const pool = await smartQuery(pair, { pool: {} });
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is giving me for both pools listed

{
  code: 12,
  message: "Not Implemented",
  details: [
  ],
}

Is this expected? Using https://terra-api.cosmosrescue.dev:8443

Copy link
Collaborator

Choose a reason for hiding this comment

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

Im aware this is an old commit, trying to derive bLuna price

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.

2 participants