forked from lnbits/events
-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.py
72 lines (62 loc) · 1.68 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from typing import Optional
from fastapi.param_functions import Query
from pydantic import BaseModel
MAX_SATS=21_000_000_00_000_000
class CreateCompetition(BaseModel):
wallet: str
name: str
info: str
banner: str
closing_datetime: str
amount_tickets: int = Query(..., ge=0)
min_bet: int = Query(..., gt=0, lt=MAX_SATS)
max_bet: int = Query(..., gt=0, lt=MAX_SATS)
choices: str
class UpdateCompetition(BaseModel):
closing_datetime: Optional[str]
amount_tickets: Optional[int] # not sure how Query will behave in case of None
class CompleteCompetition(BaseModel):
winning_choice: int # -1 for cancellation
class CreateInvoiceForTicket(BaseModel):
reward_target: str
amount: int
choice: int
class Competition(BaseModel):
id: str
wallet: str
register_id: str
name: str
info: str
banner: str
closing_datetime: str
amount_tickets: int
min_bet: int
max_bet: int
sold: int
choices: str
winning_choice: int
# states: INITIAL, COMPLETED_PAYING, COMPLETED_PAID, COMPLETED_PAID_ALL
state: str
time: int
class Ticket(BaseModel):
id: str
wallet: str
competition: str
amount: int
reward_target: str
choice: int
# states: INITIAL, FUNDED, LOST, WON_UNPAID, WON_PAYING, WON_PAYMENT_FAILED, WON_PAID,
# CANCELLED_UNPAID, CANCELLED_PAYING, CANCELLED_PAYMENT_FAILED, CANCELLED_PAID
state: str
reward_msat: int
reward_failure: str
reward_payment_hash: str
time: int
class ChoiceAmountSum(BaseModel):
choice: int
amount_sum: int
class LnurlpParameters(BaseModel):
minSendable: int
maxSendable: int
callback: str
commentAllowed: int