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

Pallet assets-vesting #7404

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pandres95
Copy link
Contributor

Fixes #4090.

Description

The pallet-assets-vesting is a pallet that supports handling vesting of an instances of pallet-assets through freezing fungibles.

The behaviour is analog to what already exists with pallet-vesting, with small differences (like adding an asset parameter where the AssetId goes on every call). Also, WithdrawalReasons are no longer used, since they're related to Currency.

Integration

This pallet can be integrated into any runtime that already has an instance of pallet-assets and pallet-assets-freezer.

The instance must be the same as the one that pallets mentioned above use.

type AssetsInstance = pallet_assets::Instance1;

#[derive_impl(pallet_assets::config_preludes::ParachainDefaultConfig)]
impl pallet_assets::Config<AssetsInstance> for Test {
	type Currency = Balances;
	type ForceOrigin = EnsureRoot<AccountId>;
	type CreateOrigin = EnsureSigned<AccountId>;
	type Freezer = AssetsFreezer;
}

impl pallet_assets_freezer::Config<AssetsInstance> for Runtime {
	type RuntimeFreezeReason = RuntimeFreezeReason;
	type RuntimeEvent = RuntimeEvent;
}

impl pallet_assets_vesting::Config<AssetsInstance> for Test {
	type RuntimeEvent = RuntimeEvent;
	type ForceOrigin = EnsureRoot<AccountId>;
	type Assets = Assets;
	type Freezer = AssetsFreezer;
	type BlockNumberToBalance = Identity;
	type RuntimeFreezeReason = RuntimeFreezeReason;
	type WeightInfo = ();
	type MinVestedTransfer = MinVestedTransfer;
	type BlockNumberProvider = System;
	const MAX_VESTING_SCHEDULES: u32 = 3;
}

Checklist

  • My PR includes a detailed description as outlined in the "Description" and its two subsections above.
  • My PR follows the labeling requirements of this project (at minimum one label for T required)
    • External contributors: ask maintainers to put the right label on your PR.
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@pandres95 pandres95 requested a review from a team as a code owner January 31, 2025 07:01
@pandres95 pandres95 marked this pull request as draft January 31, 2025 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add vestedTransfer for Assets on Asset Hub
1 participant