tx · 5f776qj3EuGgbqAwAdtXrP831Uu2YmQRu5ySRe3DmgfZ 3MwgwDZnLzb7q84gJeig6D1arburw3DpV4z: -0.01000000 Waves 2019.11.27 11:21 [783438] smart account 3MwgwDZnLzb7q84gJeig6D1arburw3DpV4z > SELF 0.00000000 Waves
{ "type": 13, "id": "5f776qj3EuGgbqAwAdtXrP831Uu2YmQRu5ySRe3DmgfZ", "fee": 1000000, "feeAssetId": null, "timestamp": 1574842909058, "version": 1, "sender": "3MwgwDZnLzb7q84gJeig6D1arburw3DpV4z", "senderPublicKey": "BE2cR9z2a4qdJFyZDswGoMSTFEMw1bovMUn8J4HRTESB", "proofs": [ "3YQg2MeTwsdNXRRPJgpaamVTLaoj2RWcixJACF8cVv3edXMJiRVypF8Ya2S5wxu2NHMrXgAwNkQomtcBLf6g1xSJ" ], "script": "base64:AAIDAAAAAAAAABAIARIDCgEIEgASAwoBCBIAAAAABAAAAAAMb3duZXJBZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUGPOYcu2HgMg0RhTmyQsqXREEy3be997yAAAAABBsb3R0ZXJ5VGlja2V0SHViCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUMuXBP9D2QYR6y0mGIcNAhzAagKHX0TNWAAAAABNsb3R0ZXJ5QWRtaW5BZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUGPOYcu2HgMg0RhTmyQsqXREEy3be997yAAAAABFkQXBwUmFuZG9tQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVO4lilH+ZljL2Blh7NcbooKir82Eq1IdIAAAAAQAAAAKY29udGV4dE9iagEAAAAXcmVnaXN0ZXJSYW5kb21SZXF1ZXN0VHgAAAABAAAAD3JhbmRvbVJlcXVlc3RUeAMJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAABHRoaXMCAAAAD3JhbmRvbVJlcXVlc3RUeAkAAAIAAAABAgAAACdyYW5kb21SZXF1ZXN0VHgga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AAAAEdW5pdAUAAAAEdW5pdAUAAAADbmlsAwMJAAAAAAAAAggFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAAxvd25lckFkZHJlc3MJAABmAAAAAgUAAAAGaGVpZ2h0CQAAZAAAAAIFAAAACXdpbkhlaWdodAUAAAAFbW9udGgHCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADG93bmVyQWRkcmVzcwkAA+sAAAACBQAAAAR0aGlzBQAAAAR1bml0BQAAAAR1bml0BQAAAANuaWwJAAACAAAAAQIAAAAceW91IGNhbid0IHdpdGhkcmF3IHRoZSBmdW5kcwAAAACV1dTj", "chainId": 84, "height": 783438, "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'3MtZCoAHpDYdFrgk8r4RwyiKHtqJXsE3XSM') | |
7 | + | ||
8 | + | let c = Address(base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP') | |
9 | + | ||
10 | + | let d = Address(base58'3NBdHZvUtU5GQSk6i2AwASRVJsNshJ1bToV') | |
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, assetBalance(this, unit), unit)]) | |
72 | + | else if (if ((e.caller == a)) | |
73 | + | then (height > (q + r)) | |
74 | + | else false) | |
75 | + | then TransferSet([ScriptTransfer(a, assetBalance(this, unit), unit)]) | |
76 | + | else throw("you can't withdraw the funds") | |
77 | + | } | |
78 | + | ||
79 | + |
github/deemru/w8io/169f3d6 20.24 ms ◑