> For the complete documentation index, see [llms.txt](https://velora-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://velora-1.gitbook.io/docs/architecture-decisions/002-pull-based-withdrawals.md). Agents can also search and read this documentation through its [MCP server](https://velora-1.gitbook.io/docs/~gitbook/mcp).

# ADR-002: Pull-based withdrawals

**Status:** Accepted

## Context

Vested tokens have to get from the vault to the recipient. A vesting protocol can either **push** (someone/something sends tokens to the recipient as they vest) or **pull** (the recipient claims when they choose). Solana has no native scheduler, so "push as it vests" implies either an off-chain cron/keeper or the creator manually sending — both add moving parts and trust.

## Decision

Withdrawals are pull-based. The recipient calls [`withdraw`](https://velora-1.gitbook.io/docs/instruction-reference/withdraw.md), and the program computes `claimable = compute_unlocked(now) - amount_claimed` and transfers exactly that. The program stores cumulative `amount_claimed` so repeated claims never double-pay.

## Consequences

**Positive**

* **No keeper infrastructure.** No cron job, no relayer, nothing to keep alive or fund. The protocol is fully self-contained on-chain.
* **Recipient controls timing.** They claim when it suits them (e.g. batching for fees or tax timing). The recipient also pays the transaction fee for their own claim.
* **Idempotent and safe.** Because `amount_claimed` is the running total, a claim with nothing newly unlocked simply returns `NothingToWithdraw` rather than mis-paying.

**Negative**

* **Tokens are not "received" automatically.** A recipient who never claims never gets paid; balances sit in the vault until withdrawn. This is acceptable and standard for vesting (cf. most token-lock protocols).
* **UI must compute "available now."** Front-ends mirror the schedule math to show pending amounts; the on-chain claim remains the source of truth.

## Alternatives considered

A keeper that pushes vested tokens on a schedule was rejected: it adds an off-chain trusted component, ongoing operational cost, and a liveness dependency for what is fundamentally a deterministic, on-demand calculation.


---

# 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://velora-1.gitbook.io/docs/architecture-decisions/002-pull-based-withdrawals.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.
