-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
54 lines (41 loc) · 893 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from pydantic import BaseModel
from typing import List, Optional
class Event(BaseModel):
type: str
sender: str
receiver: str
timestamp: int
sequence: int
version: int
amount: int = 0
class VoteOption(BaseModel):
address: str
option: str
count: int = 0
weight: int = 0
def reset_stats(self):
self.weight = 0
self.count = 0
class Txn(BaseModel):
timestamp: int
hash: str
block: int
sender: str
recipient: str
amount: float
class Vote(BaseModel):
option: VoteOption
event: Event
weight: int = 0
class VotesSummary(BaseModel):
total_votes: int
total_weight: int
class Proposal(BaseModel):
id: int
title: str
subtitle: str
address: str
description: str
options: List[VoteOption]
votes: Optional[List[Vote]]
votes_summary: Optional[VotesSummary]