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

no address(0) check for arbiter address

Summary

Concern Regarding Missing address(0) Check in Escrow.sol Constructor

Vulnerability Details

Upon examining the constructor() function of Escrow.sol, I noticed that there isn't an address(0) check in place for the arbiter address parameter. The absence of this check may pose potential issues during the dispute resolution process.

The initiateDispute() function relies on the arbiter address being valid and not equal to the zero address (address(0)). Without this check, there is a risk of restricting the seller's ability to execute initiateDispute() in cases where the buyer refuses to confirm receipt after the seller completes the audit.

constructor(
uint256 price,
IERC20 tokenContract,
address buyer,
address seller,
address arbiter, // @audit-issue address(0) check needs to be done and not be an optional, cause buyer can hold out payment and prevent seller to initiate_dispute
uint256 arbiterFee
) {
if (address(tokenContract) == address(0)) revert Escrow__TokenZeroAddress();
if (buyer == address(0)) revert Escrow__BuyerZeroAddress();
if (seller == address(0)) revert Escrow__SellerZeroAddress();
if (arbiterFee >= price) revert Escrow__FeeExceedsPrice(price, arbiterFee);
if (tokenContract.balanceOf(address(this)) < price) revert Escrow__MustDeployWithTokenBalance();
i_price = price;
i_tokenContract = tokenContract;
i_buyer = buyer;
i_seller = seller;
i_arbiter = arbiter;
i_arbiterFee = arbiterFee;
}
// @audit-issue buyer can hold out payment and prevent seller to initiate_dispute
/// @inheritdoc IEscrow
function initiateDispute() external onlyBuyerOrSeller inState(State.Created) {
if (i_arbiter == address(0)) revert Escrow__DisputeRequiresArbiter();
s_state = State.Disputed;
emit Disputed(msg.sender);
}

Impact

This will restrict the seller's ability to execute initiateDispute() in cases where the buyer refuses to confirm receipt after the seller completes the audit.

Tools Used

Manual review

Recommendations

adding a condition in the constructor() to ensure that the arbiter address is not the zero address before proceeding with the contract initialization. So that the seller can initiate a dispute.

Support

FAQs

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