Skip to content

Commit

Permalink
pausing bridging to metis (#2320)
Browse files Browse the repository at this point in the history
* Pause

* Pause bridging to metis
  • Loading branch information
abtestingalpha authored Mar 20, 2024
1 parent e277b32 commit 4ad6887
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useBridgeState } from '@/slices/bridge/hooks'
import { useIntervalTimer } from '@/utils/hooks/useIntervalTimer'
import { OPTIMISM, BASE } from '@/constants/chains/master'
import { METIS } from '@/constants/chains/master'
import {
useEventCountdownProgressBar,
getCountdownTimeStatus,
Expand All @@ -19,12 +19,10 @@ import { WarningMessage } from '../../../Warning'
* End: 50 min after start of Ecotone Fork Upgrade Time
*/
export const ECOTONE_FORK_BANNERS_START = new Date(
Date.UTC(2024, 2, 13, 23, 20, 0)
Date.UTC(2024, 2, 20, 16, 0, 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 ECOTONE_FORK_START_DATE = new Date(Date.UTC(2024, 2, 20, 16, 0, 0))
export const ECOTONE_FORK_END_DATE = new Date(Date.UTC(2024, 2, 20, 18, 0, 0))

/** Previous implementation can be seen here: https://github.com/synapsecns/sanguine/pull/2294/files#diff-bbe6298d3dfbc80e46e2ff8b399a3e1822cede80f392b1af91875145ad4eeb19R19 */
export const EcotoneForkUpgradeBanner = () => {
Expand All @@ -37,13 +35,9 @@ export const EcotoneForkUpgradeBanner = () => {

return (
<AnnouncementBanner
bannerId="03142024-ecotone-fork"
bannerId="03202024-metis-pause"
bannerContents={
<>
Optimism + Base Bridging will be paused 10 minutes ahead of Ecotone
(March 14, 00:00 UTC, 20:00 EST). Will be back online shortly
following the network upgrade.
</>
<>Metis Bridging is paused. Will be back online shortly.</>
}
startDate={ECOTONE_FORK_BANNERS_START}
endDate={ECOTONE_FORK_END_DATE}
Expand All @@ -60,18 +54,14 @@ export const EcotoneForkUpgradeBanner = () => {
export const EcotoneForkWarningMessage = () => {
const { fromChainId, toChainId } = useBridgeState()

const isChainOptimism = [fromChainId, toChainId].includes(OPTIMISM.id)
const isChainBase = [fromChainId, toChainId].includes(BASE.id)
const isToChainMetis = toChainId === METIS.id

if (isChainOptimism || isChainBase) {
if (isToChainMetis) {
return (
<WarningMessage
message={
<>
<p>
Optimism Chain and Base Chain bridging are paused until the
Ecotone Fork upgrade completes.
</p>
<p>Metis Chain bridging are paused.</p>
</>
}
/>
Expand Down Expand Up @@ -105,23 +95,22 @@ export const EcotoneForkWarningMessage = () => {
export const useEcotoneForkCountdownProgress = () => {
const { fromChainId, toChainId } = useBridgeState()

const isChainOptimism = [fromChainId, toChainId].includes(OPTIMISM.id)
const isChainBase = [fromChainId, toChainId].includes(BASE.id)
const isToChainMetis = toChainId === METIS.id

const {
isPending: isEcotoneForkUpgradePending,
EventCountdownProgressBar: EcotoneForkCountdownProgressBar,
} = useEventCountdownProgressBar(
'Ecotone Fork upgrade in progress',
'Metis Bridging is paused',
ECOTONE_FORK_START_DATE, // Countdown Bar will automatically appear after start time
ECOTONE_FORK_END_DATE // Countdown Bar will automatically disappear when end time is reached
)

return {
isEcotoneForkUpgradePending,
isCurrentChainDisabled:
(isChainOptimism || isChainBase) && isEcotoneForkUpgradePending, // Used to pause Bridge
EcotoneForkCountdownProgressBar:
isChainOptimism || isChainBase ? EcotoneForkCountdownProgressBar : null,
isCurrentChainDisabled: isToChainMetis, // Used to pause Bridge
EcotoneForkCountdownProgressBar: isToChainMetis
? EcotoneForkCountdownProgressBar
: null,
}
}
13 changes: 12 additions & 1 deletion packages/synapse-interface/pages/state-managed-bridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ import {
} from '@/slices/priceDataSlice'
import { isTransactionReceiptError } from '@/utils/isTransactionReceiptError'
import { SwitchButton } from '@/components/buttons/SwitchButton'
import {
EcotoneForkWarningMessage,
useEcotoneForkCountdownProgress,
} from '@/components/Maintenance/Events/example/EcotoneForkUpgrade'

const StateManagedBridge = () => {
const { address } = useAccount()
Expand Down Expand Up @@ -517,6 +521,12 @@ const StateManagedBridge = () => {
const springClass =
'-mt-4 fixed z-50 w-full h-full bg-opacity-50 bg-[#343036]'

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

return (
<div className="flex flex-col w-full max-w-lg mx-auto lg:mx-0">
<div className="flex flex-col">
Expand Down Expand Up @@ -554,6 +564,7 @@ const StateManagedBridge = () => {
transition-all duration-100 transform rounded-md
`}
>
{EcotoneForkCountdownProgressBar}
<div ref={bridgeDisplayRef}>
<Transition show={showSettingsSlideOver} {...TRANSITION_PROPS}>
<animated.div>
Expand Down Expand Up @@ -610,7 +621,7 @@ const StateManagedBridge = () => {
isApproved={isApproved}
approveTxn={approveTxn}
executeBridge={executeBridge}
isBridgePaused={false}
isBridgePaused={isCurrentChainDisabled}
/>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/synapse-interface/public/blacklist.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,5 +426,6 @@
"0x9961190B258897BCa7a12B8f37F415E689D281C4",
"0xe874Ae1a218C1A0d9983c908B587f029278B1C69",
"0xc12f2430ddfd54797533f827f78e49fe004d51a0",
"0x778Be423ef77A20A4493f846BdbcDDfc30252cE9"
"0x778Be423ef77A20A4493f846BdbcDDfc30252cE9",
"0x52522d35725836d48e12e64731fa170bcd9423bf"
]

0 comments on commit 4ad6887

Please sign in to comment.