Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments on lost fees due to bad debt or market forced removals #359

Merged
merged 10 commits into from
Dec 27, 2023
5 changes: 4 additions & 1 deletion src/interfaces/IMetaMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ interface IMetaMorphoBase {
function withdrawQueueLength() external view returns (uint256);

/// @notice Stores the total assets managed by this vault when the fee was last accrued.
/// @dev May be a little off `totalAssets()` after each interaction, due to some roundings.
/// @dev May be greater than `totalAssets()` due to removal of markets with non-zero supply or socialized bad debt.
/// This difference will decrease the fee accrued until one of the functions updating `lastTotalAssets` is
/// triggered (deposit/mint/withdraw/redeem/setFee/setFeeRecipient).
function lastTotalAssets() external view returns (uint256);

/// @notice Submits a `newTimelock`.
Expand Down Expand Up @@ -145,6 +147,7 @@ interface IMetaMorphoBase {
/// @notice Warning: Anyone can supply on behalf of the vault so the call to `updateWithdrawQueue` that expects a
/// market to be empty can be griefed by a front-run. To circumvent this, the allocator can simply bundle a
/// reallocation that withdraws max from this market with a call to `updateWithdrawQueue`.
/// @dev Warning: Removing a market with supply will decrease the fee accrued until the next deposit/withdrawal.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the amount removed is bigger than the total amount of interest accrued by the other markets, the fee to accrue will be zero. It's worth mentioning it in the comment or anyway be more specific.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do it yes even though I think this is the general case

/// @param indexes The indexes of each market in the previous withdraw queue, in the new withdraw queue's order.
function updateWithdrawQueue(uint256[] calldata indexes) external;

Expand Down
Loading