Peg Stability Module
Overview
The Peg Stability Module (PSM) is a crucial component of the Venus Protocol designed to maintain the value of the VAI stablecoin at $1. It functions similarly to the system provided by MakerDAO for DAI. The PSM contract utilizes two stablecoins: VAI (the target stablecoin) and USDT (used to help maintain the peg).
Features
Convert Functionality:
Users can exchange VAI and USDT with a "fixed" conversion rate of 1 VAI = $1.
Users can send VAI to the PSM and receive USDT if enough USDT is available in the PSM.
Users can send USDT to the PSM and receive VAI, provided that the PSM hasn't reached its maximum allowed minted VAI limit.
No Stability Fee
The VAI minted through the PSM does not accrue any interest or stability fee.
Configurable Parameters:
The PSM contract has three configurable variables set via the Venus Improvement Proposal (VIP):
feeIn
: Fee charged when users send USDT to the PSM.feeOut
: Fee charged when users send VAI to the PSM.maxMintedVAI
: The maximum amount of VAI that the PSM can distribute. Conversions that exceed this limit will be reverted.
Fees Sent to Treasury: The collected fees are sent to the Venus Treasury contract in each operation.
Integration with Oracle Price: The PSM considers the USD value of the stablecoin to peg VAI to its value accurately.
Convert Functions
Function swapStableForVAI
swapStableForVAI
This function allows users to exchange the paired stablecoin (USDT) for VAI.
Expected Parameters:
receiver
: Address of the user who will receive the VAI.amount
: The amount of stablecoin (USDT) the sender wants to convert.
The received stablecoins will be held by the PSM, and the fee specified by feeIn
will be sent to the Treasury contract.
This function returns the amount of VAI transferred to the receiver.
Function swapVAIForStable
swapVAIForStable
This function enables users to exchange VAI for the paired stablecoin (USDT).
Expected Parameters:
receiver
: Address of the user who will receive the stablecoin.amount
: The expected amount of stablecoin (USDT) the user should receive.
The received VAI will be burnt, and the fee specified by feeOut
will be sent to the Treasury contract.
This function returns the amount of VAI transferred from the sender (burnt + fee).
Preview Functions
The PSM also offers preview functions that help users estimate the outcome of convert operations:
previewSwapVAIForStable(uint256 stableTknAmount)
previewSwapVAIForStable(uint256 stableTknAmount)
Returns the amount of VAI that the sender would transfer (burnt + fee) to receive the specified stablecoin amount.
previewSwapStableForVAI(uint256 stableTknAmount)
previewSwapStableForVAI(uint256 stableTknAmount)
Returns the amount of VAI that the receiver would receive after executing the swapVAIForStable
function with the specified stablecoin amount.
Integration of the Oracle Price
To protect the value of VAI and consider the USD value of the paired stablecoin, the PSM integrates with the Resilient Oracle. The following rules are applied:
swapVAIForStable (the user sends VAI and receives USDT)
If the oracle price of the paired stablecoin is below $1, the conversion rate is 1 stablecoin = $1.
If the oracle price of the paired stablecoin is above $1, the conversion rate is 1 stablecoin = oracle price.
swapStableForVAI (the user sends USDT and receives VAI)
If the oracle price of the paired stablecoin is below $1, the conversion rate is 1 stablecoin = oracle price.
If the oracle price of the paired stablecoin is above $1, the conversion rate is 1 stablecoin = $1.
This documentation is designed to be user-friendly and does not cover the technical implementation details of the Peg Stability Module. For technical information, developers and smart contract auditors can refer to the smart contract code.
Last updated