Skip to content

Commit

Permalink
Add new vaults and Update Readability (#9726)
Browse files Browse the repository at this point in the history
* Add all contracts

* Cleanup wasabi abi

* Simplification of TVL measurement as requested in PR
  • Loading branch information
dnilosek authored Apr 8, 2024
1 parent 6a71b13 commit 25e3d96
Showing 1 changed file with 52 additions and 30 deletions.
82 changes: 52 additions & 30 deletions projects/juice-finance/index.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,61 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokens2 } = require('../helper/unwrapLPs')
const LENDING_POOL_USDB = "0x4A1d9220e11a47d8Ab22Ccd82DA616740CF0920a"
const LENDING_POOL_WETH = "0x44f33bC796f7d3df55040cd3C631628B560715C2";
const COLLATERAL_MANAGER = "0x6301795aa55B90427CF74C18C8636E0443F2100b"
const COLLATERAL_MANAGER_V2 = "0x105e285f1a2370D325046fed1424D4e73F6Fa2B0"
const WETH_COLLATERAL_MANAGER = "0x23eBa06981B5c2a6f1a985BdCE41BD64D18e6dFA"
const EZETH_COLLATERAL_MANAGER = "0xc81A630806d1aF3fd7509187E1AfC501Fd46e818"
const MUNCHABLE_WETH_COLLATERAL_MANAGER = "0x4A355D57fc1A5eEB33C0a19539744A2144220027"
const ADDRESSES = require("../helper/coreAssets.json");
const { sumTokens2 } = require("../helper/unwrapLPs");

const EZETH = "0x2416092f143378750bb29b79eD961ab195CcEea5"
// Tokens
const EZETH = "0x2416092f143378750bb29b79eD961ab195CcEea5";

const MUNCHABLE_LOCKDROP_VAULT = "0x01F7dF622DDE3B7d234aadBE282DDA24CEAd9D21"
// Lending pools
const LENDING_POOL_USDB = "0x4A1d9220e11a47d8Ab22Ccd82DA616740CF0920a";
const LENDING_POOL_WETH = "0x44f33bC796f7d3df55040cd3C631628B560715C2";

const vaults = [
["0x12c69BFA3fb3CbA75a1DEFA6e976B87E233fc7df", "0x72E4ce9b7cC5d9C017F64ad58e512C253a11d30a"],
['0x4bed2a922654cacc2be974689619768fabf24855', "0x0CA56aa647E83A8F0a5f7a81a2fdcA393bC68D78"],
[EZETH, '0x741011f52B7499ca951f8b8Ee547DD3Cdd813Fda'],
]
// Managers
const COLLATERAL_MANAGER = "0x6301795aa55B90427CF74C18C8636E0443F2100b";
const COLLATERAL_MANAGER_V2 = "0x105e285f1a2370D325046fed1424D4e73F6Fa2B0";
const WETH_COLLATERAL_MANAGER = "0x23eBa06981B5c2a6f1a985BdCE41BD64D18e6dFA";
const EZETH_COLLATERAL_MANAGER = "0xc81A630806d1aF3fd7509187E1AfC501Fd46e818";
const MUNCHABLE_WETH_COLLATERAL_MANAGER =
"0x32b6C6322939263029A5CF37F14A59ab0A9E277c";

const wethHolders = [LENDING_POOL_WETH, COLLATERAL_MANAGER, COLLATERAL_MANAGER_V2, WETH_COLLATERAL_MANAGER, MUNCHABLE_WETH_COLLATERAL_MANAGER, ].map(a => [ADDRESSES.blast.WETH, a])
const wethCollateralManagers = [
COLLATERAL_MANAGER,
COLLATERAL_MANAGER_V2,
WETH_COLLATERAL_MANAGER,
MUNCHABLE_WETH_COLLATERAL_MANAGER,
].map((a) => [ADDRESSES.blast.WETH, a]);

async function tvl(api) {
const thrusterv2LPs = [ // [LP, contract]
['0x12c69bfa3fb3cba75a1defa6e976b87e233fc7df', '0x8034b01555487C26D4e21F4E33b7A30fbc90d181'],
['0x12c69bfa3fb3cba75a1defa6e976b87e233fc7df', "0x72E4ce9b7cC5d9C017F64ad58e512C253a11d30a"],
]
const stakedLPCalls = thrusterv2LPs.map(lp => ({ params: [lp[1], lp[0]] }))
const v2Bals = await api.multiCall({ abi: 'function staked(address, address) view returns (uint256)', calls: stakedLPCalls, target: '0xc3ecadb7a5fab07c72af6bcfbd588b7818c4a40e' })
const v2Tokens = thrusterv2LPs.map(lp => lp[0])
api.add(v2Tokens, v2Bals)
await sumTokens2({ api, resolveLP: true, tokensAndOwners: [[ADDRESSES.blast.USDB, LENDING_POOL_USDB], [EZETH, EZETH_COLLATERAL_MANAGER], ...wethHolders, ...vaults], })
const tokens = await api.multiCall({
abi: {
inputs: [],
name: "getTotalSupply",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
calls: [LENDING_POOL_USDB, LENDING_POOL_WETH],
});

api.add(ADDRESSES.blast.USDB, tokens[0]);
api.add(ADDRESSES.blast.WETH, tokens[1]);

await sumTokens2({
api,
resolveLP: true,
tokensAndOwners: [
[EZETH, EZETH_COLLATERAL_MANAGER],
...wethCollateralManagers,
],
});
}

module.exports = {
blast: {
tvl
}
}
blast: {
tvl,
},
};

0 comments on commit 25e3d96

Please sign in to comment.