👷 Update after review

This commit is contained in:
Thomas Bouder 2021-09-07 13:31:24 +02:00
parent 90b0a62f47
commit bc80d780ec
No known key found for this signature in database
GPG Key ID: 46DDE658A384B046
2 changed files with 4 additions and 8 deletions

View File

@ -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;
}

View File

@ -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]
}
]