tx · 8VH8aAcFitXB6VMnBSPopvTCbeAZTCLJdH3APtpzs3Qm 3N4y2rVAGH2VqAo1mV7Q3749Ce3GNughXTC: -0.01400000 Waves 2021.11.17 20:29 [1795340] smart account 3N4y2rVAGH2VqAo1mV7Q3749Ce3GNughXTC > SELF 0.00000000 Waves
{ "type": 13, "id": "8VH8aAcFitXB6VMnBSPopvTCbeAZTCLJdH3APtpzs3Qm", "fee": 1400000, "feeAssetId": null, "timestamp": 1637170173711, "version": 2, "chainId": 84, "sender": "3N4y2rVAGH2VqAo1mV7Q3749Ce3GNughXTC", "senderPublicKey": "GJvQeBDAzLZepewd7B4tjh4xxDTZ3jJjGAgLu61GpiEp", "proofs": [ "4A9YkqwgBt9sWmaUNZySKGiPruH4juYEQ24M9DPCji2hWRK8gpHz3bY6WJrJH4WJXMbuHvV7K17P56Gg2ArP97AZ" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAAABAAAAANwbXQDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAcQXR0YWNoZWQgcGF5bWVudCBpcyByZXF1aXJlZAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAgY2FuIHVzZSBXQVZFUyBvbmx5IGFzIHRoZSBtb21lbnQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAABNpdGVtX0FfY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAABXByaWNlCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAC1wdXJjaGFzZSBhbW91biBjYW5ub3QgYmUgbGVzcyB0aGFuIGl0ZW0gcHJpY2UDCQAAZgAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAAC9wdXJjaGFzZSBhbW91biBjYW5ub3QgYmUgaGlnaGVyIHRoYW4gaXRlbSBwcmljZQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAAIHN0YXR1czpwdXJjaGFzZV9pdGVtX0FfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MCAAAACWNvbmZpcm1lZAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAAB9wcmljZTpwdXJjaGFzZV9pdGVtX0FfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MFAAAABXByaWNlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleZWkb9Q=", "height": 1795340, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G9jKaDofbZUXGsnYUUqoWTfTGEyHsBByY9RmpDP2vimj Next: 2HaSQvSjTfbJUgWiSQu4SvfY7cN5e7fDPVL3kAAenq3f Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let ownerPublicKey = base58'GJvQeBDAzLZepewd7B4tjh4xxDTZ3jJjGAgLu61GpiEp' | |
5 | 4 | ||
6 | - | let pubKeyAlice = base58'GJvQeBDAzLZepewd7B4tjh4xxDTZ3jJjGAgLu61GpiEp' | |
7 | 5 | ||
8 | - | let pubKeyBob = base58'4gZSiHTXLqvVnQHqBYUXzF6WzhsRjKtmrDsE16qzqhwY' | |
9 | - | ||
10 | - | let pubKeyCooper = base58'9aM8SJLh6kk8WtQgpXNSsyER2AhHSuTc84bAyuKGcmtR' | |
6 | + | @Callable(i) | |
7 | + | func purchase () = { | |
8 | + | let pmt = if ((size(i.payments) == 1)) | |
9 | + | then i.payments[0] | |
10 | + | else throw("Attached payment is required") | |
11 | + | if (isDefined(pmt.assetId)) | |
12 | + | then throw("can use WAVES only as the moment") | |
13 | + | else { | |
14 | + | let customerAddress = toBase58String(i.caller.bytes) | |
15 | + | let price = match getInteger(this, "item_A_coupon_price") { | |
16 | + | case a: Int => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | if ((price > pmt.amount)) | |
22 | + | then throw("purchase amoun cannot be less than item price") | |
23 | + | else if ((pmt.amount > price)) | |
24 | + | then throw("purchase amoun cannot be higher than item price") | |
25 | + | else [StringEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), IntegerEntry(("price:purchase_item_A_customer_" + customerAddress), price)] | |
26 | + | } | |
27 | + | } | |
11 | 28 | ||
12 | 29 | ||
13 | 30 | @Verifier(tx) | |
14 | - | func verify () = { | |
15 | - | let signedAlice = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyAlice)) | |
16 | - | then true | |
17 | - | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyAlice)) | |
18 | - | then true | |
19 | - | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyAlice)) | |
20 | - | then 1 | |
21 | - | else 0 | |
22 | - | let signedBob = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyBob)) | |
23 | - | then true | |
24 | - | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyBob)) | |
25 | - | then true | |
26 | - | else sigVerify(tx.bodyBytes, tx.proofs[2], pubKeyBob)) | |
27 | - | then 1 | |
28 | - | else 0 | |
29 | - | let signedCooper = if (if (sigVerify(tx.bodyBytes, tx.proofs[0], pubKeyCooper)) | |
30 | - | then true | |
31 | - | else sigVerify(tx.bodyBytes, tx.proofs[1], pubKeyCooper)) | |
32 | - | then 1 | |
33 | - | else 0 | |
34 | - | match tx { | |
35 | - | case d: SetScriptTransaction => | |
36 | - | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
37 | - | case d: DataTransaction => | |
38 | - | true | |
39 | - | case _ => | |
40 | - | (((signedAlice + signedBob) + signedCooper) >= 2) | |
41 | - | } | |
42 | - | } | |
31 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
43 | 32 |
github/deemru/w8io/169f3d6 34.33 ms ◑