In the updateExchangeRate
function of the AssetToken
contract, there's a comparison that checks if newExchangeRate
is less than or equal to s_exchangeRate
. This comparison allows updates where the new rate is equal to the old rate, which may not align with the intended behavior. To ensure that updates only result in an increase in the exchange rate, it is recommended to change the comparison to if (newExchangeRate < s_exchangeRate)
.
In the provided code, the updateExchangeRate
function checks if newExchangeRate
is less than or equal to the current s_exchangeRate
. The intention here seems to be to allow updates that increase the rate. However, the current comparison allows updates where the new rate is equal to the old rate, which may not be the desired behavior.
if newExchangeRate
is equal to s_exchangeRate
, the condition is met, which may not align with the intended security requirements.
Allowing updates that result in the exchange rate being the same as the previous rate can be exploited by attackers to manipulate the rate without a real increase, potentially leading to financial losses or instability.
No specific tools were used for this analysis.
To ensure that updates to the exchange rate only occur when there is a real increase, the comparison should be adjusted as follows:
updates will only be allowed when the new rate is greater than the old rate, providing the intended security and preventing rate manipulation without a real increase
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.