Skip to content

Commit

Permalink
feat: update soneium erc4626, univ3
Browse files Browse the repository at this point in the history
  • Loading branch information
noah-wasd3r committed Jan 15, 2025
1 parent 7b46929 commit 8ef3c54
Showing 1 changed file with 45 additions and 9 deletions.
54 changes: 45 additions & 9 deletions projects/synstation/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,56 @@
const { sumUnknownTokens } = require("../helper/unknownTokens")


const { uniV3Export } = require('../helper/uniswapV3')
const { mergeExports } = require("../helper/utils")

const config = {
ethereum: "0x3BaC111A6F5ED6A554616373d5c7D858d7c10d88",
astar: "0xe9B85D6A1727d4B22595bab40018bf9B7407c677"
ethereum: {preStaking:"0x3BaC111A6F5ED6A554616373d5c7D858d7c10d88"},
astar: {preStaking:"0xe9B85D6A1727d4B22595bab40018bf9B7407c677"},
soneium: {
vaults: [
"0x3BaC111A6F5ED6A554616373d5c7D858d7c10d88", // astar,
"0x2C7f58d2AfaCae1199c7e1E00FB629CCCEA5Bbd5", // usdc.e
"0x6A31048E5123859cf50F865d5a3050c18E77fFAe", // usdt
"0xefb3Cc73a5517c9825aE260468259476e7965c5E", // weth
"0x74dFFE1e68f41ec364517f1F2951047246c5DD4e", // nsASTR
"0x467b43ede72543FC0FD79c7085435A484a87e0D7", // nrETH
],
v3Factory: "0x81B4029bfCb5302317fe5d35D54544EA3328e30f"
}
}

Object.keys(config).forEach(chain => {
const prestakingAddress = config[chain]
module.exports[chain] = {
tvl: async (api) => {
const data = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolInfo(uint256) view returns (address want, uint256 totalDeposited,uint256,uint256)', target: prestakingAddress, })

const exportsData = Object.keys(config).map((chain) => {
return {[chain] : {
tvl: async (api) => {
const results = [];

const vaults = config[chain].vaults;
if(vaults) {
const data =await api.multiCall({ abi: 'address:asset', calls: vaults, permitFailure: true, })
const tokens = data;
const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults, permitFailure: true, })
bals.forEach((v, i) => v && api.add(tokens[i], v))
}

const prestakingAddress = config[chain].preStaking;
if(prestakingAddress) {

const data = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolInfo(uint256) view returns (address want, uint256 totalDeposited,uint256,uint256)', target: prestakingAddress, })
const tokens = data.map(i => i.want)
const bals = data.map(i => i.totalDeposited)
bals.forEach((v, i) => v && api.add(tokens[i], v))
return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: true, })
}
return (sumUnknownTokens({ api, resolveLP: false, useDefaultCoreAssets: true, }))

}
})
}
}
})
exportsData.push(uniV3Export({
soneium: { factory: soneium.v3Factory, fromBlock: 1812231 },
}))


module.exports = mergeExports(exportsData);

0 comments on commit 8ef3c54

Please sign in to comment.