code-423n4/2024-08-phi-validation

Buying price is greater than selling price, no one buys a depreciating asset and leads to dead protocol

c4-bot-10 opened this issue · 0 comments

Lines of code

https://github.com/code-423n4/2024-08-phi/blob/8c0985f7a10b231f916a51af5d506dd6b0c54120/src/curve/BondingCurve.sol#L78

Vulnerability details

Impact

In the BondingCurve contract, getBuyPrice for a particular supply and amount is greater than getSellPrice even if we instantly sell after a buy. It means this asset's value gets dropped always and no one wants any depreciating asset which leads to this protocol being abandoned.

Proof of Concept

-500 token supply with 100 wants to buy
-for 100 token, 10000e18/400e18-10e18-5.4 = 9.6 eth - 5.4eth = 4.1eth for 100 token
-The buying price gets 4.1 eth, calculated from the curve function
-now want sell price ->
-10000e18 / 500 -10 - 4.5 - (10000e18 / 600 - 10 - 3.6) = 5.5 - 3.06 = 2.44

if a user buys 100 tokens for 4.1 ETH and instantly or later sells the same amount of tokens for 2.44 ETH.

Tools Used

Manual Reviews

Assessed type

Other