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

aHYPE Contract Interface

Complete API reference for the AlphaHYPEManager contract.

Initialization

initialize

Initializes the upgradeable contract. Must be called immediately after deployment.

function initialize(address validator, uint64 hypeTokenIndex) external initializer
Parameters:
NameTypeDescription
validatoraddressTarget validator address for HYPE delegation
hypeTokenIndexuint64HYPE token index on Hyperliquid Spot

Access: Can only be called once during proxy deployment.


User Functions

receive (Deposit)

Deposit native HYPE to queue for αHYPE minting.

receive() external payable
Requirements:
  • msg.value >= minDepositAmount
  • msg.value must be a multiple of 10^10 wei (8-decimal alignment)
  • Deposit queue length < 100
  • If maxSupply > 0, minting must not exceed cap

Emits: DepositQueued(address indexed depositor, uint256 amount)


withdraw

Request withdrawal of αHYPE tokens for underlying HYPE.

function withdraw(uint256 amount) external nonReentrant
Parameters:
NameTypeDescription
amountuint256Amount of αHYPE to withdraw
Requirements:
  • Caller must have sufficient αHYPE balance
  • Withdrawal queue length < 100
Behavior:
  • Burns αHYPE immediately
  • Locks current exchange rate snapshot for slashing protection
  • Queues WithdrawalRequest for processing

Emits: WithdrawalQueued(address indexed withdrawer, uint256 wrappedAmount)


claimWithdrawal

Claim processed HYPE after withdrawal has been settled.

function claimWithdrawal() external nonReentrant
Requirements:
  • Caller must have non-zero owedUnderlyingAmounts[msg.sender]
Behavior:
  • Transfers owed HYPE to caller (scaled back to 18 decimals)
  • Zeros owed amount before transfer (reentrancy protection)

Emits: WithdrawalClaimed(address indexed withdrawer, uint256 amount)


Processing Functions

processQueues

Process pending deposits and withdrawals. Can be called once per block.

function processQueues() external nonReentrant
Access:
  • If processor is set: only callable by processor
  • If processor is zero address: callable by anyone
Requirements:
  • block.number > lastProcessedBlock
Behavior:
  1. Validates solvency against EVM holdings
  2. Reads HyperCore state (delegator summary, spot balance)
  3. Calculates deposit/withdrawal prices
  4. Processes deposit queue (mints αHYPE minus fee)
  5. Processes withdrawal queue when liquidity permits
  6. Balances liquidity across EVM/Spot/Staking

Emits: Multiple events depending on operations performed


Admin Functions

setMaxSupply

Set the maximum αHYPE supply cap.

function setMaxSupply(uint64 _maxSupply) external onlyOwner
Parameters:
NameTypeDescription
_maxSupplyuint64Maximum supply cap (0 = no cap)

Access: Owner only


setMinDepositAmount

Set the minimum deposit amount.

function setMinDepositAmount(uint256 _minDepositAmount) external onlyOwner
Parameters:
NameTypeDescription
_minDepositAmountuint256Minimum deposit in wei

Access: Owner only


setProcessor

Set the designated processor address.

function setProcessor(address _processor) external onlyOwner
Parameters:
NameTypeDescription
_processoraddressProcessor address (zero = permissionless)

Access: Owner only


collectFees

Withdraw accumulated protocol fees.

function collectFees() external onlyOwner nonReentrant
Behavior:
  • Transfers accumulated feeAmount to owner
  • Zeros feeAmount before transfer

Access: Owner only


View Functions

getERC20Supply

Get total αHYPE supply including queued withdrawals.

function getERC20Supply() public view returns (uint256)

Returns: totalSupply() + withdrawalAmount


getUnderlyingSupply

Get total HYPE backing available for price calculation.

function getUnderlyingSupply() public view returns (uint256)

Returns: Combined HYPE from:

  • EVM balance (scaled to 8 decimals)
  • Delegated stake
  • Undelegated stake
  • Pending withdrawals from staking
  • Spot holdings

Minus:

  • pendingDepositAmount
  • withdrawalAmount
  • feeAmount
  • owedUnderlyingAmount

decimals

Get token decimals.

function decimals() public pure override returns (uint8)

Returns: 8


pendingDepositQueueLength

Get number of pending deposits.

function pendingDepositQueueLength() external view returns (uint256)

Returns: Length of depositQueue


pendingWithdrawalQueueLength

Get number of pending withdrawals.

function pendingWithdrawalQueueLength() external view returns (uint256)

Returns: Length of pendingWithdrawalQueue


Inherited ERC20 Functions

Standard ERC20 functions inherited from OpenZeppelin:

FunctionDescription
name()Returns "Alpha HYPE"
symbol()Returns "αHYPE"
totalSupply()Total minted αHYPE
balanceOf(address)αHYPE balance of address
transfer(address, uint256)Transfer αHYPE
approve(address, uint256)Approve spender
transferFrom(address, address, uint256)Transfer from approved
allowance(address, address)Check allowance
burn(uint256)Burn own αHYPE
burnFrom(address, uint256)Burn from approved

Error Conditions

ErrorCondition
InvalidDepositAmountDeposit below minimum or not aligned
QueueFullQueue exceeds 100 entries
MaxSupplyExceededMinting would exceed supply cap
InsufficientBalanceCaller lacks αHYPE for withdrawal
NothingToClaimNo owed HYPE to claim
AlreadyProcessedQueue already processed this block
UnauthorizedProcessorNon-processor called processQueues