Skip to content

Commit ad7f568

Browse files
Merge branch 'DefiLlama:main' into main
2 parents 4da4f0e + d78d5ad commit ad7f568

File tree

524 files changed

+10781
-10202
lines changed

Some content is hidden

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

524 files changed

+10781
-10202
lines changed

pnpm-lock.yaml

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

projects/0xRoulette/index.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const { Connection, PublicKey } = require('@solana/web3.js');
2+
3+
const PROGRAM_ID = "Rou1svrgkcuo1rBNkP1XaESrD9xRpukx2uLY5MsgK14";
4+
const VAULT_ACCOUNT_SIZE = 120;
5+
const VAULT_DISCRIMINATOR = Buffer.from('e6fbf1538bca5d1c', 'hex');
6+
7+
function decodeVaultAccount(data) {
8+
const tokenMintBuffer = data.slice(0, 32);
9+
const totalLiquidity = data.readBigUInt64LE(64);
10+
11+
const tokenMint = new PublicKey(tokenMintBuffer).toString();
12+
13+
return {
14+
tokenMint,
15+
totalLiquidity: totalLiquidity.toString(),
16+
};
17+
}
18+
19+
async function tvl(_, _2, _3, { api }) {
20+
const connection = new Connection("https://api.mainnet-beta.solana.com");
21+
const programId = new PublicKey(PROGRAM_ID);
22+
23+
const accounts = await connection.getProgramAccounts(programId, {
24+
filters: [{ dataSize: VAULT_ACCOUNT_SIZE }],
25+
});
26+
27+
for (const { account } of accounts) {
28+
if (account.data.slice(0, 8).equals(VAULT_DISCRIMINATOR)) {
29+
const decoded = decodeVaultAccount(account.data.slice(8));
30+
api.add(decoded.tokenMint, decoded.totalLiquidity);
31+
}
32+
}
33+
}
34+
35+
module.exports = {
36+
timetravel: false,
37+
misrepresentedTokens: false,
38+
methodology:
39+
"TVL is calculated by fetching all program accounts using @solana/web3.js. " +
40+
"Filters for vaults by account size (120 bytes) and discriminator. " +
41+
"Raw token balances are passed to the SDK for USD conversion.",
42+
solana: {
43+
tvl,
44+
},
45+
};

projects/1776meme/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json')
22
const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs')
33

44
const config = {
5-
ethereum: { contract: '0xDFcB2aB25b7978C112E9E08a2c70d52b035F1776', tokens: [nullAddress, ADDRESSES.ethereum.WETH, '0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d'] }
5+
ethereum: { contract: '0xDFcB2aB25b7978C112E9E08a2c70d52b035F1776', tokens: [nullAddress, ADDRESSES.ethereum.WETH, ADDRESSES.bsc.USD1] }
66
}
77

88
Object.keys(config).forEach(chain => {

projects/8lends/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function borrowed(api) {
3434

3535
const tvlApi = new sdk.ChainApi({ chain: api.chain, block: api.block });
3636
await sumTokens2({ api: tvlApi, owner: FUNDRAISING_CONTRACT, tokens });
37-
api.getBalancesV2().subtract(tvlApi.getBalancesV2());
37+
api.getBalancesV2().subtract(tvlApi.getBalances());
3838
}
3939

4040
module.exports = {

projects/Corepilot/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
core: {
3+
tvl: async function tvl(api) {
4+
const totalStaked = await api.call({
5+
target: "0xF7B977d23Fc47736D767fB6AF0595102007a5433",
6+
abi: 'uint256:totalStaked',
7+
});
8+
api.addGasToken(totalStaked);
9+
}
10+
},
11+
12+
}

0 commit comments

Comments
 (0)