INonCustodialPSM
Volt Protocol
Fei Peg Stability Module
The Fei PSM is a contract which pulls reserve assets from PCV Deposits in order to exchange FEI at $1 of underlying assets with a fee. mint()
- buy FEI for $1 of underlying tokens redeem()
- sell FEI back for $1 of the same The contract is a OracleRef - to determine price of underlying, and RateLimitedReplenishable - to stop infinite mints and related DOS issues Inspired by MakerDAO PSM, code written without reference
Methods
MAX_FEE
function MAX_FEE() external view returns (uint256)
the max mint and redeem fee in basis points
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
getMaxMintAmountOut
function getMaxMintAmountOut() external view returns (uint256)
the maximum mint amount out
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
getMintAmountOut
function getMintAmountOut(uint256 amountIn) external view returns (uint256 amountFeiOut)
calculate the amount of FEI out for a given amountIn
of underlying
Parameters
Name | Type | Description |
---|---|---|
amountIn | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
amountFeiOut | uint256 | undefined |
getRedeemAmountOut
function getRedeemAmountOut(uint256 amountFeiIn) external view returns (uint256 amountOut)
calculate the amount of underlying out for a given amountFeiIn
of FEI
Parameters
Name | Type | Description |
---|---|---|
amountFeiIn | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
amountOut | uint256 | undefined |
mint
function mint(address to, uint256 amountIn, uint256 minAmountOut) external nonpayable returns (uint256 amountFeiOut)
mint amountFeiOut
FEI to address to
for amountIn
underlying tokens
see getMintAmountOut() to pre-calculate amount out
Parameters
Name | Type | Description |
---|---|---|
to | address | undefined |
amountIn | uint256 | undefined |
minAmountOut | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
amountFeiOut | uint256 | undefined |
mintFeeBasisPoints
function mintFeeBasisPoints() external view returns (uint256)
the mint fee vs oracle price in basis point terms
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
pcvDeposit
function pcvDeposit() external view returns (contract IPCVDeposit)
the PCV deposit target to deposit and withdraw from
Returns
Name | Type | Description |
---|---|---|
_0 | contract IPCVDeposit | undefined |
rateLimitedMinter
function rateLimitedMinter() external view returns (contract IGlobalRateLimitedMinter)
Rate Limited Minter contract that will be called when FEI needs to be minted
Returns
Name | Type | Description |
---|---|---|
_0 | contract IGlobalRateLimitedMinter | undefined |
redeem
function redeem(address to, uint256 amountFeiIn, uint256 minAmountOut) external nonpayable returns (uint256 amountOut)
redeem amountFeiIn
FEI for amountOut
underlying tokens and send to address to
see getRedeemAmountOut() to pre-calculate amount out
Parameters
Name | Type | Description |
---|---|---|
to | address | undefined |
amountFeiIn | uint256 | undefined |
minAmountOut | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
amountOut | uint256 | undefined |
redeemFeeBasisPoints
function redeemFeeBasisPoints() external view returns (uint256)
the redemption fee vs oracle price in basis point terms
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
setGlobalRateLimitedMinter
function setGlobalRateLimitedMinter(contract IGlobalRateLimitedMinter newMinter) external nonpayable
set the target to call for FEI minting
Parameters
Name | Type | Description |
---|---|---|
newMinter | contract IGlobalRateLimitedMinter | undefined |
setMintFee
function setMintFee(uint256 newMintFeeBasisPoints) external nonpayable
set the mint fee vs oracle price in basis point terms
Parameters
Name | Type | Description |
---|---|---|
newMintFeeBasisPoints | uint256 | undefined |
setPCVDeposit
function setPCVDeposit(contract IPCVDeposit newTarget) external nonpayable
set the target for sending surplus reserves
Parameters
Name | Type | Description |
---|---|---|
newTarget | contract IPCVDeposit | undefined |
setRedeemFee
function setRedeemFee(uint256 newRedeemFeeBasisPoints) external nonpayable
set the redemption fee vs oracle price in basis point terms
Parameters
Name | Type | Description |
---|---|---|
newRedeemFeeBasisPoints | uint256 | undefined |
underlyingToken
function underlyingToken() external view returns (contract IERC20)
the underlying token exchanged for FEI
Returns
Name | Type | Description |
---|---|---|
_0 | contract IERC20 | undefined |
withdrawERC20
function withdrawERC20(address token, address to, uint256 amount) external nonpayable
withdraw ERC20 from the contract
Parameters
Name | Type | Description |
---|---|---|
token | address | undefined |
to | address | undefined |
amount | uint256 | undefined |
Events
GlobalRateLimitedMinterUpdate
event GlobalRateLimitedMinterUpdate(contract IGlobalRateLimitedMinter oldMinter, contract IGlobalRateLimitedMinter newMinter)
event emitted when global rate limited minter is updated
Parameters
Name | Type | Description |
---|---|---|
oldMinter | contract IGlobalRateLimitedMinter | undefined |
newMinter | contract IGlobalRateLimitedMinter | undefined |
MaxFeeUpdate
event MaxFeeUpdate(uint256 oldMaxFee, uint256 newMaxFee)
event emitted when a new max fee is set
Parameters
Name | Type | Description |
---|---|---|
oldMaxFee | uint256 | undefined |
newMaxFee | uint256 | undefined |
Mint
event Mint(address to, uint256 amountIn, uint256 amountFeiOut)
event emitted when fei gets minted
Parameters
Name | Type | Description |
---|---|---|
to | address | undefined |
amountIn | uint256 | undefined |
amountFeiOut | uint256 | undefined |
MintFeeUpdate
event MintFeeUpdate(uint256 oldMintFee, uint256 newMintFee)
event emitted when a new mint fee is set
Parameters
Name | Type | Description |
---|---|---|
oldMintFee | uint256 | undefined |
newMintFee | uint256 | undefined |
MintingPaused
event MintingPaused(address account)
event that is emitted when minting is paused
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
MintingUnpaused
event MintingUnpaused(address account)
event that is emitted when minting is unpaused
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
PCVDepositUpdate
event PCVDepositUpdate(contract IPCVDeposit oldTarget, contract IPCVDeposit newTarget)
event emitted when surplus target is updated
Parameters
Name | Type | Description |
---|---|---|
oldTarget | contract IPCVDeposit | undefined |
newTarget | contract IPCVDeposit | undefined |
Redeem
event Redeem(address to, uint256 amountFeiIn, uint256 amountAssetOut)
event emitted upon a redemption
Parameters
Name | Type | Description |
---|---|---|
to | address | undefined |
amountFeiIn | uint256 | undefined |
amountAssetOut | uint256 | undefined |
RedeemFeeUpdate
event RedeemFeeUpdate(uint256 oldRedeemFee, uint256 newRedeemFee)
event emitted when a new redeem fee is set
Parameters
Name | Type | Description |
---|---|---|
oldRedeemFee | uint256 | undefined |
newRedeemFee | uint256 | undefined |
RedemptionsPaused
event RedemptionsPaused(address account)
event that is emitted when redemptions are paused
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
RedemptionsUnpaused
event RedemptionsUnpaused(address account)
event that is emitted when redemptions are unpaused
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
ReservesThresholdUpdate
event ReservesThresholdUpdate(uint256 oldReservesThreshold, uint256 newReservesThreshold)
event emitted when reservesThreshold is updated
Parameters
Name | Type | Description |
---|---|---|
oldReservesThreshold | uint256 | undefined |
newReservesThreshold | uint256 | undefined |
WithdrawERC20
event WithdrawERC20(address indexed _caller, address indexed _token, address indexed _to, uint256 _amount)
event emitted when ERC20 tokens get withdrawn
Parameters
Name | Type | Description |
---|---|---|
_caller indexed | address | undefined |
_token indexed | address | undefined |
_to indexed | address | undefined |
_amount | uint256 | undefined |