LToken's implmentation is not fully up to EIP-4626's specification
The LToken contract's maxMint and maxDeposit functions return the maximum uint256 value instead of respecting the contract's maxSupply limit, violating the EIP-4626 standard. This could cause unexpected behaviour in the future due to non-compliance.
Source: https://github.com/sherlock-audit/2022-08-sentiment-judging/tree/main/500-M
Found by
WATCHPUG
Summary
Note: This issue is a part of the extra scope added by Sentiment AFTER the audit contest. This scope was only reviewed by WatchPug and relates to these three PRs:
LToken's implmentation is not fully up to EIP-4626's specification. This issue is would actually be considered a Low issue if it were a part of a Sherlock contest.
Vulnerability Detail
function maxMint(address) public view virtual returns (uint256) {
return type(uint256).max;
}
MUST return the maximum amount of shares mint would allow to be deposited to receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.
maxMint() and maxDeposit() should reflect the limitation of maxSupply.
Impact
Could cause unexpected behavior in the future due to non-compliance with EIP-4626 standard.
Code Snippet
function maxMint(address) public view virtual returns (uint256) {
return type(uint256).max;
}
Tool used
Manual Review
Recommendation
maxMint() and maxDeposit() should reflect the limitation of maxSupply.
Consider changing maxMint() and maxDeposit() to:
function maxMint(address) public view virtual returns (uint256) {
if (totalSupply >= maxSupply) {
return 0;
}
return maxSupply - totalSupply;
}
function maxDeposit(address) public view virtual returns (uint256) {
return convertToAssets(maxMint(address(0)));
}
Sentiment Team
Fixed as recommended. PR here.
Lead Senior Watson
Confirmed fix.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the maxMint and maxDeposit functions were implemented as simple placeholders returning the maximum uint256 value, without accounting for the contract's maxSupply limit as required by EIP-4626.
Impact
Could cause unexpected behavior in the future due to non-compliance with EIP-4626 standard.
What the attacker needed
None
The fix
The team fixed it by making maxMint and maxDeposit reflect the maxSupply limitation, as recommended.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is about a smart contract that follows a standard called EIP-4626 for tokenised vaults. The standard says a function called maxMint should tell users the largest number of shares they can mint, but this contract simply says 'the biggest number possible' without considering its own supply cap. That mismatch could confuse other contracts or users who rely on the standard.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.