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