tx · 7q18P7Po2fqu7W2hfw4kf28cz6VEoEtVAN7U8VB3mLqD 3MqEdgLae5qCkoQQpGUBopbbQqxibHAhaUn: -0.01000000 Waves 2019.01.25 17:12 [465812] smart account 3MqEdgLae5qCkoQQpGUBopbbQqxibHAhaUn > SELF 0.00000000 Waves
{ "type": 13, "id": "7q18P7Po2fqu7W2hfw4kf28cz6VEoEtVAN7U8VB3mLqD", "fee": 1000000, "feeAssetId": null, "timestamp": 1548425592344, "version": 1, "sender": "3MqEdgLae5qCkoQQpGUBopbbQqxibHAhaUn", "senderPublicKey": "7UGLAZWDboB629P2BMwYndnukukT36G2PZYLcUkyQ1Nf", "proofs": [ "2z7xKi47XAcMz2Fqr8bt4n4kAPUYncz6SwrPgqoWjGfdacoxnoqdZeaM9ZWpq614ibHygJbfMZ3tXtMxgctomgMj" ], "script": "base64:AQQAAAAQY2FzaW5vc1B1YmxpY0tleQEAAAAg++4D0np85s4U1tfih28Ct9RpE6ePus2LI+C3n9wjllsEAAAAFmVuY3R5cHRlZENhc2lub3NDaG9pY2UBAAAAICVi0hBfcV1UCBcNCDjwiiEXJFF5X83lPcrHCK1SrQeJBAAAAANiZXQAAAAAAFloLwAEAAAACmNhc2lub3NGZWUAAAAAAADk4cAEAAAAFGRhdGFQbGF5ZXJzUHVibGljS2V5AQAAACAmiwIsrN/ukKYFBxoeAMX5uBcZmsePVFRLwDWPO9vhdQQAAAAMZGF0YUxvY2tlZEF0AAAAAAAABxuUBAAAABZtYXliZURhdGFQbGF5ZXJzQ2hvaWNlCQAEGgAAAAIIBQAAAAJ0eAAAAAZzZW5kZXICAAAADXBsYXllcnNDaG9pY2UEAAAAEWRhdGFQbGF5ZXJzQ2hvaWNlCQEAAAAHZXh0cmFjdAAAAAEFAAAAFm1heWJlRGF0YVBsYXllcnNDaG9pY2UEAAAAFm1heWJlRGF0YUNhc2lub3NDaG9pY2UJAAQaAAAAAggFAAAAAnR4AAAABnNlbmRlcgIAAAANc2VydmVyc0Nob2ljZQ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ANd2lubmVyQWRkcmVzcwkAAAAAAAACCAkAAZEAAAACCAUAAAADbXR4AAAACXRyYW5zZmVycwAAAAAAAAAAAAAAAAZhbW91bnQJAABlAAAAAgkAAGgAAAACBQAAAANiZXQAAAAAAAAAAAIFAAAACmNhc2lub3NGZWUHBAAAAA9mZWVHb2VzVG9DYXNpbm8DCQAAAAAAAAIICQABkQAAAAIIBQAAAANtdHgAAAAJdHJhbnNmZXJzAAAAAAAAAAABAAAACXJlY2lwaWVudAUAAAAOY2FzaW5vc0FkZHJlc3MJAAAAAAAAAggJAAGRAAAAAggFAAAAA210eAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAEAAAAGYW1vdW50BQAAAApjYXNpbm9zRmVlBwQAAAAVdGhlcmVBcmVUd29SZWNpcGllbnRzCQAAAAAAAAIIBQAAAANtdHgAAAANdHJhbnNmZXJDb3VudAAAAAAAAAAAAgMDAwUAAAAHZmVlSXNPawUAAAARcHJpemVHb2VzVG9XaW5uZXIHBQAAAA9mZWVHb2VzVG9DYXNpbm8HBQAAABV0aGVyZUFyZVR3b1JlY2lwaWVudHMHBwccHiUQ", "chainId": 84, "height": 465812, "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'3WwUyCajf3qjKohEG8MjCCJijKMGAic5vYeqKpqTYRXe' | |
5 | + | let bet = 1500000000 | |
6 | + | let casinosFee = 15000000 | |
7 | + | let dataPlayersPublicKey = base58'3bTS5N8xHdymtTeUGTX7NLoocBpnpzVDy7LpTqUjYcvp' | |
8 | + | let dataLockedAt = 465812 | |
9 | + | let maybeDataPlayersChoice = getInteger(tx.sender, "playersChoice") | |
10 | + | let dataPlayersChoice = extract(maybeDataPlayersChoice) | |
11 | + | let maybeDataCasinosChoice = getInteger(tx.sender, "serversChoice") | |
12 | + | let dataCasinosChoice = extract(maybeDataCasinosChoice) | |
13 | + | let timeoutInBlocks = 120 | |
14 | + | let dataTransactionFee = 500000 | |
15 | + | let transferTransactionFee = 500000 | |
16 | + | let massTransferTransactionFee = 600000 | |
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) + dataTransactionFee) + massTransferTransactionFee)) | |
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) + massTransferTransactionFee)) | |
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 (isCasinoDecidedNotToPlayState) | |
115 | + | then { | |
116 | + | let recipientIsPlayer = (ttx.recipient == playersAddress) | |
117 | + | let amountIsCorrent = (ttx.amount == (bet * 2)) | |
118 | + | if (if (feeIsOk) | |
119 | + | then recipientIsPlayer | |
120 | + | else false) | |
121 | + | then amountIsCorrent | |
122 | + | else false | |
123 | + | } | |
124 | + | else if (isPlayerDecidedNotToSendBetState) | |
125 | + | then { | |
126 | + | let recipientIsCasino = (ttx.recipient == casinosAddress) | |
127 | + | let amountIsCorrect = (ttx.amount == bet) | |
128 | + | if (if (feeIsOk) | |
129 | + | then recipientIsCasino | |
130 | + | else false) | |
131 | + | then amountIsCorrect | |
132 | + | else false | |
133 | + | } | |
134 | + | else false | |
135 | + | case mtx: MassTransferTransaction => | |
136 | + | let feeIsOk = (mtx.fee == massTransferTransactionFee) | |
137 | + | if (isWinnerIsDeterminedState) | |
138 | + | then { | |
139 | + | let winnerAddress = if ((dataCasinosChoice == dataPlayersChoice)) | |
140 | + | then playersAddress | |
141 | + | else casinosAddress | |
142 | + | let prizeGoesToWinner = if ((mtx.transfers[0].recipient == winnerAddress)) | |
143 | + | then (mtx.transfers[0].amount == ((bet * 2) - casinosFee)) | |
144 | + | else false | |
145 | + | let feeGoesToCasino = if ((mtx.transfers[1].recipient == casinosAddress)) | |
146 | + | then (mtx.transfers[1].amount == casinosFee) | |
147 | + | else false | |
148 | + | let thereAreTwoRecipients = (mtx.transferCount == 2) | |
149 | + | if (if (if (feeIsOk) | |
150 | + | then prizeGoesToWinner | |
151 | + | else false) | |
152 | + | then feeGoesToCasino | |
153 | + | else false) | |
154 | + | then thereAreTwoRecipients | |
155 | + | else false | |
156 | + | } | |
157 | + | else false | |
158 | + | case _ => | |
159 | + | false | |
160 | + | } |
github/deemru/w8io/169f3d6 28.72 ms ◑