tx · FmhcMWMV8njjv9kvnTVPoSqQgG4EK8nKv1oSAemQy24g 3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm: -0.01000000 Waves 2022.03.09 19:31 [1956653] smart account 3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm > SELF 0.00000000 Waves
{ "type": 13, "id": "FmhcMWMV8njjv9kvnTVPoSqQgG4EK8nKv1oSAemQy24g", "fee": 1000000, "feeAssetId": null, "timestamp": 1646843502829, "version": 2, "chainId": 84, "sender": "3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm", "senderPublicKey": "DKZcYM5WoZ3gBkiAgjzXdfQaZcfisgn2Zn4B226GHMcD", "proofs": [ "3miVw47HfHhT52jJHP3kzg6zLYnGSKUSxM33P3SLYYxz9riyQ3UvG7ArWyuvRrmMKqjdwcgEZAWUxLdT7P7ixxgC" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAAABAAAAANwbXQDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAcQXR0YWNoZWQgcGF5bWVudCBpcyByZXF1aXJlZAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAgY2FuIHVzZSBXQVZFUyBvbmx5IGF0IHRoZSBtb21lbnQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAABNpdGVtX0FfY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAABXByaWNlCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAC5wdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGxlc3MgdGhhbiBpdGVtIHByaWNlAwkAAGYAAAACCAUAAAADcG10AAAABmFtb3VudAUAAAAFcHJpY2UJAAACAAAAAQIAAAAwcHVyY2hhc2UgYW1vdW50IGNhbm5vdCBiZSBoaWdoZXIgdGhhbiBpdGVtIHByaWNlCQAFFAAAAAIJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAACBzdGF0dXM6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzAgAAAAljb25maXJtZWQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAfcHJpY2U6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsBQAAAAR1bml0AAAAAGEHKac=", "height": 1956653, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: FojoH3QYVEtEYvFUCPtgDxLzuUZsjhYRXHSZ2Rfz6Jyn Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func purchase () = { | |
8 | + | let pmt = if ((size(i.payments) == 1)) | |
9 | + | then i.payments[0] | |
10 | + | else throw("Attached payment is required") | |
11 | + | if (isDefined(pmt.assetId)) | |
12 | + | then throw("can use WAVES only at the moment") | |
13 | + | else { | |
14 | + | let customerAddress = toBase58String(i.caller.bytes) | |
15 | + | let price = match getInteger(this, "item_A_coupon_price") { | |
16 | + | case a: Int => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | if ((price > pmt.amount)) | |
22 | + | then throw("purchase amount cannot be less than item price") | |
23 | + | else if ((pmt.amount > price)) | |
24 | + | then throw("purchase amount cannot be higher than item price") | |
25 | + | else $Tuple2([StringEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), IntegerEntry(("price:purchase_item_A_customer_" + customerAddress), price)], unit) | |
26 | + | } | |
27 | + | } | |
28 | + | ||
29 | + |
github/deemru/w8io/026f985 19.26 ms ◑