> 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/protocol/deal-lifecycle.md).

# Deal lifecycle and states

Every state and transition of a loan, on the native engines and on V1: who can trigger each one, and when.

Two contract families run loans. **The native engines** (`GageV2Vault`) take every new listing: since 4 November 2026 the current engine is the Intent core `0x0086ec1540719d4199432797e2b6068e6ae5a0e5`, funded only by partner vaults, and each lend asset (GLD, NVDA, HIMS) has an Intent core of its own. The four earlier engines, the Intent core of 15 October 2026 `0x856e4232469b957150cb29a8ce9b60059449e87e`, V3 `0xfee799ade96229c2c128bc5ed9e55f8d9d01a7e9` and the two V2 engines, hold their existing loans. **V1** (`DealVault 0x3D97…` and the LP extension vaults) is exits only. A rule below applies only to positions on the contract it describes.

Both families share one rule: pull, never push. Anything owed to you, USDG, a token, a position, is credited to your internal balance and withdrawn by you. No function moves it to you on its own.

## Native engines

```mermaid
stateDiagram-v2
    [*] --> FUNDING : list · collateral escrowed
    FUNDING --> CANCELLED : cancelFunding · borrower, or anyone after the window
    FUNDING --> ACTIVE : fund · the fourth quarter is sold
    ACTIVE --> REPAID : reclaim · the cap is paid before the deadline
    ACTIVE --> DEFAULTED : finalizeDefault · anyone, from the deadline
```

### States as the app shows them

| On-chain state            | Meaning                                                                            | The position page shows                                                                                          |
| ------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| FUNDING                   | Lenders buy quarters inside the funding window. Nothing has started                | The quarters sold so far                                                                                         |
| ACTIVE                    | The loan runs. The borrower may reclaim at the cap at any time before the deadline | `EXPIRY IN …`; the borrower reads the loan card's **Time left** until repayment closes                           |
| ACTIVE, past the deadline | Repayment is closed. Anyone may finalize the default                               | `TERM ENDED · date` on the current engine and V3; `GRACE ENDS IN …` on the two V2 engines while their grace runs |
| REPAID                    | The cap was paid. The collateral is the reclaim recipient's to withdraw            | Reclaimed                                                                                                        |
| DEFAULTED                 | The lenders hold the collateral, one quarter each                                  | The borrower walked away                                                                                         |
| CANCELLED                 | Funding ended before the fourth quarter. Lenders' USDG is credited back            | Cancelled                                                                                                        |

### Transitions

| Call                 | Who                                                                                                                          | Precondition                                                                                                                                                           | Effect                                                                                                                                                                                                                       |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `list`               | Borrower (or a zap or entry router for its user)                                                                             | Collateral passes the validator: exact admitted market, limits, open cap. New listings not paused. Term allowed. Funding deadline within 7 days; the app sets 24 hours | Collateral escrowed in the loan's own account. A reclaim right (an NFT) minted to the borrower. FUNDING                                                                                                                      |
| `fund`               | Lender (or the entry router, paying with ETH). On an Intent core, only its factory's partner vaults, through the fill router | FUNDING, before the funding deadline                                                                                                                                   | 1 to 4 unsold quarters bought at a quarter of the principal each. On the fourth: the 1% origination fee credited to the fee route, principal less fee credited to the borrower, rewards registered, `fundedAt = now`. ACTIVE |
| `withdrawCommitment` | A lender                                                                                                                     | FUNDING                                                                                                                                                                | The lender's quarters released and their USDG credited back                                                                                                                                                                  |
| `cancelFunding`      | Borrower at any time; anyone after the funding deadline                                                                      | FUNDING                                                                                                                                                                | Every quarter credited back to its lender; the collateral becomes the borrower's to withdraw. CANCELLED                                                                                                                      |
| `reclaim`            | The reclaim-right holder                                                                                                     | ACTIVE, `now < fundedAt + term + grace`                                                                                                                                | Exactly the cap pulled and credited to the lenders, a quarter each. The collateral becomes the chosen recipient's to withdraw. REPAID                                                                                        |
| `finalizeDefault`    | Anyone                                                                                                                       | ACTIVE, `now ≥ fundedAt + term + grace`                                                                                                                                | The lenders' entitlement fixed. DEFAULTED                                                                                                                                                                                    |
| `withdrawCollateral` | The collateral beneficiary                                                                                                   | REPAID or CANCELLED                                                                                                                                                    | Pulls the intact collateral. An LP position can instead be unwound into its two tokens (`withdrawRepaidUnderlying`)                                                                                                          |
| `recoverDefault`     | Any lender of the loan, once                                                                                                 | DEFAULTED                                                                                                                                                              | Unwinds the collateral account: a token stays a token, an LP position becomes its two tokens                                                                                                                                 |
| `withdrawRecovery`   | Each lender                                                                                                                  | DEFAULTED, recovered                                                                                                                                                   | Pulls that lender's share of one asset, independently of the others                                                                                                                                                          |
| `withdrawUSDG`       | Anyone with a balance                                                                                                        | Balance > 0                                                                                                                                                            | Pulls all USDG credited to the caller                                                                                                                                                                                        |

Funding is atomic on the fourth quarter: the fee, the borrower's credit, the reward registration and the state change land in one transaction; no intermediate state is observable.

### The deadline

The deadline is `fundedAt + term + grace`. Repayment closes at that second and default finalization opens at that same second, so a loan is repaid on time or it is defaulted, never raced. The grace is fixed per engine: 0 on the current engine and V3, so the deadline is the end of the term; 48 hours on the two V2 engines, whose loans keep the window they were funded under and show their own deadline in the app.

Repayment is one transaction at one moment. A sequencer outage in the last hours before the deadline can block it; repay early.

### Funding in quarters

The principal is split in four; a lender takes one, two, three or four quarters, with USDG or with ETH swapped on the way in through the entry router. On an Intent core the fill router buys all four in one transaction, from one or more partner vaults, on a plan the rate service signed; if any part fails, nothing is funded. The loan starts only when all four are sold. The contract allows a funding window of up to 7 days; the app sets 24 hours. If the window closes with quarters unsold, the borrower ends funding (or anyone may, after the deadline) and every lender's USDG is credited back.

You may end up holding the collateral instead of USDG. Memes can go to zero. If the borrower walks away, you hold it.

### Selling a position

**The reclaim right.** Its holder may post an ask in USDG (`setAsk`) while the loan is ACTIVE and before the deadline; a buyer pays it (`buy`) and takes the right, the collateral outcome and any reward still to accrue. Rewards already earned stay with the seller. The sale fee is the registry's rate at posting, 1% today and at most 2%, taken from the price and credited to the fee route. The right moves only through this sale; it cannot be transferred any other way. The app calls it "Sell the reclaim right".

**Lender quarters.** On the engines with lender sales (`0xfee7…` and `0x0856…`), a lender may offer any bundle of their quarters at one price (`setLenderAsk`); the buyer (`buyLender`) takes repayment, default recovery and future reward rights on those quarters, under the same sale fee. The original engine `0x2265…` has no lender sales. You may end up holding the collateral instead of USDG.

### Cash out

The cash-out router exercises an approved reclaim right, sells the collateral through routes admitted by its owner, repays the cap and returns the rest as USDG, or reverts everything. Its fee is 0.5% of the cash left after the cap and financing costs. An LP position is unwound first. The app calls it "Cash out".

### After a default

A lender's claim is two steps: one lender unwinds the collateral for everyone (`recoverDefault`), then each lender pulls their own share of each asset (`withdrawRecovery`). An LP position comes out as its two tokens. There is no swap on the way out.

## V1

`DealVault 0x3D97…` and the LP extension vaults. They take no new listings; positions on them settle under these rules.

```mermaid
stateDiagram-v2
    [*] --> LISTED : list · collateral escrowed
    LISTED --> CANCELLED : cancel · borrower
    LISTED --> FUNDED : fund · lender pays the asking price
    FUNDED --> RECLAIMED : reclaim · borrower pays the cap
    FUNDED --> CLAIMED : claim · lender, from expiry + grace
```

### States as the app shows them

| Pill          | Sentence                                                                                        | On-chain state                  |
| ------------- | ----------------------------------------------------------------------------------------------- | ------------------------------- |
| **LISTED**    | Open at its asking price until funded or cancelled                                              | LISTED                          |
| **FUNDED**    | Running. The borrower may reclaim at the cap                                                    | FUNDED, before `expiry + grace` |
| **CLAIMABLE** | The grace has ended. The lender may claim; the borrower may still reclaim until the claim lands | FUNDED, from `expiry + grace`   |
| **RECLAIMED** | The borrower paid the cap and holds the collateral again                                        | RECLAIMED                       |
| **CLAIMED**   | The lender holds the collateral                                                                 | CLAIMED                         |
| **CANCELLED** | Taken off the market before funding                                                             | CANCELLED                       |

### Transitions

| Call        | Who                   | Precondition                                                                                             | Effect                                                                                                                                     |
| ----------- | --------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `list`      | Borrower              | Collateral passes the adapter's checks. New deals not paused. Cap, term and listing expiry within bounds | Collateral escrowed. LISTED                                                                                                                |
| `cancel`    | Borrower              | LISTED                                                                                                   | Collateral credited back to the borrower. CANCELLED                                                                                        |
| `fund`      | Lender                | LISTED, before the listing expiry                                                                        | Exactly the asking price pulled. Fee to the fee sink, remainder to the borrower's balance. `fundedAt = now`, `expiry = now + term`. FUNDED |
| `reclaim`   | Borrower              | FUNDED, no claim has landed                                                                              | Exactly the cap pulled and credited to the lender. Collateral credited to the borrower. RECLAIMED                                          |
| `claim`     | Lender                | FUNDED, `now ≥ expiry + grace`                                                                           | Collateral credited to the lender. CLAIMED                                                                                                 |
| `withdraw…` | Anyone with a balance | Balance > 0                                                                                              | Pulls USDG, an ERC-20, or a position NFT owed to the caller                                                                                |

### The deadline on V1

The lender's claim opens at `expiry + grace`: 48 hours after expiry on `0x3D97…`; each extension vault fixed its own grace at deployment, never under 24 hours. Unlike the engines, V1 does not close repayment at that moment: the borrower may still reclaim at the full cap until the lender's claim executes, and a reclaim that lands first wins. A deadline is exclusive: a listing is expired once `now ≥ listingExpiry`, and a deal is claimable once `now ≥ expiry + grace`.

### Offers

V1 also carries an offer flow (`bid`, `withdrawBid`, `accept`) in which a lender escrows a price at or below the cap and the borrower accepts one. It was never switched on: V1 listed at an asking price and funded in one step, and `fund` records an already-accepted offer so the accounting is one path.

### Early reclaim

Allowed at the full cap from the moment of funding, on every contract. The lender is paid the same amount sooner. Rewards keep their original schedule.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gage.cash/protocol/deal-lifecycle.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
