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:AAIDAAAAAAAAAAAAAAAHAAAAAAhwcmljZWFkdgAAAAAAAJiWgAAAAAAFZW1wdHkCAAAABE5VTEwAAAAAEmFsbE1lc3NhZ2VCb2FyZEtleQIAAAALYWxsX21lc3NhZ2UAAAAAEGFjdGl2ZU1lc3NhZ2VLZXkCAAAADmFjdGl2ZV9tZXNzYWdlAQAAAAl1bmlxdWVLZXkAAAACAAAABW93bmVyAAAABHRleHQEAAAABHVLZXkJAAJYAAAAAQkAAfcAAAABCQABmwAAAAEJAAEsAAAAAgUAAAAFb3duZXIFAAAABHRleHQFAAAABHVLZXkBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5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EGFjdGl2ZU1lc3NhZ2VLZXkJAABkAAAAAgUAAAAKYWN0TWVzc2FnZQAAAAAAAAAAAQUAAAADbmlsAAAAAWkBAAAADXJlbW92ZU1lc3NhZ2UAAAABAAAABHVLZXkEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50BAAAAAVvd25lcgkBAAAAC2dldFN0ckJ5S2V5AAAAAQkAASwAAAACAgAAAAZvd25lcl8FAAAABHVLZXkEAAAACmFjdE1lc3NhZ2UJAQAAAA5nZXROdW1iZXJCeUtleQAAAAEFAAAAEGFjdGl2ZU1lc3NhZ2VLZXkEAAAADXNlbmRlckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAgUAAAAFb3duZXIFAAAABWVtcHR5CQAAAgAAAAECAAAAFE1lc3NhZ2UgZGlkbid0IGZvdW5kAwkBAAAAAiE9AAAAAgUAAAAFb3duZXIFAAAADXNlbmRlckFkZHJlc3MJAAACAAAAAQkAASwAAAACAgAAABtZb3UgZG9uJ3Qgb3duZXIgb2YgbWVzc2FnZSAFAAAABHVLZXkJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEGFjdGl2ZU1lc3NhZ2VLZXkJAABlAAAAAgUAAAAKYWN0TWVzc2FnZQAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAAhtZXNzYWdlXwUAAAAEdUtleQIAAAAJI1JFTU9WRUQjBQAAAANuaWwAAAAAQbd0Mg==", "chainId": 84, "height": 561419, "spentComplexity": 0 } View: original | compacted Prev: EKxJ2EDq1ENFJNLCDDRWXkWUg57BvYHNejYWdpN6h3pZ Next: EKh4Paqbr7R9syVTqKHRh3za72M7eBG7rTDrQwheuFbv Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let priceadv = 10000000
5+
6+let empty = "NULL"
57
68 let allMessageBoardKey = "all_message"
79
2426 }
2527
2628
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+
2740 @Callable(i)
28-func setAdv (text) = {
41+func setMessage (text) = {
2942 let pmt = extract(i.payment)
3043 if (isDefined(pmt.assetId))
3144 then throw("WAVES token only at the moment")
4154 }
4255
4356
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:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let priceadv = 10000000
5+
6+let empty = "NULL"
57
68 let allMessageBoardKey = "all_message"
79
810 let activeMessageKey = "active_message"
911
1012 func uniqueKey (owner,text) = {
1113 let uKey = toBase58String(sha256(toBytes((owner + text))))
1214 uKey
1315 }
1416
1517
1618 func getNumberByKey (key) = {
1719 let num = match getInteger(this, key) {
1820 case a: Int =>
1921 a
2022 case _ =>
2123 0
2224 }
2325 num
2426 }
2527
2628
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+
2740 @Callable(i)
28-func setAdv (text) = {
41+func setMessage (text) = {
2942 let pmt = extract(i.payment)
3043 if (isDefined(pmt.assetId))
3144 then throw("WAVES token only at the moment")
3245 else if ((pmt.amount != priceadv))
3346 then throw("You need pay 0.1 WAVES")
3447 else {
3548 let ownerAddress = toBase58String(i.caller.bytes)
3649 let uKey = uniqueKey(ownerAddress, text)
3750 let allMessage = getNumberByKey(allMessageBoardKey)
3851 let actMessage = getNumberByKey(activeMessageKey)
3952 WriteSet([DataEntry(("owner_" + uKey), ownerAddress), DataEntry(("message_" + uKey), text), DataEntry(allMessageBoardKey, (allMessage + 1)), DataEntry(activeMessageKey, (actMessage + 1))])
4053 }
4154 }
4255
4356
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+

github/deemru/w8io/169f3d6 
27.44 ms