Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: small stableswap refactor and docs update #751

Merged
merged 23 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

135 changes: 18 additions & 117 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,15 @@ cargo build --release

## Run

### Local Testnet
### Chopsticks

Relay chain repository (polkadot) has to be built in `../polkadot`
Install `polkadot-launch` utility used to start network.

```
npm install -g polkadot-launch
```
The easiest way to run and interact with HydraDX node is to use [Chopsticks](/~https://github.com/acalanetwork/chopsticks)

Start local testnet with 4 relay chain validators and HydraDX as a parachain with 2 collators.

```
cd ./rococo-local
polkadot-launch config.json
```Bash
npx @acala-network/chopsticks@latest --config=launch-configs/chopsticks/hydradx.yml
```

Observe HydraDX logs

```
multitail 99*.log
```
Now you have a test node running at [`ws://localhost:8000`](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2Flocalhost%3A8000#/explorer)

### Local Testnet with Zombienet

Expand All @@ -73,105 +61,11 @@ zombienet spawn config-zombienet.json

### Interaction with the node

Go to the polkadot apps at https://dotapps.io

Then open settings screen -> developer and paste

*NOTE - FixedU128 type is not yet implemented for polkadot apps. Balance is a measure so price can be reasonably selected. If using polkadot apps to create pool:*
- 1 Mega Units equals 1:1 price
- 20 Mega Units equals 20:1 price
- 50 Kilo Units equals 0.05:1 price

```
{
"types": [
{
"AssetPair": {
"asset_in": "AssetId",
"asset_out": "AssetId"
},
"Amount": "i128",
"AmountOf": "Amount",
"Address": "AccountId",
"OrmlAccountData": {
"free": "Balance",
"frozen": "Balance",
"reserved": "Balance"
},
"BlockNumber": "u32",
"BalanceInfo": {
"amount": "Balance",
"assetId": "AssetId"
},
"Chain": {
"genesisHash": "Vec<u8>",
"lastBlockHash": "Vec<u8>"
},
"CurrencyId": "AssetId",
"CurrencyIdOf": "AssetId",
"Intention": {
"who": "AccountId",
"asset_sell": "AssetId",
"asset_buy": "AssetId",
"amount": "Balance",
"discount": "bool",
"sell_or_buy": "IntentionType"
},
"IntentionId": "Hash",
"IntentionType": {
"_enum": [
"SELL",
"BUY"
]
},
"LookupSource": "AccountId",
"OrderedSet": "Vec<AssetId>",
"Price": "Balance",
"Fee": {
"numerator": "u32",
"denominator": "u32"
},
"VestingScheduleOf": {
"start": "BlockNumber",
"period": "BlockNumber",
"period_count": "u32",
"per_period": "Balance"
}
}
],
"alias": {
"tokens": {
"AccountData": "OrmlAccountData"
}
}
}
```

Connect to the
- Hacknet: `wss://hack.hydradx.io:9944`
- [Stakenet](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc-01.snakenet.hydradx.io): `wss://rpc-01.snakenet.hydradx.io`
- or local node – if you are on chromium based browser, set chrome://flags/#allow-insecure-localhost

### Performance check

Prerequisites: rust/cargo, python 3.8+

With the following script it is possible to run a simple performance check. It might be useful
to determine whether your machine is suitable to run HydraDX node.

From the top-level node directory:
Go to the polkadot apps at https://polkadot.js.org/apps

```bash
./scripts/check_performance.sh
```

This will run series of benchmarks ( which may take a while).
The output will show benchmark results of HydraDX pallets and comparison against reference values.

The most interesting information would be the difference between the HydraDx benchmark value and the local machine's benchmark.

If the difference is >= 0, performance is similar or better.
However, if the difference < 0 - your machine might not be suitable to run HydraDX node. Contact HydraDX devs to discuss the results.
Connect to
- Mainnet: `wss://hack.hydradx.io:9944`
- local node: `ws://localhost:8000` (if you are using chopsticks)

### Testing of storage migrations and runtime upgrades

Expand All @@ -183,5 +77,12 @@ try-runtime --runtime ./target/release/wbuild/hydradx-runtime/hydradx_runtime.wa
```
or against HydraDX testnet on Rococo using `--uri wss://rococo-hydradx-rpc.hydration.dev:443`

### Honorable contributions
[@apopiak](/~https://github.com/apopiak) for great reviews [#87](/~https://github.com/galacticcouncil/HydraDX-node/pull/87) and support.

### Security
You can find details on [HydraDX Security](/~https://github.com/galacticcouncil/HydraDX-security)

Other useful resources:
* https://apidocs.bsx.fi/HydraDX
* https://docs.hydradx.io/
* https://docs.hydradx.io/omnipool_design
* https://docs.hydradx.io/fees
1 change: 1 addition & 0 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ std = [
"polkadot-runtime/std",
"hydradx-runtime/std",
"pallet-staking/std",
"scraper/std",
]

# we don't include integration tests when benchmarking feature is enabled
Expand Down
2 changes: 1 addition & 1 deletion math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = 'Apache-2.0'
name = "hydra-dx-math"
description = "A collection of utilities to make performing liquidity pool calculations more convenient."
repository = '/~https://github.com/galacticcouncil/hydradx-math'
version = "7.7.2"
version = "7.8.0"

[dependencies]
primitive-types = {default-features = false, version = '0.12.0'}
Expand Down
Loading
Loading