# Quick Start Guide

## Creating a vault

To create a vault use the vault factory. This is the first step in preparing your strategy. Once the vault is created it still needs to be whitelisted if you want to have it included in the IPOR webapp interface.&#x20;

[VIDEO](https://www.youtube.com/watch?v=_3wjQf9iMY4\&list=PLTda9D8MCj4QafXFkFPR_i27CakEUdBeg\&index=1)

## Vault Setup

[Documentation](/build-on-fusion/atomists/vault-configuration-step-by-step.md)

Playlist:  <https://www.youtube.com/playlist?list=PLTda9D8MCj4QafXFkFPR_i27CakEUdBeg>

1. Create vault [VIDEO](https://youtu.be/xxdiy6j75VQ?si=LIfnjHqNFgHNGY5S)
2. General settings [VIDEO](https://www.youtube.com/watch?v=NL7lMRXSjf4\&list=PLTda9D8MCj4QafXFkFPR_i27CakEUdBeg\&index=2)
3. Access manager [VIDEO](https://youtu.be/vi7bEMcnbbs?si=VNgrXGpjTJQg883w)
4. Integrations [VIDEO](https://youtu.be/0DL98lOzBvs?si=W_gspKW5qrwtaHFI)
   1. Fuses [VIDEO](https://youtu.be/lHBWjRYRa2o?si=KSPEjUF8NreNIBa9)
   2. Substrates [VIDEO](https://youtu.be/zYXwfeUp7Og?si=M9ImdV-Yhdi0LaGp)
      1. for the information as to what are the specific substrates for each fuse it is still best to check the test files for a specific fuse. The interface will be improved to include that information directly in the front end. <https://github.com/IPOR-Labs/ipor-fusion/blob/34795e4d2a2a060d5b0f6b1ff7486013b2bceaf8/test/fuses>
5. Scheduled operations [VIDEO](https://youtu.be/tfoUAhiKJBA?si=DzLHsI-XT_IZ2dt0)
6. Withdrawals
   1. Instant [VIDEO](https://youtu.be/p2WXHJHMMrg?si=I9wW1v-OAu7q0-Yl)
   2. Scheduled [VIDEO](https://youtu.be/7Aoke_3iMNQ?si=KSAv_Z4EZ0-eCllH)
7. Fees [VIDEO](https://youtu.be/cZPpg96R9bE?si=gjjBAadAU85hof5P)
8. Price Oracle [VIDEO](https://youtu.be/DiKjA-dQ7GE?si=RC_iTfTMsbZuq6vb)&#x20;
9. Prehooks - [VIDEO](https://youtu.be/DhtYHEmO4Ek?si=2PSttK-ZnOGeWFi-), [Documentation](https://docs.ipor.io/developers-docs/fusion/configuring-pre-hooks) &#x20;
10. Price feeds [VIDEO](https://youtu.be/8UZ6Yp512Ng?si=GBDPE9g-DwlOAKOZ)

## Running Alpha

This section describes how to set up and run the "Alpha" bot, which interacts with the smart contracts of your vault in the IPOR Fusion protocol. The bot uses the official IPOR Fusion SDK for Python.

To run and develop the bot, you will need two main repositories:

* IPOR Fusion Python SDK (ipor-fusion.py): This is the official Software Development Kit (SDK) for interacting with the protocol.\
  <https://github.com/IPOR-Labs/ipor-fusion.py>
* IPOR Fusion Alpha Example (ipor-fusion-alpha-example): This is a ready-to-run example bot that demonstrates how to use the SDK. This is the best starting point. \
  &#x20;<https://github.com/IPOR-Labs/ipor-fusion-alpha-example>

### How to run the bot as fast as possible 🚀

To run a basic version of the bot in the shortest possible time, follow the steps below using the ipor-fusion-alpha-example repository.

Clone the example repository:

```
$ git clone https://github.com/IPOR-Labs/ipor-fusion-alpha-example.git
$ cd ipor-fusion-alpha-example
```

Configure environment variables:

Copy the .env.example file to a new file named .env.

```
$ cp .env.example .env
```

Then, open the .env file and fill it with your credentials:

```
PROVIDER_URL: Your blockchain node provider URL (e.g., from Infura or Alchemy)
PRIVATE_KEY: The private key of your wallet that will manage the vault.
PLASMA_VAULT_ADDRESS: The smart contract address of your IPOR Plasma vault.

```

Install project dependencies:

Make sure you have Python (version 3.11 or newer) and poetry installed.

```
$ poetry install

```

Run the bot:

```
$ poetry run python main.py

```

The bot will connect to the blockchain network, initialize the connection to your vault, and start executing the default strategy every 60 seconds.

### How to customize the bot for your own strategy? 🛠️

The example bot is designed for easy modification. To implement your own logic:

* Edit the main strategy logic: Open the alpha\_bot.py file and modify the do\_fusion() method. This is where you should place the code for your custom strategy (e.g., conditions for opening/closing positions, flashloan logic, looping).
* Change the execution frequency: Open the main.py file and change the interval value in the scheduler section to adjust how often the bot executes its strategy.
* Add your own variables: If your strategy requires additional parameters, add them to the .env file and read them in the bot's code (e.g., in alpha\_bot.py).

### Where to find information during development? 📖

While creating your own strategy or extending the bot, use the following resources:

* Official IPOR Documentation: The main knowledge base about the protocol, smart contracts, and their functions.
* SDK Source Code (ipor-fusion.py): Analyzing the SDK's code will help you understand what functions and classes are available under the hood and how to use them.
* Example Repository (ipor-fusion-alpha-example): The best source for practical usage patterns of the SDK.

### How to debug? 🐛

Debugging is crucial for creating a stable and secure bot. Here are some recommended methods:

* Local Testing with Anvil: The example repository includes a Docker Compose configuration that runs a local blockchain instance (Anvil). This allows you to test interactions with smart contracts without incurring real gas costs.

Start the local environment with the command:

```
$ docker-compose up -d
```

The bot will automatically connect to the local Anvil instance.

* Unit and Integration Tests: The repository includes a test suite. Run them using poetry run pytest. Write your own tests for new features to ensure they work correctly.
* Logging: Add more detailed logs in the do\_fusion() method in the alpha\_bot.py file using the built-in logging module. This will help you trace what your bot is doing and what decisions it's making step-by-step.
* Interactive Debugger: Use a debugger, such as the one built into VS Code or IntelliJ IDA, to set breakpoints in the code and analyze the application's state in real-time.

### Frontend

If you would like the vault to be listed on the Fusion frontend, please contact IPOR Labs via Discord ticket.


---

# Agent Instructions: 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:

```
GET https://docs.ipor.io/build-on-fusion/developer-guide/quick-start-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
