Skip to content

[FEATURE]: WEEK 2 #5

Description

@aniket866

Feature and its Use Cases

Issue Summary Table

ID Issue Name Description Target Files Complexity Priority
** 01** Batch Order Matching Allow keepers to match one large order against multiple smaller counter-orders in a single transaction to save gas. WindmillExchange.sol
IWindmillExchange.sol
Medium High
** 02** Native ETH Integration Support native ETH trading by wrapping deposited ETH into WETH and unwrapping WETH to ETH on withdrawal or settlement. WindmillExchange.sol
IWindmillExchange.sol
High High
** 03** Protocol Fees Introduce a customizable protocol fee collected to a treasury address, separate from the keeper execution incentive fee. WindmillExchange.sol
IWindmillExchange.sol
Medium Medium
** 04** Access & Pausing Safety Restructure permissioned actions, remove pausing constraints on cancellations, and implement safety caps on admin configurations. WindmillExchange.sol Low Medium

Technical Specifications

01: Batch Order Matching

  • Objective: Save gas and allow keepers to clear liquidity efficiently by matching a single primary order (either buy or sell) against an array of opposing counter-orders.
  • Implementation Plan:
    • Implement matchBatch(uint256 primaryOrderId, uint256[] calldata counterOrderIds, uint256 deadline).
    • Optimize storage writes by reading and updating the primary order once (or writing the updated state at the end of the loop).

02: Native ETH Integration

  • Objective: Native ETH deposits automatically wrap to WETH, and WETH unwraps back to native ETH on cancels or settlements.
  • Implementation Plan:
    • Represent native ETH using address(0).
    • Accept msg.value in createOrder when tokenIn == address(0). Wrap ETH using WETH.deposit{value: msg.value}().
    • During cancelOrder, if tokenIn == address(0), call WETH.withdraw(refund) and transfer native ETH back to the maker.
    • During matches, if the receiver expects address(0) as the output token, unwrap WETH and send native ETH instead of WETH.
    • Add receive() external payable {} to accept native ETH from the WETH contract.

03: Protocol Fees

04: Access & Pausing Safety

  • Objective: Guard against locked user funds and access control vulnerabilities.
  • Implementation Plan:
    • Remove whenNotPaused modifier from cancelOrder to ensure users can withdraw/cancel orders at any time.
    • Ensure all updates to treasury and fees emit explicit tracking events.
    • Validate inputs for all new admin settings (non-zero treasury address, fee ceilings).

Additional Context

N/A

Code of Conduct

  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions