tx · EpTmyJ6r24SMT7ieV7nSVKhN5KHFyD9rrzimmSDEdCVQ

3NBvST4wVNnQSw9zjvfMrirCY5dxG3widc9:  -0.00600000 Waves

2022.08.17 11:16 [2188217] smart account 3NBvST4wVNnQSw9zjvfMrirCY5dxG3widc9 > SELF 0.00000000 Waves

{ "type": 13, "id": "EpTmyJ6r24SMT7ieV7nSVKhN5KHFyD9rrzimmSDEdCVQ", "fee": 600000, "feeAssetId": null, "timestamp": 1660724027786, "version": 2, "chainId": 84, "sender": "3NBvST4wVNnQSw9zjvfMrirCY5dxG3widc9", "senderPublicKey": "Ftxutnk5AzF4S1j6ZGLYyYLdmN2XzrRSS5EjwH4qJm4N", "proofs": [ "2a9HM16AEQkCnD3qzpZ9B3Jo1dKKEeKe2KS3mWnhrtNBkQX5XFJDKAaTiqvjgALxFgcmb1oHLViufHwVxjjBxYjp" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQgAAAACAQAAAA1nZXRBc3NldEJ5dGVzAAAAAQAAAAphc3NldElkU3RyAwkAAAAAAAACBQAAAAphc3NldElkU3RyAgAAAAVXQVZFUwUAAAAEdW5pdAkAAlkAAAABBQAAAAphc3NldElkU3RyAQAAAA5nZXRBc3NldFN0cmluZwAAAAEAAAAHYXNzZXRJZAQAAAAHJG1hdGNoMAUAAAAHYXNzZXRJZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABYgUAAAAHJG1hdGNoMAkAAlgAAAABBQAAAAFiAgAAAAVXQVZFUwAAAAIAAAABaQEAAAAHYWRkSXRlbQAAAAAEAAAAB3Rva2VuSWQICQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAAAAB2Fzc2V0SWQEAAAABmFtb3VudAgJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAAAAAGYW1vdW50BAAAAAh1bmlxdWVJZAkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAACHVuaXF1ZUlkAgAAAAZfY291bnQFAAAABmFtb3VudAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIFAAAACHVuaXF1ZUlkAgAAAAhfdG9rZW5JZAkBAAAADmdldEFzc2V0U3RyaW5nAAAAAQUAAAAHdG9rZW5JZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIFAAAACHVuaXF1ZUlkAgAAAAVvd25lcgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIFAAAAA25pbAAAAAFpAQAAAAdidXlJdGVtAAAAAQAAAAh1bmlxdWVJZAQAAAAHdG9rZW5JZAkBAAAAEUBleHRyTmF0aXZlKDEwNTgpAAAAAQkAASwAAAACBQAAAAh1bmlxdWVJZAIAAAAIX3Rva2VuSWQEAAAABmFtb3VudAkBAAAAEUBleHRyTmF0aXZlKDEwNTUpAAAAAQkAASwAAAACBQAAAAh1bmlxdWVJZAIAAAAGX2NvdW50CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50CQEAAAANZ2V0QXNzZXRCeXRlcwAAAAEFAAAAB3Rva2VuSWQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5G3/vlQ==", "height": 2188217, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Fs5wRXxMiP3Jfjcj15XwNh4yKPrv2sgaNL9TCsiw2Uw7 Next: none Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+func getAssetBytes (assetIdStr) = if ((assetIdStr == "WAVES"))
5+ then unit
6+ else fromBase58String(assetIdStr)
7+
8+
9+func getAssetString (assetId) = match assetId {
10+ case b: ByteVector =>
11+ toBase58String(b)
12+ case _ =>
13+ "WAVES"
14+}
415
516
617 @Callable(i)
7-func addItem (uniqueId,count,price) = [IntegerEntry((uniqueId + "_count"), count), IntegerEntry((uniqueId + "_price"), price)]
18+func addItem () = {
19+ let tokenId = i.payments[0].assetId
20+ let amount = i.payments[0].amount
21+ let uniqueId = toBase58String(i.transactionId)
22+[IntegerEntry((uniqueId + "_count"), amount), StringEntry((uniqueId + "_tokenId"), getAssetString(tokenId)), StringEntry((uniqueId + "owner"), toString(i.caller))]
23+ }
824
925
1026
1127 @Callable(i)
12-func changeItemPrice () = nil
13-
14-
15-
16-@Callable(i)
17-func buyItem () = nil
28+func buyItem (uniqueId) = {
29+ let tokenId = getStringValue((uniqueId + "_tokenId"))
30+ let amount = getIntegerValue((uniqueId + "_count"))
31+[ScriptTransfer(i.caller, amount, getAssetBytes(tokenId))]
32+ }
1833
1934
2035 @Verifier(tx)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+func getAssetBytes (assetIdStr) = if ((assetIdStr == "WAVES"))
5+ then unit
6+ else fromBase58String(assetIdStr)
7+
8+
9+func getAssetString (assetId) = match assetId {
10+ case b: ByteVector =>
11+ toBase58String(b)
12+ case _ =>
13+ "WAVES"
14+}
415
516
617 @Callable(i)
7-func addItem (uniqueId,count,price) = [IntegerEntry((uniqueId + "_count"), count), IntegerEntry((uniqueId + "_price"), price)]
18+func addItem () = {
19+ let tokenId = i.payments[0].assetId
20+ let amount = i.payments[0].amount
21+ let uniqueId = toBase58String(i.transactionId)
22+[IntegerEntry((uniqueId + "_count"), amount), StringEntry((uniqueId + "_tokenId"), getAssetString(tokenId)), StringEntry((uniqueId + "owner"), toString(i.caller))]
23+ }
824
925
1026
1127 @Callable(i)
12-func changeItemPrice () = nil
13-
14-
15-
16-@Callable(i)
17-func buyItem () = nil
28+func buyItem (uniqueId) = {
29+ let tokenId = getStringValue((uniqueId + "_tokenId"))
30+ let amount = getIntegerValue((uniqueId + "_count"))
31+[ScriptTransfer(i.caller, amount, getAssetBytes(tokenId))]
32+ }
1833
1934
2035 @Verifier(tx)
2136 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
2237

github/deemru/w8io/026f985 
25.00 ms