gbuiltin_proxy/lib.rs
1// Copyright (C) Gear Technologies Inc.
2// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
3
4//! Types used to communicate with proxy built-in.
5
6#![no_std]
7
8use gprimitives::ActorId;
9use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
10use scale_info::TypeInfo;
11
12/// Request that can be handled by the proxy builtin.
13///
14/// Currently all proxies aren't required to send announcement,
15/// i.e. no delays for the delegate actions.
16#[derive(Debug, Clone, Copy, Eq, PartialEq, Encode, Decode, TypeInfo, MaxEncodedLen)]
17pub enum Request {
18 /// Add proxy request.
19 ///
20 /// Requests to add `delegate` as a delegate for the actions
21 /// defined by `proxy_type` to be done on behalf of the request
22 /// sender.
23 #[codec(index = 0)]
24 AddProxy {
25 delegate: ActorId,
26 proxy_type: ProxyType,
27 },
28 /// Remove proxy request.
29 ///
30 /// Request sender asks to remove `delegate` with set of allowed actions
31 /// defined in `proxy_type` from his list of proxies.
32 #[codec(index = 1)]
33 RemoveProxy {
34 delegate: ActorId,
35 proxy_type: ProxyType,
36 },
37}
38
39/// Proxy type.
40///
41/// The mirror enum for the one defined in vara-runtime crate.
42#[derive(Debug, Clone, Copy, Eq, PartialEq, Encode, Decode, TypeInfo, MaxEncodedLen)]
43pub enum ProxyType {
44 Any,
45 NonTransfer,
46 Governance,
47 Staking,
48 IdentityJudgement,
49 CancelProxy,
50}