Skip to content

Commit c2773c6

Browse files
committed
PoS: fxportal message passing tutorial
Mumbai deprecation update
1 parent e00dcc7 commit c2773c6

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

docs/pos/how-to/bridging/l1-l2-communication/state-transfer.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,43 +27,44 @@ Use the `FxBaseChildTunnel` contract from [here](https://github.com/jdkanani/fx-
2727

2828
- You need to inherit `FxBaseRootTunnel` contract in your root contract on Ethereum. As an example, you can follow this [contract](https://github.com/jdkanani/fx-portal/blob/main/contracts/examples/state-transfer/FxStateRootTunnel.sol) . Similarly, inherit `FxBaseChildTunnel` contract in your child on Polygon. Follow this [contract](https://github.com/jdkanani/fx-portal/blob/main/contracts/examples/state-transfer/FxStateChildTunnel.sol) as an example.
2929
- While deploying your root contract on
30-
- **Goerli Testnet**, pass the address of `_checkpointManager` as **0x2890bA17EfE978480615e330ecB65333b880928e** and `_fxRoot` as **0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA**.
30+
- **Sepolia testnet**, pass the address of `_checkpointManager` as **0xbd07D7E1E93c8d4b2a261327F3C28a8EA7167209** and `_fxRoot` as **0x0E13EBEdDb8cf9f5987512d5E081FdC2F5b0991e**.
3131

3232
- **Ethereum Mainnet**, `_checkpointManager` is **0x86e4dc95c7fbdbf52e33d563bbdb00823894c287** and `_fxRoot` is **0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2**.
33-
- For deploying the child contract on **Mumbai testnet**, pass **0xCf73231F28B7331BBe3124B907840A94851f9f11** as `_fxChild` in constructor. For **Polygon mainnet,** `_fxChild` will be **0x8397259c983751DAf40400790063935a11afa28a**.
34-
- Call `setFxChildTunnel` on deployed root tunnel with the address of child tunnel. Example: [0x79cd30ace561a226258918b56ce098a08ce0c70707a80bba91197f127a48b5c2](https://goerli.etherscan.io/tx/0x79cd30ace561a226258918b56ce098a08ce0c70707a80bba91197f127a48b5c2)
35-
- Call `setFxRootTunnel` on deployed child tunnel with address of root tunnel. Example: [0xffd0cda35a8c3fd6d8c1c04cd79a27b7e5e00cfc2ffc4b864d2b45a8bb7e98b8](https://mumbai.polygonscan.com/tx/0xffd0cda35a8c3fd6d8c1c04cd79a27b7e5e00cfc2ffc4b864d2b45a8bb7e98b8/internal-transactions)
33+
- For deploying the child contract on **Amoy testnet**, pass **0xE5930336866d0388f0f745A2d9207C7781047C0f** as `_fxChild` in constructor. For **Polygon mainnet,** `_fxChild` will be **0x8397259c983751DAf40400790063935a11afa28a**.
34+
- Call `setFxChildTunnel` on deployed root tunnel with the address of child tunnel. Example: [0x97482d379e397329ac1ee2a34eeb9aceb06bd4a91ec17c7d7d3da4a1e96c165c](https://sepolia.etherscan.io/tx/0x97482d379e397329ac1ee2a34eeb9aceb06bd4a91ec17c7d7d3da4a1e96c165c)
35+
- Call `setFxRootTunnel` on deployed child tunnel with address of root tunnel. Example: [0xae30445301bd7c902bf373fb890faf5658bd3a9437131c9408d5ecbc41af3fc0](https://amoy.polygonscan.com/tx/0xae30445301bd7c902bf373fb890faf5658bd3a9437131c9408d5ecbc41af3fc0)
3636

37-
## Example Contracts of State Transfer Bridge
37+
## State tunnel sample contracts
3838

3939
- **Contracts**: [Fx-Portal Github Repository](https://github.com/jdkanani/fx-portal/tree/main/contracts/tunnel)
40-
- **Goerli:** [0xc4432e7dab6c1b43f4dc38ad2a594ca448aec9af](https://goerli.etherscan.io/address/0xc4432e7dab6c1b43f4dc38ad2a594ca448aec9af)
41-
- **Mumbai:** [0xa0060Cc969d760c3FA85844676fB654Bba693C22](https://mumbai.polygonscan.com/address/0xa0060Cc969d760c3FA85844676fB654Bba693C22/transactions)
40+
- **Sepolia:** [0x1707157b9221204869ED67705e42fB65e026586c](https://sepolia.etherscan.io/address/0x1707157b9221204869ED67705e42fB65e026586c)
41+
- **Amoy:** [0xf5D2463d0176462d797Afcd57eC477b7B0CcBE70](https://amoy.polygonscan.com/address/0xf5D2463d0176462d797Afcd57eC477b7B0CcBE70)
4242

4343
## State Transfer from Ethereum → Polygon
4444

45-
- You need to call `_sendMessageToChild()` internally in your root contract and pass the data as an argument to be sent to Polygon. Example: [0x28705fcae757a0c88694bd167cb94a2696a0bc9a645eb4ae20cff960537644c1](https://goerli.etherscan.io/tx/0x28705fcae757a0c88694bd167cb94a2696a0bc9a645eb4ae20cff960537644c1)
45+
- You need to call `_sendMessageToChild()` internally in your root contract and pass the data as an argument to be sent to Polygon. Example: [0x00a1aa71593fec825b4b1ce1081b5a9848612fb21f9e56def2914b483f5f34f5](https://sepolia.etherscan.io/tx/0x00a1aa71593fec825b4b1ce1081b5a9848612fb21f9e56def2914b483f5f34f5)
4646
- In your child contract, implement `_processMessageFromRoot()` virtual function in `FxBaseChildTunnel` to retrieve data from Ethereum. The data will be received automatically from the state receiver when the state is synced.
4747

4848
## State Transfer from Polygon → Ethereum
4949

50-
1. Call `_sendMessageToRoot()` internally in your child contract with data as a parameter to be sent to Ethereum. Example: [0x3cc9f7e675bb4f6af87ee99947bf24c38cbffa0b933d8c981644a2f2b550e66a](https://mumbai.polygonscan.com/tx/0x3cc9f7e675bb4f6af87ee99947bf24c38cbffa0b933d8c981644a2f2b550e66a/logs)
50+
1. Call `_sendMessageToRoot()` internally in your child contract with data as a parameter to be sent to Ethereum. Note down the transaction hash as it will be used to generate the proof after the transaction has been included as a checkpoint.
5151

52-
Note the transaction hash as it will be used to generate proof after it has been included as a checkpoint.
52+
2. **Proof Generation to complete the exit on root chain**: Generate the proof using the **tx hash** and **MESSAGE_SENT_EVENT_SIG**. To generate the proof, you can either use the proof generation API hosted by Polygon, or you can also spin up your own proof generation API by following the instructions [here](https://github.com/maticnetwork/proof-generation-api).
5353

54-
2. **Proof Generation to complete the exit on root chain**: Generate the proof using the **tx hash** and **MESSAGE_SENT_EVENT_SIG**. To generate the proof, you can either use the proof generation API hosted by Polygon or you can also spin up your own proof generation API by following the instructions [here](https://github.com/maticnetwork/proof-generation-api).
54+
The proof generation endpoint hosted by Polygon is available here:
55+
56+
- [Mainnet](https://proof-generator.polygon.technology/api/v1/matic/exit-payload/{burnTxHash}?eventSignature={eventSignature})
57+
- [Testnet](https://proof-generator.polygon.technology/api/v1/amoy/exit-payload/{burnTxHash}?eventSignature={eventSignature})
5558

56-
The proof generation endpoint hosted by Polygon is available [here](https://proof-generator.polygon.technology/api/v1/matic/exit-payload/{burnTxHash}?eventSignature={eventSignature}).
59+
Here,
5760

58-
- `burnTxHash` is the transaction hash of the `_sendMessageToRoot()` transaction you initiated on Polygon.
59-
- `eventSignature` is the event signature of the event emitted by the `_sendMessageToRoot()` function. The event signature for the MESSAGE_SENT_EVENT_SIG is `0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036`.
61+
- `burnTxHash` is the transaction hash of the `_sendMessageToRoot()` transaction you initiated on Polygon.
62+
- `eventSignature` is the event signature of the event emitted by the `_sendMessageToRoot()` function. The event signature for the MESSAGE_SENT_EVENT_SIG is `0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036`.
6063

61-
The proof generation API usage examples for the Mainnet and Testnet are as follows:-
62-
63-
→ [Mumbai Testnet Proof generation](https://proof-generator.polygon.technology/api/v1/mumbai/exit-payload/0x4756b76a9611cffee3d2eb645819e988c34615621ea256f818ab788d81e1f838?eventSignature=0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036)
64+
Here's an example of how to use the proof generation API:
6465

6566
→ [Polygon Mainnet Proof generation](https://proof-generator.polygon.technology/api/v1/matic/exit-payload/0x70bb6dbee84bd4ef1cd1891c666733d0803d81ac762ff7fdc4726e4525c1e23b?eventSignature=0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036)
6667

67-
3. Implement `_processMessageFromChild()` in your root contract.
68+
1. Implement `_processMessageFromChild()` in your root contract.
6869

69-
4. Use the generated proof as an input to `receiveMessage()` to retrieve data sent from child tunnel into your contract. Example: [0x436dcd500659bea715a09d9257295ddc21290769daeea7f0b666166ef75e3515](https://goerli.etherscan.io/tx/0x436dcd500659bea715a09d9257295ddc21290769daeea7f0b666166ef75e3515) )
70+
2. Use the generated proof as an input to `receiveMessage()` to retrieve data sent from child tunnel into your contract.

0 commit comments

Comments
 (0)