sherlock-audit / 2023-02-kairos-judging

2 stars 0 forks source link

Nadin - [M] Use safeTransfer/safeTransferFrom consistently instead of transfer/transferFrom #165

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

Nadin

medium

[M] Use safeTransfer/safeTransferFrom consistently instead of transfer/transferFrom

Summary

Use safeTransfer/safetransferFrom consistently instead of transfer/transferFrom

Vulnerability Detail

Some tokens do not revert on failure, but instead return false (e.g. ZRX). https://github.com/d-xo/weird-erc20/#no-revert-on-failure tranfser/transferFrom is directly used to send tokens in many places in the contract and the return value is not checked.

Impact

If the token send fails, it will cause a lot of serious problems.

Code Snippet

https://github.com/sherlock-audit/2023-02-kairos/blob/main/kairos-contracts/src/BorrowFacet.sol#L40

Tool used

Manual Review

Recommendation

Consider using safeTransfer/safetransferFrom consistently

- 40:             args[i].nft.implem.transferFrom(msg.sender, address(this), args[i].nft.id);
+ 40:            args[i].nft.implem.safeTransferFrom(msg.sender, address(this), args[i].nft.id);

Duplicate of #1