# 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>
