Skip to content

Commit

Permalink
Merge branch 'DefiLlama:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hamman247 authored Jan 26, 2025
2 parents 5b5597d + 909dce2 commit 87ba59d
Show file tree
Hide file tree
Showing 449 changed files with 9,646 additions and 4,782 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Please send answers to questions there https://github.com/DefiLlama/DefiLlama-Ad

## Work in progress

This is a work in progress. The goal is to eventually handle historical data. DefiLlama aims to be transparent, accurate and open source.
This is a work in progress. DefiLlama aims to be transparent, accurate and open source.

If you have any suggestions, want to contribute or want to chat, please join [our discord](https://discord.defillama.com/) and drop a message.

Expand All @@ -29,6 +29,8 @@ If you have any suggestions, want to contribute or want to chat, please join [ou
node test.js projects/pangolin/index.js
# Add a timestamp at the end to run the adapter at a historical timestamp
node test.js projects/aave/v3.js 1729080692
# or using YYYY-MM-DD
node test.js projects/aave/v3.js 2024-10-16
```

## Changing RPC providers
Expand All @@ -39,7 +41,7 @@ BSC_RPC="..."
POLYGON_RPC="..."
```

The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://github.com/DefiLlama/defillama-sdk/blob/master/src/providers.json)
The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://unpkg.com/@defillama/sdk@5.0.116/build/providers.json). If you run into issues with a chain make sure to update the sdk with `npm update @defillama/sdk`.

## Adapter rules
- Never add extra npm packages, if you need a chain-level package for your chain, ask us and we'll consider it, but we can't accept any npm package that is project-specific
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"biggest-files": "find ./projects -name '*.js' -not -path './projects/helper/*' -not -path './projects/curve/*' -not -path './projects/sigmao/*' -exec du -sh {} \\; | sort -rh | head -n 100",
"check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js",
"string-timestamp": "node utils/scripts/stringTimestamp.js",
"sort-chains": "node projects/helper/getChainList.js",
"postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' "
},
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion projects/1155Tech/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const MARKET_1155TECH_CONTRACT = '0x33b77fAf955Ed3eDAf939ae66C4D7a2D78bc30C6';
module.exports = {
methodology: 'Value of all Keys across all art markets is TVL in the protocol',
canto: {
tvl: sumTokensExport({ owner: MARKET_1155TECH_CONTRACT, tokens: ['0x4e71a2e537b7f9d9413d3991d37958c0b5e1e503'] })
tvl: sumTokensExport({ owner: MARKET_1155TECH_CONTRACT, tokens: [ADDRESSES.canto.NOTE] })
}
};
16 changes: 16 additions & 0 deletions projects/5ire-dapp-staking/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const STAKING_CONTRACT_V1 = "0xaa137EC3474ab407f3Be37b16576227dfE75Eb8D"
const STAKING_CONTRACT_V2 = "0x83D1B4277454EDAcF54A14fc586326386648A959"
const TOKEN_5IRE_ETH = "0x3bd7d4F524D09F4e331577247A048D56e4b67a7F"
const { stakings } = require("../helper/staking")


module.exports = {
methodology: 'Total staked tokens in 5ire Dapp Staking',
ethereum: {
tvl: () => ({}),
staking: stakings([STAKING_CONTRACT_V1, STAKING_CONTRACT_V2], TOKEN_5IRE_ETH),
},
}



18 changes: 16 additions & 2 deletions projects/CreampanFinance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@ const accounts = Object.values({
account3: 'cro1pduq0ga2ans0sspph6r5hcf77cqypz6de7n64y',
account4: 'cro1fncg0fsr8vt30qaqmzqxunnrkxr6a7xxkfpr7y',
account5: 'cro1hhfh6xaflg8zwhwvrs7sgur2pyfunjqeu8wsd6',
account6: 'cro1a2vawclcntewtjd5jfjf44dr6mdfdyg8xzfe5t',
account7: 'cro1wc43z84u8keas3ffw4ynapwe0hzfen3xx03dpd',
account8: 'cro1ujkwlnfnl3mmka4twqx07azxk6djlplddcn48h',
account9: 'cro16wzuj3a9tdqk9z3edx587athz2kk75gj2l6etk',
account10: 'cro1hfx8t4nldtfk5w6h6eherfts4gtelvcn0dypc3',
})

async function tvl(api) {
const data = await Promise.all(accounts.map(account => queryV1Beta1({ chain: 'cronos', url: `/staking/v1beta1/delegations/${account}`, })));
const factroy_contract_address = '0x66f5997b7810723aceeeb8a880846fc117081bd0';
const data2 = await Promise.all(accounts.map(account => queryV1Beta1({ chain: 'cronos', url: `/staking/v1beta1/delegators/${account}/unbonding_delegations`, })));
const factory_contract_address = '0x66f5997b7810723aceeeb8a880846fc117081bd0';
const factoryV2_contract_address = '0xfd3300b2441072b35554f1043c3d3a413fd5c219';
data.map(i => i.delegation_responses).flat().forEach(i => api.add(ADDRESSES.cronos.WCRO, i.balance.amount * 1e10))
return api.sumTokens({ owner: factroy_contract_address, tokens: [ADDRESSES.cronos.WCRO_1]})

for (let j = 0; j < accounts.length; j++) {
if (Number(data2[j].pagination.total) > 0) {
data2[j].unbonding_responses[0].entries.flat().forEach(i => api.add(ADDRESSES.cronos.WCRO, i.balance * 1e10))
}
}

return api.sumTokens({ owners: [factory_contract_address, factoryV2_contract_address], tokens: [ADDRESSES.cronos.WCRO_1] })
}

module.exports = {
Expand Down
3 changes: 3 additions & 0 deletions projects/Equalizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ module.exports = {
tvl: uniTvlExport("0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
staking: staking("0x8313f3551C4D3984FfbaDFb42f780D0c8763Ce94", "0x3Fd3A0c85B70754eFc07aC9Ac0cbBDCe664865A6"),
},
sonic: {
tvl: uniTvlExport("0xDDD9845Ba0D8f38d3045f804f67A1a8B9A528FcC", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, stablePoolSymbol: 's-'}),
}
}
11 changes: 11 additions & 0 deletions projects/SwapX-algebra/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { uniV3Export } = require("../helper/uniswapV3");

const SWAPX_ALGEBRA_FACTORY = "0x8121a3F8c4176E9765deEa0B95FA2BDfD3016794"

module.exports = uniV3Export({
sonic: {
factory: SWAPX_ALGEBRA_FACTORY,
fromBlock: 1440914,
isAlgebra: true
}
});
9 changes: 9 additions & 0 deletions projects/SwapX-v2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { uniTvlExport } = require("../helper/calculateUniTvl");

module.exports = {
misrepresentedTokens: true,
sonic: {
tvl: uniTvlExport("0x05c1be79d3aC21Cc4B727eeD58C9B2fF757F5663", undefined, undefined, {
}, { useDefaultCoreAssets: true, hasStablePools: true, }),
}
};
47 changes: 22 additions & 25 deletions projects/ZTLN/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,35 @@ query MyQuery {
}
`;

async function getTvl() {
try {
const data = await request(endpoint, query);

const securities = data.securities || [];

let tokens = 0;
const currencyDecimal = 10 ** 18;

securities.forEach(security => {
security.secondaryInvestors.forEach(investor => {
const amt = parseFloat(investor.amount);
tokens += amt / currencyDecimal;
});
});
async function tvl(api) {
const data = await request(endpoint, query);

const price = 100.5;
const tvl = tokens * price;
const securities = data.securities || [];

// console.log("tvl", tvl);
return tvl;
} catch (error) {
console.error("Error fetching TVL:", error);
return 0;
}
let tokens = 0;
const currencyDecimal = 10 ** 18;

securities.forEach(security => {
security.secondaryInvestors.forEach(investor => {
const amt = parseFloat(investor.amount);
tokens += amt / currencyDecimal;
});
});

const price = 100.5;
const tvl = tokens * price
api.addUSDValue(tvl);
}

module.exports = {
timetravel: false,
misrepresentedTokens: true,
methodology: "The value in RWA held by the protocol",
hallmarks: [
[Math.floor(new Date('2025-01-13')/1e3), 'ZTLN is deprecated'],
],
deadFrom: "2025-01-13",
ethereum: {
fetch: getTvl
tvl: () => ({}),
},
fetch: getTvl
};
7 changes: 5 additions & 2 deletions projects/abracadabra/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const {fetchChainExports} = require('../helper/exports')
const {fetchURL} = require('../helper/utils')

const endpoint = "https://analytics.abracadabra.money/api/statistic/tvl"
Expand All @@ -18,10 +17,14 @@ function chainTvl(chain){
}
}

module.exports = fetchChainExports(chainTvl, Object.keys(chainIds))
module.exports.misrepresentedTokens = true;
module.exports.hallmarks = [
[1651881600, "UST depeg"],
[1643245200, "0xSifu revealed as QuadrigaCX founder"],
[1667826000, "FTX collapse, Alameda repays FTT loans"],
]


Object.keys(chainIds).forEach(chain => {
module.exports[chain] = { tvl: chainTvl(chain) }
})
12 changes: 10 additions & 2 deletions projects/accumulated-finance/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const ADDRESSES = require('../helper/coreAssets.json')
const ADDRESSES = require('../helper/coreAssets.json');
const { sumTokens2 } = require('../helper/unwrapLPs');

const config = {
"accumulate": [
Expand Down Expand Up @@ -70,6 +71,13 @@ const config = {
}
}
],
"artela": [
{
"artela": {
"LST": "0xcba2aeec821b0b119857a9ab39e09b034249681a"
},
}
],
"stETH": [
{
"ethereum": {
Expand Down Expand Up @@ -115,7 +123,7 @@ Object.entries(transformedConfig).forEach(([chain, configs]) => {
totalSupply += parseInt(supply, 10);
api.add(token ?? baseToken ?? ADDRESSES.null, supply, { skipChain: !!baseToken })
}
return api.getBalances();
return sumTokens2({ api })
},
}
})
3 changes: 3 additions & 0 deletions projects/aelin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ function pool2TVL(chain) {
}

module.exports = {
hallmarks : [
[1702598400, "Frontend was shut down"]
],
ethereum: {
tvl: tvl('ethereum'),
pool2: pool2TVL('ethereum'),
Expand Down
4 changes: 2 additions & 2 deletions projects/airpuff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ module.exports = {

const weETH = {
vault: "0x5e0a74cb0F74D57F9d69914575b972ba6A14e27c",
reStakingToken: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
reStakingToken: ADDRESSES.ethereum.WEETH,
oracle: "0x6869f88582D049B9968A0Ef7bFCA2609D5F0123B",
};

Expand All @@ -255,7 +255,7 @@ module.exports = {

const weETH1x = {
vault: "0x9320AB04E319018842BD59e2817054d19850Abc0",
reStakingToken: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
reStakingToken: ADDRESSES.ethereum.WEETH,
oracle: "0x6869f88582D049B9968A0Ef7bFCA2609D5F0123B",
};

Expand Down
12 changes: 7 additions & 5 deletions projects/alexar/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const { getConfig } = require('../helper/cache')
const { sumTokens } = require('../helper/sumTokens')

const blacklistedAssets = ['uaxl'];

const chainMapping = {
avax: 'avalanche',
cosmos: 'cosmoshub',
Expand All @@ -11,9 +9,12 @@ const chainMapping = {
};

const blackListChains = ['comdex', 'crescent'];
const chainListSupply = ['juno', 'cosmos', 'carbon', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2'];
const chainListSupply = ['juno', 'cosmos', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2'];
const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', 'mantle', 'ethereum', 'base'];

const blacklistedTokensChain = {
ethereum: ['0x946fb08103b400d1c79e07acCCDEf5cfd26cd374'], // KIP tvl is higher than the circulating supply
}

chainListSupply.concat(chainListTotal).forEach(chain => {
if (blackListChains.includes(chain)) {
Expand All @@ -25,6 +26,7 @@ chainListSupply.concat(chainListTotal).forEach(chain => {
const config = await getConfig('alexar', 'https://api.axelarscan.io/api/getTVL')
const tokensAndOwners = []
const owners = []
const blacklistedTokens = blacklistedTokensChain[chain] || []
const mappedChain = chainMapping[chain] || chain;
config.data.forEach(({ tvl: { [mappedChain]: assetTvl } = {} }) => {
if (!assetTvl) return;
Expand All @@ -42,8 +44,8 @@ chainListSupply.concat(chainListTotal).forEach(chain => {
}
})
if (tokensAndOwners.length > 0)
return api.sumTokens({ tokensAndOwners })
return sumTokens({ chain, owners })
return api.sumTokens({ tokensAndOwners, blacklistedTokens })
return sumTokens({ chain, owners, blacklistedTokens, })
}
});

Expand Down
Loading

0 comments on commit 87ba59d

Please sign in to comment.