import { sameEVMAddress } from "./util";

export type CoinType = {
  name: string;
  symbol: string;
  decimals: number;
  address: string;
  chainID: number;
  isNative?: boolean;
  noIcon?: boolean;
  totalSupply?: string;
  icon?: string;
};
export const coins: CoinType[] = [
  {
    name: "IDC",
    symbol: "IDC",
    decimals: 18,
    address: "0x46C2448b1C3D24478AF820488b63E05Bd8f9bC13",
    chainID: 1,
    isNative: true,
    noIcon: true,
  },
  {
    name: "WBNB",
    symbol: "WBNB",
    decimals: 18,
    address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    chainID: 56,
    isNative: false,
  },
  {
    name: "USDT",
    symbol: "USDT",
    decimals: 18,
    address: "0x55d398326f99059fF775485246999027B3197955",
    chainID: 56,
  },
  {
    name: "BUSD",
    symbol: "BUSD",
    decimals: 18,
    address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
    chainID: 56,
  },
  {
    name: "USDC",
    symbol: "USDC",
    decimals: 18,
    address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
    chainID: 56,
  },
  {
    name: "WETH",
    symbol: "WETH",
    decimals: 18,
    address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    chainID: 1,
    isNative: false,
  },

  {
    name: "USDT",
    symbol: "USDT",
    decimals: 6,
    address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    chainID: 1,
  },

  {
    name: "USDC",
    symbol: "USDC",
    decimals: 6,
    address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    chainID: 1,
  },
  {
    name: "WETH",
    symbol: "WETH",
    decimals: 18,
    address: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
    chainID: 5,
  },
  {
    name: "USDT2",
    symbol: "USDT2",
    decimals: 18,
    address: "0x636e7652db6a961e47459586Ecf256358a6f15f9",
    chainID: 5,
  },
  {
    name: "USDT1",
    symbol: "USDT1",
    decimals: 6,
    address: "0x15102793B94Bfe71b82acB884806E33b6AD5552A",
    chainID: 5,
  },
  {
    name: "NEC",
    symbol: "NEC",
    decimals: 18,
    address: "0x1D3a434EeaC22d9935C14557d04B6b2D466696F7",
    chainID: 5,
    noIcon: true,
  },
  {
    name: "USDT",
    symbol: "USDT",
    decimals: 6,
    address: "0x7E89c2b18B269864DE7caC7fCbCe64b2BF74b75D",
    chainID: 97,
    noIcon: true,
  },
  {
    name: "NEC",
    symbol: "NEC",
    decimals: 18,
    address: "0xAA70F21FAcedDd91CD50988bB0780D363Ec42870",
    chainID: 97,
    noIcon: true,
  },
  {
    name: "IDC",
    symbol: "IDC",
    decimals: 18,
    address: "0xe21Ec84E66acD04ca1c4037b989210Faf1b7398C",
    chainID: 97,
    noIcon: true,
  },
  {
    name: "Tether USD",
    symbol: "USDT",
    decimals: 6,
    address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
    chainID: 137,
  },
  {
    name: "USDT",
    symbol: "USDT",
    decimals: 6,
    address: "0xC0AC5CCF66c08a3115B0dd984aab7D07587D5f76",
    chainID: 80001,
    noIcon: true,
  },
  {
    name: "NEC",
    symbol: "NEC",
    decimals: 18,
    address: "0x3fc2582317d97ca524288ee800802c12471b36e5",
    chainID: 80001,
    noIcon: true,
  },
  {
    name: "IDC",
    symbol: "IDC",
    decimals: 18,
    address: "0x87db11d115222522d97ea4ceeddfa1e8e7409b8d",
    chainID: 80001,
    noIcon: true,
  },
];

export const findCoinByAddress = (address: string) => {
  const coin = coins.find((i) => {
    return sameEVMAddress(i.address, address);
  });
  if (coin) {
    return coin;
  }
  return null;
};
