Announcing the Optimism Dai Bridge with Fast Withdrawals

TL;DR

  • The MakerDAO community will be launching an ‘official’ DAI on Optimism L2.
  • Optimism requires a 7 day lockup period when withdrawing tokens back to L1.
  • The Maker protocol can reduce this lockup period and allow near-instant withdrawals of DAI.
  • This solution can be expanded to cover other token withdrawals in combination with an AMM.
  • Initial bridge soon. Fast withdrawals Q3/Q4 2021.

The most anticipated L2 solution Optimism is fast approaching their mainnet launch which is expected later this month. While Optimism brings with it the promise of much needed gas relief, there remains an unsolved problem with optimistic rollups in general - withdrawal times. Optimism’s current design allows for transferring tokens from L1 → L2 near-instantly, but going in the reverse direction requires users to wait 1 week to allow for potential fraud proofs. This is a major roadblock to wider adoption if we want optimistic rollups to be a viable competitor to centralized alternatives.

The Maker protocol is uniquely positioned to provide a solution to this problem while preserving trustlessness and decentralization. Introducing the Optimism Dai Bridge with Fast Withdrawals - a bridge which will allow locking up L1 DAI to mint L2 oDAI as well as allowing oDAI to be burned in exchange for near-instant access to L1 DAI.

How does this work?

First a quick overview of how optimistic rollups work. Unlike side chains, all the data to reconstruct the Optimistic Virtual Machine (OVM) state is present on L1 at all times. There exists an unalterable transaction log called the Canonical Transaction Chain (CTC) which contains all of the individual transactions in a specific ordering. Anyone can look at this transaction log and reconstruct the OVM state. What this means is that although we have to wait 1 week to ensure that the result of the computation of the CTC is correct, we can have off-chain proof that the individual transaction is correct within a few minutes. Read more about Optimism.

The Maker protocol can take advantage of this by offering a token (fDAI) which represents a claim on the L1 DAI through a vault which allows locking up fDAI in exchange for newly minted regular DAI. fDAI is then validated by a Maker Oracle which can verify against the CTC. Upon finalization of the state, fDAI can be gracefully closed out and the vault loan repaid with interest. In effect we will have a stream of 1-week, very safe loans flowing out of Optimism and back into L1. This is a game changer not only for the Maker protocol, but the Ethereum ecosystem at large as we can finally offer a fast, trustless, decentralized off-ramp for optimistic rollups.

Maker as the Primary Optimism Off-Ramp

Maker has an opportunity to become the primary off-ramp for Optimism. The average user will not want to wait a week to get their assets into L1. The Optimism Dai Bridge can serve as the go-to service for exiting L2 in a timely manner. It would be unfortunate for Ethereum if we had to resort to a centralized provider to achieve this.

We believe Maker can solve this problem for three reasons:

  1. Liquidity - Maker has the ability to provide unlimited DAI liquidity.
  2. No Counterparties - Most other liquidity providers in DeFi require collateral lockup. This can result in high fees which is undesirable for users. With Maker there are no counterparties so the rate can be fixed.
  3. Trustless - Apart from the Oracles, there is no trust required to use this system.

General Token Swaps

Expanding on this service we will be able to offer fast L2 → L1 swaps on any token by routing the trade through the Optimism Dai Bridge. Trades would work by swapping the token for oDAI on L2, swapping the oDAI for L1 DAI and finally swapping back to the L1 token. This requires an AMM to be present on L2 (such as Uniswap V3), as well as integrating with an L1 AMM. AMMs may want to support this directly in their own UI as well.

Timeline

The project will be split into two deliverables:

Optimism Dai Bridge - Soon

This will allow transferring L1 DAI to L2 oDAI and back again with the regular 1 week wait on the L2 → L1 direction.

Fast Withdrawals - Q3/Q4 2021

Allow moving from oDAI to DAI with near-instant settlement. Please note this deliverable is dependent on establishing the safety of Optimism L2 first and foremost.

Next Steps

Due to the permissionless nature of Optimism, we will need to move fast to secure the initial Dai bridge. If the Maker community does not provide an official bridge then we risk another actor filling that role. The mandated actors will work to deploy the first version to coincide with the Optimism launch later this month. We will also be running a declaration of intent to confirm that governance wants to pursue building the fast withdrawal component.

65 Likes

Super cool! Thank you Sam!

It will be called oDAI, or fDAI? And fast withdrawals are still a bit away, eh? One week wait is not the end of the world.

Besides, Synthetix–do you know what other protocols are running on Optimism?

5 Likes

If I understand this correctly, fDAI will have a claim on DAI after the oracle okay’s it (after roughly 7 days). Is all fDAI the same? How does it keep fungibility? Can we mix T+3 day fDAI with some T+8 day fDAI and the system will know only to allow the T+8 day fDAI to be redeemed for DAI?

fDAI will likely have to be an NFT as you are correct the timestamp differentiates it. The oracle will okay the initial fDAI mint which says there exists a withdrawal for DAI from L2 → L1 that will be unlocked in 1 week.

2 Likes

Very exciting!

I’ve been working to build a single contract for bridging tokens onto Optimism, which will prevent fragmenting of tokens on L2 and provide a canonical source to look-up L2 tokens.

I’ve created the following PR, and the community has been very supportive of it so far. I’m hoping to get it reviewed by the Optimism team within the next week or two.

I’d love to work together to ensure that the Maker Optimism Bridge can integrate with the UniBridge & avoid further fragmentation :slightly_smiling_face:

8 Likes

Extremely exciting :slight_smile:

To clarify my understanding :

  • Those other actors would need to have mint power over some stablecoin or hold large amounts of liquidity, right?
  • If the fdai vault trusts the oracle I don’t see why there needs to be term-partitioned fdais?
  • (added question) an oracle compromise represents a risk for Maker, not for the user?

Edit : to add some details is the flow : “oracle credits address a with N fdai” → user swaps fdai for dai through fdai vault, and 1w later : “anyone can unlock the dai, send it to the the vault and close it”?

1 Like

Yes, Maker has unlimited liquidity via minting. Other will need to tie up capital which puts them at a disadvantage for fees.

This may the case. Nothing is set in stone yet.

1 Like

I was thinking this is how composability would be retained, Maker holds the fDAI and takes on the ‘risk’ and the user just gets freshly minted L1 DAI. I’m not sure if we are minting oDAI on Optimism, or if it’s all the same, and whether that would mess with the accounting :thinking:

I’m a little lost on why fDAI is required. Is it to avoid giving the oracles permission to mint L1 DAI?

1 Like

I also have some issues with the complexity of the design - most of the moving parts appear to serve no purpose. Instead of minting an NFT, then putting that into a vault, and then minting dai through the vault process (all super gas inefficient steps), you can just take the dai out of the deposit contract directly at the step where you would have minted the NFT.

Very good, our L2 progress is very good.

Looks like Sushi will also be on Optimistic. Perhaps Beating Uniswap to the punch

By minting DAI with the tokenised withdrawal claim as collateral rather than simply releasing DAI from the Deposit contract Maker protocol guarantees the solvency of the system in case of Oracles failure. Each user needs 100% guarantee that their withdrawal will be processed, otherwise the Deposit bridge to the Rollup won’t be secure and can result in double spend. It is possible to hook Oracle directly to the Deposit bridge, however that will make the system less flexible. User holding fDAI can open a Vault, but they may also simply swap that fDAI for DAI through any liquidity provider / arbitrageur

5 Likes

Maybe I haven’t fully understood the system correctly but if Oracle failure (i.e. incorrectly assuming a withdrawal on the canonical transaction chain is correct when in fact, it gets pruned later) is a possibility and you still give a user fDAI, won’t you end up with a vault of collateral that is worthless anyway?

Also, what exactly is a double spend in this context?

2 Likes

Let’s first define double spend. Alice has 1000 oDAI on Optimism. She first sends 1000 oDAI to Bob and later she attempts to withdraw 1000 oDAI. Canonical Chain on L1 will register two transactions (transfer() and initiateWithdrawal()). Clearly the second transaction will fail (revert). The fact that there is a initiateWithdraw() tx on the Canonical Chain by itself is clearly not enough evidence to release DAI from the deposit contract. So normally the bridge would wait for the Sequencer to post the L2 state, wait 7 days, and only then act accordingly (i.e. release DAI if and only if the execution of the initiateWithdrawal() actually succeeds)

Oracle can execute transactions from the Canonical Chain and see whether the initiateWithdraw() will succeed or revert. fDAI is a tokenised withdrawal claim that may be considered by Maker holders good collateral for DAI. It’s almost risk-free assuming no Oracle failure. If Oracle “lies”, collateral is worthless and DAI minted will be unbacked with the standard consequence for MKR holders

5 Likes

Thanks for clarifying.

Please correct me if I’m wrong but my understanding of Optimism is as follows. The canonical transaction chain is append-only. So the sequencer will add only one of the two double spending transactions if it is honest. If the sequencer is malicious, it may add both in some order, say initiateWithdrawal() followed by transfer(), but some verifier will prune the transfer() tx and initiateWithdrawal() remains valid and will succeed. On the other hand, if the order is transfer() followed by initiateWithdrawal(), the oracle should spot this. Either way, as soon as initiateWithdrawal() gets appended to the CTC, the oracle should know whether it is valid or not.

If the oracle works correctly, there is no risk. If the CTC has a malicious tx and the oracle fails to spot it, Maker loses money no matter how we design the system since the user has DAI (minted from the vault). So I’m still not sure why we don’t release DAI to the user in the first place.

2 Likes

Is there are mechanism in place to reward and punish oracles? And could you please talk through how you can prove that an oracle has acted poorly?

1 Like

No, that’s not how it works. The sequencer will add both txs in the chosen order. The first one will succeed, the second will fail. See https://twitter.com/bkiepuszewski/status/1369599091634749442?s=20 for details. Nobody “prunes” any transactions, they are canonical once they are submitted to L1. It’s the state (the result of their execution) that can be potentially fraudulent - honest Sequencer will submit the correct state, dishonest may submit wrong state.

1 Like

I’m seeing some questions about Oracle manipulation/failure–does this imply we will have a DC assign to this mechanism?

Also, with fDAI Vaults–if I understand it correctly–the Users will incur interest? Or, perhaps I misunderstood.

1 Like

Yes we will want a DC to protect against worst case scenarios such as fDAI gets minted ad-infinitum.

We will need some fee to pay for the service. This could take the form of an interest rate or maybe even just a fixed fee like the PSM.

6 Likes