tx · D47n1nueihuoq3SXpjJJnsDW8YTcFLtjpt2RNccbrj9u
3NBPqqjDH2eYmoHeXNPnHhLvA7D4UDQXQcx: -0.01400000 Waves
2021.01.26 14:43 [1370427] smart account 3NBPqqjDH2eYmoHeXNPnHhLvA7D4UDQXQcx > SELF 0.00000000 Waves
{
"type": 13,
"id": "D47n1nueihuoq3SXpjJJnsDW8YTcFLtjpt2RNccbrj9u",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1611661386321,
"version": 2,
"chainId": 84,
"sender": "3NBPqqjDH2eYmoHeXNPnHhLvA7D4UDQXQcx",
"senderPublicKey": "2VJESL5o2hqRwaKdJGDXpzJ7jNDcZz5y4C6qWEaUn4yY",
"proofs": [
"5efPGdFFA7YnFJApQv2KPH8V2opgQKjCS5zrnYGaWjj71jquUvBjt42dM2W6TmpN7huJVEAg1Hg1m7osGf8AMd2s"
],
"script": "base64:AAIEAAAAAAAAAAcIAhIDCgEIAAAAAQEAAAAJZGV2aWNlS2V5AAAAAQAAAAZkZXZpY2UJAAEsAAAAAgIAAAAHZGV2aWNlXwUAAAAGZGV2aWNlAAAAAQAAAAFpAQAAAAlhZGREZXZpY2UAAAABAAAABmRldmljZQkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgkBAAAACWRldmljZUtleQAAAAEFAAAABmRldmljZQYFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5WTlETA==",
"height": 1370427,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 9oRGuJi88MkzqNMxLV9oy3CbgicXBbjDheeuKsG8CLiM
Next: 6jJJgk88C1284rBQUUp9HS7BZHfmmrwF1rT2Ese3xC3M
Diff:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | func counterKey (device) = (device + "_counter") |
---|
5 | | - | |
---|
6 | | - | |
---|
7 | | - | func statusKey (device) = (device + "_status") |
---|
8 | | - | |
---|
9 | | - | |
---|
10 | | - | func deviceExists (device) = { |
---|
11 | | - | let exists = getInteger(this, counterKey(device)) |
---|
12 | | - | match exists { |
---|
13 | | - | case v: Int => |
---|
14 | | - | true |
---|
15 | | - | case _ => |
---|
16 | | - | false |
---|
17 | | - | } |
---|
18 | | - | } |
---|
| 4 | + | func deviceKey (device) = ("device_" + device) |
---|
19 | 5 | | |
---|
20 | 6 | | |
---|
21 | 7 | | @Callable(i) |
---|
22 | | - | func interact (device,action) = if (if ((action != "open")) |
---|
23 | | - | then (action != "close") |
---|
24 | | - | else false) |
---|
25 | | - | then throw("Invalid action") |
---|
26 | | - | else if (!(deviceExists(device))) |
---|
27 | | - | then throw("Device does not exist") |
---|
28 | | - | else { |
---|
29 | | - | let counter = getIntegerValue(this, counterKey(device)) |
---|
30 | | - | [StringEntry(statusKey(device), action), IntegerEntry(counterKey(device), (counter + 1))] |
---|
31 | | - | } |
---|
32 | | - | |
---|
33 | | - | |
---|
34 | | - | |
---|
35 | | - | @Callable(i) |
---|
36 | | - | func addDevice (device) = [StringEntry((device + "_status"), "close"), IntegerEntry((device + "_counter"), 0)] |
---|
| 8 | + | func addDevice (device) = [BooleanEntry(deviceKey(device), true)] |
---|
37 | 9 | | |
---|
38 | 10 | | |
---|
39 | 11 | | @Verifier(tx) |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | func counterKey (device) = (device + "_counter") |
---|
5 | | - | |
---|
6 | | - | |
---|
7 | | - | func statusKey (device) = (device + "_status") |
---|
8 | | - | |
---|
9 | | - | |
---|
10 | | - | func deviceExists (device) = { |
---|
11 | | - | let exists = getInteger(this, counterKey(device)) |
---|
12 | | - | match exists { |
---|
13 | | - | case v: Int => |
---|
14 | | - | true |
---|
15 | | - | case _ => |
---|
16 | | - | false |
---|
17 | | - | } |
---|
18 | | - | } |
---|
| 4 | + | func deviceKey (device) = ("device_" + device) |
---|
19 | 5 | | |
---|
20 | 6 | | |
---|
21 | 7 | | @Callable(i) |
---|
22 | | - | func interact (device,action) = if (if ((action != "open")) |
---|
23 | | - | then (action != "close") |
---|
24 | | - | else false) |
---|
25 | | - | then throw("Invalid action") |
---|
26 | | - | else if (!(deviceExists(device))) |
---|
27 | | - | then throw("Device does not exist") |
---|
28 | | - | else { |
---|
29 | | - | let counter = getIntegerValue(this, counterKey(device)) |
---|
30 | | - | [StringEntry(statusKey(device), action), IntegerEntry(counterKey(device), (counter + 1))] |
---|
31 | | - | } |
---|
32 | | - | |
---|
33 | | - | |
---|
34 | | - | |
---|
35 | | - | @Callable(i) |
---|
36 | | - | func addDevice (device) = [StringEntry((device + "_status"), "close"), IntegerEntry((device + "_counter"), 0)] |
---|
| 8 | + | func addDevice (device) = [BooleanEntry(deviceKey(device), true)] |
---|
37 | 9 | | |
---|
38 | 10 | | |
---|
39 | 11 | | @Verifier(tx) |
---|
40 | 12 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
41 | 13 | | |
---|