Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(synapse-interface): ecotone and metis upgrade downtime, remove eth dencun #2274

Merged
merged 38 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8cff1f6
Add Ecotone Fork upgrade banner
bigboydiamonds Mar 13, 2024
0c35627
Add Metis Downtime banner
bigboydiamonds Mar 13, 2024
eeedf1a
Add Banner
bigboydiamonds Mar 13, 2024
5470be7
Remove ETH Dencun annoucements
bigboydiamonds Mar 13, 2024
65fffff
Add Ecotone Fork and Metis Upgrade Countdown Progress Bar to Bridge card
bigboydiamonds Mar 13, 2024
4f97a62
Implement Bridge pauses for Metis and Ecotone downtime
bigboydiamonds Mar 13, 2024
18b92c4
Bridge Pause feature working
bigboydiamonds Mar 13, 2024
c075165
Add Ecotone Fork upgrade message
bigboydiamonds Mar 13, 2024
b1d473a
Improve Ecotone Fork warning message
bigboydiamonds Mar 13, 2024
255b6bb
Update Metis downtime message
bigboydiamonds Mar 13, 2024
13a782e
Simplify comparisons
bigboydiamonds Mar 13, 2024
f08910b
Update ecotone warning message
bigboydiamonds Mar 13, 2024
7c731e7
Clean, prep for merge
bigboydiamonds Mar 13, 2024
7244cf7
Update id
bigboydiamonds Mar 13, 2024
d122c52
Update EcotoneFork end time
bigboydiamonds Mar 13, 2024
6747f56
Move Events into Events folder
bigboydiamonds Mar 13, 2024
02fac8c
Update Metis banner
bigboydiamonds Mar 13, 2024
32648a4
Update Ecotone Banner for EST
bigboydiamonds Mar 13, 2024
5ec2d6a
Set times
bigboydiamonds Mar 13, 2024
a0fa1da
Rm import
bigboydiamonds Mar 13, 2024
2f871fe
useEcotoneForkEventCountdownProgress to determine when to display pro…
bigboydiamonds Mar 13, 2024
3d7a544
useMetisDowntimeCountdownProgress
bigboydiamonds Mar 13, 2024
873bd02
Add isCurrentChainDisabled props
bigboydiamonds Mar 13, 2024
e5ed8ab
Replace isBridgePaused with chain disabled prop
bigboydiamonds Mar 13, 2024
5c8fa61
Clean
bigboydiamonds Mar 13, 2024
3fcf7cc
getCountdownTimeStatus
bigboydiamonds Mar 13, 2024
e7d0890
Clean
bigboydiamonds Mar 13, 2024
2258c15
calculateTimeUntilTarget to be used in getCountdownTimeStatus
bigboydiamonds Mar 13, 2024
c01d54e
Show hours remaining when over 90 min
bigboydiamonds Mar 13, 2024
3532923
Update var naming
bigboydiamonds Mar 13, 2024
e8fe6d4
Clean
bigboydiamonds Mar 13, 2024
54d7e35
Update id to prevent conflicts
bigboydiamonds Mar 13, 2024
c7525f0
Automatically show and remove Banner based on start / end time
bigboydiamonds Mar 13, 2024
eb03d7f
Refactor: AnnouncementBanner to use getCountdownTimeStatus
bigboydiamonds Mar 13, 2024
8f4865c
Automate Banners to appear / disappear after start / end time respect…
bigboydiamonds Mar 13, 2024
d6a31ab
Keep in sync interval timers across all event countdown components
bigboydiamonds Mar 13, 2024
e87ee6a
Add comments
bigboydiamonds Mar 13, 2024
f068eff
adjust timings
aureliusbtc Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { AnnouncementBanner } from './AnnouncementBanner'
import { WarningMessage } from '../Warning'
import { useBridgeState } from '@/slices/bridge/hooks'
import { OPTIMISM, BASE } from '@/constants/chains/master'

/**
* Start: 10 min prior to Ecotone Fork Upgrade Time @ (March 14, 00:00 UTC)
* End: 10 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, 50, 0)
)
export const ECOTONE_FORK_END_DATE = new Date(Date.UTC(2024, 2, 13, 24, 10, 0))
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved

export const EcotoneForkUpgradeBanner = () => {
return (
<AnnouncementBanner
bannerId="03142024-ecotone-fork"
bannerContents={
<div className="flex flex-col justify-center space-y-1 text-center">
<div>
Optimism + Base Bridging and RFQ will be paused 10 minutes ahead of
Ecotone (March 14, 00:00 UTC).
</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
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const LinearAnimatedProgressBar = memo(

return (
<svg
id="animated-progress-bar"
id="linear-animated-progress-bar"
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved
key={Date.now()}
width="100%"
height={height}
Expand Down
57 changes: 57 additions & 0 deletions packages/synapse-interface/components/Maintenance/MetisUpgrade.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { AnnouncementBanner } from './AnnouncementBanner'
import { WarningMessage } from '../Warning'
import { useBridgeState } from '@/slices/bridge/hooks'
import { METIS } from '@/constants/chains/master'

/**
* Start: 30 min prior to Metis Chain Downtime @ (March 14, 02:00 UTC)
* End: 12 hours after start of Metis Chain Downtime
*/
export const METIS_DOWNTIME_BANNERS_START = new Date(
Date.UTC(2024, 2, 14, 1, 0, 0)
)
export const METIS_DOWNTIME_START_DATE = new Date(
Date.UTC(2024, 2, 14, 1, 30, 0)
)
export const METIS_DOWNTIME_END_DATE = new Date(
Date.UTC(2024, 2, 14, 13, 30, 0)
)

export const MetisDowntimeBanner = () => {
return (
<AnnouncementBanner
bannerId="03142024-metis-downtime"
bannerContents={
<div className="flex flex-col justify-center space-y-1 text-center">
<div>
Due to a Metis upgrade, bridging to and from Metis will pause 30
minutes ahead of March 14, 02:00 UTC,
</div>
<div>and stay paused for ~12 hours.</div>
</div>
}
startDate={METIS_DOWNTIME_BANNERS_START}
endDate={METIS_DOWNTIME_END_DATE}
/>
)
}

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

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

if (isChainMetis) {
return (
<WarningMessage
message={
<>
<p>
Metis Chain bridging is paused until the Metis upgrade completes.
</p>
</>
}
/>
)
} else return null
}
5 changes: 4 additions & 1 deletion packages/synapse-interface/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { LandingPageWrapper } from '@/components/layouts/LandingPageWrapper'
import ReactGA from 'react-ga'
import useSyncQueryParamsWithBridgeState from '@/utils/hooks/useSyncQueryParamsWithBridgeState'
import { EthDencunUpgradeBanner } from '@/components/Maintenance/EthDencunUpgrade'
import { EcotoneForkUpgradeBanner } from '@/components/Maintenance/EcotoneForkUpgrade'
import { MetisDowntimeBanner } from '@/components/Maintenance/MetisUpgrade'

// TODO: someone should add this to the .env, disable if blank, etc.
// this is being added as a hotfix to assess user load on the synapse explorer api
Expand All @@ -20,7 +22,8 @@ const Home = () => {
data-test-id="bridge-page"
className="relative z-0 flex-1 h-full overflow-y-auto focus:outline-none"
>
<EthDencunUpgradeBanner />
<EcotoneForkUpgradeBanner />
<MetisDowntimeBanner />
<div className="flex flex-col-reverse justify-center gap-16 px-4 py-20 mx-auto lg:flex-row 2xl:w-3/4 sm:mt-6 sm:px-8 md:px-12">
<Portfolio />
<StateManagedBridge />
Expand Down
178 changes: 104 additions & 74 deletions packages/synapse-interface/pages/state-managed-bridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,19 @@ import {
import { isTransactionReceiptError } from '@/utils/isTransactionReceiptError'
import { SwitchButton } from '@/components/buttons/SwitchButton'
import { useEventCountdownProgressBar } from '@/components/Maintenance/EventCountdownProgressBar'

import {
METIS_DOWNTIME_START_DATE,
METIS_DOWNTIME_END_DATE,
MetisDowntimeWarningMessage,
} from '@/components/Maintenance/MetisUpgrade'
import {
ETH_DENCUN_START_DATE,
ETH_DENCUN_END_DATE,
} from '@/components/Maintenance/EthDencunUpgrade'
ECOTONE_FORK_START_DATE,
ECOTONE_FORK_END_DATE,
EcotoneForkWarningMessage,
} from '@/components/Maintenance/EcotoneForkUpgrade'

import { OPTIMISM, BASE, METIS } from '@/constants/chains/master'

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

/* Remove after upgrades */
const {
isPending: isUpgradePending,
EventCountdownProgressBar: EthDencunEventCountdownProgressBar,
isPending: isEcotoneForkUpgradePending,
EventCountdownProgressBar: EcotoneForkCountdownProgressBar,
} = useEventCountdownProgressBar(
'Dencun upgrade in progress',
ETH_DENCUN_START_DATE,
ETH_DENCUN_END_DATE
'Ecotone Fork upgrade in progress',
ECOTONE_FORK_START_DATE,
ECOTONE_FORK_END_DATE
)

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

const isBridgePaused = (): boolean => {
if (isEcotoneForkUpgradePending) {
if ([fromChainId, toChainId].includes(OPTIMISM.id)) return true
if ([fromChainId, toChainId].includes(BASE.id)) return true
}
if (isMetisUpgradePending) {
if ([fromChainId, toChainId].includes(METIS.id)) return true
}
return false
}
bigboydiamonds marked this conversation as resolved.
Show resolved Hide resolved
/* Remove after upgrades */

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 @@ -569,73 +600,72 @@ const StateManagedBridge = () => {
transition-all duration-100 transform rounded-md
`}
>
{EthDencunEventCountdownProgressBar}
<div
className={
isUpgradePending
? 'cursor-not-allowed pointer-events-none brightness-75 contrast-[90%] opacity-75 aria-disabled'
: 'cursor-pointer pointer-events-auto'
}
>
<div ref={bridgeDisplayRef}>
<Transition show={showSettingsSlideOver} {...TRANSITION_PROPS}>
<animated.div>
<SettingsSlideOver key="settings" />
</animated.div>
</Transition>
<Transition show={showFromChainListOverlay} {...TRANSITION_PROPS}>
<animated.div className={springClass}>
<FromChainListOverlay />
</animated.div>
</Transition>
<Transition show={showFromTokenListOverlay} {...TRANSITION_PROPS}>
<animated.div className={springClass}>
<FromTokenListOverlay />
</animated.div>
</Transition>
<Transition show={showToChainListOverlay} {...TRANSITION_PROPS}>
<animated.div className={springClass}>
<ToChainListOverlay />
</animated.div>
</Transition>
<Transition show={showToTokenListOverlay} {...TRANSITION_PROPS}>
<animated.div className={springClass}>
<ToTokenListOverlay />
</animated.div>
</Transition>
<InputContainer />
<SwitchButton
onClick={() => {
dispatch(setFromChainId(toChainId))
dispatch(setFromToken(toToken))
dispatch(setToChainId(fromChainId))
dispatch(setToToken(fromToken))
}}
{EcotoneForkCountdownProgressBar}
{MetisUpgradeCountdownProgressBar}
<div ref={bridgeDisplayRef}>
<Transition show={showSettingsSlideOver} {...TRANSITION_PROPS}>
<animated.div>
<SettingsSlideOver key="settings" />
</animated.div>
</Transition>
<Transition show={showFromChainListOverlay} {...TRANSITION_PROPS}>
<animated.div className={springClass}>
<FromChainListOverlay />
</animated.div>
</Transition>
<Transition show={showFromTokenListOverlay} {...TRANSITION_PROPS}>
<animated.div className={springClass}>
<FromTokenListOverlay />
</animated.div>
</Transition>
<Transition show={showToChainListOverlay} {...TRANSITION_PROPS}>
<animated.div className={springClass}>
<ToChainListOverlay />
</animated.div>
</Transition>
<Transition show={showToTokenListOverlay} {...TRANSITION_PROPS}>
<animated.div className={springClass}>
<ToTokenListOverlay />
</animated.div>
</Transition>
<InputContainer />
<SwitchButton
onClick={() => {
dispatch(setFromChainId(toChainId))
dispatch(setFromToken(toToken))
dispatch(setToChainId(fromChainId))
dispatch(setToToken(fromToken))
}}
/>
<OutputContainer />
<Warning />

{/* Remove after upgrades */}
{isEcotoneForkUpgradePending && <EcotoneForkWarningMessage />}
{isMetisUpgradePending && <MetisDowntimeWarningMessage />}
{/* Remove after upgrades */}

<Transition
appear={true}
unmount={false}
show={true}
{...SECTION_TRANSITION_PROPS}
>
<BridgeExchangeRateInfo />
</Transition>
{showDestinationAddress && (
<DestinationAddressInput
toChainId={toChainId}
destinationAddress={destinationAddress}
/>
)}
<div className="md:my-3">
<BridgeTransactionButton
isApproved={isApproved}
approveTxn={approveTxn}
executeBridge={executeBridge}
isBridgePaused={isBridgePaused()}
/>
<OutputContainer />
<Warning />
<Transition
appear={true}
unmount={false}
show={true}
{...SECTION_TRANSITION_PROPS}
>
<BridgeExchangeRateInfo />
</Transition>
{showDestinationAddress && (
<DestinationAddressInput
toChainId={toChainId}
destinationAddress={destinationAddress}
/>
)}
<div className="md:my-3">
<BridgeTransactionButton
isApproved={isApproved}
approveTxn={approveTxn}
executeBridge={executeBridge}
isBridgePaused={isUpgradePending}
/>
</div>
</div>
</div>
</Card>
Expand Down
Loading