Open
Conversation
ororopickpocket
requested changes
Feb 24, 2022
ororopickpocket
requested changes
Feb 28, 2022
tjcloa
reviewed
Apr 29, 2022
tjcloa
reviewed
Apr 29, 2022
…stributedCollective/oracle-based-amm into wrapper-proxy-non-wrbtc-pairs
tjcloa
reviewed
May 6, 2022
tjcloa
reviewed
May 6, 2022
Comment on lines
489
to
498
| function withdraw(address token, address payable to, uint256 amount) external ownerOnly { | ||
| require(amount > 0, "non-zero withdraw amount expected"); | ||
| require(to != address(0), "receiver address invalid"); | ||
|
|
||
| if (token == address(0)) { | ||
| require(amount <= address(this).balance, "withdraw amount cannot exceed balance"); | ||
| to.transfer(amount); | ||
| } else { | ||
| require(IERC20Token(token).transfer(to, amount), "Failed to transfer the token"); | ||
| } |
Contributor
There was a problem hiding this comment.
CD6 - Don't use assert, tx.origin, address.transfer(), address.send()
https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/
import "../openzeppelin/SafeERC20.sol"; // copy from the protocol or from OZ - install proper version
using SafeERC20 for IERC20; // in the contract
address to; - to allow transfer to a contract address too (e.g. multisig)
Suggested change
| function withdraw(address token, address payable to, uint256 amount) external ownerOnly { | |
| require(amount > 0, "non-zero withdraw amount expected"); | |
| require(to != address(0), "receiver address invalid"); | |
| if (token == address(0)) { | |
| require(amount <= address(this).balance, "withdraw amount cannot exceed balance"); | |
| to.transfer(amount); | |
| } else { | |
| require(IERC20Token(token).transfer(to, amount), "Failed to transfer the token"); | |
| } | |
| function withdraw( | |
| address token, | |
| address to, | |
| uint256 amount | |
| ) external ownerOnly { | |
| require(amount > 0, "non-zero withdraw amount expected"); | |
| require(to != address(0), "receiver address invalid"); | |
| if (token == address(0)) { | |
| (bool success, ) = to.call.value(amount)(""); | |
| require(success, "transfer failed"); | |
| } else { | |
| IERC20(token).safeTransfer(token, to, amount); | |
| } | |
| } |
tjcloa
reviewed
May 6, 2022
Contributor
tjcloa
left a comment
There was a problem hiding this comment.
lgtm
pls resolve all conversations (comments)
|
Tested and reviewed the testRBTCWrapperProxy.js file. |
Alitasovryn
approved these changes
May 25, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor rbtcWrapperProxy to support non-wrbtc for providing liquidity