Managing an FAssets Agent with the FAssets Agent Admin Console#
The FAssets Agent Admin Console (Admin Console) helps you manage agent tasks like depositing collateral and setting up alerts.
Although managing the agent bot is simplified by the Admin Console UI, installation of both the agent bot and the Admin Console UI is done from the command line.
The following procedures teach you how to configure the components required to use the Admin Console, including:
- A backend that reads the state of the agent bot and makes it available to the UI
- The UI, which talks to the backend
Afterward, these procedures explain how to use the Admin Console to manage agent tasks.
Open Beta
The FAssets system is currently in the Open Beta period. During this phase, user-friendly tools are still being developed.
Some web browsers and ad blockers might prevent this functionality.
Alternatively, you can contact support@flarelabs.org.
Prerequisites#
You need to have deployed an agent bot and have it running.
Configuration Guide#
Adding login password to secrets#
Agent UI uses a password login. The password is set in secrets.json
, where you need to set the parameter apiKey.agent_bot
with a password
that you will use to login to agent UI with. Example of secrets.json
after adding the password:
"apiKey": {
"agent_bot": "verySafePassword",
... other secrets
}
Configuring the Backend Bot#
After you have successfully deployed the agent bot and it is running, you can configure the backend that links it with the Admin Console UI.
- In the folder where you installed the agent bot (typically
fasset-bots
), navigate topackages/fasset-bots-api
, and create an.env
file. This file is not the same file that you created when you deployed the bot. -
Copy the following text, and paste it into the
.env
file you just created:## Path to config file for the agent bot (and other bots) for MYSQL FASSET_BOT_CONFIG="../fasset-bots-core/run-config/coston-bot-mysql.json" ## If you want to use SQLite (not recommended), uncomment the line below and comment on the line above # FASSET_BOT_CONFIG="../fasset-bots-core/run-config/coston-bot.json" ## Path to secrets file for the agent bot (and other bots) FASSET_BOT_SECRETS="../../secrets.json" ## Enable the following line on Windows to allow reading secrets, since ## secrets file permission check does not work # ALLOW_SECRETS_ON_WINDOWS=true ## (Optional) Path to config file for users, instead you can use `-c` ## parameter # FASSET_USER_CONFIG="../fasset-bots-core/run-config/coston-user.json" ## (Optional) Path to secrets json file for users, instead you can use `-s` ## parameter. # FASSET_USER_SECRETS="" ## (Optional) Path to directory, used for storing unexecuted minting ## Defaults to `fasset` subdirectory in user's home directory # FASSET_USER_DATA_DIR="" ## (Optional) Path to the database file for the bot (only needed if SQLite database) # FASSET_BOT_SQLITE_DB="../../path-to-.db-file"
-
If you are using SQLite (not recommended) choose one of the following options:
- If you already have agent vaults:
- Navigate to the root of the
fasset-bots
repository, and locate the.db
file. The file name will be in thefasset-bots-coston.SOME_HEX_VALUE.db
format. - Copy the file name of the
.db
file. - Return to the
.env
file you created in step 1, and paste the file name of the.db
file as the value forFASSET_BOT_SQLITE_DB
. For example,FASSET_BOT_SQLITE_DB="../../fasset-bots-coston.43B835D3.db"
.
- Navigate to the root of the
- If you do not have agent vaults:
- Open the
.env
file you created when you deployed the agent bot, and addFASSET_BOT_SQLITE_DB ="./fasset-bots-coston.db"
. - Open the
.env
file you created in step 1, and specify../../fasset-bots-coston.db
as the value ofFASSET_BOT_SQLITE_DB
.
- Open the
- If you already have agent vaults:
Enabling Alerts#
You can enable alerts to be sent to the backend and displayed in the frontend.
- In the root of the respository, create a file named
alerts.json
. -
Copy the following text and paste it into the
alerts.json
file.Fill the{ "extends": "coston-bot-mysql.json", "apiNotifierConfigs": [ { "apiKey": "myApiSecret", "apiUrl": "http://localhost:1234/" } ] }
apiKey
parameter with some random string. This will be used as api key by the bot to send notifications to the backend. Optionally (not recommended), if you use SQLite, change theextends
value in the JSON tocoston-bot.json
. -
In
secrets.json
add add the same string toapiKey.notifier_key
, which is used by the backend to accept alerts from the bot. For example if youralerts.json
file looks like this{ "extends": "coston-bot-mysql.json", "apiNotifierConfigs": [ { "apiKey": "myApiSecret", "apiUrl": "http://localhost:1234/" } ] }
Then in the
secrets.json
you will have"apiKey": { "notifier_key": "myApiSecret", ... other secrets }
-
Open the
.env
file in this same folder, and change the path specified forFASSET_BOT_CONFIG
to thealerts.json
file:Then move to the folder inFASSET_BOT_CONFIG="./alerts.json"
fasset-bots/packages/fasset-bots-api
and also changeFASSET_BOT_CONFIG
to the alerts.json file:FASSET_BOT_CONFIG="../../alerts.json"
Configure Existing Agents to Setup MySQL#
Agents that already have successfully configured fasset-bots
backend need to do the following:
- Install the MySQL server.
- Create a user in MySQL as stated above.
- In the
.env
file located at the root of the repository, you should modify theFASSET_BOT_CONFIG
variable:FASSET_BOT_CONFIG="./packages/fasset-bots-core/run-config/coston-bot-mysql.json"
- In the
secrets.json
file, fill thedatabase
field with the username and password you created in MySQL. - In the
.env
file located atfasset-bots/packages/fasset-bots-api
, you must update theFASSET_BOT_CONFIG
variable:FASSET_BOT_CONFIG="../fasset-bots-core/run-config/coston-bot-mysql.json"
- If you have enabled alerts, you need to change the
extends
parameter inalerts.json
:"extends": "coston-bot-mysql.json"
Running the Admin Console Backend#
-
In the root of the repository, run the command:
oryarn start_agent_api
yarn start_agent_api_debug
This command must continue to run for as long as you intend to use the UI. When you are finished using the UI and want to stop the server, press Ctrl + C.
Info
Run start_agent_api
or start_agent_api_debug
as a service to maximize uptime for production use. Here, you have instructions to run the agent as a systemd
service for running the bot as a daemon.
Setting Up the Admin Console#
- Navigate outside of the
fasset-bots
folder. -
Clone the UI repository and enter the
src
directory:git clone https://github.com/flare-labs-ltd/fasset-agent-ui.git cd fasset-agent-ui/src
-
Create
.env
file, copy the following text, paste it in the.env
file, and save it.WALLETCONNECT_PROJECT_ID=44e7bd998ec5a65ca096ab99c9b71af8 API_URL=http://localhost:1234/api
Running the Admin Console#
- Ensure both the agent bot and the backend are running.
- Navigate to the
src
directory. -
You can run the app locally or from Docker:
- To run the app locally:
- Run
npm install
. - Run
npm run dev
. - Open http://localhost:3000 in a browser.
- Run
- To run the app from Docker:
- Run
docker-compose up -d --build
. - Open http://localhost:3000 in a browser.
- Run
The Admin Console dashboard is displayed.
- To run the app locally:
Usage Guide#
Ensure the agent bot, the backend, and the Admin Console are running and that http://localhost:3000 is open in a browser showing the Admin Console dashboard.
The Admin Console dashboard shows:
- The agent's management address, which you configured in the
secrets.json
file - The whitelist status of the management address
- One or more of the agent's bots, all of which are managed from the one management address, and the agents' vaults
- A list of alerts, if you enabled them, and notifications sent from Flare
Connecting to the Admin Console#
Some operations in the Admin Console can be done only by the management address, so you must connect using this address.
- On the Admin Console dashboard, click Connect Wallet, and sign in with your management address.
Adding Agent Vaults#
- On the Admin Console dashboard, locate the agent bot for which you want to add a vault, and click the three dots icon in the Actions column. The Agent Bot Actions menu is displayed.
- Click Add Vault.
- Specify values for required settings FASSET TYPE, VAULT COLLATERAL TOKEN, and the POOL TOKEN SUFFIX.
The suffix identifies your vault and is used to complete the name of the collateral pool token (CPT).
For example,
LBD
. - If necessary, adjust the default values for the other settings.
- Click Save and execute, and then click Confirm to proceed.
Changing Agent Vault Settings#
-
In the Vaults section on the dashboard, locate the agent vault you want to modify, and click the three dots icon in the Actions column. The Vault options menu is displayed.
-
Under Vault actions, click View Vault. The settings for the agent vault are displayed.
-
Click Edit at the top of the page.
- Update your settings. These settings always have time locks to minimize abuse. During the Open Beta, the time-locks are further reduced so that you can try different configurations. Before you save your updates, ensure you understand the time-locks associated with settings you are changing.
- Click Save and execute.
Depositing Vault Collateral#
- In the Vaults section on the dashboard, locate the vault you want to update, and click the three dots icon in the Actions column. The Vault options menu is displayed.
- In the Agent Vault Operations section, click Deposit collateral. The Deposit Collateral window is displayed.
- In the AMOUNT field, specify the amount of collateral to deposit into the vault.
You can deposit only the type of collateral that your vault was created to support.
For example, if you created a
testUSDC
vault, you can deposit onlytestUSDC
. - Click Deposit. A confirmation message is displayed.
Depositing Pool Collateral#
- In the Vaults section on the dashboard, locate the vault you want to update, and click the three dots icon in the Actions column. The Vault options menu is displayed.
- In the Agent Vault Operations section, click Deposit FLR in Pool. The Deposit FLR in Pool window is displayed.
- In the AMOUNT FLR field, specify the amount of
$FLR
to deposit into the collateral pool. - Click Deposit. A confirmation message is displayed.
Activating and Closing Vaults#
Activating a vault makes it publicly available for minting FAssets. To be activated, a vault must contain at least 1 lot for minting.
Closing a vault makes it unavailable for minting FAssets.
-
To activate a vault:
- On the dashboard, locate the vault you want to activate, and click the three dots icon in the Actions column. The Vault options menu is displayed.
- In the Agent Vault Operations section, click Activate Vault (Enter). The Activate Vault window is displayed.
- Read the message in the Activate Vault window about minting requirements, ensure your vault contains at least 1 lot to meet the requirement, and then click Confirm to activate the vault. A confirmation message is displayed.
-
To close a vault:
- On the dashboard, locate the vault you want to close, and click the three dots icon in the Actions column. The Vault options menu is displayed.
- In the Agent Vault Operations section, click Close Vault (Exit). The Deactivate Vault window is displayed.
- Ensure you want to close the vault, and click Confirm to close it. A confirmation message is displayed.