tx · 8LX6Z6mcnEsFq8ZpSh2aPhyGDo8NManaFmc6w5146yD5 3N2Q9TfYZcenz5a3on97GLEAasz21EkKMAa: -0.01400000 Waves 2021.11.17 18:59 [1795250] smart account 3N2Q9TfYZcenz5a3on97GLEAasz21EkKMAa > SELF 0.00000000 Waves
{ "type": 13, "id": "8LX6Z6mcnEsFq8ZpSh2aPhyGDo8NManaFmc6w5146yD5", "fee": 1400000, "feeAssetId": null, "timestamp": 1637164798321, "version": 2, "chainId": 84, "sender": "3N2Q9TfYZcenz5a3on97GLEAasz21EkKMAa", "senderPublicKey": "7xnAFC7PqCyLRjzmjyaTmSK7H1bEBfSx6qnj7JBj6XJe", "proofs": [ "31yeS7xEDmNuGJt9qLHmhPmNTFEVBUL2beyf6WU4RAaX9ckBwzNjpWrcjVfGGu6wA2gvgsZtiBXT5o8rLtKy8gDx" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAABAAAAAAOb3duZXJQdWJsaWNLZXkBAAAAIGdwIMDn68lL32eMqLRKIY/1dabJUxYb0aJsAxWhhGsfAAAAAAtwdWJLZXlBbGljZQEAAAAg43aQ2X2IK64P51H6+dKHLdjpoqHmimQbk8Z25XKt9W0AAAAACXB1YktleUJvYgEAAAAgNrVlZpnvdQ+1qDkZiyYl7tYcfEQCJS/tSw0Pasaz0EsAAAAADHB1YktleUNvb3BlcgEAAAAgf2hr0H2+2FrVR7cV2FEQTxxMcXc6Hp1IgaaqWMLFTH4AAAABAAAAAWkBAAAACHB1cmNoYXNlAAAAAAQAAAADcG10AwkAAAAAAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAACQAAAgAAAAECAAAAHEF0dGFjaGVkIHBheW1lbnQgaXMgcmVxdWlyZWQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIGNhbiB1c2UgV0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AABkAAAAAgkAAGQAAAACBQAAAAFhBQAAAAFiBQAAAAFjAAAAAAAAAAACTpACqg==", "height": 1795250, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AJPffQNZA4DYJk2cX3KHiaZem7wrmy4CVaV1Xwebwtun Next: JDH7UDHE9VE5ZfLegcztk1VU9whE6ec2q6GkZS6aoYzK Diff:
Old | New | Differences | |
---|---|---|---|
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ownerPublicKey = base58'7xnAFC7PqCyLRjzmjyaTmSK7H1bEBfSx6qnj7JBj6XJe' | |
5 | + | ||
6 | + | let pubKeyAlice = base58'GJvQeBDAzLZepewd7B4tjh4xxDTZ3jJjGAgLu61GpiEp' | |
7 | + | ||
8 | + | let pubKeyBob = base58'4gZSiHTXLqvVnQHqBYUXzF6WzhsRjKtmrDsE16qzqhwY' | |
9 | + | ||
10 | + | let pubKeyCooper = base58'9aM8SJLh6kk8WtQgpXNSsyER2AhHSuTc84bAyuKGcmtR' | |
5 | 11 | ||
6 | 12 | @Callable(i) | |
7 | 13 | func purchase () = { | |
28 | 34 | ||
29 | 35 | ||
30 | 36 | @Verifier(tx) | |
31 | - | func verify () = match tx { | |
32 | - | case d: SetScriptTransaction => | |
33 | - | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
34 | - | case d: DataTransaction => | |
35 | - | true | |
36 | - | case _ => | |
37 | - | false | |
38 | - | } | |
37 | + | func verify () = { | |
38 | + | let a = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyAlice)) | |
39 | + | then true | |
40 | + | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyAlice)) | |
41 | + | then true | |
42 | + | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyAlice)) | |
43 | + | then 1 | |
44 | + | else 0 | |
45 | + | let b = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyBob)) | |
46 | + | then true | |
47 | + | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyBob)) | |
48 | + | then true | |
49 | + | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyBob)) | |
50 | + | then 1 | |
51 | + | else 0 | |
52 | + | let c = if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyCooper)) | |
53 | + | then true | |
54 | + | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyCooper)) | |
55 | + | then 1 | |
56 | + | else 0 | |
57 | + | match tx { | |
58 | + | case d: SetScriptTransaction => | |
59 | + | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
60 | + | case d: DataTransaction => | |
61 | + | true | |
62 | + | case _ => | |
63 | + | (((a + b) + c) >= 2) | |
64 | + | } | |
65 | + | } | |
39 | 66 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ownerPublicKey = base58'7xnAFC7PqCyLRjzmjyaTmSK7H1bEBfSx6qnj7JBj6XJe' | |
5 | + | ||
6 | + | let pubKeyAlice = base58'GJvQeBDAzLZepewd7B4tjh4xxDTZ3jJjGAgLu61GpiEp' | |
7 | + | ||
8 | + | let pubKeyBob = base58'4gZSiHTXLqvVnQHqBYUXzF6WzhsRjKtmrDsE16qzqhwY' | |
9 | + | ||
10 | + | let pubKeyCooper = base58'9aM8SJLh6kk8WtQgpXNSsyER2AhHSuTc84bAyuKGcmtR' | |
5 | 11 | ||
6 | 12 | @Callable(i) | |
7 | 13 | func purchase () = { | |
8 | 14 | let pmt = if ((size(i.payments) == 1)) | |
9 | 15 | then i.payments[0] | |
10 | 16 | else throw("Attached payment is required") | |
11 | 17 | if (isDefined(pmt.assetId)) | |
12 | 18 | then throw("can use WAVES only as the moment") | |
13 | 19 | else { | |
14 | 20 | let customerAddress = toBase58String(i.caller.bytes) | |
15 | 21 | let price = match getInteger(this, "item_A_coupon_price") { | |
16 | 22 | case a: Int => | |
17 | 23 | a | |
18 | 24 | case _ => | |
19 | 25 | 0 | |
20 | 26 | } | |
21 | 27 | if ((price > pmt.amount)) | |
22 | 28 | then throw("purchase amoun cannot be less than item price") | |
23 | 29 | else if ((pmt.amount > price)) | |
24 | 30 | then throw("purchase amoun cannot be higher than item price") | |
25 | 31 | else [StringEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), IntegerEntry(("price:purchase_item_A_customer_" + customerAddress), price)] | |
26 | 32 | } | |
27 | 33 | } | |
28 | 34 | ||
29 | 35 | ||
30 | 36 | @Verifier(tx) | |
31 | - | func verify () = match tx { | |
32 | - | case d: SetScriptTransaction => | |
33 | - | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
34 | - | case d: DataTransaction => | |
35 | - | true | |
36 | - | case _ => | |
37 | - | false | |
38 | - | } | |
37 | + | func verify () = { | |
38 | + | let a = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyAlice)) | |
39 | + | then true | |
40 | + | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyAlice)) | |
41 | + | then true | |
42 | + | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyAlice)) | |
43 | + | then 1 | |
44 | + | else 0 | |
45 | + | let b = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyBob)) | |
46 | + | then true | |
47 | + | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyBob)) | |
48 | + | then true | |
49 | + | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyBob)) | |
50 | + | then 1 | |
51 | + | else 0 | |
52 | + | let c = if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyCooper)) | |
53 | + | then true | |
54 | + | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyCooper)) | |
55 | + | then 1 | |
56 | + | else 0 | |
57 | + | match tx { | |
58 | + | case d: SetScriptTransaction => | |
59 | + | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
60 | + | case d: DataTransaction => | |
61 | + | true | |
62 | + | case _ => | |
63 | + | (((a + b) + c) >= 2) | |
64 | + | } | |
65 | + | } | |
39 | 66 |
github/deemru/w8io/169f3d6 55.18 ms ◑