Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use safeTransfer and safeTransferFrom from SafeERC20 #229

Closed
code423n4 opened this issue Jul 12, 2022 · 2 comments
Closed

Use safeTransfer and safeTransferFrom from SafeERC20 #229

code423n4 opened this issue Jul 12, 2022 · 2 comments
Labels
bug Warden finding duplicate Another warden found this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-07-fractional/blob/main/src/modules/protoforms/BaseVault.sol#L65
https://github.com/code-423n4/2022-07-fractional/blob/main/src/references/TransferReference.sol#L22

Vulnerability details

Impact

Some tokens fail silently, not throwing an error. The functions safeTransfer and safeTransferFrom has checks for that returns and throw an error if not possible to transfer the tokens

Recommended Mitigation Steps

+ using SafeERC20 for IERC20;

-  IERC20(token).transfer(_to, _amount)
+  IERC20(token).safeTransfer(_to, _amount)

-  IERC20(token).transferFrom(_from, _to, _amount);
+  IERC20(token).safeTransferFrom(_from, _to, _amount);
@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Warden finding labels Jul 12, 2022
code423n4 added a commit that referenced this issue Jul 12, 2022
@stevennevins stevennevins added the duplicate Another warden found this issue label Jul 21, 2022
@stevennevins
Copy link
Collaborator

Duplicate of #312

@stevennevins stevennevins marked this as a duplicate of #312 Jul 21, 2022
@HardlyDifficult
Copy link
Collaborator

Agree with the sponsor that this is a non-critical best practice. Transfers may fail but no events are emitted, balance doesn't change, and no other negative consequences were identified.

Merging with the warden's QA report #231

@HardlyDifficult HardlyDifficult added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Warden finding duplicate Another warden found this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

3 participants