tx · FZXsfSf2FhWEmQJLsobbBzUC84wJnxorXoa3bsuy4377 3MrHArnt1DPnvRuoJQ9pRfWyXiKnBaMMmdj: -0.01400000 Waves 2020.11.17 17:46 [1269504] smart account 3MrHArnt1DPnvRuoJQ9pRfWyXiKnBaMMmdj > SELF 0.00000000 Waves
{ "type": 13, "id": "FZXsfSf2FhWEmQJLsobbBzUC84wJnxorXoa3bsuy4377", "fee": 1400000, "feeAssetId": null, "timestamp": 1605624441171, "version": 2, "chainId": 84, "sender": "3MrHArnt1DPnvRuoJQ9pRfWyXiKnBaMMmdj", "senderPublicKey": "CjTszkpvzupCPnyoKjtzECtLhfCMVDYM2pNBW5uExjJC", "proofs": [ "4MDRNg21s1GR4j4kPxM14zEgiGQR4rzw2RanYf8iHutd9vjefXAH7MugDbCrtkLQMifzDUAE4YAN2WuUevkyvCzf", "59h5PYDfYLFyCk52r7yRh2AEQvNoTkDz4CZrQJb1ffkHWcykKrpttSpziyAmJRejHQxnsouN65GSQZAJgq2ngFca" ], "script": "base64:AAIEAAAAAAAAAAQIAhIAAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAAABAAAAAdwYXltZW50CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAXT25seSBXYXZlcyBhcmUgYWNjZXB0ZWQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAABNpdGVtX0FfY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAAAAAAAIIBQAAAAdwYXltZW50AAAABmFtb3VudAAAAAAAAAAAAAkAAAIAAAABAgAAABRQdXJjaGFzZSBhbW91bnQgaXMgMAMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAAdwYXltZW50AAAABmFtb3VudAkAAAIAAAABAgAAABpQdXJjaGFzZSBhbW91bnQgaXMgdG9vIGxvdwMJAABmAAAAAggFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAABtQdXJjaGFzZSBhbW91bnQgaXMgdG9vIGhpZ2gJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAB9zdGF0dXM6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyBQAAAA9jdXN0b21lckFkZHJlc3MCAAAABHRydWUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAecHJpY2U6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyBQAAAA9jdXN0b21lckFkZHJlc3MFAAAABXByaWNlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAlzaWduYXR1cmUJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGBQAAAAlzaWduYXR1cmUpDVs1", "height": 1269504, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: H9CZh7sZZCH7CfCynzMjSacibtNx8NnZfVuS6QeiSZ74 Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let publicKey1 = base58'6ZxqKboj5ZWzPtPwWS9TUr1W2qCmBK7558drHCa9tWKw' | |
5 | 4 | ||
6 | - | let publicKey2 = base58'CjTszkpvzupCPnyoKjtzECtLhfCMVDYM2pNBW5uExjJC' | |
7 | 5 | ||
8 | - | let publicKey3 = base58'iRqJrgq4rS2ndNGFJoZtKcoTfskkxr3zfTesPWqtKzp' | |
9 | - | ||
10 | - | func multipleSigVerify (bodyBytes,proof1,proof2,proof3,publicKey) = { | |
11 | - | let p1 = sigVerify(bodyBytes, proof1, publicKey) | |
12 | - | let p2 = sigVerify(bodyBytes, proof2, publicKey) | |
13 | - | let p3 = sigVerify(bodyBytes, proof3, publicKey) | |
14 | - | if (if (p1) | |
15 | - | then true | |
16 | - | else p2) | |
17 | - | then true | |
18 | - | else p3 | |
6 | + | @Callable(i) | |
7 | + | func purchase () = { | |
8 | + | let payment = value(i.payments[0]) | |
9 | + | if (isDefined(payment.assetId)) | |
10 | + | then throw("Only Waves are accepted") | |
11 | + | else { | |
12 | + | let customerAddress = toBase58String(i.caller.bytes) | |
13 | + | let price = match getInteger(this, "item_A_coupon_price") { | |
14 | + | case a: Int => | |
15 | + | a | |
16 | + | case _ => | |
17 | + | 0 | |
18 | + | } | |
19 | + | if ((payment.amount == 0)) | |
20 | + | then throw("Purchase amount is 0") | |
21 | + | else if ((price > payment.amount)) | |
22 | + | then throw("Purchase amount is too low") | |
23 | + | else if ((payment.amount > price)) | |
24 | + | then throw("Purchase amount is too high") | |
25 | + | else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)] | |
26 | + | } | |
19 | 27 | } | |
20 | - | ||
21 | 28 | ||
22 | 29 | ||
23 | 30 | @Verifier(tx) | |
24 | 31 | func verify () = { | |
25 | - | let public1 = multipleSigVerify(tx.bodyBytes, tx.proofs[0], tx.proofs[1], tx.proofs[2], publicKey1) | |
26 | - | let public2 = multipleSigVerify(tx.bodyBytes, tx.proofs[0], tx.proofs[1], tx.proofs[2], publicKey2) | |
27 | - | let public3 = multipleSigVerify(tx.bodyBytes, tx.proofs[0], tx.proofs[1], tx.proofs[2], publicKey3) | |
28 | - | let result = if (if (if (public1) | |
29 | - | then public2 | |
30 | - | else false) | |
31 | - | then true | |
32 | - | else if (public2) | |
33 | - | then public3 | |
34 | - | else false) | |
35 | - | then true | |
36 | - | else if (public3) | |
37 | - | then public1 | |
38 | - | else false | |
32 | + | let signature = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
39 | 33 | match tx { | |
40 | - | case d: | |
34 | + | case d: InvokeScriptTransaction => | |
41 | 35 | true | |
42 | 36 | case _ => | |
43 | - | | |
37 | + | signature | |
44 | 38 | } | |
45 | 39 | } | |
46 | 40 |
github/deemru/w8io/169f3d6 37.23 ms ◑