tracrewards 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tracrewards-0.1.5/LICENSE +22 -0
- tracrewards-0.1.5/MANIFEST.in +3 -0
- tracrewards-0.1.5/PKG-INFO +78 -0
- tracrewards-0.1.5/README.md +63 -0
- tracrewards-0.1.5/VERSION +1 -0
- tracrewards-0.1.5/pyproject.toml +6 -0
- tracrewards-0.1.5/rewards/__init__.py +285 -0
- tracrewards-0.1.5/rewards/admin.py +315 -0
- tracrewards-0.1.5/rewards/htdocs/rewards_admin_config.html +68 -0
- tracrewards-0.1.5/rewards/htdocs/rewards_admin_payments.html +156 -0
- tracrewards-0.1.5/rewards/htdocs/rewards_admin_payouts.html +227 -0
- tracrewards-0.1.5/rewards/htdocs/rewards_user_email.html +22 -0
- tracrewards-0.1.5/rewards/htdocs/rewards_user_prefs.html +177 -0
- tracrewards-0.1.5/rewards/plugin.py +207 -0
- tracrewards-0.1.5/rewards/prefs.py +233 -0
- tracrewards-0.1.5/rewards/upgrades/__init__.py +6 -0
- tracrewards-0.1.5/rewards/upgrades/db2.py +33 -0
- tracrewards-0.1.5/setup.cfg +4 -0
- tracrewards-0.1.5/setup.py +56 -0
- tracrewards-0.1.5/tracrewards.egg-info/PKG-INFO +78 -0
- tracrewards-0.1.5/tracrewards.egg-info/SOURCES.txt +23 -0
- tracrewards-0.1.5/tracrewards.egg-info/dependency_links.txt +1 -0
- tracrewards-0.1.5/tracrewards.egg-info/entry_points.txt +4 -0
- tracrewards-0.1.5/tracrewards.egg-info/requires.txt +1 -0
- tracrewards-0.1.5/tracrewards.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2026 OUTLYR
|
|
2
|
+
https://outlyr.space
|
|
3
|
+
|
|
4
|
+
OPEN SOURCE - MIT LICENSE
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
7
|
+
this software and associated documentation files (the "Software"), to make use
|
|
8
|
+
of the Software without restriction, including the rights to use, copy, and/or
|
|
9
|
+
modify the Software, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
The Software and its derivatives may not be sold or distributed (including free
|
|
15
|
+
of charge) to others without the express written consent of the owner.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
19
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
20
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
21
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
22
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tracrewards
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: Set crypto rewards for tickets and track user balances/payouts
|
|
5
|
+
Home-page: https://trac-hacks.org/wiki/TracRewardsPlugin
|
|
6
|
+
Author: OUTLYR
|
|
7
|
+
Author-email: contact@outlyr.space
|
|
8
|
+
Project-URL: Bug Tracker, https://trac-hacks.org/report/9?COMPONENT=TracRewardsPlugin
|
|
9
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Framework :: Trac
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
|
|
16
|
+
# TracRewards
|
|
17
|
+
|
|
18
|
+
This plugin assigns a Reward value to trac tickets, and allows for rewards to be paid out via crypto currencies. It includes admin panels to configure the plugin and track what is owed/paid to users, and a user preferences panel to set the wallet and currency to receive funds. All transfers need to happen outside of Trac and can be recorded/logged in the admin panel to be reflected in the user's account.
|
|
19
|
+
|
|
20
|
+
This plugin was developed and is maintained by [OUTLYR](https://outlyr.space)
|
|
21
|
+
|
|
22
|
+
## Key Concepts
|
|
23
|
+
|
|
24
|
+
* uses `reward` ticket custom field to assign reward value to ticket
|
|
25
|
+
* uses `ticket change history` to track cumulative rewards for a user
|
|
26
|
+
* uses `rewards_payouts` database table to track payouts for each user
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
A plugin can either be deployed globally, or only for a specific environment.
|
|
31
|
+
Global deployment is done by installing the plugin:
|
|
32
|
+
|
|
33
|
+
cd /path/to/plugin_source
|
|
34
|
+
python setup.py install
|
|
35
|
+
|
|
36
|
+
The plugin is also available on PyPI and can be installed globally using pip:
|
|
37
|
+
|
|
38
|
+
pip install TracChecklist
|
|
39
|
+
|
|
40
|
+
To deploy a plugin only to a specific Trac environment, copy the egg file into
|
|
41
|
+
the plugins directory of that environment:
|
|
42
|
+
|
|
43
|
+
cd /path/to/plugin_source
|
|
44
|
+
python setup.py bdist_egg
|
|
45
|
+
cp dist/*.egg /path/to/project_environment/plugins
|
|
46
|
+
|
|
47
|
+
## Setup
|
|
48
|
+
|
|
49
|
+
Enable the plugin in your trac.ini file:
|
|
50
|
+
|
|
51
|
+
[components]
|
|
52
|
+
checklist.* = enabled
|
|
53
|
+
|
|
54
|
+
The plugin requires a new database table; update the environment to create it:
|
|
55
|
+
|
|
56
|
+
$ trac-admin /path/to/env upgrade
|
|
57
|
+
|
|
58
|
+
The plugin uses static resources (CSS, JS). If you mapped static resources so
|
|
59
|
+
they are served by the web server, the resources need to be deployed to the
|
|
60
|
+
location on the filesystem that is served by the web server. Execute the deploy
|
|
61
|
+
command, as is done during install and upgrade:
|
|
62
|
+
|
|
63
|
+
$ trac-admin /path/to/env deploy /deploy/path
|
|
64
|
+
|
|
65
|
+
Restart the server once fully configured.
|
|
66
|
+
|
|
67
|
+
## Use
|
|
68
|
+
|
|
69
|
+
The plugin creates a ticket custom field called `Reward`. All other settings can be configured in the Admin panel. Once setup, the reward value (if any) for any ticket closed as implemented will be credited to the owner of the ticket at the time it is closed.
|
|
70
|
+
|
|
71
|
+
The admin can then use the Admin `Payout` panel to generate a list of users to be paid at any time (weekly, monthly, etc.), and record the payments in Trac to capture them to the user's account.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Revision Log
|
|
75
|
+
|
|
76
|
+
* 0.0 - alpha prototype (internal testing)
|
|
77
|
+
* 0.1 - alpha prototype (internal production use)
|
|
78
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# TracRewards
|
|
2
|
+
|
|
3
|
+
This plugin assigns a Reward value to trac tickets, and allows for rewards to be paid out via crypto currencies. It includes admin panels to configure the plugin and track what is owed/paid to users, and a user preferences panel to set the wallet and currency to receive funds. All transfers need to happen outside of Trac and can be recorded/logged in the admin panel to be reflected in the user's account.
|
|
4
|
+
|
|
5
|
+
This plugin was developed and is maintained by [OUTLYR](https://outlyr.space)
|
|
6
|
+
|
|
7
|
+
## Key Concepts
|
|
8
|
+
|
|
9
|
+
* uses `reward` ticket custom field to assign reward value to ticket
|
|
10
|
+
* uses `ticket change history` to track cumulative rewards for a user
|
|
11
|
+
* uses `rewards_payouts` database table to track payouts for each user
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
A plugin can either be deployed globally, or only for a specific environment.
|
|
16
|
+
Global deployment is done by installing the plugin:
|
|
17
|
+
|
|
18
|
+
cd /path/to/plugin_source
|
|
19
|
+
python setup.py install
|
|
20
|
+
|
|
21
|
+
The plugin is also available on PyPI and can be installed globally using pip:
|
|
22
|
+
|
|
23
|
+
pip install TracChecklist
|
|
24
|
+
|
|
25
|
+
To deploy a plugin only to a specific Trac environment, copy the egg file into
|
|
26
|
+
the plugins directory of that environment:
|
|
27
|
+
|
|
28
|
+
cd /path/to/plugin_source
|
|
29
|
+
python setup.py bdist_egg
|
|
30
|
+
cp dist/*.egg /path/to/project_environment/plugins
|
|
31
|
+
|
|
32
|
+
## Setup
|
|
33
|
+
|
|
34
|
+
Enable the plugin in your trac.ini file:
|
|
35
|
+
|
|
36
|
+
[components]
|
|
37
|
+
checklist.* = enabled
|
|
38
|
+
|
|
39
|
+
The plugin requires a new database table; update the environment to create it:
|
|
40
|
+
|
|
41
|
+
$ trac-admin /path/to/env upgrade
|
|
42
|
+
|
|
43
|
+
The plugin uses static resources (CSS, JS). If you mapped static resources so
|
|
44
|
+
they are served by the web server, the resources need to be deployed to the
|
|
45
|
+
location on the filesystem that is served by the web server. Execute the deploy
|
|
46
|
+
command, as is done during install and upgrade:
|
|
47
|
+
|
|
48
|
+
$ trac-admin /path/to/env deploy /deploy/path
|
|
49
|
+
|
|
50
|
+
Restart the server once fully configured.
|
|
51
|
+
|
|
52
|
+
## Use
|
|
53
|
+
|
|
54
|
+
The plugin creates a ticket custom field called `Reward`. All other settings can be configured in the Admin panel. Once setup, the reward value (if any) for any ticket closed as implemented will be credited to the owner of the ticket at the time it is closed.
|
|
55
|
+
|
|
56
|
+
The admin can then use the Admin `Payout` panel to generate a list of users to be paid at any time (weekly, monthly, etc.), and record the payments in Trac to capture them to the user's account.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## Revision Log
|
|
60
|
+
|
|
61
|
+
* 0.0 - alpha prototype (internal testing)
|
|
62
|
+
* 0.1 - alpha prototype (internal production use)
|
|
63
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.5
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import pkg_resources
|
|
2
|
+
|
|
3
|
+
pkg_resources.require("Trac >= 1.4")
|
|
4
|
+
|
|
5
|
+
from trac.db.schema import Table, Column
|
|
6
|
+
|
|
7
|
+
# --------------------------------------------------------------------------------------
|
|
8
|
+
# plugin settings - stored in trac.ini (all lower case, under [SECTION])
|
|
9
|
+
# --------------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
# section name in trac.ini [rewards]
|
|
12
|
+
SECTION = "rewards"
|
|
13
|
+
|
|
14
|
+
# config items
|
|
15
|
+
CONF = {
|
|
16
|
+
"field": {
|
|
17
|
+
"permission": {
|
|
18
|
+
"value": "REWARDS_ADMIN",
|
|
19
|
+
"input": "text",
|
|
20
|
+
"help": """TracRewards requires this permission to edit the reward value on a ticket.
|
|
21
|
+
""",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
"currencies": {
|
|
25
|
+
"coin": {
|
|
26
|
+
"value": "ZCHF,USDC",
|
|
27
|
+
"input": "text",
|
|
28
|
+
"help": """
|
|
29
|
+
CSV list of crypto currency codes users can select for payouts
|
|
30
|
+
in Trac preferences (e.g. ZCHF, USDC, ... ).
|
|
31
|
+
""".replace(
|
|
32
|
+
"\n", " "
|
|
33
|
+
),
|
|
34
|
+
},
|
|
35
|
+
"network": {
|
|
36
|
+
"value": "Ethereum, Polygon",
|
|
37
|
+
"input": "text",
|
|
38
|
+
"help": """
|
|
39
|
+
CSV list of payment networks users can select for payouts in Trac
|
|
40
|
+
preferences (e.g. ethereum, polygon, ... ).
|
|
41
|
+
""".replace(
|
|
42
|
+
"\n", " "
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# --------------------------------------------------------------------------------------
|
|
49
|
+
# database settings - shared by first-use setup (plugin.Setup) and the db2 migration
|
|
50
|
+
# --------------------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
# setup parameters
|
|
53
|
+
DB_NAME = "TracRewards"
|
|
54
|
+
DB_VERSION = 2 # schema version (stored in "system" table)
|
|
55
|
+
|
|
56
|
+
REWARD_FIELD = "reward" # custom ticket field for reward value
|
|
57
|
+
REWARD_VALID = "implemented" # ticket resolution that triggers reward
|
|
58
|
+
PAYOUT_TABLE = "rewards_payout" # one row per payout event
|
|
59
|
+
|
|
60
|
+
# NOTE: shared by first-use setup (plugin.Setup) and the db2 migration, so a
|
|
61
|
+
# fresh install and an upgraded one can never drift apart
|
|
62
|
+
SCHEMA = [
|
|
63
|
+
# Trac timestamps need to be 'bigint' to be compatible across all
|
|
64
|
+
# supported database types (SQLite, MySQL, etc.)
|
|
65
|
+
Table(PAYOUT_TABLE, key="id")[
|
|
66
|
+
Column("id", auto_increment=True),
|
|
67
|
+
Column("timestamp", type="bigint"),
|
|
68
|
+
Column("user", type="text"),
|
|
69
|
+
Column("wallet", type="text"),
|
|
70
|
+
Column("network", type="text"),
|
|
71
|
+
Column("currency", type="text"),
|
|
72
|
+
Column("amount", type="float"),
|
|
73
|
+
Column("reference", type="text"),
|
|
74
|
+
],
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
QUERIES = {
|
|
78
|
+
"users": {
|
|
79
|
+
"param": [
|
|
80
|
+
"ticket_custom field name : REWARD_FIELD",
|
|
81
|
+
"valid ticket resolution : REWARD_VALID",
|
|
82
|
+
"sid of the user : first.last",
|
|
83
|
+
],
|
|
84
|
+
"query": """
|
|
85
|
+
SELECT *
|
|
86
|
+
FROM (
|
|
87
|
+
SELECT
|
|
88
|
+
t.id AS ticket,
|
|
89
|
+
t.summary,
|
|
90
|
+
t.milestone,
|
|
91
|
+
r.value AS reward,
|
|
92
|
+
tc.author AS closed_by,
|
|
93
|
+
tc.time AS closed_at,
|
|
94
|
+
|
|
95
|
+
-- owner at closing (from ticket_change)
|
|
96
|
+
-- or ticket owner (if owner never changed)
|
|
97
|
+
COALESCE(
|
|
98
|
+
(SELECT oc.newvalue
|
|
99
|
+
FROM ticket_change oc
|
|
100
|
+
WHERE oc.ticket = t.id
|
|
101
|
+
AND oc.field = 'owner'
|
|
102
|
+
AND oc.time <= tc.time
|
|
103
|
+
ORDER BY oc.time DESC
|
|
104
|
+
LIMIT 1), t.owner
|
|
105
|
+
) AS owner
|
|
106
|
+
|
|
107
|
+
FROM ticket_change tc
|
|
108
|
+
JOIN ticket t ON t.id = tc.ticket
|
|
109
|
+
LEFT JOIN ticket_custom r ON r.ticket = t.id AND r.name = %s
|
|
110
|
+
|
|
111
|
+
WHERE
|
|
112
|
+
|
|
113
|
+
-- ticket was closed
|
|
114
|
+
tc.field = 'status' AND tc.newvalue = 'closed'
|
|
115
|
+
|
|
116
|
+
-- resolution was valid
|
|
117
|
+
AND (
|
|
118
|
+
SELECT rc.newvalue
|
|
119
|
+
FROM ticket_change rc
|
|
120
|
+
WHERE rc.ticket = t.id
|
|
121
|
+
AND rc.field = 'resolution'
|
|
122
|
+
AND rc.time <= tc.time
|
|
123
|
+
ORDER BY rc.time DESC
|
|
124
|
+
LIMIT 1
|
|
125
|
+
) = %s
|
|
126
|
+
|
|
127
|
+
) AS closures
|
|
128
|
+
|
|
129
|
+
WHERE owner = %s
|
|
130
|
+
|
|
131
|
+
ORDER BY closed_at DESC
|
|
132
|
+
""",
|
|
133
|
+
},
|
|
134
|
+
"payouts": {
|
|
135
|
+
"param": [],
|
|
136
|
+
"query": (
|
|
137
|
+
"""
|
|
138
|
+
SELECT
|
|
139
|
+
closures.owner,
|
|
140
|
+
closures.tickets,
|
|
141
|
+
closures.total_reward,
|
|
142
|
+
(
|
|
143
|
+
SELECT COUNT(rp.id)
|
|
144
|
+
FROM
|
|
145
|
+
"""
|
|
146
|
+
+ PAYOUT_TABLE
|
|
147
|
+
+ """ AS rp
|
|
148
|
+
WHERE rp.user = closures.owner
|
|
149
|
+
) AS payments,
|
|
150
|
+
(
|
|
151
|
+
SELECT COALESCE(SUM(rp.amount), 0)
|
|
152
|
+
FROM
|
|
153
|
+
"""
|
|
154
|
+
+ PAYOUT_TABLE
|
|
155
|
+
+ """ AS rp
|
|
156
|
+
WHERE rp.user = closures.owner
|
|
157
|
+
) AS total_payout,
|
|
158
|
+
|
|
159
|
+
users.username,
|
|
160
|
+
users.email,
|
|
161
|
+
users.wallet,
|
|
162
|
+
users.network,
|
|
163
|
+
users.currency,
|
|
164
|
+
users.enabled
|
|
165
|
+
|
|
166
|
+
-- rewards data from ticket
|
|
167
|
+
FROM (
|
|
168
|
+
SELECT
|
|
169
|
+
owner,
|
|
170
|
+
COUNT(*) AS tickets,
|
|
171
|
+
SUM(CAST(reward AS DECIMAL)) AS total_reward
|
|
172
|
+
FROM (
|
|
173
|
+
SELECT
|
|
174
|
+
t.id AS ticket,
|
|
175
|
+
r.value AS reward,
|
|
176
|
+
|
|
177
|
+
-- owner at closing (from ticket_change)
|
|
178
|
+
-- or ticket owner (if owner never changed)
|
|
179
|
+
COALESCE(
|
|
180
|
+
(SELECT oc.newvalue
|
|
181
|
+
FROM ticket_change oc
|
|
182
|
+
WHERE oc.ticket = t.id
|
|
183
|
+
AND oc.field = 'owner'
|
|
184
|
+
AND oc.time <= tc.time
|
|
185
|
+
ORDER BY oc.time DESC
|
|
186
|
+
LIMIT 1), t.owner
|
|
187
|
+
) AS owner
|
|
188
|
+
|
|
189
|
+
FROM ticket_change tc
|
|
190
|
+
JOIN ticket t ON t.id = tc.ticket
|
|
191
|
+
LEFT JOIN ticket_custom r
|
|
192
|
+
ON r.ticket = t.id
|
|
193
|
+
AND r.name = 'reward'
|
|
194
|
+
|
|
195
|
+
WHERE tc.field = 'status'
|
|
196
|
+
AND tc.newvalue = 'closed'
|
|
197
|
+
|
|
198
|
+
-- resolution was implemented at time of closing
|
|
199
|
+
AND (
|
|
200
|
+
SELECT rc.newvalue
|
|
201
|
+
FROM ticket_change rc
|
|
202
|
+
WHERE rc.ticket = t.id
|
|
203
|
+
AND rc.field = 'resolution'
|
|
204
|
+
AND rc.time <= tc.time
|
|
205
|
+
ORDER BY rc.time DESC
|
|
206
|
+
LIMIT 1
|
|
207
|
+
) = 'implemented'
|
|
208
|
+
|
|
209
|
+
) AS closures
|
|
210
|
+
GROUP BY owner
|
|
211
|
+
) AS closures
|
|
212
|
+
|
|
213
|
+
-- user data from session_attribute
|
|
214
|
+
LEFT JOIN (
|
|
215
|
+
SELECT
|
|
216
|
+
sid,
|
|
217
|
+
MAX(CASE WHEN name = 'name' THEN value END) AS username,
|
|
218
|
+
MAX(CASE WHEN name = 'email' THEN value END) AS email,
|
|
219
|
+
MAX(CASE WHEN name = 'rewards.wallet' THEN value END) AS wallet,
|
|
220
|
+
MAX(CASE WHEN name = 'rewards.network' THEN value END) AS network,
|
|
221
|
+
MAX(CASE WHEN name = 'rewards.currency' THEN value END) AS currency,
|
|
222
|
+
MAX(CASE WHEN name = 'rewards.enabled' THEN value END) AS enabled
|
|
223
|
+
FROM session_attribute
|
|
224
|
+
GROUP BY sid
|
|
225
|
+
) AS users ON users.sid = closures.owner
|
|
226
|
+
|
|
227
|
+
ORDER BY owner;
|
|
228
|
+
"""
|
|
229
|
+
),
|
|
230
|
+
},
|
|
231
|
+
"stats": {
|
|
232
|
+
"param": [],
|
|
233
|
+
"query": (
|
|
234
|
+
"""
|
|
235
|
+
SELECT
|
|
236
|
+
COUNT(id) as tickets,
|
|
237
|
+
SUM(r.value) as rewards,
|
|
238
|
+
(
|
|
239
|
+
SELECT COUNT(id)
|
|
240
|
+
FROM """
|
|
241
|
+
+ PAYOUT_TABLE
|
|
242
|
+
+ """
|
|
243
|
+
) AS payments,
|
|
244
|
+
(
|
|
245
|
+
SELECT COALESCE(SUM(amount), 0)
|
|
246
|
+
FROM """
|
|
247
|
+
+ PAYOUT_TABLE
|
|
248
|
+
+ """
|
|
249
|
+
) AS payouts
|
|
250
|
+
|
|
251
|
+
FROM ticket t
|
|
252
|
+
JOIN ticket_custom r
|
|
253
|
+
ON r.ticket = t.id AND r.name = 'reward'
|
|
254
|
+
|
|
255
|
+
WHERE t.status = 'closed'
|
|
256
|
+
AND t.resolution = 'implemented';
|
|
257
|
+
"""
|
|
258
|
+
),
|
|
259
|
+
},
|
|
260
|
+
"payment": {
|
|
261
|
+
"param": [
|
|
262
|
+
"timestamp : transaction timestamp",
|
|
263
|
+
"user : user login id",
|
|
264
|
+
"wallet : crypto wallet address",
|
|
265
|
+
"network : payment network used",
|
|
266
|
+
"currency : crypto currency used (ZCHF, etc.)",
|
|
267
|
+
"amount : coin amount for this payment",
|
|
268
|
+
"reference : payment reference text (conf number)",
|
|
269
|
+
],
|
|
270
|
+
"insert": ("INSERT INTO " + PAYOUT_TABLE + """
|
|
271
|
+
(timestamp, user, wallet, network, currency, amount, reference)
|
|
272
|
+
VALUES
|
|
273
|
+
(%s, %s, %s, %s, %s, %s, %s)
|
|
274
|
+
"""),
|
|
275
|
+
"by_user": ("SELECT * FROM " + PAYOUT_TABLE + """
|
|
276
|
+
WHERE user = %s ORDER BY timestamp
|
|
277
|
+
"""),
|
|
278
|
+
"query": ("SELECT * FROM " + PAYOUT_TABLE + """
|
|
279
|
+
ORDER BY timestamp
|
|
280
|
+
"""),
|
|
281
|
+
"delete": ("DELETE FROM " + PAYOUT_TABLE + """
|
|
282
|
+
WHERE id IN (%s)
|
|
283
|
+
"""),
|
|
284
|
+
},
|
|
285
|
+
}
|