tx · 6V5htFLFAefvn6jwNrPdn5noA7Z8GLkTFE7Lc84Gr6A7
3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb: -0.01400000 Waves
2019.06.28 06:07 [561419] smart account 3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb > SELF 0.00000000 Waves
{
"type": 13,
"id": "6V5htFLFAefvn6jwNrPdn5noA7Z8GLkTFE7Lc84Gr6A7",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1561691262298,
"version": 1,
"sender": "3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb",
"senderPublicKey": "FRkBvFhV1T95mPTxp7sk2Ms2BuHViwyG7yPzxpxye1Kw",
"proofs": [
"3TPmVTE6vgJTjtHPPLwAss3QMXHVv8AXbeWX61EvqG7fwjT2k9Xi1Qy5o2i5hX6nwkckmsyEGzXKQdGqxBrGtdui"
],
"script": "base64:AAIDAAAAAAAAAAAAAAAHAAAAAAhwcmljZWFkdgAAAAAAAJiWgAAAAAAFZW1wdHkCAAAABE5VTEwAAAAAEmFsbE1lc3NhZ2VCb2FyZEtleQIAAAALYWxsX21lc3NhZ2UAAAAAEGFjdGl2ZU1lc3NhZ2VLZXkCAAAADmFjdGl2ZV9tZXNzYWdlAQAAAAl1bmlxdWVLZXkAAAACAAAABW93bmVyAAAABHRleHQEAAAABHVLZXkJAAJYAAAAAQkAAfcAAAABCQABmwAAAAEJAAEsAAAAAgUAAAAFb3duZXIFAAAABHRleHQFAAAABHVLZXkBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwU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AAIFAAAAEGFjdGl2ZU1lc3NhZ2VLZXkJAABkAAAAAgUAAAAKYWN0TWVzc2FnZQAAAAAAAAAAAQUAAAADbmlsAAAAAWkBAAAADXJlbW92ZU1lc3NhZ2UAAAABAAAABHVLZXkEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50BAAAAAVvd25lcgkBAAAAC2dldFN0ckJ5S2V5AAAAAQkAASwAAAACAgAAAAZvd25lcl8FAAAABHVLZXkEAAAACmFjdE1lc3NhZ2UJAQAAAA5nZXROdW1iZXJCeUtleQAAAAEFAAAAEGFjdGl2ZU1lc3NhZ2VLZXkEAAAADXNlbmRlckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAgUAAAAFb3duZXIFAAAABWVtcHR5CQAAAgAAAAECAAAAFE1lc3NhZ2UgZGlkbid0IGZvdW5kAwkBAAAAAiE9AAAAAgUAAAAFb3duZXIFAAAADXNlbmRlckFkZHJlc3MJAAACAAAAAQkAASwAAAACAgAAABtZb3UgZG9uJ3Qgb3duZXIgb2YgbWVzc2FnZSAFAAAABHVLZXkJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEGFjdGl2ZU1lc3NhZ2VLZXkJAABlAAAAAgUAAAAKYWN0TWVzc2FnZQAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAAhtZXNzYWdlXwUAAAAEdUtleQIAAAAJI1JFTU9WRUQjBQAAAANuaWwAAAAAQbd0Mg==",
"chainId": 84,
"height": 561419,
"spentComplexity": 0
}
View: original | compacted
Prev: EKxJ2EDq1ENFJNLCDDRWXkWUg57BvYHNejYWdpN6h3pZ
Next: EKh4Paqbr7R9syVTqKHRh3za72M7eBG7rTDrQwheuFbv
Diff:
Old | New | | Differences |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let priceadv = 10000000 |
---|
| 5 | + | |
---|
| 6 | + | let empty = "NULL" |
---|
5 | 7 | | |
---|
6 | 8 | | let allMessageBoardKey = "all_message" |
---|
7 | 9 | | |
---|
|
24 | 26 | | } |
---|
25 | 27 | | |
---|
26 | 28 | | |
---|
| 29 | + | func getStrByKey (key) = { |
---|
| 30 | + | let str = match getString(this, key) { |
---|
| 31 | + | case a: String => |
---|
| 32 | + | a |
---|
| 33 | + | case _ => |
---|
| 34 | + | empty |
---|
| 35 | + | } |
---|
| 36 | + | str |
---|
| 37 | + | } |
---|
| 38 | + | |
---|
| 39 | + | |
---|
27 | 40 | | @Callable(i) |
---|
28 | | - | func setAdv (text) = { |
---|
| 41 | + | func setMessage (text) = { |
---|
29 | 42 | | let pmt = extract(i.payment) |
---|
30 | 43 | | if (isDefined(pmt.assetId)) |
---|
31 | 44 | | then throw("WAVES token only at the moment") |
---|
|
41 | 54 | | } |
---|
42 | 55 | | |
---|
43 | 56 | | |
---|
| 57 | + | |
---|
| 58 | + | @Callable(i) |
---|
| 59 | + | func removeMessage (uKey) = { |
---|
| 60 | + | let pmt = extract(i.payment) |
---|
| 61 | + | let owner = getStrByKey(("owner_" + uKey)) |
---|
| 62 | + | let actMessage = getNumberByKey(activeMessageKey) |
---|
| 63 | + | let senderAddress = toBase58String(i.caller.bytes) |
---|
| 64 | + | if ((owner == empty)) |
---|
| 65 | + | then throw("Message didn't found") |
---|
| 66 | + | else if ((owner != senderAddress)) |
---|
| 67 | + | then throw(("You don't owner of message " + uKey)) |
---|
| 68 | + | else WriteSet([DataEntry(activeMessageKey, (actMessage - 1)), DataEntry(("message_" + uKey), "#REMOVED#")]) |
---|
| 69 | + | } |
---|
| 70 | + | |
---|
| 71 | + | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let priceadv = 10000000 |
---|
| 5 | + | |
---|
| 6 | + | let empty = "NULL" |
---|
5 | 7 | | |
---|
6 | 8 | | let allMessageBoardKey = "all_message" |
---|
7 | 9 | | |
---|
8 | 10 | | let activeMessageKey = "active_message" |
---|
9 | 11 | | |
---|
10 | 12 | | func uniqueKey (owner,text) = { |
---|
11 | 13 | | let uKey = toBase58String(sha256(toBytes((owner + text)))) |
---|
12 | 14 | | uKey |
---|
13 | 15 | | } |
---|
14 | 16 | | |
---|
15 | 17 | | |
---|
16 | 18 | | func getNumberByKey (key) = { |
---|
17 | 19 | | let num = match getInteger(this, key) { |
---|
18 | 20 | | case a: Int => |
---|
19 | 21 | | a |
---|
20 | 22 | | case _ => |
---|
21 | 23 | | 0 |
---|
22 | 24 | | } |
---|
23 | 25 | | num |
---|
24 | 26 | | } |
---|
25 | 27 | | |
---|
26 | 28 | | |
---|
| 29 | + | func getStrByKey (key) = { |
---|
| 30 | + | let str = match getString(this, key) { |
---|
| 31 | + | case a: String => |
---|
| 32 | + | a |
---|
| 33 | + | case _ => |
---|
| 34 | + | empty |
---|
| 35 | + | } |
---|
| 36 | + | str |
---|
| 37 | + | } |
---|
| 38 | + | |
---|
| 39 | + | |
---|
27 | 40 | | @Callable(i) |
---|
28 | | - | func setAdv (text) = { |
---|
| 41 | + | func setMessage (text) = { |
---|
29 | 42 | | let pmt = extract(i.payment) |
---|
30 | 43 | | if (isDefined(pmt.assetId)) |
---|
31 | 44 | | then throw("WAVES token only at the moment") |
---|
32 | 45 | | else if ((pmt.amount != priceadv)) |
---|
33 | 46 | | then throw("You need pay 0.1 WAVES") |
---|
34 | 47 | | else { |
---|
35 | 48 | | let ownerAddress = toBase58String(i.caller.bytes) |
---|
36 | 49 | | let uKey = uniqueKey(ownerAddress, text) |
---|
37 | 50 | | let allMessage = getNumberByKey(allMessageBoardKey) |
---|
38 | 51 | | let actMessage = getNumberByKey(activeMessageKey) |
---|
39 | 52 | | WriteSet([DataEntry(("owner_" + uKey), ownerAddress), DataEntry(("message_" + uKey), text), DataEntry(allMessageBoardKey, (allMessage + 1)), DataEntry(activeMessageKey, (actMessage + 1))]) |
---|
40 | 53 | | } |
---|
41 | 54 | | } |
---|
42 | 55 | | |
---|
43 | 56 | | |
---|
| 57 | + | |
---|
| 58 | + | @Callable(i) |
---|
| 59 | + | func removeMessage (uKey) = { |
---|
| 60 | + | let pmt = extract(i.payment) |
---|
| 61 | + | let owner = getStrByKey(("owner_" + uKey)) |
---|
| 62 | + | let actMessage = getNumberByKey(activeMessageKey) |
---|
| 63 | + | let senderAddress = toBase58String(i.caller.bytes) |
---|
| 64 | + | if ((owner == empty)) |
---|
| 65 | + | then throw("Message didn't found") |
---|
| 66 | + | else if ((owner != senderAddress)) |
---|
| 67 | + | then throw(("You don't owner of message " + uKey)) |
---|
| 68 | + | else WriteSet([DataEntry(activeMessageKey, (actMessage - 1)), DataEntry(("message_" + uKey), "#REMOVED#")]) |
---|
| 69 | + | } |
---|
| 70 | + | |
---|
| 71 | + | |
---|