Skip to content

Commit

Permalink
Change signatories of Foucoco chain spec
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenStueber committed Jul 20, 2023
1 parent 44d113a commit 55be2ec
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 76 deletions.
74 changes: 40 additions & 34 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ use sp_runtime::{
};
use spacewalk_primitives::{oracle::Key, Asset, CurrencyId, CurrencyId::XCM, VaultCurrencyPair};

use crate::constants::amplitude::*;

use crate::constants::pendulum;
use crate::constants::{
amplitude, foucoco, pendulum, MAINNET_BRL_CURRENCY_ID, MAINNET_TZS_CURRENCY_ID,
MAINNET_USDC_CURRENCY_ID,
};

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type AmplitudeChainSpec =
Expand Down Expand Up @@ -110,16 +111,16 @@ pub fn amplitude_config() -> AmplitudeChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "AMPE".into());
properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into());
properties.insert("tokenDecimals".into(), amplitude::TOKEN_DECIMALS.into());
properties.insert("ss58Format".into(), amplitude_runtime::SS58Prefix::get().into());

let mut signatories: Vec<_> = INITIAL_AMPLITUDE_SUDO_SIGNATORIES
let mut signatories: Vec<_> = amplitude::INITIAL_SUDO_SIGNATORIES
.iter()
.map(|ss58| AccountId::from_ss58check(ss58).unwrap())
.collect();
signatories.sort();

let invulnerables: Vec<_> = INITIAL_AMPLITUDE_VALIDATORS
let invulnerables: Vec<_> = amplitude::INITIAL_COLLATORS
.iter()
.map(|ss58| AccountId::from_ss58check(ss58).unwrap())
.collect();
Expand All @@ -142,7 +143,7 @@ pub fn amplitude_config() -> AmplitudeChainSpec {
signatories.clone(),
vec![sudo_account.clone()],
sudo_account.clone(),
AMPLITUDE_PARACHAIN_ID.into(),
amplitude::PARACHAIN_ID.into(),
false,
)
},
Expand All @@ -159,7 +160,7 @@ pub fn amplitude_config() -> AmplitudeChainSpec {
// Extensions
Extensions {
relay_chain: "kusama".into(), // You MUST set this to the correct network!
para_id: AMPLITUDE_PARACHAIN_ID,
para_id: amplitude::PARACHAIN_ID,
},
)
}
Expand All @@ -168,24 +169,25 @@ pub fn foucoco_config() -> FoucocoChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "AMPE".into());
properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into());
properties.insert("tokenDecimals".into(), foucoco::TOKEN_DECIMALS.into());
properties.insert("ss58Format".into(), foucoco_runtime::SS58Prefix::get().into());

let mut signatories: Vec<_> = INITIAL_AMPLITUDE_SUDO_SIGNATORIES
let mut signatories: Vec<_> = foucoco::INITIAL_SUDO_SIGNATORIES
.iter()
.map(|ss58| AccountId::from_ss58check(ss58).unwrap())
.collect();
signatories.sort();

let invulnerables: Vec<_> = INITIAL_FOUCOCO_VALIDATORS
let invulnerables: Vec<_> = foucoco::INITIAL_COLLATORS
.iter()
.map(|ss58| AccountId::from_ss58check(ss58).unwrap())
.collect();

let sudo_account =
pallet_multisig::Pallet::<foucoco_runtime::Runtime>::multi_account_id(&signatories[..], 3);

let offchain_worker_price_feeder = AccountId::from_ss58check(OFF_CHAIN_WORKER_ADDRESS).unwrap();
let offchain_worker_price_feeder =
AccountId::from_ss58check(foucoco::OFF_CHAIN_WORKER_ADDRESS).unwrap();

FoucocoChainSpec::from_genesis(
// Name
Expand All @@ -200,7 +202,7 @@ pub fn foucoco_config() -> FoucocoChainSpec {
signatories.clone(),
vec![sudo_account.clone(), offchain_worker_price_feeder.clone()],
sudo_account.clone(),
FOUCOCO_PARACHAIN_ID.into(),
foucoco::PARACHAIN_ID.into(),
false,
)
},
Expand All @@ -217,7 +219,7 @@ pub fn foucoco_config() -> FoucocoChainSpec {
// Extensions
Extensions {
relay_chain: "kusama".into(), // You MUST set this to the correct network!
para_id: FOUCOCO_PARACHAIN_ID,
para_id: foucoco::PARACHAIN_ID,
},
)
}
Expand All @@ -229,7 +231,7 @@ pub fn pendulum_config() -> PendulumChainSpec {

let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "PEN".into());
properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into());
properties.insert("tokenDecimals".into(), pendulum::TOKEN_DECIMALS.into());
properties.insert("ss58Format".into(), pendulum_runtime::SS58Prefix::get().into());

let multisig_genesis = create_pendulum_multisig_account(pendulum::MULTISIG_ID_GENESIS);
Expand Down Expand Up @@ -349,7 +351,7 @@ pub fn development_config() -> DevelopmentChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "UNIT".into());
properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into());
properties.insert("tokenDecimals".into(), foucoco::TOKEN_DECIMALS.into());
properties.insert("ss58Format".into(), 42.into());

DevelopmentChainSpec::from_genesis(
Expand Down Expand Up @@ -404,7 +406,7 @@ pub fn local_testnet_config() -> DevelopmentChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "UNIT".into());
properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into());
properties.insert("tokenDecimals".into(), foucoco::TOKEN_DECIMALS.into());
properties.insert("ss58Format".into(), 42.into());

DevelopmentChainSpec::from_genesis(
Expand Down Expand Up @@ -476,23 +478,25 @@ fn amplitude_genesis(
let mut balances: Vec<_> = signatories
.iter()
.cloned()
.map(|k| (k, INITIAL_ISSUANCE_PER_SIGNATORY))
.map(|k| (k, amplitude::INITIAL_ISSUANCE_PER_SIGNATORY))
.chain(
invulnerables
.iter()
.cloned()
.map(|k| (k, INITIAL_COLLATOR_STAKING + COLLATOR_ADDITIONAL)),
.map(|k| (k, amplitude::INITIAL_COLLATOR_STAKING + amplitude::COLLATOR_ADDITIONAL)),
)
.collect();

balances.push((
sudo_account.clone(),
AMPLITUDE_INITIAL_ISSUANCE
amplitude::INITIAL_ISSUANCE
.saturating_sub(
INITIAL_ISSUANCE_PER_SIGNATORY.saturating_mul(balances.len().try_into().unwrap()),
amplitude::INITIAL_ISSUANCE_PER_SIGNATORY
.saturating_mul(balances.len().try_into().unwrap()),
)
.saturating_sub(
INITIAL_COLLATOR_STAKING.saturating_mul(invulnerables.len().try_into().unwrap()),
amplitude::INITIAL_COLLATOR_STAKING
.saturating_mul(invulnerables.len().try_into().unwrap()),
),
));

Expand All @@ -501,7 +505,7 @@ fn amplitude_genesis(
let stakers: Vec<_> = invulnerables
.iter()
.cloned()
.map(|account_id| (account_id, None, INITIAL_COLLATOR_STAKING))
.map(|account_id| (account_id, None, amplitude::INITIAL_COLLATOR_STAKING))
.collect();

let inflation_config = amplitude_runtime::InflationInfo::new(
Expand Down Expand Up @@ -615,7 +619,7 @@ fn amplitude_genesis(
/* 120% */
system_collateral_ceiling: vec![(
default_pair(XCM(0)),
60_000 * 10u128.pow(TOKEN_DECIMALS),
60_000 * 10u128.pow(amplitude::TOKEN_DECIMALS),
)],
},
stellar_relay: amplitude_runtime::StellarRelayConfig::default(),
Expand Down Expand Up @@ -658,23 +662,25 @@ fn foucoco_genesis(
let mut balances: Vec<_> = signatories
.iter()
.cloned()
.map(|k| (k, INITIAL_ISSUANCE_PER_SIGNATORY))
.map(|k| (k, foucoco::INITIAL_ISSUANCE_PER_SIGNATORY))
.chain(
invulnerables
.iter()
.cloned()
.map(|k| (k, INITIAL_COLLATOR_STAKING + COLLATOR_ADDITIONAL)),
.map(|k| (k, foucoco::INITIAL_COLLATOR_STAKING + foucoco::COLLATOR_ADDITIONAL)),
)
.collect();

balances.push((
sudo_account.clone(),
AMPLITUDE_INITIAL_ISSUANCE
foucoco::INITIAL_ISSUANCE
.saturating_sub(
INITIAL_ISSUANCE_PER_SIGNATORY.saturating_mul(balances.len().try_into().unwrap()),
foucoco::INITIAL_ISSUANCE_PER_SIGNATORY
.saturating_mul(balances.len().try_into().unwrap()),
)
.saturating_sub(
INITIAL_COLLATOR_STAKING.saturating_mul(invulnerables.len().try_into().unwrap()),
foucoco::INITIAL_COLLATOR_STAKING
.saturating_mul(invulnerables.len().try_into().unwrap()),
),
));

Expand All @@ -686,7 +692,7 @@ fn foucoco_genesis(
let stakers: Vec<_> = invulnerables
.iter()
.cloned()
.map(|account_id| (account_id, None, INITIAL_COLLATOR_STAKING))
.map(|account_id| (account_id, None, foucoco::INITIAL_COLLATOR_STAKING))
.collect();

let inflation_config = foucoco_runtime::InflationInfo::new(
Expand Down Expand Up @@ -847,19 +853,19 @@ fn foucoco_genesis(
system_collateral_ceiling: vec![
(
get_vault_currency_pair(XCM(0), MAINNET_USDC_CURRENCY_ID),
50 * 10u128.pow(TOKEN_DECIMALS),
50 * 10u128.pow(foucoco::TOKEN_DECIMALS),
),
(
get_vault_currency_pair(XCM(0), MAINNET_BRL_CURRENCY_ID),
25 * 10u128.pow(TOKEN_DECIMALS),
25 * 10u128.pow(foucoco::TOKEN_DECIMALS),
),
(
get_vault_currency_pair(XCM(0), MAINNET_TZS_CURRENCY_ID),
25 * 10u128.pow(TOKEN_DECIMALS),
25 * 10u128.pow(foucoco::TOKEN_DECIMALS),
),
(
get_vault_currency_pair(XCM(0), CurrencyId::Stellar(Asset::StellarNative)),
50 * 10u128.pow(TOKEN_DECIMALS),
50 * 10u128.pow(foucoco::TOKEN_DECIMALS),
),
],
},
Expand Down
46 changes: 4 additions & 42 deletions node/src/constants/amplitude.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
use runtime_common::{Balance, UNIT};
use spacewalk_primitives::{Asset, CurrencyId};

pub const AMPLITUDE_PARACHAIN_ID: u32 = 2124;
pub const FOUCOCO_PARACHAIN_ID: u32 = 2124;
pub const AMPLITUDE_INITIAL_ISSUANCE: Balance = 200_000_000 * UNIT;
pub const PARACHAIN_ID: u32 = 2124;
pub const INITIAL_ISSUANCE: Balance = 200_000_000 * UNIT;

pub const INITIAL_ISSUANCE_PER_SIGNATORY: Balance = 200 * UNIT;

pub const INITIAL_COLLATOR_STAKING: Balance = 10_000 * UNIT;
pub const COLLATOR_ADDITIONAL: Balance = 10 * UNIT;

pub const OFF_CHAIN_WORKER_ADDRESS: &str = "6m69vWMouLarYCbJGJisVaDDpfNGETkD5hsDWf2T7osW4Cn1";

pub const TOKEN_DECIMALS: u32 = 12;

pub const INITIAL_AMPLITUDE_SUDO_SIGNATORIES: [&str; 5] = [
pub const INITIAL_SUDO_SIGNATORIES: [&str; 5] = [
"6nJwMD3gk36fe6pMRL2UpbwAEjDdjjxdngQGShe753pyAvCT",
"6i4xDEE1Q2Bv8tnJtgD4jse4YTAzzCwCJVUehRQ93hCqKp8f",
"6n62KZWvmZHgeyEXTvQFmoHRMqjKfFWvQVsApkePekuNfek5",
"6kwxQBRKMadrY9Lq3K8gZXkw1UkjacpqYhcqvX3AqmN9DofF",
"6kKHwcpCVC18KepwvdMSME8Q7ZTNr1RoRUrFDH9AdAmhL3Pt",
];

pub const INITIAL_AMPLITUDE_VALIDATORS: [&str; 8] = [
pub const INITIAL_COLLATORS: [&str; 8] = [
"6mTATq7Ug9RPk4s8aMv5H7WVZ7RvwrJ1JitbYMXWPhanzqiv",
"6n8WiWqjEB8nCNRo5mxXc89FqhuMd2dgXNSrzuPxoZSnatnL",
"6ic56zZmjqo746yifWzcNxxzxLe3pRo8WNitotniUQvgKnyU",
Expand All @@ -32,37 +28,3 @@ pub const INITIAL_AMPLITUDE_VALIDATORS: [&str; 8] = [
"6mGcZntk59RK2JfxfdmprgDJeByVUgaffMQYkp1ZeoEKeBJA",
"6jq7obxC7AxhWeJNzopwYidKNNe48cLrbGSgB2zs2SuRTWGA",
];

pub const INITIAL_FOUCOCO_VALIDATORS: [&str; 4] = [
"6ihktBwyFJYjE1LKdqoAWzo5VDPJJGso9D5iASZyhuN5JvGH",
"6mbXa9Qca6B6cX51cbtfWWLhup84rMoMFCxNHjso15GBFyGh",
"6mMdv2wmb4Cp8PAtDLF1WTh1wLPwPbETwtcjqgJLskdB8EYo",
"6kL1dzcBJiLgMdAT1qDFD79CLupX1gCCF8RSg5Dh5qRgQeCx",
];

// For Mainnet USDC issued by the testnet issuer
pub const MAINNET_USDC_CURRENCY_ID: CurrencyId = CurrencyId::Stellar(Asset::AlphaNum4 {
code: *b"USDC",
issuer: [
59, 153, 17, 56, 14, 254, 152, 139, 160, 168, 144, 14, 177, 207, 228, 79, 54, 111, 125,
190, 148, 107, 237, 7, 114, 64, 247, 246, 36, 223, 21, 197,
],
});

// For Mainnet BRL issued by the testnet issuer
pub const MAINNET_BRL_CURRENCY_ID: CurrencyId = CurrencyId::Stellar(Asset::AlphaNum4 {
code: *b"BRL\0",
issuer: [
234, 172, 104, 212, 208, 227, 123, 76, 36, 194, 83, 105, 22, 232, 48, 115, 95, 3, 45, 13,
107, 42, 28, 143, 202, 59, 197, 162, 94, 8, 62, 58,
],
});

// For Mainnet TZS issued by the testnet issuer
pub const MAINNET_TZS_CURRENCY_ID: CurrencyId = CurrencyId::Stellar(Asset::AlphaNum4 {
code: *b"TZS\0",
issuer: [
52, 201, 75, 42, 75, 169, 232, 181, 123, 34, 84, 125, 203, 179, 15, 68, 60, 76, 176, 45,
163, 130, 154, 137, 170, 27, 212, 120, 14, 68, 102, 186,
],
});
28 changes: 28 additions & 0 deletions node/src/constants/foucoco.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use runtime_common::{Balance, UNIT};

pub const PARACHAIN_ID: u32 = 2124;
pub const INITIAL_ISSUANCE: Balance = 200_000_000 * UNIT;

pub const INITIAL_ISSUANCE_PER_SIGNATORY: Balance = 200 * UNIT;

pub const INITIAL_COLLATOR_STAKING: Balance = 10_000 * UNIT;
pub const COLLATOR_ADDITIONAL: Balance = 10 * UNIT;

pub const OFF_CHAIN_WORKER_ADDRESS: &str = "6m69vWMouLarYCbJGJisVaDDpfNGETkD5hsDWf2T7osW4Cn1";

pub const TOKEN_DECIMALS: u32 = 12;

pub const INITIAL_SUDO_SIGNATORIES: [&str; 5] = [
"6mSy3qQKgAez9zpqY1JSnYW7d1njMNX93P4mkkQvsmPXmehB",
"6mrdgs7NsHwceSPQRcXCagYzZiB4hoMBGmpMPLA4rS4BGyo7",
"6jBUR27UemaZBF2aYrEbMuN3u76aANEpA3uxLrQcWP8jNDtf",
"6hcDDb1nV6zrqfiB7dgQ5DbzuLkPmxkvSZ5LSA9kcE3gxNs8",
"6k4NQX2KepBkeexrWVNabnWG9GZxvQTYi4ytHHCNwPhLZMnE",
];

pub const INITIAL_COLLATORS: [&str; 4] = [
"6ihktBwyFJYjE1LKdqoAWzo5VDPJJGso9D5iASZyhuN5JvGH",
"6mbXa9Qca6B6cX51cbtfWWLhup84rMoMFCxNHjso15GBFyGh",
"6mMdv2wmb4Cp8PAtDLF1WTh1wLPwPbETwtcjqgJLskdB8EYo",
"6kL1dzcBJiLgMdAT1qDFD79CLupX1gCCF8RSg5Dh5qRgQeCx",
];
30 changes: 30 additions & 0 deletions node/src/constants/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
use spacewalk_primitives::{Asset, CurrencyId};

pub mod amplitude;
pub mod foucoco;
pub mod pendulum;

// For Mainnet USDC issued by the testnet issuer
pub const MAINNET_USDC_CURRENCY_ID: CurrencyId = CurrencyId::Stellar(Asset::AlphaNum4 {
code: *b"USDC",
issuer: [
59, 153, 17, 56, 14, 254, 152, 139, 160, 168, 144, 14, 177, 207, 228, 79, 54, 111, 125,
190, 148, 107, 237, 7, 114, 64, 247, 246, 36, 223, 21, 197,
],
});

// For Mainnet BRL issued by the testnet issuer
pub const MAINNET_BRL_CURRENCY_ID: CurrencyId = CurrencyId::Stellar(Asset::AlphaNum4 {
code: *b"BRL\0",
issuer: [
234, 172, 104, 212, 208, 227, 123, 76, 36, 194, 83, 105, 22, 232, 48, 115, 95, 3, 45, 13,
107, 42, 28, 143, 202, 59, 197, 162, 94, 8, 62, 58,
],
});

// For Mainnet TZS issued by the testnet issuer
pub const MAINNET_TZS_CURRENCY_ID: CurrencyId = CurrencyId::Stellar(Asset::AlphaNum4 {
code: *b"TZS\0",
issuer: [
52, 201, 75, 42, 75, 169, 232, 181, 123, 34, 84, 125, 203, 179, 15, 68, 60, 76, 176, 45,
163, 130, 154, 137, 170, 27, 212, 120, 14, 68, 102, 186,
],
});
2 changes: 2 additions & 0 deletions node/src/constants/pendulum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pub const INITIAL_ISSUANCE_PER_SIGNATORY: Balance = 200 * UNIT;
pub const INITIAL_COLLATOR_STAKING: Balance = 5_000 * UNIT;
pub const COLLATOR_ADDITIONAL: Balance = 10 * UNIT;

pub const TOKEN_DECIMALS: u32 = 12;

pub const SUDO_SIGNATORIES: [&str; 5] = [
"6bgxxegcuBCYngSkJqp7bzgVZWd7brVrABEQetFq1R5dNa7T",
"6cm5M5JVknj4NQdWpdayqwm92wzvSzjgE5SCRS7HM1EoauLm",
Expand Down

0 comments on commit 55be2ec

Please sign in to comment.