tx · FzDtJdZSVxgGGohpKGohxVvuhT9dLWtJdsTwGxLJeQjG 3MqocrUVAFT2GEeyLNVRnMfsLm7KvAW6n69: -0.01000000 Waves 2019.02.20 13:14 [503346] smart account 3MqocrUVAFT2GEeyLNVRnMfsLm7KvAW6n69 > SELF 0.00000000 Waves
{ "type": 13, "id": "FzDtJdZSVxgGGohpKGohxVvuhT9dLWtJdsTwGxLJeQjG", "fee": 1000000, "feeAssetId": null, "timestamp": 1550657692868, "version": 1, "sender": "3MqocrUVAFT2GEeyLNVRnMfsLm7KvAW6n69", "senderPublicKey": "A7whtsEUXz2ERftk8d8RRUdoFPxoyFw4D2o5vPLE4KtL", "proofs": [ "qL3Trx31jrFQ8UWJXwvYZNmVz4p6J6Fqx5CB9dejh3fvEjNYd3zme9JqP2pSQZgRTHDZrdH6ziQQDsqjCP2QiPV" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABXR4RmVlAAAAAAAAB6EgBAAAAAd0aW1lb3V0AAAAAAAAAAWgBAAAABBzZXJ2ZXJUaW1lb3V0R2FwAAAAAAAAAAAeBAAAAAhsaWZlc3BhbgAAAAAAAAAH0AQAAAADZXJyCQAAAgAAAAECAAAAAAQAAAAVc2VydmVyQ2hvaWNlSGFzaEJ5dGVzCQACWQAAAAECAAAALEJ3ZVlCSnB1WTFEdFZzU1dQWmhNQll1MlhHcFozcHZZNnp5OEtpY3h1SlNyBAAAAA9zZXJ2ZXJQdWJsaWNLZXkJAAJZAAAAAQIAAAAsRkd6em1TY0FiVWNNb0xNSHNnb3FyNFFuZDgxVFBqaVFpUzlHMzR0QVFaNTcEAAAABnNlcnZlcgkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM01wd24zMVpMbVcyWUJzWnVvdXZUM1M2c1BvOGNMUWVXZGUEAAAABnBsYXllcgkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM04xMmd3SG9hdllBY3JHSlFGdV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AAxzZXJ2ZXJDaG9pY2UHAwMDCQAAAAAAAAIIBQAAAAZwYXlvdXQAAAAJcmVjaXBpZW50AwUAAAAKcGxheWVyV2lucwUAAAAGcGxheWVyBQAAAAZzZXJ2ZXIJAAH0AAAAAwgFAAAABnBheW91dAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAABnBheW91dAAAAAZwcm9vZnMAAAAAAAAAAAEFAAAAD3NlcnZlclB1YmxpY0tleQcJAAAAAAAAAgkAAfUAAAABBQAAABRzZXJ2ZXJDaG9pY2VXaXRoU2FsdAUAAAAVc2VydmVyQ2hvaWNlSGFzaEJ5dGVzBwkAAAAAAAACCQAAyAAAAAEFAAAAFHNlcnZlckNob2ljZVdpdGhTYWx0AAAAAAAAAAAmBwcFAAAAA2VycgcFAAAAA2VycgeK9uPZ", "chainId": 84, "height": 503346, "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("BweYBJpuY1DtVsSWPZhMBYu2XGpZ3pvY6zy8KicxuJSr") | |
10 | + | let serverPublicKey = fromBase58String("FGzzmScAbUcMoLMHsgoqr4Qnd81TPjiQiS9G34tAQZ57") | |
11 | + | let server = addressFromString("3Mpwn31ZLmW2YBsZuouvT3S6sPo8cLQeWde") | |
12 | + | let player = addressFromString("3N12gwHoavYAcrGJQFuYMjGB7eAszJQF2FW") | |
13 | + | let totalServerFunds = 30000000 | |
14 | + | let startingHeight = 503346 | |
15 | + | let diceCount = 3 | |
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/169f3d6 20.41 ms ◑