tx · 5PWMZNsbL8Aro6A6i1TzKueFgkVBdFdCHHTZMQR4gJJu

3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL:  -0.01400000 Waves

2019.08.27 00:12 [648662] smart account 3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL > SELF 0.00000000 Waves

{ "type": 13, "id": "5PWMZNsbL8Aro6A6i1TzKueFgkVBdFdCHHTZMQR4gJJu", "fee": 1400000, "feeAssetId": null, "timestamp": 1566854042804, "version": 1, "sender": "3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL", "senderPublicKey": "Bkgwt2aKyFdF5sdbTvPhvZkefrs3bpx9htsdCjmWh9LS", "proofs": [ "325f2x9XcPy8efBrLreCTkGGsNzz46LPwQyC3gnvUs2zNimH1AdqeUbkbTDZ9X2kjR6crPibiG3sPAtkiVENSDE7" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAEAAAAIY291cG9uSWQDCQEAAAAJaXNEZWZpbmVkAAAAAQUAAAAIY291cG9uSWQJAAACAAAAAQIAAAAmY2FsbGVyIGhhdmUgdG8gc3BlY2lmeSBjb3Vwb25JZCB0byBidXkEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACBjYW4gdXNlIFdBVkVTIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAPY3VzdG9tZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABXByaWNlBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAIY291cG9uSWQCAAAADV9jb3Vwb25fcHJpY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAANwbXQAAAAGYW1vdW50CQAAAgAAAAECAAAALnB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgbGVzcyB0aGFuIGl0ZW0gcHJpY2UDCQAAZgAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAADBwdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGhpZ2hlciB0aGFuIGl0ZW0gcHJpY2UJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAEHN0YXR1czpwdXJjaGFzZV8FAAAACGNvdXBvbklkAgAAAApfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MCAAAACWNvbmZpcm1lZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAPcHJpY2U6cHVyY2hhc2VfBQAAAAhjb3Vwb25JZAIAAAAKX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsAAAAAA1c1c4=", "chainId": 84, "height": 648662, "spentComplexity": 0 } View: original | compacted Prev: HWni1rFqC78gvVgc876h4X4Dwb8e9JzDbCDzdJtT2ake Next: 4fuYC5uqJNd5GPTBwy42Q3VbfXQ3ryoPKuWmp765SbUi Diff:
OldNewDifferences
44
55
66 @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- }
25- }
7+func purchase (couponId) = if (isDefined(couponId))
8+ then throw("caller have to specify couponId to buy")
9+ else {
10+ let pmt = extract(i.payment)
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, (couponId + "_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 WriteSet([DataEntry(((("status:purchase_" + couponId) + "_customer_") + customerAddress), "confirmed"), DataEntry(((("price:purchase_" + couponId) + "_customer_") + customerAddress), price)])
26+ }
27+ }
2628
2729
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @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- }
25- }
7+func purchase (couponId) = if (isDefined(couponId))
8+ then throw("caller have to specify couponId to buy")
9+ else {
10+ let pmt = extract(i.payment)
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, (couponId + "_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 WriteSet([DataEntry(((("status:purchase_" + couponId) + "_customer_") + customerAddress), "confirmed"), DataEntry(((("price:purchase_" + couponId) + "_customer_") + customerAddress), price)])
26+ }
27+ }
2628
2729

github/deemru/w8io/026f985 
32.96 ms