tx · G73z9UzfxhSayKNW6cqW12MYi1xjMQkjCHVeKz2VNw1W 3N3evGP2tTeuXuq3iHz13Wrjm7BonuiSMd2: -0.05000000 Waves 2022.12.22 14:24 [2371436] smart account 3N3evGP2tTeuXuq3iHz13Wrjm7BonuiSMd2 > SELF 0.00000000 Waves
{ "type": 13, "id": "G73z9UzfxhSayKNW6cqW12MYi1xjMQkjCHVeKz2VNw1W", "fee": 5000000, "feeAssetId": null, "timestamp": 1671708337415, "version": 2, "chainId": 84, "sender": "3N3evGP2tTeuXuq3iHz13Wrjm7BonuiSMd2", "senderPublicKey": "3XEAduJnZeFRL74JfaQk7MgrGDo9a9xREYyfLvyivREU", "proofs": [ "5PD2PNfsYLFpnefgpSTZFzJW99BmcnoriSJ6Vyyoem4uG4Pe4mtSjv9aj7TNZFCC5jdxKdNRGXCh2wS95ZshSUof" ], "script": "base64:BgIRCAISAwoBCBIDCgEIEgMKAQgFAA9NRVNTQUdFX0NPVU5URVICD21lc3NhZ2VfY291bnRlcgANRk9MTE9XX1NUUklORwIHZm9sbG93cwAQVFdFRVRfS0VZX1NUUklORwIGdHdlZXRfARFnZXRNZXNzYWdlQ291bnRlcgAJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUPTUVTU0FHRV9DT1VOVEVSAAABKWdldExhdGVzdFR3ZWV0SWZGcm9tU29tZW9uZUFkZHJlc3NGb2xsb3dzAgdhZGRyZXNzBm9mZnNldAQObWVzc2FnZUNvdW50ZXIJARFnZXRNZXNzYWdlQ291bnRlcgAEB3R3ZWV0SWQJAQt2YWx1ZU9yRWxzZQIJAKIIAQkArAICBRBUV0VFVF9LRVlfU1RSSU5HCQCkAwEJAGUCBQ5tZXNzYWdlQ291bnRlcgUGb2Zmc2V0AgAEBXBhcnRzCQC1CQIFB3R3ZWV0SWQCAV8EBnNlbmRlcgkAkQMCBQVwYXJ0cwAABBNrZXlUb0NoZWNrRm9sbG93aW5nCQCsAgIJAKwCAgkArAICCQCsAgIFB2FkZHJlc3MC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0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleT7/F7U=", "height": 2371436, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HLjZ4B25xaugnjDtdDuZU9geDgFkX7kfZHBLqZqx2meF Next: 9YhdhF59bKVXCBEFwTYseRGCbc2h46RGpakR82MWURs9 Diff:
Old | New | Differences | |
---|---|---|---|
10 | 10 | func getMessageCounter () = valueOrElse(getInteger(MESSAGE_COUNTER), 0) | |
11 | 11 | ||
12 | 12 | ||
13 | - | func | |
13 | + | func getLatestTweetIfFromSomeoneAddressFollows (address,offset) = { | |
14 | 14 | let messageCounter = getMessageCounter() | |
15 | 15 | let tweetId = valueOrElse(getString((TWEET_KEY_STRING + toString((messageCounter - offset)))), "") | |
16 | 16 | let parts = split(tweetId, "_") | |
17 | 17 | let sender = parts[0] | |
18 | - | if ((sender == address)) | |
18 | + | let keyToCheckFollowing = ((((address + "_") + FOLLOW_STRING) + "_") + sender) | |
19 | + | let following = valueOrElse(getBoolean(keyToCheckFollowing), false) | |
20 | + | if (following) | |
19 | 21 | then getString(tweetId) | |
20 | 22 | else "" | |
21 | 23 | } |
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 | |
13 | + | func getLatestTweetIfFromSomeoneAddressFollows (address,offset) = { | |
14 | 14 | let messageCounter = getMessageCounter() | |
15 | 15 | let tweetId = valueOrElse(getString((TWEET_KEY_STRING + toString((messageCounter - offset)))), "") | |
16 | 16 | let parts = split(tweetId, "_") | |
17 | 17 | let sender = parts[0] | |
18 | - | if ((sender == address)) | |
18 | + | let keyToCheckFollowing = ((((address + "_") + FOLLOW_STRING) + "_") + sender) | |
19 | + | let following = valueOrElse(getBoolean(keyToCheckFollowing), false) | |
20 | + | if (following) | |
19 | 21 | then getString(tweetId) | |
20 | 22 | else "" | |
21 | 23 | } | |
22 | 24 | ||
23 | 25 | ||
24 | 26 | @Callable(i) | |
25 | 27 | func follow (address) = { | |
26 | 28 | let sender = toString(i.caller) | |
27 | 29 | let followKey = ((((sender + "_") + FOLLOW_STRING) + "_") + address) | |
28 | 30 | [BooleanEntry(followKey, true)] | |
29 | 31 | } | |
30 | 32 | ||
31 | 33 | ||
32 | 34 | ||
33 | 35 | @Callable(i) | |
34 | 36 | func unfollow (address) = { | |
35 | 37 | let sender = toString(i.caller) | |
36 | 38 | let followKey = ((((sender + "_") + FOLLOW_STRING) + "_") + address) | |
37 | 39 | [DeleteEntry(followKey)] | |
38 | 40 | } | |
39 | 41 | ||
40 | 42 | ||
41 | 43 | ||
42 | 44 | @Callable(i) | |
43 | 45 | func tweet (message) = { | |
44 | 46 | let messageCounter = (getMessageCounter() + 1) | |
45 | 47 | let sender = toString(i.caller) | |
46 | 48 | let txId = toBase58String(i.transactionId) | |
47 | 49 | let msgKey = ((sender + "_") + txId) | |
48 | 50 | let tweetKey = (TWEET_KEY_STRING + toString(messageCounter)) | |
49 | 51 | [StringEntry(msgKey, message), StringEntry(tweetKey, msgKey), IntegerEntry(MESSAGE_COUNTER, messageCounter)] | |
50 | 52 | } | |
51 | 53 | ||
52 | 54 | ||
53 | 55 | @Verifier(tx) | |
54 | 56 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
55 | 57 |
github/deemru/w8io/169f3d6 39.29 ms ◑