tx · 3Hgqozmms8nhFcWeLsV6t6D2vhmTuYHYYTNJBM8q3esv

3N2dNRdfSCX65A5GYRDrmfePKyh7GZsxzq6:  -0.01400000 Waves

2019.08.15 17:02 [632272] smart account 3N2dNRdfSCX65A5GYRDrmfePKyh7GZsxzq6 > SELF 0.00000000 Waves

{ "type": 13, "id": "3Hgqozmms8nhFcWeLsV6t6D2vhmTuYHYYTNJBM8q3esv", "fee": 1400000, "feeAssetId": null, "timestamp": 1565877768152, "version": 1, "sender": "3N2dNRdfSCX65A5GYRDrmfePKyh7GZsxzq6", "senderPublicKey": "61eJYrtcz2xtkZSBG5MGML2bMxUXTueo6H1ChqftMdDt", "proofs": [ "5bSzJa3EapaDPuS1eyoJjdiKLdaFjR24QZJwzD2LpQ2DMFnaYVF3mxXb8Sfke6oHCuVHhJDYzREJdKH4c65VayRJ" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAEAAAAKY291cG9uTmFtZQQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIGNhbiB1c2UgV0FWRVMgb25seSBhdCB0aGUgbW9tZW50BAAAAA9jdXN0b21lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAgUAAAAKY291cG9uTmFtZQIAAAABQQQAAAAGcHJpY2VBBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAE2l0ZW1fQV9jb3Vwb25fcHJpY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAAGcHJpY2VBCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAC5wdXJjaGFzZS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RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzAgAAAAljb25maXJtZWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAfcHJpY2U6cHVyY2hhc2VfaXRlbV9CX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAZwcmljZUIFAAAAA25pbAkAAAIAAAABCQABLAAAAAICAAAAJFRoZXJlIGlzIG5vIGNvdXBvbiB3aXRoIGdpdmVuIG5hbWU6IAUAAAAKY291cG9uTmFtZQAAAAAS7wki", "chainId": 84, "height": 632272, "spentComplexity": 0 } View: original | compacted Prev: 5CaaxaStySdMChPKjgd8gvkzcTwizfZiyTtYHzW1mnBR Next: none Diff:
OldNewDifferences
44
55
66 @Callable(i)
7-func purchase () = {
7+func purchase (couponName) = {
88 let pmt = extract(i.payment)
99 if (isDefined(pmt.assetId))
1010 then throw("can use WAVES only at the moment")
1111 else {
1212 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)])
13+ if ((couponName == "A"))
14+ then {
15+ let priceA = match getInteger(this, "item_A_coupon_price") {
16+ case a: Int =>
17+ a
18+ case _ =>
19+ 0
20+ }
21+ if ((priceA > pmt.amount))
22+ then throw("purchase amount cannot be less than item price")
23+ else if ((pmt.amount > priceA))
24+ then throw("purchase amount cannot be higher than item price")
25+ else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), priceA)])
26+ }
27+ else if ((couponName == "B"))
28+ then {
29+ let priceB = match getInteger(this, "item_B_coupon_price") {
30+ case a: Int =>
31+ a
32+ case _ =>
33+ 0
34+ }
35+ if ((priceB > pmt.amount))
36+ then throw("purchase amount cannot be less than item price")
37+ else if ((pmt.amount > priceB))
38+ then throw("purchase amount cannot be higher than item price")
39+ else WriteSet([DataEntry(("status:purchase_item_B_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_B_customer_" + customerAddress), priceB)])
40+ }
41+ else throw(("There is no coupon with given name: " + couponName))
2442 }
2543 }
2644
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
7-func purchase () = {
7+func purchase (couponName) = {
88 let pmt = extract(i.payment)
99 if (isDefined(pmt.assetId))
1010 then throw("can use WAVES only at the moment")
1111 else {
1212 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)])
13+ if ((couponName == "A"))
14+ then {
15+ let priceA = match getInteger(this, "item_A_coupon_price") {
16+ case a: Int =>
17+ a
18+ case _ =>
19+ 0
20+ }
21+ if ((priceA > pmt.amount))
22+ then throw("purchase amount cannot be less than item price")
23+ else if ((pmt.amount > priceA))
24+ then throw("purchase amount cannot be higher than item price")
25+ else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), priceA)])
26+ }
27+ else if ((couponName == "B"))
28+ then {
29+ let priceB = match getInteger(this, "item_B_coupon_price") {
30+ case a: Int =>
31+ a
32+ case _ =>
33+ 0
34+ }
35+ if ((priceB > pmt.amount))
36+ then throw("purchase amount cannot be less than item price")
37+ else if ((pmt.amount > priceB))
38+ then throw("purchase amount cannot be higher than item price")
39+ else WriteSet([DataEntry(("status:purchase_item_B_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_B_customer_" + customerAddress), priceB)])
40+ }
41+ else throw(("There is no coupon with given name: " + couponName))
2442 }
2543 }
2644
2745

github/deemru/w8io/169f3d6 
46.75 ms