TulipInferenceEscrow. It limits how much the Gateway can settle for a user’s requests without giving the Gateway arbitrary wallet access.
Permit fields
Each permit records:- Owner.
- Credit token and model ID.
- Optional pinned provider offer.
- Remaining credit balance.
- Expiration time.
- Close request and closed state.
Request lifecycle
Quote
The Gateway tokenizes the prompt, assumes the requested maximum output, checks whether the endpoint must wake, and obtains the maximum charge from the on-chain tariff.
Reserve
The Gateway atomically reserves that maximum against the permit in its durable store. Concurrent requests cannot reuse the same available balance.
Serve and meter
The selected endpoint serves the request. The Gateway requires actual prompt and completion token usage from the upstream response.
Sign receipt
The Gateway releases the unused part of the reservation and signs an EIP-712 receipt containing the exact model, offer, tariff version, token usage, timestamps, and wake state.
Close and refund
The owner may top up an open, unexpired permit. To withdraw unused credits, the owner first requests closure. The contract enforces a 30-minute delay beforeclosePermit refunds the remaining balance.
The delay gives already issued receipts time to settle. A close request can be cancelled before final closure.
Open or pinned provider selection
- An open permit has a zero offer ID. The Gateway may select any eligible offer and may perform pre-output failover.
- A pinned permit names one offer. Settlement rejects receipts from every other offer.