tx · HZzF1N2K8hMA5EorfmihtGYn6LUVSWYspDXFBwQqSyES 3MwsbqwMs3CtRrcB3dAymQDkMBfKN7SJnt4: -0.01000000 Waves 2019.12.05 13:27 [795308] smart account 3MwsbqwMs3CtRrcB3dAymQDkMBfKN7SJnt4 > SELF 0.00000000 Waves
{ "type": 13, "id": "HZzF1N2K8hMA5EorfmihtGYn6LUVSWYspDXFBwQqSyES", "fee": 1000000, "feeAssetId": null, "timestamp": 1575541680767, "version": 1, "sender": "3MwsbqwMs3CtRrcB3dAymQDkMBfKN7SJnt4", "senderPublicKey": "4oAEYdnoZ2U89qAmPhUtgt92vNainye9zo71dXivEM4d", "proofs": [ "3Jh1AbfGViocL1ZPyENuitaPNm79oxyaHwqz9XrhTT1yArEoBHUyw3bReG4n3V2vTHYsfKTRSKiVDNY8XWez5nxo" ], "script": "base64:AAIDAAAAAAAAAA4IARIDCgEIEgMKAQgSAAAAAAYAAAAADG93bmVyQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVCKO49UfdVacf8Y0Qj59HGp7V9voyjFs/QAAAAAJdGlja2V0SHViCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUmahQH4tGDWL7q9Ff5lBDRTy7cQCV70WgAAAAABNsb3R0ZXJ5QWRtaW5BZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUf94ftL4Vg1lJrIjOemFa/6T/nk84vWbZAAAAABFkQXBwUmFuZG9tQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVH/eH7S+FYNZSayIznphWv+k/55POL1m2QAAAAAOd2l0aGRyYXdQZXJpb2QAAAAAAAAAqMABAAAAEmV4dHJhY3RSYW5kb21WYWx1ZQAAAAAEAAAAE3JlcXVlc3RDb21taXRlZFR4SWQJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAAD3JhbmRvbVJlcXVlc3RUeAQAAAAOb3JhY2xlUmVzcG9uc2UJAQAA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AAAEdGhpcwUAAAAEdW5pdAUAAAADbmlsAwMDCQAAAAAAAAIIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAATbG90dGVyeUFkbWluQWRkcmVzcwYJAAAAAAAAAggFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAAxvd25lckFkZHJlc3MJAABmAAAAAgUAAAAGaGVpZ2h0CQAAZAAAAAIFAAAAC3N0YXJ0SGVpZ2h0BQAAAAVtb250aAcJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAMb3duZXJBZGRyZXNzCQEAAAAMd2F2ZXNCYWxhbmNlAAAAAQUAAAAEdGhpcwUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAHHlvdSBjYW4ndCB3aXRoZHJhdyB0aGUgZnVuZHMAAAAAhku9TQ==", "chainId": 84, "height": 795308, "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'3N3vYnrvY2BqoM2xPnrtpBCQ4rcbzK1SHTM') | |
7 | + | ||
8 | + | let c = Address(base58'3N1aBgieFCpxDJorNX7i41KWaP974Ci9roS') | |
9 | + | ||
10 | + | let d = Address(base58'3N1aBgieFCpxDJorNX7i41KWaP974Ci9roS') | |
11 | + | ||
12 | + | let e = 43200 | |
13 | + | ||
14 | + | func f () = { | |
15 | + | let g = getStringValue(this, "randomRequestTx") | |
16 | + | let h = getStringValue(d, g) | |
17 | + | let i = getInteger(this, "randomResult") | |
18 | + | if ($isInstanceOf(i, "Int")) | |
19 | + | then { | |
20 | + | let j = i | |
21 | + | toString(j) | |
22 | + | } | |
23 | + | else split(h, "--")[1] | |
24 | + | } | |
25 | + | ||
26 | + | ||
27 | + | @Callable(k) | |
28 | + | func registerRandomRequestTx (l) = if (isDefined(getString(this, "randomRequestTx"))) | |
29 | + | then throw("randomRequestTx is already in the state") | |
30 | + | else if (isDefined(transactionHeightById(fromBase58String(l)))) | |
31 | + | then throw("You try register tx which is already in blockchain") | |
32 | + | else if ((k.caller == c)) | |
33 | + | then WriteSet([DataEntry("randomRequestTx", l), DataEntry("startHeight", height)]) | |
34 | + | else throw("only loteryOwner can start the lottery") | |
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | @Callable(k) | |
39 | + | func defineTheWinner (m) = { | |
40 | + | let n = f() | |
41 | + | let o = parseIntValue(n) | |
42 | + | if (isDefined(getInteger(this, "winnerTicket"))) | |
43 | + | then throw("winner is already defined") | |
44 | + | else if (isDefined(getString(b, ("winningTicket" + n)))) | |
45 | + | then { | |
46 | + | let p = getIntegerValue(b, "ticketAmountTotal") | |
47 | + | let q = if ((o == p)) | |
48 | + | then 1 | |
49 | + | else (o + 1) | |
50 | + | WriteSet([DataEntry("randomResult", q)]) | |
51 | + | } | |
52 | + | else { | |
53 | + | let r = parseIntValue(split(split(m, "To")[0], "ticketsFrom")[1]) | |
54 | + | let s = parseIntValue(split(m, "To")[1]) | |
55 | + | if (if ((o >= r)) | |
56 | + | then (s >= o) | |
57 | + | else false) | |
58 | + | then { | |
59 | + | let t = getStringValue(b, m) | |
60 | + | WriteSet([DataEntry("winnerTicket", o), DataEntry("winnerAddress", t)]) | |
61 | + | } | |
62 | + | else throw("these tickets didn't win") | |
63 | + | } | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | @Callable(k) | |
69 | + | func withdraw () = { | |
70 | + | let t = addressFromStringValue(getStringValue(this, "winnerAddress")) | |
71 | + | let u = getIntegerValue(this, "startHeight") | |
72 | + | let v = e | |
73 | + | if (if ((k.caller == t)) | |
74 | + | then ((u + v) >= height) | |
75 | + | else false) | |
76 | + | then TransferSet([ScriptTransfer(t, wavesBalance(this), unit)]) | |
77 | + | else if (if (if ((k.caller == c)) | |
78 | + | then true | |
79 | + | else (k.caller == a)) | |
80 | + | then (height > (u + v)) | |
81 | + | else false) | |
82 | + | then TransferSet([ScriptTransfer(a, wavesBalance(this), unit)]) | |
83 | + | else throw("you can't withdraw the funds") | |
84 | + | } | |
85 | + | ||
86 | + |
github/deemru/w8io/026f985 20.92 ms ◑