LitePSM User Guide

Level: Beginner

Estimated Time: 15 minutes

Last Updated: 2024-09-08

Overview

MakerDAO has launched LitePSM, a lightweight version of the Peg Stability Module (PSM). PSMs stabilize the DAI stablecoin against its pegged value by enabling users to trade DAI with other stablecoins like USDC (referred to as "gems") at fixed exchange ratios and fees. LitePSM's primary goal is to minimize gas costs for users. To achieve this, MakerDAO and its keeper ecosystem will absorb some of the gas expenses for all swaps by performing background bookkeeping tasks. This reduction in total gas costs benefits users swapping between DAI and USDC using PSMs, whether directly or through DEX aggregators like CoWSwap, 1inch, or Uniswap.

Learning objectives

  • Using the LitePSM

  • Migrate your integration from PSM to LitePSM

Pre-requisites

Familiarity with DAI and USDC ERC20 tokens.

Guide

LitePSM Deployments

Ethereum Mainnet

PSM Roadmap

The roadmap of the Peg Stability Module (PSM) involves several key phases and deployments as MakerDAO progresses towards Endgame launch. Here's an overview of the planned changes:

Phase 1: DAI LitePSM-USDC Launch and current DAI PSM-USDC Migration

LitePSM-USDC will be launched in three phases, and the current PSM-USDC will be wound down according to this timeline. The exact dates and durations of each phase will be announced shortly.

LitePSM Phase 1a: DAI LitePSM-USDC Launch [COMPLETE]

Efforts are being made to ensure at least 20 million USDC liquidity is available in LitePSM-USDC during Phase 1a, but actual liquidity after the LitePSM-USDC launch will depend on usage.

LitePSM Phase 1b: DAI LitePSM-USDC Live [~ Aug 22] In Phase 1b, about 200 million USDC liquidity will migrate from DAI PSM-USDC to DAI LitePSM-USDC.

LitePSM Phase 1c: DAI PSM-USDC Shutdown [~ Sep 19] DAI PSM-USDC will be entirely shut down in Phase 1c, with all remaining liquidity migrating from DAI PSM-USDC to DAI LitePSM-USDC.

Phase 2: USDS LitePSM-USDC Wrapper Launch and Migration

During the MakerDAO Endgame Phase 1B launch (not to be confused with LitePSM Phase 1B launch), MakerDAO will introduce USDS and SKY tokens and deploy a new version of the LitePSM called the USDS LitePSMWrapper-USDC. This new version will allow both USDS token holders and DAI token holders to swap their stablecoins to and from USDC using a single LitePSMWrapper-USDC contract. Liquidity from the DAI LitePSM-USDC will remain in place and will not be migrated. The USDS LitePSMWrapper-USDC contract will convert between DAI and USDS before forwarding the swap transaction to the DAI LitePSM-USDC contract to perform the actual swap between DAI and USDC.

  • USDS LitePSM-USDC is currently deployed and will be activated shortly.

Phase 3: USDS LitePSM-USDC Launch and Migration

In this phase, MakerDAO will deploy a new version of USDS LitePSM-USDC exclusively for USDS token holders to reduce the gas costs of USDS to USDC swaps on the USDS LitePSM-USDC contract. Some liquidity will migrate from DAI LitePSM-USDC version to a newly launched USDS LitePSM-USDC setup exclusively for the USDS token. Both DAI LitePSM-USDC and USDS LitePSM-USDC versions will operate simultaneously and their liquidity will be balanced by ecosystem actors based demand for either token from the ecosystem.

Usage

Public

All users will have access to the following functions:

  • sellGem : Sell USDC and receive DAI

  • buyGem : Buy USDC with DAI

sellGem function accepts two inputs:

  • usr: Address of the DAI recipient

  • gemAmt: Amount of USDC being sold

The gemAmt is denominated in 6 decimals because "Gem" refers to USDC in a USDS LitePSM-USDC deployment, which uses 6 decimals instead of the more common 18 decimals. After a successful swap, this amount of USDC is transferred from msg.sender to the LitePSM-USDC. The function returns a value denominated in 18 decimals, representing the DAI amount the user receives. The usr address then receives the DAI ERC20 balance from the LitePSM-USDC.

buyGem function accepts two inputs:

  • usr: Address of the USDC recipient

  • gemAmt: Amount of USDC being bought

The gemAmt is denominated in 6 decimals because "Gem" refers to USDC in a USDS LitePSM-USDC deployment, which uses 6 decimals instead of the more common 18 decimals. After a successful swap, this amount of USDC is transferred to the usr address. The function returns a value denominated in 18 decimals, representing the DAI amount that msg.sender transfers from their address to the LitePSM-USDC. The usr address then receives the USDC balance from the LitePSM-USDC.

Authorized Users

Authorized users have access to two additional functions: sellGemNoFee and buyGemNoFee, which allow them to execute swaps without paying additional PSM fees. Authorized users will still need to pay the gas fees for their transactions. Governance must add an authorized user to an access list on the LitePSM-USDC to allow them access to these additional functions.

sellGemNoFee and buyGemNoFee accept the same inputs and return the same values as sellGem and buyGem, respectively.

Maximum Swap Size

All users, both public and authorized, can only swap up to the DAI and USDC balances held by LitePSM-USDC. DAI balance is held by LitePSM-USDC in its own contract address. USDC balance is held in a separate Pocket contract whose address can be read from litepsm.pocket(). Please note that other LitePSM-USDC swap transactions included in a block could affect the available DAI and USDC amounts.

The USDC balance held by LitePSM-USDC is determined by external usage and periodic liquidity management by MakerDAO ecosystem actors.

The DAI balance held by LitePSM-USDC is determined by internal protocol bookkeeping activities. The maximum DAI balance held by LitePSM-USDC at any time is dictated by the buf value set by MakerDAO governance. MakerDAO keepers periodically execute a set of public functions: fill, trim, and chug to keep the DAI balance of the LitePSM-USDC in line with the buf parameter. These functions are not restricted, and any address can execute them.

The Maximum Swap Size limit restricts a single sellGem transaction. As integrators, you can handle swaps beyond this limit by constructing an atomic batch of transactions. This batch can interleave any number of psm.sellGem() transactions to swap up to the currently available DAI balance with psm.fill() transactions to refill the DAI balance in the LitePSM. This approach allows you to complete a large USDC to DAI swap transaction atomically for your users.

Fees

Public

The tin fee is assessed on all sellGem transactions, and the tout fee is assessed on all buyGem transactions. Both tin and tout values are set by MakerDAO governance.

Governance can set either tin or tout to the value of type(uint256).max, halting sellGem and buyGem transactions respectively on the LitePSM. Transactions would be halted for both public and authorized users.

Fees are represented as fixed decimal-point numbers with 18 decimals. Fee values will always be equal to or less than a WAD, which is (10^{18}). Some examples are:

  • A tin value of 1, represented as a WAD, would assess a 100% fee on a sellGem transaction. This should never happen in practice.

  • A tin value of 0.01, represented as WAD/100, would assess a fee of 1% (100 basis points) on a sellGem transaction.

  • A tout value of 0.001, represented as WAD/10000, would assess a fee of 0.01% (1 basis point) on a buyGem transaction.

Authorized Users

Authorized users are not assessed the tin and tout fees when they execute the sellGemNoFee and buyGemNoFee functions. However, they will be assessed fees like public users when they execute the regular sellGem and buyGem functions instead of the NoFee variants.

Authorized users can check their authorization status with the bud() function.

The bud function accepts the address of the authorized user. It returns a value of 1 when the address is authorized to execute both sellGemNoFee and buyGemNoFee, and a value of 0 when the address is not authorized to execute these functions.

Gas Costs

Transaction Type
Gas Limit
USD Cost*

BuyGem (DAI to USDC) Current PSM

145,030

-

BuyGem (DAI to USDC ) LitePSM - Public User

78,867

-

BuyGem (DAI to USDC ) LitePSM - Authorized User

-

-

SellGem (USDC to DAI) Current PSM

284,620

-

SellGem (USDC to DAI) LitePSM - Public User

93,742

-

SellGem (USDC to DAI) LitePSM - Authorized User

-

-

Uniswap Trade

-

-

ERC20 Transfer

-

-

* Assumes ETH-USD @ 3500 USD and 10 gwei.

Authorized Users

Please reach out to the Integrations team to discuss your use case and inquire about becoming an authorized user.

Stats

Please refer to makerburn.com for current LitePSM-USDC stats after launch.

Summary

Troubleshooting

Potential Issues

  • Swaps will fail if the LitePSM has zero DAI balance.

  • Swaps will fail if other transactions have consumed the DAI balance of the LitePSM in the same block before your transaction.

  • LitePSM offers no slippage protection, and fees could change within the same block if a pending governance action goes live in a transaction before yours.

Refill Dai Buffer

Steps to refill the DAI Balance of LitePSM-USDC:

  1. Call the rush function to check whether the DAI balance of LitePSM-USDC can be increased.

  2. If rush returns a value greater than zero, you can execute fill to increase the DAI balance of LitePSM-USDC up to the limit set by the buf parameter.

LitePSM Halt Status

  • You can check whether sellGem and sellGemNoFee are halted by verifying if the tin value is set to uint.max.

  • You can check whether buyGem and buyGemNoFee are halted by verifying if the tout value is set to uint.max.

Next steps

N/A

Resources

Last updated