Making sDAI (from SparkDAO) multichain using UMA. Users can deposit DAI, USDC, ETH and get access to Maker's DAI savings rate via Spark on their host chains starting with Scroll.
This project enables users to access MakerDAO's DSR on Scroll by making sDAI (from SparkDAO) multichain using UMA's optimistic oracle. It also enables users on Mainnet to deposit into the sDAI vault using a token of their choice without being restricted to Dai only.
sDAI is an ERC-4626 vault on mainnet that gives access to the Dai savings rate. This vault only accepts Dai as a deposit and is only available on Mainnet.
Using UMA's Optimistic Oracle and external relayers, we can access the vault from any chain if necessary deployments have been made. In this case, I have deployed it to Scroll, but it could be deployed to any chain with minor modifications.
Moreover, only Dai can be deposited in the sDai vault, restricting users who don't have Dai from participating. I built a sort of Multicall contract that enables users to deposit USDC, WETH etc and receive sDai.
Cross-chain communication and relaying are enabled through UMA's optimistic oracle system. Relayers Fill and Assert users' deposits and withdrawals using DataAssertion contracts. A user takes less than a minute to get their deposit/withdrawal request fulfilled as relayers do most of the work, and dispute mechanisms handle fraud cases.
Here's what a deposit flow would look like:
Here's what a withdrawal flow would look like:
Lastly, on Mainnet, users can deposit any token into the vault as the middleware (MultiCall.sol) contract takes the deposit in any token, swaps it to Dai via Uniswap-v3 router and deposits Dai into the sDai vault and sends the sDai to the user in one transaction.
For a more detailed explanation, please take a look at the README.md and the tests (DepositFlow.t.sol and WithdrawalFlow.t.sol).