import type { JsonFragment } from "ethers";
import { Abi, erc20Abi } from "viem";

import CustomErrors from "./CustomErrors.json" with { type: "json" };
import DataStore from "./DataStore.json" with { type: "json" };
import ERC721 from "./ERC721.json" with { type: "json" };
import EventEmitter from "./EventEmitter.json" with { type: "json" };
import ExchangeRouter from "./ExchangeRouter.json" with { type: "json" };
import GlpManager from "./GlpManager.json" with { type: "json" };
import GlvReader from "./GlvReader.json" with { type: "json" };
import GlvRouter from "./GlvRouter.json" with { type: "json" };
import GMT from "./GMT.json" with { type: "json" };
import GmxMigrator from "./GmxMigrator.json" with { type: "json" };
import GovToken from "./GovToken.json" with { type: "json" };
import MintableBaseToken from "./MintableBaseToken.json" with { type: "json" };
import Multicall from "./Multicall.json" with { type: "json" };
import OrderBook from "./OrderBook.json" with { type: "json" };
import OrderBookReader from "./OrderBookReader.json" with { type: "json" };
import OrderExecutor from "./OrderExecutor.json" with { type: "json" };
import PositionManager from "./PositionManager.json" with { type: "json" };
import PositionRouter from "./PositionRouter.json" with { type: "json" };
import Reader from "./Reader.json" with { type: "json" };
import ReaderV2 from "./ReaderV2.json" with { type: "json" };
import ReferralStorage from "./ReferralStorage.json" with { type: "json" };
import RewardReader from "./RewardReader.json" with { type: "json" };
import RewardRouter from "./RewardRouter.json" with { type: "json" };
import RewardTracker from "./RewardTracker.json" with { type: "json" };
import RouterV2 from "./Router-v2.json" with { type: "json" };
import Router from "./Router.json" with { type: "json" };
import SubaccountRouter from "./SubaccountRouter.json" with { type: "json" };
import SyntheticsReader from "./SyntheticsReader.json" with { type: "json" };
import SyntheticsRouter from "./SyntheticsRouter.json" with { type: "json" };
import Timelock from "./Timelock.json" with { type: "json" };
import Token from "./Token.json" with { type: "json" };
import Treasury from "./Treasury.json" with { type: "json" };
import UniPool from "./UniPool.json" with { type: "json" };
import UniswapV2 from "./UniswapV2.json" with { type: "json" };
import Vault from "./Vault.json" with { type: "json" };
import VaultReader from "./VaultReader.json" with { type: "json" };
import VaultV2 from "./VaultV2.json" with { type: "json" };
import VaultV2b from "./VaultV2b.json" with { type: "json" };
import Vester from "./Vester.json" with { type: "json" };
import WETH from "./WETH.json" with { type: "json" };
import YieldFarm from "./YieldFarm.json" with { type: "json" };
import YieldToken from "./YieldToken.json" with { type: "json" };

export type AbiId =
  | "CustomErrors"
  | "DataStore"
  | "ERC721"
  | "ERC20"
  | "EventEmitter"
  | "ExchangeRouter"
  | "GlpManager"
  | "GlvReader"
  | "GlvRouter"
  | "GMT"
  | "GmxMigrator"
  | "GovToken"
  | "MintableBaseToken"
  | "Multicall"
  | "OrderBook"
  | "OrderBookReader"
  | "OrderExecutor"
  | "PositionManager"
  | "PositionRouter"
  | "Reader"
  | "ReaderV2"
  | "ReferralStorage"
  | "RewardReader"
  | "RewardRouter"
  | "RewardTracker"
  | "Router-v2"
  | "Router"
  | "SubaccountRouter"
  | "SyntheticsReader"
  | "SyntheticsRouter"
  | "Timelock"
  | "Token"
  | "Treasury"
  | "UniPool"
  | "UniswapV2"
  | "Vault"
  | "VaultReader"
  | "VaultV2"
  | "VaultV2b"
  | "Vester"
  | "WETH"
  | "YieldFarm"
  | "YieldToken";

export const abis: Record<AbiId, readonly (Abi[number] & JsonFragment)[]> = {
  CustomErrors: CustomErrors.abi,
  DataStore: DataStore.abi,
  ERC721: ERC721.abi,
  ERC20: erc20Abi,
  EventEmitter: EventEmitter.abi,
  ExchangeRouter: ExchangeRouter.abi,
  GlpManager: GlpManager.abi,
  GlvReader: GlvReader.abi,
  GlvRouter: GlvRouter.abi,
  GMT: GMT.abi,
  GmxMigrator: GmxMigrator.abi,
  GovToken: GovToken.abi,
  MintableBaseToken: MintableBaseToken.abi,
  Multicall: Multicall.abi,
  OrderBook: OrderBook.abi,
  OrderBookReader: OrderBookReader.abi,
  OrderExecutor: OrderExecutor.abi,
  PositionManager: PositionManager.abi,
  PositionRouter: PositionRouter.abi,
  Reader: Reader.abi,
  ReaderV2: ReaderV2.abi,
  ReferralStorage: ReferralStorage.abi,
  RewardReader: RewardReader.abi,
  RewardRouter: RewardRouter.abi,
  RewardTracker: RewardTracker.abi,
  RouterV2: RouterV2.abi,
  Router: Router.abi,
  SubaccountRouter: SubaccountRouter.abi,
  SyntheticsReader: SyntheticsReader.abi,
  SyntheticsRouter: SyntheticsRouter.abi,
  Timelock: Timelock.abi,
  Token: Token.abi,
  Treasury: Treasury.abi,
  UniPool: UniPool.abi,
  UniswapV2: UniswapV2.abi,
  Vault: Vault.abi,
  VaultReader: VaultReader.abi,
  VaultV2: VaultV2.abi,
  VaultV2b: VaultV2b.abi,
  Vester: Vester.abi,
  WETH: WETH.abi,
  YieldFarm: YieldFarm.abi,
  YieldToken: YieldToken.abi,
} as any;
