tx · 4fuYC5uqJNd5GPTBwy42Q3VbfXQ3ryoPKuWmp765SbUi
3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL: -0.01400000 Waves
2019.08.27 00:14 [648663] smart account 3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL > SELF 0.00000000 Waves
{
"type": 13,
"id": "4fuYC5uqJNd5GPTBwy42Q3VbfXQ3ryoPKuWmp765SbUi",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1566854144301,
"version": 1,
"sender": "3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL",
"senderPublicKey": "Bkgwt2aKyFdF5sdbTvPhvZkefrs3bpx9htsdCjmWh9LS",
"proofs": [
"34HBJEyApJnfGwjkcYkxzz8XnwXD7z1YYKDPHCWVsrsZVtWLPUVenyLy16p6EQZc93J4tgEnS76eCFAM8cvYHB6j"
],
"script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAEAAAAIY291cG9uSWQDCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABBQAAAAhjb3Vwb25JZAkAAAIAAAABAgAAACZjYWxsZXIgaGF2ZSB0byBzcGVjaWZ5IGNvdXBvbklkIHRvIGJ1eQQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIGNhbiB1c2UgV0FWRVMgb25seSBhdCB0aGUgbW9tZW50BAAAAA9jdXN0b21lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAFcHJpY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAhjb3Vwb25JZAIAAAANX2NvdXBvbl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAwkAAGYAAAACBQAAAAVwcmljZQgFAAAAA3BtdAAAAAZhbW91bnQJAAACAAAAAQIAAAAucHVyY2hhc2UgYW1vdW50IGNhbm5vdCBiZSBsZXNzIHRoYW4gaXRlbSBwcmljZQMJAABmAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlCQAAAgAAAAECAAAAMHB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgaGlnaGVyIHRoYW4gaXRlbSBwcmljZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAQc3RhdHVzOnB1cmNoYXNlXwUAAAAIY291cG9uSWQCAAAACl9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwIAAAAJY29uZmlybWVkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAA9wcmljZTpwdXJjaGFzZV8FAAAACGNvdXBvbklkAgAAAApfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MFAAAABXByaWNlBQAAAANuaWwAAAAA5TPNtg==",
"chainId": 84,
"height": 648663,
"spentComplexity": 0
}
View: original | compacted
Prev: 5PWMZNsbL8Aro6A6i1TzKueFgkVBdFdCHHTZMQR4gJJu
Next: none
Diff:
Old | New | | Differences |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | | - | func purchase (couponId) = if (isDefined(couponId)) |
---|
| 7 | + | func purchase (couponId) = if (!(isDefined(couponId))) |
---|
8 | 8 | | then throw("caller have to specify couponId to buy") |
---|
9 | 9 | | else { |
---|
10 | 10 | | let pmt = extract(i.payment) |
---|
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 purchase (couponId) = if (isDefined(couponId)) |
---|
| 7 | + | func purchase (couponId) = if (!(isDefined(couponId))) |
---|
8 | 8 | | then throw("caller have to specify couponId to buy") |
---|
9 | 9 | | else { |
---|
10 | 10 | | let pmt = extract(i.payment) |
---|
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 | 15 | | let price = match getInteger(this, (couponId + "_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 | 25 | | else WriteSet([DataEntry(((("status:purchase_" + couponId) + "_customer_") + customerAddress), "confirmed"), DataEntry(((("price:purchase_" + couponId) + "_customer_") + customerAddress), price)]) |
---|
26 | 26 | | } |
---|
27 | 27 | | } |
---|
28 | 28 | | |
---|
29 | 29 | | |
---|