Skip to content

Commit

Permalink
Fix Vault router module
Browse files Browse the repository at this point in the history
  • Loading branch information
JetJadeja committed Mar 18, 2022
1 parent e7fef16 commit deccaff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/modules/VaultRouterModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ contract VaultRouterModule {
ERC20(vault).safeTransferFrom(msg.sender, address(this), rvTokenAmount);

// Withdraw from the Vault.
vault.withdraw(underlyingAmount);
vault.withdraw(underlyingAmount, address(this), address(this));

// Unwrap the withdrawn amount of WETH and transfer it to the caller.
unwrapAndTransfer(WETH(payable(address(vault.UNDERLYING()))), underlyingAmount);
Expand Down Expand Up @@ -144,7 +144,7 @@ contract VaultRouterModule {
permitAndTransferFromCaller(vault, rvTokenAmount, deadline, v, r, s);

// Withdraw from the Vault.
vault.withdraw(underlyingAmount);
vault.withdraw(underlyingAmount, address(this), address(this));

// Unwrap the withdrawn amount of WETH and transfer it to the caller.
unwrapAndTransfer(WETH(payable(address(vault.UNDERLYING()))), underlyingAmount);
Expand All @@ -165,7 +165,7 @@ contract VaultRouterModule {
ERC20(vault).safeTransferFrom(msg.sender, address(this), rvTokenAmount);

// Redeem the rvTokens.
vault.redeem(rvTokenAmount);
vault.redeem(rvTokenAmount, address(this), address(this));

// Get the Vault's underlying as WETH.
WETH weth = WETH(payable(address(vault.UNDERLYING())));
Expand Down Expand Up @@ -196,7 +196,7 @@ contract VaultRouterModule {
permitAndTransferFromCaller(vault, rvTokenAmount, deadline, v, r, s);

// Redeem the rvTokens.
vault.redeem(rvTokenAmount);
vault.redeem(rvTokenAmount, address(this), address(this));

// Get the Vault's underlying as WETH.
WETH weth = WETH(payable(address(vault.UNDERLYING())));
Expand Down Expand Up @@ -238,7 +238,7 @@ contract VaultRouterModule {
underlying.safeApprove(address(vault), amount);

// Deposit the underlying tokens into the Vault.
vault.deposit(amount);
vault.deposit(amount, address(this));

// Transfer the newly minted rvTokens back to the caller.
ERC20(vault).safeTransfer(msg.sender, vault.balanceOf(address(this)));
Expand Down

0 comments on commit deccaff

Please sign in to comment.