frame_support/traits/tokens/fungibles/roles.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Inspect traits for Asset roles
19//!
20//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits.
21
22use sp_runtime::DispatchResult;
23
24pub trait Inspect<AccountId>: super::Inspect<AccountId> {
25 // Get owner for an AssetId.
26 fn owner(asset: Self::AssetId) -> Option<AccountId>;
27 // Get issuer for an AssetId.
28 fn issuer(asset: Self::AssetId) -> Option<AccountId>;
29 // Get admin for an AssetId.
30 fn admin(asset: Self::AssetId) -> Option<AccountId>;
31 // Get freezer for an AssetId.
32 fn freezer(asset: Self::AssetId) -> Option<AccountId>;
33}
34
35/// Trait for resetting the team configuration of an existing fungible asset.
36pub trait ResetTeam<AccountId>: super::Inspect<AccountId> {
37 /// Reset the team for the asset with the given `id`.
38 ///
39 /// ### Parameters
40 /// - `id`: The identifier of the asset for which the team is being reset.
41 /// - `owner`: The new `owner` account for the asset.
42 /// - `admin`: The new `admin` account for the asset.
43 /// - `issuer`: The new `issuer` account for the asset.
44 /// - `freezer`: The new `freezer` account for the asset.
45 fn reset_team(
46 id: Self::AssetId,
47 owner: AccountId,
48 admin: AccountId,
49 issuer: AccountId,
50 freezer: AccountId,
51 ) -> DispatchResult;
52}