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

Escrow.sol#constructor - Escrow contract doesn't support fee on transfer tokens

Summary

Escrow contract doesn't support fee on transfer tokens.

Vulnerability Details

Currently when a new contract is created we check tokenContract.balanceOf(address(this)) < price. Inside EscrowFactory we transfer these tokens inside newEscrow. The check will fail with fee on transfer tokens, because those tokens take a small fee on each transfer. Since we only compare the balance of the Escrow contract to the price that was passed in the constructor, if fee on transfer tokens are used the check will always fail, because it doesn't take into account any fees.

Impact

Escrow's cannot be created using fee on transfer tokens.

Tools Used

Manual review

Recommendations

Use a whitelist/blacklist.

function newEscrow(
uint256 price,
IERC20 tokenContract,
address seller,
address arbiter,
uint256 arbiterFee,
bytes32 salt
) external returns (IEscrow) {
// Add a variable that whitelists/blacklists
if (!isTokenAllowed[tokenContract]) {
revert()
}
address computedAddress = computeEscrowAddress(
type(Escrow).creationCode,
address(this),
uint256(salt),
price,
tokenContract,
msg.sender,
seller,
arbiter,
arbiterFee
);
...
}

Support

FAQs

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