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:
Old | New | | Differences |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @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)]) |
---|
8 | 8 | | |
---|
9 | 9 | | |
---|
10 | 10 | | |
---|
11 | 11 | | @Callable(i) |
---|
12 | | - | func purchase () = { |
---|
| 12 | + | func purchase (key) = { |
---|
13 | 13 | | let pmt = extract(i.payment) |
---|
14 | 14 | | if (isDefined(pmt.assetId)) |
---|
15 | 15 | | then throw("Can use waves only at the moment") |
---|
16 | 16 | | else { |
---|
17 | 17 | | 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")) { |
---|
19 | 19 | | case a: Int => |
---|
20 | 20 | | a |
---|
21 | 21 | | case _ => |
---|
|
25 | 25 | | then throw("Purchase amount cannot be less then item price") |
---|
26 | 26 | | else if ((pmt.amount > price)) |
---|
27 | 27 | | 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)]) |
---|
29 | 29 | | } |
---|
30 | 30 | | } |
---|
31 | 31 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @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)]) |
---|
8 | 8 | | |
---|
9 | 9 | | |
---|
10 | 10 | | |
---|
11 | 11 | | @Callable(i) |
---|
12 | | - | func purchase () = { |
---|
| 12 | + | func purchase (key) = { |
---|
13 | 13 | | let pmt = extract(i.payment) |
---|
14 | 14 | | if (isDefined(pmt.assetId)) |
---|
15 | 15 | | then throw("Can use waves only at the moment") |
---|
16 | 16 | | else { |
---|
17 | 17 | | 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")) { |
---|
19 | 19 | | case a: Int => |
---|
20 | 20 | | a |
---|
21 | 21 | | case _ => |
---|
22 | 22 | | 0 |
---|
23 | 23 | | } |
---|
24 | 24 | | if ((price > pmt.amount)) |
---|
25 | 25 | | then throw("Purchase amount cannot be less then item price") |
---|
26 | 26 | | else if ((pmt.amount > price)) |
---|
27 | 27 | | 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)]) |
---|
29 | 29 | | } |
---|
30 | 30 | | } |
---|
31 | 31 | | |
---|
32 | 32 | | |
---|