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 addressvat
: MCD Vat Contract addresscdpManager
: MCD CDP managersaiJoin
: SAI collateral adapter for MCDwethJoin
: WETH collateral adapter for MCDdaiJoin
: DAI join adapter for MCDconstructor
(setup)swapSaiToDai
approve
the 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 msg.sender
.swapDaiToSai
approve
s the migration contract on the DAI ERC-20 contract so that it can transferFrom
then join
the 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 msg.sender
.migrate
MigrationProxyActions
as 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 MigrationProxyActions
migrate
function transferFrom
s the msg.sender
to the migration contract so that the migration contract has enough MKR to pay the stability fee and close the cup
.cup
(along with the MKR it has from the proxy action to pay the fee). Then it withdraws the PETH as WETH.join
s 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.msg.sender
.swapSaiToDai
wad
amount has to be below the debt ceiling for both the overall MCD system and the SAI collateral type, otherwise the frob
will fail. This means that these governance parameters can impact the speed of the transition from SAI to DAI.swapDaiToSai
wad
amount 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.migrate
cup
being migrated.cup
and SAI, they should decide whether it makes sense to:cup
in SCD, then migrate
their cup
to MCD (essentially just transfer the collateral to a new MCD Vault).migrate
their cup
with the debt in place, then use swapSaiToDai
to get DAI which they can then use as an ERC-20 or payback their MCD debt.cup
, a user will have to purchase MKR in order to pay the stability fee and be able to exit
the 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.ilks["sai"].duty
and Jug.base
have to be set to 0
during the migration periodcup
s are lost/not migrated than lost/not migrated Sai): results in an auction and possibly MKR auction to cover bad debt.