Skip to content

Commit ff40f54

Browse files
authored
fix: combine staking and TVL values for Clutch Market (DefiLlama#14738)
1 parent 59e9cc0 commit ff40f54

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

projects/clutch-market/index.js

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,52 @@ const { sumTokens2 } = require("../helper/unwrapLPs");
44
const config = {
55
arbitrum: {
66
staking: {
7-
token: "0xF4AcDE4D938844751f34659C67056f7e69dBE85a", // CLUTCH token
8-
contract: "0x2F849Bf926E457CE57dF4f8C24eEA0d33Fa04672" // CLUTCH staking contract
7+
token: "0x05905af7933f89280aB258919F0dFA056CeD8e43", // CLUTCH token
8+
contract: "0x52070c2f7527822ccaea77e46fb23754151e2793" // CLUTCH staking contract
99
},
1010
tvlTokens: [
1111
{
1212
token: ADDRESSES.arbitrum.USDC_CIRCLE, // USDC
13-
contract: "0x9797dA129eaFA143E8A50028563b69Cc02ea6444" // USDC TVL contract
13+
contract: "0xbBEa81aBd42e8804de0f7d167Cf8123206d55039" // USDC TVL contract
14+
}
15+
]
16+
},
17+
apechain: {
18+
staking: null, // No platform token staking on APE chain
19+
tvlTokens: [
20+
{
21+
token: "0x0000000000000000000000000000000000000000", // Native APE token
22+
contract: "0x7F66d16A488Eae9e2B61BfB186fD94bBA3611416" // APE contract
23+
},
24+
{
25+
token: "0xa2235d059f80e176d931ef76b6c51953eb3fbef4", // ApeUSD stablecoin
26+
contract: "0x812D9ed73aC36626CA893D99847E9978905b33C6" // ApeUSD contract
1427
}
1528
]
1629
}
1730
};
1831

1932
async function stakingTvl(_, _1, _2, { api }) {
20-
const { token, contract } = config.arbitrum.staking;
21-
return sumTokens2({ api, tokens: [token], owners: [contract] });
33+
const chain = api.chain
34+
const stakingConfig = config[chain].staking;
35+
if (!stakingConfig) return {}; // Return empty TVL if no staking on chain
36+
return sumTokens2({ api, tokens: [stakingConfig.token], owners: [stakingConfig.contract] });
2237
}
2338

2439
async function tvl(_, _1, _2, { api }) {
25-
const tokensAndOwners = config.arbitrum.tvlTokens.map(({ token, contract }) => [token, contract]);
26-
return sumTokens2({ api, tokensAndOwners });
40+
const chain = api.chain
41+
const tokensAndOwners = config[chain].tvlTokens.map(({ token, contract }) => [token, contract]);
42+
const tvlValue = await sumTokens2({ api, tokensAndOwners });
43+
44+
return tvlValue;
2745
}
2846

2947
module.exports = {
30-
methodology: "TVL includes staking for the project's own token (CLUTCH) and total value locked (TVL) for USDC in separate contracts.",
31-
arbitrum: { staking: stakingTvl, tvl },
48+
methodology: "TVL on Arbitrum includes CLUTCH token staking and USDC in lending pools. On APE Chain, TVL includes native APE token and ApeUSD stablecoin in lending pools. Values are calculated separately for staking and lending pools.",
49+
arbitrum: {
50+
staking: stakingTvl, tvl // Combined TVL and staking
51+
},
52+
apechain: {
53+
tvl // Track APE and ApeUSD lending
54+
},
3255
};

0 commit comments

Comments
 (0)