tx · 5MhWw3MjcKLjQo5jVDPHWd4H3LPiicaHnRMeWPArsWFk 3N7fkrhFoyR6SHc84ppB5LcHZZXhXZ3H4uw: -0.01000000 Waves 2018.11.16 13:29 [378176] smart account 3N7fkrhFoyR6SHc84ppB5LcHZZXhXZ3H4uw > SELF 0.00000000 Waves
{ "type": 13, "id": "5MhWw3MjcKLjQo5jVDPHWd4H3LPiicaHnRMeWPArsWFk", "fee": 1000000, "feeAssetId": null, "timestamp": 1542364254607, "version": 1, "sender": "3N7fkrhFoyR6SHc84ppB5LcHZZXhXZ3H4uw", "senderPublicKey": "4amFi6ZuySNQtY2nt448HrSbXpaQGgek8rN398SGSpF4", "proofs": [ "5hxdajuDQoFcMj2HbkX5nJaezSe9FAwE87ycJMgJDfMcBcnFDYSvAb3zWyRFcLTSc1tKphtQUMmh52uGacBqyP8V" ], "script": "base64:AQQAAAAKcGxheWVyQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVGn3krpaDTc+j3YI5REPQQIdPTpGX/43ZAQAAAAMcGxheWVyUHViS2V5AQAAACDLp0RpVCULejfAo54x+7hkLm7IuSlV5e+7DIA+iWH4RQQAAAAKY2FzaW5vQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVHmBRfKn+6Q/pc4CWgpovOtF0ZMmRT9uBwQAAAAMY2FzaW5vUHViS2V5AQAAACD5Xz3klxno1VTvF4KRetO8/FCeOmZpi1KuEatEfCBTPAQAAAAMcGxheWVyU2lnbmVkCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAMcGxheWVyUHViS2V5BAAAAAxjYXNpbm9TaWduZWQJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAxjYXNpbm9QdWJLZXkEAAAAA2JldAAAAAAAAJiWgAQAAAAFc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UAAAAJY2FzaW5vV2luBgUAAAAOcGxheWVyVGFrZVRpbWUGBQAAAA5jYXNpbm9UYWtlVGltZQUAAAAPd2l0aGRyYXdDb3JyZWN0BwbnWAyW", "chainId": 84, "height": 378176, "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 playerAddr = Address(base58'3MyaPJkHmZy4u57uKcHXgzQxsk9wAP9LTZ5') | |
4 | + | let playerPubKey = base58'EhyhHkMbyNu8PwHoiJVCq2SciN9FmM5KvBeSN2NkTmeL' | |
5 | + | let casinoAddr = Address(base58'3MzzYQCC8Ks86exHaWV2VpaANbNLPRDunNJ') | |
6 | + | let casinoPubKey = base58'HnSkSntD7ihFgZpLNmHgdVnVmCYxJLC96eNbubTXsWju' | |
7 | + | let playerSigned = sigVerify(tx.bodyBytes, tx.proofs[0], playerPubKey) | |
8 | + | let casinoSigned = sigVerify(tx.bodyBytes, tx.proofs[0], casinoPubKey) | |
9 | + | let bet = 10000000 | |
10 | + | let start = 378176 | |
11 | + | let playerChoiceTime = 100 | |
12 | + | let casinoChoiceTime = 200 | |
13 | + | let playerTakeTimeStart = 1000 | |
14 | + | let casinoTakeTimeStart = 1500 | |
15 | + | let balance = wavesBalance(tx.sender) | |
16 | + | let casinoChoiceHash = base58'5k5hW9Nuc9923TshvZFhwyGshNHfxK918SSJE6g2QAhi' | |
17 | + | let playerPlacedBet = isDefined(getString(tx.sender, "playerChoice")) | |
18 | + | let casinoPlacedBet = isDefined(getString(tx.sender, "casinoChoice")) | |
19 | + | match tx { | |
20 | + | case dtx: DataTransaction => | |
21 | + | let num = size(dtx.data) | |
22 | + | let key = dtx.data[0].key | |
23 | + | let choice = extract(getString(dtx.data, key)) | |
24 | + | let salt = if (isDefined(dtx.data[1].value)) | |
25 | + | then extract(getString(dtx.data, "salt")) | |
26 | + | else "" | |
27 | + | let inputCorrect = if (if (if (if ((key == "playerChoice")) | |
28 | + | then true | |
29 | + | else (key == "casinoChoice")) | |
30 | + | then if ((choice == "0")) | |
31 | + | then true | |
32 | + | else (choice == "1") | |
33 | + | else false) | |
34 | + | then (balance >= (bet * 2)) | |
35 | + | else false) | |
36 | + | then (2 >= num) | |
37 | + | else false | |
38 | + | let newHash = keccak256(toBytes((choice + salt))) | |
39 | + | let casinoVerified = (newHash == casinoChoiceHash) | |
40 | + | let playerTurn = if (if (if ((key == "playerChoice")) | |
41 | + | then playerSigned | |
42 | + | else false) | |
43 | + | then !(playerPlacedBet) | |
44 | + | else false) | |
45 | + | then ((start + playerChoiceTime) > height) | |
46 | + | else false | |
47 | + | let casinoTurn = if (if (if (if ((key == "casinoChoice")) | |
48 | + | then casinoSigned | |
49 | + | else false) | |
50 | + | then casinoVerified | |
51 | + | else false) | |
52 | + | then !(casinoPlacedBet) | |
53 | + | else false) | |
54 | + | then ((start + casinoChoiceTime) > height) | |
55 | + | else false | |
56 | + | if (inputCorrect) | |
57 | + | then if (playerTurn) | |
58 | + | then true | |
59 | + | else casinoTurn | |
60 | + | else false | |
61 | + | case ttx: TransferTransaction => | |
62 | + | let withdrawCorrect = if ((ttx.amount >= 10000000)) | |
63 | + | then (1000000 >= ttx.fee) | |
64 | + | else false | |
65 | + | let playerTakeTime = if (if ((ttx.recipient == playerAddr)) | |
66 | + | then (height > (start + playerTakeTimeStart)) | |
67 | + | else false) | |
68 | + | then playerPlacedBet | |
69 | + | else false | |
70 | + | let casinoTakeTime = if (if ((ttx.recipient == casinoAddr)) | |
71 | + | then (height > (start + casinoTakeTimeStart)) | |
72 | + | else false) | |
73 | + | then casinoPlacedBet | |
74 | + | else false | |
75 | + | let playerChoise = extract(getString(tx.sender, "playerChoice")) | |
76 | + | let casinoChoise = extract(getString(tx.sender, "casinoChoice")) | |
77 | + | let ready = if (playerPlacedBet) | |
78 | + | then casinoPlacedBet | |
79 | + | else false | |
80 | + | let playerWin = if (if (ready) | |
81 | + | then (playerChoise == casinoChoise) | |
82 | + | else false) | |
83 | + | then (ttx.recipient == playerAddr) | |
84 | + | else false | |
85 | + | let casinoWin = if (if (ready) | |
86 | + | then (playerChoise != casinoChoise) | |
87 | + | else false) | |
88 | + | then (ttx.recipient == casinoAddr) | |
89 | + | else false | |
90 | + | if (if (if (if (playerWin) | |
91 | + | then true | |
92 | + | else casinoWin) | |
93 | + | then true | |
94 | + | else playerTakeTime) | |
95 | + | then true | |
96 | + | else casinoTakeTime) | |
97 | + | then withdrawCorrect | |
98 | + | else false | |
99 | + | case _ => | |
100 | + | true | |
101 | + | } |
github/deemru/w8io/169f3d6 13.53 ms ◑