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:
Old | New | | Differences |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | | - | func purchase () = { |
---|
| 7 | + | func purchase (accountName) = { |
---|
8 | 8 | | let pmt = if ((size(i.payments) == 1)) |
---|
9 | 9 | | then i.payments[0] |
---|
10 | 10 | | else throw("Attached payment is required") |
---|
|
12 | 12 | | then throw("can use WAVES only at the moment") |
---|
13 | 13 | | else { |
---|
14 | 14 | | 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")) { |
---|
16 | 16 | | case a: Int => |
---|
17 | 17 | | a |
---|
18 | 18 | | case _ => |
---|
|
22 | 22 | | then throw("purchase amount cannot be less than item price") |
---|
23 | 23 | | else if ((pmt.amount > price)) |
---|
24 | 24 | | 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) |
---|
26 | 26 | | } |
---|
27 | 27 | | } |
---|
28 | 28 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | | - | func purchase () = { |
---|
| 7 | + | func purchase (accountName) = { |
---|
8 | 8 | | let pmt = if ((size(i.payments) == 1)) |
---|
9 | 9 | | then i.payments[0] |
---|
10 | 10 | | else throw("Attached payment is required") |
---|
11 | 11 | | if (isDefined(pmt.assetId)) |
---|
12 | 12 | | then throw("can use WAVES only at the moment") |
---|
13 | 13 | | else { |
---|
14 | 14 | | 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")) { |
---|
16 | 16 | | case a: Int => |
---|
17 | 17 | | a |
---|
18 | 18 | | case _ => |
---|
19 | 19 | | 0 |
---|
20 | 20 | | } |
---|
21 | 21 | | if ((price > pmt.amount)) |
---|
22 | 22 | | then throw("purchase amount cannot be less than item price") |
---|
23 | 23 | | else if ((pmt.amount > price)) |
---|
24 | 24 | | 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) |
---|
26 | 26 | | } |
---|
27 | 27 | | } |
---|
28 | 28 | | |
---|
29 | 29 | | |
---|