tx · DTm645UvT38LG1GxnuK3iGGTC3wppja168pbkTe5fFKv 3N9NHwzQ71FBoT5ZSkNRsN3wXYjv5bXGRps: -0.01000000 Waves 2019.12.02 18:24 [791225] smart account 3N9NHwzQ71FBoT5ZSkNRsN3wXYjv5bXGRps > SELF 0.00000000 Waves
{ "type": 13, "id": "DTm645UvT38LG1GxnuK3iGGTC3wppja168pbkTe5fFKv", "fee": 1000000, "feeAssetId": null, "timestamp": 1575300251099, "version": 1, "sender": "3N9NHwzQ71FBoT5ZSkNRsN3wXYjv5bXGRps", "senderPublicKey": "F8zHygscSxm1jUVMYQ5FvJLFRVTsjeWbupKmwcHUdXtj", "proofs": [ "4Kjdjf3QPH5eVd38hdU5o8GGe75oxqSTYXC7kcEke9TxCh53aj8uHxs7TmwmMxTFbrK7JePmDjDhNq3TzrFTLtUX" ], "script": "base64:AAIDAAAAAAAAAA4IARIDCgEIEgMKAQgSAAAAAAQAAAAADG93bmVyQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVCKO49UfdVacf8Y0Qj59HGp7V9voyjFs/QAAAAAQbG90dGVyeVRpY2tldEh1YgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVK3GPSss35hRHdNF2I50f/VCvX4a8IQcogAAAAATbG90dGVyeUFkbWluQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVCKO49UfdVacf8Y0Qj59HGp7V9voyjFs/QAAAAARZEFwcFJhbmRvbUFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQijuPVH3VWnH/GNEI+fRxqe1fb6MoxbP0AAAADAAAACmNvbnRleHRPYmoBAAAAF3JlZ2lzdGVyUmFuZG9tUmVxdWVzdFR4AAAAAQAAAA9yYW5kb21SZXF1ZXN0VHgDCQEAAAAJaXNEZWZpbmVkAAAAAQkABB0AAAACBQAAAAR0aGlzAgAAAA9yYW5kb21SZXF1ZXN0VHgJAAACAAAAAQIAAAAncmFuZG9tUmVxdWVzdFR4I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AAAAZjYWxsZXIFAAAADG93bmVyQWRkcmVzcwkAAGYAAAACBQAAAAZoZWlnaHQJAABkAAAAAgUAAAALc3RhcnRIZWlnaHQFAAAABW1vbnRoBwkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAxvd25lckFkZHJlc3MJAQAAAAx3YXZlc0JhbGFuY2UAAAABBQAAAAR0aGlzBQAAAAR1bml0BQAAAANuaWwJAAACAAAAAQIAAAAceW91IGNhbid0IHdpdGhkcmF3IHRoZSBmdW5kcwAAAABd/GT0", "chainId": 84, "height": 791225, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = Address(base58'3Ms4ovcT1Rtq2BExHqRbBMUeKCYmDSSGGV2') | |
5 | + | ||
6 | + | let b = Address(base58'3N5kv9zPPj9YbiMXbCeiCNf9o5B5M9NC4Ps') | |
7 | + | ||
8 | + | let c = Address(base58'3Ms4ovcT1Rtq2BExHqRbBMUeKCYmDSSGGV2') | |
9 | + | ||
10 | + | let d = Address(base58'3Ms4ovcT1Rtq2BExHqRbBMUeKCYmDSSGGV2') | |
11 | + | ||
12 | + | @Callable(e) | |
13 | + | func registerRandomRequestTx (f) = if (isDefined(getString(this, "randomRequestTx"))) | |
14 | + | then throw("randomRequestTx is already in the state") | |
15 | + | else if (isDefined(transactionHeightById(fromBase58String(f)))) | |
16 | + | then throw("You try register tx which is already in blockchain") | |
17 | + | else if ((e.caller == c)) | |
18 | + | then WriteSet([DataEntry("randomRequestTx", f), DataEntry("startHeight", height)]) | |
19 | + | else throw("only loteryOwner can start the lottery") | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(e) | |
24 | + | func defineTheWinner (g) = { | |
25 | + | let h = getStringValue(this, "randomRequestTx") | |
26 | + | let i = getStringValue(d, h) | |
27 | + | let j = split(i, "_")[0] | |
28 | + | let k = split(i, "--")[1] | |
29 | + | let l = parseIntValue(k) | |
30 | + | if (isDefined(getInteger(b, ("winningTicket" + k)))) | |
31 | + | then { | |
32 | + | let m = getIntegerValue(b, "ticketAmount") | |
33 | + | let n = if ((l == m)) | |
34 | + | then 1 | |
35 | + | else (l + 1) | |
36 | + | WriteSet([DataEntry("randomResult", n)]) | |
37 | + | } | |
38 | + | else { | |
39 | + | let o = parseIntValue(split(split(g, "To")[0], "ticketsFrom")[1]) | |
40 | + | let p = parseIntValue(split(g, "To")[1]) | |
41 | + | if (if ((l >= o)) | |
42 | + | then (p >= l) | |
43 | + | else false) | |
44 | + | then { | |
45 | + | let q = getStringValue(b, g) | |
46 | + | WriteSet([DataEntry("winnerTicket", l), DataEntry("winnerAddress", q)]) | |
47 | + | } | |
48 | + | else throw("these tickets didn't win") | |
49 | + | } | |
50 | + | } | |
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | @Callable(e) | |
55 | + | func withdraw () = { | |
56 | + | let q = addressFromStringValue(getStringValue(this, "winnerAddress")) | |
57 | + | let r = getIntegerValue(this, "startHeight") | |
58 | + | let s = 43200 | |
59 | + | if (if ((e.caller == q)) | |
60 | + | then ((r + s) >= height) | |
61 | + | else false) | |
62 | + | then ScriptResult(WriteSet([DataEntry("withdrawn", true)]), TransferSet([ScriptTransfer(q, wavesBalance(this), unit)])) | |
63 | + | else if (if (if ((e.caller == c)) | |
64 | + | then true | |
65 | + | else (e.caller == a)) | |
66 | + | then (height > (r + s)) | |
67 | + | else false) | |
68 | + | then TransferSet([ScriptTransfer(a, wavesBalance(this), unit)]) | |
69 | + | else throw("you can't withdraw the funds") | |
70 | + | } | |
71 | + | ||
72 | + |
github/deemru/w8io/026f985 21.44 ms ◑