tx · DXrYn7oafKzBohM5h3s1W4EuP787v1Hr9QYaPniceoCH 3N7PbrqWWJb4To4332umLwtdG2PFFVs9yPk: -0.01000000 Waves 2019.02.20 13:03 [503335] smart account 3N7PbrqWWJb4To4332umLwtdG2PFFVs9yPk > SELF 0.00000000 Waves
{ "type": 13, "id": "DXrYn7oafKzBohM5h3s1W4EuP787v1Hr9QYaPniceoCH", "fee": 1000000, "feeAssetId": null, "timestamp": 1550657095682, "version": 1, "sender": "3N7PbrqWWJb4To4332umLwtdG2PFFVs9yPk", "senderPublicKey": "CMDbKTd9SeJUzUypdWkfKHyMLTtEQHCKG9wUhPuP9Wih", "proofs": [ "3ijbpArs4CxMtVDkWGv3VUKw1AbWHNxsCD7dMc9gpDZks4u8uLyFhF4rYAZVkLpAim4AvJKzUHV87LsZ4m1xAru5" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABXR4RmVlAAAAAAAAB6EgBAAAAAd0aW1lb3V0AAAAAAAAAAWgBAAAABBzZXJ2ZXJUaW1lb3V0R2FwAAAAAAAAAAAeBAAAAAhsaWZlc3BhbgAAAAAAAAAH0AQAAAADZXJyCQAAAgAAAAECAAAAAAQAAAAVc2VydmVyQ2hvaWNlSGFzaEJ5dGVzCQACWQAAAAECAAAALEo0NFhOaW5lUmlFbjdoWEVyZmZmY3NHMjI1QldySkw1VTdISmVQVXNkOEh4BAAAAA9zZXJ2ZXJQdWJsaWNLZXkJAAJZAAAAAQIAAAArUm1iNWpVZU5LQURKR0t0RVpLckQ1a29aWFN2SGRDWDJwZkZSeTZiN2ViSwQAAAAGc2VydmVyCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTkNuUHJwNXNSM01YRGVrNld0eEpNWmNBdnY3dENORmh0cgQAAAAGcGxheWVyCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTXZjS0xyN3VSZDdSWHlKdldBZ2ZWeERoQXZZNlJGcGJvOAQAAA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lckNob2ljZQcDAwMJAAAAAAAAAggFAAAABnBheW91dAAAAAlyZWNpcGllbnQDBQAAAApwbGF5ZXJXaW5zBQAAAAZwbGF5ZXIFAAAABnNlcnZlcgkAAfQAAAADCAUAAAAGcGF5b3V0AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAAGcGF5b3V0AAAABnByb29mcwAAAAAAAAAAAQUAAAAPc2VydmVyUHVibGljS2V5BwkAAAAAAAACCQAB9QAAAAEFAAAAFHNlcnZlckNob2ljZVdpdGhTYWx0BQAAABVzZXJ2ZXJDaG9pY2VIYXNoQnl0ZXMHCQAAAAAAAAIJAADIAAAAAQUAAAAUc2VydmVyQ2hvaWNlV2l0aFNhbHQAAAAAAAAAACYHBwUAAAADZXJyBwUAAAADZXJyB7pG6tU=", "chainId": 84, "height": 503335, "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 me = tx.sender | |
4 | + | let txFee = 500000 | |
5 | + | let timeout = 1440 | |
6 | + | let serverTimeoutGap = 30 | |
7 | + | let lifespan = 2000 | |
8 | + | let err = throw("") | |
9 | + | let serverChoiceHashBytes = fromBase58String("J44XNineRiEn7hXErfffcsG225BWrJL5U7HJePUsd8Hx") | |
10 | + | let serverPublicKey = fromBase58String("Rmb5jUeNKADJGKtEZKrD5koZXSvHdCX2pfFRy6b7ebK") | |
11 | + | let server = addressFromString("3NCnPrp5sR3MXDek6WtxJMZcAvv7tCNFhtr") | |
12 | + | let player = addressFromString("3MvcKLr7uRd7RXyJvWAgfVxDhAvY6RFpbo8") | |
13 | + | let totalServerFunds = 30000000 | |
14 | + | let startingHeight = 503335 | |
15 | + | let diceCount = 1 | |
16 | + | let bet = 30000000 | |
17 | + | if ((height >= startingHeight)) | |
18 | + | then match tx { | |
19 | + | case payout: TransferTransaction => | |
20 | + | if (if (if (if ((payout.amount == (wavesBalance(me) - txFee))) | |
21 | + | then !(isDefined(payout.assetId)) | |
22 | + | else false) | |
23 | + | then !(isDefined(payout.feeAssetId)) | |
24 | + | else false) | |
25 | + | then (payout.fee == txFee) | |
26 | + | else false) | |
27 | + | then if (((height - startingHeight) > lifespan)) | |
28 | + | then (payout.recipient == server) | |
29 | + | else { | |
30 | + | let paymentId = payout.proofs[0] | |
31 | + | match transactionById(paymentId) { | |
32 | + | case payment: TransferTransaction => | |
33 | + | let paymentHeight = extract(transactionHeightById(paymentId)) | |
34 | + | if (if (if (if ((payment.amount == bet)) | |
35 | + | then (payment.recipient == me) | |
36 | + | else false) | |
37 | + | then (payment.sender == player) | |
38 | + | else false) | |
39 | + | then !(isDefined(payment.assetId)) | |
40 | + | else false) | |
41 | + | then if ((paymentHeight > ((startingHeight + timeout) - serverTimeoutGap))) | |
42 | + | then (payout.recipient == server) | |
43 | + | else if (if (((totalServerFunds + bet) > wavesBalance(me))) | |
44 | + | then true | |
45 | + | else (height > (startingHeight + timeout))) | |
46 | + | then (payout.recipient == player) | |
47 | + | else { | |
48 | + | let serverChoiceWithSalt = payout.attachment | |
49 | + | let playerChoice = payment.attachment | |
50 | + | let s = size(playerChoice) | |
51 | + | let serverChoice = take(serverChoiceWithSalt, 1) | |
52 | + | let serverChoiceValid = if (if (if (if (if ((serverChoice == toBytes("1"))) | |
53 | + | then true | |
54 | + | else (serverChoice == toBytes("2"))) | |
55 | + | then true | |
56 | + | else (serverChoice == toBytes("3"))) | |
57 | + | then true | |
58 | + | else (serverChoice == toBytes("4"))) | |
59 | + | then true | |
60 | + | else (serverChoice == toBytes("5"))) | |
61 | + | then true | |
62 | + | else (serverChoice == toBytes("6")) | |
63 | + | let playerWins = if (!(serverChoiceValid)) | |
64 | + | then true | |
65 | + | else if (if (if (if (if (if ((s == diceCount)) | |
66 | + | then if ((s >= 1)) | |
67 | + | then (take(drop(playerChoice, 0), 1) == serverChoice) | |
68 | + | else false | |
69 | + | else false) | |
70 | + | then true | |
71 | + | else if ((s >= 2)) | |
72 | + | then (take(drop(playerChoice, 1), 1) == serverChoice) | |
73 | + | else false) | |
74 | + | then true | |
75 | + | else if ((s >= 3)) | |
76 | + | then (take(drop(playerChoice, 2), 1) == serverChoice) | |
77 | + | else false) | |
78 | + | then true | |
79 | + | else if ((s >= 4)) | |
80 | + | then (take(drop(playerChoice, 3), 1) == serverChoice) | |
81 | + | else false) | |
82 | + | then true | |
83 | + | else if ((s >= 5)) | |
84 | + | then (take(drop(playerChoice, 4), 1) == serverChoice) | |
85 | + | else false) | |
86 | + | then true | |
87 | + | else if ((s >= 6)) | |
88 | + | then (take(drop(playerChoice, 5), 1) == serverChoice) | |
89 | + | else false | |
90 | + | if (if (if ((payout.recipient == (if (playerWins) | |
91 | + | then player | |
92 | + | else server))) | |
93 | + | then sigVerify(payout.bodyBytes, payout.proofs[1], serverPublicKey) | |
94 | + | else false) | |
95 | + | then (keccak256(serverChoiceWithSalt) == serverChoiceHashBytes) | |
96 | + | else false) | |
97 | + | then (size(serverChoiceWithSalt) == 38) | |
98 | + | else false | |
99 | + | } | |
100 | + | else false | |
101 | + | case _ => | |
102 | + | err | |
103 | + | } | |
104 | + | } | |
105 | + | else false | |
106 | + | case _ => | |
107 | + | err | |
108 | + | } | |
109 | + | else false |
github/deemru/w8io/169f3d6 39.55 ms ◑