Skip to content

Commit

Permalink
Merge pull request #47 from axieinfinity/release/v0.1.1
Browse files Browse the repository at this point in the history
Release/v0.1.1
  • Loading branch information
TuDo1403 authored Mar 19, 2024
2 parents 9870510 + ef0f90d commit 07d4305
Showing 1 changed file with 14 additions and 26 deletions.
40 changes: 14 additions & 26 deletions src/legacy/transfers/RONTransferHelperExtended.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 07d4305

Please sign in to comment.