tx · 8RDBbqchKHDpMCkXTgXAKcs2CjwrDVh84iKKwqUy1RHn 3N3evGP2tTeuXuq3iHz13Wrjm7BonuiSMd2: -0.05000000 Waves 2022.12.22 14:44 [2371458] smart account 3N3evGP2tTeuXuq3iHz13Wrjm7BonuiSMd2 > SELF 0.00000000 Waves
{ "type": 13, "id": "8RDBbqchKHDpMCkXTgXAKcs2CjwrDVh84iKKwqUy1RHn", "fee": 5000000, "feeAssetId": null, "timestamp": 1671709473579, "version": 2, "chainId": 84, "sender": "3N3evGP2tTeuXuq3iHz13Wrjm7BonuiSMd2", "senderPublicKey": "3XEAduJnZeFRL74JfaQk7MgrGDo9a9xREYyfLvyivREU", "proofs": [ "H8CoXCD7Lj6XfqZAVyyMXLvRsvXvvSuzwAwuHuXR6swoSXgZHwZeRuPbvWjB1SremY7b39aMQZiFh2DLDbXHKwi" ], "script": "base64:BgIRCAISAwoBCBIDCgEIEgMKAQgGAA9NRVNTQUdFX0NPVU5URVICD21lc3NhZ2VfY291bnRlcgANRk9MTE9XX1NUUklORwIHZm9sbG93cwAQVFdFRVRfS0VZX1NUUklORwIGdHdlZXRfARFnZXRNZXNzYWdlQ291bnRlcgAJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUPTUVTU0FHRV9DT1VOVEVSAAABKWdldExhdGVzdFR3ZWV0SWZGcm9tU29tZW9uZUFkZHJlc3NGb2xsb3dzAgVhY2N1bQZwYXJhbXMEB2FkZHJlc3MEByRtYXRjaDAJAJEDAgUGcGFyYW1zAAEDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFzBQckbWF0Y2gwBQFzAgAEBm9mZnNldAQHJG1hdGNoMAkAkQMCBQZwYXJhbXMAAAMJAAECBQckbWF0Y2gwAgNJbnQEAWkFByRtYXRjaDAFAWkAAAQObWVzc2FnZUNvdW50ZXIJARFnZXRNZXNzYWdlQ291bnRlcgAEB3R3ZWV0SWQJAQt2YWx1ZU9yRWxzZQIJAKIIAQkArAICBRBUV0VFVF9LRVlfU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VudHJ5AgUJZm9sbG93S2V5BgUDbmlsAWkBCHVuZm9sbG93AQdhZGRyZXNzBAZzZW5kZXIJAKUIAQgFAWkGY2FsbGVyBAlmb2xsb3dLZXkJAKwCAgkArAICCQCsAgIJAKwCAgUGc2VuZGVyAgFfBQ1GT0xMT1dfU1RSSU5HAgFfBQdhZGRyZXNzCQDMCAIJAQtEZWxldGVFbnRyeQEFCWZvbGxvd0tleQUDbmlsAWkBBXR3ZWV0AQdtZXNzYWdlBA5tZXNzYWdlQ291bnRlcgkAZAIJARFnZXRNZXNzYWdlQ291bnRlcgAAAQQGc2VuZGVyCQClCAEIBQFpBmNhbGxlcgQEdHhJZAkA2AQBCAUBaQ10cmFuc2FjdGlvbklkBAZtc2dLZXkJAKwCAgkArAICBQZzZW5kZXICAV8FBHR4SWQECHR3ZWV0S2V5CQCsAgIFEFRXRUVUX0tFWV9TVFJJTkcJAKQDAQUObWVzc2FnZUNvdW50ZXIJAMwIAgkBC1N0cmluZ0VudHJ5AgUGbXNnS2V5BQdtZXNzYWdlCQDMCAIJAQtTdHJpbmdFbnRyeQIFCHR3ZWV0S2V5BQZtc2dLZXkJAMwIAgkBDEludGVnZXJFbnRyeQIFD01FU1NBR0VfQ09VTlRFUgUObWVzc2FnZUNvdW50ZXIFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXlO3Kx2", "height": 2371458, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9YhdhF59bKVXCBEFwTYseRGCbc2h46RGpakR82MWURs9 Next: ELmRELFADPT7UAgT7bo8HdMB35Pt5A7LYEqe68MUWMxu Diff:
Old | New | Differences | |
---|---|---|---|
10 | 10 | func getMessageCounter () = valueOrElse(getInteger(MESSAGE_COUNTER), 0) | |
11 | 11 | ||
12 | 12 | ||
13 | - | func getLatestTweetIfFromSomeoneAddressFollows (accum,offset) = { | |
14 | - | let address = "3MuSvxzfzqLTDPq1j5mTHwK5tLx5ChDcQMi" | |
13 | + | func getLatestTweetIfFromSomeoneAddressFollows (accum,params) = { | |
14 | + | let address = match params[1] { | |
15 | + | case s: String => | |
16 | + | s | |
17 | + | case _ => | |
18 | + | "" | |
19 | + | } | |
20 | + | let offset = match params[0] { | |
21 | + | case i: Int => | |
22 | + | i | |
23 | + | case _ => | |
24 | + | 0 | |
25 | + | } | |
15 | 26 | let messageCounter = getMessageCounter() | |
16 | 27 | let tweetId = valueOrElse(getString((TWEET_KEY_STRING + toString((messageCounter - offset)))), "") | |
17 | 28 | let parts = split(tweetId, "_") | |
25 | 36 | ||
26 | 37 | ||
27 | 38 | func getLatestTweetsFromFollowingAddresses (address) = { | |
28 | - | let list = [0, 1, 2] | |
39 | + | let list = [[0, address], [1, address], [2, address]] | |
29 | 40 | let $l = list | |
30 | 41 | let $s = size($l) | |
31 | 42 | let $acc0 = nil |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let MESSAGE_COUNTER = "message_counter" | |
5 | 5 | ||
6 | 6 | let FOLLOW_STRING = "follows" | |
7 | 7 | ||
8 | 8 | let TWEET_KEY_STRING = "tweet_" | |
9 | 9 | ||
10 | 10 | func getMessageCounter () = valueOrElse(getInteger(MESSAGE_COUNTER), 0) | |
11 | 11 | ||
12 | 12 | ||
13 | - | func getLatestTweetIfFromSomeoneAddressFollows (accum,offset) = { | |
14 | - | let address = "3MuSvxzfzqLTDPq1j5mTHwK5tLx5ChDcQMi" | |
13 | + | func getLatestTweetIfFromSomeoneAddressFollows (accum,params) = { | |
14 | + | let address = match params[1] { | |
15 | + | case s: String => | |
16 | + | s | |
17 | + | case _ => | |
18 | + | "" | |
19 | + | } | |
20 | + | let offset = match params[0] { | |
21 | + | case i: Int => | |
22 | + | i | |
23 | + | case _ => | |
24 | + | 0 | |
25 | + | } | |
15 | 26 | let messageCounter = getMessageCounter() | |
16 | 27 | let tweetId = valueOrElse(getString((TWEET_KEY_STRING + toString((messageCounter - offset)))), "") | |
17 | 28 | let parts = split(tweetId, "_") | |
18 | 29 | let sender = parts[0] | |
19 | 30 | let keyToCheckFollowing = ((((address + "_") + FOLLOW_STRING) + "_") + sender) | |
20 | 31 | let following = valueOrElse(getBoolean(keyToCheckFollowing), false) | |
21 | 32 | if (following) | |
22 | 33 | then (accum :+ getString(tweetId)) | |
23 | 34 | else accum | |
24 | 35 | } | |
25 | 36 | ||
26 | 37 | ||
27 | 38 | func getLatestTweetsFromFollowingAddresses (address) = { | |
28 | - | let list = [0, 1, 2] | |
39 | + | let list = [[0, address], [1, address], [2, address]] | |
29 | 40 | let $l = list | |
30 | 41 | let $s = size($l) | |
31 | 42 | let $acc0 = nil | |
32 | 43 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
33 | 44 | then $a | |
34 | 45 | else getLatestTweetIfFromSomeoneAddressFollows($a, $l[$i]) | |
35 | 46 | ||
36 | 47 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
37 | 48 | then $a | |
38 | 49 | else throw("List size exceeds 3") | |
39 | 50 | ||
40 | 51 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
41 | 52 | } | |
42 | 53 | ||
43 | 54 | ||
44 | 55 | @Callable(i) | |
45 | 56 | func follow (address) = { | |
46 | 57 | let sender = toString(i.caller) | |
47 | 58 | let followKey = ((((sender + "_") + FOLLOW_STRING) + "_") + address) | |
48 | 59 | [BooleanEntry(followKey, true)] | |
49 | 60 | } | |
50 | 61 | ||
51 | 62 | ||
52 | 63 | ||
53 | 64 | @Callable(i) | |
54 | 65 | func unfollow (address) = { | |
55 | 66 | let sender = toString(i.caller) | |
56 | 67 | let followKey = ((((sender + "_") + FOLLOW_STRING) + "_") + address) | |
57 | 68 | [DeleteEntry(followKey)] | |
58 | 69 | } | |
59 | 70 | ||
60 | 71 | ||
61 | 72 | ||
62 | 73 | @Callable(i) | |
63 | 74 | func tweet (message) = { | |
64 | 75 | let messageCounter = (getMessageCounter() + 1) | |
65 | 76 | let sender = toString(i.caller) | |
66 | 77 | let txId = toBase58String(i.transactionId) | |
67 | 78 | let msgKey = ((sender + "_") + txId) | |
68 | 79 | let tweetKey = (TWEET_KEY_STRING + toString(messageCounter)) | |
69 | 80 | [StringEntry(msgKey, message), StringEntry(tweetKey, msgKey), IntegerEntry(MESSAGE_COUNTER, messageCounter)] | |
70 | 81 | } | |
71 | 82 | ||
72 | 83 | ||
73 | 84 | @Verifier(tx) | |
74 | 85 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
75 | 86 |
github/deemru/w8io/169f3d6 39.19 ms ◑