# Purchases & Redemptions

### Purchases

Our Teller contract's `purchase` function takes the following parameters:

* `recipient` - the address which will receive the vesting tokens (i.e. the purchaser)
* `referrer` - the address to which frontend referral fees (currently disabled) will be sent if enabled (or `0x0000000000000000000000000000000000000000` if not providing an address)
* `id` - the id of the market from which the bond is being purchased
* `amount` - the amount being purchased
* `minAmountOut` - the minimum number of payout tokens the user will receive. This protects the user against excessive slippage
* `overrides` - standard override parameters, `gasLimit`, `gasPrice` etc

The values for `amount` and `minAmountOut` should be formatted taking into account their decimals:

```
amount = ethers.utils.parseUnits(amount.toString(), quoteDecimals)
        .toString();
        
minAmountOut = ethers.utils.parseUnits(minAmountOut.toString(), payoutDecimals)
        .toString()
```

So an example call would be:

```
tellerContract.purchase(
      recipientAddress,
      referrer,
      id,
      amount,
      minAmountOut,
      overrides
);
```

### Redemptions

Our Teller's `redeem` function takes the following parameters:

* `token` - the address of the vesting token
* `amount` - the amount to redeem
* `overrides` - standard override parameters, `gasLimit`, `gasPrice` etc

For `amount` we recommend using the user's full balance by default.

So an example call would be:

<pre><code>tellerContract.redeem(
<strong>    tokenAddress, 
</strong>    amount, 
    overrides
);
</code></pre>


---

# Agent Instructions: 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:

```
GET https://dev.bondprotocol.finance/developers/purchases-and-redemptions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
