Skip to content

Commit

Permalink
Merge pull request #5155 from freakstatic/feature/argo-bridge
Browse files Browse the repository at this point in the history
Runtime: Argo Bridge
  • Loading branch information
kdembler committed Jun 4, 2024
2 parents 011d1a6 + b278c08 commit 9d0f3b7
Show file tree
Hide file tree
Showing 28 changed files with 1,833 additions and 9 deletions.
27 changes: 27 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions bin/node/src/chain_spec/argo_bridge_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use node_runtime::{argo_bridge::types::BridgeStatus, ArgoBridgeConfig, DefaultBridgingFee};

pub fn production_config() -> ArgoBridgeConfig {
ArgoBridgeConfig {
status: BridgeStatus::Paused,
mint_allowance: 0,
bridging_fee: DefaultBridgingFee::get(),
thawn_duration: 1,
}
}

pub fn testing_config() -> ArgoBridgeConfig {
ArgoBridgeConfig {
status: BridgeStatus::Paused,
mint_allowance: 0,
bridging_fee: DefaultBridgingFee::get(),
thawn_duration: 1,
}
}
15 changes: 11 additions & 4 deletions bin/node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// Example: voting_period: 1 * DAY
#![allow(clippy::identity_op)]

pub mod argo_bridge_config;
pub mod content_config;
pub mod council_config;
pub mod forum_config;
Expand All @@ -30,10 +31,10 @@ pub use grandpa_primitives::AuthorityId as GrandpaId;

use node_runtime::{
constants::currency::{DOLLARS, MIN_NOMINATOR_BOND, MIN_VALIDATOR_BOND},
wasm_binary_unwrap, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, Block, ContentConfig,
ExistentialDeposit, GrandpaConfig, ImOnlineConfig, MaxNominations, ProjectTokenConfig,
SessionConfig, SessionKeys, StakerStatus, StakingConfig, StorageConfig, SystemConfig,
TransactionPaymentConfig, VestingConfig,
wasm_binary_unwrap, ArgoBridgeConfig, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig,
Block, ContentConfig, ExistentialDeposit, GrandpaConfig, ImOnlineConfig, MaxNominations,
ProjectTokenConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, StorageConfig,
SystemConfig, TransactionPaymentConfig, VestingConfig,
};
pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sc_chain_spec::ChainSpecExtension;
Expand Down Expand Up @@ -183,6 +184,7 @@ pub fn testnet_genesis(
content_cfg: ContentConfig,
storage_cfg: StorageConfig,
project_token_cfg: ProjectTokenConfig,
argo_bridge_cfg: ArgoBridgeConfig,
) -> GenesisConfig {
// staking benchmakrs is not sensitive to actual value of min bonds so
// accounts are not funded with sufficient funds and fail with InsufficientBond err
Expand Down Expand Up @@ -335,6 +337,7 @@ pub fn testnet_genesis(
content: content_cfg,
storage: storage_cfg,
project_token: project_token_cfg,
argo_bridge: argo_bridge_cfg,
proposals_discussion: Default::default(),
members: Default::default(),
}
Expand All @@ -354,6 +357,7 @@ fn development_config_genesis() -> GenesisConfig {
content_config::testing_config(),
storage_config::testing_config(),
project_token_config::testing_config(),
argo_bridge_config::testing_config(),
)
}

Expand Down Expand Up @@ -387,6 +391,7 @@ fn local_testnet_genesis() -> GenesisConfig {
content_config::testing_config(),
storage_config::testing_config(),
project_token_config::testing_config(),
argo_bridge_config::testing_config(),
)
}

Expand Down Expand Up @@ -417,6 +422,7 @@ fn prod_test_config_genesis() -> GenesisConfig {
content_config::production_config(),
storage_config::production_config(),
project_token_config::production_config(),
argo_bridge_config::production_config(),
)
}

Expand Down Expand Up @@ -454,6 +460,7 @@ pub(crate) mod tests {
content_config::testing_config(),
storage_config::testing_config(),
project_token_config::testing_config(),
argo_bridge_config::testing_config(),
)
}

Expand Down
12 changes: 9 additions & 3 deletions bin/utils/chain-spec-builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use std::{
};

use joystream_node::chain_spec::{
self, content_config, initial_balances, joy_chain_spec_properties, project_token_config,
storage_config, AccountId, AuthorityDiscoveryId, BabeId, GrandpaId, ImOnlineId,
JOY_ADDRESS_PREFIX,
self, argo_bridge_config, content_config, initial_balances, joy_chain_spec_properties,
project_token_config, storage_config, AccountId, AuthorityDiscoveryId, BabeId, GrandpaId,
ImOnlineId, JOY_ADDRESS_PREFIX,
};

use sc_chain_spec::ChainType;
Expand Down Expand Up @@ -267,6 +267,11 @@ fn genesis_constructor(
_ => project_token_config::testing_config(),
};

let argo_bridge_cfg = match deployment {
ChainDeployment::mainnet => argo_bridge_config::production_config(),
_ => argo_bridge_config::testing_config(),
};

chain_spec::testnet_genesis(
fund_accounts,
authorities,
Expand All @@ -277,6 +282,7 @@ fn genesis_constructor(
content_cfg,
storage_cfg,
project_token_cfg,
argo_bridge_cfg,
)
}

Expand Down
56 changes: 56 additions & 0 deletions runtime-modules/argo-bridge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[package]
name = "pallet-argo-bridge"
version = '1.0.0'
authors = ['Joystream contributors']
edition = '2018'

[dependencies]
sp-io = { package = 'sp-io', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-std = { package = 'sp-std', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-runtime = { package = 'sp-runtime', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
frame-support = { package = 'frame-support', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
frame-system = { package = 'frame-system', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-arithmetic = { package = 'sp-arithmetic', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
common = { package = 'pallet-common', default-features = false, path = '../common'}
storage = { package = 'pallet-storage', default-features = false, path = '../storage'}
balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
membership = { package = 'pallet-membership', default-features = false, path = '../membership'}
codec = { package = 'parity-scale-codec', version = '3.1.2', default-features = false, features = ['derive'] }
serde = {version = '1.0.101', features = ['derive'], optional = true}
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9', optional = true }

# Benchmarking dependencies
frame-benchmarking = { package = 'frame-benchmarking', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9', optional = true}

[dev-dependencies]
sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
randomness-collective-flip = { package = 'pallet-insecure-randomness-collective-flip', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
staking-handler = { package = 'pallet-staking-handler', default-features = false, path = '../staking-handler'}
pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-storage = { package = 'sp-storage', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}

[features]
default = ['std', 'runtime-benchmarks']
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
'sp-core',
"common/runtime-benchmarks",
]
std = [
'sp-std/std',
'sp-io/std',
'sp-runtime/std',
'frame-support/std',
'frame-system/std',
'sp-arithmetic/std',
'common/std',
'storage/std',
'balances/std',
'membership/std',
'codec/std',
'serde',
'scale-info/std',
'frame-benchmarking?/std',
]
try-runtime = ["frame-support/try-runtime"]
Loading

0 comments on commit 9d0f3b7

Please sign in to comment.