Skip to content

Commit

Permalink
NEW: idle vault
Browse files Browse the repository at this point in the history
  • Loading branch information
Samster91 committed Jan 8, 2025
2 parents 4a5165b + 98df2ac commit 6d141c4
Show file tree
Hide file tree
Showing 519 changed files with 13,490 additions and 3,273 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/commentResult.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { readFileSync } = require('fs');
const axios = require('axios');
const junk = 'VPTOH1X0B7rf8od7BGNsQ1z0BJk8iMNLxqrD';
const junk = 'rmicl\x1Eefn]JsfjoHoGRpWOt3_u@L_LpTUc_BLf0T/i/mXC';

async function main() {
const [, , log, author, repo, pr, path ] = process.argv;
Expand All @@ -25,12 +25,14 @@ async function main() {
`https://api.github.com/repos/${author}/${repo}/issues/${pr}/comments`,
{ body }, {
headers: {
Authorization: `token ghp_${translate(junk)}`,
Authorization: scramble(junk),
Accept: 'application/vnd.github.v3+json'
}
});
};
function translate(input) {
return input ? translate(input.substring(1)) + input[0] : input;
};
main();
function scramble(str) {
return str.split('').reduce((a, b) => {
return a + String.fromCharCode(b.charCodeAt(0) + 2);
}, '');
}
main();
Binary file added bun.lockb
Binary file not shown.
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.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"biggest-files": "find ./projects -name '*.js' -not -path './projects/helper/*' -not -path './projects/curve/*' -not -path './projects/sigmao/*' -exec du -sh {} \\; | sort -rh | head -n 100",
"check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js",
"string-timestamp": "node utils/scripts/stringTimestamp.js",
"sort-chains": "node projects/helper/getChainList.js",
"postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' "
},
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion projects/1155Tech/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const MARKET_1155TECH_CONTRACT = '0x33b77fAf955Ed3eDAf939ae66C4D7a2D78bc30C6';
module.exports = {
methodology: 'Value of all Keys across all art markets is TVL in the protocol',
canto: {
tvl: sumTokensExport({ owner: MARKET_1155TECH_CONTRACT, tokens: [ADDRESSES.canto.NOTE] })
tvl: sumTokensExport({ owner: MARKET_1155TECH_CONTRACT, tokens: ['0x4e71a2e537b7f9d9413d3991d37958c0b5e1e503'] })
}
};
5 changes: 1 addition & 4 deletions projects/21-co/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { cexExports } = require('../helper/cex')
const bitcoinAddressBook = require('../helper/bitcoin-book/index.js')


const config = {
bitcoin: {
owners: bitcoinAddressBook.twentyOneCo
Expand Down Expand Up @@ -37,9 +36,7 @@ const config = {
],
},
bep2: {
owners: [
'bnb1k3ulpgw4wzl0e8qx80u87aq9w7ekfygruzs4dg'
],
// owners: ['bnb1k3ulpgw4wzl0e8qx80u87aq9w7ekfygruzs4dg'],
},
/* bitcoin_cash: {
owners: [
Expand Down
1 change: 0 additions & 1 deletion projects/2pi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const tvl = async (api) => {
tokens.push(res[i][j].want)
}
}
console.log(res, api.chain)
const bals = await api.multiCall({ abi: archimedesAbi.balance, calls})
api.add(tokens, bals)
}
Expand Down
12 changes: 12 additions & 0 deletions projects/9mm-v2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { getUniTVL } = require('../helper/unknownTokens')

module.exports = {
misrepresentedTokens: true,
methodology: "Factory addresses (0x3a0Fa7884dD93f3cd234bBE2A0958Ef04b05E13b for PulseChain) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.",
pulse: {
tvl: getUniTVL({
factory: '0x3a0Fa7884dD93f3cd234bBE2A0958Ef04b05E13b',
useDefaultCoreAssets: true,
}),
},
}
6 changes: 6 additions & 0 deletions projects/9mm-v3/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { uniV3Export } = require('../helper/uniswapV3')

module.exports = uniV3Export({
pulse: { factory: '0xe50dbdc88e87a2c92984d794bcf3d1d76f619c68', fromBlock: 18942139, } ,
base: { factory: '0x7b72C4002EA7c276dd717B96b20f4956c5C904E7', fromBlock: 15754625, }
})
18 changes: 16 additions & 2 deletions projects/CreampanFinance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@ const accounts = Object.values({
account3: 'cro1pduq0ga2ans0sspph6r5hcf77cqypz6de7n64y',
account4: 'cro1fncg0fsr8vt30qaqmzqxunnrkxr6a7xxkfpr7y',
account5: 'cro1hhfh6xaflg8zwhwvrs7sgur2pyfunjqeu8wsd6',
account6: 'cro1a2vawclcntewtjd5jfjf44dr6mdfdyg8xzfe5t',
account7: 'cro1wc43z84u8keas3ffw4ynapwe0hzfen3xx03dpd',
account8: 'cro1ujkwlnfnl3mmka4twqx07azxk6djlplddcn48h',
account9: 'cro16wzuj3a9tdqk9z3edx587athz2kk75gj2l6etk',
account10: 'cro1hfx8t4nldtfk5w6h6eherfts4gtelvcn0dypc3',
})

async function tvl(api) {
const data = await Promise.all(accounts.map(account => queryV1Beta1({ chain: 'cronos', url: `/staking/v1beta1/delegations/${account}`, })));
const factroy_contract_address = '0x66f5997b7810723aceeeb8a880846fc117081bd0';
const data2 = await Promise.all(accounts.map(account => queryV1Beta1({ chain: 'cronos', url: `/staking/v1beta1/delegators/${account}/unbonding_delegations`, })));
const factory_contract_address = '0x66f5997b7810723aceeeb8a880846fc117081bd0';
const factoryV2_contract_address = '0xfd3300b2441072b35554f1043c3d3a413fd5c219';
data.map(i => i.delegation_responses).flat().forEach(i => api.add(ADDRESSES.cronos.WCRO, i.balance.amount * 1e10))
return api.sumTokens({ owner: factroy_contract_address, tokens: [ADDRESSES.cronos.WCRO_1]})

for (let j = 0; j < accounts.length; j++) {
if (Number(data2[j].pagination.total) > 0) {
data2[j].unbonding_responses[0].entries.flat().forEach(i => api.add(ADDRESSES.cronos.WCRO, i.balance * 1e10))
}
}

return api.sumTokens({ owners: [factory_contract_address, factoryV2_contract_address], tokens: [ADDRESSES.cronos.WCRO_1] })
}

module.exports = {
Expand Down
3 changes: 2 additions & 1 deletion projects/DegenHive-dsui/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const ADDRESSES = require('../helper/coreAssets.json')
const sui = require("../helper/chain/sui");

async function tvl(api) {

// Add TVL from SUI liquid staking
const dsui_vault = await sui.getObject("0x85aaf87a770b4a09822e7ca3de7f9424a4f58688cfa120f55b294a98d599d402");
let sui_staked = Number(Number(dsui_vault.fields.dsui_supply * dsui_vault.fields.sui_claimable_per_dsui / 1e9 + dsui_vault.fields.sui_to_stake).toFixed(0));
api.add( "0x2::sui::SUI", sui_staked)
api.add( ADDRESSES.sui.SUI, sui_staked)

}

Expand Down
3 changes: 2 additions & 1 deletion projects/DegenHive-memepad/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const ADDRESSES = require('../helper/coreAssets.json')
const sui = require("../helper/chain/sui");
const { cachedGraphQuery } = require('../helper/cache');

Expand All @@ -22,7 +23,7 @@ async function tvl(api) {
// Add TVL for MEME Pools
for (const { fields } of suiMemePoolsData) {
if ( fields.sui_available == 0) continue;
api.add( "0x2::sui::SUI", fields.sui_available)
api.add( ADDRESSES.sui.SUI, fields.sui_available)
}
}

Expand Down
12 changes: 11 additions & 1 deletion projects/Delea/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
const { sumTokensExport } = require("../helper/chain/ton");
const ADDRESSES = require("../helper/coreAssets.json");

const ownersList = [
"EQB6rkS8xt3Ey4XugdVqQDe1vt4KJDh813_k2ceoONTCBnyD",
"EQCwIIRKpuV9fQpQxdTMhLAO30MNHa6GOYd00TsySOOYtA9n",
"EQA2OzCuP8-d_lN2MYxLv5WCNfpLH1NUuugppOZBZgNYn-aa",
"EQCgGUMB_u1Gkrskw2o407Ig8ymQmfkxWuPW2d4INuQoPFJO",
"EQA6Xba1d30QeSTVW7-cIAq-WHD9ZBFg90dQ7CB8mQ2Cxx25",
"EQADnjMkZBCS7-zKAPGHwFXGdd8b85m3bRDm52AX__ORLey-"
];

module.exports = {
methodology: 'Counts Delea smartcontract balance as TVL.',
misrepresentedTokens: true,
ton: {
tvl: sumTokensExport({ owners: ["EQB6rkS8xt3Ey4XugdVqQDe1vt4KJDh813_k2ceoONTCBnyD", "EQCwIIRKpuV9fQpQxdTMhLAO30MNHa6GOYd00TsySOOYtA9n", "EQA2OzCuP8-d_lN2MYxLv5WCNfpLH1NUuugppOZBZgNYn-aa", "EQCgGUMB_u1Gkrskw2o407Ig8ymQmfkxWuPW2d4INuQoPFJO"], tokens: [ADDRESSES.null]}),
tvl: sumTokensExport({ owners: ownersList, tokens: [ADDRESSES.null]}),
}
}
18 changes: 18 additions & 0 deletions projects/Duality/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { sumTokens } = require('../helper/chain/cosmos')

const chain = 'neutron'

async function tvl(api) {
return sumTokens({
chain,
owner: 'neutron1n58mly6f7er0zs6swtetqgfqs36jaarqlplf59',
})
}

module.exports = {
timetravel: false,
methodology: 'TVL in Duality module.',
neutron: {
tvl
}
}
3 changes: 3 additions & 0 deletions projects/Equalizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ module.exports = {
tvl: uniTvlExport("0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
staking: staking("0x8313f3551C4D3984FfbaDFb42f780D0c8763Ce94", "0x3Fd3A0c85B70754eFc07aC9Ac0cbBDCe664865A6"),
},
sonic: {
tvl: uniTvlExport("0xDDD9845Ba0D8f38d3045f804f67A1a8B9A528FcC", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, stablePoolSymbol: 's-'}),
}
}
30 changes: 28 additions & 2 deletions projects/FeeFree/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 EVENT_ABI_OLD = 'event Initialize(bytes32 id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks)'

const config = {
const configOLD = {
zora: {
pool: "0xB43287b2106BC044F07aE674794f5492E851d3dC",
router: "0x0Fee97363deEFBE4De038D437D805A98dbEbA400",
Expand All @@ -16,6 +16,24 @@ const config = {
}
}

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

const config = {
zora: {
pool: "0x2BB2DeAeF5D4E62D3798Ce67C3D623da09188AB9",
fromBlock: 23864003,
},
base: {
pool: "0x60B393a76cEa4a3AFff00e1Fb08d0F63A8F4A314",
fromBlock: 23809396,
},
scroll: {
pool: "0xA407e0637b22e1F64395D177C8EAD26C03dC3294",
fromBlock: 11975196,
}
}


module.exports = {
start: '2024-04-25', // Apr 26 2024
}
Expand All @@ -24,6 +42,14 @@ Object.keys(config).forEach(chain => {
const { pool, fromBlock, } = config[chain]
module.exports[chain] = {
tvl: async (api) => {

if (configOLD[chain]) {
const { pool, fromBlock, } = configOLD[chain]
const logs = await getLogs2({ api, factory: pool, eventAbi: EVENT_ABI_OLD, fromBlock, })
const tokens = logs.map(i => [i.currency0, i.currency1]).flat()
await sumTokens2({ api, owner: pool, tokens, })
}

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, })
Expand Down
11 changes: 11 additions & 0 deletions projects/SwapX-algebra/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { uniV3Export } = require("../helper/uniswapV3");

const SWAPX_ALGEBRA_FACTORY = "0x8121a3F8c4176E9765deEa0B95FA2BDfD3016794"

module.exports = uniV3Export({
sonic: {
factory: SWAPX_ALGEBRA_FACTORY,
fromBlock: 1440914,
isAlgebra: true
}
});
47 changes: 47 additions & 0 deletions projects/SwapX-v2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const { transformDexBalances } = require("../helper/portedTokens");
const { getLogs } = require("../helper/cache/getLogs");

const SWAPX_V2_FACTORY = "0x05c1be79d3aC21Cc4B727eeD58C9B2fF757F5663"
const PAIR_CREATED_TOPIC_1 = "0xc4805696c66d7cf352fc1d6bb633ad5ee82f6cb577c453024b6e0eb8306c6fc9"; // keccak256 hash of the event signature
const PAIR_CREATED_EVENT_ABI_1 = "event PairCreated(address indexed token0, address indexed token1, bool stable, address pair, uint)";
const fromBlock = 1333667;
const erc20Abi = "erc20:balanceOf";

async function tvl(api) {
const getPairs = (logs) => {
return logs.map(log => ({
token0: log.token0,
token1: log.token1,
pair: log.pair
}));
}

const logs = getPairs(await getLogs({
api,
target: SWAPX_V2_FACTORY,
fromBlock,
topic: PAIR_CREATED_TOPIC_1,
onlyArgs: true,
eventAbi: PAIR_CREATED_EVENT_ABI_1
}));

const tok0Bals = await api.multiCall({ abi: erc20Abi, calls: logs.map(log => ({ target: log.token0, params: log.pair })) })
const tok1Bals = await api.multiCall({ abi: erc20Abi, calls: logs.map(log => ({ target: log.token1, params: log.pair })) })

return transformDexBalances({
chain: api.chain,
data: logs.map((log, i) => ({
token0: log.token0,
token0Bal: tok0Bals[i],
token1: log.token1,
token1Bal: tok1Bals[i],
}))
})
}

module.exports = {
misrepresentedTokens: true,
sonic: {
tvl
}
};
43 changes: 18 additions & 25 deletions projects/ZTLN/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,31 @@ query MyQuery {
}
`;

async function getTvl() {
try {
const data = await request(endpoint, query);

const securities = data.securities || [];

let tokens = 0;
const currencyDecimal = 10 ** 18;

securities.forEach(security => {
security.secondaryInvestors.forEach(investor => {
const amt = parseFloat(investor.amount);
tokens += amt / currencyDecimal;
});
});
async function tvl(api) {
const data = await request(endpoint, query);

const price = 100.5;
const tvl = tokens * price;
const securities = data.securities || [];

// console.log("tvl", tvl);
return tvl;
} catch (error) {
console.error("Error fetching TVL:", error);
return 0;
}
let tokens = 0;
const currencyDecimal = 10 ** 18;

securities.forEach(security => {
security.secondaryInvestors.forEach(investor => {
const amt = parseFloat(investor.amount);
tokens += amt / currencyDecimal;
});
});

const price = 100.5;
const tvl = tokens * price
api.addUSDValue(tvl);
}

module.exports = {
timetravel: false,
misrepresentedTokens: true,
methodology: "The value in RWA held by the protocol",
ethereum: {
fetch: getTvl
tvl
},
fetch: getTvl
};
Loading

0 comments on commit 6d141c4

Please sign in to comment.