FixedTermLoanHook looks at block.timestamp instead of expiry
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/main/src/access/FixedTermLoanHooks.sol#L848
Vulnerability details
Impact
FixedTermLoanHook looks at block.timestamp instead of expiry
Proof of Concept
The idea of FixedTermLoanHook is to only allow for withdrawals after a certain term end time. However, the problem is that the current implementation does not look at the expiry, but instead at the block.timestamp
solidityfunction onQueueWithdrawal( address lender, uint32 /* expiry */, uint /* scaledAmount */, MarketState calldata /* state */, bytes calldata hooksData ) external override { HookedMarket memory market = _hookedMarkets[msg.sender]; if (!market.isHooked) revert NotHookedMarket(); if (market.fixedTermEndTime > block.timestamp) { revert WithdrawBeforeTermEnd(); }
This creates inconsistencies such as forcing users not only to wait until term's end, but also having to wait an extra withdrawalBatchDuration before they're able to withdraw their funds.
Tools Used
Manual review
Recommended Mitigation Steps
Check the expiry instead of block.timestamp
Assessed type
Context
