tx · FojoH3QYVEtEYvFUCPtgDxLzuUZsjhYRXHSZ2Rfz6Jyn

3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm:  -0.01000000 Waves

2022.03.10 20:07 [1958124] smart account 3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm > SELF 0.00000000 Waves

{ "type": 13, "id": "FojoH3QYVEtEYvFUCPtgDxLzuUZsjhYRXHSZ2Rfz6Jyn", "fee": 1000000, "feeAssetId": null, "timestamp": 1646932144274, "version": 2, "chainId": 84, "sender": "3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm", "senderPublicKey": "DKZcYM5WoZ3gBkiAgjzXdfQaZcfisgn2Zn4B226GHMcD", "proofs": [ "5EoPtiQHKDeGMMgvZDHWcV22MafsCJ3KQjYRSXbDe3qHzC2WdDm1LJYs2M12dntwsmPdE8cR4K7PLbgRd2eVpZzm" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAABAAAAC2FjY291bnROYW1lBAAAAANwbXQDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAcQXR0YWNoZWQgcGF5bWVudCBpcyByZXF1aXJlZAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAgY2FuIHVzZSBXQVZFUyBvbmx5IGF0IHRoZSBtb21lbnQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgIAAAAFaXRlbV8FAAAAC2FjY291bnROYW1lAgAAAA1fY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAABXByaWNlCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAC5wdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGxlc3MgdGhhbiBpdGVtIHByaWNlAwkAAGYAAAACCAUAAAADcG10AAAABmFtb3VudAUAAAAFcHJpY2UJAAACAAAAAQIAAAAwcHVyY2hhc2UgYW1vdW50IGNhbm5vdCBiZSBoaWdoZXIgdGhhbiBpdGVtIHByaWNlCQAFFAAAAAIJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAVc3RhdHVzOnB1cmNoYXNlX2l0ZW1fBQAAAAthY2NvdW50TmFtZQIAAAAKX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzAgAAAAljb25maXJtZWQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAFHByaWNlOnB1cmNoYXNlX2l0ZW1fBQAAAAthY2NvdW50TmFtZQIAAAAKX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsBQAAAAR1bml0AAAAAAKF6zE=", "height": 1958124, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FmhcMWMV8njjv9kvnTVPoSqQgG4EK8nKv1oSAemQy24g Next: FnX4UMjsbX962AT8hbUpmgXe8f6Yfu5PSKr275rTp2ab Diff:
OldNewDifferences
44
55
66 @Callable(i)
7-func purchase () = {
7+func purchase (accountName) = {
88 let pmt = if ((size(i.payments) == 1))
99 then i.payments[0]
1010 else throw("Attached payment is required")
1212 then throw("can use WAVES only at the moment")
1313 else {
1414 let customerAddress = toBase58String(i.caller.bytes)
15- let price = match getInteger(this, "item_A_coupon_price") {
15+ let price = match getInteger(this, (("item_" + accountName) + "_coupon_price")) {
1616 case a: Int =>
1717 a
1818 case _ =>
2222 then throw("purchase amount cannot be less than item price")
2323 else if ((pmt.amount > price))
2424 then throw("purchase amount cannot be higher than item price")
25- else $Tuple2([StringEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), IntegerEntry(("price:purchase_item_A_customer_" + customerAddress), price)], unit)
25+ else $Tuple2([StringEntry(((("status:purchase_item_" + accountName) + "_customer_") + customerAddress), "confirmed"), IntegerEntry(((("price:purchase_item_" + accountName) + "_customer_") + customerAddress), price)], unit)
2626 }
2727 }
2828
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
7-func purchase () = {
7+func purchase (accountName) = {
88 let pmt = if ((size(i.payments) == 1))
99 then i.payments[0]
1010 else throw("Attached payment is required")
1111 if (isDefined(pmt.assetId))
1212 then throw("can use WAVES only at the moment")
1313 else {
1414 let customerAddress = toBase58String(i.caller.bytes)
15- let price = match getInteger(this, "item_A_coupon_price") {
15+ let price = match getInteger(this, (("item_" + accountName) + "_coupon_price")) {
1616 case a: Int =>
1717 a
1818 case _ =>
1919 0
2020 }
2121 if ((price > pmt.amount))
2222 then throw("purchase amount cannot be less than item price")
2323 else if ((pmt.amount > price))
2424 then throw("purchase amount cannot be higher than item price")
25- else $Tuple2([StringEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), IntegerEntry(("price:purchase_item_A_customer_" + customerAddress), price)], unit)
25+ else $Tuple2([StringEntry(((("status:purchase_item_" + accountName) + "_customer_") + customerAddress), "confirmed"), IntegerEntry(((("price:purchase_item_" + accountName) + "_customer_") + customerAddress), price)], unit)
2626 }
2727 }
2828
2929

github/deemru/w8io/026f985 
25.18 ms