tx · 3c2xPB8Q5EEee9DTQiAwBVP4wbdJh9YLzh86zb8Yt5XY 3MzLFtW4HAnHScA7x9AoxtiiPrGPLyKdK5f: -0.01400000 Waves 2021.01.10 12:20 [1347141] smart account 3MzLFtW4HAnHScA7x9AoxtiiPrGPLyKdK5f > SELF 0.00000000 Waves
{ "type": 13, "id": "3c2xPB8Q5EEee9DTQiAwBVP4wbdJh9YLzh86zb8Yt5XY", "fee": 1400000, "feeAssetId": null, "timestamp": 1610270438566, "version": 2, "chainId": 84, "sender": "3MzLFtW4HAnHScA7x9AoxtiiPrGPLyKdK5f", "senderPublicKey": "6wBzB7Bw3oZwcxqF44P6x9GRDda14XkVXQdfCQSAWpeP", "proofs": [ "pQeV53SB9Me6u2sBR6V2CUNmFf6qcj1Nd9bttXBegvHpRBZfxFaAZ1jb7iNtcsZcqR8yyytgWYFRoSjGjzQsbpx" ], "script": "base64:AAIEAAAAAAAAAAkIAhIFCgMICAgAAAAKAAAAAAVjaHJpcwIAAAAjM01zRzZqUE5DclZKVXRZQjdYSkJ4Uzd1dFdzWEFmNG45VnAAAAAABGpvZXACAAAAIzNNem00Vkx3c045dVp3YlRNelBqM1h1eFY2a0VmQVI4VUROAAAAAAhyZWNlaXZlZAIAAAAIUkVDRUlWRUQAAAAACHJlamVjdGVkAgAAAAhSRUpFQ1RFRAAAAAAIYWNjZXB0ZWQCAAAACEFDQ0VQVEVEAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQIAAAAAAQAAAA1rZXlVc2VyU3RhdHVzAAAAAQAAAAZjYWxsZXIJAAEsAAAAAgIAAAAFdXNlcl8FAAAABmNhbGxlcgEAAAAOa2V5VXNlck1lc3NhZ2UAAAABAAAABmNhbGxlcgkAASwAAAACAgAAAARtc2dfBQAAAAZjYWxsZXIBAAAADWtleVVzZXJVcGRhdGUAAAABAAAABmNhbGxlcgkAASwA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5zRWxlbWVudAAAAAIJAARMAAAAAgUAAAAFY2hyaXMJAARMAAAAAgUAAAAEam9lcAkABEwAAAACCQAEJQAAAAEFAAAABHRoaXMFAAAAA25pbAUAAAAGY2FsbGVyCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAAA1rZXlVc2VyU3RhdHVzAAAAAQUAAAAHYWRkcmVzcwkBAAAACG1ha2VKU09OAAAAAwUAAAALc3RhdHVzVG9TZXQJAAJaAAAAAQkAAZsAAAABBQAAAANtc2cJAAGkAAAAAQUAAAAJdGltZXN0YW1wBQAAAANuaWwJAAACAAAAAQIAAAAhTm90IGFsbG93ZWQgdG8gY2hhbmdlIHVzZXIgc3RhdHVzAAAAALyzXog=", "height": 1347141, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8xJT4YYGVjt3ykdwu7SNGvV24L6RQxyVipX1zmeZn513 Next: 4NJ59iwCA4nvPbJQLZzMw9ubZKMubhr3TzRJAwbopYxV Diff:
Old | New | Differences | |
---|---|---|---|
40 | 40 | else false) | |
41 | 41 | then throw("Application exist already") | |
42 | 42 | else if (containsElement([chris, joep, toString(this)], caller)) | |
43 | - | then [StringEntry(keyUserStatus(address), makeJSON( | |
43 | + | then [StringEntry(keyUserStatus(address), makeJSON(statusToSet, toBase64String(toBytes(msg)), toString(timestamp)))] | |
44 | 44 | else throw("Not allowed to change user status") | |
45 | 45 | } | |
46 | 46 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let chris = "3MsG6jPNCrVJUtYB7XJBxS7utWsXAf4n9Vp" | |
5 | 5 | ||
6 | 6 | let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN" | |
7 | 7 | ||
8 | 8 | let received = "RECEIVED" | |
9 | 9 | ||
10 | 10 | let rejected = "REJECTED" | |
11 | 11 | ||
12 | 12 | let accepted = "ACCEPTED" | |
13 | 13 | ||
14 | 14 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyUserStatus (caller) = ("user_" + caller) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyUserMessage (caller) = ("msg_" + caller) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func keyUserUpdate (caller) = ("update_" + caller) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func makeJSON (statusToSet,msg,timestamp) = (((((("{\"status\": \"" + statusToSet) + "\", \"message\":\"") + msg) + "\",\"timestamp\":\"") + timestamp) + "\"}") | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | @Callable(i) | |
30 | 30 | func setStatus (address,status,msg) = { | |
31 | 31 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
32 | 32 | let id = toBase58String(i.transactionId) | |
33 | 33 | let currentStatus = getStringByKey(keyUserStatus(address)) | |
34 | 34 | let timestamp = lastBlock.timestamp | |
35 | 35 | let statusToSet = if (containsElement([received, rejected, accepted], status)) | |
36 | 36 | then status | |
37 | 37 | else throw("Unknown status") | |
38 | 38 | if (if ((currentStatus == received)) | |
39 | 39 | then (status == received) | |
40 | 40 | else false) | |
41 | 41 | then throw("Application exist already") | |
42 | 42 | else if (containsElement([chris, joep, toString(this)], caller)) | |
43 | - | then [StringEntry(keyUserStatus(address), makeJSON( | |
43 | + | then [StringEntry(keyUserStatus(address), makeJSON(statusToSet, toBase64String(toBytes(msg)), toString(timestamp)))] | |
44 | 44 | else throw("Not allowed to change user status") | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 |
github/deemru/w8io/169f3d6 30.23 ms ◑