tx · J5WcWLczipdooSDvjoTtcs8qaFosiuX4XtFsEsvJ428o 3N5NY2v5wdKQJbCvQA5o5hSihn7t7wYZ496: -0.01000000 Waves 2024.12.02 12:50 [3396876] smart account 3N5NY2v5wdKQJbCvQA5o5hSihn7t7wYZ496 > SELF 0.00000000 Waves
{ "type": 13, "id": "J5WcWLczipdooSDvjoTtcs8qaFosiuX4XtFsEsvJ428o", "fee": 1000000, "feeAssetId": null, "timestamp": 1733133121976, "version": 2, "chainId": 84, "sender": "3N5NY2v5wdKQJbCvQA5o5hSihn7t7wYZ496", "senderPublicKey": "8Ti3dhEToApephiZ47QJeuQX3UYifveNLPQjNstsLho9", "proofs": [ "4qMt19dnxBL93fzRpp8KekKoFyQjqYz9CjUam5mX14awUV36W7cSSy3xPTCRamvEZoT3CLa3ja6BQUCCDy7bAzvy" ], "script": "base64:AAIFAAAAAAAAABIIAhIECgIICBIDCgEIEgMKAQgAAAADAAAAAAxhZG1pbkFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQKod4wevFlHRdTHlxXLSQFsxtF0IER7tcAAAAAC2RBcHBBZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUjRVTeNnVQpTHDFtQW6B+jbo1nlkqGVfwAQAAAA1zZWFyY2hGb3JVc2VyAAAAAQAAAAdhZGRyZXNzBAAAAAR1c2VyBAAAAAckbWF0Y2gwCQAEIgAAAAEFAAAAB2FkZHJlc3MDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwIAAAAHTm8gVXNlcgUAAAAEdXNlcgAAAAMAAAABaQEAAAAPcmVnaXN0ZXJBY2NvdW50AAAAAgAAAAdhZGRyZXNzAAAABHJvbGUDCQEAAAACIT0AAAACCAUAAAABaQAAAAZjYWxsZXIFAAAADGFkbWluQWRkcmVzcwkAAAIAAAABAgAAACRPbmx5IHRoZSBhZG1pbiBjYW4gcmVnaXN0ZXIgYWNjb3VudHMJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgUAAAAHYWRkcmVzcwUAAAAEcm9sZQUAAAADbmlsAAAAAWkBAAAADWRlbGV0ZUFjY291bnQAAAABAAAAB2FkZHJlc3MDCQEAAAACIT0AAAACCAUAAAABaQAAAAZjYWxsZXIFAAAADGFkbWluQWRkcmVzcwkAAAIAAAABAgAAACJPbmx5IHRoZSBhZG1pbiBjYW4gZGVsZXRlIGFjY291bnRzCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAAB2FkZHJlc3MFAAAAA25pbAAAAAFpAQAAAAhzYXZlRGF0YQAAAAEAAAALdGVtcGVyYXR1cmUEAAAABmNhbGxlcggFAAAAAWkAAAAGY2FsbGVyBAAAAAR1c2VyCQEAAAANc2VhcmNoRm9yVXNlcgAAAAEJAAJYAAAAAQgFAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAgUAAAAEdXNlcgIAAAAHTm8gVXNlcgkAAAIAAAABAgAAABFVc2VyIG5vdCBlbGlnaWJsZQQAAAAKcGFyYW1ldGVycwkABEwAAAACBQAAAAt0ZW1wZXJhdHVyZQUAAAADbmlsBAAAAAppbnZva2VUYXNrCQAD/AAAAAQFAAAAC2RBcHBBZGRyZXNzAgAAAAhTYXZlRGF0YQUAAAAKcGFyYW1ldGVycwUAAAADbmlsAwkBAAAAAiE9AAAAAgUAAAAKaW52b2tlVGFzawUAAAAKaW52b2tlVGFzawkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4FAAAAA25pbAAAAADrry5t", "height": 3396876, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4fGMqfpeZ9H8yujFhY7sKWkWnP3vYVvugqC9jdMtXQQQ Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func searchForCounters () = { | |
5 | - | let searchForCounters = match getString("stored_public_key") { | |
4 | + | let adminAddress = Address(base58'3MptJSctbAkp5fddvpQmWYjjKrSoim6dL38') | |
5 | + | ||
6 | + | let dAppAddress = Address(base58'3N2n4bjG8CjdKiwLPyp3hBM4MDJ3XwMZR5h') | |
7 | + | ||
8 | + | func searchForUser (address) = { | |
9 | + | let user = match getString(address) { | |
6 | 10 | case s: String => | |
7 | 11 | s | |
8 | 12 | case _ => | |
9 | 13 | "No User" | |
10 | 14 | } | |
11 | - | | |
15 | + | user | |
12 | 16 | } | |
13 | 17 | ||
14 | 18 | ||
15 | 19 | @Callable(i) | |
16 | - | func registerPublicKey () = { | |
17 | - | let pubKey = i.callerPublicKey | |
18 | - | [StringEntry("stored_public_key", toBase58String(pubKey))] | |
19 | - | } | |
20 | + | func registerAccount (address,role) = if ((i.caller != adminAddress)) | |
21 | + | then throw("Only the admin can register accounts") | |
22 | + | else [StringEntry(address, role)] | |
20 | 23 | ||
21 | 24 | ||
22 | 25 | ||
23 | 26 | @Callable(i) | |
24 | - | func verifyProof (proof,inputs) = { | |
25 | - | let storedPublicKey = searchForCounters() | |
26 | - | let storedVecotr = toBytes(storedPublicKey) | |
27 | - | if (groth16Verify(proof, storedVecotr, inputs)) | |
28 | - | then [StringEntry("verification", "success")] | |
29 | - | else throw("Invalid Zero-Knowledge Proof") | |
27 | + | func deleteAccount (address) = if ((i.caller != adminAddress)) | |
28 | + | then throw("Only the admin can delete accounts") | |
29 | + | else [DeleteEntry(address)] | |
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | @Callable(i) | |
34 | + | func saveData (temperature) = { | |
35 | + | let caller = i.caller | |
36 | + | let user = searchForUser(toBase58String(caller.bytes)) | |
37 | + | if ((user == "No User")) | |
38 | + | then throw("User not eligible") | |
39 | + | else { | |
40 | + | let parameters = [temperature] | |
41 | + | let invokeTask = invoke(dAppAddress, "SaveData", parameters, nil) | |
42 | + | if ((invokeTask != invokeTask)) | |
43 | + | then throw("Strict value is not equal to itself.") | |
44 | + | else nil | |
45 | + | } | |
30 | 46 | } | |
31 | 47 | ||
32 | 48 |
github/deemru/w8io/026f985 27.20 ms ◑