tx · 9J18TPbv3kKpLB24i2L9cnwzkd8GUvxLCuvVQHNc5aFH 3NB1cgveY8ad3Q3YPBb8W5P1wxXf4PBdv8E: -0.01400000 Waves 2019.09.13 12:26 [674224] smart account 3NB1cgveY8ad3Q3YPBb8W5P1wxXf4PBdv8E > SELF 0.00000000 Waves
{ "type": 13, "id": "9J18TPbv3kKpLB24i2L9cnwzkd8GUvxLCuvVQHNc5aFH", "fee": 1400000, "feeAssetId": null, "timestamp": 1568366742115, "version": 1, "sender": "3NB1cgveY8ad3Q3YPBb8W5P1wxXf4PBdv8E", "senderPublicKey": "G1dpAxHK3DuPvcCbAz7eTxXXmRmqqZL1JyDUbeBQTfpA", "proofs": [ "2vWbs4NmFvhX51djAT6fD4Jdeb1ka9FLJRH3Cvpfbz6AYGJuR4abu1MNswsKR45cKbPnpmPgnm33dA5epZyymyk8" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAIAAAAAAdtaW5Wb3RlAAAAAAAAAAABAAAAAAdtYXhWb3RlAAAAAAAAAAAKAAAAABJzdG9wQmxvY2tUaW1lc3RhbXAAAAABbEqUuEoAAAAADnZvdGVyS2V5UHJlZml4AgAAAAZ2b3Rlcl8AAAAAD3N1Ym1pdEtleVByZWZpeAIAAAAHc3VibWl0XwEAAAALZ2V0Vm90ZXJLZXkAAAABAAAADHZvdGVyQWRkcmVzcwkAASwAAAACBQAAAA52b3RlcktleVByZWZpeAkAAlgAAAABBQAAAAx2b3RlckFkZHJlc3MBAAAADGdldFN1Ym1pdEtleQAAAAEAAAANY2FsbGVyQWRkcmVzcwkAASwAAAACBQAAAA9zdWJtaXRLZXlQcmVmaXgJAAJYAAAAAQUAAAANY2FsbGVyQWRkcmVzcwEAAAAUdm90ZXJJc0FsbG93ZWRUb1ZvdGUAAAABAAAADHZvdGVyQWRkcmVzcwQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAR0aGlzCQEAAAALZ2V0Vm90ZXJLZXkAAAABBQAAAAx2b3RlckFk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G9mIHJhbmdlCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAMZ2V0U3VibWl0S2V5AAAAAQgIBQAAAANjdHgAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAAd0aGVWb3RlBQAAAANuaWwAAAABAAAAAXQBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAXQDAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgYJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFzBQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAFzAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAABcwAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAFzAAAAD3NlbmRlclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAAAAAWkFAAAAByRtYXRjaDAGCQAAAgAAAAECAAAAJlRoaXMgdHlwZSBvZiB0cmFuc2FjdGlvbiBpcyBwcm9oaWJpdGVkFvEsMw==", "chainId": 84, "height": 674224, "spentComplexity": 0 } View: original | compacted Prev: 3P934np4V5zt8A7xYhGRfvkgtsUpu54kNmA8R4gcimLQ Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let minVote = 1 | |
5 | 5 | ||
6 | 6 | let maxVote = 10 | |
7 | 7 | ||
8 | 8 | let stopBlockTimestamp = 1564619356234 | |
9 | 9 | ||
10 | 10 | let voterKeyPrefix = "voter_" | |
11 | 11 | ||
12 | 12 | let submitKeyPrefix = "submit_" | |
13 | 13 | ||
14 | 14 | func getVoterKey (voterAddress) = (voterKeyPrefix + toBase58String(voterAddress)) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func getSubmitKey (callerAddress) = (submitKeyPrefix + toBase58String(callerAddress)) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func voterIsAllowedToVote (voterAddress) = match getBoolean(this, getVoterKey(voterAddress)) { | |
21 | 21 | case b: Boolean => | |
22 | 22 | b | |
23 | 23 | case _ => | |
24 | 24 | false | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | @Callable(ctx) | |
29 | 29 | func addVoter () = WriteSet([DataEntry(getVoterKey(ctx.caller.bytes), true)]) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(ctx) | |
34 | 34 | func vote (theVote) = if ((lastBlock.timestamp >= stopBlockTimestamp)) | |
35 | 35 | then throw("Voting is over, since the stop block timestamp is reached") | |
36 | 36 | else if ((voterIsAllowedToVote(ctx.caller.bytes) == false)) | |
37 | 37 | then throw("You are not allowed to vote, since your address is not present in our list of voters.") | |
38 | 38 | else { | |
39 | 39 | let dataFromStorage = getInteger(this, toBase58String(ctx.callerPublicKey)) | |
40 | 40 | if (isDefined(dataFromStorage)) | |
41 | 41 | then throw("You have already voted! Duplicate votes are prohibited.") | |
42 | 42 | else if (if ((minVote > theVote)) | |
43 | 43 | then true | |
44 | 44 | else (theVote > maxVote)) | |
45 | 45 | then throw("Vote is out of range") | |
46 | 46 | else WriteSet([DataEntry(getSubmitKey(ctx.caller.bytes), theVote)]) | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | @Verifier(t) | |
51 | 51 | func verify () = match t { | |
52 | 52 | case s: SetScriptTransaction|DataTransaction => | |
53 | 53 | sigVerify(s.bodyBytes, s.proofs[0], s.senderPublicKey) | |
54 | 54 | case i: InvokeScriptTransaction => | |
55 | 55 | true | |
56 | 56 | case _ => | |
57 | 57 | throw("This type of transaction is prohibited") | |
58 | 58 | } | |
59 | 59 |
github/deemru/w8io/026f985 48.47 ms ◑