Skip to content

Commit

Permalink
Merge branch 'master' into rename-and-relocate-useTx-file
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan authored Dec 10, 2024
2 parents 9498380 + 456ca48 commit 9f9f833
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/add-orbit-chain-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ body:
options:
- "1"
- "42161"
- "42170"
- "421614"
- "11155111"
- "17000"
Expand Down
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.
13 changes: 13 additions & 0 deletions packages/arb-token-bridge-ui/src/util/AddressUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Provider } from '@ethersproject/providers'

import { getAPIBaseUrl } from '.'
import { getProviderForChainId } from '../token-bridge-sdk/utils'

Expand Down Expand Up @@ -29,3 +31,14 @@ export async function addressIsDenylisted(address: string) {
return false
}
}

export function getNonce(
address: string | undefined,
{ provider }: { provider: Provider }
): Promise<number> {
if (typeof address === 'undefined') {
return 0 as unknown as Promise<number>
}

return provider.getTransactionCount(address)
}
12 changes: 12 additions & 0 deletions packages/arb-token-bridge-ui/src/util/WithdrawOnlyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ export const withdrawOnlyTokens: { [chainId: number]: WithdrawOnlyToken[] } = {
l2CustomAddr: '',
l1Address: '0x83e817E1574e2201a005EC0f7e700ED5606F555E',
l2Address: '0x87ABaD012da6DcD0438e36967FcaD54C9d64F86C'
},
{
symbol: 'Pepe',
l2CustomAddr: '',
l1Address: '0x6982508145454Ce325dDbE47a25d4ec3d2311933',
l2Address: '0x35E6A59F786d9266c7961eA28c7b768B33959cbB'
},
{
symbol: 'cbBTC',
l2CustomAddr: '',
l1Address: '0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf',
l2Address: '0x4A605F93288e95db40cE72934b888641D9689a48'
}
],
[ChainId.ArbitrumNova]: []
Expand Down
12 changes: 7 additions & 5 deletions packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { constants } from 'ethers'
import { Provider } from '@ethersproject/providers'
import { getArbitrumNetwork } from '@arbitrum/sdk'

Expand Down Expand Up @@ -25,18 +26,19 @@ export async function fetchL2Gateways(l2Provider: Provider) {
/* configure gateway addresses for fetching withdrawals */
const { childErc20Gateway, childCustomGateway, childWethGateway } =
l2Network.tokenBridge
const gatewaysToUse = [
childErc20Gateway,
childCustomGateway,
childWethGateway
]

const gatewaysToUse = [childErc20Gateway, childCustomGateway]
const l2ArbReverseGateway = l2ArbReverseGatewayAddresses[l2Network.chainId]
const l2DaiGateway = l2DaiGatewayAddresses[l2Network.chainId]
const l2wstETHGateway = l2wstETHGatewayAddresses[l2Network.chainId]
const l2LptGateway = l2LptGatewayAddresses[l2Network.chainId]
const l2MoonGateway = l2MoonGatewayAddresses[l2Network.chainId]
const l2UsdcGateway = l2UsdcGatewayAddresses[l2Network.chainId]

// custom gas token chains will have weth gateway set to address zero
if (childWethGateway !== constants.AddressZero) {
gatewaysToUse.push(childWethGateway)
}
if (l2ArbReverseGateway) {
gatewaysToUse.push(l2ArbReverseGateway)
}
Expand Down
96 changes: 93 additions & 3 deletions packages/arb-token-bridge-ui/src/util/orbitChainsData.json
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,8 @@
"rpcUrl": "https://socialnetwork-mainnet.g.alchemy.com/public",
"isCustom": true,
"isTestnet": false,
"name": "Social Mainnet",
"slug": "social-mainnet",
"name": "Social Network",
"slug": "social-network",
"parentChainId": 1,
"tokenBridge": {
"parentCustomGateway": "0xE32125cE1A8fFf30B5c0bB164B7E81816CA626F6",
Expand All @@ -948,14 +948,62 @@
"bridgeUiConfig": {
"color": "#12266B",
"network": {
"name": "Social Mainnet",
"name": "Social Network",
"logo": "/images/SocialMainnet_Logo.webp"
},
"nativeTokenData": {
"name": "Earth",
"symbol": "Earth"
}
}
},
{
"chainId": 140,
"confirmPeriodBlocks": 1081,
"ethBridge": {
"bridge": "0x77778b624B03D5D41FeC06641629BB3C98D94892",
"inbox": "0x1CB71Be210c6a0BE2b95B6FBD09b1a43Ae679f97",
"outbox": "0xf32E5481acde9E41cdD0EFAc6cDe3C7876cf65b3",
"rollup": "0xeD6F7916Da27b1A4680EB0C63aA3C768bCc10EDA",
"sequencerInbox": "0x7F17f54174c07F9213dc0EF9009c082542549A9C"
},
"nativeToken": "0x6e6C39CAC539Ab057d357d16d69Fd04d2b0fc38f",
"explorerUrl": "https://explorer.data-lake.co/",
"rpcUrl": "https://rpc.data-lake.co/",
"isCustom": true,
"isTestnet": false,
"name": "Data Lake Mainnet",
"slug": "data-lake-mainnet",
"parentChainId": 42170,
"tokenBridge": {
"parentCustomGateway": "0xB6725767227Aa858b112a4E563a7D357eddbECEa",
"parentErc20Gateway": "0x1fbdB03f9fe57Cf0049e0F238984C7a9cf4D8ca1",
"parentGatewayRouter": "0x63a9cd1aF4d8E254470E32F9D11FA516fdCc4a14",
"parentMultiCall": "0x23d1171380e3cbAA161F6EB31e3A3c6B548A467a",
"parentProxyAdmin": "0x0000000000000000000000000000000000000000",
"parentWeth": "0x0000000000000000000000000000000000000000",
"parentWethGateway": "0x0000000000000000000000000000000000000000",
"childCustomGateway": "0x0E13f3E7828925F31D3FE3e8Aa7343Cb95a78525",
"childErc20Gateway": "0x3b0825034A4F5b725990df6621EbE09C1ecb24dB",
"childGatewayRouter": "0x71e8d7eC6311Bbf7654E54115FD2c23d8C10Ff5f",
"childMultiCall": "0x8c4a651c207c63fd388574FeEcE51AAFD23f69a7",
"childProxyAdmin": "0x0000000000000000000000000000000000000000",
"childWeth": "0x0000000000000000000000000000000000000000",
"childWethGateway": "0x0000000000000000000000000000000000000000"
},
"bridgeUiConfig": {
"color": "#876D9C",
"network": {
"name": "Data Lake Mainnet",
"logo": "/images/DataLakeMainnet_Logo.png",
"description": "The Data Lake Chain is a pioneering Layer 3 blockchain designed to empower decentralized science (DeSci) and healthcare research. Built on Arbitrum Orbit, the Data Lake Chain is tailored for secure and compliant management of consents."
},
"nativeTokenData": {
"name": "Data Lake Token",
"symbol": "LAKE",
"logoUrl": "/images/DataLakeMainnet_NativeTokenLogo.png"
}
}
}
],
"testnet": [
Expand Down Expand Up @@ -1425,6 +1473,48 @@
"logoUrl": "/images/unite-testnet_Logo.png"
}
}
},
{
"chainId": 98864,
"confirmPeriodBlocks": 60,
"ethBridge": {
"bridge": "0xF3BE11Ead404740017e4839712Af28e3c0b5C202",
"inbox": "0xDe66d6a8BabE07f6838ea712e708BBD47837de52",
"outbox": "0xE8806C827217b9C1D9610b5334254Da4d143dF3D",
"rollup": "0x7404f23fc2189e090E2342FaaF7f20efa7bD366a",
"sequencerInbox": "0xDcAb173C5D846d686856A2D3300B8a64ba12130D"
},
"explorerUrl": "https://test-explorer.plumenetwork.xyz/",
"rpcUrl": "https://test-rpc.plumenetwork.xyz/",
"isCustom": true,
"isTestnet": true,
"name": "Plume Devnet",
"slug": "plume-devnet",
"parentChainId": 11155111,
"tokenBridge": {
"parentCustomGateway": "0xa8168b76Aa023228CaA8Ef5110477cD6d02F1508",
"parentErc20Gateway": "0xD7A43a671c177Ed55D2B4bCaFc597Bb669Ce4B99",
"parentGatewayRouter": "0x0a4671a34D411868852be59cCa137D5f251dEe52",
"parentMultiCall": "0x73465577E9FD7Cd585E4270F23A9eBa99B92b6eD",
"parentProxyAdmin": "0x0000000000000000000000000000000000000000",
"parentWeth": "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
"parentWethGateway": "0x8a3f580894fF2C51E202Da7712f5550533a956B1",
"childCustomGateway": "0xA7E44Ce807F488791c6Bc8877c9CA7b36c68B9C0",
"childErc20Gateway": "0xc9F79584303fDcb2cf5d147D7Dc79c38EA3BEC11",
"childGatewayRouter": "0x52a0A8a9A65F90E160940972A0de15491172db87",
"childMultiCall": "0xA569f0e5e284A45F6155cbc4C904ad3cae0a82b0",
"childProxyAdmin": "0x0000000000000000000000000000000000000000",
"childWeth": "0x1738E5247c85f96c9D35FE55800557C5479b7063",
"childWethGateway": "0xc260574cD5F7469d9a840f85A6648F74b7Bd4097"
},
"bridgeUiConfig": {
"color": "#F43B3A",
"network": {
"name": "Plume Devnet",
"logo": "/images/PlumeDevnet_Logo.png",
"description": "Bringing the real world onchain. Optimized for real world assets."
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ChildToParentMessageReader } from '@arbitrum/sdk'
* Fetches initiated ETH withdrawals from event logs in range of [fromBlock, toBlock].
*
* @param query Query params
* @param query.receiver Address that will receive the funds
* @param query.receiver Address that received the funds
* @param query.fromBlock Start at this block number (including)
* @param query.toBlock Stop at this block number (including)
* @param query.l2Provider Provider for the L2 network
Expand All @@ -24,7 +24,8 @@ export function fetchETHWithdrawalsFromEventLogs({
if (typeof receiver === 'undefined') {
return []
}
// funds sent by this address

// funds received by this address
return ChildToParentMessageReader.getChildToParentEvents(
l2Provider,
{ fromBlock, toBlock },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Provider, BlockTag } from '@ethersproject/providers'
import { Erc20Bridger, EventArgs } from '@arbitrum/sdk'
import { WithdrawalInitiatedEvent } from '@arbitrum/sdk/dist/lib/abi/L2ArbitrumGateway'

import { getNonce } from '../AddressUtils'

function dedupeEvents(
events: (EventArgs<WithdrawalInitiatedEvent> & {
txHash: string
Expand Down Expand Up @@ -39,9 +41,11 @@ export async function fetchTokenWithdrawalsFromEventLogs({
const erc20Bridger = await Erc20Bridger.fromProvider(l2Provider)
const promises: ReturnType<Erc20Bridger['getWithdrawalEvents']>[] = []

const senderNonce = await getNonce(sender, { provider: l2Provider })

l2GatewayAddresses.forEach(gatewayAddress => {
// funds sent by this address
if (sender) {
if (sender && senderNonce > 0) {
promises.push(
erc20Bridger.getWithdrawalEvents(
l2Provider,
Expand Down
7 changes: 7 additions & 0 deletions packages/scripts/src/addOrbitChain/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export const getParentChainInfo = (parentChainId: number) => {
chainId: 42161,
name: "Arbitrum One",
};
case 42170: // Arbitrum Nova
return {
rpcUrl: "https://nova.arbitrum.io/rpc",
blockExplorer: "https://nova.arbiscan.io",
chainId: 42170,
name: "Arbitrum Nova",
};
case 11155111: // Sepolia
return {
rpcUrl: INFURA_KEY
Expand Down
13 changes: 4 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10744,15 +10744,10 @@ nano-css@^5.3.1:
stacktrace-js "^2.0.2"
stylis "^4.0.6"

nanoid@^3.3.6:
version "3.3.6"
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==

nanoid@^3.3.7:
version "3.3.7"
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz"
integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==
nanoid@^3.3.6, nanoid@^3.3.7:
version "3.3.8"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==

napi-build-utils@^1.0.1:
version "1.0.2"
Expand Down

0 comments on commit 9f9f833

Please sign in to comment.