OrderBook

First Flight #43
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

[L-4] Lack of Events and Logging on Admin Functions and Risky Transfers


Description

Several state-changing admin or fund-related functions do not emit events, which breaks transparency and observability for off-chain systems, including:
-> withdrawFees() — emits FeesWithdrawn, but not in case of error (e.g., if totalFees == 0)
-> emergencyWithdrawERC20() — lacks any pre-check logging
-> setAllowedSellToken() — emits event, but missing safety checks
-> Failed or reverted token transfers are not gracefully handled/logged
Lack of events reduces debuggability, weakens audit trails, and makes it harder for subgraphs, indexers, or UIs to react to protocol changes.

Risk

Impact:

1. Transparency loss: No visibility when important actions (e.g., fee withdrawal, emergency withdrawal) succeed or fail.
2. Reduced traceability: Off-chain dashboards and explorers can't verify when or why certain actions were taken.
3. Missed alerts: Emergency use functions could be silently misused or fail without any log.

Proof of Concept

Call following:
```javascript
orderBook.emergencyWithdrawERC20(randomToken, 10_000e18, maliciousAddress);
```
Even if this call succeeds or fails, no event is emittedso neither the user nor protocol governors can track what was withdrawn, and no historical record is created on-chain for transparency.
Same as:
```javascript
orderBook.withdrawFees(zeroAddress); // fails silently without emitting
```

Recommended Mitigation

Emit clear events for all admin operations:
```javascript
event FeeWithdrawalAttempt(address to, uint256 amount, bool success);
event EmergencyWithdrawAttempt(address token, uint256 amount, address receiver, bool success);
```
Use try-catch for non-core tokens in `emergencyWithdrawERC20()` if interacting with nonstandard ERC20s.
Ensure events are emitted for:
=> All successful admin actions
=> All failed/cancelled admin actions.
Updates

Lead Judging Commences

yeahchibyke Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

Poor event indexing and asset token symbol not displayed

Events not properly indexed. Filtering and querying from analytic tools will be very in-efficient

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.