From 53cec4179c78d2813c1b16c936158f4f6f3e947f Mon Sep 17 00:00:00 2001 From: Irfandi D Vendy Date: Mon, 7 Jul 2025 19:10:32 +0700 Subject: [PATCH 1/5] feat: Add escher finance project --- projects/escher/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/escher/index.js diff --git a/projects/escher/index.js b/projects/escher/index.js new file mode 100644 index 00000000000..bec544e56a4 --- /dev/null +++ b/projects/escher/index.js @@ -0,0 +1,28 @@ +const { queryContract } = require("../helper/chain/cosmos"); +const CORE_ASSETS = require('../helper/coreAssets.json'); + +const consts = { + EBABY_CONTRACT: 'bbn1m7zr5jw4k9z22r9ajggf4ucalwy7uxvu9gkw6tnsmv42lvjpkwasagek5g', +} + +async function eBabyTVL(api) { + const data = await queryContract({ + contract: consts.EBABY_CONTRACT, + chain: api.chain, + data: { staking_liquidity: {} }, + }); + + // + const totalStakedAmount = parseInt(data.amount); + + const token = CORE_ASSETS.babylon.BABY; + api.add(token, totalStakedAmount); +} + + +module.exports = { + methodology: 'TVL eBABY', + babylon: { + tvl: eBabyTVL, + }, +} // node test.js projects/milky-way/index.js \ No newline at end of file From 3db1c1c4d06267b726bf76aa96e1466027837d57 Mon Sep 17 00:00:00 2001 From: Irfandi D Vendy Date: Mon, 7 Jul 2025 21:24:18 +0700 Subject: [PATCH 2/5] feat: Methodology text update --- projects/escher/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/escher/index.js b/projects/escher/index.js index bec544e56a4..f05d2876765 100644 --- a/projects/escher/index.js +++ b/projects/escher/index.js @@ -21,7 +21,7 @@ async function eBabyTVL(api) { module.exports = { - methodology: 'TVL eBABY', + methodology: 'TVL counts the tokens that are locked in the Escher staking hub', babylon: { tvl: eBabyTVL, }, From 8fe68def77bc7d494680c797d51117d9393623e0 Mon Sep 17 00:00:00 2001 From: Irfandi D Vendy Date: Sun, 19 Oct 2025 17:30:57 +0700 Subject: [PATCH 3/5] Add Union tvl to Escher project --- projects/escher/index.js | 24 ++++++++++++++++++++++-- projects/helper/coreAssets.json | 3 ++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/projects/escher/index.js b/projects/escher/index.js index f05d2876765..8e75510a6f5 100644 --- a/projects/escher/index.js +++ b/projects/escher/index.js @@ -19,10 +19,30 @@ async function eBabyTVL(api) { api.add(token, totalStakedAmount); } +async function eUTVL(api) { + const lcd = 'https://rest.union.build'; + 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 \ No newline at end of file + ethereum: { + methodology: '-', + tvl: eUTVL, + }, +} // node test.js projects/escher/index.js \ No newline at end of file diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 3d4a05bec52..66a30d9ed07 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -68,7 +68,8 @@ "BTCN": "0x386E7A3a0c0919c9d53c3b04FF67E73Ff9e45Fb6", "POL": "0x455e53cbb86018ac2b8092fdcd39d8444affc3f6", "WSOL": "0xD31a59c85aE9D8edEFeC411D448f90841571b89c", - "WAVES": "0x0Fb765ddBD4d26AC524AA5990B0643D0Ab6Ac2fE" + "WAVES": "0x0Fb765ddBD4d26AC524AA5990B0643D0Ab6Ac2fE", + "U":"0xba5ed44733953d79717f6269357c77718c8ba5ed" }, "fantom": { "WFTM": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", From 8978e5b45431dcd2f59cdc053ddf7e953f5d7b42 Mon Sep 17 00:00:00 2001 From: Irfandi D Vendy Date: Sun, 19 Oct 2025 17:39:43 +0700 Subject: [PATCH 4/5] feat: update methodology --- projects/escher/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/escher/index.js b/projects/escher/index.js index 8e75510a6f5..68ccc2d4173 100644 --- a/projects/escher/index.js +++ b/projects/escher/index.js @@ -42,7 +42,7 @@ module.exports = { tvl: eBabyTVL, }, ethereum: { - methodology: '-', + methodology: 'TVL counts the token of each delegator', tvl: eUTVL, }, } // node test.js projects/escher/index.js \ No newline at end of file From d184cd66f2de4d704d9b96773f37a4547c3b5ecb Mon Sep 17 00:00:00 2001 From: Irfandi D Vendy Date: Wed, 22 Oct 2025 16:18:28 +0700 Subject: [PATCH 5/5] feat: add union chain, use sdk query, new tvl method --- projects/escher/index.js | 25 +++++++++++++------------ projects/helper/chain/cosmos.js | 3 ++- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 3 +-- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/projects/escher/index.js b/projects/escher/index.js index 68ccc2d4173..9ebace7f2f5 100644 --- a/projects/escher/index.js +++ b/projects/escher/index.js @@ -1,13 +1,15 @@ -const { queryContract } = require("../helper/chain/cosmos"); +const { queryContract, queryV1Beta1 } = require("../helper/chain/cosmos"); const CORE_ASSETS = require('../helper/coreAssets.json'); -const consts = { +const config = { EBABY_CONTRACT: 'bbn1m7zr5jw4k9z22r9ajggf4ucalwy7uxvu9gkw6tnsmv42lvjpkwasagek5g', + U_DELEGATOR: 'union19ydrfy0d80vgpvs6p0cljlahgxwrkz54ps8455q7jfdfape7ld7quaq69v', + U_COINGECKO: 'coingecko:union-2' } async function eBabyTVL(api) { const data = await queryContract({ - contract: consts.EBABY_CONTRACT, + contract: config.EBABY_CONTRACT, chain: api.chain, data: { staking_liquidity: {} }, }); @@ -20,20 +22,19 @@ async function eBabyTVL(api) { } async function eUTVL(api) { - const lcd = 'https://rest.union.build'; - 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 : []; + const data = await queryV1Beta1({ + chain: api.chain, + url: `staking/v1beta1/delegations/${config.U_DELEGATOR}` + }); + const delegations = Array.isArray(data?.delegation_responses) ? data.delegation_responses : []; let tvlAtomic = 0; for (const d of delegations) { tvlAtomic += Number(d?.balance?.amount || 0); } + tvlAtomic /= 10 ** 18; - const token = CORE_ASSETS.ethereum.U; - api.add(token, tvlAtomic); + api.add(config.U_COINGECKO, tvlAtomic, { skipChain: true }); } module.exports = { @@ -41,7 +42,7 @@ module.exports = { methodology: 'TVL counts the tokens that are locked in the Escher staking hub', tvl: eBabyTVL, }, - ethereum: { + union: { methodology: 'TVL counts the token of each delegator', tvl: eUTVL, }, diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 82caac0c229..1f68f17a099 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -70,7 +70,8 @@ const endPoints = { embr: 'https://rest-embrmainnet-1.anvil.asia-southeast.initia.xyz', civitia: 'https://rest-civitia-1.anvil.asia-southeast.initia.xyz', echelon_initia: 'https://rest-echelon-1.anvil.asia-southeast.initia.xyz', - inertia: 'https://rest.inrt.fi' + inertia: 'https://rest.inrt.fi', + union: 'https://rest.union.build' }; const chainSubpaths = { diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 463407cc812..72ef6dded6b 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -421,6 +421,7 @@ "ultron", "umee", "unichain", + "union", "unit0", "vana", "vechain", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index da1d698300b..187905d2308 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -68,8 +68,7 @@ "BTCN": "0x386E7A3a0c0919c9d53c3b04FF67E73Ff9e45Fb6", "POL": "0x455e53cbb86018ac2b8092fdcd39d8444affc3f6", "WSOL": "0xD31a59c85aE9D8edEFeC411D448f90841571b89c", - "WAVES": "0x0Fb765ddBD4d26AC524AA5990B0643D0Ab6Ac2fE", - "U":"0xba5ed44733953d79717f6269357c77718c8ba5ed" + "WAVES": "0x0Fb765ddBD4d26AC524AA5990B0643D0Ab6Ac2fE" }, "fantom": { "WFTM": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",