{"id":20907321,"url":"https://github.com/cumpsd/chainflip-lp","last_synced_at":"2025-05-13T06:33:57.079Z","repository":{"id":253841237,"uuid":"844696940","full_name":"CumpsD/chainflip-lp","owner":"CumpsD","description":"Automated Chainflip LP Orders","archived":false,"fork":false,"pushed_at":"2024-11-01T13:07:27.000Z","size":856,"stargazers_count":4,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-01T14:18:53.617Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CumpsD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-19T19:39:19.000Z","updated_at":"2024-11-01T13:06:47.000Z","dependencies_parsed_at":"2024-08-27T15:39:38.022Z","dependency_job_id":null,"html_url":"https://github.com/CumpsD/chainflip-lp","commit_stats":null,"previous_names":["cumpsd/chainflip-lp"],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CumpsD%2Fchainflip-lp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CumpsD%2Fchainflip-lp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CumpsD%2Fchainflip-lp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CumpsD%2Fchainflip-lp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CumpsD","download_url":"https://codeload.github.com/CumpsD/chainflip-lp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225184580,"owners_count":17434354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T13:37:51.022Z","updated_at":"2024-11-18T13:37:51.712Z","avatar_url":"https://github.com/CumpsD.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chainflip Stablecoin Liquidity Provisioning Bot\n\n\u003e Earn yield without Impermanent Loss risks!\n\n## Demo\n\n[![Chainflip Stablecoin Liquidity Provisioning Bot Demo](https://img.youtube.com/vi/iaxfLvpclaQ/0.jpg)](https://www.youtube.com/watch?v=iaxfLvpclaQ \"Chainflip Stablecoin Liquidity Provisioning Bot Demo\")\n\n## Description \n\nChainflip provides people the ability to earn a liquidity provisioning fee of 0.05% on every swap which uses the liquidity pool the user has deposited funds in.\n\nThe way Chainflip liquidity provisioning works is by having limit and range orders in a liquidity pool. While range orders are passive in nature, they are a lower class citizen compared to limit orders. Limit orders need to be actively managed however.\n\nThis managing can be done manually via the Chainflip LP Dashboard, or automatically via the Chainflip LP API. The manual approach is still in reach for retail users but requires constant babysitting to place new orders. The automated way is too complicated for retail users.\n\nThis bot automates limit orders according to a user their price preferences, automatically placing new limit orders when balance is available.\n\nThe orders are limited to the USDT/USDC/arbUSDC stablecoin pools since they do not require tracking index prices and are low risk because there is no impermanent loss risk. A dollar for a dollar.\n\n* Slides are available at [drive.google.com/file/d/1rjavro4P2e0Z0Im4BeMyipPK5Ra-mpb4](https://drive.google.com/file/d/1rjavro4P2e0Z0Im4BeMyipPK5Ra-mpb4)\n* Presentation is available at [youtube.com/watch?v=iaxfLvpclaQ](https://youtube.com/watch?v=iaxfLvpclaQ)\n\n## Usage\n\n### Prerequisites\n\n* A recent Docker version: [docs.docker.com/engine/install/ubuntu/](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)\n* The `docker-compose-plugin` installed. This should be present if you followed the Docker installation instructions.\n* If you want to run as root, make sure to add `-u root` to every `docker run` command below.\n\n### Bot Configuration\n\nStart by downloading the `docker-compose.yml` file, or copying it:\n\nLinux users can also run `wget https://raw.githubusercontent.com/CumpsD/chainflip-lp/main/docker-compose.yml`\n\n```yml\nservices:\n  lp:\n    image: chainfliplabs/chainflip-lp-api:1.5\n    pull_policy: always\n    stop_grace_period: 5s\n    stop_signal: SIGINT\n    restart: unless-stopped\n    environment:\n      - RUST_LOG=info\n    volumes:\n      - .:/etc/chainflip/keys\n    entrypoint:\n      - /usr/local/bin/chainflip-lp-api\n    command:\n      - --state_chain.ws_endpoint=wss://mainnet-rpc.chainflip.io:443\n\n  cf-lp:\n    image: ghcr.io/cumpsd/chainflip-lp:v8.0.9\n    pull_policy: always\n    restart: unless-stopped\n    working_dir: \"/app\"\n    environment:\n      - DOTNET_PRINT_TELEMETRY_MESSAGE=false\n      - Bot__EnableLp=true\n      - Bot__QueryDelay=60000\n      - Bot__NodeRpcUrl=https://mainnet-rpc.chainflip.io\n      - Bot__LpRpcUrl=http://lp\n      - Bot__LpAccount=cF_YOUR_LP_ACCOUNT\n      - Bot__DustOrderSize=5\n      - Bot__MinimumOrderSize=20\n      - Bot__TelegramChannelId=-1001234567890\n      - Bot__Pools__0__Chain=Ethereum\n      - Bot__Pools__0__Asset=USDT\n      - Bot__Pools__0__Slice=80\n      - Bot__Pools__0__MinBuyTick=0\n      - Bot__Pools__0__MaxBuyTick=1\n      - Bot__Pools__0__MinSellTick=0\n      - Bot__Pools__0__MaxSellTick=-1\n      - Bot__Pools__1__Chain=Arbitrum\n      - Bot__Pools__1__Asset=USDC\n      - Bot__Pools__1__Slice=20\n      - Bot__Pools__1__MinBuyTick=0\n      - Bot__Pools__1__MaxBuyTick=1\n      - Bot__Pools__1__MinSellTick=0\n      - Bot__Pools__1__MaxSellTick=-1\n      - Serilog__MinimumLevel__Override__ChainflipLp=Information\n    depends_on:\n      - lp\n```\n\n### New User (no existing Chainflip signing key)\n\n#### Generate Keys\n\nWe start by generating a new signing key for the Chainflip LP API. This will be your LP account. Run the following command and save the **Validator Account ID** and **Seed Phrase**!\n\n```bash\ndocker run -v .:/etc/chainflip --entrypoint=/usr/local/bin/chainflip-cli chainfliplabs/chainflip-cli:1.4 generate-keys --path .\n```\n\n#### Funding\n\nThe following steps need to be followed to fund your LP account with FLIP, which is needed to submit transactions to the Chainflip network. These steps are explained in detail in [the Chainflip Funding documentation](https://docs.chainflip.io/validators/mainnet/funding/funding-and-bidding#adding-funds-to-your-validator-node).\n\n\u003e Note: The minimum funding amount for registering as a Broker or LP role is technically 1 FLIP. However, we recommend funding your accounts with at least 5 FLIP to account for transaction fees.\n\n1. Make sure you have `$FLIP` (ERC-20) in your EVM crypto wallet.\n2. Go to [Chainflip Auctions Dashboard](https://auctions.chainflip.io/) \u003e \"[**My Nodes**](https://auctions.chainflip.io/nodes)\".\n3. Connect your crypto wallet containing the `$FLIP`.\n4. Click the button \"**+ Add Node**\" \u003e You should see the \"**Register new node**\" dialog.\n5. Enter the Validator ID you got during [the previous step](#generate-keys) — your `Validator Public Key (SS58)`— and the amount of `$FLIP` you want to fund. Click on \"**Add Funds**\".\n6. Your crypto wallet will ask you to sign two transactions. The first one is a token approval and the second one transfers and add funds to your validator.\n7. Congratulations! Your LP account is now funded, you can now jump ahead to the [All Users steps](#all-users) below.\n\n### Existing User (has Chainflip LP signing key)\n\nEither:\n* Add your `signing_key_file` next to the `docker-compose.yml` file if you have an existing one.\n* Create a `signing_key_file` containing the private key of your Chainflip LP account and make sure it has **no trailing newline**!\n\nIf you do not have your private key anymore, but you have your seed phrase, run the following:\n\n```bash\ndocker run -v .:/etc/chainflip --entrypoint=/usr/local/bin/chainflip-cli chainfliplabs/chainflip-cli:1.4 generate-keys --path . --seed-phrase \"12 words here\"\n```\n\nProceed to the [All Users steps](#all-users) below once you have this.\n\n### All Users\n\n#### Creating a Telegram Group\n\n1. Create a new group.\n2. Invite `@chainflip_lp_bot` to the new group.\n3. Find the group channel id, you can do this by getting the link to the group, it is the number behind the `#` sign. (For example https://web.telegram.org/k/#-1001234567890)\n\n#### Configuring the bot\n\n1. Open the `docker-compose.yml` file.\n2. Replace `cF_YOUR_LP_ACCOUNT` with your LP account.\n3. Replace `-1001234567890` with the telegram channel id.\n4. If needed, configure the `_Slice` settings to how you would like to balance your funds between USDT and arbUSDC. The total needs to be **100**! (In the example above, it is divided in 80/20)\n5. Save the file.\n6. Run `docker compose up -d` to start the bot.\n7. Run `docker compose logs -f -n 100` to follow the logs.\n8. Every minute it will output the status of your balance, open orders and perform order placing activity.\n\n#### Deposit Liquidity\n\n1. Go to [Chainflip Liquidity Dashboard](https://lp.chainflip.io).\n2. If needed, install Polkadot.js and import your Chainflip LP account.\n3. Deposit USDC, USDT or arbUSDC into your account.\n\n## Technical Information\n\nThis project uses:\n\n* [LP API](https://docs.chainflip.io/lp/integrations/lp-api)\n* [LP API RPCs](https://docs.chainflip.io/lp/integrations/lp-api#rpc-methods)\n* [Node RPCs](https://docs.chainflip.io/lp/integrations/lp-rpcs)\n\nTo simplify setup for a user, Docker has been used to bundle the LP API in a preconfigured way with the public Chainflip Node RPC. Thanks to this a user only has to provide their keys to run the Liquidity Bot, and not have to set up an LP API themselves.\n\nThe RPC methods are used to retrieve a user their available undeployed balance. Based on the available balance and the configured minimum order amount it then proceeds to place a limit order.\n\nThis limit order takes into account the user their share preference between the USDT/USDC and arbUSDC/USDC pools. (solUSDC can easily be added when it launches). Additionally the limit order also respects the configured tick price for each pool.\n\nWhen an order is placed, a Telegram bot informs the user about this as well.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcumpsd%2Fchainflip-lp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcumpsd%2Fchainflip-lp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcumpsd%2Fchainflip-lp/lists"}