tx · 7RpEAVgFHpSemz71HszHTXch7FU14LeVqt91RGy675zU

3Mrr9J7M21Kjz3AC4ryFdawAfjR3DosPvJX:  -0.01000000 Waves

2021.08.30 18:55 [1681288] smart account 3Mrr9J7M21Kjz3AC4ryFdawAfjR3DosPvJX > SELF 0.00000000 Waves

{ "type": 13, "id": "7RpEAVgFHpSemz71HszHTXch7FU14LeVqt91RGy675zU", "fee": 1000000, "feeAssetId": null, "timestamp": 1630338984416, "version": 2, "chainId": 84, "sender": "3Mrr9J7M21Kjz3AC4ryFdawAfjR3DosPvJX", "senderPublicKey": "GFC3PrZ7FMDvtkGCf2uw9QTWKS6Ui4hbFbRoLX68Rnip", "proofs": [ "4TsCrd6LYX6Vxq1i9a5WpqdePsw6MF9fqD9N8v56zb2U8gmNfAyfsa5f2wDkD1a6LBxt4WkL2R4s2221fBeLQ5zh" ], "script": "base64:AAIDAAAAAAAAAOYIARIDCgEIGhIKAmExEgxhbnN3ZXJzQ291bnQaDQoCYTISB2Fuc3dlcnMaDwoCYTMSCWdldEFuc3dlchoOCgJhNBIIcXVlc3Rpb24aFAoCYTUSDnByZXZpb3VzQW5zd2VyGgoKAmE2EgRoYXNoGgsKAmE3EgVpbmRleBoXCgJhOBIRZ2V0UHJldmlvdXNBbnN3ZXIaDQoCYTkSB2FkZHJlc3MaDQoCYjESByRtYXRjaDAaBwoCYjISAWEaBwoCYjMSAWkaEwoCYjQSDWNhbGxlckFkZHJlc3MaDAoCYjUSBmFuc3dlcgAAAAQAAAAAAmExAAAAAAAAAAAUAAAAAAJhMgkABEwAAAACAgAAAA5JdCBpcyBjZXJ0YWluLgkABEwAAAACAgAAABNJdCBpcyBkZWNpZGVkbHkgc28uCQAETAAAAAICAAAAEFdpdGhvdXQgYSBkb3VidC4JAARMAAAAAgIAAAARWWVzIC0gZGVmaW5pdGVseS4JAARMAAAAAgIAAAATWW91IG1heSByZWx5IG9uIGl0LgkABEwAAAACAgAAABFBcyBJIHNlZSBpdCwgeWVzLgkABEw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XRhRW50cnkAAAACCQABLAAAAAIFAAAAAmI0AgAAAAJfcQUAAAACYTQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAACYjQCAAAAAl9hBQAAAAJiNQUAAAADbmlsAAAAAC+3Jq8=", "height": 1681288, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9yor9QUwVEcbMjDu65HrpTc7NgWX4xKjSQguTpiGjtAq Next: none Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-func voterIsAllowedToVote (voterPublicKey) = {
5- let alekseiPubKey = base58'CBZAPq78sWXbfYUYTgWHQkoFdSXQopXVMrT3RmXAnyNu'
6- let annaPubKey = base58'D5YzUv5nbLTjR2ZeZCwUTjtyAQ5QD2uP45FhCdMjCae1'
7- if (if ((voterPublicKey != alekseiPubKey))
8- then (voterPublicKey != annaPubKey)
9- else false)
10- then false
11- else true
4+let answersCount = 20
5+
6+let answers = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.", "Reply hazy, try again.", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.", "My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."]
7+
8+func getAnswer (question,previousAnswer) = {
9+ let hash = sha256(toBytes((question + previousAnswer)))
10+ let index = toInt(hash)
11+answers[(index % answersCount)]
1212 }
1313
1414
15+func getPreviousAnswer (address) = match getString(this, (address + "_a")) {
16+ case a: String =>
17+ a
18+ case _ =>
19+ address
20+}
21+
22+
1523 @Callable(i)
16-func vote (theVote) = if (!(voterIsAllowedToVote(i.callerPublicKey)))
17- then throw("You can not vote because you are not in the list of voters!")
18- else {
19- let dataFromStorage = getInteger(this, toBase58String(i.callerPublicKey))
20- if (isDefined(dataFromStorage))
21- then throw("You have already voted! Voting the second time is not allowed.")
22- else $Tuple2([IntegerEntry(toBase58String(i.callerPublicKey), theVote)], unit)
23- }
24+func tellme (question) = {
25+ let callerAddress = toBase58String(i.caller.bytes)
26+ let answer = getAnswer(question, getPreviousAnswer(callerAddress))
27+ WriteSet([DataEntry((callerAddress + "_q"), question), DataEntry((callerAddress + "_a"), answer)])
28+ }
2429
2530

github/deemru/w8io/026f985 
30.41 ms