Skip to content

Commit

Permalink
feat: add duckchain-new-era adapter (#12757)
Browse files Browse the repository at this point in the history
Co-authored-by: mfer <[email protected]>
Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2024
1 parent dc4c51c commit c6f27b8
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions projects/duckchain-new-era/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
const ADDRESSES = require('../helper/coreAssets.json');
const sdk = require('@defillama/sdk');
const { sumTokensExport } = require('../helper/sumTokens');
const { sumTokens2 } = require('../helper/unwrapLPs');
const { getConfig } = require('../helper/cache');

const defaultOwner = '0x6b0e12Cb3D78a931b74F51D09F3D34E3047c0E49'; // meson

const config = {
merlin: {
tokens: [
'0xB880fd278198bd590252621d4CD071b1842E9Bcd', // M-BTC
'0x93919784C523f39CACaa98Ee0a9d96c3F32b593e' // uniBTC
],
},
};

async function addCoinfg(id, ownerTokens) {
const { result } = await getConfig('meson', 'https://relayer.meson.fi/api/v1/list');
const { address, tokens } = result.find(c => c.id === id) ?? {};
if (!address) return;
ownerTokens.push([tokens.map(i => i.addr ?? nullAddress).filter(i => i), address]);
return ownerTokens;
}

Object.keys(config).forEach(chain => {
const { id = chain, owner = defaultOwner, tokens } = config[chain];
module.exports[chain] = {
tvl: async (api) => {
const ownerTokens = [];
if (tokens) ownerTokens.push([tokens, owner]);
await addCoinfg(id, ownerTokens);
return sumTokens2({ api, ownerTokens });
}
};
});

module.exports = {
methodology: "Summary of Dukchain staking assets",
ton: {
tvl: sumTokensExport({
tokens: [
ADDRESSES.null, // 用于追踪原生 TON
"EQCuPm01HldiduQ55xaBF_1kaW_WAUy5DHey8suqzU_MAJOR",
"EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT",
"EQCvxJy4eG8hyHBFsZ7eePxrRsUQSFE_jpptRAYBmcG_DOGS",
"EQB4zZusHsbU2vVTPqjhlokIOoiZhEdCMT703CWEzhTOo__X",
"EQAJ8uWd7EBqsmpSWaRdf_I-8R8-XHwh3gsNKhy-UrdrPcUo",
"EQC98_qAmNEptUtPc7W6xdHh_ZHrBUFpw5Ft_IzNU20QAJav",
"EQD-cvR0Nz6XAyRBvbhz-abTrRC6sI5tvHvvpeQraV9UAAD7",
"EQAfF5j3JMIpZlLmACv7Ub7RH7WmiVMuV4ivcgNYHvNnqHTz"
],
owners: [
"UQABbkaGs-mjWe6ifQ2h11GOEdGRyAPNrZi41-MK1uX92ulc", // UTONIC Ton生态所有代币
"EQCVarr_Agtk4A8_Sn5RO2M8QH9j5WQjdoN984P-b6TBZB8Z" // UTONIC 多签
],
onlyWhitelistedTokens: false
})
},
ethereum: {
tvl: sumTokensExport({
ownerTokens: [
[[ADDRESSES.null], "0xb4eE432B0fbb64CC5C4bbA74427436b5347E88A4"] // meson eth
],
}),
},
arbitrum: {
tvl: sumTokensExport({
owners: ["0x5E8c3F0eA1d4004F32dFaE54bca88C78D065d869"],
tokens: [ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC_CIRCLE,ADDRESSES.null,] // meson eth usdc and usdt
}),
},
merlin: { //meson merlin
tvl: async (api) => {
const ownerTokens = [];
const { tokens } = config.merlin;
if (tokens) ownerTokens.push([tokens, defaultOwner]);
//await addCoinfg('merlin', ownerTokens);
return sumTokens2({ api, ownerTokens });
}
},
};


// Excluding merlin tvl as it feels inorganic
delete module.exports.merlin

0 comments on commit c6f27b8

Please sign in to comment.