Skip to content

Commit

Permalink
issue-m-4: fix transfer() into call()
Browse files Browse the repository at this point in the history
  • Loading branch information
Attens1423 committed Nov 29, 2022
1 parent 1f3e487 commit 96b3daa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions contracts/SmartRoute/DODORouteProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ contract DODORouteProxy is Ownable {
IERC20(token).universalTransfer(payable(routeFeeReceiver), restAmount);
} else {
uint256 restAmount = address(this).balance;
payable(routeFeeReceiver).transfer(restAmount);
IERC20(_ETH_ADDRESS_).universalTransfer(payable(routeFeeReceiver), restAmount);
}
}

Expand Down Expand Up @@ -495,7 +495,7 @@ contract DODORouteProxy is Ownable {

if (originToToken == _ETH_ADDRESS_) {
IWETH(_WETH_).withdraw(receiveAmount);
payable(msg.sender).transfer(receiveAmount);
IERC20(_ETH_ADDRESS_).universalTransfer(payable(msg.sender), receiveAmount);
} else {
IERC20(toToken).universalTransfer(payable(msg.sender), receiveAmount);
}
Expand Down
3 changes: 2 additions & 1 deletion contracts/SmartRoute/lib/UniversalERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ library UniversalERC20 {
) internal {
if (amount > 0) {
if (isETH(token)) {
to.transfer(amount);
(bool send, ) = to.call{value: amount, gas:10000}("");
require(send, "UniversalERC20: dangerous receiver");
} else {
token.safeTransfer(to, amount);
}
Expand Down

0 comments on commit 96b3daa

Please sign in to comment.