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

[Deprecation] Treasury Proposals and spend_local call #5930

Closed
7 tasks
muharem opened this issue Oct 4, 2024 · 2 comments · Fixed by #6169
Closed
7 tasks

[Deprecation] Treasury Proposals and spend_local call #5930

muharem opened this issue Oct 4, 2024 · 2 comments · Fixed by #6169
Assignees

Comments

@muharem
Copy link
Contributor

muharem commented Oct 4, 2024

Deprecate the items related to the Gov_v1 treasury spend flow and provide an implementation of the Pay trait within the treasury pallet to make it possible to setup the spend call to work as spend_local.

Deprecated items:

  • Proposals, ProposalCount and Approvals storage items;
  • spend_local and remove_approval calls;
  • all public items associated exclusively with above items (e.g. MaxApprovals);

Reference issue: #138

Tasks

Preview Give feedback
@muharem
Copy link
Contributor Author

muharem commented Oct 4, 2024

The PR deprecating the public items should have the implementation of Pay trait that implemented over fungible trait. This implementation should allow to setup the spend call to behave as spend_local, transferring the funds locally. The PRdoc should contain instructions on how to migrate to the spend and stop using the spend call.

@davidk-pt
Copy link
Contributor

I think there's already config of Paymaster inside treasury pallet, we need to add another one? Am I missing something?

		/// Type for processing spends of [Self::AssetKind] in favor of [`Self::Beneficiary`].
		type Paymaster: Pay<Beneficiary = Self::Beneficiary, AssetKind = Self::AssetKind>;

github-merge-queue bot pushed a commit that referenced this issue Nov 5, 2024
…#6169)

Resolves #5930

`spend_local` from `treasury` pallet and associated types are
deprecated. `spend_local` was being used before with native currency in
the treasury.

This PR provides a documentation on how to migrate to the `spend` call
instead.

### Migration

#### For users who were using only `spend_local` before

To replace `spend_local` functionality configure `Paymaster` pallet
configuration to be `PayFromAccount` and configure `AssetKind` to be
`()` and use `spend` call instead.
This way `spend` call will function as deprecated `spend_local`.

Example:
```
impl pallet_treasury::Config for Runtime {
    ..
    type AssetKind = ();
    type Paymaster = PayFromAccount<Self::Currency, TreasuryAccount>;
    // convert balance 1:1 ratio with native currency
    type BalanceConverter = UnityAssetBalanceConversion;
    ..
}
```

#### For users who were already using `spend` with all other assets,
except the native asset

Use `NativeOrWithId` type for `AssetKind` and have a `UnionOf` for
native and non-native assets, then use that with `PayAssetFromAccount`.

Example from `kitchensink-runtime`:
```
// Union of native currency and assets
pub type NativeAndAssets =
    UnionOf<Balances, Assets, NativeFromLeft, NativeOrWithId<u32>, AccountId>;

impl pallet_treasury::Config for Runtime {
    ..
    type AssetKind = NativeOrWithId<u32>;
    type Paymaster = PayAssetFromAccount<NativeAndAssets, TreasuryAccount>;
    type BalanceConverter = AssetRate;
    ..
}

// AssetRate pallet configuration
impl pallet_asset_rate::Config for Runtime {
    ..
    type Currency = Balances;
    type AssetKind = NativeOrWithId<u32>;
    ..
}
```

---------

Co-authored-by: DavidK <davidk@parity.io>
Co-authored-by: Muharem <ismailov.m.h@gmail.com>
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 a pull request may close this issue.

2 participants