|
| 1 | +// Copyright 2021 MaidSafe.net limited. |
| 2 | +// |
| 3 | +// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT |
| 4 | +// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD |
| 5 | +// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, |
| 6 | +// modified, or distributed except according to those terms. Please review the Licences for the |
| 7 | +// specific language governing permissions and limitations relating to use of the SAFE Network |
| 8 | +// Software. |
| 9 | + |
| 10 | +use crate::PublicKey; |
| 11 | +use serde::{Deserialize, Serialize}; |
| 12 | + |
| 13 | +/// Node age, the number of times |
| 14 | +/// it has been relocated between sections. |
| 15 | +pub type NodeAge = u8; |
| 16 | + |
| 17 | +/// The stage of a node, with |
| 18 | +/// regards to eligibility for rewards. |
| 19 | +#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)] |
| 20 | +pub enum NodeRewardStage { |
| 21 | + /// When a new node joins the network. |
| 22 | + NewNode, |
| 23 | + /// When a node has been relocated to us. |
| 24 | + AwaitingActivation(NodeAge), |
| 25 | + /// After we have received the wallet id, |
| 26 | + /// the stage is `Active`. |
| 27 | + Active { |
| 28 | + /// The wallet of the node operator. |
| 29 | + wallet: PublicKey, |
| 30 | + /// The node age. |
| 31 | + age: NodeAge |
| 32 | + }, |
| 33 | + /// After a node leaves the section |
| 34 | + /// it transitions into `AwaitingRelocation` stage. |
| 35 | + AwaitingRelocation(PublicKey), |
| 36 | +} |
0 commit comments