-
Notifications
You must be signed in to change notification settings - Fork 5
/
change_mpa.py
75 lines (69 loc) · 2.59 KB
/
change_mpa.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
73
74
75
from grapheneapi.grapheneapi import GrapheneAPI
import json
perm = {}
perm["charge_market_fee"] = 0x01
perm["white_list"] = 0x02
perm["override_authority"] = 0x04
perm["transfer_restricted"] = 0x08
perm["disable_force_settle"] = 0x10
perm["global_settle"] = 0x20
perm["disable_confidential"] = 0x40
perm["witness_fed_asset"] = 0x80
perm["committee_fed_asset"] = 0x100
GRAPHENE_100_PERCENT = 10000
GRAPHENE_1_PERCENT = GRAPHENE_100_PERCENT / 100
if __name__ == '__main__':
rpc = GrapheneAPI("localhost", 8092)
issuer = "faucet"
symbol = "PEG.LAST" # LAST, RANDOM, PARITY
backing = "1.3.0"
account = rpc.get_account(issuer)
asset = rpc.get_asset(symbol)
permissions = {"charge_market_fee" : True,
"white_list" : True,
"override_authority" : True,
"transfer_restricted" : True,
"disable_force_settle" : True,
"global_settle" : True,
"disable_confidential" : True,
"witness_fed_asset" : True,
"committee_fed_asset" : True,
}
flags = {"charge_market_fee" : False,
"white_list" : False,
"override_authority" : False,
"transfer_restricted" : False,
"disable_force_settle" : False,
"global_settle" : False,
"disable_confidential" : False,
"witness_fed_asset" : True,
"committee_fed_asset" : False,
}
permissions_int = 0
for p in permissions :
if permissions[p]:
permissions_int += perm[p]
flags_int = 0
for p in permissions :
if flags[p]:
flags_int += perm[p]
options = {"max_supply" : 1000000000000000,
"market_fee_percent" : 0,
"max_market_fee" : 1000000000000000,
"issuer_permissions" : permissions_int,
"flags" : flags_int,
"core_exchange_rate" : {
"base": {
"amount": 10,
"asset_id": "1.3.0"},
"quote": {
"amount": 10,
"asset_id": asset["id"]}},
"whitelist_authorities" : [],
"blacklist_authorities" : [],
"whitelist_markets" : [],
"blacklist_markets" : [],
"description" : "Feed: Last Trade Price - every 15 minutes"
}
tx = rpc.update_asset(symbol, None, options, True)
print(json.dumps(tx, indent=4))