# Vouchers

Vouchers are outputs produced by Cartesi applications that allows the execution of code on the base layer of the rollup.
Vouchers can encapsulate any arbitrary smart contract call, and can be executed by anyone by calling the [executeOutput](https://github.com/cartesi/rollups-contracts/blob/main/src/dapp/IApplication.sol) method of the application smart contract.

One essential piece of information to execute a voucher, as required by the `executeOutput` method, is the output proof.
Proofs are generated by a Cartesi node every time an epoch closes.
Epochs are configurable, and are typically closed once a week.

Creating a voucher is easy by using the [encodeFunctionData](https://viem.sh/docs/contract/encodeFunctionData#encodefunctiondata) viem function.
The following example creates a voucher to make a [transfer](https://docs.openzeppelin.com/contracts/4.x/api/token/erc20#IERC20-transfer-address-uint256-) of an ERC-20 token.

```ts twoslash
import { Voucher } from "@deroll/core";
import { encodeFunctionData, erc20Abi, parseUnits } from "viem";

const token = "0x491604c0FDF08347Dd1fa4Ee062a822A5DD06B5D"; // CTSI address
const to = "0x8f7599fa6fDDF2845a3beBcDCb055C7Ba1793a1f"; // CTSI recipient
const amount = parseUnits("1", 18);
const voucher: Voucher = {
    destination: token,
    payload: encodeFunctionData({
        abi: erc20Abi,
        functionName: "transfer",
        args: [to, amount],
    }),
};
```
