Implementation of minting and burning of xDAI through the xDAI bridge
In general, the reader is invited to peruse the corresponding Gnosis docs.
We quote therefrom the minting pipeline:
- Users initiate the relay transaction on Ethereum by approving the bridge contract and calling the bridge contract
relayTokens(address recipient, uint256 value)
. - A
UserRequestForAffirmation(address recipient, uint256 value, bytes32 nonce)
event is emitted from the bridge contract. - Bridge validators observe the event and call
executeAffirmation(address recipient, uint256 value, bytes32 nonce)
function on Home xDAI bridge contract on Gnosis Chain. - When enough confirmations are collected (4/7 majority), the bridge contract on Gnosis Chain calls the block reward contract to record the receiver(s) and amount(s) of xDAI to mint. Hashi acts as an additional bridge valdiator who validates transactions but no actually calling executeAffirmation on Home xDAI Bridge. For more details about how Hashi works in this case, check out here.
- The block reward contract is called by the consensus engine to update user's xDAI balance.
AddedReceiver(uint256 amount, address indexed receiver, address indexed bridge)
event is emitted within the same transaction and receiver address will be credited for the equivalent xDAI amount.
NOTE
In the future (exact time yet unknown), there will occur a migration from a bridge accepting DAI as collateral to a bridge accepting USDS as collateral. Accordingly, this will have the effect of transforming xDAI into a representation of USDS. For details see the migration docs.