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

const transformKey = () => 'bsc:0x154a9f9cbd3449ad22fdae23044319d6ef2a1fab';

const config = {
  bsc: {
    SKILL_TOKEN_CONTRACT: '0x154a9f9cbd3449ad22fdae23044319d6ef2a1fab',
    STAKING: [
      '0x895BF27C99822Ef5ba88A3E6764F6247e13f0dfA',
      '0xd6b2D8f59Bf30cfE7009fB4fC00a7b13Ca836A2c',
      '0xc42dF5397B3C0B45DeDaCB83F7aDb1F30B73097d',
      '0x3C06533B42A802f3Ac0E770CCBBeA9fa7Cae9572',
    ],
    GAME_CONTRACT: '0x39Bea96e13453Ed52A734B6ACEeD4c41F57B2271',
    TREASURY_CONTRACT: '0x812Fa2f7d89e5d837450702bd51120920dccaA99'
  },
  heco: {
    SKILL_TOKEN_CONTRACT: '0x27d4DfDB3fDf58e198bA4dbc23B2F82c0b8e3405',
    STAKING: [
      '0x9810A3f2D59772f04846acA2Ba0F01caE6f43B9c',
      '0x6109A500e5b9CE40FFe075Ea3A6beA6e93c23BcF',
    ],
    GAME_CONTRACT: '0x29869EDb088466a49f75654d8F04edd16Bf60e75',
    TREASURY_CONTRACT: '0x7843Bd2aDdE5E54bD6e61C28fA89009240a48C08'
  },
  okexchain: {
    SKILL_TOKEN_CONTRACT: '0xcC137b0713E0DC63b1fA136272014F2A54Dd7aCB',
    STAKING: [
      '0xC5707a6a16CCe1963Ec3E6cdEE0A91e4876Be395',
      '0x105A0Aa801080A89465bA1f8b6696971FD5F3a6D',
    ],
    GAME_CONTRACT: '0x98145a2fEBac238280bbdEDc2757dC162318b16e',
    TREASURY_CONTRACT: '0xcBEfF02841370997054AdfF624dC490C8cB20406'
  },
  polygon: {
    SKILL_TOKEN_CONTRACT: '0x863D6074aFaF02D9D41A5f8Ea83278DF7089aA86',
    STAKING: [
      '0xE34e7cA8e64884E3b5Cd48991ba229d8302E85da',
      '0x96a5448BB59aD9Cccc3a4112c2c57a420768b499',
    ],
    GAME_CONTRACT: '0x070b1A95898B927A900A1F9F42b114154648E51A',
    TREASURY_CONTRACT: '0x216AC39765D920D7f86162Daf9BE1f045f321A8D'
  },
  avax: {
    SKILL_TOKEN_CONTRACT: '0x483416eB3aFA601B9C6385f63CeC0C82B6aBf1fb',
    STAKING: [
      '0x96438Debb1419bF0B53119Edae6e664c931504CA',
      '0xE8f14F0a5a5f059ae060664e0f165B7e5A52e4e5',
    ],
    GAME_CONTRACT: '0x46419526a59ec1d73b72620ae16da091bE8486bd',
    TREASURY_CONTRACT: '0x5B1cCb62D2F9c8523abBa89A56432005cef03b99'
  },
  aurora: {
    SKILL_TOKEN_CONTRACT: '0xE723111a6Ac865EB6E2d62e87432bdC6e2c4a86E',
    STAKING: [
      '0x5F6E97612482095C0c2C02BC495C0171e61017d7',
      '0x07f8aA038CD6a3B5FDC6ed58F608Eb33d98b299e',
    ],
    GAME_CONTRACT: '0x3F715995647fe44Db45411bb9e81b7A1aD5A8387',
    TREASURY_CONTRACT: '0x483416eB3aFA601B9C6385f63CeC0C82B6aBf1fb'
  },
  kava: {
    SKILL_TOKEN_CONTRACT: '0xC28a73FCb6248Cb1718A50a9EC9cBC361dee3ea1',
    STAKING: [
      '0xA0D3F71E7CbCac550bb3f71C27f91a436A02dEC5',
      '0xCb850EEd27fF37B591c88967b5E7bC63De121FBd',
    ],
    GAME_CONTRACT: '0x912252d3f7DaD807d122F7DBAd3D8245fc364C3d',
    TREASURY_CONTRACT: '0x26B4DCb50e07323AC875c071b4F0a1E77b259d29'
  }
}

module.exports = {};

Object.keys(config).forEach(chain => {
  const { SKILL_TOKEN_CONTRACT, STAKING, } = config[chain]
  module.exports[chain] = {
    tvl: () => ({}),
    staking: (_, _b, { [chain]: block }) => {
      return sumTokens2({ chain, block, tokens: [SKILL_TOKEN_CONTRACT], owners: STAKING, transformAddress: transformKey, })
    },
  }
})
