tx · Dvp6AtajZnqKHFheJ8tQ1wpsf4ZQb9og2YLyKn79zFTp

3ND6EFqVoR6r9jWRL87nSf2Zs5AMiNnGWD3:  -0.01000000 Waves

2021.07.05 13:09 [1600148] smart account 3ND6EFqVoR6r9jWRL87nSf2Zs5AMiNnGWD3 > SELF 0.00000000 Waves

{ "type": 13, "id": "Dvp6AtajZnqKHFheJ8tQ1wpsf4ZQb9og2YLyKn79zFTp", "fee": 1000000, "feeAssetId": null, "timestamp": 1625479766298, "version": 2, "chainId": 84, "sender": "3ND6EFqVoR6r9jWRL87nSf2Zs5AMiNnGWD3", "senderPublicKey": "KUUrvP3E8GJqJe8m89JhbWoFxA5Y6ZArXcUs6XDthT6", "proofs": [ "3G8feckyWBBntUNxPDsNruqJhRj5FrBY5kfr7ry62eiQSNmmQMU1PCY3BQqPwdCUxYgSNfTLZsaU8sErvEGqB5bG" ], "script": "base64:AAIDAAAAAAAAAHMIARIECgIICBIDCgEIGgcKAmExEgFpGgkKAmEyEgNrZXkaCgoCYTMSBG5hbWUaCQoCYTQSA3BtdBoUCgJhNRIOY3V0b21lckFkZHJlc3MaCwoCYTYSBXByaWNlGg0KAmE3EgckbWF0Y2gwGgcKAmE4EgFhAAAAAAAAAAIAAAACYTEBAAAACWFkZGNvdXBvbgAAAAIAAAACYTIAAAACYTMJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAVpdGVtXwUAAAACYTICAAAADF9jb3Vwb25fbmFtZQUAAAACYTMJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAVpdGVtXwUAAAACYTICAAAADV9jb3Vwb25fcHJpY2UAAAAAAAAAAAMFAAAAA25pbAAAAAJhMQEAAAAIcHVyY2hhc2UAAAABAAAAAmEyBAAAAAJhNAkBAAAAB2V4dHJhY3QAAAABCAUAAAACYTEAAAAHcGF5bWVudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAACYTQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACBDYW4gdXNlIHdhdmVzIG9ubHkgYXQgdGhlIG1vbWVudAQAAAACYTUJAAJYAAAAAQgIBQAAAAJhMQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAAmE2BAAAAAJhNwkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgIAAAAFaXRlbV8FAAAAAmEyAgAAAA1fY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAJhNwIAAAADSW50BAAAAAJhOAUAAAACYTcFAAAAAmE4AAAAAAAAAAAAAwkAAGYAAAACBQAAAAJhNggFAAAAAmE0AAAABmFtb3VudAkAAAIAAAABAgAAAC5QdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGxlc3MgdGhlbiBpdGVtIHByaWNlAwkAAGYAAAACCAUAAAACYTQAAAAGYW1vdW50BQAAAAJhNgkAAAIAAAABAgAAAC5QdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGxlc3MgdGhlbiBpdGVtIHByaWNlCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABVzdGF0dXM6cHVyY2hhc2VfaXRlbV8FAAAAAmEyAgAAAApfY3VzdG9tZXJfBQAAAAJhNQIAAAAJY29uZmlybWVkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABRwcmljZTpwdXJjaGFzZV9pdGVtXwUAAAACYTICAAAACl9jdXN0b21lcl8FAAAAAmE1BQAAAAJhNgUAAAADbmlsAAAAAL5Ltzc=", "height": 1600148, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Yuki6ajARw85Y2rEHkV2xkYTbLCLqwNdNVJAVKQvABh Next: GaKGnfCY9v2xN684AoLBqMn5mE8zGVxwihPf5eciB6T3 Diff:
OldNewDifferences
44
55
66 @Callable(i)
7-func addcoupon () = WriteSet([DataEntry("item_A_coupon_name", "Hotel_Rooom"), DataEntry("item_A_coupon_price", 3)])
7+func addcoupon (key,name) = WriteSet([DataEntry((("item_" + key) + "_coupon_name"), name), DataEntry((("item_" + key) + "_coupon_price"), 3)])
88
99
1010
1111 @Callable(i)
12-func purchase () = {
12+func purchase (key) = {
1313 let pmt = extract(i.payment)
1414 if (isDefined(pmt.assetId))
1515 then throw("Can use waves only at the moment")
1616 else {
1717 let cutomerAddress = toBase58String(i.caller.bytes)
18- let price = match getInteger(this, "item_A_coupon_price") {
18+ let price = match getInteger(this, (("item_" + key) + "_coupon_price")) {
1919 case a: Int =>
2020 a
2121 case _ =>
2525 then throw("Purchase amount cannot be less then item price")
2626 else if ((pmt.amount > price))
2727 then throw("Purchase amount cannot be less then item price")
28- else WriteSet([DataEntry(("status:purchase_item_A_customer_" + cutomerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + cutomerAddress), price)])
28+ else WriteSet([DataEntry(((("status:purchase_item_" + key) + "_customer_") + cutomerAddress), "confirmed"), DataEntry(((("price:purchase_item_" + key) + "_customer_") + cutomerAddress), price)])
2929 }
3030 }
3131
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
7-func addcoupon () = WriteSet([DataEntry("item_A_coupon_name", "Hotel_Rooom"), DataEntry("item_A_coupon_price", 3)])
7+func addcoupon (key,name) = WriteSet([DataEntry((("item_" + key) + "_coupon_name"), name), DataEntry((("item_" + key) + "_coupon_price"), 3)])
88
99
1010
1111 @Callable(i)
12-func purchase () = {
12+func purchase (key) = {
1313 let pmt = extract(i.payment)
1414 if (isDefined(pmt.assetId))
1515 then throw("Can use waves only at the moment")
1616 else {
1717 let cutomerAddress = toBase58String(i.caller.bytes)
18- let price = match getInteger(this, "item_A_coupon_price") {
18+ let price = match getInteger(this, (("item_" + key) + "_coupon_price")) {
1919 case a: Int =>
2020 a
2121 case _ =>
2222 0
2323 }
2424 if ((price > pmt.amount))
2525 then throw("Purchase amount cannot be less then item price")
2626 else if ((pmt.amount > price))
2727 then throw("Purchase amount cannot be less then item price")
28- else WriteSet([DataEntry(("status:purchase_item_A_customer_" + cutomerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + cutomerAddress), price)])
28+ else WriteSet([DataEntry(((("status:purchase_item_" + key) + "_customer_") + cutomerAddress), "confirmed"), DataEntry(((("price:purchase_item_" + key) + "_customer_") + cutomerAddress), price)])
2929 }
3030 }
3131
3232

github/deemru/w8io/026f985 
40.39 ms