diff --git a/src/renderer/helpers/poolHelper.test.ts b/src/renderer/helpers/poolHelper.test.ts index ad7dd8c92..b7cf1b136 100644 --- a/src/renderer/helpers/poolHelper.test.ts +++ b/src/renderer/helpers/poolHelper.test.ts @@ -17,6 +17,7 @@ import * as O from 'fp-ts/lib/Option' import { ASSETS_TESTNET } from '../../shared/mock/assets' import { PoolDetails } from '../services/midgard/types' import { toPoolData } from '../services/midgard/utils' +import { DEFAULT_MIMIR_HALT } from '../services/thorchain/const' import { GetPoolsStatusEnum, PoolDetail } from '../types/generated/midgard' import { disableAllActions, @@ -177,7 +178,7 @@ describe('helpers/poolHelper/', () => { const result = disableAllActions({ chain: BNBChain, haltedChains, - mimirHalt: { haltThorChain: true, haltEthChain: false } + mimirHalt: { ...DEFAULT_MIMIR_HALT, haltThorChain: true } }) expect(result).toBeTruthy() }) @@ -185,7 +186,7 @@ describe('helpers/poolHelper/', () => { const result = disableAllActions({ chain: LTCChain, haltedChains, - mimirHalt: { haltThorChain: true, haltEthChain: false } + mimirHalt: { ...DEFAULT_MIMIR_HALT, haltThorChain: true } }) expect(result).toBeTruthy() }) @@ -193,7 +194,7 @@ describe('helpers/poolHelper/', () => { const result = disableAllActions({ chain: ETHChain, haltedChains, - mimirHalt: { haltThorChain: false, haltEthChain: true } + mimirHalt: { ...DEFAULT_MIMIR_HALT, haltEthChain: true } }) expect(result).toBeTruthy() }) @@ -201,7 +202,7 @@ describe('helpers/poolHelper/', () => { const result = disableAllActions({ chain: LTCChain, haltedChains, - mimirHalt: { haltThorChain: false, haltEthChain: true } + mimirHalt: { ...DEFAULT_MIMIR_HALT, haltEthChain: true } }) expect(result).toBeFalsy() }) @@ -209,7 +210,7 @@ describe('helpers/poolHelper/', () => { const result = disableAllActions({ chain: ETHChain, haltedChains, - mimirHalt: { haltThorChain: false, haltEthChain: false } + mimirHalt: DEFAULT_MIMIR_HALT }) expect(result).toBeTruthy() }) @@ -217,7 +218,7 @@ describe('helpers/poolHelper/', () => { const result = disableAllActions({ chain: BNBChain, haltedChains, - mimirHalt: { haltThorChain: false, haltEthChain: false } + mimirHalt: DEFAULT_MIMIR_HALT }) expect(result).toBeTruthy() }) @@ -225,7 +226,7 @@ describe('helpers/poolHelper/', () => { const result = disableAllActions({ chain: LTCChain, haltedChains, - mimirHalt: { haltThorChain: false, haltEthChain: false } + mimirHalt: DEFAULT_MIMIR_HALT }) expect(result).toBeFalsy() }) diff --git a/src/renderer/helpers/poolHelper.ts b/src/renderer/helpers/poolHelper.ts index ff6df0932..6fd1d42fc 100644 --- a/src/renderer/helpers/poolHelper.ts +++ b/src/renderer/helpers/poolHelper.ts @@ -17,7 +17,7 @@ import { PoolDetail } from '../types/generated/midgard' import { PoolTableRowData, PoolTableRowsData, PricePool } from '../views/pools/Pools.types' import { getPoolTableRowData } from '../views/pools/Pools.utils' import { isRuneNativeAsset, convertBaseAmountDecimal, to1e8BaseAmount } from './assetHelper' -import { isEthChain } from './chainHelper' +import { isBchChain, isBnbChain, isBtcChain, isEthChain, isLtcChain } from './chainHelper' import { eqChain } from './fp/eq' import { ordBaseAmount } from './fp/ord' import { sequenceTOption, sequenceTOptionFromArray } from './fpHelpers' @@ -169,19 +169,31 @@ const isChainElem = A.elem(eqChain) export const disableAllActions = ({ chain, haltedChains, - mimirHalt: { haltThorChain, haltEthChain } + mimirHalt: { haltThorChain, haltEthChain, haltBnbChain, haltLtcChain, haltBtcChain, haltBchChain } }: { chain: Chain haltedChains: Chain[] mimirHalt: MimirHaltChain }) => { - // 1. Check `haltThorChain` (provided by `mimir` endpoint) to disable all actions for all pools + // Check `haltThorChain` (provided by `mimir` endpoint) to disable all actions for all pools if (haltThorChain) return true - // 2. Check `haltEthChain` (provided by `mimir` endpoint) to disable all actions for ETH pools + // Check `haltBnbChain` (provided by `mimir` endpoint) to disable all actions for BNB pools + if (isBnbChain(chain) && haltBnbChain) return true + + // Check `haltBtcChain` (provided by `mimir` endpoint) to disable all actions for BTC pools + if (isBtcChain(chain) && haltBtcChain) return true + + // Check `haltBchChain` (provided by `mimir` endpoint) to disable all actions for BCH pools + if (isBchChain(chain) && haltBchChain) return true + + // Check `haltLtcChain` (provided by `mimir` endpoint) to disable all actions for LTC pools + if (isLtcChain(chain) && haltLtcChain) return true + + // Check `haltEthChain` (provided by `mimir` endpoint) to disable all actions for ETH pools if (isEthChain(chain) && haltEthChain) return true - // 3. Check `chain` is included in `haltedChains` (provided by `inbound_addresses` endpoint) + // Check `chain` is included in `haltedChains` (provided by `inbound_addresses` endpoint) return FP.pipe(haltedChains, isChainElem(chain)) }