Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix-build
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan committed Oct 22, 2024
2 parents aaa4ace + 0654a93 commit 5a83cad
Show file tree
Hide file tree
Showing 32 changed files with 651 additions and 170 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/add-layerleap-request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Add Layer Leap Request
description: File a request to have your Orbit chain support Layer Leap transfers
title: "[feat]: enable Layer Leap for <Orbit Chain>"
labels: ["feat", "triage"]
labels: ["Type: Add LayerLeap"]
body:
- type: markdown
attributes:
Expand Down
44 changes: 3 additions & 41 deletions .github/ISSUE_TEMPLATE/add-orbit-chain-request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Add Orbit Chain Request
description: File a request to have your Orbit chain added to the bridge
title: "[feat]: Add Orbit chain "
labels: ["feat", "triage"]
labels: ["Type: Add Orbit Chain"]
body:
- type: markdown
attributes:
Expand Down Expand Up @@ -121,61 +121,27 @@ body:
attributes:
value: |
Please fill out this section with your chain configuration details and contract addresses. As a reminder, you can get all contract addresses by running [getAllContracts](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/feat-add-verification-scripts/examples/verify-rollup/README.md#get-all-contracts).
- type: input
id: confirmPeriodBlocks
attributes:
label: confirmPeriodBlocks
placeholder: ex. 45818
validations:
required: true
- type: markdown
attributes:
value: |
## Rollup contract addresses
## Rollup contract address
- type: markdown
attributes:
value: |
You can find this information under the `"coreContracts" : {...}` key.
- type: input
id: bridge
attributes:
label: bridge
validations:
required: true
- type: input
id: inbox
attributes:
label: inbox
validations:
required: true
- type: input
id: outbox
attributes:
label: outbox
validations:
required: true
- type: input
id: rollup
attributes:
label: rollup
validations:
required: true
- type: input
id: sequencerInbox
attributes:
label: sequencerInbox
description: Please provide the address of the rollup contract. Other core contract addresses will be fetched automatically.
validations:
required: true

- type: markdown
attributes:
value: |
## Parent chain token bridge contract addresses
- type: markdown
attributes:
value: |
You can find this information under the `"l2Contracts" : {...}` key.
- type: input
id: parent-custom-gateway
attributes:
Expand Down Expand Up @@ -224,10 +190,6 @@ body:
attributes:
value: |
## Orbit chain token bridge contract addresses
- type: markdown
attributes:
value: |
You can find this information under the `"l3Contracts" : {...}` key.
- type: input
id: child-custom-gateway
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:

- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main

- name: Build
run: yarn workspace scripts build

Expand Down
2 changes: 2 additions & 0 deletions packages/arb-token-bridge-ui/.env.local.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ NEXT_PUBLIC_INFURA_KEY_SEPOLIA=

# L2
NEXT_PUBLIC_INFURA_KEY_ARBITRUM_ONE=
NEXT_PUBLIC_INFURA_KEY_BASE=
# L2 Testnet
NEXT_PUBLIC_INFURA_KEY_ARBITRUM_SEPOLIA=
NEXT_PUBLIC_INFURA_KEY_BASE_SEPOLIA=

NEXT_PUBLIC_SENTRY_DSN=

Expand Down
11 changes: 11 additions & 0 deletions packages/arb-token-bridge-ui/public/images/ApeChainLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
144 changes: 144 additions & 0 deletions packages/arb-token-bridge-ui/public/images/ApeTokenLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/arb-token-bridge-ui/public/images/BaseWhite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ import { useActions } from '../../state'
import { useChainIdsForNetworkSelection } from '../../hooks/TransferPanel/useChainIdsForNetworkSelection'
import { useAccountType } from '../../hooks/useAccountType'

type NetworkType = 'core' | 'orbit'
type NetworkType = 'core' | 'other' | 'orbit'

enum ChainGroupName {
core = 'CORE CHAINS',
other = 'OTHER CHAINS',
orbit = 'ORBIT CHAINS'
}

Expand All @@ -48,6 +49,19 @@ const chainGroupInfo: { [key in NetworkType]: ChainGroupInfo } = {
core: {
name: ChainGroupName.core
},
other: {
name: ChainGroupName.other,
description: (
<p className="mt-2 flex gap-1 whitespace-normal rounded bg-orange-dark px-2 py-1 text-xs text-orange">
<ShieldExclamationIcon className="h-4 w-4 shrink-0" />
<span>
Independent projects using non-Arbitrum technology. These chains have
varying degrees of decentralization.{' '}
<span className="font-semibold">Bridge at your own risk.</span>
</span>
</p>
)
},
orbit: {
name: ChainGroupName.orbit,
description: (
Expand All @@ -71,15 +85,15 @@ function ChainTypeInfoRow({
style: CSSProperties
}) {
const { name, description } = chainGroup
const isCoreGroup = chainGroup.name === ChainGroupName.core
const isOrbitGroup = chainGroup.name === ChainGroupName.orbit

return (
<div
key={name}
style={style}
className={twMerge(
'px-4 py-3',
!isCoreGroup &&
!isOrbitGroup &&
'before:-mt-3 before:mb-3 before:block before:h-[1px] before:w-full before:bg-white/30 before:content-[""]'
)}
>
Expand Down Expand Up @@ -236,14 +250,19 @@ function NetworksPanel({
}

const coreNetworks = chainIds.filter(
chainId => !isNetwork(chainId).isOrbitChain
chainId => isNetwork(chainId).isCoreChain
)
const otherNetworks = chainIds.filter(
chainId =>
!isNetwork(chainId).isCoreChain && !isNetwork(chainId).isOrbitChain
)
const orbitNetworks = chainIds.filter(
chainId => isNetwork(chainId).isOrbitChain
)

return {
core: coreNetworks,
other: otherNetworks,
orbit: orbitNetworks
}
}, [debouncedNetworkSearched, chainIds])
Expand All @@ -262,6 +281,10 @@ function NetworksPanel({
groupedNetworks.push(ChainGroupName.core, ...networksToShow.core)
}

if (networksToShow.other.length > 0) {
groupedNetworks.push(ChainGroupName.other, ...networksToShow.other)
}

if (networksToShow.orbit.length > 0) {
groupedNetworks.push(ChainGroupName.orbit, ...networksToShow.orbit)
}
Expand Down Expand Up @@ -302,6 +325,12 @@ function NetworksPanel({
)
}

if (networkOrChainTypeName === ChainGroupName.other) {
return (
<ChainTypeInfoRow chainGroup={chainGroupInfo.other} style={style} />
)
}

if (networkOrChainTypeName === ChainGroupName.orbit) {
return (
<ChainTypeInfoRow chainGroup={chainGroupInfo.orbit} style={style} />
Expand Down
6 changes: 5 additions & 1 deletion packages/arb-token-bridge-ui/src/hooks/useNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {
arbitrumSepolia,
localL1Network as local,
localL2Network as arbitrumLocal,
localL3Network as l3Local
localL3Network as l3Local,
base,
baseSepolia
} from '../util/wagmi/wagmiAdditionalNetworks'

import { getDestinationChainIds } from '../util/networks'
Expand All @@ -37,7 +39,9 @@ export function isSupportedChainId(
holesky.id,
arbitrum.id,
arbitrumNova.id,
base.id,
arbitrumSepolia.id,
baseSepolia.id,
arbitrumLocal.id,
l3Local.id,
local.id,
Expand Down
13 changes: 6 additions & 7 deletions packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EthL1L3Bridger,
getArbitrumNetwork
} from '@arbitrum/sdk'
import { isDepositMode } from '../util/isDepositMode'

export const getAddressFromSigner = async (signer: Signer) => {
const address = await signer.getAddress()
Expand All @@ -28,25 +29,23 @@ export const getBridgeTransferProperties = (
const sourceChainId = props.sourceChainId
const destinationChainId = props.destinationChainId

const isSourceChainEthereumMainnetOrTestnet =
isNetwork(sourceChainId).isEthereumMainnetOrTestnet
const isDestinationChainEthereumMainnetOrTestnet =
isNetwork(destinationChainId).isEthereumMainnetOrTestnet

const isSourceChainArbitrum = isNetwork(sourceChainId).isArbitrum
const isDestinationChainArbitrum = isNetwork(destinationChainId).isArbitrum

const isSourceChainOrbit = isNetwork(sourceChainId).isOrbitChain
const isDestinationChainOrbit = isNetwork(destinationChainId).isOrbitChain

const isDeposit =
isSourceChainEthereumMainnetOrTestnet ||
(isSourceChainArbitrum && isDestinationChainOrbit)
const { isBase: isDestinationChainBase } = isNetwork(destinationChainId)

const isDeposit = isDepositMode({ sourceChainId, destinationChainId })

const isWithdrawal =
(isSourceChainArbitrum && isDestinationChainEthereumMainnetOrTestnet) || // l2 arbitrum chains to l1
(isSourceChainOrbit && isDestinationChainEthereumMainnetOrTestnet) || // l2 orbit chains to l1
(isSourceChainOrbit && isDestinationChainArbitrum) // l3 orbit chains to l1
(isSourceChainOrbit && isDestinationChainArbitrum) || // l3 orbit chains to l1
(isSourceChainOrbit && isDestinationChainBase) // l3 orbit chain to Base l2

const isTeleport = isValidTeleportChainPair({
sourceChainId,
Expand Down
14 changes: 14 additions & 0 deletions packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const chainQueryParams = [
'holesky',
'arbitrum-one',
'arbitrum-nova',
'base',
'arbitrum-sepolia',
'base-sepolia',
'custom-localhost',
'arbitrum-localhost',
'l3-localhost'
Expand Down Expand Up @@ -51,6 +53,9 @@ export function getChainQueryParamForChain(chainId: ChainId): ChainQueryParam {
case ChainId.ArbitrumNova:
return 'arbitrum-nova'

case ChainId.Base:
return 'base'

case ChainId.Holesky:
return 'holesky'

Expand All @@ -60,6 +65,9 @@ export function getChainQueryParamForChain(chainId: ChainId): ChainQueryParam {
case ChainId.ArbitrumSepolia:
return 'arbitrum-sepolia'

case ChainId.BaseSepolia:
return 'base-sepolia'

case ChainId.Local:
return 'custom-localhost'

Expand Down Expand Up @@ -107,9 +115,15 @@ export function getChainForChainKeyQueryParam(
case 'arbitrum-nova':
return customChains.arbitrumNova

case 'base':
return customChains.base

case 'arbitrum-sepolia':
return customChains.arbitrumSepolia

case 'base-sepolia':
return customChains.baseSepolia

case 'custom-localhost':
return customChains.localL1Network

Expand Down
6 changes: 6 additions & 0 deletions packages/arb-token-bridge-ui/src/util/WithdrawOnlyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ export const withdrawOnlyTokens: { [chainId: number]: WithdrawOnlyToken[] } = {
l2CustomAddr: '0x6985884c4392d348587b19cb9eaaf157f13271cd',
l1Address: '0x6985884c4392d348587b19cb9eaaf157f13271cd',
l2Address: '0xd99f14023f6bde3142d339b6c069b2b711da7e37'
},
{
symbol: 'G3',
l2CustomAddr: '0xc24A365A870821EB83Fd216c9596eDD89479d8d7',
l1Address: '0xCF67815ccE72E682Eb4429eCa46843bed81Ca739',
l2Address: '0x34fb4148fdc1ab3054ac85d32de887c58538bb57'
}
],
[ChainId.ArbitrumNova]: []
Expand Down
25 changes: 25 additions & 0 deletions packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ beforeAll(() => {
})

registerCustomArbitrumNetwork(xaiTestnet)

const polterTestnetChainId = 631571
const polterTestnet = orbitTestnets[polterTestnetChainId]

if (!polterTestnet) {
throw new Error(`Could not find Polter Testnet in the Orbit chains list.`)
}

registerCustomArbitrumNetwork(polterTestnet)
})

describe('getBaseChainIdByChainId', () => {
Expand Down Expand Up @@ -254,4 +263,20 @@ describe('getDestinationChainIds', () => {
expect(defaultChainId).toBe(ChainId.Sepolia)
expect(isAscending(nonDefaultChainIds)).toBe(true)
})

it('should return a sorted list for Base Sepolia', () => {
const destinationChainIds = getDestinationChainIds(ChainId.BaseSepolia)
const defaultChainId = destinationChainIds[0]
const nonDefaultChainIds = destinationChainIds.slice(1)

expect(defaultChainId).toBe(631571)
expect(isAscending(nonDefaultChainIds)).toBe(true)
})

// Enable when there are Orbit Chains on Base
it('should not return a list for Base', () => {
const destinationChainIds = getDestinationChainIds(ChainId.Base)

expect(destinationChainIds).toHaveLength(0)
})
})
Loading

0 comments on commit 5a83cad

Please sign in to comment.