Fees Technical Breakdown
Available Manager Fees
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:
_fundValue: The total value of the fund.
_tokenSupply: The total supply of tokens in the fund.
_performanceFeeNumerator: The numerator of the performance fee.
_managerFeeNumerator: The numerator of the manager fee.
_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.
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 depositor in the vault proportionally to their percentage share of a vault.
Fees can be minted in three ways:
When deposit happens (fees automatically minted, if any available)
When withdrawal happens (automatically minted, if any available)
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:
The function retrieves the total fund value (`fundValue`) and the total token supply (`tokenSupply`) from the `IPoolManagerLogic` contract.
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`).
It calculates the available manager fee by calling the `_availableManagerFee` function with the retrieved parameters:
availableManagerFee = _availableManagerFee(fundValue, tokenSupply, performanceFeeNumerator, managerFeeNumerator, managerFeeDenominator)
It retrieves the DAO fee numerator and denominator from the dHEDGE Factory Contract.
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
It calculates the manager fee by subtracting the DAO fee from the available manager fee:
managerFee = availableManagerFee - daoFee
If the DAO fee is greater than zero, it mints the DAO fee to the DAO address.
If the manager fee is greater than zero, it mints the manager fee to the manager's address.
It updates the (`lastFeeMintTime`) to the current block timestamp.
Event emitters are used to signal that the manager fee has been minted and provide relevant information.
Last updated