> For the complete documentation index, see [llms.txt](https://csm-docs.cozy.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://csm-docs.cozy.finance/developer-guides/safety-module-fees.md).

# Safety Module Fees

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**.

## How are fees dripped?

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.

```solidity
interface IDripModel {
  /// @notice Returns the drip factor, the percentage of reserve assets which should drip to fees, as a wad. For
  /// example, it there are 100 reserve assets and this method returns 1e17, then 100 * 1e17 / 1e18 = 10 assets
  /// will drip to fees.
  /// @param lastDripTime_ Timestamp of the last drip
  function dripFactor(uint256 lastDripTime_) external view returns (uint256 dripFactor_);
}
```

An example of a drip model that may be used for fees is the [exponential-rate drip model](/developer-guides/create-a-rewards-manager/reward-pool-drip-models.md#exponential-rate-drip-model).

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`.

### When do fees drip?

Fees can either drip simultaneously for all reserve pools or for a single reserve pool.&#x20;

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`

### How are fees from reserve pool drip collected?

Fees are collected with `CozySafetyModuleManager.claimFees`, which transfers all accrued fees in the specified Safety Modules to the protocol owner address `CozySafetyModuleManager.owner()`.

```solidity
/// @notice For all specified `safetyModules_`, transfers accrued fees to the owner address.
function claimFees(ISafetyModule[] calldata safetyModules_) external;
```

&#x20;This calls `SafetyModule.claimFees` , which is only allowed to be called from `CozySafetyModuleManager`.&#x20;

## Redemption Fees

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()`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://csm-docs.cozy.finance/developer-guides/safety-module-fees.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
