Skip to content

Commit

Permalink
Merge pull request #4 from GenerationSoftware/gen-824-launch-testnet-…
Browse files Browse the repository at this point in the history
…on-arbitrum

feat(ethereumToArbirtrum): add dispatchAndProcess functions
  • Loading branch information
PierrickGT authored Nov 7, 2023
2 parents 9cfb405 + 9230f55 commit 54f7244
Show file tree
Hide file tree
Showing 34 changed files with 1,841 additions and 2,181 deletions.
5 changes: 3 additions & 2 deletions .envrc.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export POLYGON_RPC_URL=""

# Testnet RPC URLs
export GOERLI_RPC_URL=""
export ARBITRUM_GOERLI_RPC_URL=""
export OPTIMISM_GOERLI_RPC_URL=""
export SEPOLIA_RPC_URL=""
export ARBITRUM_SEPOLIA_RPC_URL=""
export OPTIMISM_SEPOLIA_RPC_URL=""
export MUMBAI_RPC_URL=""

# Used for verifying contracts on Etherscan
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{
"files": "*.sol",
"options": {
"compiler": "0.8.16",
"bracketSpacing": true,
"printWidth": 100,
"tabWidth": 2
Expand All @@ -17,6 +18,6 @@
"arrowParens": "always",
"singleQuote": true
}
},
}
]
}
2 changes: 2 additions & 0 deletions Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export const OPTIMISM_CHAIN_ID = 10;
export const POLYGON_CHAIN_ID = 137;

export const GOERLI_CHAIN_ID = 5;
export const SEPOLIA_CHAIN_ID = 11155111;
export const ARBITRUM_GOERLI_CHAIN_ID = 421613;
export const ARBITRUM_SEPOLIA_CHAIN_ID = 421614;
64 changes: 32 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ For most bridges, you only have to call `dispatchMessage` or `dispatchMessageBat

### Dispatch a message

To dispatch a message from Ethereum to the L2 of your choice, you have to interact with the [ISingleMessageDispatcher](./src/interfaces/ISingleMessageDispatcher.sol) contract and call the following function.
To dispatch a message from Ethereum to the L2 of your choice, you have to interact with the [IMessageDispatcher](./src/interfaces/IMessageDispatcher.sol) contract and call the following function.

```solidity
/**
Expand All @@ -52,13 +52,13 @@ function dispatchMessage(
) external returns (bytes32);
```

- `toChainId`: id of the chain to which you want to dispatch the message
- `toChainId`: ID of the chain to which you want to dispatch the message
- `to`: address of the contract that will receive the message
- `data`: message that you want to be executed on L2

### Dispatch a batch messages

To dispatch a batch of messages from Ethereum to the L2 of your choice, you have to interact with the [IBatchedMessageDispatcher](./src/interfaces/IBatchedMessageDispatcher.sol) contract and call the following function.
To dispatch a batch of messages from Ethereum to the L2 of your choice, you have to interact with the [IBatchMessageDispatcher](./src/interfaces/extensions/IBatchMessageDispatcher.sol) contract and call the following function.

```solidity
/**
Expand All @@ -75,7 +75,7 @@ function dispatchMessageBatch(
) external returns (bytes32);
```

- `toChainId`: id of the chain to which you want to dispatch the message
- `toChainId`: ID of the chain to which you want to dispatch the message
- `messages`: array of Message that you want to be executed on L2

```solidity
Expand Down Expand Up @@ -121,7 +121,7 @@ The `processMessage` function requires the same transaction parameters as the Ar
/**
* @notice Process message that has been dispatched.
* @dev The transaction hash must match the one stored in the `dispatched` mapping.
* @dev `_from` is passed as `callValueRefundAddress` cause this address can cancel the retryably ticket.
* @dev `_from` is passed as `_callValueRefundAddress` cause this address can cancel the retryable ticket.
* @dev We store `_message` in memory to avoid a stack too deep error.
* @param _messageId ID of the message to process
* @param _from Address who dispatched the `_data`
Expand All @@ -131,7 +131,7 @@ The `processMessage` function requires the same transaction parameters as the Ar
* @param _gasLimit Maximum amount of gas required for the `_messages` to be executed
* @param _maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee
* @param _gasPriceBid Gas price bid for L2 execution
* @return uint256 Id of the retryable ticket that was created
* @return uint256 ID of the retryable ticket that was created
*/
function processMessage(
bytes32 messageId,
Expand Down Expand Up @@ -267,21 +267,21 @@ function _msgSender() internal view returns (address payable _signer);

### Testnet

#### Ethereum Goerli -> Arbitrum Goerli
#### Ethereum Sepolia -> Arbitrum Sepolia

| Network | Contract | Address |
| --------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Ethereum Goerli | [EthereumToArbitrumDispatcher.sol](./src/ethereum-arbitrum/EthereumToArbitrumDispatcher.sol) | [0xBc244773f71a2f897fAB5D5953AA052B8ff68670](https://goerli.etherscan.io/address/0xBc244773f71a2f897fAB5D5953AA052B8ff68670) |
| Arbitrum Goerli | [EthereumToArbitrumExecutor](./src/ethereum-arbitrum/EthereumToArbitrumExecutor.sol) | [0xe7Ab52219631882f778120c1f19D6086ED390bE1](https://goerli.arbiscan.io/address/0xe7Ab52219631882f778120c1f19D6086ED390bE1) |
| Arbitrum Goerli | [Greeter](./test/contracts/Greeter.sol) | [0xA181dE5454daa63115e4A2f626E9268Cc812FcC1](https://goerli.arbiscan.io/address/0xA181dE5454daa63115e4A2f626E9268Cc812FcC1) |
| Network | Contract | Address |
| ---------------- | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Ethereum Sepolia | [EthereumToArbitrumDispatcher.sol](./src/ethereum-arbitrum/EthereumToArbitrumDispatcher.sol) | [0x8bCDe547B30C6DE6b532073F2d091F8B292D60a6](https://sepolia.etherscan.io/address/0x8bCDe547B30C6DE6b532073F2d091F8B292D60a6) |
| Arbitrum Sepolia | [EthereumToArbitrumExecutor](./src/ethereum-arbitrum/EthereumToArbitrumExecutor.sol) | [0x02aCC9594161812E3004C174CF1735EdB10e20A4](https://sepolia.arbiscan.io/address/0x02aCC9594161812E3004C174CF1735EdB10e20A4) |
| Arbitrum Sepolia | [Greeter](./test/contracts/Greeter.sol) | [0x49b86ba45C01957Df33Fe7bbB97002A0e4E5F964](https://sepolia.arbiscan.io/address/0x49b86ba45C01957Df33Fe7bbB97002A0e4E5F964) |

#### Ethereum Goerli -> Optimism Goerli
#### Ethereum Sepolia -> Optimism Sepolia

| Network | Contract | Address |
| --------------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| Ethereum Goerli | [EthereumToOptimismDispatcher.sol](./src/ethereum-optimism/EthereumToOptimismDispatcher.sol) | [0x177B14c6b571262057C3c30E3AE6bB044F62e55c](https://goerli.etherscan.io/address/0x177B14c6b571262057C3c30E3AE6bB044F62e55c) |
| Optimism Goerli | [EthereumToOptimismExecutor](./src/ethereum-optimism/EthereumToOptimismExecutor.sol) | [0x59Ba766ff229c21b97184647292706039aF63dA1](https://goerli-optimism.etherscan.io/address/0x59Ba766ff229c21b97184647292706039aF63dA1) |
| Optimism Goerli | [Greeter](./test/contracts/Greeter.sol) | [0x6D8c6c9408C7073b17Acb7bA1eBc541fb57c1aef](https://goerli-optimism.etherscan.io/address/0x6D8c6c9408C7073b17Acb7bA1eBc541fb57c1aef) |
| Network | Contract | Address |
| ---------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| Ethereum Sepolia | [EthereumToOptimismDispatcher.sol](./src/ethereum-optimism/EthereumToOptimismDispatcher.sol) | [0x2aeB429f7d8c00983E033087Dd5a363AbA2AC55f](https://sepolia.etherscan.io/address/0x2aeB429f7d8c00983E033087Dd5a363AbA2AC55f) |
| Optimism Sepolia | [EthereumToOptimismExecutor](./src/ethereum-optimism/EthereumToOptimismExecutor.sol) | [0x6A501383A61ebFBc143Fc4BD41A2356bA71A6964](https://sepolia-optimism.etherscan.io/address/0x6A501383A61ebFBc143Fc4BD41A2356bA71A6964) |
| Optimism Sepolia | [Greeter](./test/contracts/Greeter.sol) | [0x8537C5a9AAd3ec1D31a84e94d19FcFC681E83ED0](https://sepolia-optimism.etherscan.io/address/0x8537C5a9AAd3ec1D31a84e94d19FcFC681E83ED0) |

#### Ethereum Goerli -> Polygon Mumbai

Expand Down Expand Up @@ -382,16 +382,16 @@ yarn deploy:optimism

#### Testnet

##### Ethereum Goerli to Arbitrum Goerli bridge
##### Ethereum Sepolia to Arbitrum Sepolia bridge

```
yarn deploy:arbitrumGoerli
yarn deploy:arbitrumSepolia
```

##### Ethereum Goerli to Optimism Goerli bridge
##### Ethereum Sepolia to Optimism Sepolia bridge

```
yarn deploy:optimismGoerli
yarn deploy:optimismSepolia
```

##### Ethereum Goerli to Polygon Mumbai bridge
Expand All @@ -406,13 +406,13 @@ You can use the following commands to bridge from Ethereum to a layer 2 of your

It will set the greeting message in the [Greeter](./test/contracts/Greeter.sol) contract to `Hello from L1` instead of `Hello from L2`.

#### Ethereum Goerli to Arbitrum Goerli
#### Ethereum Sepolia to Arbitrum Sepolia

```
yarn bridge:arbitrumGoerli
yarn bridge:arbitrumSepolia
```

It takes about 15 minutes for the message to be bridged to Arbitrum Goerli.
It takes about 15 minutes for the message to be bridged to Arbitrum Sepolia.

##### Example transaction

Expand All @@ -422,20 +422,20 @@ It takes about 15 minutes for the message to be bridged to Arbitrum Goerli.
| Ethereum Goerli | processMessage | [0x4effcda5e729a2943a86bd1317a784644123388bb4fd7ea207e70ec3a360ab60](https://goerli.etherscan.io/tx/0x4effcda5e729a2943a86bd1317a784644123388bb4fd7ea207e70ec3a360ab60) |
| Arbitrum Goerli | executeMessage | [0x0883252887d34a4a545a20e252e55c712807d1707438cf6e8503a99a32357024](https://goerli.arbiscan.io/tx/0x0883252887d34a4a545a20e252e55c712807d1707438cf6e8503a99a32357024) |

#### Ethereum Goerli to Optimism Goerli
#### Ethereum Sepolia to Optimism Sepolia

```
yarn bridge:optimismGoerli
yarn bridge:optimismSepolia
```

It takes about 5 minutes for the message to be bridged to Optimism Goerli.
It takes about 5 minutes for the message to be bridged to Optimism Sepolia.

##### Example transaction

| Network | Message | Transaction hash |
| --------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Ethereum Goerli | dispatchMessage | [0xdaf3b8210294dc2414beefa14e56f47f638510031c4487443c58fd6a92c8f386](https://goerli.etherscan.io/tx/0xdaf3b8210294dc2414beefa14e56f47f638510031c4487443c58fd6a92c8f386) |
| Optimism Goerli | executeMessage | [https://goerli-optimism.etherscan.io/tx/0xa83813646e7978cea4f27b57688ce30e3622b135ca6c18489d0c8fa3ee297c5b](https://goerli-optimism.etherscan.io/tx/https://goerli-optimism.etherscan.io/tx/0xa83813646e7978cea4f27b57688ce30e3622b135ca6c18489d0c8fa3ee297c5b) |
| Network | Message | Transaction hash |
| ---------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Ethereum Sepolia | dispatchMessage | [0xbfef5bbbe67454c75545739cf69e03d0e947158295fe052d468c0000729f0019](https://sepolia.etherscan.io/tx/0xbfef5bbbe67454c75545739cf69e03d0e947158295fe052d468c0000729f0019) |
| Optimism Sepolia | executeMessage | [https://sepolia-optimism.etherscan.io/tx/0x5c68c4b7912771e075437a2d170789ba8d36084e1ccd89c4fd18e5544937a0b8](https://sepolia-optimism.etherscan.io/tx/https://sepolia-optimism.etherscan.io/tx/0x5c68c4b7912771e075437a2d170789ba8d36084e1ccd89c4fd18e5544937a0b8) |

#### Ethereum Goerli to Polygon Mumbai

Expand Down
Loading

0 comments on commit 54f7244

Please sign in to comment.