Safety Module Fees
Last updated
Last updated
The Cozy Safety Module protocol is able to take fees in two ways:
Reserve pool assets drip as fees at a pre-configured rate
A fixed % of all redemptions are paid as fees
All fees are received by the owner address of the protocol - CozySafetyModuleManager.owner()
. Currently, both fees are set to zero.
The Cozy Safety Module protocol uses a drip model which defines the rate at which fees drip from reserve pool assets. The drip model may use the last time fees were dripped in the Safety Module to pro-actively determine the amount of assets to drip to claimable fees.
An example of a drip model that may be used for fees is the .
The core drip functionality is implemented in SafetyModule._dripFeesFromReservePool
. When a reserve pool drips fees, the following happens:
The amount of dripped fees is calculated as (reservePool.depositAmount - reservePool.pendingWithdrawalsAmount) * dripModel.dripFactor(reservePool.lastFeesDripTime) / 1e18
, rounded down.
reservePool.depositAmount
gets decremented by the amount of dripped fees.
reservePool.feeAmount
gets increased by that same amount of dripped fees.
reservePool.lastFeesDripTime
updates to block.timestamp
.
Fees can either drip simultaneously for all reserve pools or for a single reserve pool.
Many operations in the Safety Module internally drip fees. However, anyone can drip fees on-demand by calling SafetyModule.dripFees()
for all reserve pools and SafetyModule.dripFeesFromReservePool(reservePoolId_)
for a specific reserve pool, which are also public and external functions, respectively.
The following operations internally drip fees for all reserve pools:
SafetyModule.pause
SafetyModule.unpause
SafetyModule.trigger
The following operations internally drip fees for a single reserve pool:
SafetyModule.depositReserveAssets
SafetyModule.depositReserveAssetsWithoutTransfer
SafetyModule.redeem
SafetyModule.claimFees
Fees are collected with CozySafetyModuleManager.claimFees
, which transfers all accrued fees in the specified Safety Modules to the protocol owner address CozySafetyModuleManager.owner()
.
This calls SafetyModule.claimFees
, which is only allowed to be called from CozySafetyModuleManager
.
The CozySafetyModuleManager
defines a global redemptionFee
which applies to all redemptions from the Safety Module. The redemption fee simply takes a fixed % of all reserve assets which are redeemed as fees and sends them to the CozySafetyModuleManager.owner()
.