tx · 3f3qd5Nr5cRxHtFJpWkZ9Bsy9Xxi6D8bdM7qvbWtZ3dN 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu: -0.01400000 Waves 2020.08.27 10:27 [1150807] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves
{ "type": 13, "id": "3f3qd5Nr5cRxHtFJpWkZ9Bsy9Xxi6D8bdM7qvbWtZ3dN", "fee": 1400000, "feeAssetId": null, "timestamp": 1598513248665, "version": 1, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "2j5FTZRWFVPmHAPELbgkJH2sCXk2ZbvxGPayqU6FSYvQffDsHMQSeoRjy7ZXJML2prUYB7wRTwD6fsGBKZRH8dV3" ], "script": "base64:AAIDAAAAAAAAABsIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgAAAAIAAAAAAZ1cFZvdGUCAAAABnVwdm90ZQAAAAAIZG93blZvdGUCAAAACGRvd252b3RlAQAAAA1nZXRQcm9maWxlS2V5AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAUX2VudHJlcHJlbmV1clByb2ZpbGUBAAAADGdldFN0YXR1c0tleQAAAAEAAAACaWQJAAEsAAAAAgUAAAACaWQCAAAAB19zdGF0dXMBAAAACmdldFZvdGVLZXkAAAACAAAAAmlkAAAABHR5cGUDCQAAAAAAAAIFAAAABHR5cGUCAAAABnVwdm90ZQkAASwAAAACBQAAAAJpZAIAAAAHX3Vwdm90ZQMJAAAAAAAAAgUAAAAEdHlwZQIAAAAIZG93bnZvdGUJAAEsAAAAAgUAAAACaWQCAAAACV9kb3dudm90ZQkAAAIAAAABAgAAABFJbnZhbGlkIHZvdGUgdHlwZQEAAAAMcHJvZmlsZUV4aXN0AAAAAQAAAAJpZAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzCQEAAAANZ2V0U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AQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAAxnZXRTdGF0dXNLZXkAAAABBQAAAAZ2b3RlSWQCAAAABG9wZW4FAAAAA25pbAkAAAIAAAABAgAAAApJbnZhbGlkIElEAAAAAWkBAAAACWNsb3NlVm90ZQAAAAEAAAAGdm90ZUlkAwkBAAAADHByb2ZpbGVFeGlzdAAAAAEFAAAABnZvdGVJZAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAADGdldFN0YXR1c0tleQAAAAEFAAAABnZvdGVJZAIAAAAGY2xvc2VkBQAAAANuaWwJAAACAAAAAQIAAAAKSW52YWxpZCBJRAAAAAAlRQ/N", "chainId": 84, "height": 1150807, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 4azDtZGzz29TmKxoHG6P9q3Y8s8EBe7etozL8iwaXD2a Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let upVote = "upvote" | |
5 | + | ||
6 | + | let downVote = "downvote" | |
7 | + | ||
8 | + | func getProfileKey (id) = (id + "_entrepreneurProfile") | |
9 | + | ||
10 | + | ||
11 | + | func getStatusKey (id) = (id + "_status") | |
12 | + | ||
13 | + | ||
14 | + | func getVoteKey (id,type) = if ((type == "upvote")) | |
15 | + | then (id + "_upvote") | |
16 | + | else if ((type == "downvote")) | |
17 | + | then (id + "_downvote") | |
18 | + | else throw("Invalid vote type") | |
19 | + | ||
20 | + | ||
21 | + | func profileExist (id) = match getString(this, getProfileKey(id)) { | |
22 | + | case a: String => | |
23 | + | true | |
24 | + | case _ => | |
25 | + | false | |
26 | + | } | |
27 | + | ||
28 | + | ||
29 | + | func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) { | |
30 | + | case a: String => | |
31 | + | a | |
32 | + | case _ => | |
33 | + | false | |
34 | + | } | |
35 | + | ||
36 | + | ||
37 | + | func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) { | |
38 | + | case a: Int => | |
39 | + | a | |
40 | + | case _ => | |
41 | + | throw("Not a valid vote ID") | |
42 | + | } | |
43 | + | ||
44 | + | ||
45 | + | @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 | + | } | |
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | @Callable(i) | |
54 | + | func vote (voteId,vote) = if (profileExist(voteId)) | |
55 | + | then if ((getVoteStatus(voteId) == "open")) | |
56 | + | then if (if ((vote == upVote)) | |
57 | + | then true | |
58 | + | else (vote == downVote)) | |
59 | + | then { | |
60 | + | let voteCount = getVoteCount(voteId, vote) | |
61 | + | let newVoteCount = (voteCount + 1) | |
62 | + | WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount)]) | |
63 | + | } | |
64 | + | else throw("Not a valid vote value") | |
65 | + | else throw("This profile is not open for voting") | |
66 | + | else throw("Invalid Profile") | |
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | @Callable(i) | |
71 | + | func openVote (voteId) = if (profileExist(voteId)) | |
72 | + | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
73 | + | else throw("Invalid ID") | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(i) | |
78 | + | func closeVote (voteId) = if (profileExist(voteId)) | |
79 | + | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) | |
80 | + | else throw("Invalid ID") | |
81 | + | ||
82 | + |
github/deemru/w8io/026f985 32.13 ms ◑