File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1+ const FOREST_TOKEN = '0x11cf6bf6d87cb0eb9c294fd6cbfec91ee3a1a7d0'
2+ const V2_FACTORY = '0x8ad812a372b4c5aa1fc478b720f2adad42002f81'
3+
4+ async function getV2Pairs ( api ) {
5+ const raw = await api . fetchList ( { lengthAbi : 'uint256:allPairsLength' , itemAbi : 'function allPairs(uint256) view returns (bytes32)' , target : V2_FACTORY } )
6+ return raw . map ( r => '0x' + r . slice ( - 40 ) )
7+ }
8+
9+ async function tvl ( api ) {
10+ const pairs = await getV2Pairs ( api )
11+ const [ token0s , token1s ] = await Promise . all ( [
12+ api . multiCall ( { abi : 'address:token0' , calls : pairs } ) ,
13+ api . multiCall ( { abi : 'address:token1' , calls : pairs } ) ,
14+ ] )
15+ const tokensAndOwners = [ ]
16+ for ( let i = 0 ; i < pairs . length ; i ++ ) {
17+ if ( token0s [ i ] . toLowerCase ( ) !== FOREST_TOKEN ) tokensAndOwners . push ( [ token0s [ i ] , pairs [ i ] ] )
18+ if ( token1s [ i ] . toLowerCase ( ) !== FOREST_TOKEN ) tokensAndOwners . push ( [ token1s [ i ] , pairs [ i ] ] )
19+ }
20+ await api . sumTokens ( { tokensAndOwners } )
21+ }
22+
23+ async function staking ( api ) {
24+ const pairs = await getV2Pairs ( api )
25+ await api . sumTokens ( { owners : pairs , tokens : [ FOREST_TOKEN ] } )
26+ }
27+
28+ module . exports = {
29+ bsc : { tvl, staking } ,
30+ }
Original file line number Diff line number Diff line change @@ -2853,7 +2853,13 @@ const uniV2Configs = {
28532853 'qie-dex' : {
28542854 start : '2025-08-05' ,
28552855 qiev3 : '0x8E23128a5511223bE6c0d64106e2D4508C08398C'
2856- }
2856+ } ,
2857+ 'forest-v1' : {
2858+ bsc : {
2859+ factory : '0x9d5ef0f61a5e88d90fb231f84413b5fc43bf6a9e' ,
2860+ staking : [ '0xb6C6B8bF9d415E2D91B95134800De146Dcc5dc94' , '0x11cf6bf6d87cb0eb9c294fd6cbfec91ee3a1a7d0' ] ,
2861+ } ,
2862+ } ,
28572863}
28582864
28592865module . exports = buildProtocolExports ( uniV2Configs , uniV2ExportFn )
You can’t perform that action at this time.
0 commit comments