Learn how to upgrade multi-mortgage Dai

The official release date of Maker Multi-Minute Dai (MCD) has been confirmed, and it will be officially launched on November 18.

According to Rune Christensen, CEO of the Maker Foundation, multi-mortgage Dai will bring many new features to the Maker agreement, including the long-awaited Dai Deposit Rate (DSR) and more collateral types.

( Note: In this guide, we refer to the single collateral Dai system as SCD, the multi-collateral Dai system as MCD, we refer to the single collateral Dai token (the old version of the existing Dai) as Sai, and new The multi-collateral Dai is called Dai .)

In order to take advantage of these improvements, users and partners interacting with single-backed Dai (SCD) must migrate their existing single-secured Dai tokens (Sai) into multi-collateral Dai tokens (Dai), CDP (debt-backed positions) It also needs to be migrated. In addition, companies or projects that integrate with Sai and CDP must update their code base to point to new smart contracts and refactor their code to support the updated functionality.

To ensure a smooth transition from single collateral Dai (SCD) to multi-mortgage Dai (MCD), Maker officially released an MCD upgrade guide that outlines the upgrade process for different participants in the Maker ecosystem.

Multi-Collateral Dai

The following is a summary of the guide:

learning target

  1. Learn how to migrate to a maximum mortgage Dai (MCD);
  2. Upgrade guides for different groups;
  3. Some technical details of Sai's upgrade to Dai ;

Before learning this guide, you need to understand the basics of MakerDAO, see the MCD 101 guide .

First, the operation of the migration App

After the official release of MCD, the migration application on migrate.makerdao.com allows you to complete the migration of Dai and CDP with a simple operation (number of inputs and then confirmation).


Panel for upgrading Sai to Dai


Panel for upgrading CDP

The migration application uses a proxy contract to perform a CDP upgrade. Therefore, the application can only be used for CDP created through a Maker proxy contract. This happens automatically if you set up CDP at cdp.makerdao.com.

If you use a CDP created by a third-party service and it does not use the Maker agent to interact with the CDP core, the migration contract may not work. You can perform the migration manually by turning off the SCD CDP and moving the ETH to the MCD CDP.

Second, the upgrade guide for different user groups

1. As the holder of Sai (old version)

Scenario 1: If you store Sai (old Dai) in a wallet and control the private key of the wallet , you can go to migrate.makerdao.com and follow the process below to upgrade your Sai to Dai. Selectively activate the Dai Deposit Rate Smart Contract, which allows you to earn interest.

The following figure outlines the upgrade process:


Scenario 2: If you are storing Sai on an exchange or a centralized managed wallet, or locked in a dApp smart contract , you can ask the service provider to help complete the upgrade, or extract the currency to your own control wallet, then go to migrate.makerdao .com completes the upgrade itself.

2. As the owner of an SCD CDP (Debt Mortgage Position)

After the MCD is released, you can upgrade the SCD CDP to the MCD CDP via the upgrade application on migrate.makerdao.com. The following figure shows the process of CDP upgrade:


You can also choose to manually close your CDP by repaying your debt and redeeming your Ethereum, and use your redemption collateral to open a new MCD CDP.

If your SCD CDP has a large position, there may not be enough Sai fluidity to perform the migration. In this case, you may need to contact integrate@makerdao.com for assistance.

Note on Instadapp: If you created CDP through the Instadapp service, you will need to go to the exit page and click on the "Withdraw" button of the "Debt Mortgage Position". This will provide you with CDP custody, and then you can perform a CDP migration on the migrate.makerdao.com page.

Note on MyEtherWallet: If you are creating a CDP on MyEtherWallet, you can migrate your CDP using the migration application on migrate.makerdao.com. However, if the private key used by MyTherWallet is stored in a local file or other unsupported format, you must first import the private key into a wallet that supports Web3.

3. As a centralized exchange or managed wallet

  1. Select a date to perform the upgrade and notify the user.
  2. Suspend Sai access during the upgrade;
  3. Upgrade all users' Sai to Dai using the migration application/contract (see more details in the Migrate Applications/Contracts section below.)
  4. Point the code base to the new Dai token contract address (announced when the MCD is released);
  5. Restore Dai deposits and withdrawals;
  6. Inform the user of the Dai savings deposit rate, which allows the Dai holder to earn interest;


This process will bring the following user experience to exchange/managed users:


4. As a decentralized exchange (DEX)

  1. Notify users of the timetable for upgrading the new Dai (MCD) as soon as possible;
  2. Add support for the new Dai token on the platform, and name the old Dai as Sai;
  3. When the user initiates a Sai or Dai transaction, the user is asked to confirm the type of token in which the transaction is being made;
  4. Notify users that they can use Dai to exchange Dai on migrate.makerdao.com;

Optional: A UI can be provided to facilitate the user to transfer the token and inform the user of the Dai deposit rate;

5, as an unmanaged wallet

  1. Notify users of the timetable for MCD upgrades as soon as possible;
  2. Support both Sai and Dai balance display;
  3. After the launch of MCD, the new Dai should be named Dai on your platform, and the single mortgage Dai (SCD) should be named Sai;
  4. Notify users that they can use Dai to exchange Dai on migrate.makerdao.com;

Optional: A UI can be provided to facilitate the user to transfer the token and inform the user of the Dai deposit rate;

6, as Keeper

  1. Use this guide to get an update on Keeper and auctions in MCD.
  2. Upgrade;
  3. The official hopes to release a python library for auctions before the release of MCD, which will be the recommended auction method.

Or, if you're willing to do some extra work and use the original interface, you can interact directly with the auction contract ( flip , flap , flop ). Please note that future collateral types may have a customized auction format. More documentation will be available before the MCD is released.

7. As a market maker

  1. After adding the multi-collateral Dai on the exchange, you can choose to support Sai (old Dai) while supporting the new Dai (multi-mortgage Dai);

8, as a CDP integration partner

  1. Select the date on which the upgrade will be performed and notify the user as soon as possible;
  2. Suspend user access to CDP services during upgrades;
  3. Start the upgrade and support the new CDP core service (if you use the CDP integration of Dai.js, please refer to "Using Dai.js" below to upgrade to MCD. If you are directly integrating with CDP smart contract, please see below "Direct integration through smart contracts" to upgrade);
  4. Restore user access to CDP services;

Option 1: Implement support for additional collateral types in MCD, if you are concerned with your service, please inform the user of the Dai deposit rate;

Option 2: Implement the UI for locking Dai in the Dai Deposit Rate Smart Contract. Integrate with Dai.js : If you are using the Dai.js library to integrate CDP, make sure you have updated the library to the latest version.

Update your codebase to support the functionality of the MCD plugin, which will be bundled into the Dai.js library as a default plugin when the MCD is released.

Integrate directly with smart contracts : If you are integrating directly through smart contracts, you must add support for the new Maker core smart contract. Since the smart contract has been completely rewritten, most of the function calls have changed.

  1. First you need to know MCD: https://github.com/makerdao/developerguides/blob/master/mcd/mcd-101/mcd-101.md
  2. Implement support for MCD smart contracts (see this guide for how to interact with the CDP Manager.)
  3. Point the codebase to the new MCD smart contract;

9. As a loan agreement

  1. Select the date on which the upgrade will be performed and notify the user of the date as soon as possible;
  2. Stop Sai's loan when the upgrade occurs, and open Dai's loan at the same time;
  3. For the outstanding loans in Sai, choose one of the following options (1, accept Sai to repay the loan, then convert Sai to Dai, 2, notify the user to no longer accept Sai, let them convert Sai by migrate.makerdao.com Become Dai and then repay)

10. As a Dapp operator

  1. Select the date on which the upgrade will be performed and notify the user of the date as soon as possible;
  2. Update the code base to support the new Dai token when the MCD is released;
  3. Notify users to migrate Sai to Dai via migrate.makerdao.com;

Third, the migration contract

The functionality of the migration application outlined in the previous section is handled by the migration contract, which will be deployed at the same time as the MCD is released to support a smooth transition from single mortgage Dai to multi-collateral Dai. This section will outline how the migration contract works to help superusers and partners prepare for MCD migration.

This migration smart contract is open source and you can find it here:


In the src folder, you can find the smart contract source code. The main contract is ScdMcdMigration.sol , which contains the migration functions that will interact with it.

It contains three main functions:

  1. swapSaiToDai : A function that upgrades Sai to Dai;
  2. swapDaiToSai : A function that allows you to exchange Dai back to Sai;
  3. Migrate : A function that allows you to migrate SCD CDPs to MCD CDPs;

Because the migration application provides these features directly, the average user does not have to deal directly with these function calls, but for those superusers or partners who want to perform the migration themselves, they need a deeper understanding of the migration process.

To upgrade the old Dai to MCD Dai, you must use the swapSaiToDai function in the migration contract.

From the user's perspective, this function simply upgrades the specified number of Sai to the new Dai.

The actual behind-the-scenes process is much more complicated. The following figure outlines what happens when 10 Sai are migrated to 10 Dai.


The migration contract also allows the user to switch the new version of Dai back to Sai by using the swapDaiToSai function. In this case, the CDP operation will be revoked.

However, this operation requires a surplus of Sai funds that have been deposited in the migration contract. Therefore, the contract must have at least one Sai deposit equal to the amount of Dai you want to redeem.

You can view this guide for details on how to call the swapDaiToSai function.

In addition, the migration contract also allows users to migrate their CDP from the SCD core to the MCD core, which is done through the migrate function. More information on migrating CDP function calls can be found here .


This guide describes the steps and some technical details of how to upgrade to a multi-mortgage Dai. If you want to know more details, you can check out the following information:

1. https://github.com/makerdao/developerguides/blob/master/mcd/mcd-cli/mcd-cli-guide-01/mcd-cli-guide-01.md

2, https://github.com/makerdao/developerguides/blob/master/mcd/mcd-seth/mcd-seth-01.md

3. https://github.com/makerdao/developerguides/blob/master/mcd/upgrading-to-multi-collateral-dai/cli-mcd-migration.md

4. https://github.com/makerdao/developerguides/blob/master/mcd/add-collateral-type-testnet/add-collateral-type-testnet.md