|
| 1 | +--- |
| 2 | +title: xDai Bridge - USDS migration |
| 3 | +sidebar_position: 5 |
| 4 | +description: Replacing DAI to USDS as collateral on Foreign xDAI bridge |
| 5 | +keywords: [xdai bridge, bridge, dai, ethereum, gnosis bridge] |
| 6 | +--- |
| 7 | + |
| 8 | +# USDS migration on xDai Bridge |
| 9 | + |
| 10 | +:::danger |
| 11 | + |
| 12 | +The bridge migration has not yet taken place. |
| 13 | +Please prepare for the upcoming upgrade by switching the entry point contract from xDAI Foreign Bridge to Bridge Router contract. |
| 14 | +::: |
| 15 | + |
| 16 | +## 1. General Overview |
| 17 | + |
| 18 | +- **What changed?** |
| 19 | + |
| 20 | + - 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). |
| 21 | + - On Gnosis Chain, users still receive xDAI as usual. |
| 22 | + |
| 23 | +- **Why it matters?** |
| 24 | + |
| 25 | + - Any application sending or claiming DAI must adapt to the new USDS flows. |
| 26 | + - To send or claim tokens, you interact with the **BridgeRouter** contract, which directs transactions to the right bridge logic. |
| 27 | + |
| 28 | +- **When will it happen?** |
| 29 | + - **The exact date for the migration is to be determined** and will be anounced in our comms channel (X, Discord, Telegram, Gnosis Docs). |
| 30 | + - 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. |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 2. Key Contracts & Addresses |
| 35 | + |
| 36 | +| Contract | Chain | Address | |
| 37 | +| ------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------- | |
| 38 | +| **BridgeRouter (Proxy)** | Ethereum | [`0x9a873656c19Efecbfb4f9FAb5B7acdeAb466a0B0`](https://etherscan.io/address/0x9a873656c19Efecbfb4f9FAb5B7acdeAb466a0B0) | |
| 39 | +| BridgeRouter Impl. | Ethereum | [`0x691c025Efa7ea1c87DF256F2Da9208E5345D40b1`](https://etherscan.io/address/0x691c025Efa7ea1c87DF256F2Da9208E5345D40b1) | |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## 3. Technical Details |
| 44 | + |
| 45 | +:::info |
| 46 | +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. |
| 47 | +::: |
| 48 | + |
| 49 | +**How it works after the migration** |
| 50 | + |
| 51 | +**Relay tokens** |
| 52 | + |
| 53 | + |
| 54 | +**Claim tokens** |
| 55 | + |
| 56 | + |
| 57 | +**Scenarios** |
| 58 | + |
| 59 | +1. `BridgeRouter.relayTokens(address token, address recipient, uint256 amount)` |
| 60 | + -> When token is DAI / USDS from Ethereum, receive xDAI on GC. |
| 61 | + -> When token is other tokens from Ethereum, receive the bridged version token on GC. |
| 62 | +2. `BridgeRouter.executeSignatures(bytes memory message, bytes memory signatures)` |
| 63 | + -> claim DAI on Ethereum |
| 64 | +3. `BridgeRouter.executeSignaturesUSDS(bytes memory message, bytes memory signatures)` |
| 65 | + -> claim USDS on Ethereum |
| 66 | +4. `BridgeRouter.safeExecuteSignaturesWithAutoGasLimit(bytes memory message, bytes memory signatures)` |
| 67 | + -> claim token from Omnibridge |
| 68 | +5. `xDAIForeignBridge.relayTokens(address recipient, uint256 amount)` |
| 69 | + -> relay USDS from Ethereum, receive xDAI on GC |
| 70 | +6. `xDAIForeignBridge.executeSignatures(bytes memory message, bytes memory signatures)` |
| 71 | + -> claim DAI on Ethereum |
| 72 | +7. `xDAIForeignBridge.executeSignaturesUSDS(bytes memory message, bytes memory signatures)` |
| 73 | + -> claim USDS on Ethereum |
| 74 | + |
| 75 | +### 3.1 How to Relay Tokens |
| 76 | + |
| 77 | +1. **Approve** the BridgeRouter to spend your token: |
| 78 | + |
| 79 | + ```solidity |
| 80 | + // if sending DAI or USDS: |
| 81 | + IERC20(token).approve(BridgeRouterAddress, amount); |
| 82 | + ``` |
| 83 | + |
| 84 | +2. **Call** `relayTokens` on BridgeRouter: |
| 85 | + |
| 86 | + ```solidity |
| 87 | + BridgeRouter.relayTokens( |
| 88 | + address token, // address of DAI or USDS |
| 89 | + address recipient, // who receives xDAI on Gnosis Chain |
| 90 | + uint256 amount // how much to send |
| 91 | + ); |
| 92 | + ``` |
| 93 | + |
| 94 | +- **What happens inside?** |
| 95 | + |
| 96 | + - If `token` is DAI: it's converted to USDS, then locked in xDAI Foreign Bridge cotntracts. |
| 97 | + - If `token` is USDS: it's locked in xDAI Foreign Bridge cotntracts directly. |
| 98 | + - If `token` is any other ERC20 or ETH: it goes through Omnibridge as before. |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +### 3.2 How to Claim Tokens |
| 103 | + |
| 104 | +Once your tokens have been initiated from Gnosis Chain, you can claim them back on Ethereum: |
| 105 | + |
| 106 | +- **Claim DAI:** |
| 107 | + |
| 108 | + ```solidity |
| 109 | + BridgeRouter.executeSignatures(message, signatures); |
| 110 | + ``` |
| 111 | + |
| 112 | + - Always returns DAI. |
| 113 | + |
| 114 | +- **Claim USDS (new):** |
| 115 | + |
| 116 | + ```solidity |
| 117 | + BridgeRouter.executeSignaturesUSDS(message, signatures); |
| 118 | + ``` |
| 119 | + |
| 120 | + - 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. |
| 121 | + |
| 122 | +- **Other tokens:** |
| 123 | + |
| 124 | + ```solidity |
| 125 | + BridgeRouter.safeExecuteSignaturesWithAutoGasLimit(message, signatures); |
| 126 | + ``` |
| 127 | + |
| 128 | + - Same process as before via Omnibridge. |
| 129 | + |
| 130 | +- 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). |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +## 4. Next Steps |
| 135 | + |
| 136 | +- **Update your code**: |
| 137 | + |
| 138 | + - Replace direct xDAI Foreign bridge calls with **BridgeRouter** methods (`relayTokens`, `executeSignatures`, `executeSignaturesUSDS`). |
| 139 | + |
| 140 | +- **Monitor migration**: |
| 141 | + |
| 142 | + - Ensure you use `executeSignaturesUSDS` only once the upgrade is live. |
| 143 | + |
| 144 | +### 4.1 How to test with post migration environment |
| 145 | + |
| 146 | +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. |
| 147 | + |
| 148 | +Switch your RPC: |
| 149 | + |
| 150 | +| Chain | Description | URL | |
| 151 | +| ------------ | ----------- | --------------------------------------------------------------------------------------------- | |
| 152 | +| Ethereum | RPC | https://virtual.mainnet.rpc.tenderly.co/f7d3ce08-c1ea-42da-87f1-4a40f335dda9 | |
| 153 | +| Ethereum | Explorer | https://dashboard.tenderly.co/explorer/vnet/f7d3ce08-c1ea-42da-87f1-4a40f335dda9/transactions | |
| 154 | +| Gnosis Chain | RPC | https://virtual.gnosis.rpc.tenderly.co/c9ef8faf-bac8-40d0-8530-ded119b8012a | |
| 155 | +| Gnosis Chain | Explorer | https://dashboard.tenderly.co/explorer/vnet/c9ef8faf-bac8-40d0-8530-ded119b8012a/transactions | |
| 156 | + |
| 157 | +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. |
0 commit comments