tx · 5cfbSrTcrNS65p4hLdtqJBp8PhXZvQjt7rJoPnqh54wn 3NAH3sAy7NWNC7D3Z1PEBnNbzy8Wa5fsZUW: -0.01000000 Waves 2018.11.17 22:24 [380204] smart account 3NAH3sAy7NWNC7D3Z1PEBnNbzy8Wa5fsZUW > SELF 0.00000000 Waves
{ "type": 13, "id": "5cfbSrTcrNS65p4hLdtqJBp8PhXZvQjt7rJoPnqh54wn", "fee": 1000000, "feeAssetId": null, "timestamp": 1542482662170, "version": 1, "sender": "3NAH3sAy7NWNC7D3Z1PEBnNbzy8Wa5fsZUW", "senderPublicKey": "Fo1nRCD66GDpafUVoV8gJs59ShVUr6MvnDPqK4ABDofM", "proofs": [ "5on1hPSZfTZjp1Vrny5jHVwKLpuCcpSAGu5pn8J8jw6qtzBKv7rxQL1sF7xMSsA6TTtMd1NskBmzCnSxCqUTp5MQ" ], "script": "base64:AQQAAAAKcGxheWVyQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVGn3krpaDTc+j3YI5REPQQIdPTpGX/43ZAQAAAAMcGxheWVyUHViS2V5AQAAACDLp0RpVCULejfAo54x+7hkLm7IuSlV5e+7DIA+iWH4RQQAAAAKY2FzaW5vQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVGn3krpaDTc+j3YI5REPQQIdPTpGX/43ZAQAAAAMY2FzaW5vUHViS2V5AQAAACDLp0RpVCULejfAo54x+7hkLm7IuSlV5e+7DIA+iWH4RQQAAAAMcGxheWVyU2lnbmVkCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAMcGxheWVyUHViS2V5BAAAAAxjYXNpbm9TaWduZWQJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAxjYXNpbm9QdWJLZXkEAAAAAm1lCAUAAAACdH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 380204, "spentComplexity": 0 } View: original | compacted Prev: none Next: BvbibUhuBzo1Q3cyYTom1hGYFH97C9ktG8WjUDVB1spk Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 1 #-} | |
2 | + | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | + | let playerAddr = Address(base58'3MyaPJkHmZy4u57uKcHXgzQxsk9wAP9LTZ5') | |
4 | + | let playerPubKey = base58'EhyhHkMbyNu8PwHoiJVCq2SciN9FmM5KvBeSN2NkTmeL' | |
5 | + | let casinoAddr = Address(base58'3MyaPJkHmZy4u57uKcHXgzQxsk9wAP9LTZ5') | |
6 | + | let casinoPubKey = base58'EhyhHkMbyNu8PwHoiJVCq2SciN9FmM5KvBeSN2NkTmeL' | |
7 | + | let playerSigned = sigVerify(tx.bodyBytes, tx.proofs[0], playerPubKey) | |
8 | + | let casinoSigned = sigVerify(tx.bodyBytes, tx.proofs[0], casinoPubKey) | |
9 | + | let me = tx.sender | |
10 | + | let casinoBet = 303000000 | |
11 | + | let playerBet = 100000000 | |
12 | + | let gameBalance = (casinoBet + playerBet) | |
13 | + | let start = 380204 | |
14 | + | let playerRangeSize = 0 | |
15 | + | let balance = wavesBalance(me) | |
16 | + | let casinoChoiceHash = base58'CKeQzAitXR6CEtwLM2kGFYTk87kFrc1SFANCBPmyx7cM' | |
17 | + | let dice1 = extract(getInteger(me, "dice1")) | |
18 | + | let dice2 = extract(getInteger(me, "dice2")) | |
19 | + | let casinoDice = extract(getInteger(me, "casinoDice")) | |
20 | + | let playerDepositOk = (balance >= (casinoBet + playerBet)) | |
21 | + | let playerDepositTurn = if (if (((start + 50) > height)) | |
22 | + | then (balance >= casinoBet) | |
23 | + | else false) | |
24 | + | then !(playerDepositOk) | |
25 | + | else false | |
26 | + | let playerBetOk = if ((dice1 > 0)) | |
27 | + | then (dice2 > 0) | |
28 | + | else false | |
29 | + | let playerBetTurn = if (if (((start + 100) > height)) | |
30 | + | then playerDepositOk | |
31 | + | else false) | |
32 | + | then !(playerBetOk) | |
33 | + | else false | |
34 | + | let casinoBetOk = (casinoDice > 0) | |
35 | + | let casinoBetTurn = if (if (((start + 200) > height)) | |
36 | + | then playerBetOk | |
37 | + | else false) | |
38 | + | then !(casinoBetOk) | |
39 | + | else false | |
40 | + | let prizeTurn = casinoBetOk | |
41 | + | let playerEmergencyTakeTurn = if ((height >= (start + 300))) | |
42 | + | then !(casinoBetOk) | |
43 | + | else false | |
44 | + | let casinoCanEmergencyTakeTurn = if ((height >= (start + 100))) | |
45 | + | then if (!(playerDepositOk)) | |
46 | + | then true | |
47 | + | else !(playerBetOk) | |
48 | + | else false | |
49 | + | match tx { | |
50 | + | case dtx: DataTransaction => | |
51 | + | let num = size(dtx.data) | |
52 | + | let choice1 = extract(getInteger(dtx.data, "dice1")) | |
53 | + | let choice2 = extract(getInteger(dtx.data, "dice2")) | |
54 | + | let casinoChoice = extract(getInteger(dtx.data, "casinoDice")) | |
55 | + | let salt = extract(getString(dtx.data, "salt")) | |
56 | + | let playerDicesInRange = if (if (if ((choice1 >= 1)) | |
57 | + | then (100 >= choice1) | |
58 | + | else false) | |
59 | + | then if ((choice2 >= 1)) | |
60 | + | then (100 >= choice2) | |
61 | + | else false | |
62 | + | else false) | |
63 | + | then (choice2 >= choice1) | |
64 | + | else false | |
65 | + | let playerRangeCorrect = ((choice2 - choice1) == playerRangeSize) | |
66 | + | let casinoDicesInRange = if ((casinoChoice >= 1)) | |
67 | + | then (100 >= casinoChoice) | |
68 | + | else false | |
69 | + | let newHash = keccak256(toBytes((toString(casinoChoice) + salt))) | |
70 | + | let casinoVerified = (newHash == casinoChoiceHash) | |
71 | + | let playerInputCorrect = if (playerDicesInRange) | |
72 | + | then (num == 2) | |
73 | + | else false | |
74 | + | let casinoInputCorrect = if (if (casinoDicesInRange) | |
75 | + | then casinoVerified | |
76 | + | else false) | |
77 | + | then (num == 2) | |
78 | + | else false | |
79 | + | if (if (if (casinoSigned) | |
80 | + | then casinoBetTurn | |
81 | + | else false) | |
82 | + | then casinoInputCorrect | |
83 | + | else false) | |
84 | + | then true | |
85 | + | else if (if (playerSigned) | |
86 | + | then playerBetTurn | |
87 | + | else false) | |
88 | + | then playerInputCorrect | |
89 | + | else false | |
90 | + | case ttx: TransferTransaction => | |
91 | + | let betInRange = if ((casinoDice >= dice1)) | |
92 | + | then (dice2 >= casinoDice) | |
93 | + | else false | |
94 | + | let withdrawCorrect = if ((ttx.amount >= 10000000)) | |
95 | + | then (1000000 >= ttx.fee) | |
96 | + | else false | |
97 | + | let playerWin = if (casinoBetOk) | |
98 | + | then betInRange | |
99 | + | else false | |
100 | + | let casinoWin = if (casinoBetOk) | |
101 | + | then !(betInRange) | |
102 | + | else false | |
103 | + | let playerCanTakePrize = if (prizeTurn) | |
104 | + | then playerWin | |
105 | + | else false | |
106 | + | let playerCanTake = if (if (playerCanTakePrize) | |
107 | + | then true | |
108 | + | else playerEmergencyTakeTurn) | |
109 | + | then (ttx.recipient == playerAddr) | |
110 | + | else false | |
111 | + | let casinoCanTakePrize = if (if (prizeTurn) | |
112 | + | then casinoWin | |
113 | + | else false) | |
114 | + | then (ttx.recipient == casinoAddr) | |
115 | + | else false | |
116 | + | let casinoCanTake = if (if (casinoCanTakePrize) | |
117 | + | then true | |
118 | + | else casinoCanEmergencyTakeTurn) | |
119 | + | then (ttx.recipient == casinoAddr) | |
120 | + | else false | |
121 | + | if (if (playerCanTake) | |
122 | + | then true | |
123 | + | else casinoCanTake) | |
124 | + | then withdrawCorrect | |
125 | + | else false | |
126 | + | case _ => | |
127 | + | true | |
128 | + | } |
github/deemru/w8io/026f985 16.83 ms ◑