Cyfrin / 2023-07-foundry-defi-stablecoin

37 stars 32 forks source link

safetransferFrom #1131

Closed codehawks-bot closed 1 year ago

codehawks-bot commented 1 year ago

safetransferFrom

Severity

Medium Risk

Relevant GitHub Links

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L157

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L274

Summary

safetransferFrom in place of transferFrom.

Vulnerability Details

safeTransfer just ensures that if the destination address is a contract that it has the ability to transfer the token again.

Impact

Token can get locked by accident if the contract in which tokens send can't send back.

Tools Used

Manually

Recommendations

Use safetransferFrom in place of transferFrom.

PatrickAlphaC commented 1 year ago

Known