Skip to main content

PriceBoundPSM

contract to create a price bound DAI PSM This contract will allow swaps when the price of DAI is between 98 cents and 1.02 by default These defaults are changeable by the admin and governance by calling floor and ceiling setters setOracleFloor and setOracleCeiling

Functions

constructor

function constructor(
uint256 _floor,
uint256 _ceiling,
struct PegStabilityModule.OracleParams _params,
uint256 _mintFeeBasisPoints,
uint256 _redeemFeeBasisPoints,
uint256 _reservesThreshold,
uint256 _feiLimitPerSecond,
uint256 _mintingBufferCap,
contract IERC20 _underlyingToken,
contract IPCVDeposit _surplusTarget
) public

constructor

Parameters

NameTypeDescription
_flooruint256minimum acceptable oracle price
_ceilinguint256maximum acceptable oracle price
_paramsstruct PegStabilityModule.OracleParamsPSM construction params
_mintFeeBasisPointsuint256
_redeemFeeBasisPointsuint256
_reservesThresholduint256
_feiLimitPerSeconduint256
_mintingBufferCapuint256
_underlyingTokencontract IERC20
_surplusTargetcontract IPCVDeposit

setOracleFloorBasisPoints

function setOracleFloorBasisPoints(
uint256 newFloorBasisPoints
) external

sets the floor price in BP

Parameters

NameTypeDescription
newFloorBasisPointsuint256

setOracleCeilingBasisPoints

function setOracleCeilingBasisPoints(
uint256 newCeilingBasisPoints
) external

sets the ceiling price in BP

Parameters

NameTypeDescription
newCeilingBasisPointsuint256

isPriceValid

function isPriceValid() external returns (bool)

return wether the current oracle price is valid or not

_setCeilingBasisPoints

function _setCeilingBasisPoints(
uint256 newCeilingBasisPoints
) internal

helper function to set the ceiling in basis points

Parameters

NameTypeDescription
newCeilingBasisPointsuint256

_setFloorBasisPoints

function _setFloorBasisPoints(
uint256 newFloorBasisPoints
) internal

helper function to set the floor in basis points

Parameters

NameTypeDescription
newFloorBasisPointsuint256

_validPrice

function _validPrice(
struct Decimal.D256 price
) internal returns (bool valid)

helper function to determine if price is within a valid range

Parameters

NameTypeDescription
pricestruct Decimal.D256

_validatePriceRange

function _validatePriceRange(
struct Decimal.D256 price
) internal

reverts if the price is greater than or equal to the ceiling or less than or equal to the floor

Parameters

NameTypeDescription
pricestruct Decimal.D256