Skip to content

Commit

Permalink
Fix bLUSD LP withdrawal sandwich attack
Browse files Browse the repository at this point in the history
  • Loading branch information
edmulraney committed Mar 12, 2023
1 parent aeff38e commit 1ec07b8
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,28 @@ export const WithdrawPane: React.FC = () => {

const handleConfirmPressed = () => {
if (output === "both") {
const minBLusdAmount = withdrawal.get(BLusdAmmTokenIndex.BLUSD);
const minLusdAmount = withdrawal.get(BLusdAmmTokenIndex.LUSD);

if (minBLusdAmount === undefined || minBLusdAmount === Decimal.ZERO) return;
if (minLusdAmount === undefined || minLusdAmount === Decimal.ZERO) return;

dispatchEvent("CONFIRM_PRESSED", {
action: "removeLiquidity",
burnLpTokens,
minBLusdAmount: Decimal.ZERO, // TODO
minLusdAmount: Decimal.ZERO // TODO
minBLusdAmount,
minLusdAmount
});
} else {
const minAmount = withdrawal.get(output);

if (minAmount === undefined || minAmount === Decimal.ZERO) return;

dispatchEvent("CONFIRM_PRESSED", {
action: "removeLiquidityOneCoin",
burnLpTokens,
output,
minAmount: Decimal.ZERO // TODO
minAmount
});
}
};
Expand Down

0 comments on commit 1ec07b8

Please sign in to comment.