Skip to content

Commit 9d1dab3

Browse files
g1nt0ki0xrmvdao
andauthored
Metavault (DefiLlama#12022)
Co-authored-by: 0xR <[email protected]>
1 parent 45cb1e7 commit 9d1dab3

File tree

3 files changed

+32
-53
lines changed

3 files changed

+32
-53
lines changed

projects/kinetix/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
const { gmxExports } = require('../helper/gmx')
2+
const { staking } = require('../helper/staking');
3+
4+
const KAI_ADDRESS_KAVA = "0x52369B1539EA8F4e1eadEEF18D85462Dcf9a3658"
5+
const veKAI_ADDRESS_KAVA = "0x2A0A26D08E2F7A8E86431Ddf6910Fe7cD59b9908"
26

37
module.exports = {
48
kava: {
5-
tvl: gmxExports({ vault: "0xa721f9f61CECf902B2BCBDDbd83E71c191dEcd8b", })
9+
tvl: gmxExports({ vault: "0xa721f9f61CECf902B2BCBDDbd83E71c191dEcd8b", }),
10+
staking: staking(veKAI_ADDRESS_KAVA, KAI_ADDRESS_KAVA),
611
},
712
};

projects/metavault.trade/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { staking } = require("../helper/staking");
44
const polygonVault = "0x32848E2d3aeCFA7364595609FB050A301050A6B4";
55
const polygonStaking = "0xE8e2E78D8cA52f238CAf69f020fA961f8A7632e9"; // Staked MVX, sMVX
66
const polygonMVX = "0x2760e46d9bb43dafcbecaad1f64b93207f9f0ed7";
7+
const polygonMvxVester = "0x543e07eb4a260e10310fbcf2403e97c762a8db0b" // New Vester
78

89
const polygonTVL = async (api) => {
910
const tokens = await api.fetchList({ lengthAbi: abi.allWhitelistedTokensLength, itemAbi: abi.allWhitelistedTokens, target: polygonVault})
@@ -12,7 +13,7 @@ const polygonTVL = async (api) => {
1213

1314
module.exports = {
1415
polygon: {
15-
staking: staking(polygonStaking, polygonMVX),
16+
staking: staking([polygonStaking, polygonMvxVester], polygonMVX, ),
1617
tvl: polygonTVL,
1718
},
1819
};

projects/metavault/index.js

Lines changed: 24 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
const ADDRESSES = require('../helper/coreAssets.json')
2-
const sdk = require("@defillama/sdk");
32

43
const readerAbi = require("./reader.json");
54
const mvlpManagerAbi = require("./mvlpManager.json");
65
const { staking } = require("../helper/staking");
7-
const { sumTokens2 } = require('../helper/unwrapLPs');
8-
const { default: BigNumber } = require("bignumber.js");
6+
const { sumTokensExport } = require('../helper/unwrapLPs');
97

108
const DAI_ADDRESS = ADDRESSES.ethereum.DAI;
119
const USDC_ADDRESS = ADDRESSES.ethereum.USDC;
1210
const MVLP_ADDRESS = "0x9F4f8bc00F48663B7C204c96b932C29ccc43A2E8";
13-
const MVLP_DECIMALS = 18;
1411

1512
const REDEEM_CONTRACT = "0xd15C4677A81Ac9d744a01ecaAad684E6d296b8f3";
1613
const GOV_CLUB_CONTRACT = "0x12fc8b560925166c39E85c70E9fD4058Ca9e11c9";
@@ -23,65 +20,41 @@ const READER_CONTRACT = "0x01dd8B434A83cbdDFa24f2ef1fe2D6920ca03734"; // getToke
2320

2421
const stakingAddress = "0x42162457006DB4DA3a7af5B53DFee5A891243b4D"; // Governance Staking
2522
const stakingTokenAddress = "0x788B6D2B37Aa51D916F2837Ae25b05f0e61339d1"; // MVD
26-
const ADDRESS_ZERO = ADDRESSES.null;
2723

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
3326

34-
return sumTokens2({ tokensAndOwners: toa, block })
35-
}
27+
const ADDRESS_ZERO = ADDRESSES.null;
3628

37-
async function polygon(_, _b, { polygon: block }) {
38-
const chain = 'polygon'
3929

30+
async function polygon(api) {
4031
// 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+
6036
const mvlpSupply = supplies[1];
61-
37+
const averageAums = (+aums[0] + +aums[1]) / 2
6238
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)
7941
}
8042

8143
module.exports = {
44+
hallmarks: [
45+
[1676592000, "Launch on Arbitrum"]
46+
],
8247
misrepresentedTokens: true,
48+
arbitrum: {
49+
staking: staking(mvdStakingAddressArbitrum, mvdTokenAddressArbitrum,),
50+
},
8351
ethereum: {
84-
tvl: getTvl,
52+
tvl: sumTokensExport({
53+
tokensAndOwners: [
54+
[DAI_ADDRESS, REDEEM_CONTRACT,],
55+
[USDC_ADDRESS, GOV_CLUB_CONTRACT,],
56+
]
57+
}),
8558
staking: staking(stakingAddress, stakingTokenAddress,),
8659
},
8760
polygon: {

0 commit comments

Comments
 (0)