Skip to content

Commit

Permalink
Merge branch 'main' into spec-load
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrust committed Jul 14, 2022
2 parents 3e3555d + eba9da6 commit 0f0750f
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 131 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
inputs:
srtool_tag:
description: The SRTOOL tag to use
required: false
default: 1.60.0
required: true
release-version:
description: 'Release version tag'
default: 'v0.4.32'
required: true
ref:
description: The ref to be used for the repo
Expand All @@ -28,7 +28,7 @@ jobs:

- name: Srtool build
id: srtool_build
uses: chevdor/srtool-actions@v0.3.0
uses: chevdor/srtool-actions@v0.4.0
with:
chain: ${{ matrix.chain }}
tag: ${{ github.event.inputs.srtool_tag || env.SRTOOL_TAG }}
Expand Down Expand Up @@ -152,6 +152,6 @@ jobs:
- name: Upload assets to release
uses: softprops/action-gh-release@v1
with:
name: Arctic ${{ github.event.inputs.release-version }}
name: Snow ${{ github.event.inputs.release-version }}
files: ./release/*
draft: true
83 changes: 0 additions & 83 deletions .github/workflows/srtool.yml

This file was deleted.

1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch =
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.24" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.24" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.24", optional = true }

xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.24" }

# These dependencies are used for runtime benchmarking
frame-benchmarking = { branch = "polkadot-v0.9.24", git = "https://github.com/paritytech/substrate" }
Expand Down
11 changes: 7 additions & 4 deletions node/src/chain_spec/arctic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use arctic_runtime::currency::ICY;
use arctic_runtime::{
wasm_binary_unwrap, AccountId, AirdropConfig, AuraConfig, AuraId, BalancesConfig,
CollatorSelectionConfig, CouncilConfig, CouncilMembershipConfig, DemocracyConfig, EVMConfig,
GenesisConfig, IndicesConfig, ParachainInfoConfig, SS58Prefix, SessionConfig, SessionKeys,
Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TechnicalMembershipConfig,
VestingConfig,
GenesisConfig, IndicesConfig, ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix,
SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig,
TechnicalMembershipConfig, VestingConfig,
};
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
Expand All @@ -22,6 +22,7 @@ const AIRDROP_MERKLE_ROOT: [u8; 32] =
hex!("b654eac2f99abbe8e847a2079a2018bcf09989c00a3e0dd0114a335c4d97ef32");

const PARA_ID: u32 = 2000;
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

fn arctic_properties() -> Properties {
let mut properties = Properties::new();
Expand Down Expand Up @@ -215,7 +216,9 @@ fn make_genesis(
},
ethereum: Default::default(),
treasury: Default::default(),
polkadot_xcm: Default::default(),
polkadot_xcm: PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
parachain_system: Default::default(),
simple_inflation: Default::default(),
fees_split: Default::default(),
Expand Down
11 changes: 7 additions & 4 deletions node/src/chain_spec/snow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use snow_runtime::currency::ICY;
use snow_runtime::{
wasm_binary_unwrap, AccountId, AirdropConfig, AuraConfig, AuraId, Balance, BalancesConfig,
CollatorSelectionConfig, CouncilConfig, CouncilMembershipConfig, DemocracyConfig, EVMConfig,
GenesisConfig, IndicesConfig, ParachainInfoConfig, SS58Prefix, SessionConfig, SessionKeys,
Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TechnicalMembershipConfig,
TreasuryPalletId, VestingConfig,
GenesisConfig, IndicesConfig, ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix,
SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig,
TechnicalMembershipConfig, TreasuryPalletId, VestingConfig,
};
use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public};
use sp_runtime::traits::{AccountIdConversion, IdentifyAccount, Verify};
Expand All @@ -20,6 +20,7 @@ use super::{get_from_seed, Extensions};
pub type SnowChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;

const PARA_ID: u32 = 2000;
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

//const TOTAL_SUPPLY: Balance = ICY * 1800000000;
//const TOTAL_AIR_DROP: Balance = 1 * ICY;
Expand Down Expand Up @@ -264,7 +265,9 @@ fn make_genesis(
phragmen_election: Default::default(),
indices: IndicesConfig { indices: vec![] },
democracy: DemocracyConfig::default(),
polkadot_xcm: Default::default(),
polkadot_xcm: PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
}, // Default::default(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions pallets/airdrop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub mod pallet {
use weights::WeightInfo;

// Re-exports
pub use types::AirdropBehaviour;
pub use types::VestingTerms;

/// Configure the pallet by specifying the parameters and types on which it depends.
#[pallet::config]
Expand All @@ -75,7 +75,7 @@ pub mod pallet {

type MaxProofSize: Get<u32>;

const AIRDROP_VARIABLES: AirdropBehaviour;
const VESTING_TERMS: VestingTerms;
}

#[pallet::pallet]
Expand Down
4 changes: 2 additions & 2 deletions pallets/airdrop/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ impl pallet_airdrop::Config for Test {
type MerkelProofValidator = TestValidator<Test>;
type MaxProofSize = ConstU32<10>;

const AIRDROP_VARIABLES: types::AirdropBehaviour = {
types::AirdropBehaviour {
const VESTING_TERMS: types::VestingTerms = {
types::VestingTerms {
defi_instant_percentage: 40,
non_defi_instant_percentage: 30,
vesting_period: 5_256_000,
Expand Down
2 changes: 1 addition & 1 deletion pallets/airdrop/src/tests/user_claim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ fn respect_vesting_pallet_min_transfer() {

#[test]
fn partial_transfer_can_reclaim() {
let vesting_period = Test::AIRDROP_VARIABLES.vesting_period;
let vesting_period = Test::VESTING_TERMS.vesting_period;
minimal_test_ext().execute_with(|| {
run_to_block(1);

Expand Down
8 changes: 4 additions & 4 deletions pallets/airdrop/src/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use sp_runtime::traits::{CheckedAdd, Convert};
pub const VESTING_APPLICABLE_FROM: u32 = 1u32;

pub fn do_transfer<T: airdrop::Config>(snapshot: &mut types::SnapshotInfo<T>) -> DispatchResult {
let vesting_should_end_in = <T as airdrop::Config>::AIRDROP_VARIABLES.vesting_period;
let vesting_should_end_in = <T as airdrop::Config>::VESTING_TERMS.vesting_period;
let creditor = AirdropModule::<T>::get_creditor_account()?;

let defi_user = snapshot.defi_user;
let total_amount = snapshot.amount;

let claimer = &snapshot.ice_address;
let creditor = AirdropModule::<T>::get_creditor_account()?;

let instant_percentage = utils::get_instant_percentage::<T>(defi_user);

let (mut instant_amount, vesting_amount) =
utils::get_split_amounts::<T>(total_amount, instant_percentage).map_err(|e |{
error!("At: get_split_amount. amount: {total_amount:?}. Instant percentage: {instant_percentage}. Reason: {e:?}");
Expand Down
2 changes: 1 addition & 1 deletion pallets/airdrop/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub trait MerkelProofValidator<T: Config> {
fn validate(leaf_hash: MerkleHash, root_hash: MerkleHash, proofs: MerkleProofs<T>) -> bool;
}

pub struct AirdropBehaviour {
pub struct VestingTerms {
pub defi_instant_percentage: u8,
pub non_defi_instant_percentage: u8,
pub vesting_period: u32,
Expand Down
4 changes: 2 additions & 2 deletions pallets/airdrop/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ where

pub fn get_instant_percentage<T: airdrop::Config>(is_defi_user: bool) -> u8 {
if is_defi_user {
T::AIRDROP_VARIABLES.defi_instant_percentage
T::VESTING_TERMS.defi_instant_percentage
} else {
T::AIRDROP_VARIABLES.non_defi_instant_percentage
T::VESTING_TERMS.non_defi_instant_percentage
}
}

Expand Down
13 changes: 6 additions & 7 deletions runtime/arctic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,12 +1067,11 @@ impl pallet_base_fee::Config for Runtime {

impl pallet_randomness_collective_flip::Config for Runtime {}

const VESTED_AIRDROP_BEHAVIOUR: pallet_airdrop::AirdropBehaviour =
pallet_airdrop::AirdropBehaviour {
defi_instant_percentage: 100,
non_defi_instant_percentage: 100,
vesting_period: 7776000,
};
const AIRDROP_VESTING_TERMS: pallet_airdrop::VestingTerms = pallet_airdrop::VestingTerms {
defi_instant_percentage: 100,
non_defi_instant_percentage: 100,
vesting_period: 7776000,
};

impl pallet_airdrop::Config for Runtime {
type Event = Event;
Expand All @@ -1081,7 +1080,7 @@ impl pallet_airdrop::Config for Runtime {
type BalanceTypeConversion = ConvertInto;
type MerkelProofValidator = pallet_airdrop::merkle::AirdropMerkleValidator<Runtime>;
type MaxProofSize = ConstU32<21>;
const AIRDROP_VARIABLES: pallet_airdrop::AirdropBehaviour = VESTED_AIRDROP_BEHAVIOUR;
const VESTING_TERMS: pallet_airdrop::VestingTerms = AIRDROP_VESTING_TERMS;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
Expand Down
2 changes: 1 addition & 1 deletion runtime/arctic/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl xcm_executor::Config for XcmConfig {
// How to withdraw and deposit an asset.
type AssetTransactor = AssetTransactors;
type OriginConverter = XcmOriginToTransactDispatchOrigin;
type IsReserve = ReserveAssetFilter; //NativeAsset;
type IsReserve = (); // ReserveAssetFilter; //NativeAsset;
type IsTeleporter = (); // Teleporting is disabled.
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = XcmBarrier;
Expand Down
13 changes: 6 additions & 7 deletions runtime/frost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,20 +572,19 @@ impl pallet_simple_inflation::Config for Runtime {

impl pallet_fees_split::Config for Runtime {}

const VESTED_AIRDROP_BEHAVIOUR: pallet_airdrop::AirdropBehaviour =
pallet_airdrop::AirdropBehaviour {
defi_instant_percentage: 30,
non_defi_instant_percentage: 20,
vesting_period: 7776000,
};
const AIRDROP_VESTING_TERMS: pallet_airdrop::VestingTerms = pallet_airdrop::VestingTerms {
defi_instant_percentage: 30,
non_defi_instant_percentage: 20,
vesting_period: 7776000,
};
impl pallet_airdrop::Config for Runtime {
type Event = Event;
type Currency = Balances;
type AirdropWeightInfo = pallet_airdrop::weights::AirDropWeightInfo<Runtime>;
type BalanceTypeConversion = ConvertInto;
type MerkelProofValidator = pallet_airdrop::merkle::AirdropMerkleValidator<Runtime>;
type MaxProofSize = ConstU32<21>;
const AIRDROP_VARIABLES: pallet_airdrop::AirdropBehaviour = VESTED_AIRDROP_BEHAVIOUR;
const VESTING_TERMS: pallet_airdrop::VestingTerms = AIRDROP_VESTING_TERMS;
}

impl pallet_utility::Config for Runtime {
Expand Down
13 changes: 6 additions & 7 deletions runtime/snow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,12 +1067,11 @@ impl pallet_base_fee::Config for Runtime {

impl pallet_randomness_collective_flip::Config for Runtime {}

const VESTED_AIRDROP_BEHAVIOUR: pallet_airdrop::AirdropBehaviour =
pallet_airdrop::AirdropBehaviour {
defi_instant_percentage: 30,
non_defi_instant_percentage: 20,
vesting_period: 7776000,
};
const AIRDROP_VESTING_TERMS: pallet_airdrop::VestingTerms = pallet_airdrop::VestingTerms {
defi_instant_percentage: 100,
non_defi_instant_percentage: 100,
vesting_period: 7776000,
};

impl pallet_airdrop::Config for Runtime {
type Event = Event;
Expand All @@ -1081,7 +1080,7 @@ impl pallet_airdrop::Config for Runtime {
type BalanceTypeConversion = ConvertInto;
type MerkelProofValidator = pallet_airdrop::merkle::AirdropMerkleValidator<Runtime>;
type MaxProofSize = ConstU32<21>;
const AIRDROP_VARIABLES: pallet_airdrop::AirdropBehaviour = VESTED_AIRDROP_BEHAVIOUR;
const VESTING_TERMS: pallet_airdrop::VestingTerms = AIRDROP_VESTING_TERMS;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
Expand Down
2 changes: 1 addition & 1 deletion runtime/snow/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl xcm_executor::Config for XcmConfig {
// How to withdraw and deposit an asset.
type AssetTransactor = AssetTransactors;
type OriginConverter = XcmOriginToTransactDispatchOrigin;
type IsReserve = ReserveAssetFilter; //NativeAsset;
type IsReserve = (); // ReserveAssetFilter; //NativeAsset;
type IsTeleporter = (); // Teleporting is disabled.
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = XcmBarrier;
Expand Down

0 comments on commit 0f0750f

Please sign in to comment.