const ADDRESSES = require('../helper/coreAssets.json')
const { sumUnknownTokens } = require("../helper/unknownTokens");
const { staking } = require('../helper/staking')
const WSGB = ADDRESSES.songbird.WSGB
const CANARY_DOLLAR = ADDRESSES.songbird.CAND
 const EXFI = ADDRESSES.songbird.EXFI;
 const SFIN = ADDRESSES.songbird.SFIN;

const chain = 'songbird'

const LPs ={
  SGB_CAND_LP:	'0x47C830E141234d029D953dF39B13d7728eB9f2d4',
  EXFI_CAND_LP:	'0xB5BF334B8Cc30B8B13fc035d171D77A217aaB091',
  SFIN_CAND_LP:	'0x48195Ca4D228ce487AE2AE1335B017a95493Ade6',
  EXFI_SGB_LP:	'0xC6D2f9e21bcD963B42D85379581003be1146b3Aa',
  EXFI_SFIN_LP:	'0xcD15C231b8A0Bae40bD7938AE5eA8e43f1e9a15F',
  SGB_COOT_LP:	'0x07852D5C7fd1d630Dd79148A195aaAF72241680D',
  SFIN_SGB_LP:	'0x5D4e155CA27e8DAd4E4aceE48F83B6E0E4AFEec0',
  SGB_ExXDC_LP:	'0x3233642aCf7664a69c33e5a6FFAb321608d7A65f',
  EXFI_ExXDC_LP:	'0xc41aA3ac0e6efcb780cd4696E7eC3B8193BB46E1',
  SGB_ExUSDT_LP:	'0x3b3C6d96EB6fd413f889573df6f0bd234B298D0C',
  SGB_ExETH_LP:	'0x8741083F971d5d96Be7F007528424d5732d9cDea',
  SFIN_ExXDC_LP:	'0x23e228B819b360B7028265d742905A4f61Ee2A43'
}


// farms which reward SFIN
// [LP token address, farm address]
async function farmTvl(timestamp, ethblock, { [chain]: block }) {
  const tokens = [
    [WSGB, "0x6BA0F675EB2f169D15764D5cf10C4EF0e9e059f2"], 
    [EXFI, "0xc9231AB30b2B39c1f7f79132D7a44bBF0F8144B0"], 
    [CANARY_DOLLAR, "0x32b36B0A8B74Ac9212946a99e0af727848D5A3A1"], 
    [LPs.EXFI_SGB_LP, "0x02785B7CE6Eb9A5858561DDAB64cCBE5c478b730"],
    [LPs.SGB_COOT_LP, "0x50756c69CAC800a3fA03d130721CDa02Aa0fEF69"],
    [LPs.EXFI_CAND_LP, "0x864201b2227Ee23f0875c5D3Fc49F4F0ec59aC19"],
    [LPs.SGB_CAND_LP, "0x921E8f58cF517d289c01BCBE800c2d31838c1a28"],
    [EXFI, "0xad72C1483bBAB54B7f4e0024f6D4b437a69DA48b"],
    [EXFI, "0xbEDfFd817383147616131ED38B7030277609d8B7"],
    [EXFI, "0x6FD8A1a58645aaB92Aa6858b42a8dd985714fE15"],
    [EXFI, "0x7e48Db2b486Cf90150421cBdcA401B86833F5333"],
    [LPs.SGB_CAND_LP, "0xc387818C274a365D973AAb8287498350757D7b1f"],
    [LPs.EXFI_CAND_LP,'0x53Fb520ea993C58dB5035b3a00FABB0dc8fE3CA4'],
    [LPs.SGB_CAND_LP,'0xb4bD741343727EcBdACDE37124D869104b0AcAf8'],
    [LPs.EXFI_SGB_LP,'0x1d1FAD6faAFc6a5Cd6652fFA7BA43F9E4fa75C0d'],
    [EXFI, '0xD02C3e166223EE78F4d0ae99F5396142b48D97FE'], 
    [WSGB, '0x745d8896629842ef8E44D269f89A7A873086A6F2'],
    [EXFI, "0x61128b44C299b0f7a752BF6278f44f1EcefD9109"],
    [LPs.SGB_ExXDC_LP,'0xF81B465C562ED3f54Aea772D8A56FAF93884ea2E'],
    [EXFI, "0x3B346b0b091fA8813f60Cd6e81b95b63375e22f5"],
    [LPs.EXFI_ExXDC_LP, "0xa275DD75C1182055C7039b839cC0Da017c78933a"],
    [EXFI,"0x74C09E58AB2fb74dF729000e36D338016396ee67"],
    [LPs.SGB_ExUSDT_LP,"0xf2773bb7aa49FE3da03D327Abc0C49dB296133f3"],
    [LPs.SGB_ExETH_LP,"0xa26e3420adbBAB053657D0b732A61B386576cC7D"],
    [EXFI, '0xb78EBd4B13A2202068618BF98F952C0271159107'],
    [LPs.SGB_CAND_LP, '0x6734b6e84195Df55E171c305D021101b5601B112'],
    [LPs.EXFI_CAND_LP, '0x646262202Ffe1dE7d429802087F24D075121Ed8c'],
    [LPs.EXFI_SGB_LP, '0xa3Eb6580bA9A0D6104EAAc63c077A185b6084b5f'],
    [EXFI, '0x0a45bBE7e88B812e3DaB08B30093aF9b2A25477b'],
    [EXFI, '0x645b0743A9899c1844b2036ffA443652737bc786'],
  ];

  return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, })
}

// farms where SFIN is one part of the pair
async function pool2(timestamp, ethblock, { [chain]: block }) {
  const tokens = [
    [LPs.EXFI_SFIN_LP, "0x0732f6B4aBE5dB2127E671E4B218d340b6af169c"],
    [LPs.EXFI_SFIN_LP, "0x3b343A6FC05B699F48CBe6FF127C0af8e2aA9EEE"],
    [LPs.EXFI_SFIN_LP, "0x782BdE5353FAcFab1eBeC1803f2a575346193B30"],
    [LPs.SFIN_CAND_LP, "0xc5478a1d5914cF9D0Ee20Da21459502eCb7E1646"],
    [LPs.SFIN_CAND_LP, "0x9185D70f17eC13897D780601708b1b1F36A75d32"],
    [LPs.EXFI_SFIN_LP, "0xD262AFf2Bb76f05cf470a7D935E717eEbA8ef799"],
    [LPs.SFIN_SGB_LP, "0x2379FD47f100828382fFeaF26381Ba6608f7Bf73"],
    [LPs.SFIN_SGB_LP, "0xC1ecfEA1148f9506FF10E9Ecf76F40884b4987Cc"], 
    [LPs.EXFI_SFIN_LP, "0xDa78E41813Cc2468bAA74ad3E84b35b7FedF42bD"],
    [LPs.EXFI_SFIN_LP, '0x696E746d34703c9d640438Cc466eF58bCb7ce7c7'],
    [LPs.SFIN_CAND_LP, '0x53828fF47a6d110416a884668566c6E7806d0613'],
    [LPs.SFIN_SGB_LP, '0x0CC30B8D3d0246f691B35Ef3dA5Bf2A71CBdbceF'],
    [LPs.EXFI_SFIN_LP,"0x0E437e1c7371b2ac0f3040e2B5866c9cb2e6EA64"],
    [LPs.EXFI_SFIN_LP,"0xBdeF97BEb0a9f949b3542E60E89e66C354D299Ae"],
    [LPs.SFIN_ExXDC_LP,"0x9E7d575014489B3557D3c53E837b772E7A1EB27c"],
  ]
  return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, })
}

module.exports =  {
    tvl: farmTvl,
    pool2,
    staking: staking(['0x554742076743b366504972F86609d64fd18BDC34', '0xd0dbAFF52224C0882cfaf1765f347Cb5e4364FA1','0xfe21dE68CbFB3dcBda28Ee8aB465dbA2039bc1f6'], SFIN),
};