Skip to content

Commit 0513347

Browse files
authored
Merge branch 'DefiLlama:main' into main
2 parents ff89cf1 + 52ef6f3 commit 0513347

File tree

11 files changed

+193
-29
lines changed

11 files changed

+193
-29
lines changed

projects/fwx/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const { sumTokensExport } = require("../helper/unwrapLPs");
2+
const ADDRESSES = require("../helper/coreAssets.json");
3+
const VECTOR = require("../vector/vectorContracts.json");
4+
5+
const tokens = {
6+
COQ: "0x420FcA0121DC28039145009570975747295f2329",
7+
};
8+
const coreModuleProxy = "0xceE74C8c242047c85e6833633AbB7A4Cd8465757";
9+
const pools = {
10+
WAVAX: "0x7F91272ff1A0114743D2df95F5905F9613Fd92b3",
11+
USDC: "0x94732A5319e1feAcc7d08e08Fdc4C2c7f5123143",
12+
COQ: "0xc97d9B3971BfE1B8Ac8EA7f990Df721d8f695223",
13+
SAVAX: "0xe57a4042eA63Df072B2cf6352F9779E4D2445A92",
14+
core: "0xceE74C8c242047c85e6833633AbB7A4Cd8465757",
15+
};
16+
17+
module.exports = {
18+
avax: {
19+
tvl: sumTokensExport({
20+
tokensAndOwners: [
21+
[ADDRESSES.avax.WAVAX, pools.WAVAX],
22+
[ADDRESSES.avax.USDC, pools.USDC],
23+
[tokens.COQ, pools.COQ],
24+
[VECTOR.tokens.SAVAX.address, pools.SAVAX],
25+
[ADDRESSES.avax.WAVAX, coreModuleProxy],
26+
[ADDRESSES.avax.USDC, coreModuleProxy],
27+
[tokens.COQ, coreModuleProxy],
28+
[VECTOR.tokens.SAVAX.address, coreModuleProxy],
29+
],
30+
}),
31+
},
32+
};

projects/helio-money/index.js

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,64 @@
1-
const ADDRESSES = require('../helper/coreAssets.json')
2-
const { sumTokensExport, } = require('../helper/unknownTokens')
1+
const ADDRESSES = require("../helper/coreAssets.json");
2+
const { sumTokensExport } = require("../helper/unknownTokens");
33

44
module.exports = {
5-
methodology: 'count the amount of ankr BNB in the vault',
5+
methodology: "count the amount of ankr BNB in the vault",
66
hallmarks: [
77
[1669939200, "aBNBc exploit"],
88
//[1670544000,"aBNBc to AnkrBNB swap & HAY buyback"]
99
],
1010
bsc: {
11-
tvl:
12-
sumTokensExport({
13-
tokensAndOwners: [
14-
//ankrBNB
15-
['0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827', '0x25b21472c073095bebC681001Cbf165f849eEe5E'],
16-
[ADDRESSES.null, '0x25b21472c073095bebC681001Cbf165f849eEe5E'],
17-
//stkBNB
18-
['0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16', '0x98CB81d921B8F5020983A46e96595471Ad4E60Be'],
19-
//snBNB
20-
['0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B', '0x6F28FeC449dbd2056b76ac666350Af8773E03873'],
21-
//BNBx
22-
['0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275', '0x6ae7073d801a74eE753F19323DF320C8F5Fe2DbC']
23-
]
24-
})
25-
}
26-
}
11+
tvl: sumTokensExport({
12+
tokensAndOwners: [
13+
// BNB
14+
[ADDRESSES.null, "0x986b40C2618fF295a49AC442c5ec40febB26CC54"],
15+
16+
//ankrBNB
17+
[
18+
"0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827",
19+
"0x25b21472c073095bebc681001cbf165f849eee5e",
20+
],
21+
22+
//stkBNB
23+
[
24+
"0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16",
25+
"0x98CB81d921B8F5020983A46e96595471Ad4E60Be",
26+
],
27+
//snBNB
28+
[
29+
"0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B",
30+
"0x6F28FeC449dbd2056b76ac666350Af8773E03873",
31+
],
32+
//BNBx
33+
[
34+
"0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275",
35+
"0x6ae7073d801a74eE753F19323DF320C8F5Fe2DbC",
36+
],
37+
38+
// snBNB
39+
[
40+
"0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B",
41+
"0x91e49983598685DD5ACAc90CEb4061A772f6E5Ae",
42+
],
43+
44+
// eth
45+
[
46+
"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
47+
"0xA230805C28121cc97B348f8209c79BEBEa3839C0",
48+
],
49+
50+
// eth => wBETH
51+
[
52+
"0xa2E3356610840701BDf5611a53974510Ae27E2e1",
53+
"0xf45C3b619Ee86F653805E007fE211B7e930E0b3B",
54+
],
55+
56+
// wbeth
57+
[
58+
"0xa2E3356610840701BDf5611a53974510Ae27E2e1",
59+
"0xA230805C28121cc97B348f8209c79BEBEa3839C0",
60+
],
61+
],
62+
}),
63+
},
64+
};

projects/helper/abis/morpho.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"marketsCreated": "address[]:marketsCreated",
1212
"market": "function market(address underlying) returns (tuple( tuple(uint128 poolIndex, uint128 p2pIndex) supply, tuple(uint128 poolIndex, uint128 p2pIndex) borrow) indexes, tuple( tuple(uint256 scaledDelta, uint256 scaledP2PTotal) supply, tuple(uint256 scaledDelta, uint256 scaledP2PTotal) borrow) deltas, address underlying, tuple( bool isP2PDisabled, bool isSupplyPaused, bool isSupplyCollateralPaused, bool isBorrowPaused, bool isWithdrawPaused, bool isWithdrawCollateralPaused, bool isRepayPaused, bool isLiquidateCollateralPaused, bool isLiquidateBorrowPaused, bool isDeprecated) pauseStatues, bool isCollateral, address variableDebtToken, uint32 lastUpdateTimestamp, uint16 reserveFactor, uint16 p2pIndexCursor, address aToken, address stableDebtToken, uint256 idleSupply)"
1313
},
14-
"pool": {
15-
16-
}
17-
}
14+
"morphoBlueFunctions": {
15+
"underlying": "address:underlying",
16+
"idToMarketParams": "function idToMarketParams(bytes32 Id) returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)",
17+
"market": "function market(bytes32 input) returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)"
18+
},
19+
"pool": {}
20+
}

projects/helper/unwrapLPs.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,20 @@ async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, c
218218
return balances
219219
}
220220

221+
const factories = {}
222+
223+
const getFactoryKey = (chain, nftAddress) => `${chain}:${nftAddress}`.toLowerCase()
224+
221225
async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = 'ethereum', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) {
222226

223227
blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain)
224228
whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain)
225229
let nftIdFetcher = uniV3ExtraConfig.nftIdFetcher ?? nftAddress
226230

227231
const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftIdFetcher, owner, block, chain })).output
228-
const factory = (await sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain })).output
232+
const factoryKey = getFactoryKey(chain, nftAddress)
233+
if (!factories[factoryKey]) factories[factoryKey] = sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain })
234+
const factory = (await factories[factoryKey]).output
229235

230236
const positionIds = (await sdk.api.abi.multiCall({
231237
block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher,

projects/hexaswap/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { getUniTVL } = require('../helper/unknownTokens')
2+
3+
module.exports = {
4+
misrepresentedTokens: true,
5+
telos: {
6+
tvl: getUniTVL({
7+
fetchBalances: true,
8+
useDefaultCoreAssets: true,
9+
factory: '0x7853cDd20592aaff59D6e89B59bF67499564C525',
10+
})
11+
}
12+
}

projects/morpho-blue/addresses.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const wethWstethChainlinkAdaptiveCurveIRM945 =
2+
"0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41";
3+
const usdcWstethChainlinkAdaptiveCurveIRM860 =
4+
"0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc";
5+
6+
module.exports = {
7+
morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
8+
whitelistedIds: [
9+
wethWstethChainlinkAdaptiveCurveIRM945,
10+
usdcWstethChainlinkAdaptiveCurveIRM860,
11+
],
12+
};

projects/morpho-blue/index.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const { getLogs } = require('../helper/cache/getLogs')
2+
const abi = require("../helper/abis/morpho.json");
3+
const { morphoBlue, whitelistedIds } = require("./addresses");
4+
5+
module.exports = {
6+
methodology: `Collateral (supply minus borrows) in the balance of the Morpho contracts`,
7+
doublecounted: true,
8+
};
9+
10+
const config = {
11+
ethereum: { morphoBlue, fromBlock: 18883124 }
12+
}
13+
14+
Object.keys(config).forEach(chain => {
15+
const { morphoBlue, fromBlock } = config[chain]
16+
module.exports[chain] = {
17+
tvl: async (_, _b, _cb, { api, }) => {
18+
const marketIds = await getMarkets(api)
19+
const tokens = (await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.idToMarketParams })).map(i => [i.collateralToken, i.loanToken]).flat()
20+
return api.sumTokens({ owner: morphoBlue, tokens })
21+
},
22+
borrowed: async (_, _b, _cb, { api, }) => {
23+
const marketIds = await getMarkets(api)
24+
const marketInfo = await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.idToMarketParams })
25+
const marketData = await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.market })
26+
marketData.forEach((i, idx) => {
27+
api.add(marketInfo[idx].loanToken, i.totalBorrowAssets)
28+
})
29+
return api.getBalances()
30+
},
31+
}
32+
33+
async function getMarkets(api) {
34+
const logs = await getLogs({
35+
api, target: morphoBlue,
36+
eventAbi: 'event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)',
37+
onlyArgs: true, fromBlock,
38+
})
39+
return logs.map(i => i.id).concat(whitelistedIds)
40+
}
41+
})

projects/paraspace-ape-staking-v2/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ async function tvl(_, _1, _cb, { api }) {
3333
const stakedAddress = [nBAYC, nMAYC, nBAKC, P2PPairStaking, cAPE];
3434

3535
const balances = {};
36+
const allStakes = []
37+
for (const stake of stakedAddress) {
38+
const stakeData = await api.call({
39+
target: ApeCoinStaking,
40+
params: stake,
41+
abi: abi.ApeCoinStaking.getAllStakes,
42+
});
43+
allStakes.push(stakeData);
44+
}
3645

37-
const allStakes = await api.multiCall({
38-
calls: stakedAddress,
39-
target: ApeCoinStaking,
40-
abi: abi.ApeCoinStaking.getAllStakes,
41-
});
4246
const otherPools = {}
4347
allStakes.flat().forEach(({ poolId, tokenId, deposited }) => {
4448
if (poolId === '0') {

projects/popcorn/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { ADDRESSES } = require("./constants");
22
const { addVaultToTVL } = require("./vault");
33
const { addFraxVaultToTVL } = require("./fraxVault");
4+
const { staking } = require("../helper/staking");
45

56
function getTVL(chain = undefined) {
67
return async (timestamp, block, chainBlocks, { api }) => {
@@ -16,11 +17,15 @@ function getTVL(chain = undefined) {
1617
}
1718
}
1819

20+
const veVCX = "0x0aB4bC35Ef33089B9082Ca7BB8657D7c4E819a1A";
21+
const WETH_VCX_BAL_LP_TOKEN = "0x577A7f7EE659Aa14Dc16FD384B3F8078E23F1920";
22+
1923
module.exports = {
2024
timetravel: true,
2125
methodology: ``,
2226
ethereum: {
2327
start: 12237585,
28+
staking: staking(veVCX, WETH_VCX_BAL_LP_TOKEN),
2429
tvl: getTVL('ethereum'),
2530
},
2631
bsc: {

projects/treasury/fwx.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { treasuryExports } = require("../helper/treasury");
2+
3+
module.exports = treasuryExports({
4+
avax: {
5+
owners: ['0xB0fa4C4D58E26BED39e2C08DcFD96f5743aA6062'],
6+
ownTokens: [],
7+
},
8+
})

0 commit comments

Comments
 (0)