1
1
const ADDRESSES = require ( '../helper/coreAssets.json' )
2
- const sdk = require ( "@defillama/sdk" ) ;
3
2
4
3
const readerAbi = require ( "./reader.json" ) ;
5
4
const mvlpManagerAbi = require ( "./mvlpManager.json" ) ;
6
5
const { staking } = require ( "../helper/staking" ) ;
7
- const { sumTokens2 } = require ( '../helper/unwrapLPs' ) ;
8
- const { default : BigNumber } = require ( "bignumber.js" ) ;
6
+ const { sumTokensExport } = require ( '../helper/unwrapLPs' ) ;
9
7
10
8
const DAI_ADDRESS = ADDRESSES . ethereum . DAI ;
11
9
const USDC_ADDRESS = ADDRESSES . ethereum . USDC ;
12
10
const MVLP_ADDRESS = "0x9F4f8bc00F48663B7C204c96b932C29ccc43A2E8" ;
13
- const MVLP_DECIMALS = 18 ;
14
11
15
12
const REDEEM_CONTRACT = "0xd15C4677A81Ac9d744a01ecaAad684E6d296b8f3" ;
16
13
const GOV_CLUB_CONTRACT = "0x12fc8b560925166c39E85c70E9fD4058Ca9e11c9" ;
@@ -23,65 +20,41 @@ const READER_CONTRACT = "0x01dd8B434A83cbdDFa24f2ef1fe2D6920ca03734"; // getToke
23
20
24
21
const stakingAddress = "0x42162457006DB4DA3a7af5B53DFee5A891243b4D" ; // Governance Staking
25
22
const stakingTokenAddress = "0x788B6D2B37Aa51D916F2837Ae25b05f0e61339d1" ; // MVD
26
- const ADDRESS_ZERO = ADDRESSES . null ;
27
23
28
- async function getTvl ( timestamp , block ) {
29
- const toa = [
30
- [ DAI_ADDRESS , REDEEM_CONTRACT , ] ,
31
- [ USDC_ADDRESS , GOV_CLUB_CONTRACT , ] ,
32
- ]
24
+ const mvdStakingAddressArbitrum = "0xFA69292726A53d62111c9485C03ac551Ba05679b" ; // gMVD Staking
25
+ const mvdTokenAddressArbitrum = "0x15a808ed3846D25e88AE868DE79F1bcB1Ac382B5" ; // MVD
33
26
34
- return sumTokens2 ( { tokensAndOwners : toa , block } )
35
- }
27
+ const ADDRESS_ZERO = ADDRESSES . null ;
36
28
37
- async function polygon ( _ , _b , { polygon : block } ) {
38
- const chain = 'polygon'
39
29
30
+ async function polygon ( api ) {
40
31
// Metavault DAO MVLP Holdings
41
- const aums = (
42
- await sdk . api . abi . call ( {
43
- target : MVLP_MANAGER_CONTRACT ,
44
- abi : mvlpManagerAbi . getAums ,
45
- chain, block,
46
- } )
47
- ) . output ;
48
-
49
- const averageAums = ( + aums [ 0 ] + + aums [ 1 ] ) / 2
50
-
51
- const supplies = (
52
- await sdk . api . abi . call ( {
53
- target : READER_CONTRACT ,
54
- params : [ ADDRESS_ZERO , [ MVLP_ADDRESS ] ] ,
55
- chain, block,
56
- abi : readerAbi . getTokenBalancesWithSupplies ,
57
- } )
58
- ) . output ;
59
-
32
+ const aums = await api . call ( { target : MVLP_MANAGER_CONTRACT , abi : mvlpManagerAbi . getAums , } )
33
+ const supplies = await api . call ( { target : READER_CONTRACT , params : [ ADDRESS_ZERO , [ MVLP_ADDRESS ] ] , abi : readerAbi . getTokenBalancesWithSupplies , } )
34
+ const metavaultDaoMvlpHoldings = await api . call ( { abi : 'erc20:balanceOf' , target : MVLP_TRACKER_CONTRACT , params : MVD_DAO_MULTI_SIG_WALLET , } )
35
+
60
36
const mvlpSupply = supplies [ 1 ] ;
61
-
37
+ const averageAums = ( + aums [ 0 ] + + aums [ 1 ] ) / 2
62
38
const mvlpPrice = averageAums / mvlpSupply
63
-
64
- const metavaultDaoMvlpHoldings = (
65
- await sdk . api . erc20 . balanceOf ( {
66
- chain, block,
67
- target : MVLP_TRACKER_CONTRACT ,
68
- owner : MVD_DAO_MULTI_SIG_WALLET ,
69
- } )
70
- ) . output ;
71
-
72
- const daoMvlpHoldingsValue = metavaultDaoMvlpHoldings * mvlpPrice ;
73
-
74
- const sum = BigNumber ( daoMvlpHoldingsValue / 1e24 ) . toFixed ( 0 ) ;
75
-
76
- return {
77
- [ USDC_ADDRESS ] : sum ,
78
- } ;
39
+ const daoMvlpHoldingsValue = metavaultDaoMvlpHoldings * mvlpPrice / 1e30
40
+ api . addUSDValue ( daoMvlpHoldingsValue )
79
41
}
80
42
81
43
module . exports = {
44
+ hallmarks : [
45
+ [ 1676592000 , "Launch on Arbitrum" ]
46
+ ] ,
82
47
misrepresentedTokens : true ,
48
+ arbitrum : {
49
+ staking : staking ( mvdStakingAddressArbitrum , mvdTokenAddressArbitrum , ) ,
50
+ } ,
83
51
ethereum : {
84
- tvl : getTvl ,
52
+ tvl : sumTokensExport ( {
53
+ tokensAndOwners : [
54
+ [ DAI_ADDRESS , REDEEM_CONTRACT , ] ,
55
+ [ USDC_ADDRESS , GOV_CLUB_CONTRACT , ] ,
56
+ ]
57
+ } ) ,
85
58
staking : staking ( stakingAddress , stakingTokenAddress , ) ,
86
59
} ,
87
60
polygon : {
0 commit comments