Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions contracts/vault/Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ abstract contract Vault is
{
uint256 fee;
(amountOut, fee) = getBurnAmount(_asset, _amountIn);

_burn(msg.sender, _amountIn);

divest(_asset, amountOut + fee);

VaultLogic.burn(
getVaultStorage(),
MintBurnParams({
Expand All @@ -74,7 +78,6 @@ abstract contract Vault is
fee: fee
})
);
_burn(msg.sender, _amountIn);
}

/// @inheritdoc IVault
Expand All @@ -85,12 +88,15 @@ abstract contract Vault is
{
uint256[] memory fees;
(amountsOut, fees) = getRedeemAmount(_amountIn);

_burn(msg.sender, _amountIn);

uint256[] memory totalDivestAmounts = new uint256[](amountsOut.length);
for (uint256 i; i < amountsOut.length; i++) {
totalDivestAmounts[i] = amountsOut[i] + fees[i];
}

divestMany(assets(), totalDivestAmounts);

VaultLogic.redeem(
getVaultStorage(),
RedeemParams({
Expand All @@ -102,7 +108,6 @@ abstract contract Vault is
fees: fees
})
);
_burn(msg.sender, _amountIn);
}

/// @inheritdoc IVault
Expand Down