Users can buy the ZENO
token through the Auction
and Auction.buy()
function gets the price of ZENO
from Auction.getPrice()
. The Auction.getPrice()
function returns the price of ZENO
without any precision factor and this could return higher price than real, leading users pay more funds.
When a user attempts to buy ZENO
, they invoke the Auction.buy()
function. The function gets the price gets the price of ZENO
from Auction.getPrice()
.
We can check the price doesn't use any precision factor from the calculation of cost = price * amount
.
Since the price doesn't use any precision factor, it can lead to significant inaccuracies, especially in scenarios where the time interval for price adjustment is large relative to the price range.
Let's analyze following calculation. The precision loss can arise when state.endTime - state.startTime
is significantly larger than state.startingPrice - state.reservePrice
. This could be possible case, since price price doesn't use decimal for precision factor.
Let's consider following case:
state.startingPrice = 50
, state.reservePrice = 40
: state.startingPrice - state.reservePrice = 10
state.startTime = 1730000000
, state.endTime = 1730864000
: state.endTime - state.startTime = 864000(10 days)
When block.timestamp = 1730086399
, price = 50 - 10 * 86399 / 864000 = 50
. If user want to buy 100 ZENO, he should pay 5000 usdc.
Let's use 1e8 decimal for price as precision factor:
price = 50 * 1e8 - 10 * 1e8 * 86399/86400 = 4023159722, cost = 4023159722 * 100 / 1e8 = 4023
The difference: 5000 - 4023 = 977
This is significant amount and users will pay more funds. This scenario is not real situation, but shows possible vulnerabilities in precision loss and should be fixed.
Users should pay more funds to buy ZENO
due to missing precision factor.
Manual Review
Implement a precision factor in the price calculation within the getPrice()
function.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.