Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/collator_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ su - hydra

## Download and configure the `hydradx` binary

Pick a 12.x release, we are using `v12.1.0` from our assets repository:
Pick a 12.x release, we are using `v13.1.0` from our assets repository:

```bash
wget https://github.com/galacticcouncil/HydraDX-node/releases/download/v12.1.0/hydradx
wget https://github.com/galacticcouncil/HydraDX-node/releases/download/v13.1.0/hydradx
sudo mv hydradx /usr/local/bin
sudo chmod +x /usr/local/bin/hydradx
sudo chown hydra:hydra /usr/local/bin/hydradx
Expand Down
68 changes: 68 additions & 0 deletions docs/howto_list_token_in_omnipool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
id: howto_list_token_in_omnipool
title: List Token in the Omnipool
---

import useBaseUrl from '@docusaurus/useBaseUrl';

On this page you will find the **requirements and process for listing a project's token in the Omnipool**.


## 00 Prerequisites

With all tokens pooled into a single pool, we must take extra precautions to avoid exposing the Omnipool to large swings in token values due to market manipulation. Therefore the requirements for listing a token in the Omnipool are listed below. There may be exceptions, or additional criteria preventing a token from being listed in the Omnipool since it is difficult to define absolute rules that apply in all situations. The actual decision lies with HDX token holders who may still reject a token that meets all criteria and may accept a token that does not.

1. The token must have already gone through price discovery for at least eight months. Must be listed on a DEX with at least $100k liquidity and/or listed on a CEX with active market maker support maintaining a 2% depth of at least $2k. Ideally the token is listed on at least two exchanges.
2. Sudo control of the chain/token must have been removed or revoked. This could involve the removal of the `sudo` pallet entirely, removing a registered sudo key, or in the case of AssetHub tokens the provable burning of any administrative control over the token.
3. The project must have active token holder governance. Ideally through the use of OpenGov. We recommend setting up automated governance notifications (such as web3alerts) to mitigate governance attacks.
4. The project must have transparent market data available, including the ability to inspect transactions via a block explorer.
5. The token must be sufficiently distributed to avoid individuals causing large price swings. At least 40% of the token supply must be distributed and in circulation.
6. The token must have a market cap of at least $1M.

For new projects, a typical token launch sequence would be to perform a fair token launch using a [Liquidity Boostrapping Pool (LBP)](https://docs.hydradx.io/lbp) followed by the LBP liquidity being deposited into an Isolated Pair. Isolated Pairs can be permissionlessly created and swaps on the Hydration platform are automatically routed through both the Omnipool and Isolated Pairs, so new projects can still create their first DEX liquidity on Hydration even before their token qualifies for listing in the Omnipool. After eight months of continued price discovery, the team can apply for the token to be listed in the Omnipool if it meets the criteria above.


## 01 Listing Process

Initial listing of a token in the Omnipool is controlled by Hydration governance.

1. Open XCM channel (bidirectional HRMP channels).
2. List the token in the Hydration asset registry.
3. Hydration community vote on whether to allow listing the token in the Omnipool. The governance vote will not directly list the token but instead will include a remark to authorize listing in the Omnipool. Hydra community will also decide what the cap will be for the token as a percentage of overall Omnipool TVL. Currently each parachain token is capped at 5% of the Omnipool but will be lowered as the Omnipool asset list diversifies.
3. Initial token liquidity is transferred from team or treasury into either the chain's sibling acct on the Hydration chain or into the Omnipool account (`7L53bUTBbfuj14UpdCNPwmgzzHSsrsTWBHX5pys32mVWM3C1`).
4. HydraDX council passes a fast-track motion (including initial asset price) to add the initial liquidity to the Omnipool and enable trading. The resulting ownership NFT will be placed in the chain's sibling acct (or designated project/team acct for non-parachain tokens).

How much initial liquidity?
* For tokens with an FDV up to $50M, the minimum team/treasury deposit into the Omnipool is $300k worth of tokens.
* For tokens with an FDV above $50M, the minimum team/treasury deposit into the Omnipool is $500k worth of tokens.

Each community should consider depositing additional tokens later to bring the deposit up to $1M or up to 2.5% of FDV, in line with other community deposits. Hydra's DCA feature allows swaps to be spread out, enabling larger trades over time, but loan liquidations need to happen within a single block and therefore deeper token liquidity enables larger money markets for the token.

## 02 Managing Treasury Deposits in the Omnipool

Once initial Omnipool listing has been performed, a parachain/token's governance body can control their deposit remotely over XCM. Note that as a security precaution no account can add or remove more than 5% of the liquidity of a token within a single block and therefore large deposits and withdrawals must be performed incrementally unless assisted by Hydra governance.

### Depositing Additional Liquidity

The general process to make a large deposit remotely is:
1. Manually try to deposit tokens as liquidity in the Hydration UI to see what the current maximum deposit limit is.
2. Use `xtokens.transfer` or similar to transfer the new tokens to the chain's sibling acct on HydraDX (plus like 20 tokens to use to pay XCM fees)
3. Schedule once every 1 block repeating x times to deposit a chunk of tokens into the Omnipool. LP NFTs will automatically be placed in the account that the deposit is happening from. If your chain does not have the ability to schedule XCM transactions (using the `scheduler` pallet) then you likely should seek Hydra governance assistance in performing the deposit.

**Example from Centrifuge:**
Transfer 750k CFG, then deposit 37500 tokens 20 times (costs 0.442 CFG in XCM fees)
encoded call data: `0x3e02083e0300016d6f646c70792f747273727900000000000000000000000000000000000000007c00000000904cbb5f69aad29e00000000000003010200c91f01007369626cef070000000000000000000000000000000000000000000000000000003f040100000001010000001400000000790003010100c91f0314000400010200bd1f060200010000000000000000000000000000000000000000000000000000000000000013000064a7b3b6e00d1300010200bd1f060200010000000000000000000000000000000000000000000000000000000000000013000064a7b3b6e00d0006010700f2052a0102000400583b020d0000000000701c7cf40ae1f007000000000000140d0100000101007369626cef070000000000000000000000000000000000000000000000000000`

**Example from Phala:**
Transfer 4.08M PHA, then deposit 48000 PHA 85 times (costs 6.9 PHA in XCM fees)
encoded call data: `0x030208030300016d6f646c70792f747273727900000000000000000000000000000000000000005200000000001300407db892249f38010200c91f01007369626cf30700000000000000000000000000000000000000000000000000000007040100000001010000005500000001210003010100c91f0314000400010100cd1f00070010a5d4e81300010100cd1f00070010a5d4e80006010700f2052a0102000400583b0208000000000038e5be87aa000000000000000000140d0100000101007369626cf3070000000000000000000000000000000000000000000000000000`

### Removing Liquidity

Omnipool liquidity must be removed using the number of each specific LP NFT. It is again limited to 5% of the liquidity for that individual token.

1. Use `assetRegistry->assetIds()` to find the index for your token in the Hydration asset registry.
2. Use `uniques->acount(acct, 1337)` to find the IDs of the LP NFTs.
3. Use `omnipool->positions(ID)` to get the details about each LP NFT. Specifically, the `amount` of tokens it represents. If the amount is greater than 5% of the token's liquidity in the Omnipool you can't remove all of liquidity of that LP in a single block and need to split it up.
4. Create a series of XCM messages to call `omnipool.removeLiquidity(positionID, amount)` for each of the LP NFTs.

18 changes: 9 additions & 9 deletions docs/node_monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ $ sudo chown -R prometheus:prometheus /var/lib/prometheus

### Install Prometheus {#install-prometheus}

Check latest version number of Prometheus at the [GitHub release page](https://github.com/prometheus/prometheus/releases/).
Check latest version number of Prometheus at the [GitHub release page](https://github.com/prometheus/prometheus/releases/).
At the time of writing it is v2.34.0. Insert the latest release version in the following commands.

```shell script
# download prometheus
$ wget https://github.com/prometheus/prometheus/releases/download/v2.34.0/prometheus-2.34.0.linux-amd64.tar.gz
$ wget https://github.com/prometheus/prometheus/releases/download/v2.39.1/prometheus-2.39.1.linux-amd64.tar.gz

# unpack the binaries
$ tar xfz prometheus-*.tar.gz
Expand Down Expand Up @@ -187,13 +187,13 @@ At the time of writing the latest version was `1.3.1`.
Download the latest release.

```shell script
$ wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
$ wget https://github.com/prometheus/node_exporter/releases/download/v1.4.0/node_exporter-1.4.0.linux-amd64.tar.gz
```

Unpack the archive you just downloaded. This will create a folder called `node_exporter-1.3.1.linux-amd64`.

```shell script
$ tar xvf node_exporter-1.3.1.linux-amd64.tar.gz
$ tar xvf node_exporter-1.4.0.linux-amd64.tar.gz
```

Next we copy the binary into our local application directory and assign it to our monitoring user.
Expand Down Expand Up @@ -242,19 +242,19 @@ WantedBy=multi-user.target
We will now activate and start the service with this one-liner.

```shell script
$ sudo systemctl daemon-reload && systemctl enable node_exporter && systemctl start node_exporter
$ sudo systemctl daemon-reload && sudo systemctl enable node_exporter && sudo systemctl start node_exporter
```

### Add Scrape Job for Node Exporter {#add-scrape-job-for-node-exporter}

The Node Exporter is now up and running but we need to tell Prometheus to scrape its data.
The Node Exporter is now up and running but we need to tell Prometheus to scrape its data.
We will open the configuration file once again with the editor of choice.

```shell script
$ sudo nano /etc/prometheus/prometheus.yml
```

And at the very bottom of the file we will append one more scrape config.
And at the very bottom of the file we will append one more scrape config.
Paste the following content and save the file.

```yaml
Expand Down Expand Up @@ -286,8 +286,8 @@ At the time of writing the latest version was `8.4.6`.

```shell script
$ sudo apt-get install -y adduser libfontconfig1
$ wget https://dl.grafana.com/oss/release/grafana_8.4.6_amd64.deb
$ sudo dpkg -i grafana_8.4.6_amd64.deb
$ wget https://dl.grafana.com/oss/release/grafana_9.2.1_amd64.deb
$ sudo dpkg -i grafana_9.2.1_amd64.deb
```

The package comes with a builtin `systemd`-service which we will configure and start just like the Prometheus service.
Expand Down
3 changes: 2 additions & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ module.exports = {
type: "category",
label: "Connect to a Node",
items: ["polkadotjs_apps_local", "polkadotjs_apps_public"],
}
},
"howto_list_token_in_omnipool",
],
"Learn": [
"learn_amm",
Expand Down