Wrong price used to update updateGlobalPositionData in liquidate
Summary
In LiquidationModule::liquidate when updating global position data position.lastPrice is used insted of currentPrice
Vulnerability Detail
In FlatcoinVault::updateGlobalPositionData there's comment "The current price of the underlying asset" for _price parameter. But in liquidate used stale position.price as the parameter
0xLogos
high
Wrong price used to update updateGlobalPositionData in liquidate
Summary
In
LiquidationModule::liquidate
when updating global position dataposition.lastPrice
is used insted ofcurrentPrice
Vulnerability Detail
In
FlatcoinVault::updateGlobalPositionData
there's comment "The current price of the underlying asset" for_price
parameter. But inliquidate
used staleposition.price
as the parameterposition.price
is the price of asset in time of last open/adjustmet and can be very different from from current priceImpact
Incorrect price used for
_globalPositions
and calculatingstableCollateralTotal
inFlatcoinVault
which is critical values for protocolCode Snippet
https://github.com/sherlock-audit/2023-12-flatmoney/blob/bba4f077a64f43fbd565f8983388d0e985cb85db/flatcoin-v1/src/LiquidationModule.sol#L160
Tool used
Manual Review
Recommendation
Use
currentPrice
insteadDuplicate of #188