Skip to content

Commit

Permalink
Fail with SafeErc20FailedDecreaseAllowance on failing to decrease all…
Browse files Browse the repository at this point in the history
…owance
  • Loading branch information
0xNeshi committed Sep 30, 2024
1 parent a7dd96d commit bc7dc15
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/src/token/erc20/utils/safe_erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ impl SafeErc20 {
})?;

if current_allowance < requested_decrease {
return Err(Error::SafeErc20FailedOperation(
SafeErc20FailedOperation { token },
return Err(Error::SafeErc20FailedDecreaseAllowance(
SafeErc20FailedDecreaseAllowance {
spender,
currentAllowance: current_allowance,
requestedDecrease: requested_decrease,
},
));
}

Expand Down

0 comments on commit bc7dc15

Please sign in to comment.