ERC4626 maxDeposit() Violates Standard by Not Enforcing Actual Deposit Limits
Source: https://github.com/sherlock-audit/2025-11-inverse-finance-junior-tranche-judging/issues/20
Found by
000000, 0x23r0, 0xAlipede, 0xBoraichoT, 0xc0ffEE, 0xeix, 0xheartcode, 0xpetern, 0xsh, A_Failures_True_Power, Artur, Bobai23, CasinoCompiler, Colin, DevBear0411, EV_om, JeRRy0422, JohnTPark24, KaplanLabs, Olugbenga-ayo, Pataroff, VCeb, al0x23, algiz, bbl4de, dandan, future, greekfreakxyz, jayjoshix, maigadoh, mladenov, newspacexyz, nodesemesta, shaflow01, silver_eth, tobi0x18, touristS, typicalHuman, v_2110, vangrim, vinica_boy, y4y, yovchev_yoan
Summary
The jDola contract violates ERC-4626's "MUST" requirement for maxDeposit() by returning type(uint256).max instead of the actual maximum that can be deposited without revert. The contract has multiple deposit limits (MIN_SHARES, MAX_ASSETS, MAX_SHARES) that are not reflected in maxDeposit(), causing potential integration failures.
https://eips.ethereum.org/EIPS/eip-4626
Vulnerability Detail
According to ERC-4626, maxDeposit() has specific requirements:
MUST return the maximum amount of assets deposit would allow to be deposited for receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted
However, jDola inherits Solmate's default implementation: https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC4626.sol#L160-L162
function maxDeposit(address) public view virtual returns (uint256) {
return type(uint256).max; // Always returns unlimited
}
But jDola enforces multiple limits in afterDeposit():
function afterDeposit(uint256, uint256) internal override {
require(totalSupply >= MIN_SHARES, "Shares below MIN_SHARES"); // 1e18 minimum
require(totalSupply <= MAX_SHARES, "Shares above MAX_SHARES"); // 2^128-1 maximum
require(totalAssets() >= MIN_ASSETS, "Assets below MIN_ASSETS"); // 1e18 minimum
}
ERC-4626 Violation Examples:
- MAX_SHARES Limit: If
totalSupply = 2^128 - 1000,maxDeposit()returns unlimited but any deposit would revert - MAX_ASSETS Limit:
totalAssets()calculation caps atMAX_ASSETS = 1e32, but this isn't reflected
Impact
Breaks core EIP-4626 functionality requirements and explicit violation of "MUST" requirement
Tool used
Manual Review
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in Inverse Finance - Junior Tranche. Sherlock made it public on 26 November 2025. Found in the 1202 audit contest (finding M-1), also found by 42 other wardens.
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.