The ZlpVault
contract extends ERC4626Upgradeable
but includes several areas where the implementation deviates from or could cause incompatibility with the ERC4626 standard. These issues could result in unexpected behavior when interacting with other systems or protocols that expect ERC4626 compliance. In particular, the custom logic in the deposit
, mint
, withdraw
, and redeem
functions can cause interoperability issues.
Deviation from ERC4626 Expected Behavior:
ERC4626 Standard: The standard expects certain functions (deposit
, mint
, withdraw
, and redeem
) to be callable by any account, but in ZlpVault
, these functions are restricted to the MarketMakingEngine
through the onlyMarketMakingEngine
modifier. This restriction violates the standard and could prevent legitimate users or contracts from interacting with the vault as intended.
ERC4626 Compatibility: The ERC4626 standard defines strict guidelines for how these functions should work, including who can call them and how the accounting for assets should be handled. By modifying the access control and relying on a specific external contract (MarketMakingEngine
), ZlpVault
may not be compatible with ERC4626-compliant systems or protocols.
Non-Standard Behavior:
The maxDeposit
, maxMint
, maxWithdraw
, and maxRedeem
functions in ZlpVault
are overridden and modified to enforce limits based on the MarketMakingEngine
. However, these limits are not part of the ERC4626 specification, meaning that other ERC4626-compliant systems may not expect these restrictions.
The custom maxDeposit
and maxMint
implementations could cause conflicts with systems that expect a simpler, unrestricted deposit and mint mechanism.
Inconsistent Handling of Assets and Shares:
In the ERC4626Upgradeable
implementation, assets and shares are directly linked with standardized conversion functions. However, the ZlpVault
contract introduces custom logic to convert between assets and shares using the MarketMakingEngine
, potentially causing discrepancies when interacting with other ERC4626-compliant systems or tools that assume the standard conversion methods.
Interoperability Issues: The modified logic for access control and the custom cap enforcement mechanism could make it difficult for other contracts, external users, or decentralized applications (dApps) to integrate with ZlpVault
. This could lead to failed transactions, improper asset accounting, or unexpected behavior when interacting with decentralized finance (DeFi) protocols or automated systems that expect ERC4626-compliant vaults.
Inability to Migrate or Integrate with ERC4626 Ecosystem: If ZlpVault
is designed to be used within a broader ecosystem that expects ERC4626 compliance, the deviations from the standard could prevent it from being integrated with other systems like yield aggregators, lending platforms, or decentralized exchanges.
Loss of Interoperability: The contract’s restrictions and custom logic could prevent it from being used in other ERC4626-compliant ecosystems, limiting its flexibility and integration with decentralized finance (DeFi) platforms.
Potential Loss of Funds: Users or other contracts may encounter issues interacting with the vault, such as being unable to deposit, withdraw, or mint shares, leading to potential loss of funds or failures in DeFi protocols that rely on it.
Complexity and Maintenance Challenges: The custom logic may make the contract harder to maintain and upgrade, as well as introducing potential risks when trying to integrate with future versions of the ERC4626 standard or other compliant systems.
Manual Review
To improve compatibility with the ERC4626 standard and ensure easier integration with DeFi protocols, consider the following changes:
Remove onlyMarketMakingEngine
Modifier
The deposit
, mint
, withdraw
, and redeem
functions should be callable by any user, not just the MarketMakingEngine
. Modify these functions to remove the onlyMarketMakingEngine
restriction, as it diverges from ERC4626’s expectations:
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.