40,000 USDC
View results
Submission Details
Severity: gas
Valid

allow zero value to be transferred waste gas

Vulnerability Details

if the price has value of zero then when the buyer call confirmReceipt() function this will result in transferring zero value to the seller

function confirmReceipt() external onlyBuyer inState(State.Created) {
s_state = State.Confirmed;
emit Confirmed(i_seller);
i_tokenContract.safeTransfer(i_seller, i_tokenContract.balanceOf(address(this)));
}

Impact

gas optimization

Tools Used

manual review

Recommendations

add a check for the value that is going to be sent .

if (address(this).balance > 0) {
i_tokenContract.safeTransfer(i_seller, i_tokenContract.balanceOf(address(this)));
}

Support

FAQs

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