Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

279 update the foucoco genesis configuration to latest on chain values #282

Merged
Merged
Changes from 9 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
62d37e4
Changed fee pallet configuration in chain_spec.
adelarja Jul 18, 2023
844fdb8
Changed oracle pallet configuration in chain_spec.
adelarja Jul 18, 2023
7fa9172
Changed oracle pallet configuration in chain_spec. Added Native curre…
adelarja Jul 18, 2023
92f7b19
Changed diaOracleModule pallet configuration in chain_spec.
adelarja Jul 18, 2023
509ad5a
Changed issue pallet configuration in chain_spec.
adelarja Jul 18, 2023
07f28cf
Changed redeem pallet configuration in chain_spec.
adelarja Jul 18, 2023
03de792
Changed replace pallet configuration in chain_spec.
adelarja Jul 18, 2023
e04bdeb
Changed vault_registry pallet configuration in chain_spec.
adelarja Jul 18, 2023
8b2a0ce
Improved code format.
adelarja Jul 18, 2023
0c3c52b
Fixed some misconfigurations.
adelarja Jul 18, 2023
3a32c1d
Added premium redeem factor, and fixed liquidation factor
adelarja Jul 18, 2023
f70aff3
Refactored offchain worker price feeder account generation.
adelarja Jul 18, 2023
7224de4
Code formated
adelarja Jul 18, 2023
a648031
Fixed some issues
adelarja Jul 18, 2023
74e88b5
Improved code format
adelarja Jul 18, 2023
0469acb
Changed currencies names.
adelarja Jul 18, 2023
aa933b3
Separated amplitude and foucoco constants into a separate file, calle…
adelarja Jul 18, 2023
245ebcb
improved format
adelarja Jul 18, 2023
a9020e9
Fixed supported currencies blockchain names.
adelarja Jul 19, 2023
02396c9
Added system collateral ceiling for more currencies.
adelarja Jul 19, 2023
c21a8fb
Removed CurrencyId::Native from minimum_collateral_vault vec.
adelarja Jul 19, 2023
aab6956
Replaced TESTNET_STELLAR_CURRENCY_ID constant
adelarja Jul 19, 2023
8e89895
Merge branch '279-update-the-foucoco-genesis-configuration-to-latest-…
adelarja Jul 19, 2023
e0c860a
Refactored constants names. Added Mainnet issuers.
adelarja Jul 19, 2023
31614f2
Added comment explaining how many days max_delay represents.
adelarja Jul 19, 2023
d0ef71d
Updated spacewalk dependencies
adelarja Jul 19, 2023
c823d49
Deleted unnecessary constant. Removed unused function
adelarja Jul 19, 2023
8f07f7f
Fixed code format
adelarja Jul 19, 2023
9a38158
Reset spec_version and transaction_version back to 1
adelarja Jul 19, 2023
c113f89
Renamed spec_name and impl_name from 'amplitude' to 'foucoco'
adelarja Jul 19, 2023
67a36cf
Added INITIAL_FOUCOCO_VALIDATORS constant. This constant is passed in…
adelarja Jul 19, 2023
5b1654a
Deleted XCM(1) tokens from the initial balance.
adelarja Jul 19, 2023
881ec49
Added COLLATOR_ADDITIONAL constant.
adelarja Jul 19, 2023
a1a2ca7
Fixed code format
adelarja Jul 19, 2023
44d113a
Removed unnecessary imports
adelarja Jul 19, 2023
55be2ec
Change signatories of Foucoco chain spec
TorstenStueber Jul 20, 2023
0c4f66f
Add new Foucoco chain spec
TorstenStueber Jul 20, 2023
bdd487a
Change relay chain in Foucoco chain spec
TorstenStueber Jul 20, 2023
e1f67e5
Fixed merge conflicts
adelarja Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 108 additions & 23 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,36 @@ const MAINNET_DEFAULT_WRAPPED_CURRENCY_ID: CurrencyId = CurrencyId::Stellar(Asse
],
});

// For Testnet Stellar Native issued by the testnet issuer
const TESTNET_STELLAR_NATIVE_CURRENCY_ID: CurrencyId = CurrencyId::Stellar::StellarNative;

// For Testnet USDC issued by the testnet issuer
const TESTNET_DEFAULT_WRAPPED_CURRENCY_ID: CurrencyId = CurrencyId::AlphaNum4(
const TESTNET_USDC_CURRENCY_ID: CurrencyId = CurrencyId::AlphaNum4(
*b"USDC",
[
20, 209, 150, 49, 176, 55, 23, 217, 171, 154, 54, 110, 16, 50, 30, 226, 102, 231, 46, 199,
108, 171, 97, 144, 240, 161, 51, 109, 72, 34, 159, 139,
],
);

// For Testnet BRL issued by the testnet issuer
const TESTNET_BRL_CURRENCY_ID: CurrencyId = CurrencyId::AlphaNum4(
*b"BRL\0",
[
20, 209, 150, 49, 176, 55, 23, 217, 171, 154, 54, 110, 16, 50, 30, 226, 102, 231, 46, 199,
108, 171, 97, 144, 240, 161, 51, 109, 72, 34, 159, 139,
],
);

// For Testnet BRL issued by the testnet issuer
const TESTNET_TZS_CURRENCY_ID: CurrencyId = CurrencyId::AlphaNum4(
*b"TZS\0",
[
20, 209, 150, 49, 176, 55, 23, 217, 171, 154, 54, 110, 16, 50, 30, 226, 102, 231, 46, 199,
108, 171, 97, 144, 240, 161, 51, 109, 72, 34, 159, 139,
],
);

const FOUCOCO_PARACHAIN_ID: u32 = 2124;

/// Helper function to generate a crypto pair from seed
Expand Down Expand Up @@ -686,7 +707,14 @@ fn foucoco_genesis(
start_shutdown: bool,
) -> foucoco_runtime::GenesisConfig {
fn default_pair(currency_id: CurrencyId) -> VaultCurrencyPair<CurrencyId> {
VaultCurrencyPair { collateral: currency_id, wrapped: TESTNET_DEFAULT_WRAPPED_CURRENCY_ID }
VaultCurrencyPair { collateral: currency_id, wrapped: TESTNET_USDC_CURRENCY_ID }
}

fn get_vault_currency_pair(
collateral: CurrencyId,
wrapped: CurrencyId,
) -> VaultCurrencyPair<CurrencyId> {
VaultCurrencyPair { collateral, wrapped }
}

let mut balances: Vec<_> = signatories
Expand Down Expand Up @@ -726,6 +754,11 @@ fn foucoco_genesis(
Perquintill::from_percent(9),
);

let account_id =
adelarja marked this conversation as resolved.
Show resolved Hide resolved
AccountId::from_ss58check("6m69vWMouLarYCbJGJisVaDDpfNGETkD5hsDWf2T7osW4Cn1").unwrap();
let mut authorized_accounts = authorized_oracles.clone();
authorized_accounts.push(account_id);

foucoco_runtime::GenesisConfig {
system: foucoco_runtime::SystemConfig {
code: foucoco_runtime::WASM_BINARY
Expand Down Expand Up @@ -776,7 +809,7 @@ fn foucoco_genesis(
},
issue: foucoco_runtime::IssueConfig {
issue_period: foucoco_runtime::DAYS,
issue_minimum_transfer_amount: 1000,
issue_minimum_transfer_amount: 1_000_000_000,
limit_volume_amount: None,
limit_volume_currency_id: XCM(0),
current_volume_amount: 0u32.into(),
Expand All @@ -785,7 +818,7 @@ fn foucoco_genesis(
},
redeem: foucoco_runtime::RedeemConfig {
redeem_period: foucoco_runtime::DAYS,
redeem_minimum_transfer_amount: 1000,
redeem_minimum_transfer_amount: 1_000_000_000,
limit_volume_amount: None,
limit_volume_currency_id: XCM(0),
current_volume_amount: 0u32.into(),
Expand All @@ -794,7 +827,7 @@ fn foucoco_genesis(
},
replace: foucoco_runtime::ReplaceConfig {
replace_period: foucoco_runtime::DAYS,
replace_minimum_transfer_amount: 1000,
replace_minimum_transfer_amount: 1_000_000_000,
},
security: foucoco_runtime::SecurityConfig {
initial_status: if start_shutdown {
Expand All @@ -804,29 +837,77 @@ fn foucoco_genesis(
},
},
oracle: foucoco_runtime::OracleConfig {
max_delay: u32::MAX,
max_delay: 604_800_000,
adelarja marked this conversation as resolved.
Show resolved Hide resolved
oracle_keys: vec![
Key::ExchangeRate(CurrencyId::XCM(0)),
Key::ExchangeRate(TESTNET_DEFAULT_WRAPPED_CURRENCY_ID),
Key::ExchangeRate(CurrencyId::Native),
ebma marked this conversation as resolved.
Show resolved Hide resolved
Key::ExchangeRate(TESTNET_STELLAR_NATIVE_CURRENCY_ID),
Key::ExchangeRate(TESTNET_USDC_CURRENCY_ID),
Key::ExchangeRate(TESTNET_BRL_CURRENCY_ID),
Key::ExchangeRate(TESTNET_TZS_CURRENCY_ID),
],
},
vault_registry: foucoco_runtime::VaultRegistryConfig {
minimum_collateral_vault: vec![(XCM(0), 0), (XCM(0), 0)],
punishment_delay: foucoco_runtime::DAYS,
secure_collateral_threshold: vec![(
default_pair(XCM(0)),
FixedU128::checked_from_rational(150, 100).unwrap(),
)],
/* 150% */
minimum_collateral_vault: vec![
(XCM(0), 3_000_000_000_000),
(XCM(0), 0), // Should we remove this repeated line?
ebma marked this conversation as resolved.
Show resolved Hide resolved
(CurrencyId::Native, 0),
(TESTNET_STELLAR_NATIVE_CURRENCY_ID, 0),
(TESTNET_USDC_CURRENCY_ID, 0),
(TESTNET_BRL_CURRENCY_ID, 0),
(TESTNET_TZS_CURRENCY_ID, 0),
ebma marked this conversation as resolved.
Show resolved Hide resolved
],
punishment_delay: foucoco_runtime::DAYS * 2,
secure_collateral_threshold: vec![
(
adelarja marked this conversation as resolved.
Show resolved Hide resolved
get_vault_currency_pair(CurrencyId::Native, CurrencyId::Native),
FixedU128::checked_from_rational(150, 100).unwrap(),
),
ebma marked this conversation as resolved.
Show resolved Hide resolved
(
get_vault_currency_pair(XCM(0), TESTNET_USDC_CURRENCY_ID),
FixedU128::checked_from_rational(160, 100).unwrap(),
),
(
get_vault_currency_pair(XCM(0), TESTNET_BRL_CURRENCY_ID),
FixedU128::checked_from_rational(160, 100).unwrap(),
),
(
get_vault_currency_pair(XCM(0), TESTNET_TZS_CURRENCY_ID),
FixedU128::checked_from_rational(160, 100).unwrap(),
),
(
get_vault_currency_pair(XCM(0), TESTNET_STELLAR_NATIVE_CURRENCY_ID),
FixedU128::checked_from_rational(160, 100).unwrap(),
),
],
/* 130% */
premium_redeem_threshold: vec![(
default_pair(XCM(0)),
FixedU128::checked_from_rational(130, 100).unwrap(),
)],
/* 130% */
liquidation_collateral_threshold: vec![(
default_pair(XCM(0)),
FixedU128::checked_from_rational(120, 100).unwrap(),
)],
liquidation_collateral_threshold: vec![
(
get_vault_currency_pair(CurrencyId::Native, CurrencyId::Native),
FixedU128::checked_from_rational(120, 100).unwrap(),
),
ebma marked this conversation as resolved.
Show resolved Hide resolved
(
get_vault_currency_pair(XCM(0), TESTNET_USDC_CURRENCY_ID),
FixedU128::checked_from_rational(120, 100).unwrap(),
),
(
get_vault_currency_pair(XCM(0), TESTNET_BRL_CURRENCY_ID),
FixedU128::checked_from_rational(125, 100).unwrap(),
),
(
get_vault_currency_pair(XCM(0), TESTNET_TZS_CURRENCY_ID),
FixedU128::checked_from_rational(125, 100).unwrap(),
),
(
get_vault_currency_pair(XCM(0), TESTNET_STELLAR_NATIVE_CURRENCY_ID),
FixedU128::checked_from_rational(120, 100).unwrap(),
),
],
/* 120% */
system_collateral_ceiling: vec![(
ebma marked this conversation as resolved.
Show resolved Hide resolved
default_pair(XCM(0)),
Expand All @@ -835,21 +916,25 @@ fn foucoco_genesis(
},
stellar_relay: foucoco_runtime::StellarRelayConfig::default(),
fee: foucoco_runtime::FeeConfig {
issue_fee: FixedU128::checked_from_rational(15, 10000).unwrap(), // 0.15%
issue_griefing_collateral: FixedU128::checked_from_rational(5, 100000).unwrap(), // 0.005%
redeem_fee: FixedU128::checked_from_rational(5, 1000).unwrap(), // 0.5%
issue_fee: FixedU128::checked_from_rational(1, 1000).unwrap(), // 0.1%
issue_griefing_collateral: FixedU128::checked_from_rational(5, 1000).unwrap(), // 0.5%
redeem_fee: FixedU128::checked_from_rational(1, 1000).unwrap(), // 0.1%
premium_redeem_fee: FixedU128::checked_from_rational(5, 100).unwrap(), // 5%
punishment_fee: FixedU128::checked_from_rational(1, 10).unwrap(), // 10%
replace_griefing_collateral: FixedU128::checked_from_rational(1, 10).unwrap(), // 10%
},
nomination: foucoco_runtime::NominationConfig { is_nomination_enabled: false },
dia_oracle_module: foucoco_runtime::DiaOracleModuleConfig {
authorized_accounts: authorized_oracles,
authorized_accounts,
supported_currencies: vec![foucoco_runtime::AssetId::new(
b"Kusama".to_vec(),
b"KSM".to_vec(),
b"BRL".to_vec(),
b"USD".to_vec(),
b"TZS".to_vec(),
b"MXN".to_vec(),
)],
batching_api: b"http://dia-00.pendulumchain.tech:8070/currencies".to_vec(),
batching_api: b"https://dia-00.pendulumchain.tech/currencies".to_vec(),
coin_infos_map: vec![],
},
}
Expand Down
Loading