rename _transferEthRefund -> _unwrapAndTransferEth

This commit is contained in:
Michael Zhu
2020-02-03 16:32:07 -08:00
parent d82f34fe59
commit 0691cc7909
3 changed files with 13 additions and 13 deletions

View File

@@ -218,7 +218,7 @@ contract Broker is
} }
// Refund remaining ETH to msg.sender. // Refund remaining ETH to msg.sender.
_transferEthRefund(WETH.balanceOf(address(this))); _unwrapAndTransferEth(WETH.balanceOf(address(this)));
_clearStorage(); _clearStorage();
@@ -297,7 +297,7 @@ contract Broker is
} }
// Refund remaining ETH to msg.sender. // Refund remaining ETH to msg.sender.
_transferEthRefund(WETH.balanceOf(address(this))); _unwrapAndTransferEth(WETH.balanceOf(address(this)));
_clearStorage(); _clearStorage();

View File

@@ -61,7 +61,7 @@ contract Forwarder is
_exchangeV2 _exchangeV2
) )
{} // solhint-disable-line no-empty-blocks {} // solhint-disable-line no-empty-blocks
/// @dev Withdraws assets from this contract. It may be used by the owner to withdraw assets /// @dev Withdraws assets from this contract. It may be used by the owner to withdraw assets
/// that were accidentally sent to this contract. /// that were accidentally sent to this contract.
/// @param assetData Byte array encoded for the respective asset proxy. /// @param assetData Byte array encoded for the respective asset proxy.
@@ -148,7 +148,7 @@ contract Forwarder is
wethRemaining = wethRemaining.safeSub(wethSpentAmount); wethRemaining = wethRemaining.safeSub(wethSpentAmount);
// Refund remaining ETH to msg.sender. // Refund remaining ETH to msg.sender.
_transferEthRefund(wethRemaining); _unwrapAndTransferEth(wethRemaining);
} }
/// @dev Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction. /// @dev Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction.
@@ -204,6 +204,6 @@ contract Forwarder is
wethRemaining = wethRemaining.safeSub(wethSpentAmount); wethRemaining = wethRemaining.safeSub(wethSpentAmount);
// Refund remaining ETH to msg.sender. // Refund remaining ETH to msg.sender.
_transferEthRefund(wethRemaining); _unwrapAndTransferEth(wethRemaining);
} }
} }

View File

@@ -117,19 +117,19 @@ contract MixinWethUtils {
return ethRemaining; return ethRemaining;
} }
/// @dev Unwraps and refunds WETH to msg.sender. /// @dev Unwraps WETH and transfers ETH to msg.sender.
/// @param refundAmount Amount of WETH balance to refund. /// @param transferAmount Amount of WETH balance to unwrap and transfer.
function _transferEthRefund( function _unwrapAndTransferEth(
uint256 refundAmount uint256 transferAmount
) )
internal internal
{ {
// Do nothing if no WETH to refund // Do nothing if amount is zero
if (refundAmount > 0) { if (transferAmount > 0) {
// Convert WETH to ETH // Convert WETH to ETH
WETH.withdraw(refundAmount); WETH.withdraw(transferAmount);
// Transfer ETH to sender // Transfer ETH to sender
msg.sender.transfer(refundAmount); msg.sender.transfer(transferAmount);
} }
} }
} }