tx · EKxJ2EDq1ENFJNLCDDRWXkWUg57BvYHNejYWdpN6h3pZ
3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb: -0.01400000 Waves
2019.06.28 05:45 [561399] smart account 3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb > SELF 0.00000000 Waves
{
"type": 13,
"id": "EKxJ2EDq1ENFJNLCDDRWXkWUg57BvYHNejYWdpN6h3pZ",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1561689980105,
"version": 1,
"sender": "3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb",
"senderPublicKey": "FRkBvFhV1T95mPTxp7sk2Ms2BuHViwyG7yPzxpxye1Kw",
"proofs": [
"3L8Sog73rdbxXujVvgwkVf3VZW7eKikXC1KPoUimzoYc8gYns4QcTpdcUGVUWuyQCoqWS5G8RA9kYXkfKNbVWHGU"
],
"script": "base64:AAIDAAAAAAAAAAAAAAAFAAAAAAhwcmljZWFkdgAAAAAAAJiWgAAAAAASYWxsTWVzc2FnZUJvYXJkS2V5AgAAAAthbGxfbWVzc2FnZQAAAAAQYWN0aXZlTWVzc2FnZUtleQIAAAAOYWN0aXZlX21lc3NhZ2UBAAAACXVuaXF1ZUtleQAAAAIAAAAFb3duZXIAAAAEdGV4dAQAAAAEdUtleQkAAlgAAAABCQAB9wAAAAEJAAGbAAAAAQkAASwAAAACBQAAAAVvd25lcgUAAAAEdGV4dAUAAAAEdUtleQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0AAAABAAAAAWkBAAAABnNldEFkdgAAAAEAAAAEdGV4dAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAHldBVkVTIHRva2VuIG9ubHkgYXQgdGhlIG1vbWVudAMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAhwcmljZWFkdgkAAAIAAAABAgAAABZZb3UgbmVlZCBwYXkgMC4xIFdBVkVTBAAAAAxvd25lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAEdUtleQkBAAAACXVuaXF1ZUtleQAAAAIFAAAADG93bmVyQWRkcmVzcwUAAAAEdGV4dAQAAAAKYWxsTWVzc2FnZQkBAAAADmdldE51bWJlckJ5S2V5AAAAAQUAAAASYWxsTWVzc2FnZUJvYXJkS2V5BAAAAAphY3RNZXNzYWdlCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABBQAAABBhY3RpdmVNZXNzYWdlS2V5CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAABm93bmVyXwUAAAAEdUtleQUAAAAMb3duZXJBZGRyZXNzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAACG1lc3NhZ2VfBQAAAAR1S2V5BQAAAAR0ZXh0CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAABJhbGxNZXNzYWdlQm9hcmRLZXkJAABkAAAAAgUAAAAKYWxsTWVzc2FnZQAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAQYWN0aXZlTWVzc2FnZUtleQkAAGQAAAACBQAAAAphY3RNZXNzYWdlAAAAAAAAAAABBQAAAANuaWwAAAAAmN4UqA==",
"chainId": 84,
"height": 561399,
"spentComplexity": 0
}
View: original | compacted
Prev: 3VrtCofmHSmCCAxwkTZmDFxocb1kMAajDHxXwpXArEyG
Next: 6V5htFLFAefvn6jwNrPdn5noA7Z8GLkTFE7Lc84Gr6A7
Diff:
Old | New | | Differences |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let priceadv = 10000000 |
---|
5 | 5 | | |
---|
| 6 | + | let allMessageBoardKey = "all_message" |
---|
| 7 | + | |
---|
| 8 | + | let activeMessageKey = "active_message" |
---|
| 9 | + | |
---|
6 | 10 | | func uniqueKey (owner,text) = { |
---|
7 | 11 | | let uKey = toBase58String(sha256(toBytes((owner + text)))) |
---|
8 | 12 | | uKey |
---|
| 13 | + | } |
---|
| 14 | + | |
---|
| 15 | + | |
---|
| 16 | + | func getNumberByKey (key) = { |
---|
| 17 | + | let num = match getInteger(this, key) { |
---|
| 18 | + | case a: Int => |
---|
| 19 | + | a |
---|
| 20 | + | case _ => |
---|
| 21 | + | 0 |
---|
| 22 | + | } |
---|
| 23 | + | num |
---|
9 | 24 | | } |
---|
10 | 25 | | |
---|
11 | 26 | | |
---|
|
19 | 34 | | else { |
---|
20 | 35 | | let ownerAddress = toBase58String(i.caller.bytes) |
---|
21 | 36 | | let uKey = uniqueKey(ownerAddress, text) |
---|
22 | | - | WriteSet([DataEntry(("owner_" + uKey), ownerAddress), DataEntry(("message_" + uKey), text)]) |
---|
| 37 | + | let allMessage = getNumberByKey(allMessageBoardKey) |
---|
| 38 | + | let actMessage = getNumberByKey(activeMessageKey) |
---|
| 39 | + | WriteSet([DataEntry(("owner_" + uKey), ownerAddress), DataEntry(("message_" + uKey), text), DataEntry(allMessageBoardKey, (allMessage + 1)), DataEntry(activeMessageKey, (actMessage + 1))]) |
---|
23 | 40 | | } |
---|
24 | 41 | | } |
---|
25 | 42 | | |
---|
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 | 5 | | |
---|
| 6 | + | let allMessageBoardKey = "all_message" |
---|
| 7 | + | |
---|
| 8 | + | let activeMessageKey = "active_message" |
---|
| 9 | + | |
---|
6 | 10 | | func uniqueKey (owner,text) = { |
---|
7 | 11 | | let uKey = toBase58String(sha256(toBytes((owner + text)))) |
---|
8 | 12 | | uKey |
---|
| 13 | + | } |
---|
| 14 | + | |
---|
| 15 | + | |
---|
| 16 | + | func getNumberByKey (key) = { |
---|
| 17 | + | let num = match getInteger(this, key) { |
---|
| 18 | + | case a: Int => |
---|
| 19 | + | a |
---|
| 20 | + | case _ => |
---|
| 21 | + | 0 |
---|
| 22 | + | } |
---|
| 23 | + | num |
---|
9 | 24 | | } |
---|
10 | 25 | | |
---|
11 | 26 | | |
---|
12 | 27 | | @Callable(i) |
---|
13 | 28 | | func setAdv (text) = { |
---|
14 | 29 | | let pmt = extract(i.payment) |
---|
15 | 30 | | if (isDefined(pmt.assetId)) |
---|
16 | 31 | | then throw("WAVES token only at the moment") |
---|
17 | 32 | | else if ((pmt.amount != priceadv)) |
---|
18 | 33 | | then throw("You need pay 0.1 WAVES") |
---|
19 | 34 | | else { |
---|
20 | 35 | | let ownerAddress = toBase58String(i.caller.bytes) |
---|
21 | 36 | | let uKey = uniqueKey(ownerAddress, text) |
---|
22 | | - | WriteSet([DataEntry(("owner_" + uKey), ownerAddress), DataEntry(("message_" + uKey), text)]) |
---|
| 37 | + | let allMessage = getNumberByKey(allMessageBoardKey) |
---|
| 38 | + | let actMessage = getNumberByKey(activeMessageKey) |
---|
| 39 | + | WriteSet([DataEntry(("owner_" + uKey), ownerAddress), DataEntry(("message_" + uKey), text), DataEntry(allMessageBoardKey, (allMessage + 1)), DataEntry(activeMessageKey, (actMessage + 1))]) |
---|
23 | 40 | | } |
---|
24 | 41 | | } |
---|
25 | 42 | | |
---|
26 | 43 | | |
---|