const { staking } = require('../helper/staking')
const { sumTokens2 } = require('../helper/unwrapLPs')

const SHEZ = "0x5fE72ed557d8a02FFf49B3B826792c765d5cE162"
const SHEZ_ETH_LP = "0x74E6cAc32234133Fe06bD0f4D8237dEe1dedE057"

// erc20 vaults
const vaults = [
  "0xF89127a7839Ae1918e742A99E39182adec9C7e48", // USDC_SHEZUSD_VAULT
  "0xd116641185B1BD999b92B513657C95f78C8ae872", // wstETH_SHEZUSD_VAULT
  "0x092dBbFCb19D1763798CD46bA1635Eaf3C9BA1cD", // wstETH_SHEZETH_VAULT
  "0x5439046DC57EdE3Ff6aBA8563108326AdDE9C33b", // weETH_SHEZUSD_VAULT
  "0x7648cff49EBa2631Ea4Ae8013Dc6Eb54C1c783f2", // weETH_SHEZETH_VAULT
  "0x4DBBDF30BC801a65f6978ab629EAd5267Ac02497", // sUSDe_SHEZETH_VAULT
  "0x8A8355317936Ef99E4515567b1c9CC8B86e52a3b", // sfrxETH_SHEZETH_VAULT
  "0x84D45BF4a70605fc84D618e1809E90f73dA8f369", // ptUniETH_SHEZETH_VAULT
  "0xF00A9f21a72FabCfBAeEfa70D08D947f61B2D16C", // wOETH_SHEZUSD_VAULT
  "0x95D970fa98bf608862aE76b5492E53E701210E9F", // wOETH_SHEZETH_VAULT
  "0x6625364D0499EcEB5C9308c90eb660B96dFd0746", // WETH_SHEZUSD_VAULT
  "0x6261a4a8776343192f3bdeC04F7909591c375cfb", // WETH_SHEZETH_VAULT
  "0x3d0D2bDd6f0118ad6194aab84f10Fde688502d16", // WBTC_SHEZUSD_VAULT
  "0xED3529B182292f2e33988D852e1a9da0821FBC6e", // CRV_SHEZUSD_VAULT
]

// SHEZ single staking v1
const SHEZ_SINGLE_STAKING_V1 = "0xB775f1c426849Ba75891258abA496F69D2e6F570";

// SHEZ-ETH LP pool
const SHEZ_ETH_LP_POOL = "0x4574220A54b0306c2CBEc22A3B6C69158b27f1da";

async function tvl(api) {
  const tokens = await api.multiCall({ abi: 'address:tokenContract', calls: vaults })
  return sumTokens2({ api, tokensAndOwners2: [tokens, vaults] })
}

module.exports = {
  ethereum: {
    tvl,
    pool2: staking(SHEZ_ETH_LP_POOL, SHEZ_ETH_LP),
    staking: staking(SHEZ_SINGLE_STAKING_V1, SHEZ),
  },
}