Platform: Code4rena
Start Date: 12/04/2023
Pot Size: $60,500 USDC
Total HM: 21
Participants: 199
Period: 7 days
Judge: hansfriese
Total Solo HM: 5
Id: 231
League: ETH
Rank: 15/199
Findings: 1
Award: $700.83
🌟 Selected for report: 0
🚀 Solo Findings: 0
700.8278 USDC - $700.83
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L132
Increasing collateral and decreasing it's liquidation price, such that with new liquidation price and old collateral position is becoming unsound, leads to a revert. Such situation can happen often, imagine position that's fully minted and has market price of collateral close to liquidation, in this case, to keep position from liquidation, owner will add collateral and decrease liquidation price. Since it's fully minted, any decrease in liquidation price will lead to revert.
calling adjust with newPrice < price
and newCollateral > collateralBalance()
will lead to these consecutive calls
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L134
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L163
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L283
and could revert, since collateralReserve
equals to CollateralBalance()
, which wasn't updated yet
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L138
Place if (newPrice != price)
clause after if (newMinted < minted)
#0 - c4-pre-sort
2023-04-24T07:01:23Z
0xA5DF marked the issue as duplicate of #454
#1 - c4-judge
2023-05-18T10:40:31Z
hansfriese marked the issue as satisfactory