tx · 5ApYekggykWacKecidQxgK8fcFaHXJzTMUfYewBahUpr 3N61RCc6F8L7eQ8EHWojfqxbbd2Ch3Z4iKA: -0.01000000 Waves 2019.01.11 11:40 [445043] smart account 3N61RCc6F8L7eQ8EHWojfqxbbd2Ch3Z4iKA > SELF 0.00000000 Waves
{ "type": 13, "id": "5ApYekggykWacKecidQxgK8fcFaHXJzTMUfYewBahUpr", "fee": 1000000, "feeAssetId": null, "timestamp": 1547196058427, "version": 1, "sender": "3N61RCc6F8L7eQ8EHWojfqxbbd2Ch3Z4iKA", "senderPublicKey": "HNhG4nzNragSh5vbwudjhEvrfcRu8LwsBFEf853nYzS9", "proofs": [ "2VGW53HfknLgnYsc8o4Qt15DyfbMpnhaJmdzYkQDdrXxQDbJQrV8EU1wFKxqVVFoZGxHfnR9rRXPJhUMKcCgbLeY" ], "script": "base64:AQQAAAAQc2VydmVyc1B1YmxpY0tleQEAAAAgHipkt9S/3AqIOKX1DANBMFpryhD+GIFz8RTy9kyu4UcEAAAAFmVuY3R5cHRlZFNlcnZlcnNDaG9pY2UBAAAAIJxFqtq6Stp7F5ZI6YVzu7nDwIzlzq5Wv8KJwKQTvETnBAAAAAhkb25hdGlvbgAAAAAABfXhAAQAAAAKc2VydmVyc0ZlZQAAAAAAAA9CQAQAAAAZbWF5YmVEYXRhUGxheWVyc1B1YmxpY0tleQkABB0AAAACCAUAAAACdHgAAAAGc2VuZGVyAgAAABBwbGF5ZXJzUHVibGljS2V5BAAAABRkYXRhUGxheWVyc1B1YmxpY0tleQkAAlkAAAABCQEAAAAHZXh0cmFjdAAAAAEFAAAAGW1heWJlRGF0YVBsYXllcnNQdWJsaWNLZXkEAAAADGRhdGFMb2NrZWRBdAkBAAAAB2V4dHJhY3QAAAABCQAEGgAAAAIIBQAAAAJ0eAAAAAZzZW5kZXICAAAACGxvY2tlZEF0BAAAABZtYXliZURhdGFQbGF5ZXJzQ2hvaWNlCQAEGgAAAAIIBQAAAAJ0eAAAAAZzZW5kZXICA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lBwQAAAAPZmVlR29lc1RvU2VydmVyAwkAAAAAAAACCAkAAZEAAAACCAUAAAADbXR4AAAACXRyYW5zZmVycwAAAAAAAAAAAQAAAAlyZWNpcGllbnQFAAAADnNlcnZlcnNBZGRyZXNzCQAAAAAAAAIICQABkQAAAAIIBQAAAANtdHgAAAAJdHJhbnNmZXJzAAAAAAAAAAABAAAABmFtb3VudAUAAAAKc2VydmVyc0ZlZQcEAAAAFXRoZXJlQXJlVHdvUmVjaXBpZW50cwkAAAAAAAACCAUAAAADbXR4AAAADXRyYW5zZmVyQ291bnQAAAAAAAAAAAIDAwMFAAAAB2ZlZUlzT2sFAAAAEXByaXplR29lc1RvV2lubmVyBwUAAAAPZmVlR29lc1RvU2VydmVyBwUAAAAVdGhlcmVBcmVUd29SZWNpcGllbnRzBwcH3lWJuQ==", "chainId": 84, "height": 445043, "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 serversPublicKey = base58'32kizC3bBgzqzBEXSp9A4tiJUWgcYLR8wGPMC6aA3MdG' | |
4 | + | let enctyptedServersChoice = base58'BX2DUSKnigWNaDHaevdgZmpyzY5K42YuLN2JwUsazx1t' | |
5 | + | let donation = 100000000 | |
6 | + | let serversFee = 1000000 | |
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 maybeDataServersChoice = getInteger(tx.sender, "serversChoice") | |
13 | + | let dataServersChoice = extract(maybeDataServersChoice) | |
14 | + | let timeoutInBlocks = 120 | |
15 | + | let dataTransactionFee = 500000 | |
16 | + | let transferTransactionFee = 500000 | |
17 | + | let massTransferTransactionFee = 600000 | |
18 | + | let serversAddress = addressFromPublicKey(serversPublicKey) | |
19 | + | let playersAddress = addressFromPublicKey(dataPlayersPublicKey) | |
20 | + | let accountBalance = wavesBalance(tx.sender) | |
21 | + | let senderIsServer = sigVerify(tx.bodyBytes, tx.proofs[0], serversPublicKey) | |
22 | + | let senderIsPlayer = sigVerify(tx.bodyBytes, tx.proofs[0], dataPlayersPublicKey) | |
23 | + | let isInitialState = if (!(isDefined(maybeDataPlayersPublicKey))) | |
24 | + | then (accountBalance >= ((donation + (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(maybeDataServersChoice)) | |
38 | + | else false | |
39 | + | let playerRevealedStateTimeout = if ((height > (dataLockedAt + (timeoutInBlocks * 2)))) | |
40 | + | then (accountBalance >= (((donation * 2) + dataTransactionFee) + massTransferTransactionFee)) | |
41 | + | else false | |
42 | + | let isPlayerRevealedHisChoiceState = if (dataIsValidForPlayerRevealedState) | |
43 | + | then !(playerRevealedStateTimeout) | |
44 | + | else false | |
45 | + | let isServerDecidedNotToPlayState = if (dataIsValidForPlayerRevealedState) | |
46 | + | then playerRevealedStateTimeout | |
47 | + | else false | |
48 | + | let isDataValidForWinnerIsDeterminedState = isDefined(maybeDataServersChoice) | |
49 | + | let isBalanceValidForWinnerIsDeterminedState = (accountBalance >= ((donation * 2) + massTransferTransactionFee)) | |
50 | + | let isWinnerIsDeterminedState = if (isDataValidForWinnerIsDeterminedState) | |
51 | + | then isBalanceValidForWinnerIsDeterminedState | |
52 | + | else false | |
53 | + | let isPlayerDecidedNotToSendDonationState = 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 (senderIsServer) | |
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 validServerChoiceWasProvided = if ((firstPayloadName == "serversChoice")) | |
104 | + | then if ((firstPayloadAsInteger == 0)) | |
105 | + | then true | |
106 | + | else (firstPayloadAsInteger == 1) | |
107 | + | else false | |
108 | + | let serversSaltWasProvided = (secondPayloadName == "serversSalt") | |
109 | + | let choiceAndSaltMatchesHardcodedValue = (keccak256(toBytes((toString(firstPayloadAsInteger) + secondPayloadAsString))) == enctyptedServersChoice) | |
110 | + | let noOtherDataWasProvided = (payloadSize == 2) | |
111 | + | if (if (if (if (if (senderIsServer) | |
112 | + | then feeIsOk | |
113 | + | else false) | |
114 | + | then validServerChoiceWasProvided | |
115 | + | else false) | |
116 | + | then serversSaltWasProvided | |
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 (isServerDecidedNotToPlayState) | |
127 | + | then { | |
128 | + | let recipientIsPlayer = (ttx.recipient == playersAddress) | |
129 | + | let amountIsCorrent = (ttx.amount == (donation * 2)) | |
130 | + | if (if (feeIsOk) | |
131 | + | then recipientIsPlayer | |
132 | + | else false) | |
133 | + | then amountIsCorrent | |
134 | + | else false | |
135 | + | } | |
136 | + | else if (isPlayerDecidedNotToSendDonationState) | |
137 | + | then { | |
138 | + | let recipientIsServer = (ttx.recipient == serversAddress) | |
139 | + | let amountIsCorrect = (ttx.amount == donation) | |
140 | + | if (if (feeIsOk) | |
141 | + | then recipientIsServer | |
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 ((dataServersChoice == dataPlayersChoice)) | |
152 | + | then playersAddress | |
153 | + | else serversAddress | |
154 | + | let prizeGoesToWinner = if ((mtx.transfers[0].recipient == winnerAddress)) | |
155 | + | then (mtx.transfers[0].amount == ((donation * 2) - serversFee)) | |
156 | + | else false | |
157 | + | let feeGoesToServer = if ((mtx.transfers[1].recipient == serversAddress)) | |
158 | + | then (mtx.transfers[1].amount == serversFee) | |
159 | + | else false | |
160 | + | let thereAreTwoRecipients = (mtx.transferCount == 2) | |
161 | + | if (if (if (feeIsOk) | |
162 | + | then prizeGoesToWinner | |
163 | + | else false) | |
164 | + | then feeGoesToServer | |
165 | + | else false) | |
166 | + | then thereAreTwoRecipients | |
167 | + | else false | |
168 | + | } | |
169 | + | else false | |
170 | + | case _ => | |
171 | + | false | |
172 | + | } |
github/deemru/w8io/026f985 16.03 ms ◑