> For the complete documentation index, see [llms.txt](https://docs.vemo.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vemo.network/vemo-protocol/smart-voucher/integration.md).

# Integration

The Voucher Factory, represented by the **VoucherFactory.sol** contract, is the control center for both the NFT collection and its related token-bound accounts. It provides Dapps, project owners, and users with the ability to create vouchers and serves as the entry point for generating ERC6551Accounts.

The deployment contract addresses of **VoucherFactory.sol** on different chains:&#x20;

| Chain                  | Address                                    |
| ---------------------- | ------------------------------------------ |
| Avalanche Fuji Testnet | 0x65B903D7903d277bE600B8524a759aBEa3CC7e1A |
| Avalanche Mainnet      | 0xbB740E17f3c177172CaAcCef2F472DB41b9b1d19 |
| Bnb Mainnet            | 0x9869524fd160fe3adDA6218883B6526c0977D3a5 |

## **Sequence Diagram**

### The project owner conducts an IVO

In this case, the project owner is preparing for an Initial Voucher Offering (IVO) as fundraising or airdrop strategies. They'll set up a vesting pool with a pre-set vesting scheme and terms, then deposit their tokens into this pool. This setup will enable participants to mint vouchers, which will contain tokens within them.

* **Project Owner creates a vesting pool:**

<figure><img src="/files/hDrKBraJonUyR0RjtsZe" alt=""><figcaption></figcaption></figure>

* **Pool participant mints a voucher:**

<figure><img src="/files/PBGY0Y2sMGutjdkeI8gX" alt=""><figcaption></figcaption></figure>

### Token holder creates a voucher

In this case, a retail token holder chooses to convert his tokens into a voucher, setting the vesting scheme and terms himself. After creation, the voucher is returned to his account. He then has the option to sell the voucher in the secondary market.&#x20;

<figure><img src="/files/HHscMbGq8ELRoMbocwTL" alt=""><figcaption></figcaption></figure>

### Voucher holder claims tokens&#x20;

Whoever holds the voucher at the end of the day has the right to claim the tokens from the voucher according to the vesting scheme.

<figure><img src="/files/4NatUH7sQ0YlLgkT6ext" alt=""><figcaption></figcaption></figure>

The Voucher Factory, represented by the **Voucher.sol** contract, is the control center for both the NFT collection and its related token-bound accounts. It provides Dapps, project owners, and users with the ability to create vouchers and serves as the entry point for generating ERC6551Accounts.

The deployment contract addresses of **Voucher.sol** on different chains:&#x20;

| Chain                  | Address                                    |
| ---------------------- | ------------------------------------------ |
| Avalanche Fuji Testnet | 0x65B903D7903d277bE600B8524a759aBEa3CC7e1A |
| Avalanche Mainnet      | 0xbB740E17f3c177172CaAcCef2F472DB41b9b1d19 |
| Bnb Mainnet            | 0x9869524fd160fe3adDA6218883B6526c0977D3a5 |

## **APIs**

* **VoucherFactory.createBatchFor**: Allows an user to batch mint vouchers with tokens, multiple vesting schemes.

```markup
function createBatchFor(address tokenAddress, BatchVesting memory batch, uint96 royaltyRate, address receiver) public nonReentrant returns (address, uint256, uint256) {}
```

* **VoucherFactory.redeem**: This function executes a vesting process for the voucher owner, with VoucherFactory acting as the portal.

```markup
function redeem(address nftAddress, uint256 tokenId, uint256 _amount) external returns (bool) {}
```

## **Data Structure**

* **Voucher input structure**:

```markup
struct VestingSchedule {
    uint256 amount;
    uint8 vestingType; // linear: 1 | staged: 2
    uint8 linearType; // day: 1 | week: 2 | month: 3 | quarter: 4
    uint256 startTimestamp;
    uint256 endTimestamp;
    uint8 isVested; // unvested: 0 | vested : 1 | vesting : 2
    uint256 remainingAmount;
}

struct VestingFee {
    uint8 isFee; // no-fee: 0 | fee : 1
    address feeTokenAddress;
    address receiverAddress;
    uint256 totalFee;
    uint256 remainingFee;
}

struct Vesting {
    uint256 balance;
    VestingSchedule[] schedules;
    VestingFee fee;
}

struct BatchVesting {
    Vesting vesting;
    uint256 quantity;
    string[] tokenUris;
}
```

## Events

* **VoucherCreated**: Emitted when a voucher is created.

```markup
event VoucherCreated(
        address indexed account,
        address indexed currency,
        uint256 amount,
        address indexed nftCollection,
        uint256 tokenId
    );
```

* **VoucherRedeem**: Signals when a partial or full amount of vesting tokens is claimed from the voucher.

```markup
 event VoucherRedeem(
        address indexed account,
        address indexed currency,
        uint256 claimedAmount,
        address indexed nftCollection,
        uint256 tokenId
    );
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.vemo.network/vemo-protocol/smart-voucher/integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
