Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Wallet.cs
1using System;
5
7{
11 [CollectionName("eDalerWallets")]
12 [TypeName(TypeNameSerialization.None)]
13 [ArchivingTime(3653)] // 10 years
14 [Index("Account", "Created")]
15 public class Wallet
16 {
17 private static readonly object[] approvedSources = new object[]
18 {
19 typeof(XmppServerModule).Assembly,
20 typeof(Persistence.NeuroLedger.NeuroLedgerProvider),
21 DataStorage.Account.FromSaveUnsaved,
22 DataStorage.Account.FromUpdateObject
23 };
24
25 private string objectId = null;
27 private CaseInsensitiveString domain = null;
29 private decimal balance = 0;
30 private decimal reserved = 0;
31 private DateTime created = DateTime.MinValue;
32 private DateTime balanceTimestamp = DateTime.MinValue;
33
34 public Wallet()
35 {
36 }
37
38 [ObjectId]
39 public string ObjectId
40 {
41 get => this.objectId;
42 set => this.objectId = value;
43 }
44
45 public CaseInsensitiveString Account
46 {
47 get => this.account;
48 set => this.account = value;
49 }
50
51 [DefaultValueNull]
52 public CaseInsensitiveString Domain
53 {
54 get => this.domain;
55 set => this.domain = value;
56 }
57
58 [DefaultValueStringEmpty]
59 public CaseInsensitiveString Currency
60 {
61 get
62 {
63 Assert.CallFromSource(approvedSources);
64 return this.currency;
65 }
66
67 set
68 {
69 Assert.CallFromSource(approvedSources);
70 this.currency = value;
71 }
72 }
73
74 public decimal Balance
75 {
76 get
77 {
78 Assert.CallFromSource(approvedSources);
79 return this.balance;
80 }
81
82 set
83 {
84 Assert.CallFromSource(approvedSources);
85 this.balance = value;
86 }
87 }
88
89 public decimal Reserved
90 {
91 get
92 {
93 Assert.CallFromSource(approvedSources);
94 return this.reserved;
95 }
96
97 set
98 {
99 Assert.CallFromSource(approvedSources);
100 this.reserved = value;
101 }
102 }
103
104 public DateTime BalanceTimestamp
105 {
106 get
107 {
108 Assert.CallFromSource(approvedSources);
109 return this.balanceTimestamp;
110 }
111
112 set
113 {
114 Assert.CallFromSource(approvedSources);
115 this.balanceTimestamp = value;
116 }
117 }
118
119 public DateTime Created
120 {
121 get => this.created;
122 set => this.created = value;
123 }
124
125 }
126}
Represents a case-insensitive string.
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
Static class containing methods that can be used to make sure calls are made from appropriate locatio...
Definition: Assert.cs:15
static void CallFromSource(params string[] Sources)
Makes sure the call is made from one of the listed sources.
Definition: Assert.cs:39
Retains the current balance of an account.
Definition: Wallet.cs:16
Service Module hosting the XMPP broker and its components.
TypeNameSerialization
How the type name should be serialized.