tx · 9sc3kgzBMgdmoWRRQ124cw9gpL5mqbZzdqrSYLdspddK 3N8GJgmMBsrwhn6uQstYAmqZBLuupZEGXr9: -0.01400000 Waves 2019.07.27 18:19 [604644] smart account 3N8GJgmMBsrwhn6uQstYAmqZBLuupZEGXr9 > SELF 0.00000000 Waves
{ "type": 13, "id": "9sc3kgzBMgdmoWRRQ124cw9gpL5mqbZzdqrSYLdspddK", "fee": 1400000, "feeAssetId": null, "timestamp": 1564240800440, "version": 1, "sender": "3N8GJgmMBsrwhn6uQstYAmqZBLuupZEGXr9", "senderPublicKey": "BUuYfkh9hHixwVUQvqzkLkLbWrQYnWpJ8FXVjZUPxBcm", "proofs": [ "4sJ9A1M9ZW5xwuLbEhHGbwGUFJD5djSCajPcHS6v2JHtjGeUKMdoyv9VJLzg9yGCRA6Q5BwdeFmocRaa9BiGuaSE" ], "script": "base64:AAIDAAAAAAAAAAAAAAAHAAAAAAlzbG90Q291bnQAAAAAAAAAAGQAAAAABXNsb3RzCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAABCQAETAAAA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AAAAAABCQAAAAAAAAIFAAAABHNtdDIAAAAAAAAAAAEHCQAAAAAAAAIFAAAABHNtdDMAAAAAAAAAAAEHCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAVzbG90MQIAAAABXwUAAAAFc2xvdDICAAAAAV8FAAAABXNsb3QzCQABLAAAAAIJAAEsAAAAAgUAAAAGcGxheWVyAgAAAAFfBQAAAAl0aW1lc3RhbXAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAADaW52AAAABmNhbGxlcgkAAGkAAAACCQAAaAAAAAIIBQAAAAdwYXltZW50AAAABmFtb3VudAAAAAAAAAAAvgAAAAAAAAAAZAUAAAAEdW5pdAUAAAADbmlsCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAVzbG90MQIAAAABXwUAAAAFc2xvdDICAAAAAV8FAAAABXNsb3QzCQABLAAAAAIJAAEsAAAAAgUAAAAGcGxheWVyAgAAAAFfBQAAAAl0aW1lc3RhbXAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQUAAAADbmlsAAAAAQAAAANpbnYBAAAABWxvdHRvAAAAAAkBAAAACnN0YXJ0TG90dG8AAAABBQAAAANpbnYAAAAAVf+YHw==", "chainId": 84, "height": 604644, "spentComplexity": 0 } View: original | compacted Prev: 4K2HuvdHGHuryuTbbwHZRb8AWxbJCxfMdj6eqRiGiNvd Next: FD7G7Z3QBrb63cpHzHGgYW9DMybNvU2qQtzeAm4hrViq Diff:
Old | New | Differences | |
---|---|---|---|
52 | 52 | let randhash = randomizer(inv) | |
53 | 53 | let timestamp = toString(lastBlock.timestamp) | |
54 | 54 | if (if (if ((smt1 == 1)) | |
55 | - | then | |
56 | - | else | |
57 | - | then | |
58 | - | else | |
55 | + | then (smt2 == 1) | |
56 | + | else false) | |
57 | + | then (smt3 == 1) | |
58 | + | else false) | |
59 | 59 | then ScriptResult(WriteSet([DataEntry(((((slot1 + "_") + slot2) + "_") + slot3), ((player + "_") + timestamp))]), TransferSet([ScriptTransfer(inv.caller, ((payment.amount * 190) / 100), unit)])) | |
60 | 60 | else ScriptResult(WriteSet([DataEntry(((((slot1 + "_") + slot2) + "_") + slot3), ((player + "_") + timestamp))]), TransferSet(nil)) | |
61 | 61 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let slotCount = 100 | |
5 | 5 | ||
6 | 6 | let slots = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5] | |
7 | 7 | ||
8 | 8 | func randomizer (inv) = { | |
9 | 9 | let rand = ((((inv.transactionId + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
10 | 10 | sha256(rand) | |
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func getSlot1 (inv) = { | |
15 | 15 | let hash = sha256(((((inv.transactionId + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))) | |
16 | 16 | let index = toInt(hash) | |
17 | 17 | slots[(index % slotCount)] | |
18 | 18 | } | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func getSlot2 (inv) = { | |
22 | 22 | let hash = sha256(((((inv.transactionId + lastBlock.generationSignature) + inv.callerPublicKey) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))) | |
23 | 23 | let index = toInt(hash) | |
24 | 24 | slots[(index % slotCount)] | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getSlot3 (inv) = { | |
29 | 29 | let hash = sha256(((((inv.callerPublicKey + inv.transactionId) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))) | |
30 | 30 | let index = toInt(hash) | |
31 | 31 | slots[(index % slotCount)] | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func startLotto (inv) = { | |
36 | 36 | let MaxBet = (wavesBalance(this) / 100) | |
37 | 37 | let payment = extract(inv.payment) | |
38 | 38 | let slot1 = toString(getSlot1(inv)) | |
39 | 39 | let slot2 = toString(getSlot2(inv)) | |
40 | 40 | let slot3 = toString(getSlot3(inv)) | |
41 | 41 | let smt1 = getSlot1(inv) | |
42 | 42 | let smt2 = getSlot2(inv) | |
43 | 43 | let smt3 = getSlot3(inv) | |
44 | 44 | if (!(isDefined(inv.payment))) | |
45 | 45 | then throw("Should be with Payment in Waves") | |
46 | 46 | else if (isDefined(payment.assetId)) | |
47 | 47 | then throw("Payment should be in Waves") | |
48 | 48 | else if ((payment.amount > MaxBet)) | |
49 | 49 | then throw(("Payment should be less than " + toString(MaxBet))) | |
50 | 50 | else { | |
51 | 51 | let player = toBase58String(inv.caller.bytes) | |
52 | 52 | let randhash = randomizer(inv) | |
53 | 53 | let timestamp = toString(lastBlock.timestamp) | |
54 | 54 | if (if (if ((smt1 == 1)) | |
55 | - | then | |
56 | - | else | |
57 | - | then | |
58 | - | else | |
55 | + | then (smt2 == 1) | |
56 | + | else false) | |
57 | + | then (smt3 == 1) | |
58 | + | else false) | |
59 | 59 | then ScriptResult(WriteSet([DataEntry(((((slot1 + "_") + slot2) + "_") + slot3), ((player + "_") + timestamp))]), TransferSet([ScriptTransfer(inv.caller, ((payment.amount * 190) / 100), unit)])) | |
60 | 60 | else ScriptResult(WriteSet([DataEntry(((((slot1 + "_") + slot2) + "_") + slot3), ((player + "_") + timestamp))]), TransferSet(nil)) | |
61 | 61 | } | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | @Callable(inv) | |
66 | 66 | func lotto () = startLotto(inv) | |
67 | 67 | ||
68 | 68 |
github/deemru/w8io/026f985 29.78 ms ◑