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
4 changes: 3 additions & 1 deletion src/interfaces/IMetaMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ 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 off `totalAssets()` between deposits/withdrawals due to roundings or socialized bad debt.
/// This difference will decrease the fee accrued between 2 deposits/withdrawals.
Jean-Grimal marked this conversation as resolved.
Show resolved Hide resolved
function lastTotalAssets() external view returns (uint256);

/// @notice Submits a `newTimelock`.
Expand Down Expand Up @@ -144,6 +145,7 @@ interface IMetaMorphoBase {
/// @notice Removing a market requires the vault to have 0 supply on it; but anyone can supply on behalf of the
/// vault so the call to `updateWithdrawQueue` can be griefed by a frontrun. 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