tx · 71TRJ8kbznKzK8KZ1JhqGNB5Kr3ooSPDRNPqw3iN6wvE 3MzgHu3mKKdBoJKyz1jArzWBNwbB6dHAyti: -0.01000000 Waves 2019.09.07 19:32 [665909] smart account 3MzgHu3mKKdBoJKyz1jArzWBNwbB6dHAyti > SELF 0.00000000 Waves
{ "type": 13, "id": "71TRJ8kbznKzK8KZ1JhqGNB5Kr3ooSPDRNPqw3iN6wvE", "fee": 1000000, "feeAssetId": null, "timestamp": 1567873935996, "version": 1, "sender": "3MzgHu3mKKdBoJKyz1jArzWBNwbB6dHAyti", "senderPublicKey": "6h5J81bqqj3kUeyxapapiFTqmaAh9U3vVhthdffmRqyW", "proofs": [ "5NSmwgREvGSnw5AeamWdwfw1RWgBVkrkcJXoYxRRMEPTiCjKr72J6TKFpgCYvtBBKbsoBaUD3Rmzibta5pwgux28" ], "script": "base64:AAIDAAAAAAAAAAAAAAALAAAAAApzZXJ2aWNlRmVlAAAAAAAAAYagAAAAAAVlbXB0eQIAAAAETlVMTAAAAAASYWxsTWVzc2FnZUJvYXJkS2V5AgAAAAthbGxfbWVzc2FnZQAAAAAQYWN0aXZlTWVzc2FnZUtleQIAAAAOYWN0aXZlX21lc3NhZ2UAAAAADmVhcm5lZFdhdmVzS2V5AgAAAAtlYXJuZWRXYXZlcwAAAAANc2VydmljZUZlZUtleQIAAAAKc2VydmljZUZlZQAAAAAJZEFwcE93bmVyAgAAABojZEFwcCBPd25lciBXYXZlcyBBZGRyZXNzIwEAAAAJdW5pcXVlS2V5AAAAAgAAAAVvd25lcgAAAAR0ZXh0BAAAAAR1S2V5CQACWAAAAAEJAAH3AAAAAQkAAZsAAAABCQABLAAAAAIFAAAABW93bmVyBQAAAAR0ZXh0BQAAAAR1S2V5AQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJ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AAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEGFjdGl2ZU1lc3NhZ2VLZXkJAABlAAAAAgUAAAAKYWN0TWVzc2FnZQAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAAhtZXNzYWdlXwUAAAAEdUtleQIAAAAUI1ZJT0xBVElPTiBPRiBSVUxFUyMFAAAAA25pbAAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAA1zZW5kZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMDCQEAAAACIT0AAAACBQAAAA1zZW5kZXJBZGRyZXNzBQAAAAlkQXBwT3duZXIJAAACAAAAAQIAAAAaWW91IGFyZW4ndCBvd25lciB0aGlzIGRBcHAJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHVuaXQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5/cm/Ww==", "chainId": 84, "height": 665909, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let serviceFee = 100000 | |
5 | + | ||
6 | + | let empty = "NULL" | |
7 | + | ||
8 | + | let allMessageBoardKey = "all_message" | |
9 | + | ||
10 | + | let activeMessageKey = "active_message" | |
11 | + | ||
12 | + | let earnedWavesKey = "earnedWaves" | |
13 | + | ||
14 | + | let serviceFeeKey = "serviceFee" | |
15 | + | ||
16 | + | let dAppOwner = "#dApp Owner Waves Address#" | |
17 | + | ||
18 | + | func uniqueKey (owner,text) = { | |
19 | + | let uKey = toBase58String(sha256(toBytes((owner + text)))) | |
20 | + | uKey | |
21 | + | } | |
22 | + | ||
23 | + | ||
24 | + | func getNumberByKey (key) = { | |
25 | + | let num = match getInteger(this, key) { | |
26 | + | case a: Int => | |
27 | + | a | |
28 | + | case _ => | |
29 | + | 0 | |
30 | + | } | |
31 | + | num | |
32 | + | } | |
33 | + | ||
34 | + | ||
35 | + | func getStrByKey (key) = { | |
36 | + | let str = match getString(this, key) { | |
37 | + | case a: String => | |
38 | + | a | |
39 | + | case _ => | |
40 | + | empty | |
41 | + | } | |
42 | + | str | |
43 | + | } | |
44 | + | ||
45 | + | ||
46 | + | func getSeviceFee () = { | |
47 | + | let fee = match getInteger(this, serviceFeeKey) { | |
48 | + | case a: Int => | |
49 | + | a | |
50 | + | case _ => | |
51 | + | serviceFee | |
52 | + | } | |
53 | + | fee | |
54 | + | } | |
55 | + | ||
56 | + | ||
57 | + | @Callable(i) | |
58 | + | func setMessage (text) = { | |
59 | + | let pmt = extract(i.payment) | |
60 | + | let localFee = getSeviceFee() | |
61 | + | if (isDefined(pmt.assetId)) | |
62 | + | then throw("WAVES token only at the moment") | |
63 | + | else if ((pmt.amount != localFee)) | |
64 | + | then throw("Wrong service fee amount") | |
65 | + | else { | |
66 | + | let ownerAddress = toBase58String(i.caller.bytes) | |
67 | + | let uKey = uniqueKey(ownerAddress, (toString(height) + toBase58String(i.transactionId))) | |
68 | + | let allMessage = getNumberByKey(allMessageBoardKey) | |
69 | + | let actMessage = getNumberByKey(activeMessageKey) | |
70 | + | let earnedWaves = getNumberByKey(earnedWavesKey) | |
71 | + | WriteSet([DataEntry(("owner_" + uKey), ownerAddress), DataEntry(("message_" + uKey), text), DataEntry(allMessageBoardKey, (allMessage + 1)), DataEntry(activeMessageKey, (actMessage + 1)), DataEntry(earnedWavesKey, (earnedWaves + localFee))]) | |
72 | + | } | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(i) | |
78 | + | func removeMessage (uKey) = { | |
79 | + | let owner = getStrByKey(("owner_" + uKey)) | |
80 | + | let actMessage = getNumberByKey(activeMessageKey) | |
81 | + | let senderAddress = toBase58String(i.caller.bytes) | |
82 | + | if ((owner == empty)) | |
83 | + | then throw("Message didn't found") | |
84 | + | else if ((owner != senderAddress)) | |
85 | + | then throw(("You don't owner of message " + uKey)) | |
86 | + | else WriteSet([DataEntry(activeMessageKey, (actMessage - 1)), DataEntry(("message_" + uKey), "#REMOVED#")]) | |
87 | + | } | |
88 | + | ||
89 | + | ||
90 | + | ||
91 | + | @Callable(i) | |
92 | + | func setServiceFee (newFee) = { | |
93 | + | let senderAddress = toBase58String(i.caller.bytes) | |
94 | + | if ((senderAddress != dAppOwner)) | |
95 | + | then throw("You aren't owner this dApp") | |
96 | + | else WriteSet([DataEntry(serviceFeeKey, newFee)]) | |
97 | + | } | |
98 | + | ||
99 | + | ||
100 | + | ||
101 | + | @Callable(i) | |
102 | + | func violationDetected (uKey) = { | |
103 | + | let actMessage = getNumberByKey(activeMessageKey) | |
104 | + | let senderAddress = toBase58String(i.caller.bytes) | |
105 | + | if ((senderAddress != dAppOwner)) | |
106 | + | then throw("You aren't owner this dApp") | |
107 | + | else WriteSet([DataEntry(activeMessageKey, (actMessage - 1)), DataEntry(("message_" + uKey), "#VIOLATION OF RULES#")]) | |
108 | + | } | |
109 | + | ||
110 | + | ||
111 | + | ||
112 | + | @Callable(i) | |
113 | + | func withdraw (amount) = { | |
114 | + | let senderAddress = toBase58String(i.caller.bytes) | |
115 | + | if ((senderAddress != dAppOwner)) | |
116 | + | then throw("You aren't owner this dApp") | |
117 | + | else TransferSet([ScriptTransfer(i.caller, amount, unit)]) | |
118 | + | } | |
119 | + | ||
120 | + | ||
121 | + | @Verifier(tx) | |
122 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
123 | + |
github/deemru/w8io/026f985 23.13 ms ◑