tx · EKJLZ4bejtZhQ8LSpfPpEg7XEru9AM6C3KHtw2Hfv53k 3NAGFVwpzyGaGLbR29hvXLnY3ysZmeWogdX: -0.01000000 Waves 2022.05.18 18:17 [2057272] smart account 3NAGFVwpzyGaGLbR29hvXLnY3ysZmeWogdX > SELF 0.00000000 Waves
{ "type": 13, "id": "EKJLZ4bejtZhQ8LSpfPpEg7XEru9AM6C3KHtw2Hfv53k", "fee": 1000000, "feeAssetId": null, "timestamp": 1652887016516, "version": 2, "chainId": 84, "sender": "3NAGFVwpzyGaGLbR29hvXLnY3ysZmeWogdX", "senderPublicKey": "5qA7HQ72BFr7ggPCXMRPR5wx7Woi4RL8EZBGkRSbbF8Y", "proofs": [ "4giEJfgDnVDyTZ3EQPtaG2LjiBfH5Qw8rcgkLHKi9iQmDoYBE6YPuCxxJCCK65mbmggqX6My5YNHVWDwvK6p3mig" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIIAQAAAAAAAAABAAAAAWkBAAAABHRlc3QAAAACAAAABWRhcHAyAAAAEHBheW1lbnRzX2NvdW50ZXIDCQAAZwAAAAIFAAAAEHBheW1lbnRzX2NvdW50ZXIAAAAAAAAAAGQJAAUUAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAWdG90YWxfcGF5bWVudHNfY291bnRlcgUAAAAQcGF5bWVudHNfY291bnRlcgUAAAADbmlsBQAAABBwYXltZW50c19jb3VudGVyBAAAAANyZXMJAAP9AAAABAkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAFZGFwcDICAAAABHRlc3QJAARMAAAAAgUAAAAEdGhpcwkABEwAAAACCQAAZAAAAAIFAAAAEHBheW1lbnRzX2NvdW50ZXIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMFAAAAA25pbAkABEwAAAACCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgUAAAAEdW5pdAAAAAAAAAAAAQkABEwAAAACCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgUAAAAEdW5pdAAAAAAAAAAAAQkABEwAAAACCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgUAAAAEdW5pdAAAAAAAAAAAAQkABEwAAAACCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgUAAAAEdW5pdAAAAAAAAAAAAQkABEwAAAACCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgUAAAAEdW5pdAAAAAAAAAAAAQkABEwAAAACCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgUAAAAEdW5pdAAAAAAAAAAAAQUAAAADbmlsAwkAAAAAAAACBQAAAANyZXMFAAAAA3JlcwQAAAAHJG1hdGNoMAUAAAADcmVzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAA3JlcwUAAAAHJG1hdGNoMAkABRQAAAACCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAABVsYXN0X3BheW1lbnRzX2NvdW50ZXIFAAAAA3JlcwUAAAADbmlsBQAAAANyZXMJAAACAAAAAQIAAAARYmFkIGludm9rZSByZXN1bHQJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAABDDnHM=", "height": 2057272, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9mDUUfjQJUZFXjv2J3dCjeJ31QLcFmRPkdkPKR8hwip Next: 5u7XBu2it28DZAa5KKmZnE8AsgYxrwfvQiz89BuR2KpA Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 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 | 4 | ||
22 | 5 | ||
23 | 6 | @Callable(i) | |
24 | - | func tellme (question) = { | |
25 | - | let callerAddress = toBase58String(i.caller.bytes) | |
26 | - | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
27 | - | [StringEntry((callerAddress + "_q"), question), StringEntry((callerAddress + "_a"), answer)] | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | @Callable(i) | |
33 | - | func recv_payments (payments_counter) = if ((payments_counter >= 100)) | |
34 | - | then $Tuple2(nil, payments_counter) | |
7 | + | func test (dapp2,payments_counter) = if ((payments_counter >= 100)) | |
8 | + | then $Tuple2([IntegerEntry("total_payments_counter", payments_counter)], payments_counter) | |
35 | 9 | else { | |
36 | - | let res = | |
10 | + | let res = reentrantInvoke(addressFromStringValue(dapp2), "test", [this, (payments_counter + size(i.payments))], [AttachedPayment(unit, 1), AttachedPayment(unit, 1), AttachedPayment(unit, 1), AttachedPayment(unit, 1), AttachedPayment(unit, 1), AttachedPayment(unit, 1)]) | |
37 | 11 | if ((res == res)) | |
38 | - | then | |
12 | + | then match res { | |
39 | 13 | case res: Int => | |
40 | - | res | |
14 | + | $Tuple2([IntegerEntry("last_payments_counter", res)], res) | |
41 | 15 | case _ => | |
42 | - | | |
43 | - | } | |
16 | + | throw("bad invoke result") | |
17 | + | } | |
44 | 18 | else throw("Strict value is not equal to itself.") | |
45 | 19 | } | |
46 | 20 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 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 | 4 | ||
22 | 5 | ||
23 | 6 | @Callable(i) | |
24 | - | func tellme (question) = { | |
25 | - | let callerAddress = toBase58String(i.caller.bytes) | |
26 | - | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
27 | - | [StringEntry((callerAddress + "_q"), question), StringEntry((callerAddress + "_a"), answer)] | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | @Callable(i) | |
33 | - | func recv_payments (payments_counter) = if ((payments_counter >= 100)) | |
34 | - | then $Tuple2(nil, payments_counter) | |
7 | + | func test (dapp2,payments_counter) = if ((payments_counter >= 100)) | |
8 | + | then $Tuple2([IntegerEntry("total_payments_counter", payments_counter)], payments_counter) | |
35 | 9 | else { | |
36 | - | let res = | |
10 | + | let res = reentrantInvoke(addressFromStringValue(dapp2), "test", [this, (payments_counter + size(i.payments))], [AttachedPayment(unit, 1), AttachedPayment(unit, 1), AttachedPayment(unit, 1), AttachedPayment(unit, 1), AttachedPayment(unit, 1), AttachedPayment(unit, 1)]) | |
37 | 11 | if ((res == res)) | |
38 | - | then | |
12 | + | then match res { | |
39 | 13 | case res: Int => | |
40 | - | res | |
14 | + | $Tuple2([IntegerEntry("last_payments_counter", res)], res) | |
41 | 15 | case _ => | |
42 | - | | |
43 | - | } | |
16 | + | throw("bad invoke result") | |
17 | + | } | |
44 | 18 | else throw("Strict value is not equal to itself.") | |
45 | 19 | } | |
46 | 20 | ||
47 | 21 |
github/deemru/w8io/169f3d6 47.39 ms ◑