Skip to content

Instantly share code, notes, and snippets.

1. Re-entrancy Vulnerability (Critical)
In sellOption function of contract, the code allows a user to reenter into contract before the state is modified.
```javascript
IERC721(market).safeTransferFrom(msg.sender, order.maker, optionId);
IERC20(weth).safeTransferFrom(order.maker, msg.sender, saleProceeds);
IERC20(weth).safeTransferFrom(order.maker, feeRecipient, ask - saleProceeds);
```
Fix: Update state before doing any transfers.
```javascript