// import BigNumber from "bignumber.js";
// import { caseInsensitiveCompare } from "./object.helpers";
// import { absolutizeValue } from "./numeric.helpers";
// import { TokenInfo } from "../interfaces/token-info.interface";
// import { CoinGeckoService } from "../services/coin-gecko/coin-gecko.service";

// export const TWENTY_SEVEN_DECIMALS = "1e27";

// export type OracleRateMap = Map<string, string>;
// export type PricingRateMap = Map<string, number>;

// export const getOracleRate = (
//   from: string | undefined,
//   to: string | undefined,
//   rateOracleAddress: string,
//   rateMap: OracleRateMap,
//   defaultRate: string = "0",
// ): BigNumber => {
//   return getRateNormalized(from, to, rateOracleAddress, rateMap, defaultRate);
// }

// export const getPricingRateFor = (
//   from: TokenInfo,
//   pricingRateMap: PricingRateMap,
//   to?: TokenInfo,
//   defaultRate: number = 0
// ) => {
//   return CoinGeckoService.getRate(pricingRateMap, from, to);
// };

// export const getRateNormalized = (
//   fromAddress: string | undefined,
//   toAddress: string | undefined,
//   rateOracleAddress: string,
//   rateMap: OracleRateMap,
//   defaultRate: string = "0",
//   fromDecimals: number = 0,
//   toDecimals: number = 0,
// ) => {
//   if (!fromAddress || !toAddress) {
//     return new BigNumber(defaultRate);
//   }

//   if (caseInsensitiveCompare(fromAddress, toAddress)) {
//     return new BigNumber(1);
//   }

//   const decimalsMultiplier = absolutizeValue(1, fromDecimals - toDecimals);
//   const rateInfo = getFullInfoRateFor(fromAddress, toAddress, rateOracleAddress, rateMap);

//   if (rateInfo) {
//     return new BigNumber(rateInfo || 0).div(TWENTY_SEVEN_DECIMALS).times(decimalsMultiplier);
//   }

//   const reversedRateInfo = getFullInfoRateFor(toAddress, fromAddress, rateOracleAddress, rateMap);

//   if (reversedRateInfo) {
//     return new BigNumber(reversedRateInfo || 0).div(TWENTY_SEVEN_DECIMALS).pow(-1).times(decimalsMultiplier);
//   }

//   return new BigNumber(defaultRate);
// }

// const getFullInfoRateFor = (from: string, to: string, oracle: string, rateMap: OracleRateMap): string | undefined => {
//   return rateMap.get(getOracleRateKey(from, to, oracle));
// }

// export const getPricingFullInfoRateFor = (from: TokenInfo, rateMap: PricingRateMap, to?: TokenInfo): number | undefined => {
//   return CoinGeckoService.getRate(rateMap, from, to);
// };

// export const addRateToMap = (from: string, to: string, oracle: string, value: string, rateMap: OracleRateMap): OracleRateMap => {
//   rateMap.set(getOracleRateKey(from, to, oracle), value);

//   return rateMap;
// }

// const KEY_SPLITTER = "/";

// const getOracleRateKey = (from: string, to: string, oracle: string) =>
//   `${from.toLowerCase()}${KEY_SPLITTER}${to.toLowerCase()}${KEY_SPLITTER}${oracle.toLowerCase()}`;

