Home

Awesome

DAI Teleport

DAI Teleport facility allows users to fast teleport DAI between "domains", i.e. different chains that have a settlement mechanism with Ethereum L1.

If DAI is teleported from L2 -> L1, this is equivalent to "fast withdrawal". First, DAI will be burned on L2, then minted on L1 and sent to the user as soon as the L2 transaction is confirmed. After a while, during a settlement process, DAI will be released from L1 Bridge escrow (to have DAI on L2 in the first place, it had to be put on L1 escrow some time before) and burned.

If DAI is teleported from L2 -> L2, it will be burned on the source domain and it will be minted on the destination domain, while the settlement process on L1 will eventually move DAI from source domain bridge escrow to destination domain bridge escrow.

Security

Smart contracts stored in this repository are part of the bug bounty. To disclose any vulnerabilities, please refer to the bug bounty page. (Note: /src/relays/TrustedRelay.sol is currently excluded as that was a proof of concept.)

Domains, Gateways and Teleport Router

On L1 each Domain must be associated with a Gateway, that is a contract that supports requestMint() and settle() operations. For any L2 Domain, Gateway is a bridge from L1 -> L2, whereas for the L1 Domain, Gateway is the TeleportJoin adapter contract.

Teleport Router keeps track of each Domain's Gateway and routes requestMint() or settle() requests to the appropriate contracts.

Domains

Roles

DAI Teleport L2 → L1 (aka fast withdrawals)

FastWithdrawal

Governance controlled parameters:

Normal (fast) path

To fast withdraw DAI from L2, user:

Settlement

Settlement process moves DAI from L1 Bridge to TeleportJoin to clear the debt that accumulates there. It is triggered by keepers.

Slow (emergency) path

If attestations cannot be obtained (Oracles down or censoring), user needs to wait so that L2 message is confirmed on L1 (on Optimistic Rollups that is typically 7 days, on zkRollups it can be anything between few hours to a day). Once L2->L1 message can be relayed, user:

DAI Teleport L2→L2

Teleport

Normal (fast) path

Teleporting DAI to another L2 domain is very similar, the only difference is that DAI is minted on a target Domain rather than on L1. For this scheme to work, the MakerDAO MCD sytem needs to be deployed on a target domain.

Settlement

Settlement process is very similar, however DAI is transfered from the source domain bridge on L1 to the target domain bridge on L1 rather than moved from the source domain to L1 MCD to pay the debt. This DAI, now in target domain bridge on L1 will be backing DAI that is minted on L2 target domain.

Slow (emergency) path

For a slow path, once the L2->L1 message from the source domain is received on L1 and can be relayed, the user can relay the message, which will call requestMint() on the target domain L1Bridge. This will pass an L1->L2 message to L2bridge which will call requestMint() on a TeleportJoin contract on target domain L2.

Technical Documentation

Each Teleport is described with the following struct:

struct TeleportGUID {
	bytes32 sourceDomain;
	bytes32 targetDomain;
	bytes32 receiver;
	bytes32 operator;
	uint128 amount;
	uint80 nonce;
	uint48 timestamp;
}

Source domain implementation must ensure that keccack(TeleportGUID) is unique for each teleport transfer. We use bytes32 for addresses to support non-EVM compliant domains.

Contracts

TeleportRouter

TeleportOracleAuth

TeleportJoin

TeleportFees

Authorization

Example

Setup: Debt ceiling: 10M DAI

OperationAvailable Debt
User A inititates teleport for 2M10M
User A mints 2M on L1 with Oracle's attestations8M (10M-2M)
User B initiates teleport for 9 M8M
Keeper flushes 2M (from UserA) and 9M (from UserB)8M
User C initiates teleport for 5M8M
User C mints 5M on L1 with Oracle's attestations3M (8M - 5M)
After 7 days keepers calls finializeFlush() that burns 11M14M (3M + 11M)
User D inititates teleport for 10M14M
User D mints 10M on L1 with Oracle's attestations4M (14M - 10M)
User B wants to withdraw from teleport Ilk 9m using slow withdrawal path. They can withdraw only 4M0M (4M - 4M)
Keeper flushes 15M (from UserC and UserD)0M
After 7 days keepers calls finializeFlush() that burns 15M15M (0M + 15M)
User B can withdraw the rest of the funds (5M)10M (15M - 5M)

Risks

Oracle censoring or oracle failure

If user is unable to obtain Oracle's attestations, slow path is taken - no user funds are at risk

Oracle malfunction (wrong attestations)

If user is able to obtain fraudulant attestation (i.e. attesting that DAI on L2 is burn and withdrawn whereas in reality is not), this will result in bad debt - DAI minted in a teleport will never be settled. This will result in bad debt that eventually will have to be healed through a standard MakerDAO debt healing processes.

Source domain compromised

Target domain compromised

Related repositories