tx · 3Hgqozmms8nhFcWeLsV6t6D2vhmTuYHYYTNJBM8q3esv
3N2dNRdfSCX65A5GYRDrmfePKyh7GZsxzq6: -0.01400000 Waves
2019.08.15 17:02 [632272] smart account 3N2dNRdfSCX65A5GYRDrmfePKyh7GZsxzq6 > SELF 0.00000000 Waves
{
"type": 13,
"id": "3Hgqozmms8nhFcWeLsV6t6D2vhmTuYHYYTNJBM8q3esv",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1565877768152,
"version": 1,
"sender": "3N2dNRdfSCX65A5GYRDrmfePKyh7GZsxzq6",
"senderPublicKey": "61eJYrtcz2xtkZSBG5MGML2bMxUXTueo6H1ChqftMdDt",
"proofs": [
"5bSzJa3EapaDPuS1eyoJjdiKLdaFjR24QZJwzD2LpQ2DMFnaYVF3mxXb8Sfke6oHCuVHhJDYzREJdKH4c65VayRJ"
],
"script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAEAAAAKY291cG9uTmFtZQQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIGNhbiB1c2UgV0FWRVMgb25seSBhdCB0aGUgbW9tZW50BAAAAA9jdXN0b21lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAgUAAAAKY291cG9uTmFtZQIAAAABQQQAAAAGcHJpY2VBBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAE2l0ZW1fQV9jb3Vwb25fcHJpY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAAGcHJpY2VBCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAC5wdX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9CX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzAgAAAAljb25maXJtZWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAfcHJpY2U6cHVyY2hhc2VfaXRlbV9CX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAZwcmljZUIFAAAAA25pbAkAAAIAAAABCQABLAAAAAICAAAAJFRoZXJlIGlzIG5vIGNvdXBvbiB3aXRoIGdpdmVuIG5hbWU6IAUAAAAKY291cG9uTmFtZQAAAAAS7wki",
"chainId": 84,
"height": 632272,
"spentComplexity": 0
}
View: original | compacted
Prev: 5CaaxaStySdMChPKjgd8gvkzcTwizfZiyTtYHzW1mnBR
Next: none
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)) |
---|
| 7 | + | func purchase (b) = { |
---|
| 8 | + | let c = extract(a.payment) |
---|
| 9 | + | if (isDefined(c.assetId)) |
---|
10 | 10 | | then throw("can use WAVES only at the moment") |
---|
11 | 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")) |
---|
| 12 | + | let d = toBase58String(a.caller.bytes) |
---|
| 13 | + | if ((b == "A")) |
---|
| 14 | + | then { |
---|
| 15 | + | let e = { |
---|
| 16 | + | let f = getInteger(this, "item_A_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_item_A_customer_" + d), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + d), e)]) |
---|
| 29 | + | } |
---|
| 30 | + | else if ((b == "B")) |
---|
16 | 31 | | then { |
---|
17 | | - | let f = e |
---|
18 | | - | f |
---|
| 32 | + | let h = { |
---|
| 33 | + | let f = getInteger(this, "item_B_coupon_price") |
---|
| 34 | + | if ($isInstanceOf(f, "Int")) |
---|
| 35 | + | then { |
---|
| 36 | + | let g = f |
---|
| 37 | + | g |
---|
| 38 | + | } |
---|
| 39 | + | else 0 |
---|
| 40 | + | } |
---|
| 41 | + | if ((h > c.amount)) |
---|
| 42 | + | then throw("purchase amount cannot be less than item price") |
---|
| 43 | + | else if ((c.amount > h)) |
---|
| 44 | + | then throw("purchase amount cannot be higher than item price") |
---|
| 45 | + | else WriteSet([DataEntry(("status:purchase_item_B_customer_" + d), "confirmed"), DataEntry(("price:purchase_item_B_customer_" + d), h)]) |
---|
19 | 46 | | } |
---|
20 | | - | else 0 |
---|
21 | | - | } |
---|
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)]) |
---|
| 47 | + | else throw(("There is no coupon with given name: " + b)) |
---|
27 | 48 | | } |
---|
28 | 49 | | } |
---|
29 | 50 | | |
---|
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(a) |
---|
7 | | - | func purchase () = { |
---|
8 | | - | let b = extract(a.payment) |
---|
9 | | - | if (isDefined(b.assetId)) |
---|
| 7 | + | func purchase (b) = { |
---|
| 8 | + | let c = extract(a.payment) |
---|
| 9 | + | if (isDefined(c.assetId)) |
---|
10 | 10 | | then throw("can use WAVES only at the moment") |
---|
11 | 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")) |
---|
| 12 | + | let d = toBase58String(a.caller.bytes) |
---|
| 13 | + | if ((b == "A")) |
---|
| 14 | + | then { |
---|
| 15 | + | let e = { |
---|
| 16 | + | let f = getInteger(this, "item_A_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_item_A_customer_" + d), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + d), e)]) |
---|
| 29 | + | } |
---|
| 30 | + | else if ((b == "B")) |
---|
16 | 31 | | then { |
---|
17 | | - | let f = e |
---|
18 | | - | f |
---|
| 32 | + | let h = { |
---|
| 33 | + | let f = getInteger(this, "item_B_coupon_price") |
---|
| 34 | + | if ($isInstanceOf(f, "Int")) |
---|
| 35 | + | then { |
---|
| 36 | + | let g = f |
---|
| 37 | + | g |
---|
| 38 | + | } |
---|
| 39 | + | else 0 |
---|
| 40 | + | } |
---|
| 41 | + | if ((h > c.amount)) |
---|
| 42 | + | then throw("purchase amount cannot be less than item price") |
---|
| 43 | + | else if ((c.amount > h)) |
---|
| 44 | + | then throw("purchase amount cannot be higher than item price") |
---|
| 45 | + | else WriteSet([DataEntry(("status:purchase_item_B_customer_" + d), "confirmed"), DataEntry(("price:purchase_item_B_customer_" + d), h)]) |
---|
19 | 46 | | } |
---|
20 | | - | else 0 |
---|
21 | | - | } |
---|
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)]) |
---|
| 47 | + | else throw(("There is no coupon with given name: " + b)) |
---|
27 | 48 | | } |
---|
28 | 49 | | } |
---|
29 | 50 | | |
---|
30 | 51 | | |
---|