tx · Gt2NH17aJycRZQR3UqjybJQXiPRQrhjg422VcCQxBJRX

3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe:  -0.00100000 Waves

2022.09.19 17:44 [2236145] smart account 3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe > SELF 0.00000000 Waves

{ "type": 13, "id": "Gt2NH17aJycRZQR3UqjybJQXiPRQrhjg422VcCQxBJRX", "fee": 100000, "feeAssetId": null, "timestamp": 1663598662240, "version": 2, "chainId": 84, "sender": "3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe", "senderPublicKey": "FFVf3kC6HkjRMmf8W6Zr2bNKhJ5EN5W1vG44GbgvHd9Z", "proofs": [ "5tbLLkgFfdSSBx3kNxHWntjBhaykiM6uKuGYVmm5Hpa9VHFippmeXRgH1DfAeZkBTucySnXLph159LeQAEak2i5W" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAABAAAACkNvdXBvblR5cGUEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACBjYW4gdXNlIFdBVkVTIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAPY3VzdG9tZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABXByaWNlBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgkAASwAAAACAgAAAAVJdGVtXwUAAAAKQ291cG9uVHlwZQIAAAANX2NvdXBvbl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlCQAAAgAAAAECAAAAKVB1cmNoYXNlIGFtb3VudCBzaG91bGQgYmUgZXF1YWwgdG8gcHJpY2UgCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABZzdGF0dXM6IHB1cmNoYXNlX2l0ZW1fBQAAAApDb3Vwb25UeXBlAgAAAApfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MCAAAACWNvbmZpcm1lZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAVcHJpY2U6IHB1cmNoYXNlX2l0ZW1fBQAAAApDb3Vwb25UeXBlAgAAAApfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MFAAAABXByaWNlBQAAAANuaWwAAAAArN32Dw==", "height": 2236145, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B7hkcnyvHN66SqHNnEEEBaTSBHVfAnxAV7Fd9UvUeFNu Next: G6DAxYWgrrwBWBFg4uwSHuQHzqxV8y7fjyjruXmhRAJf Diff:
OldNewDifferences
44
55
66 @Callable(i)
7-func purchase () = {
7+func purchase (CouponType) = {
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") {
13+ let price = match getInteger(this, (("Item_" + CouponType) + "_coupon_price")) {
1414 case a: Int =>
1515 a
1616 case _ =>
1818 }
1919 if ((pmt.amount != price))
2020 then throw("Purchase amount should be equal to price ")
21- else WriteSet([DataEntry(("status: purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price: purchase_item_A_customer_" + customerAddress), price)])
21+ else WriteSet([DataEntry(((("status: purchase_item_" + CouponType) + "_customer_") + customerAddress), "confirmed"), DataEntry(((("price: purchase_item_" + CouponType) + "_customer_") + customerAddress), price)])
2222 }
2323 }
2424
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 (CouponType) = {
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") {
13+ let price = match getInteger(this, (("Item_" + CouponType) + "_coupon_price")) {
1414 case a: Int =>
1515 a
1616 case _ =>
1717 0
1818 }
1919 if ((pmt.amount != price))
2020 then throw("Purchase amount should be equal to price ")
21- else WriteSet([DataEntry(("status: purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price: purchase_item_A_customer_" + customerAddress), price)])
21+ else WriteSet([DataEntry(((("status: purchase_item_" + CouponType) + "_customer_") + customerAddress), "confirmed"), DataEntry(((("price: purchase_item_" + CouponType) + "_customer_") + customerAddress), price)])
2222 }
2323 }
2424
2525

github/deemru/w8io/169f3d6 
31.01 ms