tx · 9DAqreucRx51th2PcxqXPmZwMjqdR3MQEEWdRsDfxPAK

3MviJMF4qeNVjYE5dP5vS1kw2D6nqq8gYdP:  -0.01400000 Waves

2019.06.25 09:02 [557236] smart account 3MviJMF4qeNVjYE5dP5vS1kw2D6nqq8gYdP > SELF 0.00000000 Waves

{ "type": 13, "id": "9DAqreucRx51th2PcxqXPmZwMjqdR3MQEEWdRsDfxPAK", "fee": 1400000, "feeAssetId": null, "timestamp": 1561442542969, "version": 1, "sender": "3MviJMF4qeNVjYE5dP5vS1kw2D6nqq8gYdP", "senderPublicKey": "4YoPLh2RSxZJ5gZ1Q2AbpY8MRg71SGbqFC1dsusDjSs6", "proofs": [ "4veEZPbXpcM4zUaZCPVwnwMoxXMFi7karrQm7Pr7NvVQXDnoMnwkj5JTbTNxT3tooddHtDrzu5PX7DBxkSg7vfz6" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAA9vd25lclB1YmxpY2tLZXkBAAAAINAm5XUgnXI2F/C3jS2g12iVY9hP+3Jw26q/jnqGHDYUAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACBjYW4gdXNlIFdBVlJTIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAPY3VzdG9tZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABXByaWNlBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAE2l0ZW1fQV9jb3Vwb25fcHJpY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAANwbXQAAAAGYW1vdW50CQAAAgAAAAECAAAALnB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYnkgbGVzcyB0aGFuIGl0ZW0gcHJpY2UDCQAAZgAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAADBwdXJjaGFzZSBhbW91bnQgY2Fubm90IGJ5IGhpZ2hlciB0aGFuIGl0ZW0gcHJpY2UJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAgc3RhdHVzOnB1cmNoYXNlX2l0ZW1fQV9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwIAAAAJY29uZmlybWVkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAAH3ByaWNlOnB1cmNoYXNlX2l0ZW1fQV9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwUAAAAFcHJpY2UFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcml2eQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABlTZXRBc3NldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPb3duZXJQdWJsaWNrS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGB/yN0m8=", "chainId": 84, "height": 557236, "spentComplexity": 0 } View: original | compacted Prev: 9bKHuBpmRZcvp4F4VDGrMbwsNrNZSADc9WXdSUq8pTKf Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let NONE = "none"
4+let ownerPublickKey = base58'F1YCfxUbn5koBMjxuA4iGzudDF5c69T5EUXgkudQ9FVM'
55
6-func getNumberByKey (key) = {
7- let num = match getInteger(this, key) {
8- case a: Int =>
9- a
10- case _ =>
11- 0
12- }
13- num
6+@Callable(i)
7+func purchase () = {
8+ let pmt = extract(i.payment)
9+ if (isDefined(pmt.assetId))
10+ then throw("can use WAVRS 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 by less than item price")
21+ else if ((pmt.amount > price))
22+ then throw("purchase amount cannot by higher than item price")
23+ else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)])
24+ }
1425 }
1526
1627
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 getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
32-
33-
34-func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
35-
36-
37-func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
38-
39-
40-func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
41-
42-
43-func getKeyItemData (item) = (item + "_data")
44-
45-
46-func getKeyItemSupplier (item) = (item + "_owner")
47-
48-
49-func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
50-
51-
52-func getKeyBalanceSupplier (account) = (account + "_balance")
53-
54-
55-func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
56-
57-
58-@Callable(i)
59-func addItem (title,price,data) = {
60- let supplierAddress = toBase58String(i.caller.bytes)
61- let item = getKeyItem(supplierAddress, title)
62- if ((0 >= price))
63- then throw("purchase amount cannot be less then item price")
64- else if ((getValueItemSupplier(item) != NONE))
65- then throw("an item is already exist")
66- else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
67- }
68-
28+@Verifier(tx)
29+func verivy () = match tx {
30+ case d: SetAssetScriptTransaction =>
31+ sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublickKey)
32+ case d: DataTransaction =>
33+ true
34+ case _ =>
35+ false
36+}
6937

github/deemru/w8io/169f3d6 
37.67 ms