tx · 9ojzsroAi3MUvS9cTpiv339ATH3gzfxVrYBtkog5QZMi 3MvFWdf5NgnMVSprWTkEP1okPo1pDgqLH76: -0.05000000 Waves 2020.10.05 11:40 [1207035] smart account 3MvFWdf5NgnMVSprWTkEP1okPo1pDgqLH76 > SELF 0.00000000 Waves
{ "type": 13, "id": "9ojzsroAi3MUvS9cTpiv339ATH3gzfxVrYBtkog5QZMi", "fee": 5000000, "feeAssetId": null, "timestamp": 1601887234638, "version": 2, "chainId": 84, "sender": "3MvFWdf5NgnMVSprWTkEP1okPo1pDgqLH76", "senderPublicKey": "7qQJSjnWatmsj6R3ztxN7Z8dnfhozBHpLwKYKgpSKWMd", "proofs": [ "3darTR81YxXSBQvhYqJFmYDaC5fn66Mr7zZ6m2ku5W6eFNSgNPpiJNtU5kbv5Y7vWTYUFd1kNXxSx1Z1cwcmNqW", "WN7ZGQePXr8HjnuLGjwM4PfKnYDwjXGvwRt9Xm5wHkNypbqUwaP4ZxwmFdTTeuSP12pj5H6myrbvGtfauRCQByi" ], "script": "base64:AAIDAAAAAAAAAAQIARIAAAAAAwAAAAALYWxpY2VQdWJLZXkBAAAAIGWMWL1xS8UM0sunKVizh4wfr9liEBCLf8kf/FHCLjtAAAAAAAlib2JQdWJLZXkBAAAAIFWhIQjZ0p7zX1Aax7DUrjRyF/IFaG7tPly3lj9wpgMYAAAAAAxjb29wZXJQdWJLZXkBAAAAIH6pV/Zr5KzU7mhyJG84bHzs5/S+RkxIN29Q/qRoYgpmAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACBjYW4gdXNlIFdBVkVTIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAPY3VzdG9tZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABXByaWNlBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAE2l0ZW1fQV9jb3Vwb25fcHJpY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAANwbXQAAAAGYW1vdW50CQAAAgAAAAECAAAALnB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgbGVzcyB0aGFuIGl0ZW0gcHJpY2UDCQAAZgAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAADBwdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGhpZ2hlciB0aGFuIGl0ZW0gcHJpY2UJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAgc3RhdHVzOnB1cmNoYXNlX2l0ZW1fQV9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwIAAAAJY29uZmlybWVkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAAH3ByaWNlOnB1cmNoYXNlX2l0ZW1fQV9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwUAAAAFcHJpY2UFAAAAA25pbAAAAACaIMkL", "height": 1207035, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: t3D15JsUrDF3KM6M8h7VkgdTXPDpdkQjMkqXSLGRfJf Next: none Diff:
Old | New | Differences | |
---|---|---|---|
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | - | @Verifier(tx) | |
33 | - | func verify () = { | |
34 | - | let alice1 = sigVerify(tx.bodyBytes, tx.proofs[0], alicePubKey) | |
35 | - | let alice2 = sigVerify(tx.bodyBytes, tx.proofs[1], alicePubKey) | |
36 | - | let alice3 = sigVerify(tx.bodyBytes, tx.proofs[2], alicePubKey) | |
37 | - | let bob1 = sigVerify(tx.bodyBytes, tx.proofs[0], bobPubKey) | |
38 | - | let bob2 = sigVerify(tx.bodyBytes, tx.proofs[1], bobPubKey) | |
39 | - | let bob3 = sigVerify(tx.bodyBytes, tx.proofs[2], bobPubKey) | |
40 | - | let cooper1 = sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubKey) | |
41 | - | let cooper2 = sigVerify(tx.bodyBytes, tx.proofs[1], cooperPubKey) | |
42 | - | let cooper3 = sigVerify(tx.bodyBytes, tx.proofs[2], cooperPubKey) | |
43 | - | let aliceAndBob = if (if (if (if (if (if (alice1) | |
44 | - | then bob2 | |
45 | - | else false) | |
46 | - | then true | |
47 | - | else if (alice1) | |
48 | - | then bob3 | |
49 | - | else false) | |
50 | - | then true | |
51 | - | else if (alice2) | |
52 | - | then bob1 | |
53 | - | else false) | |
54 | - | then true | |
55 | - | else if (alice2) | |
56 | - | then bob3 | |
57 | - | else false) | |
58 | - | then true | |
59 | - | else if (alice3) | |
60 | - | then bob1 | |
61 | - | else false) | |
62 | - | then true | |
63 | - | else if (alice3) | |
64 | - | then bob2 | |
65 | - | else false | |
66 | - | let aliceAndCooper = if (if (if (if (if (if (alice1) | |
67 | - | then cooper2 | |
68 | - | else false) | |
69 | - | then true | |
70 | - | else if (alice1) | |
71 | - | then cooper3 | |
72 | - | else false) | |
73 | - | then true | |
74 | - | else if (alice2) | |
75 | - | then cooper1 | |
76 | - | else false) | |
77 | - | then true | |
78 | - | else if (alice2) | |
79 | - | then cooper3 | |
80 | - | else false) | |
81 | - | then true | |
82 | - | else if (alice3) | |
83 | - | then cooper1 | |
84 | - | else false) | |
85 | - | then true | |
86 | - | else if (alice3) | |
87 | - | then cooper2 | |
88 | - | else false | |
89 | - | let bobAndCooper = if (if (if (if (if (if (cooper1) | |
90 | - | then bob2 | |
91 | - | else false) | |
92 | - | then true | |
93 | - | else if (cooper1) | |
94 | - | then bob3 | |
95 | - | else false) | |
96 | - | then true | |
97 | - | else if (cooper2) | |
98 | - | then bob1 | |
99 | - | else false) | |
100 | - | then true | |
101 | - | else if (cooper2) | |
102 | - | then bob3 | |
103 | - | else false) | |
104 | - | then true | |
105 | - | else if (cooper3) | |
106 | - | then bob1 | |
107 | - | else false) | |
108 | - | then true | |
109 | - | else if (cooper3) | |
110 | - | then bob2 | |
111 | - | else false | |
112 | - | match tx { | |
113 | - | case _ => | |
114 | - | if (if (aliceAndBob) | |
115 | - | then true | |
116 | - | else aliceAndCooper) | |
117 | - | then true | |
118 | - | else bobAndCooper | |
119 | - | } | |
120 | - | } | |
121 | - |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let alicePubKey = base58'7qQJSjnWatmsj6R3ztxN7Z8dnfhozBHpLwKYKgpSKWMd' | |
5 | 5 | ||
6 | 6 | let bobPubKey = base58'6mGA9LY4CmJFmQjCd2owynzAriXsRbtGrV7nKoimiuLs' | |
7 | 7 | ||
8 | 8 | let cooperPubKey = base58'9XS9277UP5uChd1k1JU2T3mgZzvAooJf8yciGGrqGWK7' | |
9 | 9 | ||
10 | 10 | @Callable(i) | |
11 | 11 | func purchase () = { | |
12 | 12 | let pmt = extract(i.payment) | |
13 | 13 | if (isDefined(pmt.assetId)) | |
14 | 14 | then throw("can use WAVES only at the moment") | |
15 | 15 | else { | |
16 | 16 | let customerAddress = toBase58String(i.caller.bytes) | |
17 | 17 | let price = match getInteger(this, "item_A_coupon_price") { | |
18 | 18 | case a: Int => | |
19 | 19 | a | |
20 | 20 | case _ => | |
21 | 21 | 0 | |
22 | 22 | } | |
23 | 23 | if ((price > pmt.amount)) | |
24 | 24 | then throw("purchase amount cannot be less than item price") | |
25 | 25 | else if ((pmt.amount > price)) | |
26 | 26 | then throw("purchase amount cannot be higher than item price") | |
27 | 27 | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)]) | |
28 | 28 | } | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | - | @Verifier(tx) | |
33 | - | func verify () = { | |
34 | - | let alice1 = sigVerify(tx.bodyBytes, tx.proofs[0], alicePubKey) | |
35 | - | let alice2 = sigVerify(tx.bodyBytes, tx.proofs[1], alicePubKey) | |
36 | - | let alice3 = sigVerify(tx.bodyBytes, tx.proofs[2], alicePubKey) | |
37 | - | let bob1 = sigVerify(tx.bodyBytes, tx.proofs[0], bobPubKey) | |
38 | - | let bob2 = sigVerify(tx.bodyBytes, tx.proofs[1], bobPubKey) | |
39 | - | let bob3 = sigVerify(tx.bodyBytes, tx.proofs[2], bobPubKey) | |
40 | - | let cooper1 = sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubKey) | |
41 | - | let cooper2 = sigVerify(tx.bodyBytes, tx.proofs[1], cooperPubKey) | |
42 | - | let cooper3 = sigVerify(tx.bodyBytes, tx.proofs[2], cooperPubKey) | |
43 | - | let aliceAndBob = if (if (if (if (if (if (alice1) | |
44 | - | then bob2 | |
45 | - | else false) | |
46 | - | then true | |
47 | - | else if (alice1) | |
48 | - | then bob3 | |
49 | - | else false) | |
50 | - | then true | |
51 | - | else if (alice2) | |
52 | - | then bob1 | |
53 | - | else false) | |
54 | - | then true | |
55 | - | else if (alice2) | |
56 | - | then bob3 | |
57 | - | else false) | |
58 | - | then true | |
59 | - | else if (alice3) | |
60 | - | then bob1 | |
61 | - | else false) | |
62 | - | then true | |
63 | - | else if (alice3) | |
64 | - | then bob2 | |
65 | - | else false | |
66 | - | let aliceAndCooper = if (if (if (if (if (if (alice1) | |
67 | - | then cooper2 | |
68 | - | else false) | |
69 | - | then true | |
70 | - | else if (alice1) | |
71 | - | then cooper3 | |
72 | - | else false) | |
73 | - | then true | |
74 | - | else if (alice2) | |
75 | - | then cooper1 | |
76 | - | else false) | |
77 | - | then true | |
78 | - | else if (alice2) | |
79 | - | then cooper3 | |
80 | - | else false) | |
81 | - | then true | |
82 | - | else if (alice3) | |
83 | - | then cooper1 | |
84 | - | else false) | |
85 | - | then true | |
86 | - | else if (alice3) | |
87 | - | then cooper2 | |
88 | - | else false | |
89 | - | let bobAndCooper = if (if (if (if (if (if (cooper1) | |
90 | - | then bob2 | |
91 | - | else false) | |
92 | - | then true | |
93 | - | else if (cooper1) | |
94 | - | then bob3 | |
95 | - | else false) | |
96 | - | then true | |
97 | - | else if (cooper2) | |
98 | - | then bob1 | |
99 | - | else false) | |
100 | - | then true | |
101 | - | else if (cooper2) | |
102 | - | then bob3 | |
103 | - | else false) | |
104 | - | then true | |
105 | - | else if (cooper3) | |
106 | - | then bob1 | |
107 | - | else false) | |
108 | - | then true | |
109 | - | else if (cooper3) | |
110 | - | then bob2 | |
111 | - | else false | |
112 | - | match tx { | |
113 | - | case _ => | |
114 | - | if (if (aliceAndBob) | |
115 | - | then true | |
116 | - | else aliceAndCooper) | |
117 | - | then true | |
118 | - | else bobAndCooper | |
119 | - | } | |
120 | - | } | |
121 | - |
github/deemru/w8io/026f985 33.11 ms ◑