tx · E4hnHnqqXTGSuC6mGyswzT6Du8GRcCJHKHjtk1UqHgRY

3Mrm2Y65tQHXfGxscQKTNc8ezxczedMDcnk:  -0.01400000 Waves

2019.09.18 12:26 [681514] smart account 3Mrm2Y65tQHXfGxscQKTNc8ezxczedMDcnk > SELF 0.00000000 Waves

{ "type": 13, "id": "E4hnHnqqXTGSuC6mGyswzT6Du8GRcCJHKHjtk1UqHgRY", "fee": 1400000, "feeAssetId": null, "timestamp": 1568798817904, "version": 1, "sender": "3Mrm2Y65tQHXfGxscQKTNc8ezxczedMDcnk", "senderPublicKey": "Fxiie4GD9XKqtFXMHFgiDJTqvfZP1xSgdYbS7ZQtq4RW", "proofs": [ "3Nrw3i1JR9i9NMEQYRvLQf3hEyUt97TYCKaZKe1ZFWe4tsdqzErx5b2NcNoA8KhyM1YnMD5GNSmSw5shBQRbupDq" ], "script": "base64:AAIDAAAAAAAAAAAAAAAIAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfb3duZXIBAAAAFGdldFZhb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AAAACURhdGFFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEFAAAAA25pbAAAAAD7ewqa", "chainId": 84, "height": 681514, "spentComplexity": 0 } View: original | compacted Prev: AhLKmPrrsKtK6Xby4FXJkd1axr3amE3TRumtKUNY42vc Next: F7oPxdRuk7feFxoivJh5aaPVEcxzZpg3cqLQDV5ZWzS9 Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let NONE = "none"
5+
6+func getNumberByKey (key) = {
7+ let num = match getInteger(this, key) {
8+ case a: Int =>
9+ a
10+ case _ =>
11+ 0
12+ }
13+ num
14+ }
15+
16+
17+func getStrByKey (key) = {
18+ let str = match getString(this, key) {
19+ case a: String =>
20+ a
21+ case _ =>
22+ NONE
23+ }
24+ str
25+ }
26+
27+
28+func getKeyItemPrice (item) = (item + "_price")
29+
30+
31+func getKeyItemSupplier (item) = (item + "_owner")
32+
33+
34+func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
35+
36+
37+func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
38+
39+
40+func getKeyItemData (item) = (item + "_data")
441
542
643 @Callable(i)
7-func purchase () = {
8- let pmt = extract(i.payment)
9- if (isDefined(pmt.assetId))
10- then throw("can use WAVES only at the moment")
11- else {
12- let customerAddress = toBase58String(i.caller.bytes)
13- let price = match getInteger(this, "item_A_coupon_price") {
14- case a: Int =>
15- a
16- case _ =>
17- 0
18- }
19- if ((price > pmt.amount))
20- then throw("purchase amount cannot be less than item price")
21- else if ((pmt.amount > price))
22- then throw("purchase amount cannot be higher than item price")
23- else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)])
24- }
44+func addItem (title,price,data) = {
45+ let supplierAddress = toBase58String(i.caller.bytes)
46+ let item = getKeyItem(supplierAddress, title)
47+ if ((0 >= price))
48+ then throw("Purchase amount cannot be less than item price.")
49+ else if ((getValueItemSupplier(item) != NONE))
50+ then throw("Ann item is already exist.")
51+ else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
2552 }
2653
2754

github/deemru/w8io/026f985 
34.74 ms