Skip to content

flare-foundation/fasset-bots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FAsset bots

The FAsset system is a protocol that bridges assets from non-smart contract chains to Flare/Songbird. It includes bots that automate actions for various roles (agent, challenger, liquidator) in response to events that need quick reactions, such as collateral reservation, minting, redemption, low collateral ratio, and price changes.

Actors in FAsset system

  • Agent: The main player in the FAsset system.
  • Challenger: Ensures the health of the FAsset system.
  • Liquidator: Liquidates bad agents.
  • SystemKeeper: Keeps the FAsset system in order by opening and closing liquidations.
  • TimeKeeper: Maintains the underlying block by proving and updating it to prevent the current block from being too outdated, which would otherwise shorten the time for minting or redemption payments.

Install

Clone this repository fasset-bots and enter the fasset-bots directory.

git clone [email protected]:flarenetwork/fasset-bots.git
cd fassets-bots

If you are an open beta participant, switch to the open_beta branch.

git checkout open_beta

Install fasset-bots

yarn && yarn build

Install mysql and create a user by following this guide

Setup

With Docker (preferred)

  1. Create .env file containing MySQL username and password for Docker:
    FASSET_DB_USER="fassetbot"
    FASSET_DB_PASSWORD="9owYgVNocTXmRLUGPmcg"
    
  2. Start the setup process by executing this Docker command:
    docker compose --profile setup up
    
  3. Wait until the MySQL and setup services start-up and in another terminal, connect to service to set it up:
    docker compose exec setup bash
    
  4. Continue with agent setup using Official Docs https://docs.flare.network/infra/fassets/deploying-agent/#configure-the-access-keys Once you are finished with setting up the agent, stop the current docker containers and execute the command:
    docker compose --profile run-agent up
    

Manually (not preferred)

Agent Bot

Follow this guide on how to set up an Agent Bot for XRP on Testnet.

How to run

Agent bot

Run yarn run-agent.

The script will create AgentBotRunner. The runner will initiate needed context and connect to native network. Then it will constantly check if any active agent stored in persistent state should handle any incoming events.

In order to create new agent, deposit funds and do other manual operations, command line interface is provided agent-bot. You can access it with opening another terminal and run command yarn agent-bot [command].

Challenger, Liquidator, SystemKeeper, TimeKeeper

Other bots can be run using ActorBaseRunner. The runner will initiate needed context and create desired actor via method async create(config: TrackedStateConfig, address: string, kind: ActorBaseKind), where ActorBaseKind determines which actor should be created.

Example for such scripts:

  • Run yarn run-challenger for Challenger.

  • Run yarn run-liquidator for Liquidator.

  • Run yarn run-systemKeeper for SystemKeeper.

  • Run yarn run-timeKeeper for TimeKeeper.

Helpers: In order to efficiently run Challenger, Liquidation, SystemKeeper some non-persistent state is being tracked with TrackedState and TrackedAgentState. See here.

Agent bot command line interface

Command line interface is provided for Agent bot, User bot and for key/password generation. For more see here.

User bot command line interface

More information about the user bot can be found here.

Examples

REST APIs for Agent bot

Same commands as in cli agent-bot can be run via REST APIs. For more see here.

Logging

Log files are created every hour and can be found in packages/fasset-bots-core/log/.

What to be aware of when testing on Coston and testnet XRP

  • Run TimeKeeper or manually run proveAndUpdateUnderlyingBlock before reserving collateral, before redeeming, ...
  • Newly created testnet XRP account should get initial deposit of at least 10 XRP. Otherwise payment to this account will be rejected by tecNO_DST_INSUF_XRP.

Testnet Faucets

Other Useful Web Clients

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 7