QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

Incorrect Casting of `_vault` to `IVaultExplorer` in `UpliftOnlyExample.getPoolLPTokenValue()`

Summary

The UpliftOnlyExample contract incorrectly casts the _vault variable to an IVaultExplorer, wrongly assuming Vault inherits from VaultExplorer, but thats not correct. The code functions correctly only because both contracts share the same getPoolData(pool) method signature

Vulnerability Details

The line PoolData memory poolData = IVaultExplorer(address(_vault)).getPoolData(pool); assumes inheritance between Vault and VaultExplorer.

function getPoolLPTokenValue(
int256[] memory _prices,
address pool,
MULDIRECTION _direction
) internal view returns (uint256) {
uint256 poolValueInUSD;
@> PoolData memory poolData = IVaultExplorer(address(_vault)).getPoolData(pool);

https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-hooks/contracts/hooks-quantamm/UpliftOnlyExample.sol#L664C36-L664C67

The casting is incorrect as Vault does not inherit from VaultExplorer.

The code works due to identical method signatures, not due to correct inheritance.

Impact

No security risks, but incorrect casting

Tools Used

Manual Code Review

Recommendations

- import { IVaultExplorer } from "@balancer-labs/v3-interfaces/contracts/vault/IVaultExplorer.sol";
function getPoolLPTokenValue(
int256[] memory _prices,
address pool,
MULDIRECTION _direction
) internal view returns (uint256) {
uint256 poolValueInUSD;
- PoolData memory poolData = IVaultExplorer(address(_vault)).getPoolData(pool);
+ PoolData memory poolData =_vault.getPoolData(pool);
uint256 poolTotalSupply = _vault.totalSupply(pool);
Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!