From b7f66edfb8eaf17be378f168e58487f44ab6aa04 Mon Sep 17 00:00:00 2001 From: huyhuynh3103 Date: Tue, 19 Mar 2024 11:20:28 +0700 Subject: [PATCH] feat: remove send zero checks --- .../transfers/RONTransferHelperExtended.sol | 40 +++++++------------ 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/legacy/transfers/RONTransferHelperExtended.sol b/src/legacy/transfers/RONTransferHelperExtended.sol index 08d31c3..51ef344 100644 --- a/src/legacy/transfers/RONTransferHelperExtended.sol +++ b/src/legacy/transfers/RONTransferHelperExtended.sol @@ -20,12 +20,9 @@ library RONTransferHelperExtended { */ function safeUnwrapTokenAndTransfer(IWRON wron, address token, address payable to, uint256 amount) internal { if (token == address(wron)) { - // Check whether the recipient receives RON - if (RONTransferHelper.send(to, 0)) { - wron.withdraw(amount); - RONTransferHelper.safeTransfer(to, amount); - return; - } + wron.withdraw(amount); + RONTransferHelper.safeTransfer(to, amount); + return; } TransferHelper.safeTransfer(token, to, amount); @@ -48,12 +45,9 @@ library RONTransferHelperExtended { uint256 amount ) internal { if (token == address(wron)) { - // Check whether the recipient receives RON - if (RONTransferHelper.send(to, 0)) { - wron.approve(address(wronHelper), amount); - wronHelper.withdrawTo(to, amount); - return; - } + wron.approve(address(wronHelper), amount); + wronHelper.withdrawTo(to, amount); + return; } TransferHelper.safeTransfer(token, to, amount); @@ -74,13 +68,10 @@ library RONTransferHelperExtended { internal { if (token == address(wron)) { - // Check whether the recipient receives RON - if (RONTransferHelper.send(to, 0)) { - TransferFromHelper.safeTransferFrom(token, from, address(this), amount); - IWRON(wron).withdraw(amount); - RONTransferHelper.safeTransfer(to, amount); - return; - } + TransferFromHelper.safeTransferFrom(token, from, address(this), amount); + IWRON(wron).withdraw(amount); + RONTransferHelper.safeTransfer(to, amount); + return; } TransferFromHelper.safeTransferFrom(token, from, to, amount); @@ -104,13 +95,10 @@ library RONTransferHelperExtended { uint256 amount ) internal { if (token == address(wron)) { - // Check whether the recipient receives RON - if (RONTransferHelper.send(to, 0)) { - TransferFromHelper.safeTransferFrom(token, from, address(this), amount); - wron.approve(address(wronHelper), amount); - wronHelper.withdrawTo(to, amount); - return; - } + TransferFromHelper.safeTransferFrom(token, from, address(this), amount); + wron.approve(address(wronHelper), amount); + wronHelper.withdrawTo(to, amount); + return; } TransferFromHelper.safeTransferFrom(token, from, to, amount);