@0x/contracts-asset-proxy
: Inline _grantAllowances()
in Eth2DaiBridge
.
This commit is contained in:
parent
4098238019
commit
d15f4de4ae
@ -57,7 +57,7 @@ contract Eth2DaiBridge is
|
|||||||
|
|
||||||
IEth2Dai exchange = _getEth2DaiContract();
|
IEth2Dai exchange = _getEth2DaiContract();
|
||||||
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
|
// 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.
|
// Try to sell all of this contract's `fromTokenAddress` token balance.
|
||||||
uint256 boughtAmount = _getEth2DaiContract().sellAllAmount(
|
uint256 boughtAmount = _getEth2DaiContract().sellAllAmount(
|
||||||
@ -95,18 +95,6 @@ contract Eth2DaiBridge is
|
|||||||
return IEth2Dai(ETH2DAI_ADDRESS);
|
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
|
/// @dev Permissively transfers an ERC20 token that may not adhere to
|
||||||
/// specs.
|
/// specs.
|
||||||
/// @param tokenAddress The token contract address.
|
/// @param tokenAddress The token contract address.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user