use safetransfer
This commit is contained in:
@@ -335,8 +335,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
|
||||
uint256 originToTokenBalance = IERC20(toToken).balanceOf(msg.sender);
|
||||
IWETH(_WETH_).deposit{value: msg.value}();
|
||||
bool success = IWETH(_WETH_).transfer(dodoPairs[0], msg.value);
|
||||
require(success, "WETH_TRANSFER_FAIL");
|
||||
SafeERC20.safeTransfer(IERC20(_WETH_), dodoPairs[0], msg.value);
|
||||
|
||||
for (uint256 i = 0; i < dodoPairs.length; i++) {
|
||||
if (i == dodoPairs.length - 1) {
|
||||
|
||||
@@ -226,8 +226,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
|
||||
uint256 originToTokenBalance = IERC20(toToken).balanceOf(msg.sender);
|
||||
IWETH(_WETH_).deposit{value: msg.value}();
|
||||
bool success = IWETH(_WETH_).transfer(dodoPairs[0], msg.value);
|
||||
require(success, "WETH_TRANSFER_FAIL");
|
||||
SafeERC20.safeTransfer(IERC20(_WETH_), dodoPairs[0], msg.value);
|
||||
|
||||
for (uint256 i = 0; i < dodoPairs.length; i++) {
|
||||
if (i == dodoPairs.length - 1) {
|
||||
|
||||
@@ -103,8 +103,7 @@ contract UniV3Adapter is IDODOAdapter, IUniswapV3SwapCallback, InitializableOwna
|
||||
if (token == _WETH_ && address(this).balance >= value) {
|
||||
// pay with WETH9
|
||||
IWETH(_WETH_).deposit{value: value}(); // wrap only what is needed to pay
|
||||
bool success = IWETH(_WETH_).transfer(recipient, value);
|
||||
require(success, "WETH_TRANSFER_FAIL");
|
||||
SafeERC20.safeTransfer(IERC20(_WETH_), recipient, value);
|
||||
} else if (payer == address(this)) {
|
||||
// pay with tokens already in the contract (for the exact input multihop case)
|
||||
SafeERC20.safeTransfer(IERC20(token), recipient, value);
|
||||
|
||||
Reference in New Issue
Block a user