tx · 4azDtZGzz29TmKxoHG6P9q3Y8s8EBe7etozL8iwaXD2a 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu: -0.01400000 Waves 2020.08.27 10:38 [1150817] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves
{ "type": 13, "id": "4azDtZGzz29TmKxoHG6P9q3Y8s8EBe7etozL8iwaXD2a", "fee": 1400000, "feeAssetId": null, "timestamp": 1598513904372, "version": 1, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "2fKpz1aw5MhfR68rmT7gBCT1VXuYgMJedi9ZLfxbSXGRKUJJoSk2T8QauiCqeigfHD8VeE4j5nd6WAW5r6SUYNWN" ], "script": "base64:AAIDAAAAAAAAABsIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgAAAAJAAAAAAZ1cFZvdGUCAAAABnVwdm90ZQAAAAAIZG93blZvdGUCAAAACGRvd252b3RlAAAAAAxhZG1pbkFkZHJlc3MBAAAAGgFUMKrzx6zWhD7gnlA6G49B3zJOXSnbMw+gAQAAAA1nZXRQcm9maWxlS2V5AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAUX2VudHJlcHJlbmV1clByb2ZpbGUBAAAADGdldFN0YXR1c0tleQAAAAEAAAACaWQJAAEsAAAAAgUAAAACaWQCAAAAB19zdGF0dXMBAAAACmdldFZvdGVLZXkAAAACAAAAAmlkAAAABHR5cGUDCQAAAAAAAAIFAAAABHR5cGUCAAAABnVwdm90ZQkAASwAAAACBQAAAAJpZAIAAAAHX3Vwdm90ZQMJAAAAAAAAAgUAAAAEdHlwZQIAAAAIZG93bnZvdGUJAAEsAAAAAgUAAAACaWQCAAAACV9kb3dudm90ZQkAAAIAAAABAgAAABFJbnZhbGlkIHZvdGUgdHlwZQEAAAAMcHJvZmlsZUV4aXN0AAAAAQAAAAJpZAQA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HZhbHVlCQAAAgAAAAECAAAAI1RoaXMgcHJvZmlsZSBpcyBub3Qgb3BlbiBmb3Igdm90aW5nCQAAAgAAAAECAAAAD0ludmFsaWQgUHJvZmlsZQAAAAFpAQAAAAhvcGVuVm90ZQAAAAEAAAAGdm90ZUlkAwkBAAAAAiE9AAAAAggIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwUAAAAMYWRtaW5BZGRyZXNzCQAAAgAAAAECAAAALk9ubHkgRHl6cnVwdCBBZG1pbiBjYW4gY2FsbCB0aGlzIGRBcHAgZnVuY3Rpb24DCQEAAAAMcHJvZmlsZUV4aXN0AAAAAQUAAAAGdm90ZUlkCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAMZ2V0U3RhdHVzS2V5AAAAAQUAAAAGdm90ZUlkAgAAAARvcGVuBQAAAANuaWwJAAACAAAAAQIAAAAKSW52YWxpZCBJRAAAAAFpAQAAAAljbG9zZVZvdGUAAAABAAAABnZvdGVJZAMJAQAAAAIhPQAAAAIICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMFAAAADGFkbWluQWRkcmVzcwkAAAIAAAABAgAAAC5Pbmx5IER5enJ1cHQgQWRtaW4gY2FuIGNhbGwgdGhpcyBkQXBwIGZ1bmN0aW9uAwkBAAAADHByb2ZpbGVFeGlzdAAAAAEFAAAABnZvdGVJZAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAADGdldFN0YXR1c0tleQAAAAEFAAAABnZvdGVJZAIAAAAGY2xvc2VkBQAAAANuaWwJAAACAAAAAQIAAAAKSW52YWxpZCBJRAAAAACscUlE", "chainId": 84, "height": 1150817, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3f3qd5Nr5cRxHtFJpWkZ9Bsy9Xxi6D8bdM7qvbWtZ3dN Next: 4m7YTvePdAzignJRoWbXYNKoukdLpP5znYQdjjDXgJDc Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | let upVote = "upvote" | |
5 | 5 | ||
6 | 6 | let downVote = "downvote" | |
7 | + | ||
8 | + | let adminAddress = base58'3MtMR16kp56cr9Hfb2dVBAM5PtuhJDCK5fu' | |
7 | 9 | ||
8 | 10 | func getProfileKey (id) = (id + "_entrepreneurProfile") | |
9 | 11 | ||
43 | 45 | ||
44 | 46 | ||
45 | 47 | @Callable(i) | |
46 | - | func addEntrepreneurProfile (name,avatar,bio,gender,location) = { | |
47 | - | let transactionId = toBase58String(i.transactionId) | |
48 | - | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open"), DataEntry(getVoteKey(transactionId, "downvote"), 0)]) | |
49 | - | } | |
48 | + | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress)) | |
49 | + | then throw("Only Dyzrupt Admin can call this dApp function") | |
50 | + | else { | |
51 | + | let transactionId = toBase58String(i.transactionId) | |
52 | + | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open"), DataEntry(getVoteKey(transactionId, "downvote"), 0)]) | |
53 | + | } | |
50 | 54 | ||
51 | 55 | ||
52 | 56 | ||
68 | 72 | ||
69 | 73 | ||
70 | 74 | @Callable(i) | |
71 | - | func openVote (voteId) = if (profileExist(voteId)) | |
72 | - | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
73 | - | else throw("Invalid ID") | |
75 | + | func openVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
76 | + | then throw("Only Dyzrupt Admin can call this dApp function") | |
77 | + | else if (profileExist(voteId)) | |
78 | + | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
79 | + | else throw("Invalid ID") | |
74 | 80 | ||
75 | 81 | ||
76 | 82 | ||
77 | 83 | @Callable(i) | |
78 | - | func closeVote (voteId) = if (profileExist(voteId)) | |
79 | - | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) | |
80 | - | else throw("Invalid ID") | |
84 | + | func closeVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
85 | + | then throw("Only Dyzrupt Admin can call this dApp function") | |
86 | + | else if (profileExist(voteId)) | |
87 | + | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) | |
88 | + | else throw("Invalid ID") | |
81 | 89 | ||
82 | 90 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let upVote = "upvote" | |
5 | 5 | ||
6 | 6 | let downVote = "downvote" | |
7 | + | ||
8 | + | let adminAddress = base58'3MtMR16kp56cr9Hfb2dVBAM5PtuhJDCK5fu' | |
7 | 9 | ||
8 | 10 | func getProfileKey (id) = (id + "_entrepreneurProfile") | |
9 | 11 | ||
10 | 12 | ||
11 | 13 | func getStatusKey (id) = (id + "_status") | |
12 | 14 | ||
13 | 15 | ||
14 | 16 | func getVoteKey (id,type) = if ((type == "upvote")) | |
15 | 17 | then (id + "_upvote") | |
16 | 18 | else if ((type == "downvote")) | |
17 | 19 | then (id + "_downvote") | |
18 | 20 | else throw("Invalid vote type") | |
19 | 21 | ||
20 | 22 | ||
21 | 23 | func profileExist (id) = match getString(this, getProfileKey(id)) { | |
22 | 24 | case a: String => | |
23 | 25 | true | |
24 | 26 | case _ => | |
25 | 27 | false | |
26 | 28 | } | |
27 | 29 | ||
28 | 30 | ||
29 | 31 | func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) { | |
30 | 32 | case a: String => | |
31 | 33 | a | |
32 | 34 | case _ => | |
33 | 35 | false | |
34 | 36 | } | |
35 | 37 | ||
36 | 38 | ||
37 | 39 | func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) { | |
38 | 40 | case a: Int => | |
39 | 41 | a | |
40 | 42 | case _ => | |
41 | 43 | throw("Not a valid vote ID") | |
42 | 44 | } | |
43 | 45 | ||
44 | 46 | ||
45 | 47 | @Callable(i) | |
46 | - | func addEntrepreneurProfile (name,avatar,bio,gender,location) = { | |
47 | - | let transactionId = toBase58String(i.transactionId) | |
48 | - | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open"), DataEntry(getVoteKey(transactionId, "downvote"), 0)]) | |
49 | - | } | |
48 | + | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress)) | |
49 | + | then throw("Only Dyzrupt Admin can call this dApp function") | |
50 | + | else { | |
51 | + | let transactionId = toBase58String(i.transactionId) | |
52 | + | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open"), DataEntry(getVoteKey(transactionId, "downvote"), 0)]) | |
53 | + | } | |
50 | 54 | ||
51 | 55 | ||
52 | 56 | ||
53 | 57 | @Callable(i) | |
54 | 58 | func vote (voteId,vote) = if (profileExist(voteId)) | |
55 | 59 | then if ((getVoteStatus(voteId) == "open")) | |
56 | 60 | then if (if ((vote == upVote)) | |
57 | 61 | then true | |
58 | 62 | else (vote == downVote)) | |
59 | 63 | then { | |
60 | 64 | let voteCount = getVoteCount(voteId, vote) | |
61 | 65 | let newVoteCount = (voteCount + 1) | |
62 | 66 | WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount)]) | |
63 | 67 | } | |
64 | 68 | else throw("Not a valid vote value") | |
65 | 69 | else throw("This profile is not open for voting") | |
66 | 70 | else throw("Invalid Profile") | |
67 | 71 | ||
68 | 72 | ||
69 | 73 | ||
70 | 74 | @Callable(i) | |
71 | - | func openVote (voteId) = if (profileExist(voteId)) | |
72 | - | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
73 | - | else throw("Invalid ID") | |
75 | + | func openVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
76 | + | then throw("Only Dyzrupt Admin can call this dApp function") | |
77 | + | else if (profileExist(voteId)) | |
78 | + | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
79 | + | else throw("Invalid ID") | |
74 | 80 | ||
75 | 81 | ||
76 | 82 | ||
77 | 83 | @Callable(i) | |
78 | - | func closeVote (voteId) = if (profileExist(voteId)) | |
79 | - | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) | |
80 | - | else throw("Invalid ID") | |
84 | + | func closeVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
85 | + | then throw("Only Dyzrupt Admin can call this dApp function") | |
86 | + | else if (profileExist(voteId)) | |
87 | + | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) | |
88 | + | else throw("Invalid ID") | |
81 | 89 | ||
82 | 90 |
github/deemru/w8io/169f3d6 29.04 ms ◑