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: support base and base sepolia parent chains #1996

Merged
merged 25 commits into from
Oct 21, 2024
Merged

Conversation

fionnachan
Copy link
Member

Closes FS-920

Copy link

vercel bot commented Oct 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
arbitrum-token-bridge ✅ Ready (Inspect) Visit Preview Oct 21, 2024 2:03pm

name: 'Base',
logo: '/images/BaseWhite.svg',
description:
'Base is built as an Ethereum L2, decentralized with the Optimism Superchain, and incubated by Coinbase.'
Copy link
Member Author

@fionnachan fionnachan Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we want to update the copy, i grabbed it from their website

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for product

@fionnachan fionnachan marked this pull request as ready for review October 18, 2024 11:53
@fionnachan fionnachan requested review from brtkx and spsjvc October 18, 2024 11:53
packages/arb-token-bridge-ui/src/hooks/useNetworks.ts Outdated Show resolved Hide resolved
(isSourceChainArbitrum && isDestinationChainOrbit)
const { isBase: isDestinationChainBase } = isNetwork(destinationChainId)

const isDeposit = isDepositMode({ sourceChainId, destinationChainId })

const isWithdrawal =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this work?

const isWithdrawal = !isDeposit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking with @dewanshparashar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we cannot. Because our isSupported flag in bridge-sdk>utils is a union of isDeposit || isWithdrawal || isTeleport and having isWthdrawal = !isDeposit will lead it to support all unsupported combinations.

packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts Outdated Show resolved Hide resolved
packages/arb-token-bridge-ui/src/util/networks.ts Outdated Show resolved Hide resolved
packages/arb-token-bridge-ui/src/util/networks.ts Outdated Show resolved Hide resolved
packages/arb-token-bridge-ui/src/util/networks.ts Outdated Show resolved Hide resolved
packages/arb-token-bridge-ui/src/util/networks.ts Outdated Show resolved Hide resolved
packages/arb-token-bridge-ui/src/util/orbitChainsData.json Outdated Show resolved Hide resolved
// L3 Testnets
L3Local = 333333
}

type L1Network = {
type NonArbParentNetwork = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spsjvc not sure about this name, any suggestions?

@spsjvc spsjvc changed the title feat: support base and base sepolia feat: support base and base sepolia parent chains Oct 21, 2024
)
const otherNetworks = chainIds.filter(chainId => isNetwork(chainId).isBase)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we ever add other chains to this group this check would fail, so can we do

Suggested change
const otherNetworks = chainIds.filter(chainId => isNetwork(chainId).isBase)
const otherNetworks = chainIds.filter(chainId => !isNetwork(chainId).isCoreChain && !isNetwork(chainId).isOrbitChain)

ChainId.ArbitrumSepolia
ChainId.ArbitrumSepolia,
ChainId.BaseSepolia,
ChainId.Base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base shouldn't be part of this list, should be only testnets

if (isL1Chain(chain) && getChildrenForNetwork(chain.chainId).length === 0) {
// exclude L1 chains or Base Chains with no child chains
if (
!('parentChainId' in chain) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use isNonArbParentChain instead

@@ -236,14 +270,19 @@ export const getExplorerUrl = (chainId: ChainId) => {
export const getL1BlockTime = (chainId: number) => {
const chain = getChainByChainId(getBaseChainIdByChainId({ chainId }))

if (!chain || !isL1Chain(chain)) {
if (!chain || !('blockTime' in chain)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use isNonArbParentChain instead

Copy link
Member

@spsjvc spsjvc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@spsjvc spsjvc merged commit 7251f61 into master Oct 21, 2024
37 checks passed
@spsjvc spsjvc deleted the base-and-base-sepolia branch October 21, 2024 15:48
@spsjvc spsjvc mentioned this pull request Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants