Skip to content

Commit 2e60b7e

Browse files
authored
[UPDATE] BMX by Morphex: Add TVL tracking for staking and Mode network; Add tracking for Freestyle on Base (DefiLlama#11041)
* Add Mode, staking, and add Freestyle separately * Update index.js
1 parent 9f1af43 commit 2e60b7e

File tree

2 files changed

+65
-4
lines changed

2 files changed

+65
-4
lines changed

projects/bmx/index.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
const { staking } = require("../helper/staking");
22
const { gmxExports } = require("../helper/gmx");
3-
const sdk = require('@defillama/sdk')
43

5-
const vaultAddress = "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C";
4+
const vaultAddresses = {
5+
base: "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C",
6+
mode: "0xff745bdB76AfCBa9d3ACdCd71664D4250Ef1ae49"
7+
};
8+
const stakingAddresses = {
9+
base: "0x3085F25Cbb5F34531229077BAAC20B9ef2AE85CB",
10+
mode: "0x773F34397d5F378D993F498Ee646FFe4184E00A3"
11+
};
12+
const tokenAddresses = {
13+
base: "0x548f93779fBC992010C07467cBaf329DD5F059B7",
14+
mode: "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"
15+
};
616

717
module.exports = {
8-
methodology: "BMX liquidity is calculated by the value of tokens in the BLT pool.",
18+
methodology: "BMX Classic liquidity is calculated by the value of tokens in the BLT/MLT pool. TVL also includes BMX staked.",
919
base: {
10-
tvl: gmxExports({ vault: vaultAddress })
20+
tvl: gmxExports({ vault: vaultAddresses.base }),
21+
staking: staking(stakingAddresses.base, tokenAddresses.base)
1122
},
23+
mode: {
24+
tvl: gmxExports({ vault: vaultAddresses.mode }),
25+
staking: staking(stakingAddresses.mode, tokenAddresses.mode)
26+
}
1227
};

projects/freestyle/index.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const ADDRESSES = require('../helper/coreAssets.json')
2+
const { request, } = require("graphql-request");
3+
4+
const freestyleConfig = {
5+
base: {
6+
token: ADDRESSES.base.USDC,
7+
start: 1700006400,
8+
graphUrl: "https://api.studio.thegraph.com/query/62454/analytics_base_8_2/version/latest",
9+
accountSource: '0x6D63921D8203044f6AbaD8F346d3AEa9A2719dDD'
10+
},
11+
}
12+
13+
async function tvl(api) {
14+
const { token, graphUrl, start, accountSource } = freestyleConfig[api.chain]
15+
16+
const query = `
17+
query stats($from: String!, $to: String!) {
18+
dailyHistories(
19+
where: {
20+
timestamp_gte: $from
21+
timestamp_lte: $to
22+
accountSource: "${accountSource}"
23+
}
24+
) {
25+
timestamp
26+
platformFee
27+
accountSource
28+
tradeVolume
29+
deposit
30+
withdraw
31+
}
32+
}
33+
`
34+
const { dailyHistories } = await request(graphUrl, query, {
35+
from: start.toString(),
36+
to: api.timestamp.toString(),
37+
});
38+
39+
let total = dailyHistories.reduce((acc, cur) => acc + (Number(cur.deposit) - Number(cur.withdraw)), 0);
40+
41+
api.add(token, total)
42+
}
43+
44+
Object.keys(freestyleConfig).forEach(chain => {
45+
module.exports[chain] = { tvl }
46+
})

0 commit comments

Comments
 (0)