> For the complete documentation index, see [llms.txt](https://docs.gage.cash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gage.cash/developers/integrate.md).

# Integrate gage

Everything in gage is public: the contracts, the events, and the services that read them. This page is for anyone building on top.

## Reading

* **From the indexer.** The [API](/developers/api.md) serves every list and page the app shows. Run your own instance against the chain, or read the events directly. State is fully derivable from events.
* **From the contracts.** `getDeal`, `getBid`, `claimableAt`, and the balance views on the vault; `earned`, `positionState` and `valueInGAGE` on the liquidity rewards contract; epoch and budget views on emissions. See [Contracts](/developers/contracts.md).

## Writing

* **Fund a deal from a contract.** Approve USDG to the vault and call `fund(dealId, lender)` with `lender` equal to your own address. The vault only accepts a `lender` that is not the caller from a router the registry has allowlisted, so a contract funds for itself.
* **List from a contract.** Approve the collateral to the vault and call `list`. Withdrawals credit the caller; a contract that lists must be able to call `withdrawUSDG` and `withdrawERC20`.
* **Register rewards.** `register(dealId)` on the deal rewards contract is permissionless. The app does it right after funding; a keeper backstops within the hour. If you fund from your own app, register too.
* **Checkpoint positions.** `checkpoint(tokenId)` on the liquidity rewards contract is permissionless and keeps a position's score current.
* **Trigger a clip.** `buyback(clipUSDG)` and the splitter's `split()` are permissionless above their thresholds and pay the caller a bounty.

## What never to rely on

* **A price from the contracts.** There is none. The vault reads no price; the in-range check reads a tick at deposit only.
* **The services being up.** Nothing they hold is needed to settle a deal. Reclaim, claim, cancel and withdraw work with a wallet and the contract addresses alone.
* **Push transfers.** Anything owed is credited to a balance and withdrawn by its owner. Watch `Withdrawn` events, not incoming transfers.
* **Token-layer keys being present.** The deployment record gains them when that layer is deployed, and every consumer must work without them.

## Robinhood Chain specifics

* The Universal Router on Robinhood Chain is a modified fork whose v4 swap struct carries an extra `minHopPriceX36` field. Stock Uniswap SDK calldata reverts. Anything that builds swap calldata for the entry router must target that ABI.
* Stock Token amounts are raw units on-chain. Scale by `uiMultiplier()` for display only.
* Block timestamps are the clock. Block numbers on this stack are an L1 estimate.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gage.cash/developers/integrate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
