Skip to content

Conversation

zengzengzenghuy
Copy link

@zengzengzenghuy zengzengzenghuy commented Feb 13, 2025

What

Background: https://forum.gnosis.io/t/gip-118-should-sdai-be-replaced-by-susds-in-the-bridge/9354

How

  1. New Router contract(BridgeRouter.sol) to route relayTokens function and claim token executeSignatures(to receive DAI) / executeSignaturesUSDS(to receive USDS) to xDAI bridge, safeExecuteSignaturesWithAutoGasLimit to AMB/Omnibridge.
    1. Router contract is controlled by bridge governors and upgradeable
    2. Routes:
      1. DAI → XDaiBridgePeripheral
      2. USDS → XDaiBridge
      3. ETH →WETHOmnibridgeRouter
      4. Other tokens → Omnibridge
  2. xDAI Foreign bridge only accepts deposit from USDS token.
    1. Changing the address of daiToken() to USDS and sDaiToken() to sUSDS.
    2. calling XDaiForeignBridge's executeSignatures and BridgeRouter's executeSignatures will always receive DAI
    3. calling XDaiForeignBridge's executeSignaturesUSDS and BridgeRouter's executeSignaturesUSDS will receive USDS post upgrade, while BridgeRouter's executeSignaturesUSDS will revert pre upgrade.
    4. XDaiForeignBridge's swapSDAIToUSDS() is a one time function that is called during the upgrade and changes the collateral from DAI to USDS.

New contracts

  1. BridgeRouter: https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/contracts/upgradeable_contracts/erc20_to_native/BridgeRouter.sol , Upgradeable with TransparentUpgradeableProxy https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/contracts/upgradeability/TransparentUpgradeableProxy.sol
  2. XDaiBridgePeripheral: https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/contracts/upgradeable_contracts/erc20_to_native/XDaiBridgePeripheral.sol
  3. XDaiBridgePeripheralForDaiPreUsdsUpgrade: https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/contracts/upgradeable_contracts/erc20_to_native/XDaiBridgePeripheralForDaiPreUsdsUpgrade.sol
  4. XDaiBridgePeripheralForUsdsPreUsdsUpgrade: https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/contracts/upgradeable_contracts/erc20_to_native/XDaiBridgePeripheralForUsdsPreUsdsUpgrade.sol

Modified contracts

  1. XDaiForeignBridge: https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/contracts/upgradeable_contracts/erc20_to_native/XDaiForeignBridge.sol
  2. SavingsDaiConnector: https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/contracts/upgradeable_contracts/erc20_to_native/SavingsDaiConnector.sol

Fork Test

https://github.com/gnosischain/tokenbridge-contracts/blob/feat/xdai-usds-migration/test/foundry/forkTest.sh

Bridge validator test (Check if bridge validator continues to work after bridge migration & xDAI can be still be minted on Gnosis Chain)

https://github.com/gnosischain/xdai-bridge-test

Reference

  1. How xDAI bridge works: https://docs.gnosischain.com/bridges/About%20Token%20Bridges/xdai-bridge

…d ForeignBridgeErcToNative.onExecuteMessage, add check on message length in Message.hashMessage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants