tx · 2as9TnjHo2pu1BxK6VttkgSZq1uSKQXimx9HV1SumSDp 3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP: -0.01400000 Waves 2019.11.14 18:53 [764939] smart account 3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP > SELF 0.00000000 Waves
{ "type": 13, "id": "2as9TnjHo2pu1BxK6VttkgSZq1uSKQXimx9HV1SumSDp", "fee": 1400000, "feeAssetId": null, "timestamp": 1573746831408, "version": 1, "sender": "3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP", "senderPublicKey": "3bmZaUZ9wp3K1YZQFqTkN1oZzumQPi7WLQ9QowMaqqEZ", "proofs": [ "5wmK752fwtYvStswZA4tqWJfY7F8Fk5JdCucB8nR7i34CGGXCWEA3pypMnLjKdTeNtaf4dVgu194ZG4nCXEigHm8" ], "script": "base64:AAIDAAAAAAAAAA0IARIDCgEIEgQKAggBAAAAAgAAAAALdGlja2V0UHJpY2UAAAAAAAAAJxAAAAAABU1SVGlkAgAAACw4YWZZcmJEQnI2VHc1SmdhV1VnbTJHbmNZN3JMODdKdkdHN2FXZXpXTUdnWgAAAAIAAAAKY29udGV4dE9iagEAAAAJYnV5VGlja2V0AAAAAQAAAA1hZGRyZXNUb0xlYXNlBAAAAAckbWF0Y2gwCAUAAAAKY29udGV4dE9iagAAAAdwYXltZW50AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9BdHRhY2hlZFBheW1lbnQEAAAAAXAFAAAAByRtYXRjaDADAwkAAAAAAAACCAUAAAABcAAAAAZhbW91bnQFAAAAC3RpY2tldFByaWNlCQAAAAAAAAIJAAJYAAAAAQkBAAAAB2V4dHJhY3QAAAABCAUAAAABcAAAAAdhc3NldElkBQAAAAVNUlRpZAcEAAAAD3RpY2tldEFtb3VudE5ldwkAAGQAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAx0aWNrZXRBbW91bnQAAAAAAAAAAAEJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAGdGlja2V0CQABpAAAAAEFAAAAD3RpY2tldEFtb3VudE5ldwUAAAANYWRkcmVzVG9MZWFzZQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAMdGlja2V0QW1vdW50BQAAAA90aWNrZXRBbW91bnROZXcFAAAAA25pbAkAAAIAAAABAgAAACZJbmNvcnJlY3QgYW1vdW50IG9yIGFzc2V0SWQgaW4gcGF5bWVudAkAAAIAAAABAgAAABRQYXltZW50IG5vdCBhdHRhY2hlZAAAAApjb250ZXh0T2JqAQAAAAlhZGRXaW5uZXIAAAACAAAAB2xvdHRlcnkAAAAGdGlja2V0BAAAAA5sb3R0ZXJ5QWRkcmVzcwkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABBQAAAAdsb3R0ZXJ5AwkBAAAACWlzRGVmaW5lZAAAAAEJAAQdAAAAAgUAAAAEdGhpcwUAAAAHbG90dGVyeQQAAAANd2lubmVyQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADXdpbm5lckFkZHJlc3MEAAAADHdpbm5lclRpY2tldAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADHdpbm5lclRpY2tldAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAA13aW5uaW5nVGlja2V0CQABpAAAAAEFAAAADHdpbm5lclRpY2tldAUAAAANd2lubmVyQWRkcmVzcwUAAAADbmlsCQAAAgAAAAECAAAAI3lvdSB0b3VjaCBpbmNvcnJlY3QgbG90dGVyeSBhZGRyZXNzAAAAALy/BIE=", "chainId": 84, "height": 764939, "spentComplexity": 0 } View: original | compacted Prev: 6bPHhC8KvqeM2bti86ee4R6bzFWK7LKk3Ayig3YZgo8y Next: AEaHTefo6PjA3d37Cv6rkSjs1kKJjWy7ZVWUQTYrAQbC Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = | |
4 | + | let a = 10000 | |
5 | 5 | ||
6 | - | let b = " | |
6 | + | let b = "8afYrbDBr6Tw5JgaWUgm2GncY7rL87JvGG7aWezWMGgZ" | |
7 | 7 | ||
8 | - | let c = base58'CBoRgqiPjXZMaoN8BwCSFfXsRX5jvNDiZ9SArkfMQX1Z' | |
9 | - | ||
10 | - | let d = Address(base58'3Mt1uo5ieYK8Pk9XyVZp88HBLMfprrq515z') | |
11 | - | ||
12 | - | @Callable(e) | |
13 | - | func randomRequestTxIdRecord (f) = if (isDefined(getString(this, "randomRequestTxId"))) | |
14 | - | then throw("randomIdTx is already in the state") | |
15 | - | else if ((e.caller == addressFromString(b))) | |
16 | - | then WriteSet([DataEntry("randomRequestTxId", f)]) | |
17 | - | else throw("only owner can start the lottery") | |
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | @Callable(e) | |
22 | - | func checkRandom () = { | |
23 | - | let g = getStringValue(this, "randomRequestTxId") | |
24 | - | let h = getStringValue(d, g) | |
25 | - | let i = split(h, "_")[0] | |
26 | - | let j = split(h, "--")[1] | |
27 | - | if ((i == "FINISHED")) | |
28 | - | then WriteSet([DataEntry("randomResult", parseIntValue(j))]) | |
29 | - | else throw("Incorrect random result") | |
8 | + | @Callable(c) | |
9 | + | func buyTicket (d) = { | |
10 | + | let e = c.payment | |
11 | + | if ($isInstanceOf(e, "AttachedPayment")) | |
12 | + | then { | |
13 | + | let f = e | |
14 | + | if (if ((f.amount == a)) | |
15 | + | then (toBase58String(extract(f.assetId)) == b) | |
16 | + | else false) | |
17 | + | then { | |
18 | + | let g = (getIntegerValue(this, "ticketAmount") + 1) | |
19 | + | WriteSet([DataEntry(("ticket" + toString(g)), d), DataEntry("ticketAmount", g)]) | |
20 | + | } | |
21 | + | else throw("Incorrect amount or assetId in payment") | |
22 | + | } | |
23 | + | else throw("Payment not attached") | |
30 | 24 | } | |
31 | 25 | ||
32 | 26 | ||
33 | 27 | ||
34 | - | @Callable( | |
35 | - | func | |
36 | - | let j = | |
37 | - | if (isDefined( | |
28 | + | @Callable(c) | |
29 | + | func addWinner (h,i) = { | |
30 | + | let j = extract(addressFromString(h)) | |
31 | + | if (isDefined(getString(this, h))) | |
38 | 32 | then { | |
39 | - | let k = getIntegerValue(a, "ticketAmount") | |
40 | - | let l = if ((j == k)) | |
41 | - | then 1 | |
42 | - | else (j + 1) | |
43 | - | WriteSet([DataEntry("randomResult", l)]) | |
33 | + | let k = getStringValue(j, "winnerAddress") | |
34 | + | let l = getIntegerValue(j, "winnerTicket") | |
35 | + | WriteSet([DataEntry(("winningTicket" + toString(l)), k)]) | |
44 | 36 | } | |
45 | - | else { | |
46 | - | let m = getStringValue(a, ("ticket" + toString(j))) | |
47 | - | WriteSet([DataEntry("winnerTicket", j), DataEntry("winnerAddress", m)]) | |
48 | - | } | |
37 | + | else throw("you touch incorrect lottery address") | |
49 | 38 | } | |
50 | 39 | ||
51 | - | ||
52 | - | @Verifier(n) | |
53 | - | func o () = { | |
54 | - | let p = 1 | |
55 | - | let q = 0 | |
56 | - | let r = n | |
57 | - | if ($isInstanceOf(r, "LeaseTransaction")) | |
58 | - | then { | |
59 | - | let s = r | |
60 | - | if (if (if ((height > p)) | |
61 | - | then (q > height) | |
62 | - | else false) | |
63 | - | then isDefined(getString(this, "winnerAddress")) | |
64 | - | else false) | |
65 | - | then (s.recipient == addressFromString(getStringValue(this, "winnerAddress"))) | |
66 | - | else false | |
67 | - | } | |
68 | - | else if ($isInstanceOf(r, "LeaseCancelTransaction")) | |
69 | - | then { | |
70 | - | let t = r | |
71 | - | if ((height > p)) | |
72 | - | then sigVerify(n.bodyBytes, n.proofs[0], c) | |
73 | - | else false | |
74 | - | } | |
75 | - | else if ($isInstanceOf(r, "TransferTransaction")) | |
76 | - | then { | |
77 | - | let u = r | |
78 | - | if ((height > p)) | |
79 | - | then sigVerify(n.bodyBytes, n.proofs[0], c) | |
80 | - | else false | |
81 | - | } | |
82 | - | else true | |
83 | - | } | |
84 | 40 |
github/deemru/w8io/169f3d6 44.78 ms ◑