tx · 8pvuipMYrbvPHWNFc17inUNMSqnFxxSkRUtk3ZrJb2Wm 3MqbbJoyWT7Hh7NkYZhqFC1VnvHZQrwTy9P: -0.01000000 Waves 2018.12.14 14:47 [404403] smart account 3MqbbJoyWT7Hh7NkYZhqFC1VnvHZQrwTy9P > SELF 0.00000000 Waves
{ "type": 13, "id": "8pvuipMYrbvPHWNFc17inUNMSqnFxxSkRUtk3ZrJb2Wm", "fee": 1000000, "feeAssetId": null, "timestamp": 1544787897761, "version": 1, "sender": "3MqbbJoyWT7Hh7NkYZhqFC1VnvHZQrwTy9P", "senderPublicKey": "3YeAVPnxvg7J6BPfJU7hQmQjpyZhVrEJJgKnimxu9bZ6", "proofs": [ "47rjDiM4jcPM5wuSUbQYc1TCgmG6QxYnhQt68djSyYJoKgmiBLEnQaGnD1pBgEHRy2B9RGt6zEHf5KgeecWYCCLi" ], "script": "base64:AQQAAAAQY2FzaW5vc1B1YmxpY0tleQEAAAAgy6dEaVQlC3o3wKOeMfu4ZC5uyLkpVeXvuwyAPolh+EUEAAAAFmVuY3R5cHRlZENhc2lub3NDaG9pY2UBAAAAIGqMYfsYEv30jqKSIRVCmk7kn2ZnsZs7EfU1dPZXRBpjBAAAAANiZXQAAAAAAAX14QAEAAAADHBsYXllcnNQcml6ZQAAAAAAC+vCAAQAAAAKYm94ZXNDb3VudAAAAAAAAAAABQQAAAAZbWF5YmVEYXRhUGxheWVyc1B1YmxpY0tleQkABB0AAAACCAUAAAACdHgAAAAGc2VuZGVyAgAAABBwbGF5ZXJzUHVibGljS2V5BAAAABRkYXRhUGxheWVyc1B1YmxpY0tleQkAAlkAAAABCQEAAAAHZXh0cmFjdAAAAAEFAAAAGW1heWJlRGF0YVBsYXllcnNQdWJsaWNLZXkEAAAADGRhdGFMb2NrZWRBdAkBAAAAB2V4dHJhY3QAAAABCQAEGgAAAAIIBQAAAAJ0eAAAAAZzZW5kZXICAAAACGxvY2tlZEF0BAAAABZtYXliZURhdGFQbGF5ZXJzQ2h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ADdHR4AAAACXJlY2lwaWVudAUAAAANd2lubmVyQWRkcmVzcwQAAAAPYW1vdW50SXNDb3JyZWN0CQAAAAAAAAIIBQAAAAN0dHgAAAAGYW1vdW50CQAAZAAAAAIFAAAADHBsYXllcnNQcml6ZQUAAAADYmV0AwMFAAAAB2ZlZUlzT2sFAAAAEXByaXplR29lc1RvV2lubmVyBwUAAAAPYW1vdW50SXNDb3JyZWN0BwMFAAAAHWlzQ2FzaW5vRGVjaWRlZE5vdFRvUGxheVN0YXRlBAAAABFyZWNpcGllbnRJc1BsYXllcgkAAAAAAAACCAUAAAADdHR4AAAACXJlY2lwaWVudAUAAAAOcGxheWVyc0FkZHJlc3MEAAAAD2Ftb3VudElzQ29ycmVudAkAAAAAAAACCAUAAAADdHR4AAAABmFtb3VudAkAAGQAAAACBQAAAAxwbGF5ZXJzUHJpemUFAAAAA2JldAMDBQAAAAdmZWVJc09rBQAAABFyZWNpcGllbnRJc1BsYXllcgcFAAAAD2Ftb3VudElzQ29ycmVudAcDBQAAACBpc1BsYXllckRlY2lkZWROb3RUb1NlbmRCZXRTdGF0ZQQAAAARcmVjaXBpZW50SXNDYXNpbm8JAAAAAAAAAggFAAAAA3R0eAAAAAlyZWNpcGllbnQFAAAADmNhc2lub3NBZGRyZXNzBAAAAA9hbW91bnRJc0NvcnJlY3QJAAAAAAAAAggFAAAAA3R0eAAAAAZhbW91bnQFAAAADHBsYXllcnNQcml6ZQMDBQAAAAdmZWVJc09rBQAAABFyZWNpcGllbnRJc0Nhc2lubwcFAAAAD2Ftb3VudElzQ29ycmVjdAcHB2Kw5ns=", "chainId": 84, "height": 404403, "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'EhyhHkMbyNu8PwHoiJVCq2SciN9FmM5KvBeSN2NkTmeL' | |
4 | + | let enctyptedCasinosChoice = base58'8AvNXcEhp95CU4371ZxjWzCzWHfiVg17691fo3QA3Tut' | |
5 | + | let bet = 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 maybeDataCasinosChoice = getInteger(tx.sender, "casinosChoice") | |
14 | + | let dataCasinosChoice = extract(maybeDataCasinosChoice) | |
15 | + | let timeoutInBlocks = 120 | |
16 | + | let dataTransactionFee = 500000 | |
17 | + | let transferTransactionFee = 500000 | |
18 | + | let casinosAddress = addressFromPublicKey(casinosPublicKey) | |
19 | + | let playersAddress = addressFromPublicKey(dataPlayersPublicKey) | |
20 | + | let accountBalance = wavesBalance(tx.sender) | |
21 | + | let senderIsCasino = sigVerify(tx.bodyBytes, tx.proofs[0], casinosPublicKey) | |
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(maybeDataCasinosChoice)) | |
38 | + | else false | |
39 | + | let playerRevealedStateTimeout = if ((height > (dataLockedAt + (timeoutInBlocks * 2)))) | |
40 | + | then (accountBalance >= (((playersPrize + bet) + dataTransactionFee) + transferTransactionFee)) | |
41 | + | else false | |
42 | + | let isPlayerRevealedHisChoiceState = if (dataIsValidForPlayerRevealedState) | |
43 | + | then !(playerRevealedStateTimeout) | |
44 | + | else false | |
45 | + | let isCasinoDecidedNotToPlayState = if (dataIsValidForPlayerRevealedState) | |
46 | + | then playerRevealedStateTimeout | |
47 | + | else false | |
48 | + | let isDataValidForWinnerIsDeterminedState = isDefined(maybeDataCasinosChoice) | |
49 | + | let isBalanceValidForWinnerIsDeterminedState = (accountBalance >= ((playersPrize + bet) + transferTransactionFee)) | |
50 | + | let isWinnerIsDeterminedState = if (isDataValidForWinnerIsDeterminedState) | |
51 | + | then isBalanceValidForWinnerIsDeterminedState | |
52 | + | else false | |
53 | + | let isPlayerDecidedNotToSendBetState = 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 feeIsOk = (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 | + | let noOtherDataWasProvided = (payloadSize == 2) | |
75 | + | if (if (if (if (senderIsCasino) | |
76 | + | then feeIsOk | |
77 | + | else false) | |
78 | + | then validLockedAtIsProvided | |
79 | + | else false) | |
80 | + | then playersPublicKeyIsProvided | |
81 | + | else false) | |
82 | + | then noOtherDataWasProvided | |
83 | + | else false | |
84 | + | } | |
85 | + | else if (isLockedState) | |
86 | + | then { | |
87 | + | let validPlayersChoiceIsProvided = if ((firstPayloadName == "playersChoice")) | |
88 | + | then if ((firstPayloadAsInteger >= 0)) | |
89 | + | then (boxesCount > firstPayloadAsInteger) | |
90 | + | else false | |
91 | + | else false | |
92 | + | let noOtherDataWasProvided = (payloadSize == 1) | |
93 | + | if (if (if (senderIsPlayer) | |
94 | + | then feeIsOk | |
95 | + | else false) | |
96 | + | then validPlayersChoiceIsProvided | |
97 | + | else false) | |
98 | + | then noOtherDataWasProvided | |
99 | + | else false | |
100 | + | } | |
101 | + | else if (isPlayerRevealedHisChoiceState) | |
102 | + | then { | |
103 | + | let validCasinoChoiceWasProvided = if ((firstPayloadName == "casinosChoice")) | |
104 | + | then if ((firstPayloadAsInteger >= 0)) | |
105 | + | then (boxesCount > firstPayloadAsInteger) | |
106 | + | else false | |
107 | + | else false | |
108 | + | let casinosSaltWasProvided = (secondPayloadName == "casinosSalt") | |
109 | + | let choiceAndSaltMatchesHardcodedValue = (keccak256(toBytes((toString(firstPayloadAsInteger) + secondPayloadAsString))) == enctyptedCasinosChoice) | |
110 | + | let noOtherDataWasProvided = (payloadSize == 2) | |
111 | + | if (if (if (if (if (senderIsCasino) | |
112 | + | then feeIsOk | |
113 | + | else false) | |
114 | + | then validCasinoChoiceWasProvided | |
115 | + | else false) | |
116 | + | then casinosSaltWasProvided | |
117 | + | else false) | |
118 | + | then choiceAndSaltMatchesHardcodedValue | |
119 | + | else false) | |
120 | + | then noOtherDataWasProvided | |
121 | + | else false | |
122 | + | } | |
123 | + | else false | |
124 | + | case ttx: TransferTransaction => | |
125 | + | let feeIsOk = (ttx.fee == transferTransactionFee) | |
126 | + | if (isWinnerIsDeterminedState) | |
127 | + | then { | |
128 | + | let winnerAddress = if ((dataCasinosChoice == dataPlayersChoice)) | |
129 | + | then playersAddress | |
130 | + | else casinosAddress | |
131 | + | let prizeGoesToWinner = (ttx.recipient == winnerAddress) | |
132 | + | let amountIsCorrect = (ttx.amount == (playersPrize + bet)) | |
133 | + | if (if (feeIsOk) | |
134 | + | then prizeGoesToWinner | |
135 | + | else false) | |
136 | + | then amountIsCorrect | |
137 | + | else false | |
138 | + | } | |
139 | + | else if (isCasinoDecidedNotToPlayState) | |
140 | + | then { | |
141 | + | let recipientIsPlayer = (ttx.recipient == playersAddress) | |
142 | + | let amountIsCorrent = (ttx.amount == (playersPrize + bet)) | |
143 | + | if (if (feeIsOk) | |
144 | + | then recipientIsPlayer | |
145 | + | else false) | |
146 | + | then amountIsCorrent | |
147 | + | else false | |
148 | + | } | |
149 | + | else if (isPlayerDecidedNotToSendBetState) | |
150 | + | then { | |
151 | + | let recipientIsCasino = (ttx.recipient == casinosAddress) | |
152 | + | let amountIsCorrect = (ttx.amount == playersPrize) | |
153 | + | if (if (feeIsOk) | |
154 | + | then recipientIsCasino | |
155 | + | else false) | |
156 | + | then amountIsCorrect | |
157 | + | else false | |
158 | + | } | |
159 | + | else false | |
160 | + | case _ => | |
161 | + | false | |
162 | + | } |
github/deemru/w8io/169f3d6 19.87 ms ◑