Skip to content

Commit 67e39a0

Browse files
gianfra-tebma
andauthored
addition of spwacewalk pallets to pendulum (#401)
* addition of spwacewalk pallets to pendulum * Update node/src/chain_spec.rs Co-authored-by: Marcel Ebert <mail@marcel-ebert.de> * fix incorrect field in genesis function * indentation * try to fix strange indentation issue * indentation 2 --------- Co-authored-by: Marcel Ebert <mail@marcel-ebert.de>
1 parent cbe4614 commit 67e39a0

5 files changed

Lines changed: 613 additions & 66 deletions

File tree

Cargo.lock

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/chain_spec.rs

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ pub fn pendulum_config() -> PendulumChainSpec {
331331
vesting_schedules.clone(),
332332
multisig_genesis.clone(),
333333
pendulum::PARACHAIN_ID.into(),
334+
false,
334335
)
335336
},
336337
// Bootnodes
@@ -412,6 +413,10 @@ pub fn development_config() -> DevelopmentChainSpec {
412413
)
413414
}
414415

416+
fn default_pair(currency_id: CurrencyId) -> VaultCurrencyPair<CurrencyId> {
417+
VaultCurrencyPair { collateral: currency_id, wrapped: MAINNET_USDC_CURRENCY_ID }
418+
}
419+
415420
fn amplitude_genesis(
416421
invulnerables: Vec<AccountId>,
417422
signatories: Vec<AccountId>,
@@ -420,10 +425,6 @@ fn amplitude_genesis(
420425
id: ParaId,
421426
start_shutdown: bool,
422427
) -> amplitude_runtime::GenesisConfig {
423-
fn default_pair(currency_id: CurrencyId) -> VaultCurrencyPair<CurrencyId> {
424-
VaultCurrencyPair { collateral: currency_id, wrapped: MAINNET_USDC_CURRENCY_ID }
425-
}
426-
427428
let mut balances: Vec<_> = signatories
428429
.iter()
429430
.cloned()
@@ -852,6 +853,7 @@ fn pendulum_genesis(
852853
vesting_schedules: Vec<(AccountId, BlockNumber, BlockNumber, Balance)>,
853854
sudo_account: AccountId,
854855
id: ParaId,
856+
start_shutdown: bool,
855857
) -> pendulum_runtime::GenesisConfig {
856858
let mut genesis_issuance = pendulum::TOTAL_INITIAL_ISSUANCE;
857859
for balance in balances.clone() {
@@ -921,6 +923,75 @@ fn pendulum_genesis(
921923
..Default::default()
922924
},
923925
vesting: pendulum_runtime::VestingConfig { vesting: vesting_schedules },
926+
issue: pendulum_runtime::IssueConfig {
927+
issue_period: amplitude_runtime::DAYS,
928+
issue_minimum_transfer_amount: 1000,
929+
limit_volume_amount: None,
930+
limit_volume_currency_id: XCM(0),
931+
current_volume_amount: 0u32.into(),
932+
interval_length: (60u32 * 60 * 24),
933+
last_interval_index: 0u32,
934+
},
935+
redeem: pendulum_runtime::RedeemConfig {
936+
redeem_period: pendulum_runtime::DAYS,
937+
redeem_minimum_transfer_amount: 1000,
938+
limit_volume_amount: None,
939+
limit_volume_currency_id: XCM(0),
940+
current_volume_amount: 0u32.into(),
941+
interval_length: (60u32 * 60 * 24),
942+
last_interval_index: 0u32,
943+
},
944+
replace: pendulum_runtime::ReplaceConfig {
945+
replace_period: pendulum_runtime::DAYS,
946+
replace_minimum_transfer_amount: 1000,
947+
},
948+
security: pendulum_runtime::SecurityConfig {
949+
initial_status: if start_shutdown {
950+
pendulum_runtime::StatusCode::Shutdown
951+
} else {
952+
pendulum_runtime::StatusCode::Error
953+
},
954+
},
955+
oracle: pendulum_runtime::OracleConfig {
956+
max_delay: u32::MAX,
957+
oracle_keys: vec![
958+
Key::ExchangeRate(CurrencyId::XCM(0)),
959+
Key::ExchangeRate(MAINNET_USDC_CURRENCY_ID),
960+
],
961+
},
962+
vault_registry: pendulum_runtime::VaultRegistryConfig {
963+
minimum_collateral_vault: vec![(XCM(0), 0)],
964+
punishment_delay: pendulum_runtime::DAYS,
965+
secure_collateral_threshold: vec![(
966+
default_pair(XCM(0)),
967+
FixedU128::checked_from_rational(150, 100).unwrap(),
968+
)],
969+
/* 150% */
970+
premium_redeem_threshold: vec![(
971+
default_pair(XCM(0)),
972+
FixedU128::checked_from_rational(130, 100).unwrap(),
973+
)],
974+
/* 130% */
975+
liquidation_collateral_threshold: vec![(
976+
default_pair(XCM(0)),
977+
FixedU128::checked_from_rational(120, 100).unwrap(),
978+
)],
979+
/* 120% */
980+
system_collateral_ceiling: vec![(
981+
default_pair(XCM(0)),
982+
60_000 * 10u128.pow(pendulum::TOKEN_DECIMALS),
983+
)],
984+
},
985+
stellar_relay: pendulum_runtime::StellarRelayConfig::default(),
986+
fee: pendulum_runtime::FeeConfig {
987+
issue_fee: FixedU128::checked_from_rational(15, 10000).unwrap(), // 0.15%
988+
issue_griefing_collateral: FixedU128::checked_from_rational(5, 100000).unwrap(), // 0.005%
989+
redeem_fee: FixedU128::checked_from_rational(5, 1000).unwrap(), // 0.5%
990+
premium_redeem_fee: FixedU128::checked_from_rational(5, 100).unwrap(), // 5%
991+
punishment_fee: FixedU128::checked_from_rational(1, 10).unwrap(), // 10%
992+
replace_griefing_collateral: FixedU128::checked_from_rational(1, 10).unwrap(), // 10%
993+
},
994+
nomination: pendulum_runtime::NominationConfig { is_nomination_enabled: false },
924995
}
925996
}
926997

node/src/rpc.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ where
5252
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
5353
module.merge(Staking::new(client.clone()).into_rpc())?;
5454
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
55+
module.merge(Issue::new(client.clone()).into_rpc())?;
56+
module.merge(Redeem::new(client.clone()).into_rpc())?;
57+
module.merge(Replace::new(client.clone()).into_rpc())?;
58+
module.merge(VaultRegistry::new(client.clone()).into_rpc())?;
59+
module.merge(Oracle::new(client.clone()).into_rpc())?;
5560
module.merge(FarmingRpc::new(client.clone()).into_rpc())?;
5661
module.merge(ZenlinkProtocol::new(client).into_rpc())?;
5762
Ok(module)

0 commit comments

Comments
 (0)