tx · EdhgQE9shK4pnYX274q2P9eYAUWB15nSsK3BcSNcNG4y 3Mr1SwAEMAhq4Md3oHGZ44mdmjftKQYyh2T: -0.01000000 Waves 2019.02.20 13:26 [503364] smart account 3Mr1SwAEMAhq4Md3oHGZ44mdmjftKQYyh2T > SELF 0.00000000 Waves
{ "type": 13, "id": "EdhgQE9shK4pnYX274q2P9eYAUWB15nSsK3BcSNcNG4y", "fee": 1000000, "feeAssetId": null, "timestamp": 1550658407288, "version": 1, "sender": "3Mr1SwAEMAhq4Md3oHGZ44mdmjftKQYyh2T", "senderPublicKey": "wQi9jc33WW12StG7hVimkQ2wBmcm4MC9zVzn6SeD2sL", "proofs": [ "j2nYpw2BKpGE4T1Dr3v6xfULBiR3YPoUyMLLyNrnuMMjftXRVqDjMUurmyXbw6kzVFDisLtcWbf23fjkg3XSgyU" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABXR4RmVlAAAAAAAAB6EgBAAAAAd0aW1lb3V0AAAAAAAAAAWgBAAAABBzZXJ2ZXJUaW1lb3V0R2FwAAAAAAAAAAAeBAAAAAhsaWZlc3BhbgAAAAAAAAAH0AQAAAADZXJyCQAAAgAAAAECAAAAAAQAAAAVc2VydmVyQ2hvaWNlSGFzaEJ5dGVzCQACWQAAAAECAAAALDVORlp0QVlvNW03QXFFa3JDTnJ6WEpaYkxDQ0pRU2tCWml3RkZ6NDYyZ0JlBAAAAA9zZXJ2ZXJQdWJsaWNLZXkJAAJZAAAAAQIAAAAsQ05lTkhiRllMRjVRTktDc2tZUFQ4S2Q3c1N2RUhqRGRpYlNuaEVvajRLV3IEAAAABnNlcnZlcgkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM05CR0tSUXcydFdrZ3hRQmh0Tmc4V3dEb21KRnlIOU0xR0gEAAAABnBsYXllcgkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM016cnZZaHV4MTVocHBVQlJmYkdVQ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AAxzZXJ2ZXJDaG9pY2UHAwMDCQAAAAAAAAIIBQAAAAZwYXlvdXQAAAAJcmVjaXBpZW50AwUAAAAKcGxheWVyV2lucwUAAAAGcGxheWVyBQAAAAZzZXJ2ZXIJAAH0AAAAAwgFAAAABnBheW91dAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAABnBheW91dAAAAAZwcm9vZnMAAAAAAAAAAAEFAAAAD3NlcnZlclB1YmxpY0tleQcJAAAAAAAAAgkAAfUAAAABBQAAABRzZXJ2ZXJDaG9pY2VXaXRoU2FsdAUAAAAVc2VydmVyQ2hvaWNlSGFzaEJ5dGVzBwkAAAAAAAACCQAAyAAAAAEFAAAAFHNlcnZlckNob2ljZVdpdGhTYWx0AAAAAAAAAAAmBwcFAAAAA2VycgcFAAAAA2Vycge47XjV", "chainId": 84, "height": 503364, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 1 #-} | |
2 | + | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | + | let me = tx.sender | |
4 | + | let txFee = 500000 | |
5 | + | let timeout = 1440 | |
6 | + | let serverTimeoutGap = 30 | |
7 | + | let lifespan = 2000 | |
8 | + | let err = throw("") | |
9 | + | let serverChoiceHashBytes = fromBase58String("5NFZtAYo5m7AqEkrCNrzXJZbLCCJQSkBZiwFFz462gBe") | |
10 | + | let serverPublicKey = fromBase58String("CNeNHbFYLF5QNKCskYPT8Kd7sSvEHjDdibSnhEoj4KWr") | |
11 | + | let server = addressFromString("3NBGKRQw2tWkgxQBhtNg8WwDomJFyH9M1GH") | |
12 | + | let player = addressFromString("3MzrvYhux15hppUBRfbGUCfTpX5Q2EKHPxU") | |
13 | + | let totalServerFunds = 30000000 | |
14 | + | let startingHeight = 503364 | |
15 | + | let diceCount = 2 | |
16 | + | let bet = 30000000 | |
17 | + | if ((height >= startingHeight)) | |
18 | + | then match tx { | |
19 | + | case payout: TransferTransaction => | |
20 | + | if (if (if (if ((payout.amount == (wavesBalance(me) - txFee))) | |
21 | + | then !(isDefined(payout.assetId)) | |
22 | + | else false) | |
23 | + | then !(isDefined(payout.feeAssetId)) | |
24 | + | else false) | |
25 | + | then (payout.fee == txFee) | |
26 | + | else false) | |
27 | + | then if (((height - startingHeight) > lifespan)) | |
28 | + | then (payout.recipient == server) | |
29 | + | else { | |
30 | + | let paymentId = payout.proofs[0] | |
31 | + | match transactionById(paymentId) { | |
32 | + | case payment: TransferTransaction => | |
33 | + | let paymentHeight = extract(transactionHeightById(paymentId)) | |
34 | + | if (if (if (if ((payment.amount == bet)) | |
35 | + | then (payment.recipient == me) | |
36 | + | else false) | |
37 | + | then (payment.sender == player) | |
38 | + | else false) | |
39 | + | then !(isDefined(payment.assetId)) | |
40 | + | else false) | |
41 | + | then if ((paymentHeight > ((startingHeight + timeout) - serverTimeoutGap))) | |
42 | + | then (payout.recipient == server) | |
43 | + | else if (if (((totalServerFunds + bet) > wavesBalance(me))) | |
44 | + | then true | |
45 | + | else (height > (startingHeight + timeout))) | |
46 | + | then (payout.recipient == player) | |
47 | + | else { | |
48 | + | let serverChoiceWithSalt = payout.attachment | |
49 | + | let playerChoice = payment.attachment | |
50 | + | let s = size(playerChoice) | |
51 | + | let serverChoice = take(serverChoiceWithSalt, 1) | |
52 | + | let serverChoiceValid = if (if (if (if (if ((serverChoice == toBytes("1"))) | |
53 | + | then true | |
54 | + | else (serverChoice == toBytes("2"))) | |
55 | + | then true | |
56 | + | else (serverChoice == toBytes("3"))) | |
57 | + | then true | |
58 | + | else (serverChoice == toBytes("4"))) | |
59 | + | then true | |
60 | + | else (serverChoice == toBytes("5"))) | |
61 | + | then true | |
62 | + | else (serverChoice == toBytes("6")) | |
63 | + | let playerWins = if (!(serverChoiceValid)) | |
64 | + | then true | |
65 | + | else if (if (if (if (if (if ((s == diceCount)) | |
66 | + | then if ((s >= 1)) | |
67 | + | then (take(drop(playerChoice, 0), 1) == serverChoice) | |
68 | + | else false | |
69 | + | else false) | |
70 | + | then true | |
71 | + | else if ((s >= 2)) | |
72 | + | then (take(drop(playerChoice, 1), 1) == serverChoice) | |
73 | + | else false) | |
74 | + | then true | |
75 | + | else if ((s >= 3)) | |
76 | + | then (take(drop(playerChoice, 2), 1) == serverChoice) | |
77 | + | else false) | |
78 | + | then true | |
79 | + | else if ((s >= 4)) | |
80 | + | then (take(drop(playerChoice, 3), 1) == serverChoice) | |
81 | + | else false) | |
82 | + | then true | |
83 | + | else if ((s >= 5)) | |
84 | + | then (take(drop(playerChoice, 4), 1) == serverChoice) | |
85 | + | else false) | |
86 | + | then true | |
87 | + | else if ((s >= 6)) | |
88 | + | then (take(drop(playerChoice, 5), 1) == serverChoice) | |
89 | + | else false | |
90 | + | if (if (if ((payout.recipient == (if (playerWins) | |
91 | + | then player | |
92 | + | else server))) | |
93 | + | then sigVerify(payout.bodyBytes, payout.proofs[1], serverPublicKey) | |
94 | + | else false) | |
95 | + | then (keccak256(serverChoiceWithSalt) == serverChoiceHashBytes) | |
96 | + | else false) | |
97 | + | then (size(serverChoiceWithSalt) == 38) | |
98 | + | else false | |
99 | + | } | |
100 | + | else false | |
101 | + | case _ => | |
102 | + | err | |
103 | + | } | |
104 | + | } | |
105 | + | else false | |
106 | + | case _ => | |
107 | + | err | |
108 | + | } | |
109 | + | else false |
github/deemru/w8io/026f985 16.88 ms ◑