When user call mintFertilizer
function, the contract divide tokenAmountIn
by Price
of BarinRaise
token to get amount of Fertilizer token to mint .However it does not check if the Price Return from Oracle is zero.
The Contract Calculate the amount of tokens to be minted by dividing tokenAmountIn
by Price of BarinRaise
token. To fetch the price the contract calls LibUsdOracle.getUsdPrice()
. The LibUsdOracle.getUsdPrice
can return zero if the Price is not valid or steal.
following function will return fertilizerAmountOut
amount :
The getUsdPrice()
function code :
As it can be seen from getUsdPrice
that it will return 0 if wstethUsdPrice
or ethUsdPrice
is 0.
It will Dos, although the zero return case is already handled in mintFertilizer
function via require(fertilizerAmountOut > 0, "Fertilizer: None bought.")
Manual Review
check that if getUsdPrice
return 0 , then return 0. otherwise do the calculation
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.