Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Cherry pick changes of 0.4.5 into develop (#1906)
Browse files Browse the repository at this point in the history
  • Loading branch information
veado authored Oct 28, 2021
1 parent a9560cb commit f30453b
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 0.5.0 (2021-10-28)
# 0.5.0 (2021-10-29)

## Add

Expand Down Expand Up @@ -36,6 +36,12 @@
- Set testnet as default network in development mode [#1851](https://github.com/thorchain/asgardex-electron/pull/1851)
- Update to latest npm dependencies (19-10-2021) [#1864](https://github.com/thorchain/asgardex-electron/pull/1864)

# 0.4.5 (2021-10-28)

## Fix

- [Mimir] Consider mimir//PAUSELP [#1902](https://github.com/thorchain/asgardex-electron/issues/1902)

# 0.4.4 (2021-10-12)

## Add
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "asgardex",
"productName": "ASGARDEX",
"version": "0.4.4",
"version": "0.4.5",
"description": "WALLET AND EXCHANGE CLIENT FOR THORCHAIN",
"main": "index.js",
"scripts": {
Expand Down
52 changes: 51 additions & 1 deletion src/renderer/helpers/poolHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ describe('helpers/poolHelper/', () => {
units: '0',
volume24h: '0',
liquidityUnits: '0',
synthUnits: '0'
synthUnits: '0',
synthSupply: '0'
}
const pool1: PoolDetail = { ...mockPoolDetail, status: GetPoolsStatusEnum.Staged, runeDepth: '1000' }
const pool2: PoolDetail = { ...mockPoolDetail, status: GetPoolsStatusEnum.Available, runeDepth: '2000' }
Expand Down Expand Up @@ -370,6 +371,15 @@ describe('helpers/poolHelper/', () => {
})
expect(result).toBeTruthy()
})

it('true if LP is paused', () => {
const result = disablePoolActions({
chain: BNBChain,
haltedChains: [ETHChain, BNBChain],
mimirHalt: { ...DEFAULT_MIMIR_HALT, pauseLp: true }
})
expect(result).toBeTruthy()
})
it('true if BNB chain is not in halted list, but paused', () => {
const result = disablePoolActions({
chain: BNBChain,
Expand All @@ -378,6 +388,14 @@ describe('helpers/poolHelper/', () => {
})
expect(result).toBeTruthy()
})
it('true if BNB chain is not in halted list, but LP paused', () => {
const result = disablePoolActions({
chain: BNBChain,
haltedChains: [],
mimirHalt: { ...DEFAULT_MIMIR_HALT, pauseLp: true }
})
expect(result).toBeTruthy()
})
it('true if BTC chain is not in halted list, but paused', () => {
const result = disablePoolActions({
chain: BTCChain,
Expand All @@ -386,6 +404,14 @@ describe('helpers/poolHelper/', () => {
})
expect(result).toBeTruthy()
})
it('true if BTC chain is not in halted list, but LP paused', () => {
const result = disablePoolActions({
chain: BTCChain,
haltedChains: [],
mimirHalt: { ...DEFAULT_MIMIR_HALT, pauseLp: true }
})
expect(result).toBeTruthy()
})
it('true if BCH chain is not in halted list, but paused', () => {
const result = disablePoolActions({
chain: BCHChain,
Expand All @@ -394,6 +420,14 @@ describe('helpers/poolHelper/', () => {
})
expect(result).toBeTruthy()
})
it('true if BCH chain is not in halted list, but LP paused', () => {
const result = disablePoolActions({
chain: BCHChain,
haltedChains: [],
mimirHalt: { ...DEFAULT_MIMIR_HALT, pauseLp: true }
})
expect(result).toBeTruthy()
})
it('true if ETH chain is not in halted list, but paused', () => {
const result = disablePoolActions({
chain: ETHChain,
Expand All @@ -402,6 +436,14 @@ describe('helpers/poolHelper/', () => {
})
expect(result).toBeTruthy()
})
it('true if ETH chain is not in halted list, but LP paused', () => {
const result = disablePoolActions({
chain: ETHChain,
haltedChains: [],
mimirHalt: { ...DEFAULT_MIMIR_HALT, pauseLp: true }
})
expect(result).toBeTruthy()
})
it('true if LTC chain is not in halted list, but paused', () => {
const result = disablePoolActions({
chain: LTCChain,
Expand All @@ -410,5 +452,13 @@ describe('helpers/poolHelper/', () => {
})
expect(result).toBeTruthy()
})
it('true if LTC chain is not in halted list, but LP paused', () => {
const result = disablePoolActions({
chain: LTCChain,
haltedChains: [],
mimirHalt: { ...DEFAULT_MIMIR_HALT, pauseLp: true }
})
expect(result).toBeTruthy()
})
})
})
3 changes: 2 additions & 1 deletion src/renderer/helpers/poolHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,14 @@ export const disableTradingActions = ({
export const disablePoolActions = ({
chain,
haltedChains,
mimirHalt: { pauseLpBnb, pauseLpBch, pauseLpBtc, pauseLpEth, pauseLpLtc }
mimirHalt: { pauseLp, pauseLpBnb, pauseLpBch, pauseLpBtc, pauseLpEth, pauseLpLtc }
}: {
chain: Chain
haltedChains: Chain[]
mimirHalt: MimirPauseLP
}) => {
// Check all `pauseLp{chain}` values (provided by `mimir` endpoint) to disable pool actions
if (pauseLp) return true
if (isBnbChain(chain) && pauseLpBnb) return true
if (isBchChain(chain) && pauseLpBch) return true
if (isBtcChain(chain) && pauseLpBtc) return true
Expand Down
1 change: 1 addition & 0 deletions src/renderer/hooks/useMimirHalt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const useMimirHalt = (): { mimirHaltRD: MimirHaltRD; mimirHalt: MimirHalt
haltEthTrading: mimir['mimir//HALTETHTRADING'] === 1,
haltLtcTrading: mimir['mimir//HALTLTCTRADING'] === 1,
// `PAUSELP{chain}` flags
pauseLp: mimir['mimir//PAUSELP'] === 1,
pauseLpBnb: mimir['mimir//PAUSELPBNB'] === 1,
pauseLpBch: mimir['mimir//PAUSELPBCH'] === 1,
pauseLpBtc: mimir['mimir//PAUSELPBTC'] === 1,
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/i18n/de/halt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const halt: HaltMessages = {
'halt.chains': '{chains} Chains wurden vorübergehend gestoppt.',
'halt.chain.trading': 'Der Handel für {chains} Chain(s) wurde vorübergehend gestoppt.',
'halt.chain.pause':
'Liquidity-Aktivitäten (Hinzufügen/Entfernen) für {chains} Chain(s) wurde vorübergehend gestoppt.',
'Liquidity-Aktivitäten (Hinzufügen/Entfernen) wurden für {chains} Chain(s) vorübergehend gestoppt.',
'halt.chain.pauseall': 'Liquidity-Aktivitäten (Hinzufügen/Entfernen) wurden für alle Chains vorübergehend gestoppt.',
'halt.chain.upgrade': 'Upgrade für {chains} ist vorübergehend deaktiviert.'
}

Expand Down
1 change: 1 addition & 0 deletions src/renderer/i18n/en/halt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const halt: HaltMessages = {
'halt.chains': '{chains} chains have been halted temporarily.',
'halt.chain.trading': 'Trade has been halted for {chains} chain(s) temporarily.',
'halt.chain.pause': 'Liquidity activities (add/remove) for {chains} chain(s) have been disabled temporarily.',
'halt.chain.pauseall': 'Liquidity activities (add/remove) for all chains have been disabled temporarily.',
'halt.chain.upgrade': 'Upgrade for {chains} is disabled for maintenance temporarily.'
}

Expand Down
1 change: 1 addition & 0 deletions src/renderer/i18n/fr/halt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const halt: HaltMessages = {
'halt.chain.trading': 'L’échange pour {chains} est temporairement interrompu.',
'halt.chain.pause':
'Les activités de liquidité (ajouter/retirer) pour la(es) chaîne(s) {chains} sont temporairement désactivées.',
'halt.chain.pauseall': 'Liquidity activities (add/remove) for all chains have been disabled temporarily. - FR',
'halt.chain.upgrade': 'La mise à jour pour {chains} est temporairement désactivée pour maintenance.'
}

Expand Down
1 change: 1 addition & 0 deletions src/renderer/i18n/ru/halt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const halt: HaltMessages = {
'halt.chains': 'Торговля для цепей {chains} приостановлена.',
'halt.chain.trading': 'Торговля {chains} временно приостановлена.',
'halt.chain.pause': 'Liquidity activities (add/remove) for {chains} chain(s) have been disabled temporarily - RU.',
'halt.chain.pauseall': 'Liquidity activities (add/remove) for all chains have been disabled temporarily. - RU',
'halt.chain.upgrade': 'Обновление для {chains} временно приостановлено для поддержки.'
}

Expand Down
1 change: 1 addition & 0 deletions src/renderer/i18n/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ export type HaltMessageKey =
| 'halt.chain.trading'
| 'halt.chain.upgrade'
| 'halt.chain.pause'
| 'halt.chain.pauseall'

export type HaltMessages = { [key in HaltMessageKey]: string }

Expand Down
1 change: 1 addition & 0 deletions src/renderer/services/thorchain/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const DEFAULT_MIMIR_HALT: MimirHalt = {
haltLtcTrading: false,
haltBnbChain: false,
haltBnbTrading: false,
pauseLp: false,
pauseLpBnb: false,
pauseLpBch: false,
pauseLpBtc: false,
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/services/thorchain/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const MimirIO = t.type({
'mimir//HALTLTCTRADING': t.union([t.number, t.undefined]),
'mimir//HALTBNBCHAIN': t.union([t.number, t.undefined]),
'mimir//HALTBNBTRADING': t.union([t.number, t.undefined]),
'mimir//PAUSELP': t.union([t.number, t.undefined]),
'mimir//PAUSELPBNB': t.union([t.number, t.undefined]),
'mimir//PAUSELPBCH': t.union([t.number, t.undefined]),
'mimir//PAUSELPBTC': t.union([t.number, t.undefined]),
Expand Down Expand Up @@ -118,6 +119,7 @@ export type MimirHaltTrading = {
}

export type MimirPauseLP = {
pauseLp: boolean
pauseLpBnb: boolean
pauseLpBch: boolean
pauseLpBtc: boolean
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/views/app/AppView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const AppView: React.FC = (): JSX.Element => {
haltTrading,
haltBnbChain,
haltBnbTrading,
pauseLp,
pauseLpBnb,
haltBtcChain,
haltBtcTrading,
Expand Down Expand Up @@ -158,6 +159,8 @@ export const AppView: React.FC = (): JSX.Element => {
msg =
pausedLPs.length > 0
? `${msg} ${intl.formatMessage({ id: 'halt.chain.pause' }, { chains: pausedLPs.join(', ') })}`
: pauseLp
? `${msg} ${intl.formatMessage({ id: 'halt.chain.pauseall' })}`
: `${msg}`
}

Expand Down

0 comments on commit f30453b

Please sign in to comment.