PSM
Contract for swapping stable token for VAI token and vice versa to maintain the peg stability between them.
enum FeeDirection {
IN,
OUT
}
The divisor used to convert fees to basis points.
uint256 BASIS_POINTS_DIVISOR
The mantissa value representing 1 (used for calculations).
uint256 MANTISSA_ONE
The value representing one dollar in the stable token.
uint256 ONE_DOLLAR
VAI token contract.
contract IVAI VAI
The address of the stable token contract.
address STABLE_TOKEN_ADDRESS
The address of ResilientOracle contract wrapped in its interface.
contract ResilientOracleInterface oracle
The address of the Venus Treasury contract.
address venusTreasury
The incoming stableCoin fee. (Fee for swapStableForVAI).
uint256 feeIn
The outgoing stableCoin fee. (Fee for swapVAIForStable).
uint256 feeOut
The maximum amount of VAI that can be minted through this contract.
uint256 vaiMintCap
The total amount of VAI minted through this contract.
uint256 vaiMinted
A flag indicating whether the contract is currently paused or not.
bool isPaused
Initializes the contract via Proxy Contract with the required parameters.
function initialize(address accessControlManager_, address venusTreasury_, address oracleAddress_, uint256 feeIn_, uint256 feeOut_, uint256 vaiMintCap_) external
Parameters
Name | Type | Description |
---|---|---|
accessControlManager_ | address | The address of the AccessControlManager contract. |
venusTreasury_ | address | The address where fees will be sent. |
oracleAddress_ | address | The address of the ResilientOracle contract. |
feeIn_ | uint256 | The percentage of fees to be applied to a stablecoin -> VAI swap. |
feeOut_ | uint256 | The percentage of fees to be applied to a VAI -> stablecoin swap. |
vaiMintCap_ | uint256 | The cap for the total amount of VAI that can be minted. |
Swaps VAI for a stable token.
function swapVAIForStable(address receiver, uint256 stableTknAmount) external returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
receiver | address | The address where the stablecoin will be sent. |
stableTknAmount | uint256 | The amount of stable tokens to receive. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount of VAI received and burnt from the sender. |
Swaps stable tokens for VAI with fees.
function swapStableForVAI(address receiver, uint256 stableTknAmount) external returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
receiver | address | The address that will receive the VAI tokens. |
stableTknAmount | uint256 | The amount of stable tokens to be swapped. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Amount of VAI minted to the sender. |
Pause the PSM contract.
function pause() external
Resume the PSM contract.
function resume() external
Set the fee percentage for incoming swaps.
function setFeeIn(uint256 feeIn_) external
Parameters
Name | Type | Description |
---|---|---|
feeIn_ | uint256 | The new fee percentage for incoming swaps. |
Set the fee percentage for outgoing swaps.
function setFeeOut(uint256 feeOut_) external
Parameters
Name | Type | Description |
---|---|---|
feeOut_ | uint256 | The new fee percentage for outgoing swaps. |
Set the address of the Venus Treasury contract.
function setVenusTreasury(address venusTreasury_) external
Parameters
Name | Type | Description |
---|---|---|
venusTreasury_ | address | The new address of the Venus Treasury contract. |
Set the address of the ResilientOracle contract.
function setOracle(address oracleAddress_) external
Parameters
Name | Type | Description |
---|---|---|
oracleAddress_ | address | The new address of the ResilientOracle contract. |
Calculates the amount of VAI that would be burnt from the user.
function previewSwapVAIForStable(uint256 stableTknAmount) external view returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
stableTknAmount | uint256 | The amount of stable tokens to be received after the swap. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount of VAI that would be taken from the user. |
Calculates the amount of VAI that would be sent to the receiver.
function previewSwapStableForVAI(uint256 stableTknAmount) external view returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
stableTknAmount | uint256 | The amount of stable tokens provided for the swap. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount of VAI that would be sent to the receiver. |
Last modified 1mo ago