This is a server that interacts with a Liquidity Bridge Contract (LBC) to provide liquidity for users as part of the Flyover protocol. This server performs all the necessary operations to play the role of the Liquidity Provider, involving transactions in both Rootstock and Bitcoin networks.
To run the project locally you can follow these steps:
git clone [email protected]:rsksmart/liquidity-provider-server.git
cd docker-compose/local
export LPS_STAGE=regtest
./lps-env.sh up
This will set up a local environment, please keep in mind that a productive set-up could vary in multiple aspects.
For the unit tests you can run make test
in the root of the repository and for the integration tests please check this file
If you want to play with the code and make modifications to it then run the following commands (remember that you need to have Go installed with the version
specified in the go.mod
file):
git clone [email protected]:rsksmart/liquidity-provider-server.git
make tools
To see the required environment variables to run an instance of this server and its description check the Environment.md file.
The HTTP API provided in this server is divided in two; the public API and the Management (private) API. To understand the purpose of each one of those API check the LP Management file.
To see the details of the interface itself and the structures involved check the OpenAPI.yml file that is in the root of the repository.
The server has the following dependencies:
- Rootstock node
- Bitcoin node
- MongoDB instance
IMPORTANT: liquidity provider server performs sensitive operations and uses non publicly enabled functionality of both Rootstock and Bitcoin nodes. This means that the nodes used to run this server must be private and well protected, the usage of public nodes or nodes that are not properly secured might lead to a loss of funds.
P.S.: if you run the server locally you'll see that the docker compose includes more services than the previously mentioned, that is because the ones mentioned before are the minimal dependencies, but in order to run a fully functional environment more dependencies might be required.
- PegIn: process of converting BTC into RBTC. Here is a diagram with a detailed view of the process.
- PegOut: process of converting RBTC into BTC. Here is a diagram with a detailed view of the process.
The cmd/utils directory contains scripts with different utilities for the liquidity providers. You can either run them directly
with go run
or build them with make utils
. You can run the scripts with the --help
flag to see the available options. The current utilities are:
- update_provider_url: updates the URL of a liquidity provider provided when the discovery function of the Liquidity Bridge Contract is executed.
If you're looking forward to integrate with Flyover Protocol then you can check the Flyover SDK repository.
If you're interested in becoming a liquidity provider then you can read the Liquidity Provider Management file.