tx · 7WY1qii5a9eQQXEuTa1yQ8hQhZMcLb6rZfyub8U4BXY4 3MyY8HWSxxH8SLxnBHgYZQh26FVgybkTTp9: -0.00200000 Waves 2022.07.29 14:04 [2161024] smart account 3MyY8HWSxxH8SLxnBHgYZQh26FVgybkTTp9 > SELF 0.00000000 Waves
{ "type": 13, "id": "7WY1qii5a9eQQXEuTa1yQ8hQhZMcLb6rZfyub8U4BXY4", "fee": 200000, "feeAssetId": null, "timestamp": 1659092678239, "version": 2, "chainId": 84, "sender": "3MyY8HWSxxH8SLxnBHgYZQh26FVgybkTTp9", "senderPublicKey": "69whdb3wz2NxWkDP633fGFWMnqmhZSDPJ5ThCu3x47jU", "proofs": [ "2c8bKYzJ9iJu4GD6TjcRovQ9WwGgbX3EJh3x2qQ9xUhX1Nbgf3snpNUJTJ4RuScBnWHiCMZxFsq8aF9MMjb8cjc9" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAACgEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAABQAAAAN2YWwBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAAB2lzT3duZXIAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwAAAAAbQ09VUlNfQ0VSVElGSUNBVEVfVElMRV9URVhUAgAAAA9ORlQgQ2VydGlmaWNhdGUAAAAAJ0NPVVJTX0NFUlRJRklDQVRFX0RFU0NSSV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AAAAB2FkZHJlc3MDCQEAAAACIT0AAAACCQEAAAAMdHJ5R2V0U3RyaW5nAAAAAQUAAAADa2V5AgAAAAAGBwAAAAEAAAABaQEAAAAIaXNzdWVORlQAAAAABAAAAANrZXkJAAEsAAAAAgIAAAAIaGlzdG9yeV8JAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyAwkAAAAAAAACCQEAAAAMdHJ5R2V0U3RyaW5nAAAAAQUAAAADa2V5AgAAAAAJAAUUAAAAAgkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgkAASwAAAACAgAAAAhoaXN0b3J5XwkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIGCQAETAAAAAIJAARCAAAABQUAAAAbQ09VUlNfQ0VSVElGSUNBVEVfVElMRV9URVhUCQEAAAAeZ2V0Q291cnNDZXJ0aWZpY2F0ZURlc2NyaXB0aW9uAAAAAQkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEAAAAAAAAAAAAHBQAAAANuaWwFAAAABHVuaXQJAAACAAAAAQUAAAArQ09VUlNfRVJST1JfQ0VSVElGSUNBVEVfQUxSRUFEWV9JU1NVRURfVEVYVAAAAAD3pUJT", "height": 2161024, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DLsfAkjiWUtxPCqWLaHeq4xZ7sWhcrtgQLGmzm7j3Bhh Next: 8NKSvYajriK4GDqJkByjx7XCvLyA3w7UoSzrtoZEwmLf Diff:
Old | New | Differences | |
---|---|---|---|
37 | 37 | ||
38 | 38 | let COURS_ERROR_CERTIFICATE_ALREADY_ISSUED_TEXT = "A certificate has already been issued at your address" | |
39 | 39 | ||
40 | - | func addToHistory (address) = { | |
40 | + | func addAddressToHistory (address) = [BooleanEntry(("history_" + toString(address)), true)] | |
41 | + | ||
42 | + | ||
43 | + | func isAddressInHistory (address) = { | |
41 | 44 | let key = ("history_" + toString(address)) | |
42 | 45 | if ((tryGetString(key) != "")) | |
43 | - | then | |
44 | - | else | |
46 | + | then true | |
47 | + | else false | |
45 | 48 | } | |
46 | 49 | ||
47 | 50 | ||
48 | 51 | @Callable(i) | |
49 | - | func issueNFT (address) = $Tuple2([Issue(COURS_CERTIFICATE_TILE_TEXT, getCoursCertificateDescription(address), 1, 0, false)], unit) | |
52 | + | func issueNFT () = { | |
53 | + | let key = ("history_" + toString(i.caller)) | |
54 | + | if ((tryGetString(key) == "")) | |
55 | + | then $Tuple2([BooleanEntry(("history_" + toString(i.caller)), true), Issue(COURS_CERTIFICATE_TILE_TEXT, getCoursCertificateDescription(toString(i.caller)), 1, 0, false)], unit) | |
56 | + | else throw(COURS_ERROR_CERTIFICATE_ALREADY_ISSUED_TEXT) | |
57 | + | } | |
50 | 58 | ||
51 | 59 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func tryGetString (key) = { | |
5 | 5 | let val = match getString(this, key) { | |
6 | 6 | case b: String => | |
7 | 7 | b | |
8 | 8 | case _ => | |
9 | 9 | "" | |
10 | 10 | } | |
11 | 11 | val | |
12 | 12 | } | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func tryGetInteger (key) = { | |
16 | 16 | let val = match getInteger(this, key) { | |
17 | 17 | case b: Int => | |
18 | 18 | b | |
19 | 19 | case _ => | |
20 | 20 | 0 | |
21 | 21 | } | |
22 | 22 | val | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func isOwner (address) = (address == this) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | let COURS_CERTIFICATE_TILE_TEXT = "NFT Certificate" | |
30 | 30 | ||
31 | 31 | let COURS_CERTIFICATE_DESCRIPTION_LEFT_TEXT = "This NFT certificate certifies the completion of the course for a user with a wallet address of " | |
32 | 32 | ||
33 | 33 | let COURS_CERTIFICATE_DESCRIPTION_RIGHT_TEXT = ". The user has gained in-depth knowledge in understanding the operation of the blockchain, interacting with the exchange, and successfully passed the course exams." | |
34 | 34 | ||
35 | 35 | func getCoursCertificateDescription (address) = ((COURS_CERTIFICATE_DESCRIPTION_LEFT_TEXT + address) + COURS_CERTIFICATE_DESCRIPTION_RIGHT_TEXT) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | let COURS_ERROR_CERTIFICATE_ALREADY_ISSUED_TEXT = "A certificate has already been issued at your address" | |
39 | 39 | ||
40 | - | func addToHistory (address) = { | |
40 | + | func addAddressToHistory (address) = [BooleanEntry(("history_" + toString(address)), true)] | |
41 | + | ||
42 | + | ||
43 | + | func isAddressInHistory (address) = { | |
41 | 44 | let key = ("history_" + toString(address)) | |
42 | 45 | if ((tryGetString(key) != "")) | |
43 | - | then | |
44 | - | else | |
46 | + | then true | |
47 | + | else false | |
45 | 48 | } | |
46 | 49 | ||
47 | 50 | ||
48 | 51 | @Callable(i) | |
49 | - | func issueNFT (address) = $Tuple2([Issue(COURS_CERTIFICATE_TILE_TEXT, getCoursCertificateDescription(address), 1, 0, false)], unit) | |
52 | + | func issueNFT () = { | |
53 | + | let key = ("history_" + toString(i.caller)) | |
54 | + | if ((tryGetString(key) == "")) | |
55 | + | then $Tuple2([BooleanEntry(("history_" + toString(i.caller)), true), Issue(COURS_CERTIFICATE_TILE_TEXT, getCoursCertificateDescription(toString(i.caller)), 1, 0, false)], unit) | |
56 | + | else throw(COURS_ERROR_CERTIFICATE_ALREADY_ISSUED_TEXT) | |
57 | + | } | |
50 | 58 | ||
51 | 59 |
github/deemru/w8io/026f985 25.68 ms ◑