FeeManagercontract is responsible for updating fees within relevant contracts of the protocol for HAs, for users minting and burning and for SLPs slippage. There is one such contract per collateral/stablecoin pair.
AccessControl. This contract is not upgradeable.
FeeManagercontract in another contract (like a
StableMastercontract) can always be modified.
FeeManagerdoes not inherit from the
FunctionUtilsbecause the parameters for the fees are stored as
uint256rather than as
uint64and a different
_piecewiseLinearfunction is hence needed. The reason for this different structure is that there is otherwise a risk of overflow in the
_piecewiseLinearfunction used in other contracts.
stableMaster: Reference to the
StableMastercontract associated to the stablecoin
perpetualManager: Address of the
PerpetualManagercontract corresponding to this keeper contract
fee > BASE_PARAMSthen /// agents incur a malus and will have larger fees, while
fee < BASE_PARAMSthey incur a smaller fee than what they would have if fees just consisted in what was obtained using coverage.
xBonusMalusMint, xBonusMalusBurn: Values of the collateral ratio where mint or burn transaction fees will change for users. It should be ranked in ascending order.
yFeeMint, yFeeBurn: Values of the mint or burn fees at the points of collateral ratio in the x array. The evolution of the fees when collateral ratio is between two threshold values is linear
xSlippage: Values of the collateral ratio where the slippage factor for SLPs exiting will evolve
ySlippage: Slippage factor at the values of collateral ratio above
xSlippageFee: Values of the collateral ratio where the slippage fee, that is the portion of the fees that does not come to SLPs although changes
ySlippageFee: Slippage fee value at the values of collateral ratio above
haFeeDeposit, haFeeWithdraw: Extra deposit or withdraw bonus/malus for HAs fees,
BASE_PARAMSmeans that there are no fees
POOLMANAGER_ROLE: this role is admin of all roles here. Although there is no function that requires this role, this role is here as it allows the corresponding
PoolManagerto directly update the roles in this contract without having to define functions in it.
GUARDIAN_ROLE: there is no
GOVERNOR_ROLEin this contract
StableMastercontract based on the collateral ratio.
bonusMalusMint: part of the fee induced by a user minting depending on the collateral ratio. In normal times, no fees are taken for that, and so this fee should be equal to
bonusMalusBurn: part of the fee induced by a user burning depending on the collateral ratio
slippage: what's given to SLPs compared with their claim when they exit
slippageFee: that is the portion of fees that is put aside because the protocol is not well collateralized
bonusMalusBurnallow governance to add penalties or bonuses for users minting and burning in some situations of collateral ratio. These parameters are multiplied to the fee amount depending on coverage by Hedging Agents to get the exact fee induced to the users.
_piecewiseLinearfunction defined in
FunctionUtils. The reason for having a different function is that here the values in the
xArraycan be greater than
BASE_PARAMSmeaning that if we used the same version of
FunctionUtils, there would be a non negligeable risk of overflow.
PerpetualManagercontract. This function updates:
PerpetualManagercontract, these parameters are multiplied to the fee amount depending on the HA coverage to get the exact fee amount for HAs. For the moment, these parameters do not depend on the collateral ratio, and they are just an extra element that governance can play on to correct fees taken for HAs.
xArray: New collateral ratio thresholds (in ascending order)
yArray: New fees or ratio at thresholds
typeChange: Type of parameter to change
typeChange = 1, minting fees are updated. For
typeChange = 2, burning fees are updated. For
typeChange = 3, slippage values are updated. For other values of
typeChange, slippage fee values are updated.
_haFeeDeposit: New deposit fee for HAs
_haFeeWithdraw: New withdraw fee for HAs