Skip to content

Latest commit

 

History

History
19 lines (18 loc) · 684 Bytes

ERC20 approve() race condition.md

File metadata and controls

19 lines (18 loc) · 684 Bytes

Use safeIncreaseAllowance() and safeDecreaseAllowance() from OpenZeppelin’s SafeERC20 implementation to prevent race conditions from manipulating the allowance amounts. (see here)


Slide Screenshot

022.jpg


Slide Text

  • ERC20 approve() -> Race-condition
  • approve(100) -> approve(50)
  • Allowance Decrease
    • Front-run -> Spend 150
  • increaseAllowance()
  • decreaseAllowance()

References


Tags