Skip to content

Commit

Permalink
Merge pull request #321 from mangata-finance/develop-v0.9.26
Browse files Browse the repository at this point in the history
Develop v0.9.26
  • Loading branch information
mateuszaaa authored Sep 21, 2022
2 parents a7a83fc + c38e659 commit 100147f
Show file tree
Hide file tree
Showing 30 changed files with 1,897 additions and 1,974 deletions.
2,954 changes: 1,367 additions & 1,587 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mp-traits = { path = './primitives/traits'}

# patch generated by ./scripts/dev_manifest.sh
[patch."https://github.com/mangata-finance/open-runtime-module-library"]

orml-xcm = { git = "https://github.com/mangata-finance//open-runtime-module-library", branch = "mangata-dev" }
orml-xcm-support = { git = "https://github.com/mangata-finance//open-runtime-module-library", branch = "mangata-dev" }
orml-utilities = { git = "https://github.com/mangata-finance//open-runtime-module-library", branch = "mangata-dev" }
Expand Down
140 changes: 70 additions & 70 deletions node/Cargo.toml

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions node/src/chain_spec/mangata_kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ use codec::Encode;
use cumulus_primitives_core::ParaId;
use hex::FromHex;
use hex_literal::hex;
use jsonrpsee::core::__reexports::serde_json;
use mangata_kusama_runtime::{
constants::parachains, ksm_per_second, AccountId, AssetMetadataOf, AuraId, CustomMetadata,
GeneralKey, MultiLocation, Parachain, Signature, XcmMetadata, KAR_TOKEN_ID, KSM_TOKEN_ID,
TUR_TOKEN_ID, X1, X2,
};
use sc_service::ChainType;
use sp_core::{sr25519, ByteArray, Pair, Public, H160};
use sp_runtime::traits::{IdentifyAccount, Verify};
use sp_runtime::{
traits::{ConstU32, IdentifyAccount, Verify},
WeakBoundedVec,
};

pub mod public_testnet_keys {
pub const ALICE_SR25519: &str =
Expand Down Expand Up @@ -442,8 +446,8 @@ pub fn local_config() -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "MGAL".into());
properties.insert("tokenDecimals".into(), 18.into());
properties.insert("ss58Format".into(), 42.into());
properties.insert("tokenDecimals".into(), 18u32.into());
properties.insert("ss58Format".into(), 42u32.into());

ChainSpec::from_genesis(
// Name
Expand Down Expand Up @@ -626,7 +630,10 @@ pub fn local_config() -> ChainSpec {
1,
X2(
Parachain(parachains::karura::ID),
GeneralKey(parachains::karura::KAR_KEY.to_vec()),
GeneralKey(WeakBoundedVec::<u8, ConstU32<32>>::force_from(
parachains::karura::KAR_KEY.to_vec(),
None,
)),
),
)
.into(),
Expand Down
14 changes: 10 additions & 4 deletions node/src/chain_spec/mangata_rococo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use mangata_rococo_runtime::{
};
use sc_service::ChainType;
use sp_core::{sr25519, ByteArray, Pair, Public, H160};
use sp_runtime::traits::{IdentifyAccount, Verify};
use sp_runtime::{
traits::{ConstU32, IdentifyAccount, Verify},
WeakBoundedVec,
};

pub mod public_testnet_keys {
pub const ALICE_SR25519: &str =
Expand Down Expand Up @@ -252,8 +255,8 @@ pub fn mangata_rococo_local_config() -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "MGRL".into());
properties.insert("tokenDecimals".into(), 18.into());
properties.insert("ss58Format".into(), 42.into());
properties.insert("tokenDecimals".into(), 18u32.into());
properties.insert("ss58Format".into(), 42u32.into());

ChainSpec::from_genesis(
// Name
Expand Down Expand Up @@ -436,7 +439,10 @@ pub fn mangata_rococo_local_config() -> ChainSpec {
1,
X2(
Parachain(parachains::karura::ID),
GeneralKey(parachains::karura::KAR_KEY.to_vec()),
GeneralKey(WeakBoundedVec::<u8, ConstU32<32>>::force_from(
parachains::karura::KAR_KEY.to_vec(),
None,
)),
),
)
.into(),
Expand Down
10 changes: 5 additions & 5 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
service::new_partial,
};
use codec::Encode;
use cumulus_client_service::genesis::generate_genesis_block;
use cumulus_client_cli::generate_genesis_block;
use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
Expand Down Expand Up @@ -252,7 +252,7 @@ pub fn run() -> Result<()> {
spec if spec.is_mangata_kusama() => {
let state_version = Cli::native_runtime_version(&spec).state_version();
let block: service::mangata_kusama_runtime::Block =
generate_genesis_block(&spec, state_version)?;
generate_genesis_block(&*spec, state_version)?;
let raw_header = block.header().encode();
let output_buf = if params.raw {
raw_header
Expand All @@ -265,7 +265,7 @@ pub fn run() -> Result<()> {
spec if spec.is_mangata_rococo() => {
let state_version = Cli::native_runtime_version(&spec).state_version();
let block: service::mangata_rococo_runtime::Block =
generate_genesis_block(&spec, state_version)?;
generate_genesis_block(&*spec, state_version)?;
let raw_header = block.header().encode();
let output_buf = if params.raw {
raw_header
Expand Down Expand Up @@ -453,15 +453,15 @@ pub fn run() -> Result<()> {
spec if spec.is_mangata_kusama() => {
let state_version = Cli::native_runtime_version(&spec).state_version();
let block: service::mangata_kusama_runtime::Block =
generate_genesis_block(&spec, state_version)
generate_genesis_block(&*config.chain_spec, state_version)
.map_err(|e| format!("{:?}", e))?;
format!("0x{:?}", HexDisplay::from(&block.header().encode()))
},
#[cfg(feature = "mangata-rococo")]
spec if spec.is_mangata_rococo() => {
let state_version = Cli::native_runtime_version(&spec).state_version();
let block: service::mangata_rococo_runtime::Block =
generate_genesis_block(&spec, state_version)
generate_genesis_block(&*config.chain_spec, state_version)
.map_err(|e| format!("{:?}", e))?;
format!("0x{:?}", HexDisplay::from(&block.header().encode()))
},
Expand Down
26 changes: 13 additions & 13 deletions pallets/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ log = { version = "0.4.14", default-features = false }
serde = { version = "1.0.126", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
frame-support = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
frame-system = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
orml-tokens = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev-v0.9.24" }
frame-support = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
frame-system = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
orml-tokens = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev" }
mangata-primitives = { default-features = false, version = '0.1.0' , path = '../../primitives/mangata'}
sp-core = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-std = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-runtime = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev-v0.9.24" }
sp-io = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev-v0.9.24" }
sp-arithmetic= { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev-v0.9.24" }
frame-benchmarking = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-core = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-std = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-runtime = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev" }
sp-io = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev" }
sp-arithmetic= { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev" }
frame-benchmarking = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
mp-bootstrap = { path = "../../primitives/bootstrap", default-features=false }
pallet-vesting-mangata = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev-v0.9.24" }
pallet-vesting-mangata = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev" }
pallet-issuance = { path = "../issuance", default-features = false}

[dev-dependencies]
test-case = "2.0.2"
sp-core = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-io = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
orml-traits = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev-v0.9.24" }
sp-core = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-io = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
orml-traits = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev" }
pallet-xyk = { path = "../xyk" }
pallet-issuance = { path = "../issuance", default-features = false}
mockall = "0.11.0"
Expand Down
16 changes: 11 additions & 5 deletions pallets/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use mp_bootstrap::{PoolCreateApi, RewardsApi};
use orml_tokens::{MultiTokenCurrency, MultiTokenCurrencyExtended, MultiTokenReservableCurrency};
use pallet_vesting_mangata::MultiTokenVestingLocks;
use scale_info::TypeInfo;
use sp_arithmetic::helpers_128bit::multiply_by_rational;
use sp_arithmetic::{helpers_128bit::multiply_by_rational_with_rounding, per_things::Rounding};
use sp_core::U256;
use sp_io::KillStorageResult;
use sp_runtime::traits::{AccountIdConversion, CheckedAdd, SaturatedConversion};
Expand Down Expand Up @@ -741,10 +741,16 @@ impl<T: Config> Pallet<T> {
let provision = Self::provisions(who, token_id);
let (vested_provision, lock_start, lock_end) = Self::vested_provisions(who, token_id);
let (_, liquidity) = Self::minted_liquidity();
let rewards = multiply_by_rational(liquidity / 2, provision, valuation)
.map_err(|_| Error::<T>::MathOverflow)?;
let vested_rewards = multiply_by_rational(liquidity / 2, vested_provision, valuation)
.map_err(|_| Error::<T>::MathOverflow)?;
let rewards =
multiply_by_rational_with_rounding(liquidity / 2, provision, valuation, Rounding::Down)
.ok_or(Error::<T>::MathOverflow)?;
let vested_rewards = multiply_by_rational_with_rounding(
liquidity / 2,
vested_provision,
valuation,
Rounding::Down,
)
.ok_or(Error::<T>::MathOverflow)?;
Ok((rewards, vested_rewards, (lock_start, lock_end)))
}

Expand Down
26 changes: 13 additions & 13 deletions pallets/bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ serde = { version = "1.0.126", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }

frame-support = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
frame-system = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-runtime = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-core = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-std = { version = "4.0.0-dev", default-features = false , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-io = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
frame-support = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
frame-system = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-runtime = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-core = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-std = { version = "4.0.0-dev", default-features = false , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-io = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }

artemis-core = {default-features = false, version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev-v0.9.24"}

[dev-dependencies]
pallet-verifier = {version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev-v0.9.24"}
artemis-erc20-app = {version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev-v0.9.24"}
artemis-eth-app = {version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev-v0.9.24"}
artemis-asset = {version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev-v0.9.24"}
orml-tokens = {version = "0.4.1-dev", git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev-v0.9.24"}
orml-traits = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev-v0.9.24" }
pallet-verifier = {version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev"}
artemis-erc20-app = {version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev"}
artemis-eth-app = {version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev"}
artemis-asset = {version = "0.1.1", git = "https://github.com/mangata-finance/snowbridge", branch = "mangata-dev"}
orml-tokens = {version = "0.4.1-dev", git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev"}
orml-traits = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev" }
mangata-primitives = { path = '../../primitives/mangata', default-features = false, version = '0.1.0' }


Expand Down
20 changes: 10 additions & 10 deletions pallets/issuance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ log = { version = "0.4.14", default-features = false }
serde = { version = "1.0.126", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
frame-support = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
frame-system = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
orml-tokens = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev-v0.9.24" }
frame-support = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
frame-system = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
orml-tokens = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev" }
mangata-primitives = { default-features = false, version = '0.1.0' , path = '../../primitives/mangata'}
sp-std = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-runtime = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev-v0.9.24" }
pallet-vesting-mangata = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev-v0.9.24" }
frame-benchmarking = { git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24", optional = true, default-features = false }
sp-std = { default-features = false, version = '4.0.0-dev' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-runtime = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev" }
pallet-vesting-mangata = { git = "https://github.com/mangata-finance/substrate", default-features = false, branch = "mangata-dev" }
frame-benchmarking = { git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev", optional = true, default-features = false }
cfg-if = "1.0.0"

[dev-dependencies]
sp-core = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
sp-io = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev-v0.9.24" }
orml-traits = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev-v0.9.24" }
sp-core = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
sp-io = { default-features = false, version = '6.0.0' , git = "https://github.com/mangata-finance/substrate", branch = "mangata-dev" }
orml-traits = { default-features = false, version="0.4.1-dev" , git = "https://github.com/mangata-finance/open-runtime-module-library", branch = "mangata-dev" }

[features]
default = ['std']
Expand Down
Loading

0 comments on commit 100147f

Please sign in to comment.