Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

aHYPESeat core logic

Fee Model

Fees scale linearly with utilization:

utilization = occupiedSeats / maxSeats
 
feePerSecond = minFeePerSecond + (maxFeePerSecond - minFeePerSecond) × utilization

Example Fee Calculation

UtilizationMin Fee (APR)Max Fee (APR)Effective Fee
0%10%100%10%
50%10%100%55%
100%10%100%100%

Fees accrue continuously per second and are tracked via a global cumulative index.

Debt Accounting

Global Index

cumulativeFeePerSeat += feePerSecond × timeDelta

The global index grows every second based on current utilization.

Per-User Tracking

Each user stores a snapshot of the cumulative index when they join or settle:

userDebt = settledDebt + (currentIndex - userSnapshot)

This allows O(1) debt calculation without iterating over time periods.

Health System

A position is healthy when:

collateral >= debt
ConditionStatusActions Available
collateral >= debtHealthyWithdraw excess, add collateral, repay
collateral < debtUnhealthyCan be liquidated by anyone

Access Gating

Backend systems use isActive(user) for access control:

  • Returns true if user has a seat AND position is healthy
  • Returns false otherwise

Liquidation (Kick)

When a position becomes unhealthy (debt > collateral), anyone can liquidate:

kick(unhealthyUser)
Liquidation Process:
  1. Seat is revoked and removed from holder list
  2. Position cleared (collateral, debt, snapshot reset)
  3. Collateral seized and distributed as fees
Fee Distribution:
  • (100% - burnBps%) sent to feeRecipient
  • burnBps% burned (removed from circulation)

Parameters

ParameterTypeDescription
maxSeatsuint256Maximum concurrent seat holders
minFeePerSeconduint256Minimum fee rate (WAD, 1e18 = 100%)
maxFeePerSeconduint256Maximum fee rate at 100% utilization
feeRecipientaddressAddress receiving non-burned fees
burnBpsuint256Basis points of fees to burn (0-10000)

Storage Layout

Position Struct

struct Position {
    bool hasSeat;               // Whether user holds a seat
    uint256 collateral;         // aHYPE locked as collateral
    uint256 settledDebt;        // Crystallized debt amount
    uint256 feeIndexSnapshot;   // cumulativeFeePerSeat at join/settle
}

State Variables

VariableTypeDescription
HYPEIERC20aHYPE token contract (immutable)
maxSeatsuint256Maximum seats available
occupiedSeatsuint256Current number of occupied seats
cumulativeFeePerSeatuint256Global fee accumulator (WAD)
lastAccrualTimeuint256Timestamp of last fee accrual
positionsmapping(address => Position)User positions
seatHoldersaddress[]Array of all seat holder addresses

Constants

uint256 constant WAD = 1e18;  // High-precision decimal (18 decimals)

User Lifecycle

Joining

1. User calls purchaseSeat(depositAmount)
   └── Must have >= minDepositForSeat() aHYPE
 
2. Transfer aHYPE to contract
   └── Sets collateral = depositAmount
 
3. Create seat
   └── hasSeat = true
   └── feeIndexSnapshot = cumulativeFeePerSeat
   └── Add to seatHolders array

Maintaining

While holding seat:
├── addCollateral(amount)     // Increase safety buffer
├── repayFees(amount)         // Reduce debt
├── withdrawCollateral(amount) // Remove excess (must stay healthy)
└── Monitor: debtValueOf(user) // Check current debt

Exiting

Voluntary exit:
└── User calls exit()
    ├── Settle debt from collateral
    ├── Return remaining collateral
    └── Remove from seatHolders
 
Forced exit (liquidation):
└── Anyone calls kick(user) when unhealthy
    ├── Seize all collateral
    ├── Distribute as fees (burn + recipient)
    └── Remove from seatHolders

Integration Guide

Checking Access

// For backend gating
if (seatMarket.isActive(user)) {
    // Grant access
} else {
    // Deny access
}

Getting All Active Seats

// Returns array of healthy seat holders
address[] memory activeUsers = seatMarket.getHealthySeats();

Monitoring Debt

// Get current debt including pending fees
uint256 debt = seatMarket.debtValueOf(user);
 
// Get position details
Position memory pos = seatMarket.positions(user);
uint256 collateral = pos.collateral;
 
// Health check
bool healthy = collateral >= debt;