8000 Add bridges changes by vanshika-srivastava · Pull Request #776 · gnosischain/documentation · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add bridges changes #776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 138 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
9fc18de
Add files via upload
0xarmagan Jul 29, 2024
8af54f1
Update 07-24-core-devs-call.md
0xarmagan Jul 29, 2024
1bb846e
fix broken RPC url
vanshika-srivastava Jul 29, 2024
683d1c8
fix all the broken anchors and hyperlinks
vanshika-srivastava Jul 31, 2024
edc86c6
chore: fix some comments (#702)
zhoufanjin Jul 31, 2024
0244f05
shutterized -> to change to shutter enabled
vanshika-srivastava Aug 1, 2024
4a5ca3c
Merge branch 'main' into dev
vanshika-srivastava Aug 1, 2024
8db8770
fix core dev call layout
vanshika-srivastava Aug 2, 2024
4550427
Core Devs Call Notes July 31, 2024
0xarmagan Aug 6, 2024
86d3056
remove custom signer from interact page
vanshika-srivastava Aug 6, 2024
76868df
fix: 07-31-core-devs-call format
zengzengzenghuy Aug 6, 2024
6461c4f
Core Devs Call Notes Aug 7, 2024
0xarmagan Aug 9, 2024
03e5df4
"Liquid Staking" Page Update (#709)
iamjackgale Aug 12, 2024
aa150fb
Update _generate_validator_keys_wagyu.md (#710)
theChim9 Aug 12, 2024
ef62199
Update voluntary-exit.md (#711)
theChim9 Aug 12, 2024
d222223
Add files via upload
0xarmagan Aug 23, 2024
c0deaae
Update 08-21-core-devs-call.md
0xarmagan Aug 23, 2024
5a2569c
Update 08-07-core-devs-call.md
0xarmagan Aug 23, 2024
b35f1e8
Merge branch 'main' into dev
vanshika-srivastava Aug 26, 2024
aec2c12
Updates 08-21-core-devs-call.md for a small typo
vanshika-srivastava Aug 26, 2024
8f6fca4
Core Devs call notes Aug 28
0xarmagan Aug 31, 2024
9b89786
feat: Cookbook Onboard integration (#715)
ClockRide Sep 2, 2024
97b2046
Update 08-28-core-devs-call.md - fix format
vanshika-srivastava Sep 2, 2024
9090c86
Added dRPC to community Faucets (#698)
maradeeym Sep 2, 2024
46c76b9
chore(bridges): update deprecated url to https://github.com/tokenbridge/
zengzengzenghuy Sep 8, 2024
a79b5c3
add section for running node with eth swarm setup
vanshika-srivastava Sep 11, 2024
fed4767
feat(bridges): add Hashi integration overview
zengzengzenghuy Sep 16, 2024
01d820f
chore(bridges): add testnet contracts for Hashi integration
zengzengzenghuy Sep 17, 2024
9e9710c
fix: error
zengzengzenghuy Sep 17, 2024
be2b4fc
Merge branch 'main' into dev
vanshika-srivastava Sep 17, 2024
98c04a7
added custom signers guides
skundu42 Sep 19, 2024
ba01ed5
Add Confidential Computing category and Secret Network tooling (#719)
secretpatrick Sep 20, 2024
294c29b
Updated the faucet link
vanshika-srivastava Sep 21, 2024
d3dacce
fix naming for confidential computing
vanshika-srivastava Sep 21, 2024
c5c2d87
Update release workflow name
Sep 26, 2024
ce14288
Update Faucets.md with Correct faucet link
vanshika-srivastava Sep 26, 2024
e68809a
Update communication.md with new discord link
vanshika-srivastava Sep 26, 2024
6c8aabf
Update staking.md with new discord link
vanshika-srivastava Sep 26, 2024
0154b68
Update docusaurus.config.js
vanshika-srivastava Sep 26, 2024
bbd5a48
Update troubleshooting.md
vanshika-srivastava Sep 26, 2024
ad67463
Update monitoring.md
vanshika-srivastava Sep 26, 2024
03e54a0
Update bug-bounty.md
vanshika-srivastava Sep 26, 2024
231704e
Update depositWithdrawalReward.md
vanshika-srivastava Sep 26, 2024
5caa8fa
Update offlineAndSyncIssue.md
vanshika-srivastava Sep 26, 2024
48a0857
Update changingwc.md
vanshika-srivastava Sep 26, 2024
2d08dad
Update docusaurus.config.js
vanshika-srivastava Sep 26, 2024
13884a1
Add Bee node quickstart guides (#724)
NoahMaizels Sep 30, 2024
f117dcf
Merge main into dev (#727)
vanshika-srivastava Oct 1, 2024
bd734a8
Delete docs/node/Node Tools/eth-swarm.md
vanshika-srivastava Oct 1, 2024
87c3371
added swarm dappnode package setup and install guide (#730)
rampall Oct 2, 2024
dff1b40
Merge branch 'main' into dev
vanshika-srivastava Oct 2, 2024
7db492a
re-purposed validator tools
skundu42 Oct 2, 2024
5a896a3
fix broken page
skundu42 Oct 2, 2024
23df6d3
Add files via upload
0xarmagan Oct 4, 2024
de05daf
Update 10-03-core-devs-call.md
0xarmagan Oct 4, 2024
778c624
Update 10-03-core-devs-call.md
0xarmagan Oct 4, 2024
bb18ecb
Updated communication.md with new newsletter link
vanshika-srivastava Oct 7, 2024
54c8d31
Add files via upload
0xarmagan Oct 9, 2024
78901a7
Update 10-09-core-devs-call.md
0xarmagan Oct 9, 2024
a91bdca
fix: correctly render jwt generation instruction from partials import…
sorXCode Oct 14, 2024
e377032
feat(bridges): update governance proposal for AMB implementation upgrade
zengzengzenghuy Oct 15, 2024
2fbd3dd
Add files via upload
0xarmagan Oct 23, 2024
755ddc3
Update 10-23-core-devs-call.md
0xarmagan Oct 23, 2024
212e152
Updated erigon links
skundu42 Nov 7, 2024
2792756
Add files via upload
0xarmagan Nov 21, 2024
232d0a8
Update 11-20-core-devs-call.md
0xarmagan Nov 21, 2024
4076a63
doc: space id web3 name sdk (#740)
minghuipei Nov 28, 2024
f4f8767
Add files via upload
0xarmagan Nov 28, 2024
601ca91
Update 11-27-core-devs-call.md
0xarmagan Nov 28, 2024
9ba3f89
Revise and fix Nethermind links (#743)
rubo Dec 13, 2024
d804fcc
Docs Update: Creating a "User Onboarding" section and adding Reown (#…
rohit-710 Dec 13, 2024
3845a06
12-11-core-devs-call.md
0xarmagan Dec 13, 2024
698c072
feat(bridges): update governance proposal
zengzengzenghuy Dec 16, 2024
6831f46
Merge branch 'main' into dev
zengzengzenghuy Dec 18, 2024
0e49a01
Fix 12-11-core-devs-call.md
vanshika-srivastava Dec 19, 2024
601d190
Merge branch 'main' into dev
skundu42 Dec 20, 2024
a88ae09
Update 12-11-core-devs-call.md
vanshika-srivastava Dec 23, 2024
24bb9cc
Instructions for running geth (#747)
gballet Jan 8, 2025
2e06970
fixed broken link on node page
skundu42 Jan 9, 2025
bed9a02
Update geth.md
skundu42 Jan 9, 2025
59838cf
Add files via upload
0xarmagan Jan 9, 2025
61a4e37
Update 12-18-core-devs-call.md
0xarmagan Jan 9, 2025
94d8f3e
Merge branch 'main' into dev
skundu42 Jan 10, 2025
e3f5c43
Create 01-08-core-devs-call.md
0xarmagan Jan 15, 2025
f3db081
Add files via upload
0xarmagan Jan 15, 2025
ce5e4fc
Update 01-15-core-devs-call.md
0xarmagan Jan 15, 2025
0c7ba6e
Update 01-15-core-devs-call.md
0xarmagan Jan 30, 2025
26dc174
Create 01-22-core-devs-call.md
0xarmagan Jan 30, 2025
dc7a9e9
Create 01-29-core-devs-call.md
0xarmagan Jan 30, 2025
3085ba3
bridge: update bridge governor decisions
zengzengzenghuy Feb 3, 2025
e5d7373
Create 02-05-core-devs-call.md
0xarmagan Feb 7, 2025
49c405d
Merge branch 'main' into dev
skundu42 Feb 7, 2025
7c56a8d
fix typos (#752)
rex4539 Feb 10, 2025
b0cd631
add tenderly to blockchain explorers and faucets (#754)
nvitorovic Feb 21, 2025
259a6f0
added third-party bridges page
skundu42 Feb 22, 2025
9438fbb
bumped docusaurus version
skundu42 Feb 22, 2025
9a6a800
Update 404 link `node/README.md` (#755)
dsarfed Feb 22, 2025
37d6ba3
removed old bridges links
skundu42 Feb 24, 2025
b87a6ae
Create 02-12-core-devs-call.md
0xarmagan Feb 25, 2025
33986ff
Create 02-19-core-devs-call.md
0xarmagan Feb 25, 2025
659dfce
minor changes on brdige documentation
skundu42 Feb 26, 2025
8e8e59d
docs: fix grammar issue in merge description (#757)
lipperhey Feb 26, 2025
34b95a0
resolve build error
skundu42 Feb 26, 2025
de627a1
Merge branch 'main' into dev
skundu42 Feb 27, 2025
7757612
docs: fixed typos and style inconsistencies in doc (#759)
hexcow Feb 27, 2025
28f182a
bridges: add decomission of transfer notice in xDAI bridge
zengzengzenghuy Mar 12, 2025
4f66ff4
Create 02-26-core-devs-call.md
0xarmagan Mar 20, 2025
df811e3
Create 03-05-core-devs-call.md
0xarmagan Mar 20, 2025
332f7cb
Create 03-12-core-devs-call.md
0xarmagan Mar 20, 2025
b5f181a
Create 03-19-core-devs-call.md
0xarmagan Mar 20, 2025
297a350
docs: Fix minor phrasing issues (#762)
onasilos Mar 20, 2025
b76298d
docs: fix typo in doc about BSC - Gnosis Chain bridge (#760)
hexcow Mar 20, 2025
b24d374
fix github workflows
skundu42 Mar 20, 2025
bcebdda
Create 03-26-core-devs-call.md
0xarmagan Apr 2, 2025
e9fa65c
Update 03-26-core-devs-call.md
0xarmagan Apr 2, 2025
2c76416
Update README.md
0xarmagan Apr 9, 2025
47a86b9
added llms.txt generation
skundu42 Apr 9, 2025
86b3ba1
bridges: add xDAI bridge Hashi upgrade in governance decision
zengzengzenghuy Apr 15, 2025
8a1039f
bridges: notify bridge UI downtime for xDAI bridge and add guide for …
zengzengzenghuy Apr 15, 2025
b8ca5da
bridges: remove xDAIBridge warning for bridge UI blockage
zengzengzenghuy Apr 17, 2025
a634b50
Merge branch 'main' into dev
zengzengzenghuy Apr 17, 2025
d3d59d6
bridge: fix previous commit issue
zengzengzenghuy Apr 17, 2025
f52745d
Merge branch 'main' into dev
zengzengzenghuy Apr 17, 2025
e70552b
added dapp stack
skundu42 Apr 24, 2025
015ea27
Update docusaurus.config.js
vanshika-srivastava Apr 24, 2025
f27be64
bridge: update content and remove Goerli-Chiado addresses
zengzengzenghuy Apr 25, 2025
73a62c7
Create pectra.md
vanshika-srivastava Apr 30, 2025
0eac466
Update docusaurus.config.js
vanshika-srivastava Apr 30, 2025
fcf0e0c
Update pectra.md
vanshika-srivastava Apr 30, 2025
df148b5
Update pectra.md
vanshika-srivastava Apr 30, 2025
a8f50b6
Update pectra.md modifications
vanshika-srivastava Apr 30, 2025
639e49f
Merge branch 'main' into dev
vanshika-srivastava Apr 30, 2025
e90aaa6
add reth docs
skundu42 May 1, 2025
c523fec
bridge: add governance decision for deposit contract proxy upgrade
zengzengzenghuy May 2, 2025
2324ea2
bridge: update docs
zengzengzenghuy May 5, 2025
e0c6c40
bridges: add xdaibridge usds migration info
zengzengzenghuy May 7, 2025
13427ab
Merge branch 'main' into dev
zengzengzenghuy May 7, 2025
cb21fc9
Updated reth.md
vanshika-srivastava May 7, 2025
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
35 changes: 23 additions & 12 deletions docs/bridges/About Token Bridges/amb-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ Due to the light client finality requirements (at least 23mins on Ethereum), the

### Terminology

- **Home (Native) Network**: Of the two networks being bridged between, the home or native network is the one with fast and inexpensive operations. All bridge operations to collect validator confirmations are performed on this side of the bridge. It is the Gnosis Chain in this case.
- **Foreign Network**: Can be any EVM chain, generally it refers to Ethereum.
- **Originating Contract**: An arbitrary contract where the message originates, typically this is where the user interacts and requests for a function to be invoked on another network.
- **Home (Native) Network**: Gnosis Chain.
- **Foreign Network**: Ethereum.
- **Originating Contract**: An arbitrary contract where the message originates, typically this is where the user interacts and requests for a function to be invoked on another network. For example, Omnibridge is the originating contract that use AMB contract as data messaging layer.

### Call a cross-chain method via AMB:

Expand All @@ -100,21 +100,32 @@ function requireToPassMessage (address _contract,

![](/img/bridges/diagrams/amb-bridge-contract-flow.png)

#### Foreign Network to Home Network
#### Ethereum to Gnosis Chain

1. User calls `foo()` on the originating contract
2. Originating contract calls [`requireToPassMessage()`](https://etherscan.io/address/0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e#writeProxyContract#F10) on Foreign Bridge contract, and encodes `foo()`, target address, and gas limit used on the other chain for executing a message.
3. `UserRequestForAffirmation` event is emitted, and listening validators relay the message to the Home side where signatures are collected
4. [`executeAffirmation()`](https://gnosisscan.io/address/0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59#writeProxyContract#F15) is called on the Home Bridge contract by a validator once enough signatures are collected.
5. Home bridge contract decodes the message and calls `foo()` on the target contract.
2. Originating contract calls [`requireToPassMessage()`](https://etherscan.io/address/0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e#writeProxyContract#F10) on [Foreign AMB contract](https://etherscan.io/address/0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e#writeProxyContract), and encodes `foo()`, target address, and gas limit used on the other chain for executing a message.
3. `UserRequestForAffirmation(bytes32 indexed messageId, bytes encodedData)` event is emitted from [Foreign AMB contract](https://etherscan.io/address/0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e#writeProxyContract), and listening bridge validators relay the message to the Home side where signatures are collected by calling Home AMB `executeAffirmation(bytes message)`, where `message` parameter is the `encodedData` from `UserRequestForAffirmation` event. Hashi acts as an additional bridge valdiator who validates transactions but no actually calling `executeAffirmation` on Home AMB. For more details about how Hashi works in this case, check out [here](./hashi-integration.md)
4. Once enough signatures has been collected by bridge valdiators, the transaction will emit `CollectedSignatures (address authorityResponsibleForRelay, bytes32 messageHash, uint256 NumberOfCollectedSignatures)` and calls `foo()` on the target contract.

#### Home Network to Foreign Network
#### Gnosis Chain to Ethereum

1. User calls `foo()` on an originating contract
2. Originating contract calls [`requireToPassMessage()`](https://gnosisscan.io/address/0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59#writeProxyContract#F14) on Home Bridge contract, and encodes `foo()`, target address, and gas limit used on the other chain for executing a message.
3. Signatures are collected from validators by calling [`submitSignatures()`](https://gnosisscan.io/address/0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59#writeProxyContract#F5), and once enough are collected `CollectedSignatures()` event is emitted.
4. Message is relayed to the Foreign Bridge contract, and [`executeSignatures()`](https://etherscan.io/address/0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e#writeProxyContract#F3) is called
5. Foreign bridge contract decodes the message and calls `foo()` on target contract
3. Signatures are collected from validators by calling [`submitSignatures()`](https://gnosisscan.io/address/0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59#writeProxyContract#F5), and once enough are collected `CollectedSignatures()` event is emitted. Hashi acts as an additional bridge valdiator who validates transactions but no actually calling `executeAffirmation` on Home AMB. For more details about how Hashi works in this case, check out [here](./hashi-integration.md)
4. Anyone can execute the call by calling [`executeSignatures(bytes message, bytes signatures)`](https://etherscan.io/address/0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e#writeProxyContract#F3) on Foreign AMB. To fetch the calldata for `executeSignatures` function, please follow the [guideline below](#how-to-call-executesignatures-on-foreign-amb-ethereum).
5. Foreign AMB contract decodes the message and calls `foo()` on target contract


### How to call executeSignatures on Foreign AMB (Ethereum)

When the transaction is initiated from Home Network (Gnosis Chain), one has to claim the transaction on Ethereum explicitly. Here is how you can fetch the calldata required to call Foreign AMB to claim the transaction.

1. Find the originating transaction on Gnosis Chain that interact with the Home AMB, and look for `UserRequestForSignature(bytes32 indexed messageId, bytes encodedData)`. [Example](https://gnosisscan.io/tx/0x946d5a926b4e6c55b51eae53b6fea118d7d4fd5ebfa44d6256ef4ce7b4d927be#eventlog)
![](../../../static/img/bridges/amb-userrequestforsignature.png)
2. Go to [AMB Helper contract](https://gnosisscan.io/address/0x7d94ece17e81355326e3359115D4B02411825EdD#readContract) on Gnosis Chain, paste the `encodedData` from `UserReqeustForSignature` into `getSignatures(bytes _message)` (the message starts with 0x0005). Fetch the return value from `getSignatures`.
![](../../../static/img/bridges/amb-getsignatures.png)
3. On Foreign AMB, call `executeSigantures(bytes _data, bytes _signatures)`, where `_data` is the `encodedData` from `UserRequestForSignature` and `_signatures` is from the return value of `getSignatures` method. Please make sure that the caller account has enough ETH for the gas fee.


### How to check if AMB is down (not relaying message)

Expand Down
29 changes: 29 additions & 0 deletions docs/bridges/About Token Bridges/hashi-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,35 @@ For Omnibridge / AMB:
3. If Hashi is enabled & mandatory, off chain executor calls Ethereum’s Yaru.executeMessages(), which check if the hash is agreed upon adapters and set isApprovedByHashi(messageId) to true eventually.
4. User claims token by calling Ethereum’s ForeignxDAIBridge.executeSignatures(). DAI is transfer to the receiver eventually.

# Hashi Manager contract

Hashi Manager contract is the contract that controls the Hashi oracle and relevant information.

<Tabs>
<TabItem value="amb" label="AMB">

| Contract | Address |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Hashi Manager on Ethereum | [0x93f6eE78451AaCc1Db1db49a12aBfCc4662B9Cc9](https://etherscan.io/address/0x93f6eE78451AaCc1Db1db49a12aBfCc4662B9Cc9) |
| Hashi Manager on Gnosis Chain | [0x74CACae9801bA4Fe0027Ed6F58d53797CCa7296E](https://gnosisscan.io/address/0x74CACae9801bA4Fe0027Ed6F58d53797CCa7296E) |

</TabItem>

<TabItem value="xdai" label="xDai">

| Contract | Address |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Hashi Manager on Ethereum | [0x9acCFAD714A1e670CD1f6dc666FE892d1d5547BD ](https://etherscan.io/address/0x9acCFAD714A1e670CD1f6dc666FE892d1d5547BD) |
| Hashi Manager on Gnosis Chain | [0x60Aa15198a3AdfC86FF15B941549A6447B2dDB49](https://gnosisscan.io/address/0x60Aa15198a3AdfC86FF15B941549A6447B2dDB49) |

</TabItem>
</Tabs>

1. Set the oracle sets (reporter address from source chain, adapter address on target chain) for certain route (i.e. Ethereum -> Gnosis Chain, Gnosis Chain -> Ethereum).
2. Set the target address: the bridge contract on the target chain.
3. Set exepected adapter hash: the adapter address on the same chain.
4. Set Yaho, Yaru: For message relaying and executing logic. Check out how it works [here](https://crosschain-alliance.gitbook.io/hashi/getting-started/how-hashi-works)

## Reference

1. AMB contracts: https://github.com/crosschain-alliance/tokenbridge-contracts/tree/feat/hashi-integration-amb
Expand Down
37 changes: 23 additions & 14 deletions docs/bridges/About Token Bridges/omnibridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ Daily Limit is reset according to the following logic: the smart contract stores
</details>
```


### Terminology

- **Home (Native) Network**: Gnosis Chain.
- **Foreign Network**: Ethereum.
- **Mediator Contract**: Omnibridge contract, built on top of AMB.

### Bridge Validators

- See [Bridge Validator](../management/validators#amb--omnibridge)
Expand All @@ -143,18 +150,20 @@ Daily Limit is reset according to the following logic: the smart contract stores

## How it works

The Omnibridge is built on top of the [Arbitrary Message Bridge](./amb-bridge.md).

### Ethereum -> Gnosis

![](/img/bridges/diagrams/token-bridge-01.png)

1. User `approve` Omnibridge as token spender.
2. User call `relayTokens()` on Mediator contract.
3. Mediator calls `requireToPassMessage()` on the Bridge.
4. `UserRequestForAffirmation` event is emitted for validators to validate the message.
5. Message is relayed to the mediator contract when consensus is met by calling `executeAffirmation()`.
6. ABM calls mediator on Gnosis chain:
- token does not exist: the mediator deploys a new token registry and mints the relayed amount.
- token exists: the relayed amount is minted in the token address.
2. User call `relayTokens()` on [Foreign Omnibridge contract](https://etherscan.io/address/0x88ad09518695c6c3712AC10a214bE5109a655671#writeProxyContract).
3. Omnibridge contract calls Foreign AMB `requireToPassMessage()`.
4. `UserRequestForAffirmation` event is emitted from Foreign AMB and `TokensBridgingInitiated(address indexed token, address indexed sender, uint256 value, bytes32 indexed messageId)` event is emitted from Foreign Omnibridge.
5. Message is relayed to the Omnibridge contract when bridge validator threshold is met by calling [Home AMB](https://gnosisscan.io/address/0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59#writeProxyContract)`executeAffirmation()` on Gnosis Chain.
6. AMB calls [Omnibridge on Gnosis chain](https://gnosisscan.io/address/0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d#writeProxyContract):
- token does not exist: the Omnibridge deploys a new token registry and mints the relayed amount.
- token exists: the relayed Omnibridge is minted in the token address.

---

Expand All @@ -164,15 +173,15 @@ Daily Limit is reset according to the following logic: the smart contract stores

1. User calls `transferAndCall` on ERC-677 token contract to send tokens to Omnibridge contract
2. `OnTokenTransfer` is called
3. Mediator contract burns tokens and calls bridge contract's `requireToPassMessage()` function.
3. Home Omnibridge contract burns tokens and calls bridge contract's `requireToPassMessage()` function.
4. `UseRequestForSignature` event is emitted for validators to validate the message.
5. Validators listen to the event: call `submitSignature` on Gnosis chain.
6. `CollectedSignatures` event is emitted when consensus is met.
7. User calls AMB (Ethereum side) `executeSignatures()`
8. ABM calls `handleBridgedTokens()` on Mediator.
9. Mediator contract unlocks the tokens

The Omnibridge is built on top of the [Arbitrary Message Bridge](./amb-bridge.md).
6. `CollectedSignatures` event is emitted when enough bridge validator's signature is collected.
7. User calls AMB `executeSignatures()` on Ethereum. To fetch the calldata for the function, please check [guideline here](./amb-bridge.md#how-to-call-executesignatures-on-foreign-amb-ethereum)
8. AMB calls `handleBridgedTokens()` on Foreign Omnibridge contract.
9. Foreign Omnibridge contract unlocks the tokens.


## Exceptions and Special Cases

Expand Down Expand Up @@ -231,7 +240,7 @@ A partial token list of inflationary tokens is included below:

Additional References:

- [GIP-31: Hardfork that removed `transferAfterCall` from Bridged Token methods](https://forum.gnosis.io/t/gip-31-should-gnosis-chain-perform-a-hardfork-to-upgrade-the-token-contract-vulnerable-to-the-reentrancy-attack/413) (also see [writeup](https://hackmd.io/@koal/SJiDiO0bc))
- [GIP-31: Hardfork that removed `transferAfterCall` from Bridged Token methods](https://forum.gnosis.io/t/gip-31-should-gnosis-chain-perform-a-hardfork-to-upgrade-the-token-contract-vulnerable-to-the-reentrancy-attack/4134) (also see [writeup](https://hackmd.io/@koal/SJiDiO0bc))

### Canonical Token Registries

Expand Down
157 changes: 157 additions & 0 deletions docs/bridges/About Token Bridges/usds-xdaibridge-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
title: xDai Bridge - USDS migration
sidebar_position: 5
description: Replacing DAI to USDS as collateral on Foreign xDAI bridge
keywords: [xdai bridge, bridge, dai, ethereum, gnosis bridge]
---

# USDS migration on xDai Bridge

:::danger

The bridge migration has not yet taken place.
Please prepare for the upcoming upgrade by switching the entry point contract from xDAI Foreign Bridge to Bridge Router contract.
:::

## 1. General Overview

- **What changed?**

- The [xDAI bridge on Ethereum](https://etherscan.io/address/0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016) no longer accepts DAI as collateral. It now uses [USDS](https://etherscan.io/address/0xdC035D45d973E3EC169d2276DDab16f1e407384F).
- On Gnosis Chain, users still receive xDAI as usual.

- **Why it matters?**

- Any application sending or claiming DAI must adapt to the new USDS flows.
- To send or claim tokens, you interact with the **BridgeRouter** contract, which directs transactions to the right bridge logic.

- **When will it happen?**
- **The exact date for the migration is to be determined** and will be anounced in our comms channel (X, Discord, Telegram, Gnosis Docs).
- Before the migration happen, third party applications are given **1 month**(June 8, 2025) to adapt to the changes by switching the entry point contract to Bridge Router.

---

## 2. Key Contracts & Addresses

| Contract | Chain | Address |
| ------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| **BridgeRouter (Proxy)** | Ethereum | [`0x9a873656c19Efecbfb4f9FAb5B7acdeAb466a0B0`](https://etherscan.io/address/0x9a873656c19Efecbfb4f9FAb5B7acdeAb466a0B0) |
| BridgeRouter Impl. | Ethereum | [`0x691c025Efa7ea1c87DF256F2Da9208E5345D40b1`](https://etherscan.io/address/0x691c025Efa7ea1c87DF256F2Da9208E5345D40b1) |

---

## 3. Technical Details

:::info
Please refer to [here](https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/USDSMigration.md) for details regarding the contracts, workflow pre & post migration.
:::

**How it works after the migration**

**Relay tokens**
![](../../../static/img/bridges/xdaibridge/bridge-router-relay-token.svg)

**Claim tokens**
![](../../../static/img/bridges/xdaibridge/bridge-router-claim-token.svg)

**Scenarios**

1. `BridgeRouter.relayTokens(address token, address recipient, uint256 amount)`
-> When token is DAI / USDS from Ethereum, receive xDAI on GC.
-> When token is other tokens from Ethereum, receive the bridged version token on GC.
2. `BridgeRouter.executeSignatures(bytes memory message, bytes memory signatures)`
-> claim DAI on Ethereum
3. `BridgeRouter.executeSignaturesUSDS(bytes memory message, bytes memory signatures)`
-> claim USDS on Ethereum
4. `BridgeRouter.safeExecuteSignaturesWithAutoGasLimit(bytes memory message, bytes memory signatures)`
-> claim token from Omnibridge
5. `xDAIForeignBridge.relayTokens(address recipient, uint256 amount)`
-> relay USDS from Ethereum, receive xDAI on GC
6. `xDAIForeignBridge.executeSignatures(bytes memory message, bytes memory signatures)`
-> claim DAI on Ethereum
7. `xDAIForeignBridge.executeSignaturesUSDS(bytes memory message, bytes memory signatures)`
-> claim USDS on Ethereum

### 3.1 How to Relay Tokens

1. **Approve** the BridgeRouter to spend your token:

```solidity
// if sending DAI or USDS:
IERC20(token).approve(BridgeRouterAddress, amount);
```

2. **Call** `relayTokens` on BridgeRouter:

```solidity
BridgeRouter.relayTokens(
address token, // address of DAI or USDS
address recipient, // who receives xDAI on Gnosis Chain
uint256 amount // how much to send
);
```

- **What happens inside?**

- If `token` is DAI: it's converted to USDS, then locked in xDAI Foreign Bridge cotntracts.
- If `token` is USDS: it's locked in xDAI Foreign Bridge cotntracts directly.
- If `token` is any other ERC20 or ETH: it goes through Omnibridge as before.

---

### 3.2 How to Claim Tokens

Once your tokens have been initiated from Gnosis Chain, you can claim them back on Ethereum:

- **Claim DAI:**

```solidity
BridgeRouter.executeSignatures(message, signatures);
```

- Always returns DAI.

- **Claim USDS (new):**

```solidity
BridgeRouter.executeSignaturesUSDS(message, signatures);
```

- Only works after the upgrade; [reverts](https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/contracts/upgradeable_contracts/erc20_to_native/BridgeRouter.sol#L105) before.

- **Other tokens:**

```solidity
BridgeRouter.safeExecuteSignaturesWithAutoGasLimit(message, signatures);
```

- Same process as before via Omnibridge.

- To fetch the `message` and `signatures` parameters, please check the guide for xDai Bridge [here](./xdai-bridge.md#how-to-claim-dai-on-ethereum), for AMB/Omnibridge [here](./amb-bridge.md#how-to-call-executesignatures-on-foreign-amb-ethereum).

---

## 4. Next Steps

- **Update your code**:

- Replace direct xDAI Foreign bridge calls with **BridgeRouter** methods (`relayTokens`, `executeSignatures`, `executeSignaturesUSDS`).

- **Monitor migration**:

- Ensure you use `executeSignaturesUSDS` only once the upgrade is live.

### 4.1 How to test with post migration environment

To simulate the actual mainnet environment, we use Tenderly Virtual TestNets for both Ethereum and Gnosis Chain. Third-party applications are encouraged to use the following RPC endpoints to simulate the post-migration environment.

Switch your RPC:

| Chain | Description | URL |
| ------------ | ----------- | --------------------------------------------------------------------------------------------- |
| Ethereum | RPC | https://virtual.mainnet.rpc.tenderly.co/f7d3ce08-c1ea-42da-87f1-4a40f335dda9 |
| Ethereum | Explorer | https://dashboard.tenderly.co/explorer/vnet/f7d3ce08-c1ea-42da-87f1-4a40f335dda9/transactions |
| Gnosis Chain | RPC | https://virtual.gnosis.rpc.tenderly.co/c9ef8faf-bac8-40d0-8530-ded119b8012a |
| Gnosis Chain | Explorer | https://dashboard.tenderly.co/explorer/vnet/c9ef8faf-bac8-40d0-8530-ded119b8012a/transactions |

If you run into any issues or have any questions, please reach out to our comms channel: [Telegram](https://t.me/gnosischain), [X](https://x.com/gnosischain), [Discord](https://discord.com/invite/gnosis) for assistance.
Loading
Loading
0