diff --git a/contracts/asset-proxy/contracts/src/bridges/Eth2DaiBridge.sol b/contracts/asset-proxy/contracts/src/bridges/Eth2DaiBridge.sol index d95f57a856..28be6df443 100644 --- a/contracts/asset-proxy/contracts/src/bridges/Eth2DaiBridge.sol +++ b/contracts/asset-proxy/contracts/src/bridges/Eth2DaiBridge.sol @@ -33,9 +33,6 @@ contract Eth2DaiBridge is /* Mainnet addresses */ address constant public ETH2DAI_ADDRESS = 0x39755357759cE0d7f32dC8dC45414CCa409AE24e; - /// @dev Whether we've granted an allowance to a spender for a token. - mapping (address => mapping (address => bool)) private _hasAllowance; - /// @dev Callback for `IERC20Bridge`. Tries to buy `amount` of /// `toTokenAddress` tokens by selling the entirety of the opposing asset /// (DAI or WETH) to the Eth2Dai contract, then transfers the bought @@ -98,8 +95,7 @@ contract Eth2DaiBridge is return IEth2Dai(ETH2DAI_ADDRESS); } - /// @dev Grants an unlimited allowance to `spender` for `tokenAddress` token, - /// if we haven't done so already. + /// @dev Grants an unlimited allowance to `spender` for `tokenAddress` token. /// @param spender The spender address. /// @param tokenAddress The token address. function _grantAllowanceForToken( @@ -108,11 +104,7 @@ contract Eth2DaiBridge is ) private { - mapping (address => bool) storage spenderHasAllowance = _hasAllowance[spender]; - if (!spenderHasAllowance[tokenAddress]) { - spenderHasAllowance[tokenAddress] = true; - IERC20Token(tokenAddress).approve(spender, uint256(-1)); - } + IERC20Token(tokenAddress).approve(spender, uint256(-1)); } /// @dev Permissively transfers an ERC20 token that may not adhere to diff --git a/contracts/asset-proxy/test/eth2dai_bridge.ts b/contracts/asset-proxy/test/eth2dai_bridge.ts index 5f24e29596..f8958a00ef 100644 --- a/contracts/asset-proxy/test/eth2dai_bridge.ts +++ b/contracts/asset-proxy/test/eth2dai_bridge.ts @@ -154,16 +154,6 @@ blockchainTests.resets('Eth2DaiBridge unit tests', env => { expect(approvals[0].allowance).to.bignumber.eq(constants.MAX_UINT256); }); - it('does not set an unlimited allowance on the `fromTokenAddress` token if already set', async () => { - const { opts } = await withdrawToAsync(); - const { logs } = await withdrawToAsync({ fromTokenAddress: opts.fromTokenAddress }); - const approvals = filterLogsToArguments( - logs, - TestEth2DaiBridgeEvents.TokenApprove, - ); - expect(approvals.length).to.eq(0); - }); - it('transfers filled amount to `to`', async () => { const { opts, logs } = await withdrawToAsync(); const transfers = filterLogsToArguments(