1- const { staking } = require ( "../helper/staking" ) ;
1+ const { sumTokens2 } = require ( "../helper/unwrapLPs" ) ;
2+ const ADDRESSES = require ( "../helper/coreAssets.json" ) ;
23
4+ // tokens addresses
5+ const LBGT_ADDRESS = "0xBaadCC2962417C01Af99fb2B7C75706B9bd6Babe" ;
6+ const PBERA_ADDRESS = "0xDeadf18CB9233770FE8874c78D7483b4A126B34a" ;
7+ const SWBERA_ADDRESS = "0x118D2cEeE9785eaf70C15Cd74CD84c9f8c3EeC9a" ;
8+ const BGT_ADDRESS = "0x656b95E550C07a9ffe548bd4085c72418Ceb1dba" ;
9+
10+ // forge addresses
11+ const BERAPAW_FORGE_ADDRESS = "0xFeedb9750d6ac77D2E52e0C9EB8fB79F9de5Cafe" ;
12+ const BERAPAW_STAKER = "0x4b1d14c4fEA305c4144b51ee64141567A0F0B00B" ;
13+
14+ // staking vaults
315const STAKED_LBGT_VAULT = "0xFace73a169e2CA2934036C8Af9f464b5De9eF0ca" ;
16+ const STAKED_PBERA_VAULT = "0xE3e61dBb030998110b91c0D1de8215DB761F52c6" ;
17+
18+ // LP staking
419const BERACHAIN_REWARD_VAULT_WBERA_LBGT_LP = "0xE8ED00B1B142E8D84eF773C4FCcaA18682d5a401" ;
520const LP_REWARD_VAULT = "0xa77dee7bc36c463bB3E39804c9C7b13427D712B0" ;
6- const LBGT_ADDRESS = "0xBaadCC2962417C01Af99fb2B7C75706B9bd6Babe" ;
721
22+
23+ // counts total supply of LBGT and pBERA tokens
24+ async function tvl ( api ) {
25+ // check BGT balance in BeraPaw Forge (LBGT backing)
26+ await sumTokens2 ( {
27+ owner : BERAPAW_FORGE_ADDRESS ,
28+ tokens : [ BGT_ADDRESS ] ,
29+ api,
30+ } ) ;
31+
32+ // check BERA, WBERA and swBERA balance in BERAPAW_STAKER (pBERA backing)
33+ await sumTokens2 ( {
34+ owner : BERAPAW_STAKER ,
35+ tokens : [
36+ ADDRESSES . null , // BERA (native token)
37+ ADDRESSES . berachain . WBERA , // WBERA
38+ SWBERA_ADDRESS , // swBERA
39+ ] ,
40+ api,
41+ } ) ;
42+ }
43+
44+ // counts WBERA-LBGT LP tokens
845async function pool2 ( api ) {
946 // WBERA-LBGT LP TVL
1047 const stakedLP = await api . call ( {
@@ -16,15 +53,14 @@ async function pool2(api) {
1653 target : BERACHAIN_REWARD_VAULT_WBERA_LBGT_LP ,
1754 abi : 'address:stakeToken' ,
1855 } ) ;
56+
1957 api . add ( lpAddress , stakedLP ) ;
2058}
2159
22-
2360module . exports = {
24- methodology : 'TVL includes staked LBGT and WBERA-LBGT LP tokens' ,
61+ methodology : 'TVL includes staked LBGT and pBERA tokens, plus WBERA-LBGT LP tokens' ,
2562 berachain : {
63+ tvl,
2664 pool2,
27- staking : staking ( STAKED_LBGT_VAULT , LBGT_ADDRESS , "berachain" ) ,
28- tvl : ( async ) => ( { } ) ,
2965 } ,
3066} ;
0 commit comments