Skip to content

Commit

Permalink
chore: use max redeem
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Aug 21, 2023
1 parent d48b460 commit 551e554
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/VaultV3.vy
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ interface IStrategy:
def convertToAssets(shares: uint256) -> uint256: view
def convertToShares(assets: uint256) -> uint256: view
def previewWithdraw(assets: uint256) -> uint256: view
def maxRedeem(owner: address) -> uint256: view

interface IAccountant:
def report(strategy: address, gain: uint256, loss: uint256) -> (uint256, uint256): nonpayable
Expand Down Expand Up @@ -653,7 +654,7 @@ def _withdraw_from_strategy(strategy: address, assets_to_withdraw: uint256):
# Use previewWithdraw since it should round up.
IStrategy(strategy).previewWithdraw(assets_to_withdraw),
# And check against our actual balance.
IStrategy(strategy).balanceOf(self)
IStrategy(strategy).maxRedeem(self)
)
# Redeem the shares.
IStrategy(strategy).redeem(shares_to_redeem, self, self)
Expand Down

0 comments on commit 551e554

Please sign in to comment.