Skip to content

Commit dabf061

Browse files
Adding PumpBase (#16766)
1 parent 9032855 commit dabf061

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

projects/PumpBase/index.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const { getLogs } = require('../helper/cache/getLogs')
2+
3+
const FACTORY = '0x19798E390E69a36814B25BbBC7e75530E8a0A101'
4+
const WETH = '0x4200000000000000000000000000000000000006'
5+
const INITIAL_LIQUIDITY = 1500_000_000_000_000_000n
6+
7+
const abi = {
8+
bondingCurveMap: "function bondingCurveMap(address) view returns (address)",
9+
getReserves: "function getReserves() view returns (uint256 _reserveEth, uint256 _reserveToken)",
10+
Deployed: "event Deployed(address indexed token, address indexed bondingCurve, address indexed creator, uint256 timestamp)",
11+
}
12+
13+
async function tvl(api) {
14+
const logs = await getLogs({
15+
api,
16+
target: FACTORY,
17+
topics: ['0x0aca3d0708cc06a2b4b4bedc6fe1b5febc7f70a1c413ac1fb594bc32c911df16'],
18+
fromBlock: 36935850,
19+
})
20+
21+
if (logs.length === 0) return
22+
23+
const allTokens = logs.map(log => `0x${log.topics[1].slice(26)}`).map(token => token.toLowerCase())
24+
const tokens = [...new Set(allTokens)]
25+
26+
const bondingCurves = await api.multiCall({ abi: abi.bondingCurveMap, calls: tokens, target: FACTORY })
27+
const reserves = await api.multiCall({ abi: abi.getReserves, calls: bondingCurves })
28+
29+
let totalEth = 0n
30+
31+
reserves.forEach(([reserveEth, reserveToken], i) => {
32+
const actualEth = BigInt(reserveEth) - INITIAL_LIQUIDITY
33+
if (actualEth > 0n) {
34+
totalEth += actualEth
35+
}
36+
api.add(tokens[i], reserveToken)
37+
})
38+
39+
if (totalEth > 0n) {
40+
api.add(WETH, totalEth)
41+
}
42+
}
43+
44+
module.exports = {
45+
methodology: 'Counts ETH and tokens locked in bonding curves. ETH reserves are calculated by subtracting the fake initial liquidity (1.5 ETH) from the total reserves.',
46+
start: 1750043447,
47+
base: { tvl }
48+
}

0 commit comments

Comments
 (0)