tx · GnHiVTGcJ1CFvg59yNpxonNaM1TrjUe2htjRjAoRob2n 3N3vSNRvnmWhgREb8DrnCzuGw4mzRhE4SNz: -0.01000000 Waves 2019.02.20 12:57 [503329] smart account 3N3vSNRvnmWhgREb8DrnCzuGw4mzRhE4SNz > SELF 0.00000000 Waves
{ "type": 13, "id": "GnHiVTGcJ1CFvg59yNpxonNaM1TrjUe2htjRjAoRob2n", "fee": 1000000, "feeAssetId": null, "timestamp": 1550656680691, "version": 1, "sender": "3N3vSNRvnmWhgREb8DrnCzuGw4mzRhE4SNz", "senderPublicKey": "9t8siGgpjGB4MSzxAsKn9biKfsd7ekK6xPZUCoombfvZ", "proofs": [ "DPpKsXN59khDDjPAi6bParD5Te4PmwT44kyknG5pW1fi4NdhDH4ZHndkS82EBxvsbxxnHdxmhWgHUz4yQAsx7h6" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABXR4RmVlAAAAAAAAB6EgBAAAAAd0aW1lb3V0AAAAAAAAAAWgBAAAABBzZXJ2ZXJUaW1lb3V0R2FwAAAAAAAAAAAeBAAAAAhsaWZlc3BhbgAAAAAAAAAH0AQAAAADZXJyCQAAAgAAAAECAAAAAAQAAAAVc2VydmVyQ2hvaWNlSGFzaEJ5dGVzCQACWQAAAAECAAAALEV0ZDlEak45QTFhb3FmVmhEZHoyaHVIa1NVTFB5WG9GcGN3SkpaV0NaeUFtBAAAAA9zZXJ2ZXJQdWJsaWNLZXkJAAJZAAAAAQIAAAAsOFNqRTNLQ2ZwdENiR2dERXNza3p6bjNpNTJzcFpxdzd4dVRxaFdOMlNodlMEAAAABnNlcnZlcgkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM044MTQ4V3ZITUE1aXZmTUpuTWo0dmlaTXhtTVBiWWZjYVQEAAAABnBsYXllcgkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM01xYXhlcWNBVE51UW11aXFOdXhLaHZQN2V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2ZXJDaG9pY2UHAwMDCQAAAAAAAAIIBQAAAAZwYXlvdXQAAAAJcmVjaXBpZW50AwUAAAAKcGxheWVyV2lucwUAAAAGcGxheWVyBQAAAAZzZXJ2ZXIJAAH0AAAAAwgFAAAABnBheW91dAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAABnBheW91dAAAAAZwcm9vZnMAAAAAAAAAAAEFAAAAD3NlcnZlclB1YmxpY0tleQcJAAAAAAAAAgkAAfUAAAABBQAAABRzZXJ2ZXJDaG9pY2VXaXRoU2FsdAUAAAAVc2VydmVyQ2hvaWNlSGFzaEJ5dGVzBwkAAAAAAAACCQAAyAAAAAEFAAAAFHNlcnZlckNob2ljZVdpdGhTYWx0AAAAAAAAAAAmBwcFAAAAA2VycgcFAAAAA2VycgdW/T88", "chainId": 84, "height": 503329, "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("Etd9DjN9A1aoqfVhDdz2huHkSULPyXoFpcwJJZWCZyAm") | |
10 | + | let serverPublicKey = fromBase58String("8SjE3KCfptCbGgDEsskzzn3i52spZqw7xuTqhWN2ShvS") | |
11 | + | let server = addressFromString("3N8148WvHMA5ivfMJnMj4viZMxmMPbYfcaT") | |
12 | + | let player = addressFromString("3MqaxeqcATNuQmuiqNuxKhvP7ef3ajV4csq") | |
13 | + | let totalServerFunds = 30000000 | |
14 | + | let startingHeight = 503329 | |
15 | + | let diceCount = 1 | |
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 ((wavesBalance(me) >= (totalServerFunds + bet))) | |
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 20.03 ms ◑