Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ jobs:
with:
context: token-bridge-contracts
load: true
tags: arbitrum-chain-sdk-token-bridge-contracts:v1.2.2
cache-from: type=gha,scope=token-bridge-contracts-v1.2.2
cache-to: type=gha,mode=max,scope=token-bridge-contracts-v1.2.2
tags: arbitrum-chain-sdk-token-bridge-contracts:v1.2.5
cache-from: type=gha,scope=token-bridge-contracts-v1.2.5
cache-to: type=gha,mode=max,scope=token-bridge-contracts-v1.2.5

- name: Set up the local node
run: |
Expand Down
16 changes: 11 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,49 @@ const nitroTestnodeL3 = defineChain({
testnet: true,
});

const rhMainnet = defineChain({
id: 4_663,
network: 'robinhood-chain',
name: 'Robinhood Chain',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: {
default: {
http: ['https://rpc.mainnet.chain.robinhood.com'],
},
public: {
http: ['https://rpc.mainnet.chain.robinhood.com'],
},
},
blockExplorers: {
default: {
name: 'Blockscout',
url: 'https://robinhoodchain.blockscout.com',
},
},
});

const rhTestnet = defineChain({
id: 46_630,
network: 'robinhood-chain-testnet',
name: 'Robinhood Chain Testnet',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: {
default: {
http: ['https://rpc.testnet.chain.robinhood.com'],
},
public: {
http: ['https://rpc.testnet.chain.robinhood.com'],
},
},
blockExplorers: {
default: {
name: 'Blockscout',
url: 'https://explorer.testnet.chain.robinhood.com',
},
},
testnet: true,
});

const customParentChains: Record<number, Chain> = {};

export function getCustomParentChains(): Chain[] {
Expand Down Expand Up @@ -131,6 +174,7 @@ export const mainnets = [
arbitrumOne,
arbitrumNova,
base,
rhMainnet,
];

export const testnets = [
Expand All @@ -139,6 +183,7 @@ export const testnets = [
// testnet L2
arbitrumSepolia,
baseSepolia,
rhTestnet,
// local nitro-testnode
nitroTestnodeL1,
nitroTestnodeL2,
Expand All @@ -154,11 +199,13 @@ export {
arbitrumOne,
arbitrumNova,
base,
rhMainnet,
// testnet L1
sepolia,
// testnet L2
arbitrumSepolia,
baseSepolia,
rhTestnet,
// local nitro-testnode
nitroTestnodeL1,
nitroTestnodeL2,
Expand Down
2 changes: 2 additions & 0 deletions src/contracts/RollupCreator/v3.2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,11 @@ export const rollupCreatorABI = [
export const rollupCreatorAddress = {
1: '0xe06Bc77336E201c4C08751918A4bB99ddf0e1Bf7',
1337: '0xe6D50099f4d891240435143193d46581A1447202',
4663: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
8453: '0x8d1668636D053C10F57367D68118bD624f41ffe6',
42161: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
42170: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
46630: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
84532: '0x8d1668636D053C10F57367D68118bD624f41ffe6',
412346: '0xbcF51F3AAb5D5Efa025b4A2B235BDc9F3f69b4d2',
421614: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
Expand Down
2 changes: 2 additions & 0 deletions src/contracts/TokenBridgeCreator/v1.2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,11 @@ export const tokenBridgeCreatorABI = [
export const tokenBridgeCreatorAddress = {
1: '0x60D9A46F24D5a35b95A78Dd3E793e55D94EE0660',
1337: '0x4Af567288e68caD4aA93A272fe6139Ca53859C70',
4663: '0x8B1EFf64E1eAd493A82C6798f5708183AF91A3AD',
8453: '0x4C240987d6fE4fa8C7a0004986e3db563150CA55',
42161: '0x2f5624dc8800dfA0A82AC03509Ef8bb8E7Ac000e',
42170: '0x8B9D9490a68B1F16ac8A21DdAE5Fd7aB9d708c14',
46630: '0xB27b615369d2B846183c36AD8406B4DD7990fb70',
84532: '0xFC71d21a4FE10Cc0d34745ba9c713836f82f8DE3',
412346: '0x38F35Af53bF913c439eaB06A367e09D6eb253492',
421614: '0x56C486D3786fA26cc61473C499A36Eb9CC1FbD8E',
Expand Down
3 changes: 3 additions & 0 deletions src/contracts/WETH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
// * https://github.com/OffchainLabs/arbitrum-token-bridge/blob/master/packages/arb-token-bridge-ui/src/util/networksNitroTestnode.ts
// * https://docs.base.org/chain/base-contracts#base-mainnet
// * https://docs.base.org/chain/base-contracts#base-testnet-sepolia
// * https://docs.robinhood.com/chain/protocol-contracts
export const wethAddress = {
1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
1337: '0x217788c286797D56Cd59aF5e493f3699C39cbbe8',
4663: '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73',
8453: '0x4200000000000000000000000000000000000006',
42161: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
42170: '0x722E8BdD2ce80A4422E880164f2079488e115365',
46630: '0x7943e237c7F95DA44E0301572D358911207852Fa',
84532: '0x4200000000000000000000000000000000000006',
412346: '0xF5fE98ee962e3E077A75FBe6fE8aBaeF80F3c12d',
421614: '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73',
Expand Down
4 changes: 4 additions & 0 deletions src/createRollupGetMaxDataSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import {
arbitrumOne,
arbitrumNova,
base,
rhMainnet,
sepolia,
arbitrumSepolia,
baseSepolia,
rhTestnet,
nitroTestnodeL1,
nitroTestnodeL2,
} from './chains';
Expand All @@ -26,9 +28,11 @@ export function createRollupGetMaxDataSize(parentChainId: ParentChainId): bigint
case arbitrumOne.id:
case arbitrumNova.id:
case base.id:
case rhMainnet.id:
// testnet L2
case arbitrumSepolia.id:
case baseSepolia.id:
case rhTestnet.id:
// local nitro-testnode L2
case nitroTestnodeL2.id:
return BigInt(104_857);
Expand Down
2 changes: 1 addition & 1 deletion src/createTokenBridge-testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getNitroTestnodePrivateKeyAccounts } from './testHelpers';
const execFilePromise = promisify(execFile);
const testnodeAccounts = getNitroTestnodePrivateKeyAccounts();
const tokenBridgeContractsImage =
process.env.TOKEN_BRIDGE_CONTRACTS_IMAGE ?? 'arbitrum-chain-sdk-token-bridge-contracts:v1.2.2';
process.env.TOKEN_BRIDGE_CONTRACTS_IMAGE ?? 'arbitrum-chain-sdk-token-bridge-contracts:v1.2.5';
const skipTokenBridgeContractsImageBuild = process.env.TOKEN_BRIDGE_CONTRACTS_SKIP_BUILD === 'true';

let tokenBridgeContractsImagePromise: Promise<string> | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@arbitrum/nitro-contracts": "^3.2.0",
"@arbitrum/chain-actions": "1.0.0-alpha.4",
"@arbitrum/sdk": "^4.0.4",
"@arbitrum/token-bridge-contracts": "^1.2.2",
"@arbitrum/token-bridge-contracts": "^1.2.5",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@offchainlabs/fund-distribution-contracts": "^1.1.0",
Expand Down
2 changes: 2 additions & 0 deletions src/parentChainIsArbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export function parentChainIsArbitrum(parentChainId: ParentChainId): boolean {

case chains.arbitrumOne.id:
case chains.arbitrumNova.id:
case chains.rhMainnet.id:
case chains.arbitrumSepolia.id:
case chains.rhTestnet.id:
case chains.nitroTestnodeL2.id:
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/parentChainIsMainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ export function parentChainIsMainnet(parentChainId: ParentChainId): boolean {
case chains.arbitrumOne.id:
case chains.arbitrumNova.id:
case chains.base.id:
case chains.rhMainnet.id:
return true;

case chains.sepolia.id:
case chains.arbitrumSepolia.id:
case chains.baseSepolia.id:
case chains.rhTestnet.id:
case chains.nitroTestnodeL1.id:
case chains.nitroTestnodeL2.id:
return false;
Expand Down
4 changes: 4 additions & 0 deletions src/utils/getEarliestRollupCreatorDeploymentBlockNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import {
arbitrumOne,
arbitrumNova,
base,
rhMainnet,
sepolia,
arbitrumSepolia,
baseSepolia,
rhTestnet,
nitroTestnodeL1,
nitroTestnodeL2,
} from '../chains';
Expand All @@ -19,11 +21,13 @@ const earliestRollupCreatorDeploymentBlockNumber: Record<number, bigint> = {
[arbitrumOne.id]: 150_599_584n,
[arbitrumNova.id]: 47_798_739n,
[base.id]: 12_978_604n,
[rhMainnet.id]: 51_078_803n,
// testnet L1
[sepolia.id]: 4_741_823n,
// testnet L2
[arbitrumSepolia.id]: 654_628n,
[baseSepolia.id]: 10_606_961n,
[rhTestnet.id]: 111_220_754n,
// local nitro-testnode
[nitroTestnodeL1.id]: 0n,
[nitroTestnodeL2.id]: 0n,
Expand Down
4 changes: 4 additions & 0 deletions src/utils/getParentChainLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import {
arbitrumOne,
arbitrumNova,
base,
rhMainnet,
arbitrumSepolia,
baseSepolia,
rhTestnet,
nitroTestnodeL2,
} from '../chains';
import { ParentChainId } from '../types/ParentChain';
Expand All @@ -26,9 +28,11 @@ export function getParentChainLayer(parentChainId: ParentChainId): 1 | 2 {
case arbitrumOne.id:
case arbitrumNova.id:
case base.id:
case rhMainnet.id:
// testnet L2
case arbitrumSepolia.id:
case baseSepolia.id:
case rhTestnet.id:
// local nitro-testnode L2
case nitroTestnodeL2.id:
return 2;
Expand Down
15 changes: 12 additions & 3 deletions src/utils/getRollupCreatorAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Client, Transport, Chain, ChainContract, Address } from 'viem';
import { rollupCreatorAddress as rollupCreatorV3Dot2Address } from '../contracts/RollupCreator/v3.2';
import { rollupCreatorAddress as rollupCreatorV2Dot1Address } from '../contracts/RollupCreator/v2.1';

import { validateParentChain } from '../types/ParentChain';
import { ParentChainId, validateParentChain } from '../types/ParentChain';
import { RollupCreatorSupportedVersion } from '../types/createRollupTypes';

export function getRollupCreatorAddress<TChain extends Chain | undefined>(
Expand All @@ -25,12 +25,21 @@ export function getRollupCreatorAddress<TChain extends Chain | undefined>(
return address;
}

const rollupCreatorAddress =
// older versions are not deployed on all parent chains, so their maps may miss entries
const rollupCreatorAddress: Partial<Record<ParentChainId, Address>> =
rollupCreatorVersion === 'v3.2'
? //
rollupCreatorV3Dot2Address
: //
rollupCreatorV2Dot1Address;

return rollupCreatorAddress[parentChainId];
const address = rollupCreatorAddress[parentChainId];

if (typeof address === 'undefined') {
throw new Error(
`RollupCreator ${rollupCreatorVersion} is not deployed on parent chain ${parentChainId}`,
);
}

return address;
}
2 changes: 1 addition & 1 deletion token-bridge-contracts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates git docker.io python3 chromium build-essential && \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
RUN git clone -b v1.2.2 https://github.com/OffchainLabs/token-bridge-contracts.git ./
RUN git clone -b v1.2.5 https://github.com/OffchainLabs/token-bridge-contracts.git ./
RUN yarn install
RUN yarn build
ENTRYPOINT ["yarn"]
6 changes: 6 additions & 0 deletions wagmi.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import {
arbitrumOne,
arbitrumNova,
base,
rhMainnet,
sepolia,
arbitrumSepolia,
baseSepolia,
rhTestnet,
nitroTestnodeL1,
nitroTestnodeL2,
} from './src/chains';
Expand Down Expand Up @@ -94,11 +96,13 @@ const contracts: ContractConfig[] = [
[arbitrumOne.id]: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
[arbitrumNova.id]: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
[base.id]: '0x8d1668636D053C10F57367D68118bD624f41ffe6',
[rhMainnet.id]: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
// testnet L1
[sepolia.id]: '0xe06Bc77336E201c4C08751918A4bB99ddf0e1Bf7',
// testnet L2
[arbitrumSepolia.id]: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
[baseSepolia.id]: '0x8d1668636D053C10F57367D68118bD624f41ffe6',
[rhTestnet.id]: '0xF5962AD061A1aD6F38F340F5b267b3593cC1Cd7B',
// local nitro-testnode (on "release" branch with --tokenbridge --l3node --l3-token-bridge flags)
[nitroTestnodeL1.id]: '0xe6D50099f4d891240435143193d46581A1447202',
[nitroTestnodeL2.id]: '0xbcF51F3AAb5D5Efa025b4A2B235BDc9F3f69b4d2',
Expand All @@ -114,11 +118,13 @@ const contracts: ContractConfig[] = [
[arbitrumOne.id]: '0x2f5624dc8800dfA0A82AC03509Ef8bb8E7Ac000e',
[arbitrumNova.id]: '0x8B9D9490a68B1F16ac8A21DdAE5Fd7aB9d708c14',
[base.id]: '0x4C240987d6fE4fa8C7a0004986e3db563150CA55',
[rhMainnet.id]: '0x8B1EFf64E1eAd493A82C6798f5708183AF91A3AD',
// testnet L1
[sepolia.id]: '0x7edb2dfBeEf9417e0454A80c51EE0C034e45a570',
// testnet L2
[arbitrumSepolia.id]: '0x56C486D3786fA26cc61473C499A36Eb9CC1FbD8E',
[baseSepolia.id]: '0xFC71d21a4FE10Cc0d34745ba9c713836f82f8DE3',
[rhTestnet.id]: '0xB27b615369d2B846183c36AD8406B4DD7990fb70',
// local nitro-testnode (on "release" branch with --tokenbridge --l3node --l3-token-bridge flags)
[nitroTestnodeL1.id]: '0x4Af567288e68caD4aA93A272fe6139Ca53859C70',
[nitroTestnodeL2.id]: '0x38F35Af53bF913c439eaB06A367e09D6eb253492',
Expand Down
Loading
Loading