tx · 7Up1dH9x5tSpT7seE1tGUB2QV9Ggd7CaXKFRDrxhUo1M 3MwLNbzF4w298YSpa1CrASmgZQs4H7QnUKJ: -0.04000000 Waves 2019.07.24 16:48 [600195] smart account 3MwLNbzF4w298YSpa1CrASmgZQs4H7QnUKJ > SELF 0.00000000 Waves
{ "type": 13, "id": "7Up1dH9x5tSpT7seE1tGUB2QV9Ggd7CaXKFRDrxhUo1M", "fee": 4000000, "feeAssetId": null, "timestamp": 1563976119646, "version": 1, "sender": "3MwLNbzF4w298YSpa1CrASmgZQs4H7QnUKJ", "senderPublicKey": "A2cDxBUnFcmQWri8JQ7Kpa7MNbLnBv1Q9P6vmo9Moj6C", "proofs": [ "3HU1jG9AAjSBZ7rWyrEgPAyYadghtFqsnbZeekejHA5cUaTb3mN6bQSzyw18zJSMqyGmZSjvwwt46nt1XA8dNy7V" ], "script": "base64:AAIDAAAAAAAAAAAAAAAUAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9OR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UAAAAEdXNlcgUAAAAEaGFzaAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEmdldEtleUNvbW1pdHNDb3VudAAAAAEFAAAABGl0ZW0JAABkAAAAAgUAAAAHY29tbWl0cwAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEGdldEtleUl0ZW1TdGF0dXMAAAABBQAAAARpdGVtAwkAAAAAAAACBQAAAAdjb21taXRzBQAAAAZWT1RFUlMFAAAABlJFVkVBTAUAAAAGVk9USU5HBQAAAANuaWwAAAAAqS9DRw==", "chainId": 84, "height": 600195, "spentComplexity": 0 } View: original | compacted Prev: DkucYCo4DTSAgyCVSt89LcSrFC49kJfU3Y64dmqHb8Ae Next: ESF3T3qvTNZispPzjk3XFo3nz66p7nzpqLQc5FQ6WiAa Diff:
Old | New | Differences | |
---|---|---|---|
61 | 61 | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
62 | 62 | ||
63 | 63 | ||
64 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
65 | + | ||
66 | + | ||
64 | 67 | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
65 | 68 | ||
66 | 69 | ||
76 | 79 | then throw("reached max num of voters") | |
77 | 80 | else if ((getValueCommit(item, user) != NONE)) | |
78 | 81 | then throw("user has already participated") | |
79 | - | else if (if ((status != NONE)) | |
80 | - | then (status != VOTING) | |
81 | - | else false) | |
82 | - | then throw("voting is not possible") | |
83 | - | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
84 | - | then REVEAL | |
85 | - | else VOTING)]) | |
82 | + | else if ((getKeyItemSupplier(item) == NONE)) | |
83 | + | then throw("item does not exist") | |
84 | + | else if (if ((status != NONE)) | |
85 | + | then (status != VOTING) | |
86 | + | else false) | |
87 | + | then throw("voting is not possible") | |
88 | + | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
89 | + | then REVEAL | |
90 | + | else VOTING)]) | |
86 | 91 | } | |
87 | 92 | ||
88 | 93 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let NONE = "none" | |
5 | 5 | ||
6 | 6 | let VOTERS = 3 | |
7 | 7 | ||
8 | 8 | let QUORUM = 2 | |
9 | 9 | ||
10 | 10 | let VOTING = "voting" | |
11 | 11 | ||
12 | 12 | let REVEAL = "reveal" | |
13 | 13 | ||
14 | 14 | let FEATURED = "featured" | |
15 | 15 | ||
16 | 16 | let DELISTED = "delisted" | |
17 | 17 | ||
18 | 18 | func getNumberByKey (key) = { | |
19 | 19 | let num = match getInteger(this, key) { | |
20 | 20 | case a: Int => | |
21 | 21 | a | |
22 | 22 | case _ => | |
23 | 23 | 0 | |
24 | 24 | } | |
25 | 25 | num | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func getStrByKey (key) = { | |
30 | 30 | let str = match getString(this, key) { | |
31 | 31 | case a: String => | |
32 | 32 | a | |
33 | 33 | case _ => | |
34 | 34 | NONE | |
35 | 35 | } | |
36 | 36 | str | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getKeyCommitsCount (item) = (item + "_comcnt") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getVAlueRveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func getKeyItemStatus (item) = (item + "_status") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
62 | 62 | ||
63 | 63 | ||
64 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
65 | + | ||
66 | + | ||
64 | 67 | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
65 | 68 | ||
66 | 69 | ||
67 | 70 | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
68 | 71 | ||
69 | 72 | ||
70 | 73 | @Callable(i) | |
71 | 74 | func voteCommit (item,hash) = { | |
72 | 75 | let user = toBase58String(i.caller.bytes) | |
73 | 76 | let commits = getValueCommitsCount(item) | |
74 | 77 | let status = getValueItemStatus(item) | |
75 | 78 | if ((commits >= VOTERS)) | |
76 | 79 | then throw("reached max num of voters") | |
77 | 80 | else if ((getValueCommit(item, user) != NONE)) | |
78 | 81 | then throw("user has already participated") | |
79 | - | else if (if ((status != NONE)) | |
80 | - | then (status != VOTING) | |
81 | - | else false) | |
82 | - | then throw("voting is not possible") | |
83 | - | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
84 | - | then REVEAL | |
85 | - | else VOTING)]) | |
82 | + | else if ((getKeyItemSupplier(item) == NONE)) | |
83 | + | then throw("item does not exist") | |
84 | + | else if (if ((status != NONE)) | |
85 | + | then (status != VOTING) | |
86 | + | else false) | |
87 | + | then throw("voting is not possible") | |
88 | + | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
89 | + | then REVEAL | |
90 | + | else VOTING)]) | |
86 | 91 | } | |
87 | 92 | ||
88 | 93 |
github/deemru/w8io/169f3d6 37.36 ms ◑