Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions projects/escher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,30 @@ async function eBabyTVL(api) {
api.add(token, totalStakedAmount);
}

async function eUTVL(api) {
const lcd = 'https://rest.union.build';
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use our SDK for EVM TVLs. Maybe use staking() from our helpers. Also since this is your own token, please export this as staking rather than tvl and use tvl: () => ({})

Copy link
Contributor Author

@DVendy DVendy Oct 21, 2025

Choose a reason for hiding this comment

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

hi @waynebruce0x thanks for the response. As for this initially we wanted to list it under union chain but it's not there yet so we listed under ethereum since our token currently only lives in ethereum.
Can you add the union chain? that way we can query using cosmos helper just like our eBABY
https://union.build/

Copy link
Collaborator

Choose a reason for hiding this comment

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

you should add 'union' to chains.json and then export a balance of either ethereum:0xba5ed44733953d79717f6269357c77718c8ba5ed or coingecko:union-2 under tvl.union

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi @waynebruce0x I've updated the code with :

  • added union chain to chain.js
  • tvl now uses cosmos sdk rather than fetching to rest
  • use union coingecko string as balance

I noticed that the build is failing, but it's not from our project folder

const delegator = 'union19ydrfy0d80vgpvs6p0cljlahgxwrkz54ps8455q7jfdfape7ld7quaq69v';

const res = await fetch(`${lcd}/cosmos/staking/v1beta1/delegations/${delegator}`);
const json = await res.json();
const delegations = Array.isArray(json?.delegation_responses) ? json.delegation_responses : [];

let tvlAtomic = 0;
for (const d of delegations) {
tvlAtomic += Number(d?.balance?.amount || 0);
}

const token = CORE_ASSETS.ethereum.U;
api.add(token, tvlAtomic);
}

module.exports = {
methodology: 'TVL counts the tokens that are locked in the Escher staking hub',
babylon: {
methodology: 'TVL counts the tokens that are locked in the Escher staking hub',
tvl: eBabyTVL,
},
} // node test.js projects/milky-way/index.js
ethereum: {
methodology: 'TVL counts the token of each delegator',
tvl: eUTVL,
},
} // node test.js projects/escher/index.js
3 changes: 2 additions & 1 deletion projects/helper/coreAssets.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"BTCN": "0x386E7A3a0c0919c9d53c3b04FF67E73Ff9e45Fb6",
"POL": "0x455e53cbb86018ac2b8092fdcd39d8444affc3f6",
"WSOL": "0xD31a59c85aE9D8edEFeC411D448f90841571b89c",
"WAVES": "0x0Fb765ddBD4d26AC524AA5990B0643D0Ab6Ac2fE"
"WAVES": "0x0Fb765ddBD4d26AC524AA5990B0643D0Ab6Ac2fE",
"U":"0xba5ed44733953d79717f6269357c77718c8ba5ed"
},
"fantom": {
"WFTM": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",
Expand Down
Loading