tx · C6R1q8tzqP3tQXxuDn6b9cWyGBzoq2oxbE6KjeQ3ToqL
3N5NY2v5wdKQJbCvQA5o5hSihn7t7wYZ496: -0.01000000 Waves
2025.01.02 13:10 [3441439] smart account 3N5NY2v5wdKQJbCvQA5o5hSihn7t7wYZ496 > SELF 0.00000000 Waves
{
"type": 13,
"id": "C6R1q8tzqP3tQXxuDn6b9cWyGBzoq2oxbE6KjeQ3ToqL",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1735812649665,
"version": 2,
"chainId": 84,
"sender": "3N5NY2v5wdKQJbCvQA5o5hSihn7t7wYZ496",
"senderPublicKey": "8Ti3dhEToApephiZ47QJeuQX3UYifveNLPQjNstsLho9",
"proofs": [
"5ib8QhaoGLuVuYnMtVrab77RytDH13pBj3rDyM9TBf3shisRpfhERP2K9QgRR4r8xVKjGbayaEb8wQByaa3sAxrr"
],
"script": "base64:AAIFAAAAAAAAABQIAhIFCgMICAgSAwoBCBIECgIICAAAAAMAAAAADGFkbWluQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVAqh3jB68WUdF1MeXFctJAWzG0XQgRHu1wAAAAALZEFwcEFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVSNFVN42dVClMcMW1BboH6NujWeWSoZV/ABAAAADXNlYXJjaEZvclVzZXIAAAABAAAAB2FkZHJlc3MEAAAABHVzZXIEAAAAByRtYXRjaDAJAAQiAAAAAQUAAAAHYWRkcmVzcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAgAAAAdObyBVc2VyBQAAAAR1c2VyAAAAAwAAAAFpAQAAAA9yZWdpc3RlckFjY291bnQAAAADAAAAB2FkZHJlc3MAAAAEcm9sZQAAAARuYW1lAwkBAAAAAiE9AAAAAggFAAAAAWkAAAAGY2FsbGVyBQAAAAxhZG1pbkFkZHJlc3MJAAACAAAAAQIAAAAkT25seSB0aGUgYW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wDCQEAAAACIT0AAAACBQAAAAppbnZva2VUYXNrBQAAAAppbnZva2VUYXNrCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgUAAAADbmlsAAAAALNuH1U=",
"height": 3441439,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 2qCufYWWKYzNDL7L62DG66YPmq8JfZVmQ9dH7fN4wmFQ
Next: none
Diff:
Old | New | | Differences |
---|
24 | 24 | | |
---|
25 | 25 | | |
---|
26 | 26 | | @Callable(i) |
---|
27 | | - | func deleteAccount (address) = if ((i.caller != adminAddress)) |
---|
28 | | - | then throw("Only the admin can delete accounts") |
---|
29 | | - | else [DeleteEntry(address), DeleteEntry((address + "_name"))] |
---|
| 27 | + | func deleteAccount (address) = { |
---|
| 28 | + | let caller = i.callerPublicKey |
---|
| 29 | + | let user = searchForUser(toBase58String(caller)) |
---|
| 30 | + | if ((user != "Admin")) |
---|
| 31 | + | then throw("Only the admin can delete accounts") |
---|
| 32 | + | else [DeleteEntry(address), DeleteEntry((address + "_name"))] |
---|
| 33 | + | } |
---|
30 | 34 | | |
---|
31 | 35 | | |
---|
32 | 36 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let adminAddress = Address(base58'3MptJSctbAkp5fddvpQmWYjjKrSoim6dL38') |
---|
5 | 5 | | |
---|
6 | 6 | | let dAppAddress = Address(base58'3N2n4bjG8CjdKiwLPyp3hBM4MDJ3XwMZR5h') |
---|
7 | 7 | | |
---|
8 | 8 | | func searchForUser (address) = { |
---|
9 | 9 | | let user = match getString(address) { |
---|
10 | 10 | | case s: String => |
---|
11 | 11 | | s |
---|
12 | 12 | | case _ => |
---|
13 | 13 | | "No User" |
---|
14 | 14 | | } |
---|
15 | 15 | | user |
---|
16 | 16 | | } |
---|
17 | 17 | | |
---|
18 | 18 | | |
---|
19 | 19 | | @Callable(i) |
---|
20 | 20 | | func registerAccount (address,role,name) = if ((i.caller != adminAddress)) |
---|
21 | 21 | | then throw("Only the admin can register accounts") |
---|
22 | 22 | | else [StringEntry(address, role), StringEntry((address + "_name"), name)] |
---|
23 | 23 | | |
---|
24 | 24 | | |
---|
25 | 25 | | |
---|
26 | 26 | | @Callable(i) |
---|
27 | | - | func deleteAccount (address) = if ((i.caller != adminAddress)) |
---|
28 | | - | then throw("Only the admin can delete accounts") |
---|
29 | | - | else [DeleteEntry(address), DeleteEntry((address + "_name"))] |
---|
| 27 | + | func deleteAccount (address) = { |
---|
| 28 | + | let caller = i.callerPublicKey |
---|
| 29 | + | let user = searchForUser(toBase58String(caller)) |
---|
| 30 | + | if ((user != "Admin")) |
---|
| 31 | + | then throw("Only the admin can delete accounts") |
---|
| 32 | + | else [DeleteEntry(address), DeleteEntry((address + "_name"))] |
---|
| 33 | + | } |
---|
30 | 34 | | |
---|
31 | 35 | | |
---|
32 | 36 | | |
---|
33 | 37 | | @Callable(i) |
---|
34 | 38 | | func saveData (temperature,humidity) = { |
---|
35 | 39 | | let caller = i.callerPublicKey |
---|
36 | 40 | | let user = searchForUser(toBase58String(caller)) |
---|
37 | 41 | | if ((user == "No User")) |
---|
38 | 42 | | then throw("User not eligible") |
---|
39 | 43 | | else { |
---|
40 | 44 | | let parameters = [temperature, humidity] |
---|
41 | 45 | | let invokeTask = invoke(dAppAddress, "SaveData", parameters, nil) |
---|
42 | 46 | | if ((invokeTask != invokeTask)) |
---|
43 | 47 | | then throw("Strict value is not equal to itself.") |
---|
44 | 48 | | else nil |
---|
45 | 49 | | } |
---|
46 | 50 | | } |
---|
47 | 51 | | |
---|
48 | 52 | | |
---|