# Vault Creation

Each vault on Prodigy.Fi is a unique smart contract. The smart contract transparently and securely automates the actions required to operate the vault throughout its lifecycle.

Any user (Vault Creators) can create a vault by setting the [vault parameters](https://prodigyfi.gitbook.io/dual-investment/vault-creation/vault-parameters) such as Asset Pair, direction, Linked Price, Yield, Expiry, and Quantity.

The Vault Creator also provides the necessary liquidity to fund the vault. This action automatically generates a smart contract for the vault and lists it on the platform for discovery.

## Smart Contract Terms: Investment Token And Linked Token <a href="#smart-contract-terms-investment-token-and-linked-token" id="smart-contract-terms-investment-token-and-linked-token"></a>

In our smart contract, we use the terms Investment Token and Linked Token to define the relationship between the paired tokens.

### Investment Token  <a href="#investment-token" id="investment-token"></a>

* Deposited by Vault Subscribers into the vault.
* Also deposited by Vault Creators to fund subscriber yields when a swap does not occur.

### Linked Token <a href="#linked-token" id="linked-token"></a>

* Deposited by Vault Creators into the vault.

## Swap Execution <a href="#swap-execution" id="swap-execution"></a>

A swap in a vault occurs only if the Linked Price is reached at the time of the vault’s expiry.

### Swapped <a href="#swapped" id="swapped"></a>

* At vault expiry, the Linked Price was reached.
* Vault Subscriber's Investment Token is swapped for the Linked Token.
* Vault Subscribers receives Linked token at the Linked Price + their yield in the Linked Token.
* Vault Creator receives their deposited investment token (yield is paid out in Linked tokens) and the Investment Token from Vault Subscribers.

### Unswapped <a href="#unswapped" id="unswapped"></a>

* At vault expiry, the Linked Price was not reached.
* No token swap occurs.
* Vault Subscribers receives the investment token they deposited + yield in the Investment Token.
* Vault Creator’s receives the Linked Token they deposited. The Investment Token that the vault Creator deposited is paid out as yield to the Vault Subscribers.

## Simplified Example: ETH-USDC Buy Low <a href="#simplified-example-weth-usdc-buy-low" id="simplified-example-weth-usdc-buy-low"></a>

Vault Creator will create a vault and provide both Linked Tokens (ETH) and rewards (USDC). Subscribers will deposit Investment Token (USDC) into the vault.

<figure><img src="https://1498879445-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0xUM1AtBZof4xC0ubVWO%2Fuploads%2FZ23482ucehB5Y7Z3iBhP%2Fimage.png?alt=media&#x26;token=9977d0c2-609d-442a-9e25-6a347831f737" alt=""><figcaption></figcaption></figure>

### Swapped <a href="#swapped.1" id="swapped.1"></a>

If the Linked Price of the vault is reached, Vault Subscribers’ deposits in the Investment Token (USDC) are swapped for the Vault Creator's Linked Token (ETH), which includes the reward in ETH.

<figure><img src="https://1498879445-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0xUM1AtBZof4xC0ubVWO%2Fuploads%2FbKrYP0JNPn7FAKHOFurv%2Fimage.png?alt=media&#x26;token=3dfc0e22-2f6d-41b5-a592-b67bc1e05a3d" alt=""><figcaption></figcaption></figure>

### Unswapped <a href="#unswapped" id="unswapped"></a>

If the Linked Price is not reached, Subscribers get their Investment Token (USDC) returned, and the Vault Creator pays the reward in USDC.

<figure><img src="https://1498879445-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0xUM1AtBZof4xC0ubVWO%2Fuploads%2FcaG8SEr0U3QfczUIJXM4%2Fimage.png?alt=media&#x26;token=744af179-168a-46b9-9751-2df8a38c3f20" alt=""><figcaption></figcaption></figure>

