tx · Hn4ct6ft3JtikTH573GJNcgPtwjzNr4cux66mMVvhsom 3NBTfJX2TCCN9os2B4JXDmxsXxLfCunkeJ7: -0.01000000 Waves 2019.07.03 18:21 [569408] smart account 3NBTfJX2TCCN9os2B4JXDmxsXxLfCunkeJ7 > SELF 0.00000000 Waves
{ "type": 13, "id": "Hn4ct6ft3JtikTH573GJNcgPtwjzNr4cux66mMVvhsom", "fee": 1000000, "feeAssetId": null, "timestamp": 1562167299891, "version": 1, "sender": "3NBTfJX2TCCN9os2B4JXDmxsXxLfCunkeJ7", "senderPublicKey": "5ttyBBtcmv9J4Xzt6xFNZw6KHkDV8E67uQMampRBJTUw", "proofs": [ "4kcswmSYoLgfpTnhmSsjYCY4gCpkXKFmxJwL93HKswwT9BBRHCYPKo8AUKzGhEV3d2nmqW3LwwED3GBMaPyYkH5z" ], "script": "base64:AAIDAAAAAAAAAAAAAAAhAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQUAAAADc3Ry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408, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let NONE = "none" | |
5 | + | ||
6 | + | let VOTERS = 3 | |
7 | + | ||
8 | + | let QUORUM = 2 | |
9 | + | ||
10 | + | let VOTING = "voting" | |
11 | + | ||
12 | + | let REVEAL = "reveal" | |
13 | + | ||
14 | + | let FEATURED = "featured" | |
15 | + | ||
16 | + | let DELISTED = "delisted" | |
17 | + | ||
18 | + | func getNumberByKey (key) = { | |
19 | + | let num = match getInteger(this, key) { | |
20 | + | case a: Int => | |
21 | + | a | |
22 | + | case _ => | |
23 | + | 0 | |
24 | + | } | |
25 | + | num | |
26 | + | } | |
27 | + | ||
28 | + | ||
29 | + | func getStrByKey (key) = { | |
30 | + | let str = match getString(this, key) { | |
31 | + | case a: String => | |
32 | + | a | |
33 | + | case _ => | |
34 | + | NONE | |
35 | + | } | |
36 | + | str | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | func getKeyItemPrice (item) = (item + "_price") | |
41 | + | ||
42 | + | ||
43 | + | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
44 | + | ||
45 | + | ||
46 | + | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
47 | + | ||
48 | + | ||
49 | + | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
50 | + | ||
51 | + | ||
52 | + | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
53 | + | ||
54 | + | ||
55 | + | func getKeyItemData (item) = (item + "_data") | |
56 | + | ||
57 | + | ||
58 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
59 | + | ||
60 | + | ||
61 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
62 | + | ||
63 | + | ||
64 | + | func getKeyBalanceSupplier (account) = (account + "_balanace") | |
65 | + | ||
66 | + | ||
67 | + | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
68 | + | ||
69 | + | ||
70 | + | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
71 | + | ||
72 | + | ||
73 | + | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
74 | + | ||
75 | + | ||
76 | + | func getKeyCommitsCount (item) = (item + "_comcnt") | |
77 | + | ||
78 | + | ||
79 | + | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
80 | + | ||
81 | + | ||
82 | + | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
83 | + | ||
84 | + | ||
85 | + | func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
86 | + | ||
87 | + | ||
88 | + | func getKeyItemStatus (item) = (item + "_status") | |
89 | + | ||
90 | + | ||
91 | + | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
92 | + | ||
93 | + | ||
94 | + | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
95 | + | ||
96 | + | ||
97 | + | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
98 | + | ||
99 | + | ||
100 | + | func getExtAddressOracle () = extract(addressFromString("3MvxG7PEiAW4NfKByTSAXnDnawTVZ2A6433")) | |
101 | + | ||
102 | + | ||
103 | + | let BLACKLISTED = "blacklist" | |
104 | + | ||
105 | + | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") | |
106 | + | ||
107 | + | ||
108 | + | func getExtValueItemWhiteListStatus (oracle,account) = { | |
109 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { | |
110 | + | case a: String => | |
111 | + | a | |
112 | + | case _ => | |
113 | + | NONE | |
114 | + | } | |
115 | + | str | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | @Callable(i) | |
120 | + | func addItem (title,price,data) = { | |
121 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
122 | + | let item = getKeyItem(supplierAddress, title) | |
123 | + | let supplierwhitelist = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
124 | + | if ((0 >= price)) | |
125 | + | then throw("purchase ammount cannnot be less than item price") | |
126 | + | else if ((getValueItemSupplier(item) != NONE)) | |
127 | + | then throw("an item is already exist") | |
128 | + | else if ((supplierwhitelist == BLACKLISTED)) | |
129 | + | then throw("supplier's account has been blacklisted") | |
130 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierwhitelist)]) | |
131 | + | } | |
132 | + | ||
133 | + |
github/deemru/w8io/026f985 15.05 ms ◑