Skip to content

Commit 379beac

Browse files
authored
Merge branch 'DefiLlama:main' into main
2 parents 6c380d8 + 4aa5ed4 commit 379beac

File tree

1,572 files changed

+7292
-8017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,572 files changed

+7292
-8017
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"treasury": "cd utils;npm i; cd ..; node utils/testInteractive treasury",
1515
"entities": "cd utils;npm i; cd ..; node utils/testInteractive entities",
1616
"useTokenLabels": "node utils/scripts/useTokenLabels.js",
17+
"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",
1718
"postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' "
1819
},
1920
"author": "",

projects/0xDAO/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const xTAROT = "0x74D1D2A851e339B8cB953716445Be7E8aBdf92F4"
2222

2323
const fBEET = "0xfcef8a994209d6916EB2C86cDD2AFD60Aa6F54b1"
2424

25-
async function tvl(time, ethBlock, chainBlocks) {
25+
async function tvl(_, __, chainBlocks) {
2626
// 0xDAO Master Chef
2727
const balances = {}
2828
const chain = 'fantom'

projects/0x_nodes/index.js

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,57 @@
1-
const ADDRESSES = require('../helper/coreAssets.json')
2-
const { GraphQLClient, gql } = require('graphql-request')
3-
const { getBlock } = require('../helper/http')
41
const { staking } = require('../helper/staking')
5-
const sdk = require('@defillama/sdk')
62

73
const CONFIG = {
84
ethereum: {
9-
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11',
10-
strategy_token: ADDRESSES.ethereum.WETH, //wETH
115
bios_token: '0xAACa86B876ca011844b5798ECA7a67591A9743C8',
126
kernel_addr: '0xcfcff4eb4799cda732e5b27c3a36a9ce82dbabe0'
137
},
148
bsc: {
15-
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-bsc',
16-
strategy_token: '0x418D75f65a02b3D53B2418FB8E1fe493759c7605', //wBNB
179
bios_token: '0xcf87d3d50a98a7832f5cfdf99ae1b88c7cfba4a7',
1810
kernel_addr: '0x37c12de5367fa61ad05e2bf2d032d7ce5dd31793'
1911
},
2012
polygon: {
21-
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-polygon',
22-
strategy_token: ADDRESSES.ethereum.MATIC, //wMATIC
2313
bios_token: '0xe20d2df5041f8ed06976846470f727295cdd4d23',
2414
kernel_addr: '0x267720b5d8dcbdb847fc333ccc68cb284648b816'
2515
},
2616
fantom: {
27-
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-fantom',
28-
strategy_token: ADDRESSES.ethereum.FTM, //wFTM
2917
bios_token: '0x75e0eb8e6d92ab832bb11e46c041d06a89ac5f0d',
3018
kernel_addr: '0x9db0e84ea53c5a3c000a721bb4295a6053b3de78'
3119
},
3220
avax: {
33-
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-avalanche',
34-
strategy_token: '0x85f138bfEE4ef8e540890CFb48F620571d67Eda3', //wAVAX
3521
bios_token: '0xd7783a275e53fc6746dedfbad4a06059937502a4',
3622
kernel_addr: '0x479ea3715682e6255234e788875bdbded6faae41'
3723
},
3824
metis: {
39-
uri: 'https://andromeda-graph.metis.io/subgraphs/name/0xnodes/System11-metis',
40-
strategy_token: '0x9E32b13ce7f2E80A01932B42553652E053D6ed8e', //METIS
4125
bios_token: '0x3405a1bd46b85c5c029483fbecf2f3e611026e45',
4226
kernel_addr: '0xa1DA47F6563e7B17075FcA61DeDC4622aE2F3912'
4327
},
4428
}
45-
function offset(chain) {
46-
switch (chain) {
47-
case 'ethereum':
48-
return 110
49-
case 'bsc':
50-
return 600
51-
case 'polygon':
52-
return 750
53-
case 'fantom':
54-
return 1500
55-
case 'metis':
56-
return 500
57-
case 'avax':
58-
return 750
59-
}
60-
}
61-
function chainTvl(chain) {
62-
return async (timestamp, ethBlock, chainBlocks) => {
63-
if (timestamp > 1659527340) return {}
64-
const { [chain]:{ uri }} = CONFIG
65-
const { [chain]:{ strategy_token }} = CONFIG
66-
var graphQLClient = new GraphQLClient(uri)
67-
const block = (await getBlock(timestamp, chain, chainBlocks)) - offset(chain)
68-
var query = gql`{strategyTokenBalances(block: {number: `+block+`}){amount}}`
69-
const results = await graphQLClient.request(query)
70-
let amount = 0
71-
for (let i = 0; i < results.strategyTokenBalances.length; i++) { //loop through the array
72-
amount += Number(results.strategyTokenBalances[i].amount); //Do the math!
73-
}
74-
const balances = {}
75-
sdk.util.sumSingleBalance(balances, strategy_token, amount)
76-
return balances
77-
}
78-
}
29+
7930
function stakingTvl(chain) {
8031
const { [chain]:{ bios_token }} = CONFIG
8132
const { [chain]:{ kernel_addr }} = CONFIG
82-
return staking(kernel_addr, bios_token, chain)
33+
return staking(kernel_addr, bios_token)
8334
}
84-
function chainExports(chainTvl, stakingTvl, chains){
35+
36+
function chainExports(chains){
8537
const chainTvls = chains.reduce((obj, chain) => ({
8638
...obj,
8739
[chain]: {
88-
tvl:chainTvl(chain),
40+
tvl: () => ({}),
8941
staking: stakingTvl(chain)
9042
}
9143
}), {})
9244
return chainTvls
9345
}
94-
const tvlExports = chainExports(chainTvl, stakingTvl , ['ethereum', 'bsc', 'polygon', 'fantom', 'metis', 'avax'])
46+
const tvlExports = chainExports(['ethereum', 'bsc', 'polygon', 'fantom', 'metis', 'avax'])
9547
module.exports = {
9648
hallmarks: [
9749
[1659527340, "Protocol declared insolvent"],
9850
],
9951
methodology: ` Counts the number of wrapped native tokens in all yield strategies across all the chains the protocol is deployed on
10052
+ staking counts the number of BIOS tokens staked in the kernels across all the chains (PFA: Protocol Fee Accruals by staking assets)`,
10153
start: 1633046400, // Friday 1. October 2021 00:00:00 GMT
102-
...tvlExports
54+
...tvlExports,
55+
deadFrom: 1659527340,
10356
}
10457

projects/1beam/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Contracts = {
99
}
1010
}
1111

12-
const moonbeamTvl = async (timestamp, ethBlock, chainBlocks, { api }) => {
12+
const moonbeamTvl = async (api) => {
1313
const pools = Object.values(Contracts.moonbeam.pools)
1414
const tokens = await api.multiCall({ abi: Abis.getTokens, calls: pools })
1515
const bals = await api.multiCall({ abi: Abis.getTokenBalances, calls: pools })

projects/1inch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {}
88
Object.keys(config).forEach(chain => {
99
const { blacklistedTokens = [], factories } = config[chain]
1010
module.exports[chain] = {
11-
tvl: async (_, _b, _2, { api }) => {
11+
tvl: async (api) => {
1212
const ownerTokens = []
1313
for (const { MooniswapFactory, fromBlock} of factories) {
1414
const logs = await getLogs({

projects/1swap/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Contracts = {
1616
};
1717

1818

19-
const tvl = async (timestamp, ethBlock, chainBlocks, { api }) => {
19+
const tvl = async (api) => {
2020
const ownerTokens = []
2121
const poolTvl = async (pool) => {
2222
ownerTokens.push([await api.call({ target: pool, abi: abiMoonriver.getTokens, }), pool])

projects/3a-dao/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ const { getLogs } = require('../helper/cache/getLogs')
22

33
const config = {
44
polygon: { factory: '0x4760847023fa0833221ae76E01Db1E483A5D20e0', fromBlock: 49852705 },
5+
linea: { factory: '0x65c6FD9B3a2A892096881e28f07c732ed128893E', fromBlock: 3045954 },
56
}
67

78
Object.keys(config).forEach(chain => {
89
const { factory, fromBlock, } = config[chain]
910
module.exports[chain] = {
10-
tvl: async (_, _b, _cb, { api, }) => {
11+
tvl: async (api) => {
1112
const logs = await getLogs({
1213
api,
1314
target: factory,
@@ -16,7 +17,7 @@ Object.keys(config).forEach(chain => {
1617
fromBlock,
1718
})
1819
const vaults = logs.map(log => log.vault)
19-
const tokens = await api.multiCall({ abi: 'address[]:collaterals', calls: vaults})
20+
const tokens = await api.multiCall({ abi: 'address[]:collaterals', calls: vaults })
2021
const ownerTokens = tokens.map((token, i) => [token, vaults[i]])
2122
return api.sumTokens({ ownerTokens })
2223
}

projects/3fmutual/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { sumTokensExport } = require("../helper/unwrapLPs");
2+
3+
const tokens = require("../helper/coreAssets.json");
4+
5+
const TOKENS = [
6+
tokens.null,
7+
];
8+
9+
const ethereumContract = [
10+
"0x66be1bc6C6aF47900BBD4F3711801bE6C2c6CB32",
11+
];
12+
13+
module.exports = {
14+
ethereum: { tvl: sumTokensExport({ owners: ethereumContract, tokens: TOKENS }) }
15+
};

projects/3xcalibur/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ const { uniTvlExport } = require("../helper/calculateUniTvl.js");
22

33
module.exports = {
44
misrepresentedTokens: true,
5-
timetravel: true,
6-
start: 1667689200,
5+
start: 1667689200,
76
arbitrum: {
87
tvl: uniTvlExport("0xD158bd9E8b6efd3ca76830B66715Aa2b7Bad2218", "arbitrum", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
98
},

0 commit comments

Comments
 (0)