Skip to content

Commit

Permalink
useMetisDowntimeCountdownProgress
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboydiamonds committed Mar 13, 2024
1 parent 2f871fe commit 3d7a544
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const EcotoneForkWarningMessage = () => {
} else return null
}

export const useEcotoneForkEventCountdownProgress = () => {
export const useEcotoneForkCountdownProgress = () => {
const { fromChainId, toChainId } = useBridgeState()

const isChainOptimism = [fromChainId, toChainId].includes(OPTIMISM.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AnnouncementBanner } from '../AnnouncementBanner'
import { WarningMessage } from '../../Warning'
import { useBridgeState } from '@/slices/bridge/hooks'
import { METIS } from '@/constants/chains/master'
import { useEventCountdownProgressBar } from '../EventCountdownProgressBar'

/**
* Start: 30 min prior to Metis Chain Downtime @ (March 14, 02:00 UTC)
Expand Down Expand Up @@ -55,3 +56,25 @@ export const MetisDowntimeWarningMessage = () => {
)
} else return null
}

export const useMetisDowntimeCountdownProgress = () => {
const { fromChainId, toChainId } = useBridgeState()

const isChainMetis = [fromChainId, toChainId].includes(METIS.id)

const {
isPending: isMetisUpgradePending,
EventCountdownProgressBar: MetisUpgradeCountdownProgressBar,
} = useEventCountdownProgressBar(
'Metis upgrade in progress',
METIS_DOWNTIME_START_DATE,
METIS_DOWNTIME_END_DATE
)

return {
isMetisUpgradePending,
MetisUpgradeCountdownProgressBar: isChainMetis
? MetisUpgradeCountdownProgressBar
: null,
}
}
24 changes: 14 additions & 10 deletions packages/synapse-interface/pages/state-managed-bridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ import {
METIS_DOWNTIME_START_DATE,
METIS_DOWNTIME_END_DATE,
MetisDowntimeWarningMessage,
useMetisDowntimeCountdownProgress,
} from '@/components/Maintenance/Events/MetisUpgrade'
import {
ECOTONE_FORK_START_DATE,
ECOTONE_FORK_END_DATE,
EcotoneForkWarningMessage,
useEcotoneForkEventCountdownProgress,
useEcotoneForkCountdownProgress,
} from '@/components/Maintenance/Events/EcotoneForkUpgrade'

import { OPTIMISM, BASE, METIS } from '@/constants/chains/master'
Expand Down Expand Up @@ -543,17 +544,20 @@ const StateManagedBridge = () => {
// ECOTONE_FORK_END_DATE
// )

// const {
// isPending: isMetisUpgradePending,
// EventCountdownProgressBar: MetisUpgradeCountdownProgressBar,
// } = useEventCountdownProgressBar(
// 'Metis upgrade in progress',
// METIS_DOWNTIME_START_DATE,
// METIS_DOWNTIME_END_DATE
// )

const { isEcotoneForkUpgradePending, EcotoneForkCountdownProgressBar } =
useEcotoneForkEventCountdownProgress()
useEcotoneForkCountdownProgress()

const {
isPending: isMetisUpgradePending,
EventCountdownProgressBar: MetisUpgradeCountdownProgressBar,
} = useEventCountdownProgressBar(
'Metis upgrade in progress',
METIS_DOWNTIME_START_DATE,
METIS_DOWNTIME_END_DATE
)
const { isMetisUpgradePending, MetisUpgradeCountdownProgressBar } =
useMetisDowntimeCountdownProgress()

const isBridgePaused = (): boolean => {
if (isEcotoneForkUpgradePending) {
Expand Down

0 comments on commit 3d7a544

Please sign in to comment.