From 5a061d07719aa057c135d3a4014f312451c416c1 Mon Sep 17 00:00:00 2001 From: rjman Date: Tue, 26 Oct 2021 20:36:01 +0800 Subject: [PATCH] Intro liquidation client && Fix launch config (#815) * :recycle: Fix launch script config * :sparkles: Introduce liquidation client to docker-compose * use v1.7.1 in scripts & make prices pallet use Operational dispatch class Co-authored-by: Cheng JIANG --- Makefile | 1 + docker-compose.override.yml | 6 +++++- launch/config.ts | 10 +++++----- launch/index.ts | 2 +- pallets/prices/src/lib.rs | 6 +++--- pallets/prices/src/mock.rs | 7 ++----- scripts/collator.sh | 2 +- scripts/fullnode.sh | 2 +- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 188362c0b..c378da4e5 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,7 @@ launch: shutdown docker image pull parallelfinance/polkadot:$(RELAY_DOCKER_TAG) docker image pull parallelfinance/parallel:$(DOCKER_TAG) docker image pull parallelfinance/stake-client:latest + docker image pull parallelfinance/liquidation-client:latest docker image pull parallelfinance/nominate-client:latest docker image pull parallelfinance/oracle-client:latest docker image pull parallelfinance/parallel-dapp:latest diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 4de805be3..3351e13e6 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -6,7 +6,7 @@ services: image: parallelfinance/parallel-dapp:latest restart: always - oracle: + oracle-client: image: parallelfinance/oracle-client:latest command: start -m 12000 -w ws://parachain-2085-0:9944 restart: always @@ -29,5 +29,9 @@ services: - "redis" restart: always + liquidation-client: + image: parallelfinance/liquidation-client:latest + command: --endpoint ws://parachain-2085-0:9944 + restart: always volumes: redis: diff --git a/launch/config.ts b/launch/config.ts index e7368e673..d2fcbd0c6 100644 --- a/launch/config.ts +++ b/launch/config.ts @@ -1,5 +1,5 @@ const config = { - liquidAsset: 5000, + liquidAsset: 1000, stakingAsset: 100, assets: [ { @@ -22,14 +22,14 @@ const config = { } }, state: 'Pending', - ptokenId: 1000 + ptokenId: 2100 }, balances: [] }, { name: 'Parallel Kusama', symbol: 'XKSM', - assetId: 5000, + assetId: 1000, decimal: 12, marketOption: { closeFactor: 50e4, @@ -46,7 +46,7 @@ const config = { } }, state: 'Pending', - ptokenId: 2000 + ptokenId: 3000 }, balances: [] }, @@ -70,7 +70,7 @@ const config = { } }, state: 'Pending', - ptokenId: 1002 + ptokenId: 2102 }, balances: [['5HHMY7e8UAqR5ZaHGaQnRW5EDR8dP7QpAyjeBu6V7vdXxxbf', '100000000000000000000']] } diff --git a/launch/index.ts b/launch/index.ts index e5f57b538..2a77b297d 100644 --- a/launch/index.ts +++ b/launch/index.ts @@ -36,7 +36,7 @@ async function main() { let call = [] for (const { name, symbol, assetId, decimal, marketOption, balances } of config.assets) { - console.log(`Create ${name}(${symbol}) asset.`) + console.log(`Create ${name}(${symbol}) asset, ptokenId is ${marketOption.ptokenId}`) call.push( api.tx.sudo.sudo(api.tx.assets.forceCreate(assetId, signer.address, true, 1)), api.tx.sudo.sudo(api.tx.assets.forceSetMetadata(assetId, name, symbol, decimal, false)), diff --git a/pallets/prices/src/lib.rs b/pallets/prices/src/lib.rs index f8b159441..620aa99ec 100644 --- a/pallets/prices/src/lib.rs +++ b/pallets/prices/src/lib.rs @@ -22,7 +22,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use frame_support::{log, pallet_prelude::*, transactional}; +use frame_support::{log, pallet_prelude::*, transactional, weights::DispatchClass}; use frame_system::pallet_prelude::*; use orml_oracle::DataProviderExtended; use orml_traits::DataProvider; @@ -97,7 +97,7 @@ pub mod pallet { #[pallet::call] impl Pallet { /// Set emergency price - #[pallet::weight(::WeightInfo::set_price())] + #[pallet::weight((::WeightInfo::set_price(), DispatchClass::Operational))] #[transactional] pub fn set_price( origin: OriginFor, @@ -112,7 +112,7 @@ pub mod pallet { } /// Reset emergency price - #[pallet::weight(::WeightInfo::reset_price())] + #[pallet::weight((::WeightInfo::reset_price(), DispatchClass::Operational))] #[transactional] pub fn reset_price( origin: OriginFor, diff --git a/pallets/prices/src/mock.rs b/pallets/prices/src/mock.rs index f38fe8ada..ec7fd3a77 100644 --- a/pallets/prices/src/mock.rs +++ b/pallets/prices/src/mock.rs @@ -17,17 +17,14 @@ use super::*; use frame_support::{construct_runtime, ord_parameter_types, parameter_types, traits::Everything}; use frame_system::EnsureSignedBy; -pub use primitives::tokens::{DOT, KSM, XDOT, XKSM}; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup, FixedPointNumber}; +pub use primitives::tokens::{DOT, KSM, XDOT, XKSM}; + pub type AccountId = u128; pub type BlockNumber = u64; -mod prices { - pub use super::super::*; -} - parameter_types! { pub const BlockHashCount: u64 = 250; } diff --git a/scripts/collator.sh b/scripts/collator.sh index 26c043cb2..cbffd5059 100755 --- a/scripts/collator.sh +++ b/scripts/collator.sh @@ -44,7 +44,7 @@ docker run --restart=always --name heiko-collator \ -p $RELAY_P2P_PORT:$RELAY_P2P_PORT \ -v "$VOLUME:/data" \ -v "$(realpath $KEYSTORE_PATH):/app/keystore" \ - parallelfinance/parallel:v1.0.0 \ + parallelfinance/parallel:v1.7.1 \ -d /data \ --chain=$PARA_CHAIN \ --collator \ diff --git a/scripts/fullnode.sh b/scripts/fullnode.sh index 2c57cc714..255ba6419 100755 --- a/scripts/fullnode.sh +++ b/scripts/fullnode.sh @@ -36,7 +36,7 @@ docker run --restart=always --name heiko-fullnode \ -p $RELAY_RPC_PORT:$RELAY_RPC_PORT \ -p $RELAY_P2P_PORT:$RELAY_P2P_PORT \ -v "$VOLUME:/data" \ - parallelfinance/parallel:v1.0.0 \ + parallelfinance/parallel:v1.7.1 \ -d /data \ --chain=$PARA_CHAIN \ --parachain-id=$PARA_ID \