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

Constructor of `Escrow` should make sure that `arbiter` is non-zero address if `arbterFee` is non-zero.

Summary

If arbiterFee is non-zero, it means resolveDispute() would be called and arbiter should also be non-zero address.

Vulnerability Details

constructor(
uint256 price,
IERC20 tokenContract,
address buyer,
address seller,
address arbiter,
uint256 arbiterFee
) {
...
i_buyer = buyer;
i_seller = seller;
i_arbiter = arbiter;
i_arbiterFee = arbiterFee; //@audit - if arbiterFee > 0 then arbiter should not be zero.
}

Impact

Arbiter fee would be meaningless if arbiter is set to zero address.

Tools Used

Manual Review

Recommendations

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 (arbiterFee >= price) revert Escrow__FeeExceedsPrice(price, arbiterFee);
+ if (arbiter == address(0) && arbiterFee > 0) revert Escrow__InvalidArbiter(arbiter, 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;
}

Support

FAQs

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