tx · AjUQmESBuSAUinpbooiqANVMyPN48zxYij44MhV2Lpcy 3NBEZbC9KqdW7RDgYKpBA33ghY5z5XExiKQ: -0.01000000 Waves 2019.02.05 20:34 [482023] smart account 3NBEZbC9KqdW7RDgYKpBA33ghY5z5XExiKQ > SELF 0.00000000 Waves
{ "type": 13, "id": "AjUQmESBuSAUinpbooiqANVMyPN48zxYij44MhV2Lpcy", "fee": 1000000, "feeAssetId": null, "timestamp": 1549388138167, "version": 1, "sender": "3NBEZbC9KqdW7RDgYKpBA33ghY5z5XExiKQ", "senderPublicKey": "9WydfcpFSweC3aWBfhkXF6KHnfb47EGasut1Sv3MTH7T", "proofs": [ "2x3ZRWGuNat9f4QvqVZN1yn8qmXGf2zGdqrVPwgyPvVkaGh3YWFA1fKS7CDz2az91DSYvFpWCn2VjjNUxW1L9ygT" ], "script": "base64:AQQAAAAQY2FzaW5vc1B1YmxpY0tleQEAAAAg++4D0np85s4U1tfih28Ct9RpE6ePus2LI+C3n9wjllsEAAAAFmVuY3R5cHRlZENhc2lub3NDaG9pY2UBAAAAIDraRh1r1yUWPofE1f78abmHh9X/59838/Shscwriz/XBAAAAANiZXQAAAAAAACYloAEAAAAFWdhbWVDb21taXNzaW9uUGVyY2VudAAAAAAAAAAAAQQAAAAOZ2FtZUNvbW1pc3Npb24JAABpAAAAAgUAAAAVZ2FtZUNvbW1pc3Npb25QZXJjZW50AAAAAAAAAABkBAAAABRkYXRhUGxheWVyc1B1YmxpY0tleQEAAAAg++4D0np85s4U1tfih28Ct9RpE6ePus2LI+C3n9wjllsEAAAADGRhdGFMb2NrZWRBdAAAAAAAAAda5wQAAAAWbWF5YmVEYXRhUGxheWVyc0Nob2ljZQkABBoAAAACCAUAAAACdHgAAAAGc2VuZGVyAgAAAA1wbGF5ZXJzQ2hvaWNlBAAAABFkYXRhUGxheWVyc0Nob2ljZQkBAAAAB2V4dHJhY3QAAAABBQAAABZtYXliZURhdGFQbGF5ZXJzQ2hvaWNlBAAAABZtYXliZUR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mVyAwkAAAAAAAACCAUAAAADdHR4AAAACXJlY2lwaWVudAUAAAANd2lubmVyQWRkcmVzcwkAAAAAAAACCAUAAAADdHR4AAAABmFtb3VudAkAAGgAAAACCQAAaAAAAAIAAAAAAAAAAAIFAAAAA2JldAkAAGUAAAACAAAAAAAAAAABBQAAAA5nYW1lQ29tbWlzc2lvbgcDBQAAAAdmZWVJc09rBQAAABFwcml6ZUdvZXNUb1dpbm5lcgcDBQAAAB1pc0Nhc2lub0RlY2lkZWROb3RUb1BsYXlTdGF0ZQQAAAARcmVjaXBpZW50SXNQbGF5ZXIJAAAAAAAAAggFAAAAA3R0eAAAAAlyZWNpcGllbnQFAAAADnBsYXllcnNBZGRyZXNzBAAAAA9hbW91bnRJc0NvcnJlbnQJAAAAAAAAAggFAAAAA3R0eAAAAAZhbW91bnQJAABkAAAAAgUAAAADYmV0CQAAaAAAAAIFAAAAA2JldAkAAGUAAAACAAAAAAAAAAABCQAAaAAAAAIAAAAAAAAAAAIFAAAADmdhbWVDb21taXNzaW9uAwMFAAAAB2ZlZUlzT2sFAAAAEXJlY2lwaWVudElzUGxheWVyBwUAAAAPYW1vdW50SXNDb3JyZW50BwMFAAAAIGlzUGxheWVyRGVjaWRlZE5vdFRvU2VuZEJldFN0YXRlBAAAABFyZWNpcGllbnRJc0Nhc2lubwkAAAAAAAACCAUAAAADdHR4AAAACXJlY2lwaWVudAUAAAAOY2FzaW5vc0FkZHJlc3MEAAAAD2Ftb3VudElzQ29ycmVjdAkAAAAAAAACCAUAAAADdHR4AAAABmFtb3VudAUAAAADYmV0AwMFAAAAB2ZlZUlzT2sFAAAAEXJlY2lwaWVudElzQ2FzaW5vBwUAAAAPYW1vdW50SXNDb3JyZWN0BwcHPjGghg==", "chainId": 84, "height": 482023, "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'4xjgxoXR7uD84DiC4or553Fe3XkDYUi9E3ZyR5c6ZWog' | |
5 | + | let bet = 10000000 | |
6 | + | let gameCommissionPercent = 1 | |
7 | + | let gameCommission = (gameCommissionPercent / 100) | |
8 | + | let dataPlayersPublicKey = base58'HxRqMjTQJNEjnaEqWCvg81EZCUky9LhdozdaxFta4SsU' | |
9 | + | let dataLockedAt = 482023 | |
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 + (bet * (1 - (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 gameCommissionValueTest = gameCommission | |
44 | + | let gameCommissionValueTest2 = (1 - (2 * gameCommission)) | |
45 | + | let gameCommissionValueTest3 = (bet * (1 - (2 * gameCommission))) | |
46 | + | let gameCommissionValueTest4 = transferTransactionFee | |
47 | + | let balanceBeforePaymentToWinner = ((bet + (bet * (1 - (2 * gameCommission)))) + transferTransactionFee) | |
48 | + | let isBalanceValidForWinnerIsDeterminedState = (accountBalance >= balanceBeforePaymentToWinner) | |
49 | + | let alwaysTrue = if ((gameCommissionValueTest2 > gameCommissionValueTest)) | |
50 | + | then (gameCommissionValueTest3 > gameCommissionValueTest4) | |
51 | + | else false | |
52 | + | let isWinnerIsDeterminedState = if (if (alwaysTrue) | |
53 | + | then isDataValidForWinnerIsDeterminedState | |
54 | + | else false) | |
55 | + | then isBalanceValidForWinnerIsDeterminedState | |
56 | + | else false | |
57 | + | let isPlayerDecidedNotToSendBetState = if (isDataValidForWinnerIsDeterminedState) | |
58 | + | then !(isBalanceValidForWinnerIsDeterminedState) | |
59 | + | else false | |
60 | + | match tx { | |
61 | + | case dtx: DataTransaction => | |
62 | + | let payloadSize = size(dtx.data) | |
63 | + | let firstPayloadName = dtx.data[0].key | |
64 | + | let secondPayloadName = dtx.data[1].key | |
65 | + | let firstPayloadAsInteger = extract(getInteger(dtx.data, firstPayloadName)) | |
66 | + | let secondPayloadAsString = extract(getString(dtx.data, secondPayloadName)) | |
67 | + | let feeIsOk = (dtx.fee == dataTransactionFee) | |
68 | + | if (isUserDecidedNotToPlayState) | |
69 | + | then { | |
70 | + | let validLockedAtIsProvided = true | |
71 | + | let playersPublicKeyIsProvided = true | |
72 | + | let noOtherDataWasProvided = (payloadSize == 2) | |
73 | + | if (if (if (if (senderIsCasino) | |
74 | + | then feeIsOk | |
75 | + | else false) | |
76 | + | then validLockedAtIsProvided | |
77 | + | else false) | |
78 | + | then playersPublicKeyIsProvided | |
79 | + | else false) | |
80 | + | then noOtherDataWasProvided | |
81 | + | else false | |
82 | + | } | |
83 | + | else if (isLockedState) | |
84 | + | then { | |
85 | + | let validPlayersChoiceIsProvided = if ((firstPayloadName == "playersChoice")) | |
86 | + | then if ((firstPayloadAsInteger == 0)) | |
87 | + | then true | |
88 | + | else (firstPayloadAsInteger == 1) | |
89 | + | else false | |
90 | + | let noOtherDataWasProvided = (payloadSize == 1) | |
91 | + | if (if (if (senderIsPlayer) | |
92 | + | then feeIsOk | |
93 | + | else false) | |
94 | + | then validPlayersChoiceIsProvided | |
95 | + | else false) | |
96 | + | then noOtherDataWasProvided | |
97 | + | else false | |
98 | + | } | |
99 | + | else if (isPlayerRevealedHisChoiceState) | |
100 | + | then { | |
101 | + | let validCasinoChoiceWasProvided = if ((firstPayloadName == "serversChoice")) | |
102 | + | then if ((firstPayloadAsInteger == 0)) | |
103 | + | then true | |
104 | + | else (firstPayloadAsInteger == 1) | |
105 | + | else false | |
106 | + | let casinosSaltWasProvided = (secondPayloadName == "serversSalt") | |
107 | + | let choiceAndSaltMatchesHardcodedValue = (keccak256(toBytes((toString(firstPayloadAsInteger) + secondPayloadAsString))) == enctyptedCasinosChoice) | |
108 | + | let noOtherDataWasProvided = (payloadSize == 2) | |
109 | + | if (if (if (if (if (senderIsCasino) | |
110 | + | then feeIsOk | |
111 | + | else false) | |
112 | + | then validCasinoChoiceWasProvided | |
113 | + | else false) | |
114 | + | then casinosSaltWasProvided | |
115 | + | else false) | |
116 | + | then choiceAndSaltMatchesHardcodedValue | |
117 | + | else false) | |
118 | + | then noOtherDataWasProvided | |
119 | + | else false | |
120 | + | } | |
121 | + | else false | |
122 | + | case ttx: TransferTransaction => | |
123 | + | let feeIsOk = (ttx.fee == transferTransactionFee) | |
124 | + | if (isWinnerIsDeterminedState) | |
125 | + | then { | |
126 | + | let winnerAddress = if ((dataCasinosChoice == dataPlayersChoice)) | |
127 | + | then playersAddress | |
128 | + | else casinosAddress | |
129 | + | let prizeGoesToWinner = if ((ttx.recipient == winnerAddress)) | |
130 | + | then (ttx.amount == ((2 * bet) * (1 - gameCommission))) | |
131 | + | else false | |
132 | + | if (feeIsOk) | |
133 | + | then prizeGoesToWinner | |
134 | + | else false | |
135 | + | } | |
136 | + | else if (isCasinoDecidedNotToPlayState) | |
137 | + | then { | |
138 | + | let recipientIsPlayer = (ttx.recipient == playersAddress) | |
139 | + | let amountIsCorrent = (ttx.amount == (bet + (bet * (1 - (2 * gameCommission))))) | |
140 | + | if (if (feeIsOk) | |
141 | + | then recipientIsPlayer | |
142 | + | else false) | |
143 | + | then amountIsCorrent | |
144 | + | else false | |
145 | + | } | |
146 | + | else if (isPlayerDecidedNotToSendBetState) | |
147 | + | then { | |
148 | + | let recipientIsCasino = (ttx.recipient == casinosAddress) | |
149 | + | let amountIsCorrect = (ttx.amount == bet) | |
150 | + | if (if (feeIsOk) | |
151 | + | then recipientIsCasino | |
152 | + | else false) | |
153 | + | then amountIsCorrect | |
154 | + | else false | |
155 | + | } | |
156 | + | else false | |
157 | + | case _ => | |
158 | + | false | |
159 | + | } |
github/deemru/w8io/169f3d6 24.49 ms ◑