Skip to content

Commit cd14a01

Browse files
sunshine1293Nhut Dang
andauthored
feat: add TVL tracking for OpenEden TBILL USDO across multiple chains (DefiLlama#14155)
Co-authored-by: Nhut Dang <[email protected]>
1 parent b802131 commit cd14a01

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

projects/openeden-tbill/index.js

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,46 @@ const xrpTBILLAddr = {
1515
subscriptionOperatorAddress: 'rB56JZWRKvpWNeyqM3QYfZwW4fS9YEyPWM',
1616
}
1717

18-
async function evmTVL(api) {
19-
if (evmTBILLAddr[api.chain]) {
20-
const tbillTVL = await api.call({
21-
abi: 'uint256:totalAssets',
22-
target: evmTBILLAddr[api.chain],
23-
})
24-
api.add(evmTBILLAddr[api.chain], tbillTVL)
25-
}
26-
27-
if (evmUSDOAddr[api.chain]) {
28-
const usdoTVL = await api.call({
29-
abi: 'uint256:totalSupply',
30-
target: evmUSDOAddr[api.chain],
31-
})
32-
api.add(evmUSDOAddr[api.chain], usdoTVL)
33-
}
18+
async function evmTVL(api, token) {
19+
const tvl = await api.call({
20+
abi: 'erc20:totalSupply',
21+
target: token,
22+
})
23+
api.add(token, tvl, { skipChain: true })
24+
}
25+
26+
async function ethTVL(api) {
27+
evmTVL(api, evmTBILLAddr['ethereum'])
28+
evmTVL(api, evmUSDOAddr['ethereum'])
29+
}
30+
31+
async function arbTVL(api) {
32+
evmTVL(api, evmTBILLAddr['arbitrum'])
33+
}
34+
35+
async function baseTVL(api) {
36+
evmTVL(api, evmUSDOAddr['base'])
3437
}
3538

3639
async function solTVL(api) {
3740
const data = await getTokenSupplies([solTBILLAddr])
3841
Object.entries(data).forEach(([token, balance]) => {
39-
api.add(token, balance)
42+
api.add(token, balance, { skipChain: true })
4043
})
4144
}
4245

4346
async function xrpTVL(api) {
44-
4547
const data = await ripple.gatewayBalances({
46-
account: xrpTBILLAddr.issuerAddress,
47-
hotwallet: xrpTBILLAddr.subscriptionOperatorAddress,
48+
account: xrpTBILLAddr.issuerAddress,
49+
hotwallet: xrpTBILLAddr.subscriptionOperatorAddress,
4850
})
4951
api.add(evmTBILLAddr['ethereum'], Number(data.obligations?.TBL) * 1e6, { skipChain: true })
5052
}
5153

5254
module.exports = {
53-
ethereum: { tvl: evmTVL },
54-
arbitrum: { tvl: evmTVL },
55-
base: { tvl: evmTVL},
55+
ethereum: { tvl: ethTVL },
56+
arbitrum: { tvl: arbTVL },
57+
base: { tvl: baseTVL},
5658
ripple: { tvl: xrpTVL },
5759
solana: { tvl: solTVL },
5860
}

0 commit comments

Comments
 (0)