# Tokos Rates

Hyperliquid funding, as a rate you can trade. Fixed-for-floating swaps on the hourly funding of HyperCore perps (HYPE, BTC, ETH), settled in USDC (0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65, 6 decimals) on Elysium (chain 99901).

- long = receive the floating funding longs pay on HyperCore, pay fixed (a HyperCore long locking its cost). short = pay floating, receive fixed (a HyperCore short or basis trade locking its income).
- A keeper posts each settled hourly print (Hyperliquid `fundingHistory`) to TokosOracle, one per market per hour, in order, clamped to +-0.04% per hour. The oracle keeps a cumulative index; positions accrue lazily: pnl = side x notional x ((index now - index at open) - fixed x prints).
- Maturities: any 00:00 UTC from 1 to 31 days out (the app offers 7D and 30D). Margin 2% initial, 1% maintenance; anyone may liquidate below maintenance (reward 0.25% of notional, at most 50 USDC).
- Fee 0.05% of notional per open and per early close (hard cap 0.30%), 80% to the pool, 20% to the protocol.
- The pool of each market is the counterparty: its fixed rate starts at an anchor that follows the 24-print average and moves with the pool's net exposure. Opens and LP withdrawals that would leave the pool unable to pay every remaining print at the cap revert.
- Opens, closes, margin removal and LP moves wait for the print of the latest top of the hour. 24 hours after a missed print anyone may freeze a feed and every position settles on the last good index.

## Read (keyless, JSON, CORS open)
- GET https://www.tokos.tech/api/markets
- GET https://www.tokos.tech/api/funding?coin=HYPE&hours=168
- GET https://www.tokos.tech/api/quote?coin=HYPE&side=long&notional=1000&tenor=7d
- GET https://www.tokos.tech/api/keeper

## Act
- MCP (Streamable HTTP, keyless): POST https://www.tokos.tech/mcp. Tools: markets, funding, quote_open, position, pool, keeper_status, open_calldata, close_calldata, deposit_calldata. Reads and calldata only, it never signs.
- SDK: https://www.tokos.tech/sdk/tokos.js (markets, funding, quote, keeper, accrued, oneHour, replayAnchor, openCalldata, closeCalldata, depositCalldata).
- Writes: approve USDC to the market, then open(maturity, side, notional, margin, limitRate) / close(id, minPayout) / deposit(assets) / withdraw(shares).

## Contracts
- TokosOracle: 0x467AAF9a623Ca8deBb7fc80b38b2CF9DDFb978eC
- TokosMarket HYPE: 0x4039adFeccb1F16112c5DBfD88dF89E0E7535344 (feed 0)
- TokosMarket BTC: 0xc35fB1dD14C8F411895E21960709E87101e0579F (feed 1)
- TokosMarket ETH: 0xFEE3eF0Af07EB6176E8B0ab9D37B591Eba875493 (feed 2)

Units: rates per hour scaled 1e18; USDC in base units. The contracts are unaudited.
