tx · GtgJRbmrssJNVZJvXiS8FnjBp3XcLH3HKFcSYWxEPZiP 3MqKyuCxQwdRXmejv5WLhQA7pWzSsjvu9zQ: -0.01000000 Waves 2022.01.22 15:26 [1890115] smart account 3MqKyuCxQwdRXmejv5WLhQA7pWzSsjvu9zQ > SELF 0.00000000 Waves
{ "type": 13, "id": "GtgJRbmrssJNVZJvXiS8FnjBp3XcLH3HKFcSYWxEPZiP", "fee": 1000000, "feeAssetId": null, "timestamp": 1642854385939, "version": 2, "chainId": 84, "sender": "3MqKyuCxQwdRXmejv5WLhQA7pWzSsjvu9zQ", "senderPublicKey": "ANUHXt7YWeaTEcFr5T64XGdgsnoF8z5QHeMoc56gJuwY", "proofs": [ "58meTYN5i58ALJqiGzbyUqYo1XsZXNSMT8BQw8e8cHDsWCgGvGzsCdKwBXLpnRNBkxhM7mXgbcvizQZMkFTZC9gL" ], "script": "base64:AAIDAAAAAAAAANgIARIDCgEIGhEKAWESDGFuc3dlcnNDb3VudBoMCgFiEgdhbnN3ZXJzGg4KAWMSCWdldEFuc3dlchoNCgFkEghxdWVzdGlvbhoTCgFlEg5wcmV2aW91c0Fuc3dlchoJCgFmEgRoYXNoGgoKAWcSBWluZGV4GhYKAWgSEWdldFByZXZpb3VzQW5zd2VyGgwKAWkSB2FkZHJlc3MaDAoBahIHJG1hdGNoMBoGCgFrEgFhGgYKAWwSAWkaEgoBbRINY2FsbGVyQWRkcmVzcxoLCgFuEgZhbnN3ZXIAAAAEAAAAAAFhAAAAAAAAAAAUAAAAAAFiCQAETAAAAAICAAAADkl0IGlzIGNlcnRhaW4uCQAETAAAAAICAAAAE0l0IGlzIGRlY2lkZWRseSBzby4JAARMAAAAAgIAAAAQV2l0aG91dCBhIGRvdWJ0LgkABEwAAAACAgAAABFZZXMgLSBkZWZpbml0ZWx5LgkABEwAAAACAgAAABNZb3UgbWF5IHJlbHkgb24gaXQuCQAETAAAAAICAAAAEUFzIEkgc2VlIGl0LCB5ZXMuCQAETAAAAAICAAA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9xBQAAAAFkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAAAW0CAAAAAl9hBQAAAAFuBQAAAANuaWwAAAAADG+fNA==", "height": 1890115, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
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)] | |
12 | + | } | |
13 | + | ||
14 | + | ||
15 | + | func getPreviousAnswer (address) = match getString(this, (address + "_a")) { | |
16 | + | case a: String => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | address | |
20 | + | } | |
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
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 | + | } | |
29 | + | ||
30 | + |
github/deemru/w8io/169f3d6 15.76 ms ◑