Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BorrowingVault withdraw paused blocks liquidations #579

Open
0xdcota opened this issue Jun 5, 2023 · 0 comments
Open

BorrowingVault withdraw paused blocks liquidations #579

0xdcota opened this issue Jun 5, 2023 · 0 comments
Assignees

Comments

@0xdcota
Copy link
Contributor

0xdcota commented Jun 5, 2023

In the BorrowingVault during the liquidate() call, we check that gainedShares are not more than the liquiated owner existing shares.
However, in case vault's withdrawals are paused, the existingShares will return zero.

uint256 gainedAssets = Math.mulDiv(debtToCover, 10 ** _asset.decimals(), discountedPrice);
gainedShares = convertToShares(gainedAssets);
_payback(caller, owner, debtToCover, debtSharesToCover);
// Ensure liquidator receives no more shares than 'owner' owns.
uint256 existingShares = maxRedeem(owner);
if (gainedShares > existingShares) {
gainedShares = existingShares;
}

function maxRedeem(address owner) public view override returns (uint256) {
if (paused(VaultActions.Withdraw)) {
return 0;
}
return convertToShares(maxWithdraw(owner));
}

@0xdcota 0xdcota self-assigned this Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant