OrderBook

First Flight #43
Beginner FriendlySolidity
100 EXP
Submission Details
Impact: low
Likelihood: low
Invalid

the allowed tokens like weth, wbtc,wsol are stored like individual variables in the ```constructor``` which is not scalable and Repetitive boilerplate logic, Can’t loop through them efficiently

Author Revealed upon completion

Root + Impact

Description

  • Not scalable (what if you add 10 tokens?)

  • Repetitive boilerplate logic

  • Can’t loop through them efficiently

// Root cause in the codebase with @> marks to highlight the relevant section

Risk

Likelihood:

  • Reason 1 // Describe WHEN this will occur (avoid using "if" statements)

  • Reason 2

Impact:

  • Impact 1

  • Impact 2

Proof of Concept

constructor(address _weth, address _wbtc, address _wsol, address _usdc, address _owner) Ownable(_owner) {

Recommended Mitigation

- constructor(address _weth, address _wbtc, address _wsol, address _usdc, address _owner) Ownable(_owner) {
+ address[] public supportedTokens;
+mapping(string => address) public tokens; // e.g., tokens["weth"]
Updates

Lead Judging Commences

yeahchibyke Lead Judge about 5 hours ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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