Skip to content

Commit

Permalink
Merge pull request #2042 from KomodoPlatform/improve-frontend-coin-logic
Browse files Browse the repository at this point in the history
Improve frontend coin logic
  • Loading branch information
tonymorony authored Nov 4, 2022
2 parents be29be3 + 15f19ed commit 79cc4d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
10 changes: 1 addition & 9 deletions atomic_defi_design/Dex/Components/CoinMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,7 @@ Menu {
id: disable_action
text: qsTr("Disable %1", "TICKER").arg(ticker)
onTriggered: API.app.disable_coins([ticker])
enabled:
{
let progress = General.zhtlcActivationProgress(current_ticker_infos.activation_status, ticker)
if (General.isZhtlc(ticker))
{
if (progress != 100) return false
}
return General.canDisable(ticker, progress)
}
enabled: General.canDisable(ticker)
}

MenuItem {
Expand Down
13 changes: 9 additions & 4 deletions atomic_defi_design/Dex/Constants/General.qml
Original file line number Diff line number Diff line change
Expand Up @@ -589,12 +589,17 @@ QtObject {
property Timer prevent_coin_disabling: Timer { interval: 5000 }

function canDisable(ticker) {
if(prevent_coin_disabling.running)
if (prevent_coin_disabling.running)
return false

if(ticker === atomic_app_primary_coin || ticker === atomic_app_secondary_coin) return false
else if(ticker === "ETH") return !General.isParentCoinNeeded("ETH", "ERC-20")
else if(ticker === "QTUM") return !General.isParentCoinNeeded("QTUM", "QRC-20")
if (ticker === atomic_app_primary_coin || ticker === atomic_app_secondary_coin) return false
if (ticker === "ETH") return !General.isParentCoinNeeded("ETH", "ERC-20")
if (ticker === "QTUM") return !General.isParentCoinNeeded("QTUM", "QRC-20")
if (General.isZhtlc(ticker))
{
let progress = General.zhtlcActivationProgress(current_ticker_infos.activation_status, ticker)
if (progress != 100) return false
}

return true
}
Expand Down

0 comments on commit 79cc4d2

Please sign in to comment.