Skip to content

Commit

Permalink
Intro liquidation client && Fix launch config (#815)
Browse files Browse the repository at this point in the history
* ♻️ Fix launch script config

* ✨ Introduce liquidation client to docker-compose

* use v1.7.1 in scripts & make prices pallet use Operational dispatch class

Co-authored-by: Cheng JIANG <[email protected]>
  • Loading branch information
0xrjman and GopherJ authored Oct 26, 2021
1 parent 5213338 commit 5a061d0
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
10 changes: 5 additions & 5 deletions launch/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const config = {
liquidAsset: 5000,
liquidAsset: 1000,
stakingAsset: 100,
assets: [
{
Expand All @@ -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,
Expand All @@ -46,7 +46,7 @@ const config = {
}
},
state: 'Pending',
ptokenId: 2000
ptokenId: 3000
},
balances: []
},
Expand All @@ -70,7 +70,7 @@ const config = {
}
},
state: 'Pending',
ptokenId: 1002
ptokenId: 2102
},
balances: [['5HHMY7e8UAqR5ZaHGaQnRW5EDR8dP7QpAyjeBu6V7vdXxxbf', '100000000000000000000']]
}
Expand Down
2 changes: 1 addition & 1 deletion launch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
6 changes: 3 additions & 3 deletions pallets/prices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -97,7 +97,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Set emergency price
#[pallet::weight(<T as Config>::WeightInfo::set_price())]
#[pallet::weight((<T as Config>::WeightInfo::set_price(), DispatchClass::Operational))]
#[transactional]
pub fn set_price(
origin: OriginFor<T>,
Expand All @@ -112,7 +112,7 @@ pub mod pallet {
}

/// Reset emergency price
#[pallet::weight(<T as Config>::WeightInfo::reset_price())]
#[pallet::weight((<T as Config>::WeightInfo::reset_price(), DispatchClass::Operational))]
#[transactional]
pub fn reset_price(
origin: OriginFor<T>,
Expand Down
7 changes: 2 additions & 5 deletions pallets/prices/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/collator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion scripts/fullnode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 5a061d0

Please sign in to comment.