OrderBook

First Flight #43
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

`OrderBook` Hardcoded Token Addresses in the `Constructor` Create Permanent Contract Obsolescence Risk

Root + Impact

Description

The smart contract hardcodes critical token addresses `(WETH, WBTC, WSOL, USDC)` directly in the constructor without any upgrade mechanism. This creates an immutable dependency on specific token contract implementations that may become deprecated, migrated, or obsolete over time. Given that the contract has no upgradeability mechanisms, any changes to these token contracts in the broader ecosystem will permanently strand user funds and render the contract unusable.
@> constructor(
address _weth,
address _wbtc,
address _wsol,
address _usdc,
address _owner
) Ownable(_owner) {
//rest of function
}

Risk

Likelihood:

Historical precedent: USDC has migrated contract addresses multiple times, and other major tokens have undergone similar transitions.

Impact:

- HIGH SEVERITY: Permanent contract death with no recovery mechanism
- Fund Lock: User assets become permanently inaccessible if any referenced token migrates or is deprecated
- Business Continuity: Complete service disruption with no ability to adapt to ecosystem changes
- Regulatory Risk: Inability to comply with potential regulatory requirements for token updates
- User Trust: Catastrophic loss of user confidence and potential legal liability

Proof of Concept

// Current implementation - immutable token references
constructor(address _weth, address _wbtc, address _wsol, address _usdc, address _owner) {
iWETH = IERC20(_weth); // Permanent reference - cannot be updated
iWBTC = IERC20(_wbtc); // If WBTC migrates, contract becomes obsolete
iWSOL = IERC20(_wsol); // Wrapped SOL could change bridge implementations
iUSDC = IERC20(_usdc); // USDC has historically upgraded contracts
}
// Scenario: USDC migrates to new contract address
// Result: Contract still references old USDC, users cannot interact with new ecosystem
//

Recommended Mitigation

1. Implement Token Registry Pattern
```diff
+ mapping(bytes32 => address) public tokenAddresses;
// Replace `tokenSymbol` and `newAddress` with actual token symbol and new address respectively
+ function updateTokenAddress(bytes32 tokenSymbol, address newAddress) external onlyOwner {
+ require(newAddress != address(0), "Invalid address");
+ tokenAddresses[tokenSymbol] = newAddress;
+ emit TokenAddressUpdated(tokenSymbol, newAddress);
+}
```
2 Implement Upgradeable Proxy Pattern
- Use OpenZeppelin's upgradeable contracts
- Implement proper upgrade governance with timelock
- Maintain storage layout compatibility
Updates

Lead Judging Commences

yeahchibyke Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Appeal created

prevrandoah Submitter
4 months ago
yeahchibyke Lead Judge
4 months ago
prevrandoah Submitter
4 months ago
yeahchibyke Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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