tx · DtZaSYVa76hQMWjRu7PX7XbushugsRUsxNRBe86hvvaB 3N4Ncsai2RZG8Vk8oKMJ9jzrdsGh8PdME7s: -0.01000000 Waves 2019.11.27 13:58 [783586] smart account 3N4Ncsai2RZG8Vk8oKMJ9jzrdsGh8PdME7s > SELF 0.00000000 Waves
{ "type": 13, "id": "DtZaSYVa76hQMWjRu7PX7XbushugsRUsxNRBe86hvvaB", "fee": 1000000, "feeAssetId": null, "timestamp": 1574852396605, "version": 1, "sender": "3N4Ncsai2RZG8Vk8oKMJ9jzrdsGh8PdME7s", "senderPublicKey": "6ThX2m5Hmm2YdbgwbRpYHacDYAskKpQMWj46ucdFeupg", "proofs": [ "M8hfFLUYvhMXXjDJMXf1ztVoWcQMpA6NJz5xg8f9HfJNXSpY5ge25BAV6MBDtUZNzzSe5rGmsiodDwZK8ntJ5yN" ], "script": "base64:AAIDAAAAAAAAABAIARIDCgEIEgASAwoBCBIAAAAABAAAAAAMb3duZXJBZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUGPOYcu2HgMg0RhTmyQsqXREEy3be997yAAAAABBsb3R0ZXJ5VGlja2V0SHViCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFU0eiTIYL4hDW29dsqS/AoWA+j0n0l6eKKAAAAABNsb3R0ZXJ5QWRtaW5BZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUGPOYcu2HgMg0RhTmyQsqXREEy3be997yAAAAABFkQXBwUmFuZG9tQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVHuu+H80lmUlbX4/sSpu4BMiHCfMg3xRygAAAAQAAAAKY29udGV4dE9iagEAAAAXcmVnaXN0ZXJSYW5kb21SZXF1ZXN0VHgAAAABAAAAD3JhbmRvbVJlcXVlc3RUeAMJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAABHRoaXMCAAAAD3JhbmRvbVJlcXVlc3RUeAkAAAIAAAABAgAAACdyYW5kb21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XZlc0JhbGFuY2UAAAABBQAAAAR0aGlzBQAAAAR1bml0BQAAAANuaWwDAwMJAAAAAAAAAggFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAABNsb3R0ZXJ5QWRtaW5BZGRyZXNzBgkAAAAAAAACCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADG93bmVyQWRkcmVzcwkAAGYAAAACBQAAAAZoZWlnaHQJAABkAAAAAgUAAAAJd2luSGVpZ2h0BQAAAAVtb250aAcJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAMb3duZXJBZGRyZXNzCQEAAAAMd2F2ZXNCYWxhbmNlAAAAAQUAAAAEdGhpcwUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAHHlvdSBjYW4ndCB3aXRoZHJhdyB0aGUgZnVuZHMAAAAA9DFTfA==", "chainId": 84, "height": 783586, "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'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP') | |
5 | + | ||
6 | + | let b = Address(base58'3N93ycb6Sxsr6i5DyDhkijcNRya84PeyipH') | |
7 | + | ||
8 | + | let c = Address(base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP') | |
9 | + | ||
10 | + | let d = Address(base58'3N1C4Vh7ZqXUUy7RFm4c7uEFHE2Yt4KByhB') | |
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)]) | |
19 | + | else throw("only loteryOwner can start the lottery") | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(e) | |
24 | + | func checkRandom () = { | |
25 | + | let g = getStringValue(this, "randomRequestTx") | |
26 | + | let h = getStringValue(d, g) | |
27 | + | let i = split(h, "_")[0] | |
28 | + | let j = split(h, "--")[1] | |
29 | + | if ((i == "FINISHED")) | |
30 | + | then WriteSet([DataEntry("randomResult", parseIntValue(j))]) | |
31 | + | else throw("Incorrect random result") | |
32 | + | } | |
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | @Callable(e) | |
37 | + | func defineTheWinner (k) = { | |
38 | + | let j = getIntegerValue(this, "randomResult") | |
39 | + | if (isDefined(getInteger(b, ("winningTicket" + toString(j))))) | |
40 | + | then { | |
41 | + | let l = getIntegerValue(b, "ticketAmount") | |
42 | + | let m = if ((j == l)) | |
43 | + | then 1 | |
44 | + | else (j + 1) | |
45 | + | WriteSet([DataEntry("randomResult", m)]) | |
46 | + | } | |
47 | + | else { | |
48 | + | let n = parseIntValue(split(split(k, "To")[0], "ticketsFrom")[1]) | |
49 | + | let o = parseIntValue(split(k, "To")[1]) | |
50 | + | if (if ((j >= n)) | |
51 | + | then (o >= j) | |
52 | + | else false) | |
53 | + | then { | |
54 | + | let p = getStringValue(b, k) | |
55 | + | WriteSet([DataEntry("winnerTicket", j), DataEntry("winnerAddress", p), DataEntry("winHeight", height)]) | |
56 | + | } | |
57 | + | else throw("these tickets didn't win") | |
58 | + | } | |
59 | + | } | |
60 | + | ||
61 | + | ||
62 | + | ||
63 | + | @Callable(e) | |
64 | + | func withdraw () = { | |
65 | + | let p = addressFromStringValue(getStringValue(this, "winnerAddress")) | |
66 | + | let q = getIntegerValue(this, "winHeight") | |
67 | + | let r = 43200 | |
68 | + | if (if ((e.caller == p)) | |
69 | + | then ((q + r) >= height) | |
70 | + | else false) | |
71 | + | then TransferSet([ScriptTransfer(p, wavesBalance(this), unit)]) | |
72 | + | else if (if (if ((e.caller == c)) | |
73 | + | then true | |
74 | + | else (e.caller == a)) | |
75 | + | then (height > (q + r)) | |
76 | + | else false) | |
77 | + | then TransferSet([ScriptTransfer(a, wavesBalance(this), unit)]) | |
78 | + | else throw("you can't withdraw the funds") | |
79 | + | } | |
80 | + | ||
81 | + |
github/deemru/w8io/169f3d6 31.36 ms ◑