Skip to content

Commit

Permalink
Merge pull request #751 from galacticcouncil/feat/stableswap-refactor
Browse files Browse the repository at this point in the history
refactor: small stableswap refactor and docs update
  • Loading branch information
enthusiastmartin authored Jan 31, 2024
2 parents 7aad09b + b0e1011 commit d35ad7d
Show file tree
Hide file tree
Showing 20 changed files with 921 additions and 405 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

139 changes: 22 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+
Go to the polkadot apps at https://polkadot.js.org/apps

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:

```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://rpc.hydradx.cloud`
- local node: `ws://localhost:8000` (if you are using chopsticks)

### Testing of storage migrations and runtime upgrades

Expand All @@ -183,5 +77,16 @@ 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
Useful resources:

* /~https://github.com/galacticcouncil/HydraDX-security
* https://apidocs.bsx.fi/HydraDX
* https://docs.hydradx.io/
* https://docs.hydradx.io/omnipool_design
* https://docs.hydradx.io/fees

Bug bounty: [https://immunefi.com/bounty/hydradx/](https://immunefi.com/bounty/hydradx/)

Reponsible disclosure: security@hydradx.io
3 changes: 2 additions & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime-integration-tests"
version = "1.17.1"
version = "1.17.2"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down 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

0 comments on commit d35ad7d

Please sign in to comment.