Fees Technical Breakdown

Available Manager Fees

https://github.com/dhedge/V2-Public/blob/ba2f06d40a87e18a150f4055def5e7a2d596c719/contracts/PoolLogic.sol#L608

The `_availableManagerFee` function calculates the available manager fees (performance and management fee included) for the vault

  • available = (currentTokenPrice - tokenPriceAtLastFeeMint) * _tokenSupply * ( _performanceFeeNumerator / _feeDenominator) / currentTokenPrice;

The function takes the following parameters:

  1. _fundValue: The total value of the fund.

  2. _tokenSupply: The total supply of tokens in the fund.

  3. _performanceFeeNumerator: The numerator of the performance fee.

  4. _managerFeeNumerator: The numerator of the manager fee.

  5. _feeDenominator: The denominator of both the performance fee and the manager fee, used to round whole numbers into decimals (conversion).

The function first checks if either the _tokenSupply or _fundValue is zero. If either of them is zero, it returns 0, indicating that no manager fee is available.

It calculates the currentTokenPrice by dividing the _fundValue by the _tokenSupply and multiplying it by 10^18. This ensures the token price is represented with sufficient decimal places.

Performance Fee

If the currentTokenPrice is greater than the tokenPriceAtLastFeeMint, it means the token price has increased since the last fee mint. In this case, it calculates the available performance fee.

It subtracts the tokenPriceAtLastFeeMint from the currentTokenPrice.

Multiplies the price difference by the _tokenSupply, _performanceFeeNumerator, and divides it by _feeDenominator.

Divides the result by the currentTokenPrice.

The purpose of this calculation is to determine the increase in the token price and allocate a portion of it as the available performance fee.

Management fee

It calculates the management (‘streamingFee’) fee by multiplying (‘_tokenSupply’), (‘timeChange’), (‘_managerFeeNumerator’), and dividing it by (‘_feeDenominator’). The division by 365 days (number of seconds in a year) normalizes the fee over a one-year period.

  • streamingFee = (_tokenSupply * timeChange * _managerFeeNumerator / _feeDenominator) / (365 days);

The formula multiplies the token supply (‘_tokenSupply’) by the time change (‘timeChange’) and the manager fee numerator (‘_managerFeeNumerator’). It then divides it by the fee denominator (‘_feeDenominator’) and further divides by the number of seconds in a year (365 days) to calculate the streaming fee.

Finally, the streaming fee is added to the available manager fee (available = available.add(streamingFee)), and the function returns the total fees available manager fee.

Performance Fee Numerator

The Performance Fee Numerator (‘_performanceFeeNumerator’) is a value that is used to calculate the performance fee that is charged to each investor in a dHEDGE vault. The performance fee is a percentage of the profits that are generated by a dHEDGE vault that is paid to the vault's manager in shares of the vault (token inflation).

The (‘_performanceFeeNumerator’) is set during the establishment of a new vault and is designated by the manager. This fee amount can also be changed by the manager, but is capped at 20% (‘_performanceFeeNumerator’ = 2,000).

Management Fee Numerator

The Management Fee Numerator (‘_managerFeeNumerator’) value is used to calculate the management fee that is charged to investors in a dHEDGE vault. The management fee is a percentage of the assets of the vault that is paid to the vault's manager in new shares of the vault.

The (‘_managerFeeNumerator’) is set during the establishment of a new vault and is designated by the manager. This variable can also be changed by the manager, but is hard capped at 3% ((‘_managerFeeNumerator’) = 300).

Mint Manager Fee

One key thing to note is that, as the Management or Performance fees are minted, there are new vault shares issued or created and distributed to the manager’s wallet in compensation for these fees. This invariably increases the total vault shares outstanding in the vault, and therefore increases the manager’s percentage holdings of the vault. This also slightly decreases the price per share of each vault share outstanding simultaneously. The assets and positions of the vault remain the same during this minting stay the same, but the value per share invariably decreases slightly in proportion to how many new shares were minted and issued to the Manager. Fees are always minted across every investor in the vault proportionally to their percentage share of a vault.

Fees can be minted in three ways:

  1. When an investor deposits (fees automatically minted, if any available)

  2. When an investor withdrawals assets (automatically minted, if any available)

  3. Manually at the Manager’s discretion when or if they are available

The breakdown of the mechanics of this function are below:

The (`mintManagerFee`) function is called externally to mint the manager fee for the pool. Let's break it down step by step:

  1. The function retrieves the total fund value (`fundValue`) and the total token supply (`tokenSupply`) from the `IPoolManagerLogic` contract.

  2. It calls the `getFee` function of the `IPoolManagerLogic` contract to retrieve the performance fee numerator (`performanceFeeNumerator`), the manager fee numerator (`managerFeeNumerator`), and the manager fee denominator (`managerFeeDenominator`).

  3. It calculates the available manager fee by calling the `_availableManagerFee` function with the retrieved parameters:

  • availableManagerFee = _availableManagerFee(fundValue, tokenSupply, performanceFeeNumerator, managerFeeNumerator, managerFeeDenominator)

  1. It retrieves the DAO fee numerator and denominator from the dHEDGE Factory Contract.

  2. It calculates the DAO fee (10%) by multiplying the available manager fee by the DAO fee numerator and dividing it by the DAO fee denominator:

  • daoFee = availableManagerFee * daoFeeNumerator / daoFeeDenominator

  1. It calculates the manager fee by subtracting the DAO fee from the available manager fee:

  • managerFee = availableManagerFee - daoFee

  1. If the DAO fee is greater than zero, it mints the DAO fee to the DAO address.

  2. If the manager fee is greater than zero, it mints the manager fee to the manager's address.

  3. It updates the (`lastFeeMintTime`) to the current block timestamp.

  4. Event emitters are used to signal that the manager fee has been minted and provide relevant information.

Last updated