Data Structures
Key data structures used in the AgoráX smart contract and frontend.
OrderStatus Enum
Represents the current state of an order.
enum OrderStatus {
Active = 0, // Order is open (includes expired orders not yet cancelled)
Cancelled = 1, // Order was cancelled by owner
Completed = 2 // Order was fully filled
}0 = Active
1 = Cancelled
2 = Completed
OrderDetails Struct (Solidity)
Core structure for storing order information on-chain.
struct OrderDetails {
address sellToken; // Token being sold
uint256 sellAmount; // Total amount to sell
uint256[] buyTokensIndex; // Indices into whitelist
uint256[] buyAmounts; // Required amounts per buy token
uint64 expirationTime; // Unix timestamp
bool allOrNothing; // Must fill 100% at once
}OrderDetailsWithID Struct
Extended order information returned by view functions.
struct OrderDetailsWithID {
uint256 orderID; // Unique order identifier
uint256 remainingSellAmount; // Unfilled sell tokens
uint256 redeemedSellAmount; // Proceeds already claimed
uint64 lastUpdateTime; // Most recent update timestamp (triggers cooldown)
OrderStatus status; // Active, Cancelled, or Completed
uint256 creationProtocolFee; // Protocol fee at time of order creation
OrderDetails orderDetails; // Core order data
}Frontend TypeScript Types
CompleteOrderDetails
Full order data as used in the React frontend.
interface CompleteOrderDetails {
userDetails: UserOrderDetails;
orderDetailsWithID: {
orderID: bigint;
remainingSellAmount: bigint;
redeemedSellAmount: bigint;
lastUpdateTime: number;
status: number;
creationProtocolFee: bigint;
orderDetails: {
sellToken: `0x${string}`;
sellAmount: bigint;
buyTokensIndex: readonly bigint[];
buyAmounts: readonly bigint[];
expirationTime: bigint;
allOrNothing: boolean;
};
};
}TokenConstant
Token configuration from the constants file.
interface TokenConstant {
t: string; // Full name (e.g., "PulseChain")
ticker: string; // Symbol (e.g., "PLS")
a?: string; // Contract address (undefined for native)
d: number; // Decimals (usually 18)
dexs?: string[]; // DEX pair addresses for pricing
logoFormat?: string;// "svg" | "png" | "webp"
}Whitelist Token
Token data returned from the contract whitelist.
interface WhitelistToken {
tokenAddress: `0x${string}`;
isActive: boolean;
whitelistIndex: bigint;
}Filter State (URL Params)
Filter configuration stored in URL query parameters.
interface FilterState {
searchQuery: string; // order-id | seller | ticker
status: 'active' | 'expired' | 'completed' | 'cancelled';
dateFilter: '1h' | '12h' | '24h' | '7d' | '30d' | '90d' | '180d' | 'custom' | null;
customDateStart: number | null; // Unix timestamp
customDateEnd: number | null; // Unix timestamp
aonFilter: boolean; // All-or-nothing only
dustFilter: string | null; // Min USD value
claimableFilter: boolean; // Has claimable proceeds
fillRange: [number, number]; // 0-100 % filled
positionRange: [number, number]; // -100 to +100 limit position
}