Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Bit-Genie authored May 2, 2024
2 parents 41c2d91 + 26b69dc commit 15a7cab
Show file tree
Hide file tree
Showing 125 changed files with 2,116 additions and 770 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions projects/FeeFree/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { getLogs2 } = require('../helper/cache/getLogs')
const { sumTokens2 } = require('../helper/unwrapLPs')

const EVENT_ABI = 'event Initialize(bytes32 id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks)'

const config = {
zora: {
pool: "0xB43287b2106BC044F07aE674794f5492E851d3dC",
router: "0x0Fee97363deEFBE4De038D437D805A98dbEbA400",
fromBlock: 13704184,
},
}

module.exports = {
start: 1714060800, // Apr 26 2024
}

Object.keys(config).forEach(chain => {
const { pool, fromBlock, } = config[chain]
module.exports[chain] = {
tvl: async (api) => {
const logs = await getLogs2({ api, factory: pool, eventAbi: EVENT_ABI, fromBlock, })
const tokens = logs.map(i => [i.currency0, i.currency1]).flat()
return sumTokens2({ api, owner: pool, tokens, })
}
}
})
7 changes: 6 additions & 1 deletion projects/LamaMiner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ const { sumTokensExport } = require("../helper/unknownTokens")
const LAMA_TOKEN_CONTRACT = '0x89A8633bcaD3af0951acC5137811ea21a17C37DC';
const LAMA_MINER_CONTRACT = '0x1f4292Cf1C0fDa5Ef1C3e9d1e59C13bd1808DD10';
const LP_LAMA_WAVAX = "0xf3336be3416916D26840f41780E0cBc861eF3B3C"
const LAMA_STAKING_CONTRACT = '0xc16ce7B683da825906c6CA8Df33986c6Ef9B287B';
const LP_LQDX_LAMA = "0x3a74922803415Dfc43c0030d47707b20f4c1b05d"


module.exports = {
misrepresentedTokens: true,
methodology: 'counts the number of LAMA tokens in the Lama Miner contract.',
start: 1711962980,
avax: {
tvl: sumTokensExport({ owner: LAMA_MINER_CONTRACT, tokens: [LAMA_TOKEN_CONTRACT], lps: [LP_LAMA_WAVAX], useDefaultCoreAssets: true, })
tvl: sumTokensExport({ owner: LAMA_MINER_CONTRACT, tokens: [LAMA_TOKEN_CONTRACT], lps: [LP_LAMA_WAVAX], useDefaultCoreAssets: true, }),
staking: sumTokensExport({ owner: LAMA_STAKING_CONTRACT, tokens: [LAMA_TOKEN_CONTRACT], lps: [LP_LAMA_WAVAX, LP_LQDX_LAMA], useDefaultCoreAssets: true, })
}
}
19 changes: 19 additions & 0 deletions projects/Mezo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const ADDRESSES = require('../helper/coreAssets.json');
const { sumTokens } = require('../helper/sumTokens');

const bridge = "0xAB13B8eecf5AA2460841d75da5d5D861fD5B8A39";

async function tvl(api) {
const balances = {};
await sumTokens({
api,
balances,
owners: [bridge],
tokens: [ADDRESSES.ethereum.tBTC, ADDRESSES.ethereum.WBTC]
})
return balances
}

module.exports = {
ethereum: { tvl }
}
22 changes: 22 additions & 0 deletions projects/MorpheusAI/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const ADDRESSES = require('../helper/coreAssets.json')
const STETH_CONTRACT = ADDRESSES.ethereum.STETH;
const PROJECT_CONTRACT = '0x47176B2Af9885dC6C4575d4eFd63895f7Aaa4790';

async function tvl(_, __, ___, { api }) {
const stEthBalance = await api.call({
abi: 'erc20:balanceOf',
target: STETH_CONTRACT,
params: [PROJECT_CONTRACT],
});

api.add(STETH_CONTRACT, stEthBalance);
}

module.exports = {
timetravel: true,
misrepresentedTokens: false,
methodology: 'Calculates TVL based on stETH deposits in the project contract.',
ethereum: {
tvl,
},
};
10 changes: 10 additions & 0 deletions projects/PulseGun-farm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { masterchefExports } = require("../helper/unknownTokens");

module.exports = masterchefExports({
chain: "pulse",
masterchef: "0x1b9DD75c79Ef7308bC9aD449A9171fC5406403D8",
nativeTokens: ["0xa39e7837B0c283e7ce07cfA7ca3DeEe58fbcbCd8"],
useDefaultCoreAssets: true,
poolInfoABI: "function poolInfo(uint256) view returns (address)",
getToken: (i) => i,
});
3 changes: 3 additions & 0 deletions projects/PulseGun/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { uniTvlExport } = require('../helper/unknownTokens')

module.exports = uniTvlExport('pulse', '0x5c92d17f52987DED8D2c0Fa0d5fbfcD68A09B074')
118 changes: 104 additions & 14 deletions projects/aera/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { cachedGraphQuery } = require("../helper/cache");
const { sumTokens2, } = require('../helper/unwrapLPs')
const { getLogs } = require('../helper/cache/getLogs')

const COMPOUND_ORACLE_NAME = 'CompoundV3PositionOracle'
const AAVE_ORACLE_NAME = 'AaveV3PositionOracle'

const config = {
polygon: {
graphUrl: 'https://api.thegraph.com/subgraphs/name/fico23/aera-subgraph-polygon',
aavePool: '0x794a61358D6845594F94dc1DB02A252b5b4814aD',
aavePoolDataProvider: '0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654',
comets: [
Expand All @@ -16,10 +15,27 @@ const config = {
baseToken: ADDRESSES.polygon.USDC
}
],
cometReward: '0x45939657d1CA34A8FA39A924B71D28Fe8431e581'
cometReward: '0x45939657d1CA34A8FA39A924B71D28Fe8431e581',
vaultFactories: [
{
address: "0xfa6295a04f99815e8fa65240ed2cf9ad383c50ba",
fromBlock: 42027977
},
{
address: "0x3c14801dc6402e0560d69083f2b238b4c4b4dafe",
fromBlock: 42835719
},
{
address: "0x49b428ea1cd536e7d103e9729ea14400785e30ec",
fromBlock: 54062542
},
{
address: "0xa1c908cf7371047649dfca9ece01327dc6db3094",
fromBlock: 48024333
}
]
},
ethereum: {
graphUrl: 'https://api.thegraph.com/subgraphs/name/fico23/aera-subgraph',
aavePool: '0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2',
aavePoolDataProvider: '0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3',
comets: [
Expand All @@ -32,28 +48,102 @@ const config = {
baseToken: ADDRESSES.ethereum.USDC
}
],
cometReward: '0x1B0e765F6224C21223AeA2af16c1C46E38885a40'
}
cometReward: '0x1B0e765F6224C21223AeA2af16c1C46E38885a40',
vaultFactories: [
{
address: "0x8a7c03e9f037ba096f1fa8b48bfd65c7578327c9",
fromBlock: 17642780
},
{
address: "0xbebb92ed09688e64dc38c240b600d0b1d504ee56",
fromBlock: 17694550
},
{
address: "0x6b8d4485e11aae228a32FAe5802c6d4BA25EA404",
fromBlock: 18143506
},
{
address: "0x9500948c2BEeeB2Da4CC3aA21CB05Bd2e7C27191",
fromBlock: 18192390
},
{
address: "0x38896b4ac8420b8A2B768001Da44d11109F1797D",
fromBlock: 18737324
}
]
},
arbitrum: {
aavePool: '0x794a61358D6845594F94dc1DB02A252b5b4814aD',
aavePoolDataProvider: '0x6b4E260b765B3cA1514e618C0215A6B7839fF93e',
comets: [
{
address: '0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA',
baseToken: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8',
},
{
address: '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf',
baseToken: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
},
],
cometReward: '0x88730d254A2f7e6AC8388c3198aFd694bA9f7fae',
vaultFactories: [
{
address: "0xaF2762E1F75DeCdb8d240576e7A2CEc1A365cD46",
fromBlock: 203397910
}
]
},
base: {
aavePool: '0xA238Dd80C259a72e81d7e4664a9801593F98d1c5',
aavePoolDataProvider: '0x2d8A3C5677189723C4cB8873CfC9C8976FDF38Ac',
comets: [
{
address: '0x46e6b214b524310239732D51387075E0e70970bf',
baseToken: '0x4200000000000000000000000000000000000006',
},
{
address: '0xb125E6687d4313864e53df431d5425969c15Eb2F',
baseToken: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
},
{
address: '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf',
baseToken: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA',
},
],
cometReward: '0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1',
vaultFactories: [
{
address: "0x5CD0Cb0DcDEF98a8d07a8D44054a13F2c35C53E1",
fromBlock: 13582859
}
]
},
}

const graphQuery = `query MyQuery($block: Int) {vaultCreateds(block: {number: $block}){ id vault assetRegistry }}`

module.exports.methodology = 'Counts tokens held directly in vaults, as well as aave and compound positions.'
module.exports.start = 1682619377

Object.keys(config).forEach(chain => {
module.exports[chain] = {
tvl: async (api) => {
const GRAPH_URL = config[chain].graphUrl
const AAVE_POOL = config[chain].aavePool
const AAVE_POOL_DATA_PROVIDER = config[chain].aavePoolDataProvider
const COMETS = config[chain].comets
const COMET_REWARD = config[chain].cometReward
const cacheKey = `aera/${chain}`

const block = (await api.getBlock()) - 100 // polygon subgraph sync lags

const { vaultCreateds } = await cachedGraphQuery(cacheKey, GRAPH_URL, graphQuery, { api, variables: { block } })
const vaultFactories = config[chain].vaultFactories

const vaultCreateds = []
for (const { address, fromBlock} of vaultFactories) {
const logs = await getLogs({
api,
target: address,
topic: 'VaultCreated(address indexed,address,address, address indexed, address indexed, address, uint256, string, address)',
eventAbi: 'event VaultCreated(address indexed vault, address assetRegistry, address hooks, address indexed owner, address indexed guardian, address feeRecipient, uint256 fee, string description, address wrappedNativeToken)',
onlyArgs: true,
fromBlock,
})
vaultCreateds.push(...logs.map(x => ({vault: x.vault, assetRegistry: x.assetRegistry})))
}

const vaults = []
const assetRegistries = []
Expand Down
20 changes: 16 additions & 4 deletions projects/airpuff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ module.exports = {

const airPuff1XwETHMode = {
vault: "0xeAaD8f5F1901D2f92B747650c0f941Bfa3413dAF",
pendleAddress: "0x4200000000000000000000000000000000000006",
pendleAddress: ADDRESSES.optimism.WETH_1,
};

const airPuff1XUSDTMode = {
vault: "0xCEb6264CdCcDDd8c9631212Dc7112304F9393818",
pendleAddress: "0xf0F161fDA2712DB8b566946122a5af183995e2eD",
pendleAddress: ADDRESSES.mode.USDT,
};

const airPuff1XUSDCMode = {
vault: "0x08ccF72358B44D9d45438Fc703962A0a2FD5c978",
pendleAddress: "0xd988097fb8612cc24eeC14542bC03424c656005f",
pendleAddress: ADDRESSES.mode.USDC,
};

const airPuff1XwBTCMode = {
vault: "0xf9B484901BCA34A8615c90E8C4933f1Bd553B639",
pendleAddress: "0xcdd475325d6f564d27247d1dddbb0dac6fa0a5cf",
pendleAddress: ADDRESSES.mode.WBTC,
};

const airPuff1XwrsETHMode = {
Expand Down Expand Up @@ -310,6 +310,11 @@ module.exports = {
pendleAddress: "0x5cb12D56F5346a016DBBA8CA90635d82e6D1bcEa",
};

const pTEzETHDEC30 = {
vault: "0xebdaDFC590393938b601a9738C3107460838e880",
pendleAddress: "0xf7906F274c174A52d444175729E3fa98f9bde285",
};

const tokensAndOwners2 = [
pTweETH,
pTezETH,
Expand All @@ -320,6 +325,7 @@ module.exports = {
bptzrsETH1x,
bptzUSDe1x,
bptrswETH1x,
pTEzETHDEC30,
].map((i) => [i.pendleAddress, i.vault]);
tokensAndOwners.push(...tokensAndOwners2);
await api.sumTokens({ tokensAndOwners });
Expand All @@ -345,6 +351,11 @@ module.exports = {
pendleAddress: "0xad853EB4fB3Fe4a66CdFCD7b75922a0494955292",
};

const bsolvBTC1X = {
vault: "0x43D10bfB9f1625827Ee8EE7A461eDE28340bdBb5",
tokenAddress: "0x3647c54c4c2C65bC7a2D63c0Da2809B399DBBDC0",
};

await api.sumTokens({
tokensAndOwners: [
[ADDRESSES.arbitrum.USDC, lendingArb.usdc_e],
Expand All @@ -354,6 +365,7 @@ module.exports = {
[ADDRESSES.arbitrum.ARB, lendingArb.arb],
[ADDRESSES.arbitrum.USDC_CIRCLE, lendingArb.usdc],
[bptUSDe1x.pendleAddress, bptUSDe1x.vault],
[bsolvBTC1X.tokenAddress, bsolvBTC1X.vault],
],
});

Expand Down
1 change: 1 addition & 0 deletions projects/aloe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const config = {
optimism: { fromBlock: 113464669, },
base: { fromBlock: 7869252, },
arbitrum: { fromBlock: 159919891, },
linea: { factory: '0x00000000333288eBA83426245D144B966Fd7e82E', fromBlock: 3982456 },
};

async function getVaults(api) {
Expand Down
16 changes: 14 additions & 2 deletions projects/arcade-xyz/constants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const ADDRESSES = require('../helper/coreAssets.json')
const SUBGRAPH_URL = 'https://subgraph.satsuma-prod.com/c59d37e827d0/non-fungible-technologies/protocol/api';
const CHAIN = 'ethereum';

Expand All @@ -11,6 +12,13 @@ const VAULT_FACTORY_SUPER_RARE = '0x7594916540e60fc8d6e9ba5c3c83632f7001cf53';
const LOAN_CORE_V3 = '0x89bc08ba00f135d608bc335f6b33d7a9abcc98af';
const VAULT_FACTORY_V3 = '0x269363665dbb1582b143099a3cb467e98a476d55';

// Staking
const STAKING_REWARDS = "0x80bDdd56b947c547Ab8964D80E98E42Ff77a5793";
const SINGLE_SIDED_STAKING = "0x72854FBb44d3dd87109D46a9298AEB0d018740f0";
const ARCD = "0xe020B01B6fbD83066aa2e8ee0CCD1eB8d9Cc70bF";
const ARCD_WETH_LP = "0x06af8C358c0787640588734E4733A779961a2bca";
const WETH = ADDRESSES.ethereum.WETH;

const VAULT_FACTORIES = new Set();
VAULT_FACTORIES.add(VAULT_FACTORY_A);
VAULT_FACTORIES.add(VAULT_FACTORY_APE_STAKING_A);
Expand All @@ -34,5 +42,9 @@ module.exports = {
VAULT_FACTORY_SUPER_RARE,
VAULT_FACTORY_V3,
VAULT_FACTORIES,
}

STAKING_REWARDS,
SINGLE_SIDED_STAKING,
ARCD,
ARCD_WETH_LP,
WETH,
}
Loading

0 comments on commit 15a7cab

Please sign in to comment.