> ## Documentation Index
> Fetch the complete documentation index at: https://www.zkcompression.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Program examples

> Anchor program examples for light-token CPI.

Find all examples on Github: [examples-light-token](https://github.com/Lightprotocol/examples-light-token)

<Accordion title="Agent skill">
  Install or view [dedicated agent skills](/ai-tools/overview#agent-skills).

  ```
  npx skills add Lightprotocol/skills
  ```

  Install orchestrator agent skill or view [skill.md](https://www.zkcompression.com/skill.md):

  ```bash theme={null}
  npx skills add https://zkcompression.com
  ```
</Accordion>

### Examples

|                         | Description                                                            |                                                                                                                                           |
| ----------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **cp-swap-reference**   | Fork of Raydium AMM that creates markets without paying rent-exemption | [Example](https://github.com/Lightprotocol/cp-swap-reference) \| [Docs](/light-token/defi/programs)                                       |
| **create-and-transfer** | Create account via macro and transfer via CPI                          | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/create-and-transfer)                            |
| **escrow**              | Peer-to-peer light-token swap with offer/accept flow                   | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/escrow)                                         |
| **fundraiser**          | Token fundraiser with target, deadline, and refunds                    | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/fundraiser)                                     |
| **light-token-minter**  | Create light-mints with metadata, mint tokens                          | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/light-token-minter)                             |
| **pinocchio-swap**      | Light Token swap reference implementation                              | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/pinocchio/swap) \| [Docs](/light-token/defi/programs-pinocchio) |
| **token-swap**          | AMM with liquidity pools and swaps                                     | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/token-swap)                                     |

### Macros

|                                     | Description                              |                                                                                                                                                                                     |
| ----------------------------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **counter**                         | Create PDA with sponsored rent-exemption | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/counter) \| [Docs](/pda/light-pda/overview)                                  |
| **create-associated-token-account** | Create associated light-token account    | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-associated-token-account) \| [Docs](/light-token/cookbook/create-ata) |
| **create-mint**                     | Create light-token mint                  | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-mint) \| [Docs](/light-token/cookbook/create-mint)                    |
| **create-token-account**            | Create light-token account               | [Example](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-token-account) \| [Docs](/light-token/cookbook/create-token-account)  |

### Instructions

The instructions use pure CPI calls which you can combine with existing and / or light macros.
For existing programs, you can replace spl\_token with light\_token instructions as you need. The API is a superset of SPL-token so switching is straightforward.

|                                     | Description                                                        |                                                                                                                                                                                                      |
| ----------------------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **approve**                         | Approve delegate via CPI                                           | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/approve/src/lib.rs) \| [Docs](/light-token/cookbook/approve-revoke)                     |
| **burn**                            | Burn tokens via CPI                                                | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/burn/src/lib.rs) \| [Docs](/light-token/cookbook/burn)                                  |
| **close**                           | Close token account via CPI                                        | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/close/src/lib.rs) \| [Docs](/light-token/cookbook/close-token-account)                  |
| **create-associated-token-account** | Create associated light-token account via CPI                      | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/create-associated-token-account/src/lib.rs) \| [Docs](/light-token/cookbook/create-ata) |
| **create-mint**                     | Create light-token mint via CPI                                    | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/create-mint/src/lib.rs) \| [Docs](/light-token/cookbook/create-mint)                    |
| **create-token-account**            | Create light-token account via CPI                                 | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/create-token-account/src/lib.rs) \| [Docs](/light-token/cookbook/create-token-account)  |
| **freeze**                          | Freeze token account via CPI                                       | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/freeze/src/lib.rs) \| [Docs](/light-token/cookbook/freeze-thaw)                         |
| **mint-to**                         | Mint tokens via CPI                                                | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/mint-to/src/lib.rs) \| [Docs](/light-token/cookbook/mint-to)                            |
| **revoke**                          | Revoke delegate via CPI                                            | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/revoke/src/lib.rs) \| [Docs](/light-token/cookbook/approve-revoke)                      |
| **thaw**                            | Thaw token account via CPI                                         | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/thaw/src/lib.rs) \| [Docs](/light-token/cookbook/freeze-thaw)                           |
| **transfer-checked**                | Transfer with mint validation via CPI                              | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/transfer-checked/src/lib.rs) \| [Docs](/light-token/cookbook/transfer-checked)          |
| **transfer-interface**              | Transfer between light-token, Token 2022, and SPL accounts via CPI | [Example](https://github.com/Lightprotocol/examples-light-token/blob/main/programs/anchor/basic-instructions/transfer-interface/src/lib.rs) \| [Docs](/light-token/cookbook/transfer-interface)      |
