40,000 USDC
View results
Submission Details
Severity: low

getPrice() will return wrong value

Summary

getPrice() will return the wrong value as i_price

Vulnerability Details

function getPrice() external view returns (uint256) {
return i_price;
}

getPrice() returns i_price and i_price can be set at the deployment of the contract. initially i_price will be a token balance deposited to the contract. But if the Buyer transfers tokens directly to the contract, it will not update the i_price, and getPrice() will return the wrong old value.

Impact

getPrice() will return the wrong value, which can affect displaying the wrong value and affect user experience.

Tools Used

Manual Review

Recommendations

return the contract token balance

function getPrice() external view returns (uint256) {
return i_tokenContract.balanceOf(address(this));;
}

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.