tx · Fk3of2jD1ztqWRBAiYNKMdr9yfMUz5NvZagibJGDo3jK 3MqdfeXunrJwJmXkNRViAbzc6jpkJEY5PGQ: -0.01000000 Waves 2018.12.21 22:41 [415063] smart account 3MqdfeXunrJwJmXkNRViAbzc6jpkJEY5PGQ > SELF 0.00000000 Waves
{ "type": 13, "id": "Fk3of2jD1ztqWRBAiYNKMdr9yfMUz5NvZagibJGDo3jK", "fee": 1000000, "feeAssetId": null, "timestamp": 1545421257408, "version": 1, "sender": "3MqdfeXunrJwJmXkNRViAbzc6jpkJEY5PGQ", "senderPublicKey": "BDbBWpxKLAgVUVZXhPz73Xfuoxneq73TVtq4GMq2iYYH", "proofs": [ "3GjdJnN6yb3VJNHRCPxJcC5otgztJXNCbUsevCbL5EkZ1TJh9nM4N1pCdYvLfrEvt31H1RBURLzvVrM2Hr3nQgU7" ], "script": "base64:AQQAAAAQc2VydmVyc1B1YmxpY0tleQEAAAAgHipkt9S/3AqIOKX1DANBMFpryhD+GIFz8RTy9kyu4UcEAAAAFmVuY3R5cHRlZFNlcnZlcnNDaG9pY2UBAAAAICDg+DbDzYVVsQ8S9nYLnDKloaGgSoBTST6WtVUvRGfwBAAAAAhkb25hdGlvbgAAAAAABfXhAAQAAAAMcGxheWVyc1ByaXplAAAAAAAL68IABAAAAApib3hlc0NvdW50AAAAAAAAAAAFBAAAABltYXliZURhdGFQbGF5ZXJzUHVibGljS2V5CQAEHQAAAAIIBQAAAAJ0eAAAAAZzZW5kZXICAAAAEHBsYXllcnNQdWJsaWNLZXkEAAAAFGRhdGFQbGF5ZXJzUHVibGljS2V5CQACWQAAAAEJAQAAAAdleHRyYWN0AAAAAQUAAAAZbWF5YmVEYXRhUGxheWVyc1B1YmxpY0tleQQAAAAMZGF0YUxvY2tlZEF0CQEAAAAHZXh0cmFjdAAAAAEJAAQaAAAAAggFAAAAAnR4AAAABnNlbmRlcgIAAAAIbG9ja2VkQXQEAAAAFm1heWJlRGF0YVBsYXllcnNDaG9pY2UJAA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ZG9uYXRpb24HAwUAAAAdaXNTZXJ2ZXJEZWNpZGVkTm90VG9QbGF5U3RhdGUEAAAAEXJlY2lwaWVudElzUGxheWVyCQAAAAAAAAIIBQAAAAN0dHgAAAAJcmVjaXBpZW50BQAAAA5wbGF5ZXJzQWRkcmVzcwMDBQAAAA90cmFuc2ZlckZlZUlzT2sFAAAAEXJlY2lwaWVudElzUGxheWVyBwkAAAAAAAACCAUAAAADdHR4AAAABmFtb3VudAkAAGQAAAACBQAAAAxwbGF5ZXJzUHJpemUFAAAACGRvbmF0aW9uBwMFAAAAJWlzUGxheWVyRGVjaWRlZE5vdFRvU2VuZERvbmF0aW9uU3RhdGUEAAAAEXJlY2lwaWVudElzU2VydmVyCQAAAAAAAAIIBQAAAAN0dHgAAAAJcmVjaXBpZW50BQAAAA5zZXJ2ZXJzQWRkcmVzcwMDBQAAAA90cmFuc2ZlckZlZUlzT2sFAAAAEXJlY2lwaWVudElzU2VydmVyBwkAAAAAAAACCAUAAAADdHR4AAAABmFtb3VudAUAAAAMcGxheWVyc1ByaXplBwcH0G1yoQ==", "chainId": 84, "height": 415063, "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 serversPublicKey = base58'32kizC3bBgzqzBEXSp9A4tiJUWgcYLR8wGPMC6aA3MdG' | |
4 | + | let enctyptedServersChoice = base58'3DM1cZQSyqGquUPmoHjbZYCUcrGjfVjFiunv8NvN6wZZ' | |
5 | + | let donation = 100000000 | |
6 | + | let playersPrize = 200000000 | |
7 | + | let boxesCount = 5 | |
8 | + | let maybeDataPlayersPublicKey = getString(tx.sender, "playersPublicKey") | |
9 | + | let dataPlayersPublicKey = fromBase58String(extract(maybeDataPlayersPublicKey)) | |
10 | + | let dataLockedAt = extract(getInteger(tx.sender, "lockedAt")) | |
11 | + | let maybeDataPlayersChoice = getInteger(tx.sender, "playersChoice") | |
12 | + | let dataPlayersChoice = extract(maybeDataPlayersChoice) | |
13 | + | let maybeDataServersChoice = getInteger(tx.sender, "serversChoice") | |
14 | + | let dataServersChoice = extract(maybeDataServersChoice) | |
15 | + | let timeoutInBlocks = 120 | |
16 | + | let dataTransactionFee = 500000 | |
17 | + | let transferTransactionFee = 500000 | |
18 | + | let serversAddress = addressFromPublicKey(serversPublicKey) | |
19 | + | let playersAddress = addressFromPublicKey(dataPlayersPublicKey) | |
20 | + | let accountBalance = wavesBalance(tx.sender) | |
21 | + | let senderIsServer = sigVerify(tx.bodyBytes, tx.proofs[0], serversPublicKey) | |
22 | + | let senderIsPlayer = sigVerify(tx.bodyBytes, tx.proofs[0], dataPlayersPublicKey) | |
23 | + | let isInitialState = if (!(isDefined(maybeDataPlayersPublicKey))) | |
24 | + | then (accountBalance >= ((playersPrize + (dataTransactionFee * 3)) + transferTransactionFee)) | |
25 | + | else false | |
26 | + | let dataIsValidForLockedState = if (isDefined(maybeDataPlayersPublicKey)) | |
27 | + | then !(isDefined(maybeDataPlayersChoice)) | |
28 | + | else false | |
29 | + | let lockedStateTimeout = (height > (dataLockedAt + timeoutInBlocks)) | |
30 | + | let isLockedState = if (dataIsValidForLockedState) | |
31 | + | then !(lockedStateTimeout) | |
32 | + | else false | |
33 | + | let isUserDecidedNotToPlayState = if (dataIsValidForLockedState) | |
34 | + | then lockedStateTimeout | |
35 | + | else false | |
36 | + | let dataIsValidForPlayerRevealedState = if (isDefined(maybeDataPlayersChoice)) | |
37 | + | then !(isDefined(maybeDataServersChoice)) | |
38 | + | else false | |
39 | + | let playerRevealedStateTimeout = if ((height > (dataLockedAt + (timeoutInBlocks * 2)))) | |
40 | + | then (accountBalance >= (((playersPrize + donation) + dataTransactionFee) + transferTransactionFee)) | |
41 | + | else false | |
42 | + | let isPlayerRevealedHisChoiceState = if (dataIsValidForPlayerRevealedState) | |
43 | + | then !(playerRevealedStateTimeout) | |
44 | + | else false | |
45 | + | let isServerDecidedNotToPlayState = if (dataIsValidForPlayerRevealedState) | |
46 | + | then playerRevealedStateTimeout | |
47 | + | else false | |
48 | + | let isDataValidForWinnerIsDeterminedState = isDefined(maybeDataServersChoice) | |
49 | + | let isBalanceValidForWinnerIsDeterminedState = (accountBalance >= ((playersPrize + donation) + transferTransactionFee)) | |
50 | + | let isWinnerIsDeterminedState = if (isDataValidForWinnerIsDeterminedState) | |
51 | + | then isBalanceValidForWinnerIsDeterminedState | |
52 | + | else false | |
53 | + | let isPlayerDecidedNotToSendDonationState = if (isDataValidForWinnerIsDeterminedState) | |
54 | + | then !(isBalanceValidForWinnerIsDeterminedState) | |
55 | + | else false | |
56 | + | match tx { | |
57 | + | case dtx: DataTransaction => | |
58 | + | let payloadSize = size(dtx.data) | |
59 | + | let firstPayloadName = dtx.data[0].key | |
60 | + | let secondPayloadName = dtx.data[1].key | |
61 | + | let firstPayloadAsInteger = extract(getInteger(dtx.data, firstPayloadName)) | |
62 | + | let secondPayloadAsString = extract(getString(dtx.data, secondPayloadName)) | |
63 | + | let dataFeeIsOk = (dtx.fee == dataTransactionFee) | |
64 | + | if (if (isInitialState) | |
65 | + | then true | |
66 | + | else isUserDecidedNotToPlayState) | |
67 | + | then { | |
68 | + | let validLockedAtIsProvided = if ((firstPayloadName == "lockedAt")) | |
69 | + | then if ((firstPayloadAsInteger == height)) | |
70 | + | then true | |
71 | + | else (firstPayloadAsInteger == (height - 1)) | |
72 | + | else false | |
73 | + | let playersPublicKeyIsProvided = (secondPayloadName == "playersPublicKey") | |
74 | + | if (if (if (if (senderIsServer) | |
75 | + | then dataFeeIsOk | |
76 | + | else false) | |
77 | + | then validLockedAtIsProvided | |
78 | + | else false) | |
79 | + | then playersPublicKeyIsProvided | |
80 | + | else false) | |
81 | + | then (payloadSize == 2) | |
82 | + | else false | |
83 | + | } | |
84 | + | else if (isLockedState) | |
85 | + | then { | |
86 | + | let validPlayersChoiceIsProvided = if ((firstPayloadName == "playersChoice")) | |
87 | + | then if ((firstPayloadAsInteger >= 0)) | |
88 | + | then (boxesCount > firstPayloadAsInteger) | |
89 | + | else false | |
90 | + | else false | |
91 | + | if (if (if (senderIsPlayer) | |
92 | + | then dataFeeIsOk | |
93 | + | else false) | |
94 | + | then validPlayersChoiceIsProvided | |
95 | + | else false) | |
96 | + | then (payloadSize == 1) | |
97 | + | else false | |
98 | + | } | |
99 | + | else if (isPlayerRevealedHisChoiceState) | |
100 | + | then { | |
101 | + | let validServerChoiceWasProvided = if ((firstPayloadName == "serversChoice")) | |
102 | + | then if ((firstPayloadAsInteger >= 0)) | |
103 | + | then (boxesCount > firstPayloadAsInteger) | |
104 | + | else false | |
105 | + | else false | |
106 | + | let serversSaltWasProvided = (secondPayloadName == "serversSalt") | |
107 | + | let choiceAndSaltMatchesHardcodedValue = (keccak256(toBytes((toString(firstPayloadAsInteger) + secondPayloadAsString))) == enctyptedServersChoice) | |
108 | + | if (if (if (if (if (senderIsServer) | |
109 | + | then dataFeeIsOk | |
110 | + | else false) | |
111 | + | then validServerChoiceWasProvided | |
112 | + | else false) | |
113 | + | then serversSaltWasProvided | |
114 | + | else false) | |
115 | + | then choiceAndSaltMatchesHardcodedValue | |
116 | + | else false) | |
117 | + | then (payloadSize == 2) | |
118 | + | else false | |
119 | + | } | |
120 | + | else false | |
121 | + | case ttx: TransferTransaction => | |
122 | + | let transferFeeIsOk = (ttx.fee == transferTransactionFee) | |
123 | + | if (isWinnerIsDeterminedState) | |
124 | + | then { | |
125 | + | let winnerAddress = if ((dataServersChoice == dataPlayersChoice)) | |
126 | + | then playersAddress | |
127 | + | else serversAddress | |
128 | + | let prizeGoesToWinner = (ttx.recipient == winnerAddress) | |
129 | + | if (if (transferFeeIsOk) | |
130 | + | then prizeGoesToWinner | |
131 | + | else false) | |
132 | + | then (ttx.amount == (playersPrize + donation)) | |
133 | + | else false | |
134 | + | } | |
135 | + | else if (isServerDecidedNotToPlayState) | |
136 | + | then { | |
137 | + | let recipientIsPlayer = (ttx.recipient == playersAddress) | |
138 | + | if (if (transferFeeIsOk) | |
139 | + | then recipientIsPlayer | |
140 | + | else false) | |
141 | + | then (ttx.amount == (playersPrize + donation)) | |
142 | + | else false | |
143 | + | } | |
144 | + | else if (isPlayerDecidedNotToSendDonationState) | |
145 | + | then { | |
146 | + | let recipientIsServer = (ttx.recipient == serversAddress) | |
147 | + | if (if (transferFeeIsOk) | |
148 | + | then recipientIsServer | |
149 | + | else false) | |
150 | + | then (ttx.amount == playersPrize) | |
151 | + | else false | |
152 | + | } | |
153 | + | else false | |
154 | + | case _ => | |
155 | + | false | |
156 | + | } |
github/deemru/w8io/026f985 27.81 ms ◑