-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.py
57 lines (52 loc) · 1.51 KB
/
compile.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
import smartpy as sp
import json
import os
from datetime import datetime, timezone
env = os.environ
def UTCTimestamp(datestring):
dt = datetime.strptime(datestring, '%Y-%m-%dT%H:%M:%S')
dt_utc = dt.replace(tzinfo=timezone.utc)
return int(dt_utc.timestamp())
cwd = os.getcwd()
Store = sp.io.import_script_from_url("file://%s/contracts/store.py" % cwd)
Controller = sp.io.import_script_from_url("file://%s/contracts/controller.py" % cwd)
admin = sp.address(env['TEZID_ADMIN'])
store = sp.address(env['TEZID_STORE'])
TezIDStoreMetadata = {
"name": "TezID Store",
"description": "Datastore for TezID",
"version": "2.0.0",
"homepage": "https://tezid.net",
"authors": ["asbjornenge <[email protected]>"],
"interfaces": ["TZIP-016"]
}
TezIDControllerMetadata = {
"name": "TezID Controller",
"description": "Controller for TezID",
"version": "4.1.0",
"homepage": "https://tezid.net",
"authors": ["asbjornenge <[email protected]>"],
"interfaces": ["TZIP-016"]
}
sp.add_compilation_target("store", Store.TezIDStore(
sp.set([admin]),
sp.big_map(),
sp.big_map(
{
"": sp.utils.bytes_of_string("tezos-storage:content"),
"content": sp.utils.bytes_of_string(json.dumps(TezIDStoreMetadata))
}
)
)
)
sp.add_compilation_target("controller", Controller.TezIDController(
admin,
store,
sp.big_map(
{
"": sp.utils.bytes_of_string("tezos-storage:content"),
"content": sp.utils.bytes_of_string(json.dumps(TezIDControllerMetadata))
}
)
)
)