Skip to content

Using the Command Line to Deposit Collateral#

As a user of the FAssets system, you can deposit collateral into an agent's collateral pool to provide additional financial backing for the agent. In exchange for your collateral, you will earn shares of the agent's fees. Additionally, you will receive collateral pool tokens, which you will be able to redeem, transfer, or trade.

While the functionality to deposit collateral via a dapp is being developed, this guide is for users who have some experience using a terminal. It provides the following information:

  • How to set up the FAssets command-line tool
  • How to get a list of available agents
  • How to deposit collateral into a selected agent's collateral pool

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 a server with at least a minimum of 2 CPUs and 4GB RAM, or 2GB if the database is on a separate server.

You need knowledge of the following tools:

Warning

If you are using Windows, it is strongly recommended to use Windows Subsystem for Linux, version 2 (WSL 2).

Setting up the FAssets tools#

Setting up After Testnet XRP Reset#

Info

This section is only for users using FAssets before the testnet XRP reset, so please read more.

Suppose you previously ran the FAssets agent before the XRP testnet reset. You will need to skip the whitelisting part but still need to:

  • pull the latest changes from the repository by git pull;
  • build then with yarn && yarn build;
  • installing the MySQL database and setting it up following the guide later in this document;
  • create a new agent using the existing management address following the guide.

Clone and Setup the Tools Repository#

Info

If you set up an FAssets agent, bot or user, please use a separate directory for each role.

  1. Clone the repository and enter the working directory:

    git clone https://github.com/flare-labs-ltd/fasset-bots.git
    cd fasset-bots
    
  2. Switch to the open_beta branch:

    git checkout open_beta
    
  3. Install dependencies and build the project:

    yarn && yarn build
    

    Info

    Fresh installation can take more than 10 minutes, depending on if you have cached dependencies before.

  4. Copy the environment file from a template .env.template to .env:

    cp .env.template .env
    

Configure User's Access Keys#

The FAsset user operates with multiple keys for the Flare and underlying network chains.

  1. Generate the user's secrets using this command:

    yarn key-gen generateSecrets --user -o secrets.json
    

    Info

    This command can only be executed once, after which all secret keys will be generated. You must use a separate directory for each role you want to perform: agent, bot, or minter and redeemer.

    Warning

    • The addresses in secrets.json are for hot wallets and should not hold large token amounts, as their private keys are on an always-online machine. Keep your main account in an offline wallet and transfer funds as needed.
    • As soon as you create the secrets.json file, back it up, and remember to back it up again whenever you add new keys. Store the backup securely, preferably on an external drive in a physical vault, as unauthorized access can compromise the agent. You need to make regular backups only if you make changes.
  2. Fund the user's FLR wallet with some CFLR to pay the gas fees. You can find the user wallet's address in the secrets.json file under the user.native.address key. You can get the CFLR tokens from the Flare faucet.

  3. Prevent other users from reading the secrets.json file:

    chmod 600 secrets.json
    
  4. Fill the indexer field in the secrets.json file with the following values:

    "indexer": "123456",
    

    Info

    These values apply only to the Coston Testnet and will be different for other networks.

Depositing Collateral into an Agent's Collateral Pool#

The collateral pool can contain only $CFLR, so ensure you funded your wallet with tokens from the faucet, as described in step 2 above.

  1. Use the command below to list all available agents:

    yarn user-bot --fasset FTestXRP agents
    

    A list of agents is displayed.

  2. Copy the address of an agent in the list.

  3. Use the command below to send your collateral to the agent. Replace AGENT_ADDRESS with the address you copied in the previous step, and replace CFLR_AMOUNT with a portion of the funds you received from the faucet.

    yarn agent-bot buyPoolCollateral AGENT_ADDRESS CFLR_AMOUNT --fasset FTestXRP
    

    A message indicates the amount of collateral you successfully provided to the selected agent's collateral pool.