Skip to content

Commit

Permalink
feat(queue): add events
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubilmax committed Sep 20, 2023
1 parent 78af18a commit 7a0a2dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/MetaMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, IMetaMorpho {
}

supplyQueue = newSupplyQueue;

emit EventsLib.SetSupplyQueue(msg.sender, newSupplyQueue);
}

function sortWithdrawQueue(uint256[] calldata indexes) external onlyAllocator {
Expand Down Expand Up @@ -239,6 +241,8 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, IMetaMorpho {
}

withdrawQueue = newWithdrawQueue;

emit EventsLib.SetWithdrawQueue(msg.sender, newWithdrawQueue);
}

function reallocate(MarketAllocation[] calldata withdrawn, MarketAllocation[] calldata supplied)
Expand Down Expand Up @@ -553,7 +557,7 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, IMetaMorpho {
// 1. oracle.price() is never called (the vault doesn't borrow)
// 2. `_withdrawable` caps to the liquidity available on Morpho
// 3. virtually accruing interest didn't fail in `_withdrawable`
assets = assets.zeroFloorSub(_withdrawable(marketParams, id));
assets -= _withdrawable(marketParams, id);

if (assets == 0) return 0;
}
Expand Down
4 changes: 4 additions & 0 deletions src/libraries/EventsLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ library EventsLib {
/// @notice Emitted when the vault's last total assets is updated.
/// @param totalAssets The total amount of assets this vault manages.
event UpdateLastTotalAssets(uint256 totalAssets);

event SetSupplyQueue(address indexed allocator, Id[] id);

event SetWithdrawQueue(address indexed allocator, Id[] id);
}

0 comments on commit 7a0a2dc

Please sign in to comment.