-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(synapse-interface): ecotone and metis upgrade downtime, remove e…
…th dencun (#2274) * Add Ecotone Fork upgrade banner * Add Metis Downtime banner * Add Banner * Remove ETH Dencun annoucements * Add Ecotone Fork and Metis Upgrade Countdown Progress Bar to Bridge card * Implement Bridge pauses for Metis and Ecotone downtime * Bridge Pause feature working * Add Ecotone Fork upgrade message * Improve Ecotone Fork warning message * Update Metis downtime message * Simplify comparisons * Update ecotone warning message * Clean, prep for merge * Update id * Update EcotoneFork end time * Move Events into Events folder * Update Metis banner * Update Ecotone Banner for EST * Set times * Rm import * useEcotoneForkEventCountdownProgress to determine when to display progress * useMetisDowntimeCountdownProgress * Add isCurrentChainDisabled props * Replace isBridgePaused with chain disabled prop * Clean * getCountdownTimeStatus * Clean * calculateTimeUntilTarget to be used in getCountdownTimeStatus * Show hours remaining when over 90 min * Update var naming * Clean * Update id to prevent conflicts * Automatically show and remove Banner based on start / end time * Refactor: AnnouncementBanner to use getCountdownTimeStatus * Automate Banners to appear / disappear after start / end time respectively * Keep in sync interval timers across all event countdown components * Add comments * adjust timings --------- Co-authored-by: aureliusbtc <[email protected]>
- Loading branch information
1 parent
60ca5cd
commit f527ce5
Showing
9 changed files
with
402 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
packages/synapse-interface/components/Maintenance/EthDencunUpgrade.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
packages/synapse-interface/components/Maintenance/Events/EcotoneForkUpgrade.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { AnnouncementBanner } from '../AnnouncementBanner' | ||
import { WarningMessage } from '../../Warning' | ||
import { useBridgeState } from '@/slices/bridge/hooks' | ||
import { OPTIMISM, BASE } from '@/constants/chains/master' | ||
import { | ||
useEventCountdownProgressBar, | ||
getCountdownTimeStatus, | ||
} from '../EventCountdownProgressBar' | ||
import { useIntervalTimer } from '@/utils/hooks/useIntervalTimer' | ||
|
||
/** | ||
* Start: 25 min prior to Ecotone Fork Upgrade Time @ (March 14, 00:00 UTC) | ||
* End: 25 min after start of Ecotone Fork Upgrade Time | ||
*/ | ||
export const ECOTONE_FORK_BANNERS_START = new Date( | ||
Date.UTC(2024, 2, 13, 23, 20, 0) | ||
) | ||
export const ECOTONE_FORK_START_DATE = new Date( | ||
Date.UTC(2024, 2, 13, 23, 35, 0) | ||
) | ||
export const ECOTONE_FORK_END_DATE = new Date(Date.UTC(2024, 2, 14, 0, 25, 0)) | ||
|
||
export const EcotoneForkUpgradeBanner = () => { | ||
const { isComplete } = getCountdownTimeStatus( | ||
ECOTONE_FORK_BANNERS_START, | ||
ECOTONE_FORK_END_DATE | ||
) | ||
|
||
useIntervalTimer(60000, isComplete) | ||
|
||
return ( | ||
<AnnouncementBanner | ||
bannerId="03142024-ecotone-fork" | ||
bannerContents={ | ||
<div className="flex flex-col justify-center space-y-1 text-center"> | ||
<div> | ||
Optimism + Base Bridging will be paused 10 minutes ahead of Ecotone | ||
(March 14, 00:00 UTC, 20:00 EST). | ||
</div> | ||
<div>Will be back online shortly following the network upgrade.</div> | ||
</div> | ||
} | ||
startDate={ECOTONE_FORK_BANNERS_START} | ||
endDate={ECOTONE_FORK_END_DATE} | ||
/> | ||
) | ||
} | ||
|
||
export const EcotoneForkWarningMessage = () => { | ||
const { fromChainId, toChainId } = useBridgeState() | ||
|
||
const isChainOptimism = [fromChainId, toChainId].includes(OPTIMISM.id) | ||
const isChainBase = [fromChainId, toChainId].includes(BASE.id) | ||
|
||
if (isChainOptimism || isChainBase) { | ||
return ( | ||
<WarningMessage | ||
message={ | ||
<> | ||
<p> | ||
Optimism Chain and Base Chain bridging are paused until the | ||
Ecotone Fork upgrade completes. | ||
</p> | ||
</> | ||
} | ||
/> | ||
) | ||
} else return null | ||
} | ||
|
||
export const useEcotoneForkCountdownProgress = () => { | ||
const { fromChainId, toChainId } = useBridgeState() | ||
|
||
const isChainOptimism = [fromChainId, toChainId].includes(OPTIMISM.id) | ||
const isChainBase = [fromChainId, toChainId].includes(BASE.id) | ||
|
||
const { | ||
isPending: isEcotoneForkUpgradePending, | ||
EventCountdownProgressBar: EcotoneForkCountdownProgressBar, | ||
} = useEventCountdownProgressBar( | ||
'Ecotone Fork upgrade in progress', | ||
ECOTONE_FORK_START_DATE, | ||
ECOTONE_FORK_END_DATE | ||
) | ||
|
||
return { | ||
isEcotoneForkUpgradePending, | ||
isCurrentChainDisabled: | ||
(isChainOptimism || isChainBase) && isEcotoneForkUpgradePending, | ||
EcotoneForkCountdownProgressBar: | ||
isChainOptimism || isChainBase ? EcotoneForkCountdownProgressBar : null, | ||
} | ||
} |
Oops, something went wrong.