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