tx · Afqz8Yp6kzoaChDERnaN9TLEeBEj6X3zCMT9XvZAWktf 3MugaWDovwskWUMov8XUjB1zsWAUSznheXZ: -0.01000000 Waves 2019.11.21 16:15 [774995] smart account 3MugaWDovwskWUMov8XUjB1zsWAUSznheXZ > SELF 0.00000000 Waves
{ "type": 13, "id": "Afqz8Yp6kzoaChDERnaN9TLEeBEj6X3zCMT9XvZAWktf", "fee": 1000000, "feeAssetId": null, "timestamp": 1574342163666, "version": 1, "sender": "3MugaWDovwskWUMov8XUjB1zsWAUSznheXZ", "senderPublicKey": "AYLh5PtxU74Z83Sdi1CZbuoXWRsubEaFw1FLQxjWDjqP", "proofs": [ "9tofnP495hX2mAPonxzQQY3HHVUWfD6ecCkUzm7GNdxdjZ3MGpZHXvofSdcidPCztkCWc5WFJ4cJTJxNhrgqqfQ" ], "script": "base64:AAIDAAAAAAAAAA4IARIDCgEIEgASAwoBCAAAAAQAAAAAEGxvdHRlcnlUaWNrZXRIdWIJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVSC55hpYARw/MBFqc24rdbL0z1qhgL8B1oAAAAADGxvdHRlcnlPd25lcgIAAAAjM011Z2FXRG92d3NrV1VNb3Y4WFVqQjF6c1dBVVN6bmhlWFoAAAAAC293bmVyUHViS2V5AQAAACCNwHO6L9pJ14g8N8Z7UpPEWTMZicTTiaTuie5VyMOsDgAAAAARZEFwcFJhbmRvbUFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVSCOmgm+YYukYEdK0aRU3x2fI8wwLXo1f8AAAADAAAACmNvbnRleHRPYmoBAAAAF3JlZ2lzdGVyUmFuZG9tUmVxdWVzdFR4AAAAAQAAAA9yYW5kb21SZXF1ZXN0VHgDCQEAAAAJaXNEZWZpbmVkAAAAAQkABB0AAAACBQAAAAR0aGlzAgAAAA9yYW5kb21SZXF1ZXN0VHgJAAACAAAAAQIAAAAncmFuZG9tUmVxdWVzdFR4IGlzIGFscmVhZHkgaW4gdGhlIHN0YXRlAw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AAAAGaGVpZ2h0BQAAAA5oZWlnaHRFbmRMZWFzZQkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAC293bmVyUHViS2V5BwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAMJAABmAAAAAgUAAAAGaGVpZ2h0BQAAAA5oZWlnaHRFbmRMZWFzZQkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAC293bmVyUHViS2V5BwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAC293bmVyUHViS2V5eJPpSQ==", "chainId": 84, "height": 774995, "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'3N1rF4PLyqW2W7f24LjoVB4AtKEVMssx31T') | |
5 | + | ||
6 | + | let b = "3MugaWDovwskWUMov8XUjB1zsWAUSznheXZ" | |
7 | + | ||
8 | + | let c = base58'AYLh5PtxU74Z83Sdi1CZbuoXWRsubEaFw1FLQxjWDjqP' | |
9 | + | ||
10 | + | let d = Address(base58'3N1nfb37S1VkVNNmhYN5F3hr6UjRs67rLar') | |
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 == addressFromString(b))) | |
18 | + | then WriteSet([DataEntry("randomRequestTx", f)]) | |
19 | + | else throw("only owner 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(a, ("winningTicket" + toString(j))))) | |
40 | + | then { | |
41 | + | let l = getIntegerValue(a, "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(k, "To")[1]) | |
49 | + | let o = parseIntValue(split(split(k, "To")[0], "ticketsFrom")[1]) | |
50 | + | if (if ((j >= n)) | |
51 | + | then (o >= j) | |
52 | + | else false) | |
53 | + | then { | |
54 | + | let p = getStringValue(a, k) | |
55 | + | WriteSet([DataEntry("winnerTicket", j), DataEntry("winnerAddress", p)]) | |
56 | + | } | |
57 | + | else throw("these tickets didn't win") | |
58 | + | } | |
59 | + | } | |
60 | + | ||
61 | + | ||
62 | + | @Verifier(q) | |
63 | + | func r () = { | |
64 | + | let s = 1 | |
65 | + | let t = 1000000000000 | |
66 | + | let u = q | |
67 | + | if ($isInstanceOf(u, "LeaseTransaction")) | |
68 | + | then { | |
69 | + | let v = u | |
70 | + | if (if (if ((height > s)) | |
71 | + | then (t > height) | |
72 | + | else false) | |
73 | + | then isDefined(getString(this, "winnerAddress")) | |
74 | + | else false) | |
75 | + | then (v.recipient == addressFromString(getStringValue(this, "winnerAddress"))) | |
76 | + | else false | |
77 | + | } | |
78 | + | else if ($isInstanceOf(u, "LeaseCancelTransaction")) | |
79 | + | then { | |
80 | + | let w = u | |
81 | + | if ((height > t)) | |
82 | + | then sigVerify(q.bodyBytes, q.proofs[0], c) | |
83 | + | else false | |
84 | + | } | |
85 | + | else if ($isInstanceOf(u, "TransferTransaction")) | |
86 | + | then { | |
87 | + | let x = u | |
88 | + | if ((height > t)) | |
89 | + | then sigVerify(q.bodyBytes, q.proofs[0], c) | |
90 | + | else false | |
91 | + | } | |
92 | + | else sigVerify(q.bodyBytes, q.proofs[0], c) | |
93 | + | } | |
94 | + |
github/deemru/w8io/169f3d6 15.81 ms ◑