#41890 [SC-Insight] MoneyBrinter vault does not consider Farm's staking cap
Submitted on Mar 19th 2025 at 07:49:59 UTC by @trtrth for Audit Comp | Yeet
Report ID: #41890
Report Type: Smart Contract
Report severity: Insight
Target: https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/contracts/MoneyBrinter.sol
Impacts:
Description
Brief/Intro
The MoneyBrinter vault does not take into account the maximum deposit amount. This makes the vault incompliant with ERC4626 and it can cause user deposits unexpectedly to fail
Vulnerability Details
According to ERC-4626 about maxDeposit()
Maximum amount of the underlying asset that can be deposited into the Vault for the receiver, through a deposit call.
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 (it should underestimate if necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.
MUST factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.
MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
MUST NOT revert.
The current MoneyBrinter implementation always returns 2 ** 256 - 1 for maxDeposit().
However, the farm contract has the staking cap configuration. By this, the value returned from maxDeposit() can be higher than the farm's remaining staking cap and it can cause user deposits to be failed.
Below is the staking logic in the farm contract
Impact Details
Not comply ERC4626
References
Farm contract implementation: https://bartio.beratrail.io/token/0xbdEE3F788a5efDdA1FcFe6bfe7DbbDa5690179e6/contract/code
Proof of Concept
Proof of Concept
Update the test
test_Valid_Deposit_Into_Beradromein filetest/vault/Vault_IntegrationTest_ZeroFee.t.solas below:
Run the test and console shows.
It means that the max deposit amount is still 2**256 - 1 and the deposit fails due to farm's staking cap reached
Was this helpful?