This commit is contained in:
Aleksandr Kraiz
2023-02-13 19:35:58 +04:00
parent 0ed3611a31
commit 40fa9d6b52
9 changed files with 31 additions and 30 deletions

View File

@@ -90,7 +90,7 @@ export default class FarmingManager {
const poolsConfig = await simpleFetch(this.orionUnit.orionBlockchain.getPoolsConfig)();
const pool = poolsConfig.pools[poolName];
if (pool === undefined) throw new Error(`Pool ${poolName} not found`);
if (!pool) throw new Error(`Pool ${poolName} not found`);
const pairContract = IUniswapV2Pair__factory
.connect(pool.lpTokenAddress, this.orionUnit.provider);
@@ -183,7 +183,7 @@ export default class FarmingManager {
if (assetAIsNativeCurrency || assetBIsNativeCurrency) {
const contractBalance = balances[nativeCryptocurrency]?.exchange;
if (contractBalance === undefined) throw new Error(`No balance for '${nativeCryptocurrency}'`);
if (!contractBalance) throw new Error(`No balance for '${nativeCryptocurrency}'`);
const nativeAssetAmount = assetBIsNativeCurrency ? assetBAmount : assetAAmount;
if (nativeAssetAmount.gt(contractBalance)) {
@@ -242,7 +242,7 @@ export default class FarmingManager {
const poolsConfig = await simpleFetch(this.orionUnit.orionBlockchain.getPoolsConfig)();
const pool = poolsConfig.pools[poolName];
if (pool === undefined) throw new Error(`Pool ${poolName} not found`);
if (!pool) throw new Error(`Pool ${poolName} not found`);
const walletAddress = await signer.getAddress();

View File

@@ -42,7 +42,7 @@ export default class OrionUnit {
constructor(config: VerboseOrionUnitConfig) {
this.config = config;
const chainInfo = chains[config.chainId];
if (chainInfo === undefined) throw new Error('Chain info is required');
if (!chainInfo) throw new Error('Chain info is required');
// if ('env' in config)
// this.env = config.env;