Brivault overrides deposit instead of _deposit function, causing shares to be minted to msg.sender rather than the intended receiver and bypassing ERC4626’s:: _convertToShares, which leads to inaccurate share calculations.
The Brivault contract inherits from ERC4626 and overrides the deposit function. In ERC4626, overriding the internal _deposit function automatically affects both the deposit and mint mechanisms. The _deposit function is supposed to mint shares to the specified receiver using _mint(receiver, shares). However, in the overridden deposit function, shares are instead minted to msg.sender via _mint(msg.sender, participantShares).
Additionally, by overriding deposit directly, the contract bypasses the standard ERC4626 ::_convertToShares logic, resulting in imprecise share calculations that may not correctly reflect the proportional ownership based on the vault’s assets.
The result is that the receiver does not receive the expected minted tokens; instead, the msg.sender receives the tokens.
User1 approves Brivault and deposits on behalf of User2.As a result, User2 did not receive the shares.
Place the following code in briVault.t.sol.
The Result:
The _deposit function should be overridden instead of deposit.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.