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:AAIFAAAAAAAAAAQIAhIAAAAACgEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAABQAAAAN2YWwBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAAB2lzT3duZXIAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwAAAAAbQ09VUlNfQ0VSVElGSUNBVEVfVElMRV9URVhUAgAAAA9ORlQgQ2VydGlmaWNhdGUAAAAAJ0NPVVJTX0NFUlRJRklDQVRFX0RFU0NSS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FAAAAB2FkZHJlc3MDCQEAAAACIT0AAAACCQEAAAAMdHJ5R2V0U3RyaW5nAAAAAQUAAAADa2V5AgAAAAAGBwAAAAEAAAABaQEAAAAIaXNzdWVORlQAAAAABAAAAANrZXkJAAEsAAAAAgIAAAAIaGlzdG9yeV8JAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyAwkAAAAAAAACCQEAAAAMdHJ5R2V0U3RyaW5nAAAAAQUAAAADa2V5AgAAAAAJAAUUAAAAAgkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgkAASwAAAACAgAAAAhoaXN0b3J5XwkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIGCQAETAAAAAIJAARCAAAABQUAAAAbQ09VUlNfQ0VSVElGSUNBVEVfVElMRV9URVhUCQEAAAAeZ2V0Q291cnNDZXJ0aWZpY2F0ZURlc2NyaXB0aW9uAAAAAQkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEAAAAAAAAAAAAHBQAAAANuaWwFAAAABHVuaXQJAAACAAAAAQUAAAArQ09VUlNfRVJST1JfQ0VSVElGSUNBVEVfQUxSRUFEWV9JU1NVRURfVEVYVAAAAAD3pUJT", "height": 2161024, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DLsfAkjiWUtxPCqWLaHeq4xZ7sWhcrtgQLGmzm7j3Bhh Next: 8NKSvYajriK4GDqJkByjx7XCvLyA3w7UoSzrtoZEwmLf Diff:
OldNewDifferences
3737
3838 let COURS_ERROR_CERTIFICATE_ALREADY_ISSUED_TEXT = "A certificate has already been issued at your address"
3939
40-func addToHistory (address) = {
40+func addAddressToHistory (address) = [BooleanEntry(("history_" + toString(address)), true)]
41+
42+
43+func isAddressInHistory (address) = {
4144 let key = ("history_" + toString(address))
4245 if ((tryGetString(key) != ""))
43- then throw(COURS_ERROR_CERTIFICATE_ALREADY_ISSUED_TEXT)
44- else [BooleanEntry(key, true)]
46+ then true
47+ else false
4548 }
4649
4750
4851 @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+ }
5058
5159
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func tryGetString (key) = {
55 let val = match getString(this, key) {
66 case b: String =>
77 b
88 case _ =>
99 ""
1010 }
1111 val
1212 }
1313
1414
1515 func tryGetInteger (key) = {
1616 let val = match getInteger(this, key) {
1717 case b: Int =>
1818 b
1919 case _ =>
2020 0
2121 }
2222 val
2323 }
2424
2525
2626 func isOwner (address) = (address == this)
2727
2828
2929 let COURS_CERTIFICATE_TILE_TEXT = "NFT Certificate"
3030
3131 let COURS_CERTIFICATE_DESCRIPTION_LEFT_TEXT = "This NFT certificate certifies the completion of the course for a user with a wallet address of "
3232
3333 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."
3434
3535 func getCoursCertificateDescription (address) = ((COURS_CERTIFICATE_DESCRIPTION_LEFT_TEXT + address) + COURS_CERTIFICATE_DESCRIPTION_RIGHT_TEXT)
3636
3737
3838 let COURS_ERROR_CERTIFICATE_ALREADY_ISSUED_TEXT = "A certificate has already been issued at your address"
3939
40-func addToHistory (address) = {
40+func addAddressToHistory (address) = [BooleanEntry(("history_" + toString(address)), true)]
41+
42+
43+func isAddressInHistory (address) = {
4144 let key = ("history_" + toString(address))
4245 if ((tryGetString(key) != ""))
43- then throw(COURS_ERROR_CERTIFICATE_ALREADY_ISSUED_TEXT)
44- else [BooleanEntry(key, true)]
46+ then true
47+ else false
4548 }
4649
4750
4851 @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+ }
5058
5159

github/deemru/w8io/026f985 
25.52 ms