-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.py
47 lines (33 loc) · 1.13 KB
/
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
import peewee as pw
DBFILE = 'db.sqlite'
db = pw.SqliteDatabase(DBFILE)
class BaseModel(pw.Model):
class Meta:
database = db
class Config(BaseModel):
address = pw.CharField(max_length=42)
private_key = pw.CharField(max_length=64)
gas_price = pw.IntegerField()
web3_node = pw.CharField(max_length=255)
token = pw.CharField(max_length=42)
caribmars_token = pw.CharField(max_length=42)
current_nonce = pw.IntegerField(default=0)
eth_balance = pw.CharField(default=0)
token_balance = pw.CharField(default=0)
class Recipient(BaseModel):
address = pw.CharField(max_length=42)
amount = pw.DecimalField(max_digits=36, decimal_places=18)
class Tx(BaseModel):
choices = (
('NEW', 'NEW'),
('SIGNED', 'SIGNED'),
('SENT', 'SENT'),
('MINED', 'MINED'),
)
raw_tx = pw.TextField(default="")
signed_tx = pw.BlobField(default="")
tx_hash = pw.BlobField(default="")
tx_receipt = pw.TextField(default="")
nonce = pw.IntegerField(null=True)
recipient = pw.ForeignKeyField(Recipient, backref='txes')
status = pw.CharField(choices=choices)