From bc80d780eceb16c3ce84d4beb4897dc699c4135a Mon Sep 17 00:00:00 2001 From: Thomas Bouder Date: Tue, 7 Sep 2021 13:31:24 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Update=20after=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contracts/mainnet/connectors/yearn_v2/main.sol | 8 ++------ test/yearn/yearn.test.js | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/contracts/mainnet/connectors/yearn_v2/main.sol b/contracts/mainnet/connectors/yearn_v2/main.sol index d5f34517..e1d8343d 100644 --- a/contracts/mainnet/connectors/yearn_v2/main.sol +++ b/contracts/mainnet/connectors/yearn_v2/main.sol @@ -14,14 +14,12 @@ abstract contract YearnResolver is Events, Basic { /** * @dev Deposit funds in the vault, issuing shares to recipient. * @notice This will deposit funds to a specific Yearn Vault. - * @param token The address of the token to deposit. * @param vault The address of the vault to deposit funds into. * @param amt The amount of tokens to deposit. * @param getId ID to retrieve amt. * @param setId ID stores the amount of shares received. */ function deposit( - address token, address vault, uint256 amt, uint256 getId, @@ -31,16 +29,14 @@ abstract contract YearnResolver is Events, Basic { YearnV2Interface yearn = YearnV2Interface(vault); - bool isEth = token == ethAddr; address want = yearn.token(); - + bool isEth = want == ethAddr; TokenInterface tokenContract = TokenInterface(want); - if (isEth && want == wethAddr) { + if (isEth) { _amt = _amt == uint(-1) ? address(this).balance : _amt; convertEthToWeth(isEth, tokenContract, _amt); } else { - require(want == token, "incorrect token"); _amt = _amt == uint(-1) ? tokenContract.balanceOf(address(this)) : _amt; } diff --git a/test/yearn/yearn.test.js b/test/yearn/yearn.test.js index 3df70948..409161b0 100644 --- a/test/yearn/yearn.test.js +++ b/test/yearn/yearn.test.js @@ -97,7 +97,7 @@ describe("Yearn", function () { { connector: connectorName, method: "deposit", - args: [tokens.dai.address, DAI_VAULT, amount, 0, setId] + args: [DAI_VAULT, amount, 0, setId] }, { connector: connectorName, @@ -124,7 +124,7 @@ describe("Yearn", function () { { connector: connectorName, method: "deposit", - args: [tokens.dai.address, DAI_VAULT, amount, 0, setId] + args: [DAI_VAULT, amount, 0, setId] } ]