Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: low
Invalid

Storage reference is passed to a function with a memory parameter CreditDelegationBranch::_convertAssetsToUsdc()

Summary

Storage reference is passed to a function with a memory parameter. This will not update the storage variable as expected. This is the case in atleast two places in the below code Ln 447 and Ln 500 of the function CreditDelegationBranch::_convertAssetsToUsdc() & CreditDelegationBranch::_convertUsdcToAssets().

Found in src/market-making/branches/CreditDelegationBranch.sol [Line: 447](./src/market-making/branches/CreditDelegationBranch.sol#L447)

similar thing on #L500 (code ommited for simplicity.)

// swap the vault's assets to usdc in order to cover the usd denominated debt partially or fully
// both input and output in native precision
ctx.usdcOut = _convertAssetsToUsdc(
vault.swapStrategy.usdcDexSwapStrategyId,
ctx.vaultAsset,
ctx.swapAmount,
vault.swapStrategy.usdcDexSwapPath,
address(this),
ctx.usdc
);
// Here is the function signiture:
/// @param assetAmount in native precision of asset token
/// @return usdcOut in native usdc precision
function _convertAssetsToUsdc(
uint128 dexSwapStrategyId,
address asset,
uint256 assetAmount,
bytes memory path,
address recipient,
address usdc
)
internal
returns (uint256 usdcOut)

Impact

This will not update the storage variable as expected.

Tools Used

Static Analyzer

Recommendations

Use storage parameters instead.

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!