// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; /// @notice Shared types for Asyncium intents and receipts. /// Sizes and prices use 8 decimals (E8), the HyperCore wire precision. Notional = sz * px / 1e8. library AsyncTypes { enum Tif { Ioc, Gtc, Alo } enum Status { None, Open, Acked, // a GTC order rests on HyperCore; not final Filled, Partial, Dropped, // HyperCore cancelled or rejected it; `reason` carries why Unanswered // no receipt by deadline + grace; set by expire() } struct Intent { uint32 asset; // HyperCore asset id (perp index, or 10000 + spot index) bool isBuy; bool reduceOnly; Tif tif; uint64 sz; // E8 uint64 limitPx; // E8 uint64 deadline; // unix seconds uint32 callbackGas; } struct Receipt { Status status; uint64 filledSz; // E8 uint64 avgPx; // E8, 0 when nothing filled int64 fee; // E8 in quote, negative is a rebate uint64 oid; // HyperCore order id, 0 when never placed uint64 coreTime; // HyperCore time of the final event, ms uint8 reason; // Dropped reason code (see docs), 0 otherwise bytes32 fillHash; // hash of the HyperCore fill hashes, 0 when nothing filled } } interface IAsyncReceiver { function onReceipt(uint256 intentId, AsyncTypes.Receipt calldata receipt) external; } interface IAsyncRouter { function request(AsyncTypes.Intent calldata intent) external returns (uint256 intentId); function cloidOf(uint256 intentId) external view returns (bytes16); } interface IBondRegistry { function reserve(address relayer, uint256 notional) external; function release(address relayer, uint256 notional) external; function penalize(address relayer) external returns (uint256 burned); function slash(address relayer, address challenger) external returns (uint256 slashed); function canCarry(address relayer, uint256 notional) external view returns (bool); }