@0x/contracts-asset-proxy: Inline _grantAllowances() in Eth2DaiBridge.

This commit is contained in:
Lawrence Forman 2019-10-01 19:17:12 -07:00
parent 4098238019
commit d15f4de4ae

View File

@ -57,7 +57,7 @@ contract Eth2DaiBridge is
IEth2Dai exchange = _getEth2DaiContract();
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
_grantAllowanceForToken(address(exchange), fromTokenAddress);
IERC20Token(fromTokenAddress).approve(address(exchange), uint256(-1));
// Try to sell all of this contract's `fromTokenAddress` token balance.
uint256 boughtAmount = _getEth2DaiContract().sellAllAmount(
@ -95,18 +95,6 @@ contract Eth2DaiBridge is
return IEth2Dai(ETH2DAI_ADDRESS);
}
/// @dev Grants an unlimited allowance to `spender` for `tokenAddress` token.
/// @param spender The spender address.
/// @param tokenAddress The token address.
function _grantAllowanceForToken(
address spender,
address tokenAddress
)
private
{
IERC20Token(tokenAddress).approve(spender, uint256(-1));
}
/// @dev Permissively transfers an ERC20 token that may not adhere to
/// specs.
/// @param tokenAddress The token contract address.