tx · FfwfjaTVkMi9xXESmMeNtJrQViB2dRC8hzhcTzdLrQx1 3N4AFGKqyT5eY8jxyrJGifCFemviGftuAmz: -0.01000000 Waves 2018.12.17 14:12 [408759] smart account 3N4AFGKqyT5eY8jxyrJGifCFemviGftuAmz > SELF 0.00000000 Waves
{ "type": 13, "id": "FfwfjaTVkMi9xXESmMeNtJrQViB2dRC8hzhcTzdLrQx1", "fee": 1000000, "feeAssetId": null, "timestamp": 1545045154561, "version": 1, "sender": "3N4AFGKqyT5eY8jxyrJGifCFemviGftuAmz", "senderPublicKey": "7iAYNRT26SNG2xcqPonfRicf1KLthXUxHXatfKnS9CZy", "proofs": [ "3YvqW7yNqMpLkpB6HgHYm2TiGygex7vRQCrSUFfvSHBGteeC9V1SmfaUJNZC1v233Hm3ZFwQ24kQKxFk83AEp5as" ], "script": "base64:AQQAAAAQY2FzaW5vc1B1YmxpY0tleQEAAAAgHipkt9S/3AqIOKX1DANBMFpryhD+GIFz8RTy9kyu4UcEAAAAFmVuY3R5cHRlZENhc2lub3NDaG9pY2UBAAAAINC3Upv2NBxM6aGngEu86281schCF/IyDMeTAvpjVzNSBAAAAANiZXQAAAAAADuaygAEAAAACmNhc2lub3NGZWUAAAAAAAAtxsAEAAAAGW1heWJlRGF0YVBsYXllcnNQdWJsaWNLZXkJAAQdAAAAAggFAAAAAnR4AAAABnNlbmRlcgIAAAAQcGxheWVyc1B1YmxpY0tleQQAAAAUZGF0YVBsYXllcnNQdWJsaWNLZXkJAAJZAAAAAQkBAAAAB2V4dHJhY3QAAAABBQAAABltYXliZURhdGFQbGF5ZXJzUHVibGljS2V5BAAAAAxkYXRhTG9ja2VkQXQJAQAAAAdleHRyYWN0AAAAAQkABBoAAAACCAUAAAACdHgAAAAGc2VuZGVyAgAAAAhsb2NrZWRBdAQAAAAWbWF5YmVEYXRhUGxheWVyc0Nob2ljZQkABBoAAAACCAUAAAACdHgAAAAGc2VuZGVyAgAAAA1wbGF5ZXJzQ2hvaWNlBAAAABF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bnQFAAAADmNhc2lub3NBZGRyZXNzCQAAAAAAAAIICQABkQAAAAIIBQAAAANtdHgAAAAJdHJhbnNmZXJzAAAAAAAAAAABAAAABmFtb3VudAUAAAAKY2FzaW5vc0ZlZQcEAAAAFXRoZXJlQXJlVHdvUmVjaXBpZW50cwkAAAAAAAACCAUAAAADbXR4AAAADXRyYW5zZmVyQ291bnQAAAAAAAAAAAIDAwMFAAAAB2ZlZUlzT2sFAAAAEXByaXplR29lc1RvV2lubmVyBwUAAAAPZmVlR29lc1RvQ2FzaW5vBwUAAAAVdGhlcmVBcmVUd29SZWNpcGllbnRzBwcHU9p4/Q==", "chainId": 84, "height": 408759, "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'32kizC3bBgzqzBEXSp9A4tiJUWgcYLR8wGPMC6aA3MdG' | |
4 | + | let enctyptedCasinosChoice = base58'F3jw6Sju3TVXjjhxLdWZPW3bJVBRhMJPTaf3AjNyeey7' | |
5 | + | let bet = 1000000000 | |
6 | + | let casinosFee = 3000000 | |
7 | + | let maybeDataPlayersPublicKey = getString(tx.sender, "playersPublicKey") | |
8 | + | let dataPlayersPublicKey = fromBase58String(extract(maybeDataPlayersPublicKey)) | |
9 | + | let dataLockedAt = extract(getInteger(tx.sender, "lockedAt")) | |
10 | + | let maybeDataPlayersChoice = getInteger(tx.sender, "playersChoice") | |
11 | + | let dataPlayersChoice = extract(maybeDataPlayersChoice) | |
12 | + | let maybeDataCasinosChoice = getInteger(tx.sender, "casinosChoice") | |
13 | + | let dataCasinosChoice = extract(maybeDataCasinosChoice) | |
14 | + | let timeoutInBlocks = 120 | |
15 | + | let dataTransactionFee = 500000 | |
16 | + | let transferTransactionFee = 500000 | |
17 | + | let massTransferTransactionFee = 600000 | |
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 >= ((bet + (dataTransactionFee * 3)) + massTransferTransactionFee)) | |
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 >= (((bet * 2) + dataTransactionFee) + massTransferTransactionFee)) | |
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 >= ((bet * 2) + massTransferTransactionFee)) | |
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 true | |
90 | + | else (firstPayloadAsInteger == 1) | |
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 true | |
106 | + | else (firstPayloadAsInteger == 1) | |
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 (isCasinoDecidedNotToPlayState) | |
127 | + | then { | |
128 | + | let recipientIsPlayer = (ttx.recipient == playersAddress) | |
129 | + | let amountIsCorrent = (ttx.amount == (bet * 2)) | |
130 | + | if (if (feeIsOk) | |
131 | + | then recipientIsPlayer | |
132 | + | else false) | |
133 | + | then amountIsCorrent | |
134 | + | else false | |
135 | + | } | |
136 | + | else if (isPlayerDecidedNotToSendBetState) | |
137 | + | then { | |
138 | + | let recipientIsCasino = (ttx.recipient == casinosAddress) | |
139 | + | let amountIsCorrect = (ttx.amount == bet) | |
140 | + | if (if (feeIsOk) | |
141 | + | then recipientIsCasino | |
142 | + | else false) | |
143 | + | then amountIsCorrect | |
144 | + | else false | |
145 | + | } | |
146 | + | else false | |
147 | + | case mtx: MassTransferTransaction => | |
148 | + | let feeIsOk = (mtx.fee == massTransferTransactionFee) | |
149 | + | if (isWinnerIsDeterminedState) | |
150 | + | then { | |
151 | + | let winnerAddress = if ((dataCasinosChoice == dataPlayersChoice)) | |
152 | + | then playersAddress | |
153 | + | else casinosAddress | |
154 | + | let prizeGoesToWinner = if ((mtx.transfers[0].recipient == winnerAddress)) | |
155 | + | then (mtx.transfers[0].amount == ((bet * 2) - casinosFee)) | |
156 | + | else false | |
157 | + | let feeGoesToCasino = if ((mtx.transfers[1].recipient == casinosAddress)) | |
158 | + | then (mtx.transfers[1].amount == casinosFee) | |
159 | + | else false | |
160 | + | let thereAreTwoRecipients = (mtx.transferCount == 2) | |
161 | + | if (if (if (feeIsOk) | |
162 | + | then prizeGoesToWinner | |
163 | + | else false) | |
164 | + | then feeGoesToCasino | |
165 | + | else false) | |
166 | + | then thereAreTwoRecipients | |
167 | + | else false | |
168 | + | } | |
169 | + | else false | |
170 | + | case _ => | |
171 | + | false | |
172 | + | } |
github/deemru/w8io/fabc49c 17.95 ms ◑