Cyfrin / 2023-07-escrow

17 stars 12 forks source link

deployement will fail for fee on transfer tokens #831

Open codehawks-bot opened 11 months ago

codehawks-bot commented 11 months ago

deployement will fail for fee on transfer tokens

Severity

Medium Risk

Relevant GitHub Links

https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol#L44

https://github.com/Cyfrin/2023-07-escrow/blob/main/src/EscrowFactory.sol#L39

Summary

As mentioned many times almost all type of tokens but for fee on transfer token deployement will fail everytime

Vulnerability Details

in newEscrow first price tokens sent to computedAddress then deployment occurs and for deployment price should not be less than balance of tokenContract.

In the case fee on transfer , transferred price will be less than param price and hence the actual token balance of the tokenCOntract will be less than price resulting fail deployment https://github.com/Cyfrin/2023-07-escrow/blob/main/src/EscrowFactory.sol#L39 https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol#L44

Impact

deployment will fail

Tools Used

Manual

Recommendations

Check balance before and after the transfer and then pass actual transfer amount in deployement function.