tx · C5HPYQdwFQJbac7XUjyLPixt44YM9dbJmxnmdGvFENGy
3N58AEeUCDbB93RaTVPfS3hmXS4RameBJAh: -0.01000000 Waves
2022.04.10 15:52 [2002508] smart account 3N58AEeUCDbB93RaTVPfS3hmXS4RameBJAh > SELF 0.00000000 Waves
{
"type": 13,
"id": "C5HPYQdwFQJbac7XUjyLPixt44YM9dbJmxnmdGvFENGy",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1649595195213,
"version": 2,
"chainId": 84,
"sender": "3N58AEeUCDbB93RaTVPfS3hmXS4RameBJAh",
"senderPublicKey": "AUmzFrGot6sb7JrGGwmQA7RZLFhA7T9x8auj4KByeoUf",
"proofs": [
"4Ts4N26aeojwe9Tjh92KLBt9Ctyat3U22wiPvDH5nvMDQJWiAqfi9a7LqXw8vWUNt5aeJm7x9dbKKhaZyNQGpvxr"
],
"script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQgAAAABAAAAAA1jb250cmFjdE93bmVyAgAAACMzTjU4QUVlVUNEYkI5M1JhVFZQZlMzaG1YUzRSYW1lQkpBaAAAAAIAAAABaQEAAAAPYXV0aG9yaXplRGV2aWNlAAAAAQAAAA1kZXZpY2VBZGRyZXNzBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMDCQAAAAAAAAIFAAAACmN1cnJlbnRLZXkFAAAADWNvbnRyYWN0T3duZXIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAADWRldmljZUFkZHJlc3MGBQAAAANuaWwJAAACAAAAAQIAAAAuWW91IGFyZSBub3QgYXV0aG9yaXplZCB0byBtYW5hZ2UgdGhpcyBjb250cmFjdAAAAAFpAQAAABFkZWF1dGhvcml6ZURldmljZQAAAAEAAAANZGV2aWNlQWRkcmVzcwQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkAAAAAAAACBQAAAApjdXJyZW50S2V5BQAAAA1jb250cmFjdE93bmVyCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA1kZXZpY2VBZGRyZXNzBwUAAAADbmlsCQAAAgAAAAECAAAALllvdSBhcmUgbm90IGF1dGhvcml6ZWQgdG8gbWFuYWdlIHRoaXMgY29udHJhY3QAAAAA87cZBA==",
"height": 2002508,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 7s8NWkyeBgZ1Dut9rfMCy55NSFuQ7fFduBuydxWxVhcp
Next: none
Diff:
Old | New | | Differences |
---|
4 | 4 | | let contractOwner = "3N58AEeUCDbB93RaTVPfS3hmXS4RameBJAh" |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | | - | func saveAge (age) = { |
---|
| 7 | + | func authorizeDevice (deviceAddress) = { |
---|
8 | 8 | | let currentKey = toBase58String(i.caller.bytes) |
---|
9 | | - | ScriptResult(WriteSet([DataEntry(currentKey, age)]), TransferSet([ScriptTransfer(i.caller, age, unit)])) |
---|
| 9 | + | if ((currentKey == contractOwner)) |
---|
| 10 | + | then WriteSet([DataEntry(deviceAddress, true)]) |
---|
| 11 | + | else throw("You are not authorized to manage this contract") |
---|
10 | 12 | | } |
---|
11 | 13 | | |
---|
12 | 14 | | |
---|
13 | 15 | | |
---|
14 | 16 | | @Callable(i) |
---|
15 | | - | func addPoint (point) = { |
---|
16 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
17 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
18 | | - | case a: Int => |
---|
19 | | - | a |
---|
20 | | - | case _ => |
---|
21 | | - | 0 |
---|
22 | | - | } |
---|
23 | | - | let newAmount = (currentAmount + point) |
---|
24 | | - | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
25 | | - | } |
---|
26 | | - | |
---|
27 | | - | |
---|
28 | | - | |
---|
29 | | - | @Callable(i) |
---|
30 | | - | func addContract (deviceAddress) = { |
---|
| 17 | + | func deauthorizeDevice (deviceAddress) = { |
---|
31 | 18 | | let currentKey = toBase58String(i.caller.bytes) |
---|
32 | 19 | | if ((currentKey == contractOwner)) |
---|
33 | | - | then WriteSet([DataEntry(deviceAddress, true)]) |
---|
34 | | - | else throw("You are not contractOwner") |
---|
| 20 | + | then WriteSet([DataEntry(deviceAddress, false)]) |
---|
| 21 | + | else throw("You are not authorized to manage this contract") |
---|
35 | 22 | | } |
---|
36 | | - | |
---|
37 | | - | |
---|
38 | | - | |
---|
39 | | - | @Callable(i) |
---|
40 | | - | func removeContract (deviceAddress) = WriteSet([DataEntry(deviceAddress, false)]) |
---|
41 | 23 | | |
---|
42 | 24 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let contractOwner = "3N58AEeUCDbB93RaTVPfS3hmXS4RameBJAh" |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | | - | func saveAge (age) = { |
---|
| 7 | + | func authorizeDevice (deviceAddress) = { |
---|
8 | 8 | | let currentKey = toBase58String(i.caller.bytes) |
---|
9 | | - | ScriptResult(WriteSet([DataEntry(currentKey, age)]), TransferSet([ScriptTransfer(i.caller, age, unit)])) |
---|
| 9 | + | if ((currentKey == contractOwner)) |
---|
| 10 | + | then WriteSet([DataEntry(deviceAddress, true)]) |
---|
| 11 | + | else throw("You are not authorized to manage this contract") |
---|
10 | 12 | | } |
---|
11 | 13 | | |
---|
12 | 14 | | |
---|
13 | 15 | | |
---|
14 | 16 | | @Callable(i) |
---|
15 | | - | func addPoint (point) = { |
---|
16 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
17 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
18 | | - | case a: Int => |
---|
19 | | - | a |
---|
20 | | - | case _ => |
---|
21 | | - | 0 |
---|
22 | | - | } |
---|
23 | | - | let newAmount = (currentAmount + point) |
---|
24 | | - | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
25 | | - | } |
---|
26 | | - | |
---|
27 | | - | |
---|
28 | | - | |
---|
29 | | - | @Callable(i) |
---|
30 | | - | func addContract (deviceAddress) = { |
---|
| 17 | + | func deauthorizeDevice (deviceAddress) = { |
---|
31 | 18 | | let currentKey = toBase58String(i.caller.bytes) |
---|
32 | 19 | | if ((currentKey == contractOwner)) |
---|
33 | | - | then WriteSet([DataEntry(deviceAddress, true)]) |
---|
34 | | - | else throw("You are not contractOwner") |
---|
| 20 | + | then WriteSet([DataEntry(deviceAddress, false)]) |
---|
| 21 | + | else throw("You are not authorized to manage this contract") |
---|
35 | 22 | | } |
---|
36 | | - | |
---|
37 | | - | |
---|
38 | | - | |
---|
39 | | - | @Callable(i) |
---|
40 | | - | func removeContract (deviceAddress) = WriteSet([DataEntry(deviceAddress, false)]) |
---|
41 | 23 | | |
---|
42 | 24 | | |
---|