SCD <> MCD Migration
The Maker Protocol Upgrade Contract
The Migration contract's purpose is to allow moving SAI and CDPs from the SCD system to the MCD system, thus becoming DAI and Vaults. It also allows users to move SAI/DAI in both directions should they want to exit MCD and go back to SCD.
swapSaiToDai- Takes Sai (ERC-20 DAI from Single Collateral System) returns DAI (ERC-20 DAI from MultiCollateral System).
swapDaiToSai- Takes DAI (ERC-20 DAI from MultiCollateral System) returns Sai (ERC-20 DAI from Single Collateral System)
migrate- Moves a Vault from SCD to MCD by closing the SCD one and opening a corresponding MCD one.
tub: SCD Tub contract address
vat: MCD Vat Contract address
cdpManager: MCD CDP manager
saiJoin: SAI collateral adapter for MCD
wethJoin: WETH collateral adapter for MCD
daiJoin: DAI join adapter for MCD
Overall this contract has two primary purposes:
- 1.Two-way exchange for SAI and DAI
- 2.One-way transfer of Vaults
Users of the current DAI system will want to move to the new MCD system. This function allows DAI holders to seamlessly convert their DAI. They will need to
approvethe migration contract on the SAI ERC-20 contract so that it can perform the
transferFrom. The migration contract holds a Vault in MCD that takes SAI as collateral and allows it to exit MCD-DAI, which it does and returns to the
In case a user wants to go back to SAI, this function allows them to turn in their DAI in exchange for SAI. This requires the user
approves the migration contract on the DAI ERC-20 contract so that it can
jointhe DAI back into MCD. This pays back the "debt" in its SAI-MCD Vault and allows it to retrieve the SAI "collateral" and return it to the
This function is meant to be used in combination with the
MigrationProxyActionsas it requires the migration contract owns the SCD-Vault (
cup) already and that the migration contract has enough MKR to pay the stability fees. The
msg.senderto the migration contract so that the migration contract has enough MKR to pay the stability fee and close the
The migration contract first draws its own SAI out of its MCD contract and uses that to pay back the debt for the
cup(along with the MKR it has from the proxy action to pay the fee). Then it withdraws the PETH as WETH.
Next the migration contract opens a Vault using the MCD CDP manager and
joins its WETH into its new Vault and withdraws enough DAI from the new Vault (and pays back its Vault) to compensate for the SAI it drew earlier in this step.
Lastly, the migration contract gives the MCD-Vault to the
- Any special/unique information about the specific contract
- Anything that it may rely on, especially if it is not obvious
- Sources of user error if not explicitly defined
wadamount has to be below the debt ceiling for both the overall MCD system and the SAI collateral type, otherwise the
frobwill fail. This means that these governance parameters can impact the speed of the transition from SAI to DAI.
wadamount has to be below the amount of SAI collateral in the migration contract's Vault. If a user with DAI wants to move to SAI but no SAI users have already moved to DAI, then this will fail.
Because the migration contract will have to first draw SAI from its MCD collateral, the system will have to be seeded with SAI in the migration contract's Vault in an amount that exceeds the SAI debt for the
If a user holds both a
cupand SAI, they should decide whether it makes sense to:
- 1.Pay back the
cupin SCD, then
cupto MCD (essentially just transfer the collateral to a new MCD Vault).
cupwith the debt in place, then use
swapSaiToDaito get DAI which they can then use as an ERC-20 or payback their MCD debt.
One additional consideration, to close or migrate a
cup, a user will have to purchase MKR in order to pay the stability fee and be able to
exitthe SCD system. However, once in MCD, new fees will be accrued (and have to be paid) in DAI. If a user's converted SAI does not cover their MCD debt + stability fee, they may have to purchase DAI on the open market.
Before SCD shutdown: Users who took out a Vault in SCD and then used the DAI to purchase something will either have to buy SAI on the open market to pay back their SCD debt or they will have to migrate their collateral to MCD.
- Potential for error: Governance parameters around SAI collateral
- Collateralization ratio has to be set to a very low number
Jug.basehave to be set to
0during the migration period
- Auth errors on Sai Join
- Excess Sai in MCD (i.e. more
cups are lost/not migrated than lost/not migrated Sai): results in an auction and possibly MKR auction to cover bad debt.
- Sai debt ceiling to 0
- MCD.ilks[sai] debt ceiling to SCD.totalDai
- DSR value competitive with Compound to encourage migration