40,000 USDC
View results
Submission Details
Severity: gas

Make the arbiter address check in the constructor itself.

Summary

Initially, no check against the arbiter's address is made. However, in the function initiateDispute, there is a check to see if the address is non-zero or not.

Details & Recommendations

In a case where arbiter's address is zero address, it becomes difficult to raise the dispute and no one can initiate the dispute without an option to do so.

It's better to perform a check against the arbiter's address in the constructor itself, as there is no specific use case where we blindly state that we don't need an arbiter.

constructor(
uint256 price,
IERC20 tokenContract,
address buyer,
address seller,
address arbiter,
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 (arbiter == address(0)) revert Escrow__DisputeRequiresArbiter();
if (arbiterFee >= price) revert Escrow__FeeExceedsPrice(price, arbiterFee);
if (tokenContract.balanceOf(address(this)) < price) revert Escrow__MustDeployWithTokenBalance();
}

Support

FAQs

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