Epoch Stake Auction

The Epoch Stake Auction system allows users to participate in stake auctions by placing bids for staking rights. This section details the core components and their implementations.

Core Types and Interfaces

The auction system is built on several key types and interfaces that define the structure of bids and auction data.

The BidType type defines the two possible bid types:

// src/oada/actions.ts
// Defines the possible types of bids in the stake auction
// BidTypePartial: Allows partial filling of the bid
// BidTypeFull: Requires the entire bid to be filled or none at all
export type BidType = "BidTypePartial" | "BidTypeFull";

The StakeAuctionBidRequest interface defines the structure for submitting a bid:

// src/oada/actions.ts
// Interface for submitting a stake auction bid
// Contains all necessary information for placing a bid
type StakeAuctionBidRequest = {
  bidType: BidType; // Type of bid (partial or full)
  bidApy: Big; // Annual Percentage Yield in basis points
  bidValue: GYValueOut; // Value being bid (in ADA or OADA)
  stakeAddressBech32: string; // Stake address for rewards
};

The StakeAuctionBidView interface defines the structure for viewing bid information:

// src/oada/actions.ts
// Interface for viewing stake auction bid information
// Contains all relevant information about an existing bid
export type StakeAuctionBidView = {
  txOutRef: string; // Transaction reference
  assetClass: string; // Asset being bid (ADA or OADA)
  apy: number; // Annual Percentage Yield
  amount: number; // Bid amount
  ownerPkh: string; // Public key hash of bid owner
  bidType: BidType; // Type of bid
  stakeAddressBech32: string; // Stake address for rewards
};

The BidView interface defines the structure for displaying bid information in the UI:

// src/oada/view.ts
// Interface for displaying bid information in the UI
// Contains formatted values for user display
export type BidView = {
  id: string; // Unique identifier for the bid
  asset: string; // Asset type (ADA or OADA)
  apy: string; // Formatted APY with % symbol
  amount: number; // Raw bid amount
  amountFormatted: string; // Formatted bid amount with suffix
  requestedSizeFormatted: string; // Formatted requested stake size
  bidLock: string; // Formatted duration of bid lock period
};

Key features of the Epoch Stake Auction system include:

  1. Bid Types

    • Partial fill bids that can be filled in portions

    • Full fill bids that must be filled entirely or not at all

  2. Bid Calculation

    • Dynamic APY calculation based on market conditions

    • Requested stake size calculation based on bid amount and APY

    • Clearing rate determination through binary search

  3. Bid Management

    • Place new bids with specified amounts and APY

    • Cancel existing bids

    • Track bid status and history

  4. Market Interface

    • Real-time order book display

    • Market and limit order types

    • Currency selection (ADA or OADA)

    • Bid adjustment capabilities

  5. Dashboard Features

    • Current auction statistics

    • Bid distribution visualization

    • APY range display

    • Volume tracking

The system provides a comprehensive interface for users to participate in stake auctions, with support for various bid types and real-time market information.

Last updated