Skip to content
This repository was archived by the owner on Jun 25, 2021. It is now read-only.

Commit e15cbab

Browse files
oetyngjoshuef
authored andcommitted
feat(rewards): add reward stage enum
1 parent ed7005d commit e15cbab

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ mod sequence;
3636
mod token;
3737
mod transfer;
3838
mod utils;
39+
mod rewards;
3940

4041
pub use blob::{
4142
Address as BlobAddress, Data as Blob, Kind as BlobKind, PrivateData as PrivateBlob,
@@ -67,6 +68,7 @@ pub use sequence::{
6768
PublicPolicy as SequencePublicPolicy, PublicSeqData, User as SequenceUser,
6869
};
6970
pub use transfer::*;
71+
pub use rewards::{NodeAge, NodeRewardStage};
7072

7173
use serde::{Deserialize, Serialize};
7274
use std::fmt::Debug;

src/rewards.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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

Comments
 (0)