Platform: Code4rena
Start Date: 21/08/2023
Pot Size: $125,000 USDC
Total HM: 26
Participants: 189
Period: 16 days
Judge: GalloDaSballo
Total Solo HM: 3
Id: 278
League: ETH
Rank: 147/189
Findings: 1
Award: $7.84
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Vagner
Also found by: 0Kage, 0xCiphky, 0xnev, ABAIKUNANBAEV, Aymen0909, Evo, KmanOfficial, MohammedRizwan, T1MOH, Viktor_Cortess, Yanchuan, ak1, alexzoid, bin2chen, codegpt, hals, ladboy233, mrudenko, nemveer, oakcobalt, peakbolt, pep7siup, qbs, said, savi0ur, tapir, wintermute, zaevlad, zzebra83
7.8372 USDC - $7.84
The lpTokenBalance state variable in the UniV2LiquidityAmo contract may become inconsistent with the actual LP token balance of the contract. This can occur if users add or remove liquidity directly through the Uniswap pool without using the contract's functions. Such inconsistency can lead to inaccurate calculations and unexpected contract behavior.
In the provided code section, the lpTokenBalance is updated based on the contract's interactions. However, if a user interacts directly with the Uniswap pool, this balance won't reflect the actual state.
function addLiquidity(uint amountA, uint amountB) external onlyOwner { // ... existing code ... // Call the sync function to ensure lpTokenBalance is consistent sync(); // ... rest of the function ... }
By adding the sync function call within the addLiquidity function (and similarly in other functions that change liquidity), we ensure that the lpTokenBalance state variable remains consistent with the actual LP token balance of the contract.
Manual review
Integrate the sync function call within all functions that change the liquidity to ensure the lpTokenBalance state variable remains consistent.
Context
#0 - c4-pre-sort
2023-09-09T03:52:01Z
bytes032 marked the issue as duplicate of #798
#1 - c4-pre-sort
2023-09-09T04:09:20Z
bytes032 marked the issue as duplicate of #269
#2 - c4-pre-sort
2023-09-11T11:58:21Z
bytes032 marked the issue as sufficient quality report
#3 - c4-judge
2023-10-15T18:13:28Z
GalloDaSballo marked the issue as satisfactory