tx · 8UbejayJi9LVB82mvqJxikTYhtgoJ7D5vNPWLksotApM

3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D:  -0.01000000 Waves

2019.06.22 14:35 [553190] smart account 3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D > SELF 0.00000000 Waves

{ "type": 13, "id": "8UbejayJi9LVB82mvqJxikTYhtgoJ7D5vNPWLksotApM", "fee": 1000000, "feeAssetId": null, "timestamp": 1561203324523, "version": 1, "sender": "3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D", "senderPublicKey": "BJRaSW2saRv7CcFs3mSYpaVFQSFpZq9rGKnCcRKuKgWv", "proofs": [ "2Za1aGfgtj4g5oYxuxJNUs1jAPoZveoV8uE4oWdHDE6mEYKoJfgLuk2Jy7NXunmS29oyrtNCVx1JLDf8ANBnTnLB" ], "script": "base64:AAIDAAAAAAAAAAAAAAAHAAAAAAROT05FAgAAAARub25lAQAAAApnZXRLZXlJdGVtAAAAAgAAAAhzdXBwbGllcgAAAAV0aXRsZQkAASwAAAACAgAAAAVpdGVtXwkAAlgAAAABCQAB9wAAAAEJAAGbAAAAAQkAASwAAAACBQAAAAhzdXBwbGllcgUAAAAFdGl0bGUBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfb3duZXIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAADmdldEtleUl0ZW1EYXRhAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABV9kYXRhAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5P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HJlc3MCAAAACWNvbmZpcm1lZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAUcHJpY2U6cHVyY2hhc2VfaXRlbV8FAAAABHR5cGUCAAAACl9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwUAAAAFcHJpY2UFAAAAA25pbAAAAAFpAQAAAAdhZGRJdGVtAAAAAwAAAAV0aXRsZQAAAAVwcmljZQAAAARkYXRhBAAAAA9zdXBwbGllckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAEaXRlbQkBAAAACmdldEtleUl0ZW0AAAACBQAAAA9zdXBwbGllckFkZHJlc3MFAAAABXRpdGxlAwkAAGcAAAACAAAAAAAAAAAABQAAAAVwcmljZQkAAAIAAAABAgAAAC5wdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGxlc3MgdGhhbiBpdGVtIHByaWNlAwkBAAAAAiE9AAAAAgkBAAAAFGdldFZhbHVlSXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAETk9ORQkAAAIAAAABAgAAABlhbiBpdGVtcyBpcyBhbHJlYWR5IGV4aXN0CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAPc3VwcGxpZXJBZGRyZXNzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQUAAAAEaXRlbQUAAAAFcHJpY2UJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEFAAAAA25pbAAAAACSJs3s", "chainId": 84, "height": 553190, "spentComplexity": 0 } View: original | compacted Prev: none Next: EKC61cF24UvhESRWABKAvwmG1BiZ1EMjb7zDrUh39kdc Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let NONE = "none"
5+
6+func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
7+
8+
9+func getKeyItemSupplier (item) = (item + "_owner")
10+
11+
12+func getKeyItemPrice (item) = (item + "_price")
13+
14+
15+func getKeyItemData (item) = (item + "_data")
16+
17+
18+func getStrByKey (key) = {
19+ let str = match getString(this, key) {
20+ case a: String =>
21+ a
22+ case _ =>
23+ NONE
24+ }
25+ str
26+ }
27+
28+
29+func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
30+
31+
32+@Callable(i)
33+func purchase (type) = {
34+ let pmt = extract(i.payment)
35+ if (isDefined(pmt.assetId))
36+ then throw("can use WAVES only at the moment")
37+ else {
38+ let customerAddress = toBase58String(i.caller.bytes)
39+ let price = match getInteger(this, (("item_" + type) + "_coupon_price")) {
40+ case a: Int =>
41+ a
42+ case _ =>
43+ 0
44+ }
45+ if ((price > pmt.amount))
46+ then throw("purschase amount cannot be less than item price")
47+ else if ((pmt.amount > price))
48+ then throw("purchase amount cannot be higher than item price")
49+ else WriteSet([DataEntry(((("status:purchase_item_" + type) + "_customer_") + customerAddress), "confirmed"), DataEntry(((("price:purchase_item_" + type) + "_customer_") + customerAddress), price)])
50+ }
51+ }
52+
53+
54+
55+@Callable(i)
56+func addItem (title,price,data) = {
57+ let supplierAddress = toBase58String(i.caller.bytes)
58+ let item = getKeyItem(supplierAddress, title)
59+ if ((0 >= price))
60+ then throw("purchase amount cannot be less than item price")
61+ else if ((getValueItemSupplier(item) != NONE))
62+ then throw("an items is already exist")
63+ else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
64+ }
65+
66+

github/deemru/w8io/169f3d6 
20.81 ms