View Functions & Getters

Read‑only on‑chain methods for inspecting THLP state, NAV, and in‑flight deposits/withdrawals.


Key On‑Chain State

vaultaddress

Underlying Hyperliquid vault address.

totalDepositsuint256

Sum of all users’ net deposits (μ‑USDC).

perfFeeBpsuint16

Performance fee rate in basis points (100 = 1%).

head, tailuint16

`head` = oldest live bucket index; `tail` = next free slot in the 4 096‑ring.

totalAssets

Compute total vault equity (μ‑USDC) across all unlocked & locked buckets.

totalAssets.sol
function totalAssets() public view returns (uint256 eq)
  • Scans from `head` to `tail`, summing each bucket’s CoreReaderLib.readUserVaultEquity(...).equity.
  • Returns the aggregate in μ‑USDC units.

convertToAssets

How many μ‑USDC back `shares` of tHLP are worth (i.e. NAV × shares).

convertToAssets.sol
function convertToAssets(uint256 shares) public view returns (uint256)
  • If `totalSupply == 0`, returns `shares` (1 share = 1 μ‑USDC).
  • Else = `shares * totalAssets() / totalSupply()`.

convertToShares

How many tHLP shares you’d receive for `assets` μ‑USDC deposit.

convertToShares.sol
function convertToShares(uint256 assets) public view returns (uint256)
  • If `totalAssets() == 0`, returns `assets` (1 asset = 1 share).
  • Else = `assets * totalSupply() / totalAssets()`.

dep

Your in‑flight deposit state.

dep.sol
function dep(address user) public view returns (uint64 amt, uint64 collateral, uint256 preEq, uint32 tokenId, address helper, DepStage st)
  • `amt` = net USDC bridged (μ‑units), `collateral` = original collateral (μ‑units),
  • `preEq` = vault equity snapshot before bucket enqueue, `st` = NONE/BRIDGED/FINALIZED.

wdr

Your in‑flight withdrawal state.

wdr.sol
function wdr(address user) public view returns (uint64 usd, uint256 preEq, WdrStage st)
  • `usd` = amount to redeem (μ‑USDC), `preEq` = vault equity snapshot before burn,
  • `st` = NONE/REQUESTED/BRIDGED.

Why use these?

  • totalAssets() and convertToAssets/convertToShares let front‑ends display up‑to‑date NAV and deposit–mint ratios.
  • dep() and wdr() let you build UI showing “pending” order status, refund eligibility, or re‑entrancy guards.
  • head/ tail are useful for off‑chain monitoring and analytics of bucket health.