gbuiltin_proxy/
lib.rs

1// This file is part of Gear.
2
3// Copyright (C) 2021-2025 Gear Technologies Inc.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19//! Types used to communicate with proxy built-in.
20
21#![no_std]
22
23use gprimitives::ActorId;
24use parity_scale_codec::{Decode, Encode};
25
26/// Request that can be handled by the proxy builtin.
27///
28/// Currently all proxies aren't required to send announcement,
29/// i.e. no delays for the delegate actions.
30#[derive(Debug, Clone, Copy, Eq, PartialEq, Encode, Decode)]
31pub enum Request {
32    /// Add proxy request.
33    ///
34    /// Requests to add `delegate` as a delegate for the actions
35    /// defined by `proxy_type` to be done on behalf of the request
36    /// sender.
37    AddProxy {
38        delegate: ActorId,
39        proxy_type: ProxyType,
40    },
41    /// Remove proxy request.
42    ///
43    /// Request sender asks to remove `delegate` with set of allowed actions
44    /// defined in `proxy_type` from his list of proxies.
45    RemoveProxy {
46        delegate: ActorId,
47        proxy_type: ProxyType,
48    },
49}
50
51/// Proxy type.
52///
53/// The mirror enum for the one defined in vara-runtime crate.
54#[derive(Debug, Clone, Copy, Eq, PartialEq, Encode, Decode)]
55pub enum ProxyType {
56    Any,
57    NonTransfer,
58    Governance,
59    Staking,
60    IdentityJudgement,
61    CancelProxy,
62}