Skip to content

[FEATURE]: Establish Base Frontend Architecture & Protocol Integration Layer #2

Description

@dhruvi-16-me

Feature and its Use Cases

Body

Motivation

Windmill is not a traditional static-price order book. Orders define time-dependent price functions and matching is lazy (transaction-triggered).

Before building UI components, we should define:

  • Frontend architecture
  • Contract interaction layer
  • Real-time price evaluation strategy
  • Deterministic trade preview model

This prevents UI assumptions that conflict with protocol mechanics.

Scope of Initial Frontend Setup

1️⃣ Project Structure

Proposed structure:

src/
  components/
  pages/
  hooks/
  services/
    contracts/
    pricing/
  utils/

2️⃣ Contract Integration Layer

Create a dedicated contract service layer responsible for:

  • Reading order data
  • Evaluating price at current timestamp
  • Estimating trade outcomes
  • Preparing transaction calls

UI components should not directly handle contract logic.


3️⃣ Time-Dependent Price Evaluation

Frontend must evaluate:

P(t_now) = startPrice + slope * (t_now - startTime)

using latest block timestamp (not local clock if possible).

Display:

  • Current evaluated price
  • Remaining amount
  • Price trajectory (optional visual)

This is not a static order table.

4️⃣ Deterministic Trade Preview

Before calling matchOrders, UI should:

  • Compute buyPrice(t_now)
  • Compute sellPrice(t_now)
  • Verify match condition locally
  • Show expected settlement amount

This ensures user understands execution outcome.

Deliverable

  • Clean React/Vite/Next setup (depending on stack)
  • Wallet connection (e.g., wagmi / ethers)
  • Contract read/write layer
  • Basic order display
  • Basic trade preview logic

Goal

Create a frontend foundation that correctly reflects:

  • Lazy execution model
  • Time-dependent pricing
  • Deterministic settlement

Before adding visual complexity.

Additional Context

No response

Code of Conduct

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions