diff --git a/Cargo.lock b/Cargo.lock index 1c374dafd2..4b87bec4f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -184,6 +184,7 @@ dependencies = [ "bifrost-minter-reward", "bifrost-runtime-common", "bifrost-salp", + "bifrost-vesting", "bifrost-vsbond-auction", "bifrost-vtoken-mint", "cumulus-pallet-aura-ext", @@ -229,7 +230,6 @@ dependencies = [ "pallet-transaction-payment-rpc-runtime-api", "pallet-treasury", "pallet-utility", - "pallet-vesting", "pallet-xcm", "parachain-info", "parity-scale-codec", @@ -2138,6 +2138,7 @@ dependencies = [ "bifrost-minter-reward", "bifrost-runtime-common", "bifrost-salp", + "bifrost-vesting", "bifrost-vsbond-auction", "bifrost-vtoken-mint", "cumulus-pallet-aura-ext", @@ -2184,7 +2185,6 @@ dependencies = [ "pallet-transaction-payment-rpc-runtime-api", "pallet-treasury", "pallet-utility", - "pallet-vesting", "pallet-xcm", "parachain-info", "parity-scale-codec", diff --git a/Makefile b/Makefile index e7a6acfe5c..1198ef9b02 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ run-dev: .PHONY: run-dev-manual-seal run-dev-manual-seal: - RUST_LOG=debug cargo run -p node-cli --locked --features "with-dev-runtime" -- --tmp --dev --sealing instant + RUST_LOG=debug cargo run -p node-cli --locked --features "with-dev-runtime" -- --tmp --dev --sealing instant --rpc-cors all --unsafe-ws-external # Build docker image .PHONY: build-docker-image diff --git a/pallets/vesting/src/lib.rs b/pallets/vesting/src/lib.rs index d619ea0feb..1ff107f138 100644 --- a/pallets/vesting/src/lib.rs +++ b/pallets/vesting/src/lib.rs @@ -366,6 +366,36 @@ pub mod pallet { Ok(()) } + #[pallet::weight(0)] + pub fn force_set_vested( + origin: OriginFor, + source: ::Source, + target: ::Source, + schedule: VestingInfo, T::BlockNumber>, + ) -> DispatchResult { + ensure_root(origin)?; + ensure!(schedule.locked >= T::MinVestedTransfer::get(), Error::::AmountLow); + + let target = T::Lookup::lookup(target)?; + let source = T::Lookup::lookup(source)?; + + T::Currency::remove_lock(VESTING_ID, &target); + + let (from, to, value) = if schedule.locked > T::Currency::free_balance(&target) { + (&source, &target, schedule.locked - T::Currency::free_balance(&target)) + } else { + (&target, &source, T::Currency::free_balance(&target) - schedule.locked) + }; + + T::Currency::transfer(&from, &to, value, ExistenceRequirement::AllowDeath)?; + + Vesting::::insert(target.clone(), schedule); + let res = Self::update_lock(target.clone()); + debug_assert!(res.is_ok()); + + Ok(()) + } + #[pallet::weight(0)] pub fn init_vesting_start_at( origin: OriginFor, diff --git a/runtime/asgard/Cargo.toml b/runtime/asgard/Cargo.toml index ebe5f1fa88..a363a7ccba 100644 --- a/runtime/asgard/Cargo.toml +++ b/runtime/asgard/Cargo.toml @@ -57,7 +57,6 @@ pallet-transaction-payment = { version = "3.0.0", default-features = false } pallet-transaction-payment-rpc-runtime-api = { version = "3.0.0", default-features = false } pallet-treasury = { version = "3.0.0", default-features = false } pallet-utility = { version = "3.0.0", default-features = false } -pallet-vesting = { version = "3.0.0", default-features = false } # Cumulus dependencies cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.8" } @@ -80,15 +79,16 @@ pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.8" } # bifrost pallets -bifrost-runtime-common = { package = "bifrost-runtime-common", path = "../common", default-features = false } -bifrost-vtoken-mint = { path = "../../pallets/vtoken-mint", default-features = false } -bifrost-minter-reward = { path = "../../pallets/minter-reward", default-features = false } +bifrost-bancor= { path = "../../pallets/bancor",default-features = false } +bifrost-bancor-runtime-api = { path = "../../pallets/bancor/rpc/runtime-api", default-features = false } bifrost-flexible-fee = { path = "../../pallets/flexible-fee", default-features = false } bifrost-flexible-fee-rpc-runtime-api = { path = "../../pallets/flexible-fee/rpc/runtime-api", default-features = false } -bifrost-salp= {path = "../../pallets/salp",default-features = false} -bifrost-bancor= {path = "../../pallets/bancor",default-features = false} -bifrost-vsbond-auction = { path = "../../pallets/vsbond-auction", default-features = false } -bifrost-bancor-runtime-api = { path = "../../pallets/bancor/rpc/runtime-api", default-features = false } +bifrost-minter-reward = { path = "../../pallets/minter-reward", default-features = false } +bifrost-runtime-common = { package = "bifrost-runtime-common", path = "../common", default-features = false } +bifrost-salp = { path = "../../pallets/salp", default-features = false } +bifrost-vsbond-auction = { path = "../../pallets/vsbond-auction", default-features = false } +bifrost-vtoken-mint = { path = "../../pallets/vtoken-mint", default-features = false } +pallet-vesting = { package = "bifrost-vesting", path = "../../pallets/vesting", default-features = false } # orml orml-currencies = { version = "0.4.1-dev", default-features = false } diff --git a/runtime/dev/Cargo.toml b/runtime/dev/Cargo.toml index 075a3ec795..97042e061d 100644 --- a/runtime/dev/Cargo.toml +++ b/runtime/dev/Cargo.toml @@ -58,7 +58,6 @@ pallet-transaction-payment = { version = "3.0.0", default-features = false } pallet-transaction-payment-rpc-runtime-api = { version = "3.0.0", default-features = false } pallet-treasury = { version = "3.0.0", default-features = false } pallet-utility = { version = "3.0.0", default-features = false } -pallet-vesting = { version = "3.0.0", default-features = false } # Cumulus dependencies cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.8" } @@ -81,15 +80,16 @@ pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.8" } # bifrost pallets -bifrost-runtime-common = { package = "bifrost-runtime-common", path = "../common", default-features = false } -bifrost-vtoken-mint = { path = "../../pallets/vtoken-mint", default-features = false } -bifrost-minter-reward = { path = "../../pallets/minter-reward", default-features = false } +bifrost-bancor= { path = "../../pallets/bancor",default-features = false } +bifrost-bancor-runtime-api = { path = "../../pallets/bancor/rpc/runtime-api", default-features = false } bifrost-flexible-fee = { path = "../../pallets/flexible-fee", default-features = false } bifrost-flexible-fee-rpc-runtime-api = { path = "../../pallets/flexible-fee/rpc/runtime-api", default-features = false } -bifrost-salp= {path = "../../pallets/salp",default-features = false} -bifrost-bancor= {path = "../../pallets/bancor",default-features = false} -bifrost-vsbond-auction = { path = "../../pallets/vsbond-auction", default-features = false } -bifrost-bancor-runtime-api = { path = "../../pallets/bancor/rpc/runtime-api", default-features = false } +bifrost-minter-reward = { path = "../../pallets/minter-reward", default-features = false } +bifrost-runtime-common = { package = "bifrost-runtime-common", path = "../common", default-features = false } +bifrost-salp = { path = "../../pallets/salp", default-features = false } +bifrost-vsbond-auction = { path = "../../pallets/vsbond-auction", default-features = false } +bifrost-vtoken-mint = { path = "../../pallets/vtoken-mint", default-features = false } +pallet-vesting = { package = "bifrost-vesting", path = "../../pallets/vesting", default-features = false } # orml orml-currencies = { version = "0.4.1-dev", default-features = false }