tx · 5PWMZNsbL8Aro6A6i1TzKueFgkVBdFdCHHTZMQR4gJJu 3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL: -0.01400000 Waves 2019.08.27 00:12 [648662] smart account 3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL > SELF 0.00000000 Waves
{ "type": 13, "id": "5PWMZNsbL8Aro6A6i1TzKueFgkVBdFdCHHTZMQR4gJJu", "fee": 1400000, "feeAssetId": null, "timestamp": 1566854042804, "version": 1, "sender": "3N1p4LEmbVeJqPTsdWYw3xHUpLHz7gYQncL", "senderPublicKey": "Bkgwt2aKyFdF5sdbTvPhvZkefrs3bpx9htsdCjmWh9LS", "proofs": [ "325f2x9XcPy8efBrLreCTkGGsNzz46LPwQyC3gnvUs2zNimH1AdqeUbkbTDZ9X2kjR6crPibiG3sPAtkiVENSDE7" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAEAAAAIY291cG9uSWQDCQEAAAAJaXNEZWZpbmVkAAAAAQUAAAAIY291cG9uSWQJAAACAAAAAQIAAAAmY2FsbGVyIGhhdmUgdG8gc3BlY2lmeSBjb3Vwb25JZCB0byBidXkEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACBjYW4gdXNlIFdBVkVTIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAPY3VzdG9tZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABXByaWNlBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAIY291cG9uSWQCAAAADV9jb3Vwb25fcHJpY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAANwbXQAAAAGYW1vdW50CQAAAgAAAAECAAAALnB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgbGVzcyB0aGFuIGl0ZW0gcHJpY2UDCQAAZgAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAADBwdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGhpZ2hlciB0aGFuIGl0ZW0gcHJpY2UJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAEHN0YXR1czpwdXJjaGFzZV8FAAAACGNvdXBvbklkAgAAAApfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MCAAAACWNvbmZpcm1lZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAPcHJpY2U6cHVyY2hhc2VfBQAAAAhjb3Vwb25JZAIAAAAKX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsAAAAAA1c1c4=", "chainId": 84, "height": 648662, "spentComplexity": 0 } View: original | compacted Prev: HWni1rFqC78gvVgc876h4X4Dwb8e9JzDbCDzdJtT2ake Next: 4fuYC5uqJNd5GPTBwy42Q3VbfXQ3ryoPKuWmp765SbUi Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(a) | |
7 | - | func purchase () = { | |
8 | - | let b = extract(a.payment) | |
9 | - | if (isDefined(b.assetId)) | |
10 | - | then throw("can use WAVES only at the moment") | |
11 | - | else { | |
12 | - | let c = toBase58String(a.caller.bytes) | |
13 | - | let d = { | |
14 | - | let e = getInteger(this, "item_A_coupon_price") | |
15 | - | if ($isInstanceOf(e, "Int")) | |
16 | - | then { | |
17 | - | let f = e | |
18 | - | f | |
19 | - | } | |
20 | - | else 0 | |
7 | + | func purchase (b) = if (isDefined(b)) | |
8 | + | then throw("caller have to specify couponId to buy") | |
9 | + | else { | |
10 | + | let c = extract(a.payment) | |
11 | + | if (isDefined(c.assetId)) | |
12 | + | then throw("can use WAVES only at the moment") | |
13 | + | else { | |
14 | + | let d = toBase58String(a.caller.bytes) | |
15 | + | let e = { | |
16 | + | let f = getInteger(this, (b + "_coupon_price")) | |
17 | + | if ($isInstanceOf(f, "Int")) | |
18 | + | then { | |
19 | + | let g = f | |
20 | + | g | |
21 | + | } | |
22 | + | else 0 | |
23 | + | } | |
24 | + | if ((e > c.amount)) | |
25 | + | then throw("purchase amount cannot be less than item price") | |
26 | + | else if ((c.amount > e)) | |
27 | + | then throw("purchase amount cannot be higher than item price") | |
28 | + | else WriteSet([DataEntry(((("status:purchase_" + b) + "_customer_") + d), "confirmed"), DataEntry(((("price:purchase_" + b) + "_customer_") + d), e)]) | |
21 | 29 | } | |
22 | - | if ((d > b.amount)) | |
23 | - | then throw("purchase amount cannot be less than item price") | |
24 | - | else if ((b.amount > d)) | |
25 | - | then throw("purchase amount cannot be higher than item price") | |
26 | - | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + c), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + c), d)]) | |
27 | - | } | |
28 | - | } | |
30 | + | } | |
29 | 31 | ||
30 | 32 |
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(a) | |
7 | - | func purchase () = { | |
8 | - | let b = extract(a.payment) | |
9 | - | if (isDefined(b.assetId)) | |
10 | - | then throw("can use WAVES only at the moment") | |
11 | - | else { | |
12 | - | let c = toBase58String(a.caller.bytes) | |
13 | - | let d = { | |
14 | - | let e = getInteger(this, "item_A_coupon_price") | |
15 | - | if ($isInstanceOf(e, "Int")) | |
16 | - | then { | |
17 | - | let f = e | |
18 | - | f | |
19 | - | } | |
20 | - | else 0 | |
7 | + | func purchase (b) = if (isDefined(b)) | |
8 | + | then throw("caller have to specify couponId to buy") | |
9 | + | else { | |
10 | + | let c = extract(a.payment) | |
11 | + | if (isDefined(c.assetId)) | |
12 | + | then throw("can use WAVES only at the moment") | |
13 | + | else { | |
14 | + | let d = toBase58String(a.caller.bytes) | |
15 | + | let e = { | |
16 | + | let f = getInteger(this, (b + "_coupon_price")) | |
17 | + | if ($isInstanceOf(f, "Int")) | |
18 | + | then { | |
19 | + | let g = f | |
20 | + | g | |
21 | + | } | |
22 | + | else 0 | |
23 | + | } | |
24 | + | if ((e > c.amount)) | |
25 | + | then throw("purchase amount cannot be less than item price") | |
26 | + | else if ((c.amount > e)) | |
27 | + | then throw("purchase amount cannot be higher than item price") | |
28 | + | else WriteSet([DataEntry(((("status:purchase_" + b) + "_customer_") + d), "confirmed"), DataEntry(((("price:purchase_" + b) + "_customer_") + d), e)]) | |
21 | 29 | } | |
22 | - | if ((d > b.amount)) | |
23 | - | then throw("purchase amount cannot be less than item price") | |
24 | - | else if ((b.amount > d)) | |
25 | - | then throw("purchase amount cannot be higher than item price") | |
26 | - | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + c), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + c), d)]) | |
27 | - | } | |
28 | - | } | |
30 | + | } | |
29 | 31 | ||
30 | 32 |
github/deemru/w8io/169f3d6 39.91 ms ◑