tx · 2T3s3z6zFWMzteXPk4HMAmdrNF4evoRzDAhKXtXTW8GZ 3N6jEkSedoJfphMqMTY1TBNMuZN8PzTNcox: -0.01000000 Waves 2019.02.11 16:47 [490561] smart account 3N6jEkSedoJfphMqMTY1TBNMuZN8PzTNcox > SELF 0.00000000 Waves
{ "type": 13, "id": "2T3s3z6zFWMzteXPk4HMAmdrNF4evoRzDAhKXtXTW8GZ", "fee": 1000000, "feeAssetId": null, "timestamp": 1549892895004, "version": 1, "sender": "3N6jEkSedoJfphMqMTY1TBNMuZN8PzTNcox", "senderPublicKey": "DRJWPdG3YGvG4BFpBWiwjBGD99cUZe1yU9TgpqEpnXsF", "proofs": [ "2DdJ4FDH2ZARzx9KMV1ZrJaVSHxvn4M2fJ93t2DjhCmEXQVSpCFmLfsx5AFkfR4pAQ2T3NYyaxNZex7y65xLCfbo" ], "script": "base64:AQQAAAAQY2FzaW5vc1B1YmxpY0tleQEAAAAg++4D0np85s4U1tfih28Ct9RpE6ePus2LI+C3n9wjllsEAAAAFmVuY3R5cHRlZENhc2lub3NDaG9pY2UBAAAAIFC/ivlK/7y/lesmk3CwyeeBlzXm+T7Sar8U7chmAPVEBAAAAANiZXQAAAAAAAvrwgAEAAAAFWdhbWVDb21taXNzaW9uUGVyY2VudAAAAAAAAAAAAwQAAAAOZ2FtZUNvbW1pc3Npb24JAABpAAAAAgkAAGgAAAACCQAAaAAAAAIAAAAAAAAAAAIFAAAAA2JldAUAAAAVZ2FtZUNvbW1pc3Npb25QZXJjZW50AAAAAAAAAABkBAAAABRkYXRhUGxheWVyc1B1YmxpY0tleQEAAAAg++4D0np85s4U1tfih28Ct9RpE6ePus2LI+C3n9wjllsEAAAADGRhdGFMb2NrZWRBdAAAAAAAAAd8QQQAAAAWbWF5YmVEYXRhUGxheWVyc0Nob2ljZQkABBoAAAACCAUAAAACdHgAAAAGc2VuZGVyAgAAAA1wbGF5ZXJzQ2hvaWNlBAAAABFkYXRhUGxheWVyc0Nob2ljZQkBAAA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NpZGVkTm90VG9TZW5kQmV0U3RhdGUEAAAAEXJlY2lwaWVudElzQ2FzaW5vCQAAAAAAAAIIBQAAAAN0dHgAAAAJcmVjaXBpZW50BQAAAA5jYXNpbm9zQWRkcmVzcwQAAAAPZXhwZWN0ZWRCYWxhbmNlCQAAZQAAAAIFAAAAA2JldAUAAAAOZ2FtZUNvbW1pc3Npb24EAAAAD2Ftb3VudElzQ29ycmVjdAkAAAAAAAACCAUAAAADdHR4AAAABmFtb3VudAUAAAAPZXhwZWN0ZWRCYWxhbmNlAwMFAAAAB2ZlZUlzT2sFAAAAEXJlY2lwaWVudElzQ2FzaW5vBwUAAAAPYW1vdW50SXNDb3JyZWN0BwcHg3j6LA==", "chainId": 84, "height": 490561, "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 casinosPublicKey = base58'HxRqMjTQJNEjnaEqWCvg81EZCUky9LhdozdaxFta4SsU' | |
4 | + | let enctyptedCasinosChoice = base58'6SD21D1pqFAwWLmnZ6HT1EbukWv5MjdCPTufoPh8QfiT' | |
5 | + | let bet = 200000000 | |
6 | + | let gameCommissionPercent = 3 | |
7 | + | let gameCommission = (((2 * bet) * gameCommissionPercent) / 100) | |
8 | + | let dataPlayersPublicKey = base58'HxRqMjTQJNEjnaEqWCvg81EZCUky9LhdozdaxFta4SsU' | |
9 | + | let dataLockedAt = 490561 | |
10 | + | let maybeDataPlayersChoice = getInteger(tx.sender, "playersChoice") | |
11 | + | let dataPlayersChoice = extract(maybeDataPlayersChoice) | |
12 | + | let maybeDataCasinosChoice = getInteger(tx.sender, "serversChoice") | |
13 | + | let dataCasinosChoice = extract(maybeDataCasinosChoice) | |
14 | + | let timeoutInBlocks = 120 | |
15 | + | let dataTransactionFee = 500000 | |
16 | + | let transferTransactionFee = 500000 | |
17 | + | let casinosAddress = addressFromPublicKey(casinosPublicKey) | |
18 | + | let playersAddress = addressFromPublicKey(dataPlayersPublicKey) | |
19 | + | let accountBalance = wavesBalance(tx.sender) | |
20 | + | let senderIsCasino = sigVerify(tx.bodyBytes, tx.proofs[0], casinosPublicKey) | |
21 | + | let senderIsPlayer = sigVerify(tx.bodyBytes, tx.proofs[0], dataPlayersPublicKey) | |
22 | + | let dataIsValidForLockedState = !(isDefined(maybeDataPlayersChoice)) | |
23 | + | let lockedStateTimeout = (height > (dataLockedAt + timeoutInBlocks)) | |
24 | + | let isLockedState = if (dataIsValidForLockedState) | |
25 | + | then !(lockedStateTimeout) | |
26 | + | else false | |
27 | + | let isUserDecidedNotToPlayState = if (dataIsValidForLockedState) | |
28 | + | then lockedStateTimeout | |
29 | + | else false | |
30 | + | let dataIsValidForPlayerRevealedState = if (isDefined(maybeDataPlayersChoice)) | |
31 | + | then !(isDefined(maybeDataCasinosChoice)) | |
32 | + | else false | |
33 | + | let playerRevealedStateTimeout = if ((height > (dataLockedAt + (timeoutInBlocks * 2)))) | |
34 | + | then (accountBalance >= ((((bet * 2) - gameCommission) + dataTransactionFee) + transferTransactionFee)) | |
35 | + | else false | |
36 | + | let isPlayerRevealedHisChoiceState = if (dataIsValidForPlayerRevealedState) | |
37 | + | then !(playerRevealedStateTimeout) | |
38 | + | else false | |
39 | + | let isCasinoDecidedNotToPlayState = if (dataIsValidForPlayerRevealedState) | |
40 | + | then playerRevealedStateTimeout | |
41 | + | else false | |
42 | + | let isDataValidForWinnerIsDeterminedState = isDefined(maybeDataCasinosChoice) | |
43 | + | let isBalanceValidForWinnerIsDeterminedState = (accountBalance >= (((bet * 2) - gameCommission) + transferTransactionFee)) | |
44 | + | let isWinnerIsDeterminedState = if (isDataValidForWinnerIsDeterminedState) | |
45 | + | then isBalanceValidForWinnerIsDeterminedState | |
46 | + | else false | |
47 | + | let isPlayerDecidedNotToSendBetState = if (isDataValidForWinnerIsDeterminedState) | |
48 | + | then !(isBalanceValidForWinnerIsDeterminedState) | |
49 | + | else false | |
50 | + | match tx { | |
51 | + | case dtx: DataTransaction => | |
52 | + | let payloadSize = size(dtx.data) | |
53 | + | let firstPayloadName = dtx.data[0].key | |
54 | + | let secondPayloadName = dtx.data[1].key | |
55 | + | let firstPayloadAsInteger = extract(getInteger(dtx.data, firstPayloadName)) | |
56 | + | let secondPayloadAsString = extract(getString(dtx.data, secondPayloadName)) | |
57 | + | let feeIsOk = (dtx.fee == dataTransactionFee) | |
58 | + | if (isUserDecidedNotToPlayState) | |
59 | + | then { | |
60 | + | let validLockedAtIsProvided = true | |
61 | + | let playersPublicKeyIsProvided = true | |
62 | + | let noOtherDataWasProvided = (payloadSize == 2) | |
63 | + | if (if (if (if (senderIsCasino) | |
64 | + | then feeIsOk | |
65 | + | else false) | |
66 | + | then validLockedAtIsProvided | |
67 | + | else false) | |
68 | + | then playersPublicKeyIsProvided | |
69 | + | else false) | |
70 | + | then noOtherDataWasProvided | |
71 | + | else false | |
72 | + | } | |
73 | + | else if (isLockedState) | |
74 | + | then { | |
75 | + | let validPlayersChoiceIsProvided = if ((firstPayloadName == "playersChoice")) | |
76 | + | then if ((firstPayloadAsInteger == 0)) | |
77 | + | then true | |
78 | + | else (firstPayloadAsInteger == 1) | |
79 | + | else false | |
80 | + | let noOtherDataWasProvided = (payloadSize == 1) | |
81 | + | if (if (if (senderIsPlayer) | |
82 | + | then feeIsOk | |
83 | + | else false) | |
84 | + | then validPlayersChoiceIsProvided | |
85 | + | else false) | |
86 | + | then noOtherDataWasProvided | |
87 | + | else false | |
88 | + | } | |
89 | + | else if (isPlayerRevealedHisChoiceState) | |
90 | + | then { | |
91 | + | let validCasinoChoiceWasProvided = if ((firstPayloadName == "serversChoice")) | |
92 | + | then if ((firstPayloadAsInteger == 0)) | |
93 | + | then true | |
94 | + | else (firstPayloadAsInteger == 1) | |
95 | + | else false | |
96 | + | let casinosSaltWasProvided = (secondPayloadName == "serversSalt") | |
97 | + | let choiceAndSaltMatchesHardcodedValue = (keccak256(toBytes((toString(firstPayloadAsInteger) + secondPayloadAsString))) == enctyptedCasinosChoice) | |
98 | + | let noOtherDataWasProvided = (payloadSize == 2) | |
99 | + | if (if (if (if (if (senderIsCasino) | |
100 | + | then feeIsOk | |
101 | + | else false) | |
102 | + | then validCasinoChoiceWasProvided | |
103 | + | else false) | |
104 | + | then casinosSaltWasProvided | |
105 | + | else false) | |
106 | + | then choiceAndSaltMatchesHardcodedValue | |
107 | + | else false) | |
108 | + | then noOtherDataWasProvided | |
109 | + | else false | |
110 | + | } | |
111 | + | else false | |
112 | + | case ttx: TransferTransaction => | |
113 | + | let feeIsOk = (ttx.fee == transferTransactionFee) | |
114 | + | if (isWinnerIsDeterminedState) | |
115 | + | then { | |
116 | + | let winnerAddress = if ((dataCasinosChoice == dataPlayersChoice)) | |
117 | + | then playersAddress | |
118 | + | else casinosAddress | |
119 | + | let expectedBalance = ((bet * 2) - gameCommission) | |
120 | + | let prizeGoesToWinner = if ((ttx.recipient == winnerAddress)) | |
121 | + | then (ttx.amount == expectedBalance) | |
122 | + | else false | |
123 | + | if (feeIsOk) | |
124 | + | then prizeGoesToWinner | |
125 | + | else false | |
126 | + | } | |
127 | + | else if (isCasinoDecidedNotToPlayState) | |
128 | + | then { | |
129 | + | let recipientIsPlayer = (ttx.recipient == playersAddress) | |
130 | + | let expectedBalance = ((bet * 2) - gameCommission) | |
131 | + | let amountIsCorrent = (ttx.amount == expectedBalance) | |
132 | + | if (if (feeIsOk) | |
133 | + | then recipientIsPlayer | |
134 | + | else false) | |
135 | + | then amountIsCorrent | |
136 | + | else false | |
137 | + | } | |
138 | + | else if (isPlayerDecidedNotToSendBetState) | |
139 | + | then { | |
140 | + | let recipientIsCasino = (ttx.recipient == casinosAddress) | |
141 | + | let expectedBalance = (bet - gameCommission) | |
142 | + | let amountIsCorrect = (ttx.amount == expectedBalance) | |
143 | + | if (if (feeIsOk) | |
144 | + | then recipientIsCasino | |
145 | + | else false) | |
146 | + | then amountIsCorrect | |
147 | + | else false | |
148 | + | } | |
149 | + | else false | |
150 | + | case _ => | |
151 | + | false | |
152 | + | } |
github/deemru/w8io/026f985 29.53 ms ◑