# MakerDAO DSR (Dai Savings Rate) Module The DSR is a special module in the MakerDAO smart contract system that allows DAI holders to receive a share of the revenue earned by MakerDAO. This share was recently voted to be set to *1% APR* as per **this on-chain poll**. There are several ways to integrate with the DSR ## Using SavingsDAI (ERC4626 Vault) **SavingsDAI** is an ERC20-compliant token that conforms to the ERC4626 spec. You can deposit **DAI** in the DSR by calling its `mint` method and withdraw by calling the `burn` method. This contract requires a DAI approval to be set before minting sDAI, and an sDAI approval before burning it. SavingsDAI's address is [0x843801cef0fe346a2db6e13e7ba02f9f2a411d0d]( https://etherscan.io/address/0x843801cef0fe346a2db6e13e7ba02f9f2a411d0d) ## Using Chai (ERC20) **Chai** is a tradable ERC20 representation of DAI deposited in the DSR. To deposit **DAI** and get **Chai**, call its `join` method, specifying the receiving address and the amount of DAI to be deposited. To redeem **Chai** for **DAI**, call its `exit` method, specifying the chai holder's address and the amount of **Chai** to be burnt. Chai's address is [0x06AF07097C9Eeb7fD685c692751D5C66dB49c215](https://etherscan.io/token/0x06AF07097C9Eeb7fD685c692751D5C66dB49c215) ## Integrating directly with the DSR system To integrate with the DSR, you will need to interact with several Maker contracts. Here is a quick list of the addresses (on Mainnet) you need to be aware of: * DaiJoin @ `0x9759A6Ac90977b93B58547b4A71c78317f391A28` * Pot @ `0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7` * Vat @ `0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B` The **test deployment** can be found on the Goerli testnet with the following address set: * DaiJoin @ `0x6a60b7070befb2bfc964F646efDF70388320f4E0` * Pot @ `0x50672F0a14B40051B65958818a7AcA3D54Bd81Af` * Vat @ `0xB966002DDAa2Baf48369f5015329750019736031` Steps to follow to deposit DAI in the DSR: 1. Approve DaiJoin to spend the amount of DAI you want to deposit in the DSR by calling `DAI.approve(DaiJoin, <amount>)` 2. Deposit your DAI in the system by calling `DaiJoin.join(<your address>, <amount>)` 3. Calculate `chi` (the conversion factor from DAI to DSR shares) as the following 1. get the `rho` from the Pot by calling `Pot.rho()` 2. if `rho < timestamp(right now)`, `chi` is assigned to be `Pot.drip()` 3. else, `chi` is assigned to be `Pot.chi()` 4. Calculate the amount of DSR shares `shares` as `<DAI amount> / chi`, with 18 decimals of precision. 5. Assign your deposited DAI to the DSR by calling `Pot.join(shares)` To withdraw: 1. Retrieve your DSR share balance `shares` by calling `Pot.pie(<your address>)` 2. Calculate the amount of DAI you can retrieve from the Maker system as `amount = shares * chi` (with 18 decimals of precision) 1. *This result is the current DAI balance of the address, and can be shown to users.* 4. Call `Pot.exit(shares)` to assign the underlying DAI balance to your address. 5. Calculate `chi` (the conversion factor from DAI to DSR shares) as the following 1. get the `rho` from the Pot by calling `Pot.rho()` 2. if `rho < timestamp(right now)`, `chi` is assigned to be `Pot.drip()` 3. else, `chi` is assigned to be `Pot.chi()` 6. Call `DaiJoin.exit(<your address>, amount)` 7. ERC20 DAI tokens will be credited to your address.